diff --git a/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt b/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt index 4f98774738..84c2da76b0 100644 --- a/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt +++ b/node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt @@ -1201,7 +1201,7 @@ abstract class AbstractNode(val configuration: NodeConfiguration, override lateinit var networkParameters: NetworkParameters init { - this@AbstractNode.attachments.servicesForResolution = this + this@AbstractNode.attachments.nodeVerificationSupport = this } fun start(myInfo: NodeInfo, networkParameters: NetworkParameters) { diff --git a/node/src/main/kotlin/net/corda/node/services/persistence/NodeAttachmentService.kt b/node/src/main/kotlin/net/corda/node/services/persistence/NodeAttachmentService.kt index 7e4c06e5d8..fc17b10d77 100644 --- a/node/src/main/kotlin/net/corda/node/services/persistence/NodeAttachmentService.kt +++ b/node/src/main/kotlin/net/corda/node/services/persistence/NodeAttachmentService.kt @@ -32,7 +32,7 @@ import net.corda.core.internal.entries import net.corda.core.internal.isUploaderTrusted import net.corda.core.internal.readFully import net.corda.core.internal.utilities.ZipBombDetector -import net.corda.core.node.ServicesForResolution +import net.corda.core.internal.verification.NodeVerificationSupport import net.corda.core.node.services.AttachmentId import net.corda.core.node.services.vault.AttachmentQueryCriteria import net.corda.core.node.services.vault.AttachmentSort @@ -90,7 +90,7 @@ class NodeAttachmentService @JvmOverloads constructor( ) : AttachmentStorageInternal, SingletonSerializeAsToken() { // This is to break the circular dependency. - lateinit var servicesForResolution: ServicesForResolution + lateinit var nodeVerificationSupport: NodeVerificationSupport companion object { private val log = contextLogger() @@ -390,7 +390,7 @@ class NodeAttachmentService @JvmOverloads constructor( private fun increaseDefaultVersionIfWhitelistedAttachment(contractClassNames: List, contractVersionFromFile: Int, attachmentId: AttachmentId) = if (contractVersionFromFile == DEFAULT_CORDAPP_VERSION) { - val versions = contractClassNames.mapNotNull { servicesForResolution.networkParameters.whitelistedContractImplementations[it]?.indexOf(attachmentId) } + val versions = contractClassNames.mapNotNull { nodeVerificationSupport.networkParameters.whitelistedContractImplementations[it]?.indexOf(attachmentId) } .filter { it >= 0 }.map { it + 1 } // +1 as versions starts from 1 not 0 val max = versions.maxOrNull() if (max != null && max > contractVersionFromFile) { @@ -416,7 +416,7 @@ class NodeAttachmentService @JvmOverloads constructor( // set the hash field of the new attachment record. val bytes = inputStream.readFully() - require(!ZipBombDetector.scanZip(ByteArrayInputStream(bytes), servicesForResolution.networkParameters.maxTransactionSize.toLong())) { + require(!ZipBombDetector.scanZip(ByteArrayInputStream(bytes), nodeVerificationSupport.networkParameters.maxTransactionSize.toLong())) { "The attachment is too large and exceeds both max transaction size and the maximum allowed compression ratio" } val id = bytes.sha256() diff --git a/node/src/test/java/net/corda/node/services/vault/VaultQueryJavaTests.java b/node/src/test/java/net/corda/node/services/vault/VaultQueryJavaTests.java index 0a4330967a..c26c0c0b86 100644 --- a/node/src/test/java/net/corda/node/services/vault/VaultQueryJavaTests.java +++ b/node/src/test/java/net/corda/node/services/vault/VaultQueryJavaTests.java @@ -10,8 +10,8 @@ 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.verification.NodeVerificationSupport; import net.corda.core.messaging.DataFeed; -import net.corda.core.node.ServicesForResolution; import net.corda.core.node.services.AttachmentStorage; import net.corda.core.node.services.IdentityService; import net.corda.core.node.services.Vault; @@ -97,9 +97,9 @@ public class VaultQueryJavaTests { vaultFiller = new VaultFiller(services, DUMMY_NOTARY); vaultService = services.getVaultService(); storage = new NodeAttachmentService(new MetricRegistry(), new TestingNamedCacheFactory(100), database); - ServicesForResolution serviceForResolution = mock(ServicesForResolution.class); - ((NodeAttachmentService) storage).servicesForResolution = serviceForResolution; - doReturn(testNetworkParameters()).when(serviceForResolution).getNetworkParameters(); + NodeVerificationSupport nodeVerificationSupport = mock(NodeVerificationSupport.class); + ((NodeAttachmentService) storage).nodeVerificationSupport = nodeVerificationSupport; + doReturn(testNetworkParameters()).when(nodeVerificationSupport).getNetworkParameters(); } @After diff --git a/node/src/test/kotlin/net/corda/node/services/attachments/AttachmentTrustCalculatorTest.kt b/node/src/test/kotlin/net/corda/node/services/attachments/AttachmentTrustCalculatorTest.kt index c767ccf2f3..6febdb3311 100644 --- a/node/src/test/kotlin/net/corda/node/services/attachments/AttachmentTrustCalculatorTest.kt +++ b/node/src/test/kotlin/net/corda/node/services/attachments/AttachmentTrustCalculatorTest.kt @@ -6,7 +6,7 @@ import net.corda.core.internal.AttachmentTrustCalculator import net.corda.core.internal.AttachmentTrustInfo import net.corda.core.internal.hash import net.corda.core.internal.read -import net.corda.core.node.ServicesForResolution +import net.corda.core.internal.verification.NodeVerificationSupport import net.corda.coretesting.internal.rigorousMock import net.corda.node.services.persistence.NodeAttachmentService import net.corda.nodeapi.internal.persistence.CordaPersistence @@ -47,7 +47,7 @@ class AttachmentTrustCalculatorTest { private lateinit var database: CordaPersistence private lateinit var storage: NodeAttachmentService private lateinit var attachmentTrustCalculator: AttachmentTrustCalculator - private val services = rigorousMock().also { + private val nodeVerificationSupport = rigorousMock().also { doReturn(testNetworkParameters()).whenever(it).networkParameters } private val cacheFactory = TestingNamedCacheFactory() @@ -61,7 +61,7 @@ class AttachmentTrustCalculatorTest { it.start() } } - storage.servicesForResolution = services + storage.nodeVerificationSupport = nodeVerificationSupport attachmentTrustCalculator = NodeAttachmentTrustCalculator(storage, database, cacheFactory) } diff --git a/node/src/test/kotlin/net/corda/node/services/persistence/NodeAttachmentServiceTest.kt b/node/src/test/kotlin/net/corda/node/services/persistence/NodeAttachmentServiceTest.kt index 29cb879b87..79c17fe120 100644 --- a/node/src/test/kotlin/net/corda/node/services/persistence/NodeAttachmentServiceTest.kt +++ b/node/src/test/kotlin/net/corda/node/services/persistence/NodeAttachmentServiceTest.kt @@ -19,7 +19,7 @@ import net.corda.core.internal.cordapp.CordappImpl.Companion.DEFAULT_CORDAPP_VER import net.corda.core.internal.hash import net.corda.core.internal.read import net.corda.core.internal.readFully -import net.corda.core.node.ServicesForResolution +import net.corda.core.internal.verification.NodeVerificationSupport import net.corda.core.node.services.AttachmentId import net.corda.core.node.services.vault.AttachmentQueryCriteria.AttachmentsQueryCriteria import net.corda.core.node.services.vault.AttachmentSort @@ -84,7 +84,7 @@ class NodeAttachmentServiceTest { private lateinit var database: CordaPersistence private lateinit var storage: NodeAttachmentService private lateinit var devModeStorage: NodeAttachmentService - private val services = rigorousMock().also { + private val nodeVerificationSupport = rigorousMock().also { doReturn(testNetworkParameters()).whenever(it).networkParameters } @@ -105,13 +105,13 @@ class NodeAttachmentServiceTest { it.start() } } - storage.servicesForResolution = services + storage.nodeVerificationSupport = nodeVerificationSupport devModeStorage = NodeAttachmentService(MetricRegistry(), TestingNamedCacheFactory(), database, true).also { database.transaction { it.start() } } - devModeStorage.servicesForResolution = services + devModeStorage.nodeVerificationSupport = nodeVerificationSupport } @After