0
votes

When collecting signatures on a newly proposed transaction Corda threw an OverlappingAttachmentsException because of a namespace conflict. The error message appears to be correct because there are two attachments which contain the same namespace for the contract in the node_attachments table.

net.corda.core.contracts.TransactionVerificationException$OverlappingAttachmentsException:
Multiple attachments define a file at com/foo/company/<state>/api/v2/orderdetails.class., transaction: 1C1985615C0B53F228B22B2C4F05CE039CC6C577A87E3B2FC9AA2CB00ED5FC43
        at net.corda.core.serialization.internal.AttachmentsClassLoader.checkAttachments(AttachmentsClassLoader.kt:272) ~[corda-core-4.3.jar:?]
        at net.corda.core.serialization.internal.AttachmentsClassLoader.<init>(AttachmentsClassLoader.kt:132) ~[corda-core-4.3.jar:?]
        at net.corda.core.serialization.internal.AttachmentsClassLoaderBuilder$withAttachmentsClassloaderContext$serializationContext$1.apply(AttachmentsClassLoader.kt:325) ~[corda-core-4.3.jar:?]
        at net.corda.core.serialization.internal.AttachmentsClassLoaderBuilder$withAttachmentsClassloaderContext$serializationContext$1.apply(AttachmentsClassLoader.kt:298) ~[corda-core-4.3.jar:?]
        at java.util.HashMap.computeIfAbsent(HashMap.java:1127) ~[?:1.8.0_212]
        at java.util.Collections$SynchronizedMap.computeIfAbsent(Collections.java:2672) ~[?:1.8.0_212]
        at net.corda.core.serialization.internal.AttachmentsClassLoaderBuilder.withAttachmentsClassloaderContext(AttachmentsClassLoader.kt:323) ~[corda-core-4.3.jar:?]
        at net.corda.core.serialization.internal.AttachmentsClassLoaderBuilder.withAttachmentsClassloaderContext$default(AttachmentsClassLoader.kt:319) ~[corda-core-4.3.jar:?]
        at net.corda.core.transactions.LedgerTransaction.internalPrepareVerify$core(LedgerTransaction.kt:146) ~[corda-core-4.3.jar:?]
        at net.corda.core.transactions.LedgerTransaction.verify(LedgerTransaction.kt:136) ~[corda-core-4.3.jar:?]
        at net.corda.core.flows.CollectSignaturesFlow.call(CollectSignaturesFlow.kt:103) ~[corda-core-4.3.jar:?]
        at net.corda.core.flows.CollectSignaturesFlow.call(CollectSignaturesFlow.kt:67) ~[corda-core-4.3.jar:?]

Where does Corda load attachment files from during verification? I was under the impression Corda would only load contracts for validation from cordapps deployed to the node's cordapps folder directly and not attempt to use contracts saved in the node_attachments table.

If Corda does load contracts from the node vault then does it follow that the anytime a new contract cordapp is deployed that it should have a unique package namespace?

For reference this error occurred during testing of a cordapp upgrade to Corda 4.3.

1

1 Answers

0
votes

This turned out to be caused by a conflict between contract hash constraints from Corda 3.3 and the new contract signature constraints from Corda 4.3. To prevent this error hash constraints have to be disabled on the node.

As per docs the node must be started with this JVM option: -Dnet.corda.node.disableHashConstraints="true"

https://docs.corda.net/docs/corda-os/4.3/api-contract-constraints.html#hash-constrained-states-in-private-networks

From the upgrade guide: "Upgrade CorDapps to use Corda 4 signature constraints and consume existing states on ledger issued with older constraint types (e.g. Corda 3.x states issued with hash or CZ whitelisted constraints)."

https://docs.corda.net/docs/corda-os/4.3/app-upgrade-notes.html#step-9-learn-about-signature-constraints-and-jar-signing