mirror of
https://github.com/corda/corda.git
synced 2025-06-14 13:18:18 +00:00
CORDA-2089 - network parameters tags - part (#4228)
* CORDA-2089 - network parameters tags - part Data structures changes, storage and notarisation. Tag transactions with network parameters hash that was in force when tx was created. Add component group on all core transactions and resolved parameters on full transactions. The hash should be always visible on the filtered versions of transactions. Add notarisation check that the parameters are current. Implement network parameters storage on services for resolution. This is only part of the work, next PR will include changes to ResolveTransactionsFlow to make sure that parameters in the transaction graph are ordered (this is to prevent the downgrade attack, when the malicious notary and participants sign transaction that shouldn't be notarised otherwise). Probably on network services side we need the default parameters endpoint for the transactions that were created before this change - for now it's default to the current ones. * Make parameters storage agnostic to cert hierarchy Test fixes * Address most PR comments * Fixes after rebase * Fixes. Add epoch column to parameters storage. * Address part of review comments * Some more comments * Hopefully fixing what I broke doing rebse * Address Kostas comments * Further fixes * Save all parameters from updates to storage * Fix integration test * Address comments * Fixes after rebase * Fix test * Fixes * Add wrapper for filtering around parameters hash * API stability fixes * Add NetworkParametersStorageInternal * Rename
This commit is contained in:
committed by
GitHub
parent
e4c1db4db6
commit
5d2ad46553
@ -15,7 +15,7 @@ import java.nio.file.Path
|
||||
import java.nio.file.StandardCopyOption
|
||||
import java.util.Collections.singleton
|
||||
|
||||
// When scanning of the CorDapp Jar is performed without "corda-core.jar" being the in the classpath, there is no way to appreciate
|
||||
// When scanning of the CorDapp Jar is performed without "corda-core.jar" being in the classpath, there is no way to appreciate
|
||||
// relationships between those interfaces, therefore they have to be listed explicitly.
|
||||
val coreContractClasses = setOf(Contract::class, UpgradedContractWithLegacyConstraint::class, UpgradedContract::class)
|
||||
|
||||
|
@ -4,13 +4,12 @@ import com.nhaarman.mockito_kotlin.any
|
||||
import com.nhaarman.mockito_kotlin.doReturn
|
||||
import com.nhaarman.mockito_kotlin.whenever
|
||||
import net.corda.core.contracts.*
|
||||
import net.corda.core.crypto.SecureHash
|
||||
import net.corda.core.identity.AbstractParty
|
||||
import net.corda.core.identity.CordaX500Name
|
||||
import net.corda.core.identity.Party
|
||||
import net.corda.core.internal.AbstractAttachment
|
||||
import net.corda.core.node.ServicesForResolution
|
||||
import net.corda.core.node.services.AttachmentStorage
|
||||
import net.corda.core.node.services.NetworkParametersStorage
|
||||
import net.corda.core.serialization.deserialize
|
||||
import net.corda.core.serialization.serialize
|
||||
import net.corda.core.transactions.LedgerTransaction
|
||||
@ -67,19 +66,18 @@ class AttachmentsClassLoaderStaticContractTests {
|
||||
}
|
||||
}
|
||||
|
||||
private val unsignedAttachment = object : AbstractAttachment({ byteArrayOf() }) {
|
||||
override val id: SecureHash get() = throw UnsupportedOperationException()
|
||||
private val networkParameters = testNetworkParameters()
|
||||
|
||||
private val networkParametersStorage get() = rigorousMock<NetworkParametersStorage>().also {
|
||||
doReturn(networkParameters.serialize().hash).whenever(it).currentHash
|
||||
}
|
||||
|
||||
private val attachments = rigorousMock<AttachmentStorage>().also {
|
||||
doReturn(unsignedAttachment).whenever(it).openAttachment(any())
|
||||
}
|
||||
|
||||
private val serviceHub = rigorousMock<ServicesForResolution>().also {
|
||||
private val serviceHub get() = rigorousMock<ServicesForResolution>().also {
|
||||
val cordappProviderImpl = CordappProviderImpl(cordappLoaderForPackages(listOf("net.corda.nodeapi.internal")), MockCordappConfigProvider(), MockAttachmentStorage())
|
||||
cordappProviderImpl.start(testNetworkParameters().whitelistedContractImplementations)
|
||||
doReturn(cordappProviderImpl).whenever(it).cordappProvider
|
||||
doReturn(testNetworkParameters()).whenever(it).networkParameters
|
||||
doReturn(networkParametersStorage).whenever(it).networkParametersStorage
|
||||
doReturn(networkParameters).whenever(it).networkParameters
|
||||
val attachmentStorage = rigorousMock<AttachmentStorage>()
|
||||
doReturn(attachmentStorage).whenever(it).attachments
|
||||
val attachment = rigorousMock<ContractAttachment>()
|
||||
|
Reference in New Issue
Block a user