suvit
suvit

Reputation: 11

issue while upgrading corda state

I am trying to upgrade corda state at runtime.I followed explicit-cordapp-upgrades repository in corda sample github. Created separate subproject for old contract-state and new contract-state, to generate the separate jars. But facing few challenges while doing so.

How to calculate sha256 of old contract-state jar which will needed in "legacyContractConstraint" variable of new contract ? (I tried to calculate hash from outside the code and put that hash in "legacyContractConstraint" variable. for this, I build sub-projects one by one. So that it will create old contract jar at first and then I calculate hash of old contract-state outside the code and put that hash in "legacyContractConstraint" variable. )

Getting below error: [ERROR] 2019-06-11T11:13:43,632Z [Node thread-1] proxies.ExceptionSerialisingRpcOpsProxy.log - Error during RPC invocation [errorCode=y0q4pg, moreInformationAt=https://errors.corda.net/OS/4.0/y0q4pg] {actor_id=user1, actor_owning_identity=OU=HSSOPS, O=HSS-Custody, L=London, C=GB, actor_store_id=NODE_CONFIG, fiber-id=10000005, flow-id=8d51b505-575d-400d-b9da-2307ee3ce065, invocation_id=396859d3-311b-4f1c-9d83-9e8af58c9f3b, invocation_timestamp=2019-06-11T11:13:43.582Z, origin=user1, session_id=c7154935-d700-479f-a183-f5d9e634da1d, session_timestamp=2019-06-11T11:13:39.567Z, thread-id=207}

java.lang.IllegalArgumentException: Unsupported input contract constraint SignatureAttachmentConstraint(key=EC Public Key [4b:44:7c:7b:1b:38:a6:93:bd:9a:c4:1d:8b:46:b4:6b:77:ba:f8:0e]
        X: 38d226dcd0fa574316da478aa75225e6ce18f65cbd96e60bf3c8251b1965417
        Y: 56e5dcf7ccab21b712601ed0278501f2f33d0b5fdaa4c09e62639464e4910871
)
at net.corda.core.transactions.ContractUpgradeWireTransaction$Companion.calculateUpgradedState$core(ContractUpgradeTransactions.kt:55) ~[corda-core-4.0.jar:?]
at net.corda.core.transactions.ContractUpgradeLedgerTransaction.<init>(ContractUpgradeTransactions.kt:333) ~[corda-core-4.0.jar:?]
at net.corda.core.transactions.ContractUpgradeLedgerTransaction.<init>(ContractUpgradeTransactions.kt:236) ~[corda-core-4.0.jar:?]
at net.corda.core.transactions.ContractUpgradeLedgerTransaction$Companion.create$core(ContractUpgradeTransactions.kt:270) ~[corda-core-4.0.jar:?]
at net.corda.core.transactions.ContractUpgradeWireTransaction.resolve(ContractUpgradeTransactions.kt:117) ~[corda-core-4.0.jar:?]
at net.corda.core.transactions.SignedTransaction.resolveContractUpgradeTransaction(SignedTransaction.kt:306) ~[corda-core-4.0.jar:?]
at net.corda.core.transactions.SignedTransaction.verifyContractUpgradeTransaction(SignedTransaction.kt:214) ~[corda-core-4.0.jar:?]
at net.corda.core.transactions.SignedTransaction.verify(SignedTransaction.kt:182) ~[corda-core-4.0.jar:?]
at net.corda.core.flows.AbstractStateReplacementFlow$Instigator.call(AbstractStateReplacementFlow.kt:65) ~[corda-core-4.0.jar:?]
at net.corda.core.flows.AbstractStateReplacementFlow$Instigator.call(AbstractStateReplacementFlow.kt:50) ~[corda-core-4.0.jar:?]
at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:228) ~[corda-node-4.0.jar:?]
at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:45) ~[corda-node-4.0.jar:?]
at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1092) ~[quasar-core-0.7.10-jdk8.jar:0.7.10]
at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) ~[quasar-core-0.7.10-jdk8.jar:0.7.10]
at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) ~[quasar-core-0.7.10-jdk8.jar:0.7.10]
at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) ~[quasar-core-0.7.10-jdk8.jar:0.7.10]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_171]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_171]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_171]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.8.0_171]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_171]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_171]
at net.corda.node.utilities.AffinityExecutor$ServiceAffinityExecutor$1$thread$1.run(AffinityExecutor.kt:63) ~[corda-node-4.0.jar:?]

Upvotes: 1

Views: 126

Answers (3)

Sneha Damle
Sneha Damle

Reputation: 634

Yes that is correct explicit contract upgrade is not supported by Signature Constraint, in fact there is no need to perform this tedious process of explicit upgrade.

While using SignatureConstraint you have to replace the old jar with the new contract jar. As long as the new jar is signed using the same key used to sign the old jar, the upgrade will work.

Upvotes: 1

Satienpong Yotee
Satienpong Yotee

Reputation: 37

Refer to this link

https://github.com/corda/corda/blob/master/docs/source/upgrading-cordapps.rst#performing-explicit-contract-and-state-upgrades

States created or migrated to the Signature Constraint can't be explicitly upgraded using the Contract upgrade transaction. This feature might be added in a future version.

Is that mean SignatureConstraint is not support explicit upgrade right?

Upvotes: 0

Chris Chabot
Chris Chabot

Reputation: 274

Looking at explicit-cordapp-upgrades, it goes through this process:

  1. Connect to PartyA and PartyB's nodes via RPC
  2. Issue a state with the old contract
  3. Upgrade the state to use the new contract
  4. Wait ten seconds for the contract upgrade to propagate
  5. Log the state to show that its contract has been upgraded

Looking at the error message you're getting, it's failing at:

Unsupported input contract constraint SignatureAttachmentConstraint(key=EC Public Key [4b:44:7c:7b:1b:38:a6:93:bd:9a:c4:1d:8b:46:b4:6b:77:ba:f8:0e]

That function verifies that the transaction has valid public key signers:

https://docs.corda.net/head/api/javadoc/net/corda/core/contracts/SignatureAttachmentConstraint.html

Which I'm guessing might mean that one of the nodes that signed one of the transactions that is being replayed / re-issued is no longer available on the network, and hence its public key is no longer valid.

Upvotes: 2

Related Questions