Ben Tan
Ben Tan

Reputation: 138

Is the same source code compiled (into CorDapps) at different times considered different versions?

Something that was highlighted in a discussion today. The same CorDapp (same source code no difference) was deployed in both Party A and B. However, the CorDapp in party A was compiled a week ago. When party B tried to create a transaction with A, it doesn't work and you get an exception as net.corda.core.contracts.TransactionverificationException$ContractCOnstraintRejection@: Contract constraints failed for net-corda.training.contract.IOUContract, transaction: tx hash. Is this a valid observation?

The log outputs the following exception using the IOUContract as an example: net.corda.core.contracts.TransactionVerificationException$ContractConstraintRejection: Contract constraints failed for net.corda.training.contract.IOUContract, transaction: D60DD71F9D50BA7A638455B676CD394601460D937544A5697643FDD952C9FCB4 at net.corda.core.transactions.LedgerTransaction.verifyConstraints(LedgerTransaction.kt:91) ~[corda-core-1.0.0.jar:?] at net.corda.core.transactions.LedgerTransaction.verify(LedgerTransaction.kt:67) ~[corda-core-1.0.0.jar:?] at net.corda.node.services.transactions.InMemoryTransactionVerifierService$verify$1.invoke(InMemoryTransactionVerifierService.kt:13) ~[corda-node-1.0.0.jar:?] at net.corda.node.services.transactions.InMemoryTransactionVerifierService$verify$1.invoke(InMemoryTransactionVerifierService.kt:10) ~[corda-node-1.0.0.jar:?] at net.corda.core.internal.concurrent.ValueOrException$DefaultImpls.capture(CordaFutureImpl.kt:104) ~[corda-core-1.0.0.jar:?] at net.corda.core.internal.concurrent.OpenFuture$DefaultImpls.capture(CordaFutureImpl.kt) ~[corda-core-1.0.0.jar:?] at net.corda.core.internal.concurrent.CordaFutureImpl.capture(CordaFutureImpl.kt:116) ~[corda-core-1.0.0.jar:?] at net.corda.core.internal.concurrent.CordaFutureImplKt$fork$$inlined$also$lambda$1.run(CordaFutureImpl.kt:22) ~[corda-core-1.0.0.jar:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[?:1.8.0_131] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[?:1.8.0_131] at java.lang.Thread.run(Unknown Source) ~[?:1.8.0_131]

Upvotes: 1

Views: 217

Answers (2)

Joel
Joel

Reputation: 23140

As Richard states, for a given set of CorDapp source files, the hash of the generated CorDapp JAR is not deterministic.

One key reason is that the JAR still includes a timestamp. See https://docs.corda.net/head/cordapp-build-systems.html#creating-the-cordapp-jar.

Upvotes: 0

Richard Green
Richard Green

Reputation: 2062

One missing question is:

Was the same cordapp-jar distributed to both machines ? By this I don't mean the same source code distributed and then compiled independently, I mean one compilation and then the result of that ran on both nodes. Before Corda reaches wire stability, any differences in the compilation environment (no matter how minor) may result in errors like the one you encountered.

Upvotes: 1

Related Questions