升级corda状态时出现问题

时间:2019-06-11 12:04:36

标签: corda

我正在尝试在运行时升级Corda状态。我遵循了Corda示例github中的explicit-cordapp-upgrades存储库。为旧的合同状态和新的合同状态创建了单独的子项目,以生成单独的jar。但是,这样做的时候几乎没有挑战。

如何计算新合同的“ legacyContractConstraint”变量所需的旧合同状态jar的sha256?     (我尝试从代码外部计算哈希,并将该哈希放入“ legacyContractConstraint”变量中。为此,我一个一个地构建子项目。因此,它将首先创建旧合约jar,然后计算旧合约的哈希-在代码外声明状态,并将该哈希值放入“ legacyContractConstraint”变量中。)

得到以下错误:     [错误] 2019-06-11T11:13:43,632Z [节点线程-1] proxies.ExceptionSerialisingRpcOpsProxy.log-RPC调用期间出错[errorCode = y0q4pg,moreInformationAt = https://errors.corda.net/OS/4.0/y0q4pg] {actor_id = user1,actor_owning_identity = OU = HSSOPS,O = HSS保管,L =伦敦,C = GB,actor_store_id = NODE_CONFIG,fibre-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:?]

3 个答案:

答案 0 :(得分:1)

查看显式cordapp-upgrades,它经历了以下过程:

  1. 通过RPC连接到PartyA和PartyB的节点
  2. 发布具有旧合同的州
  3. 升级状态以使用新合同
  4. 等待十秒钟,以便合同升级传播
  5. 登录状态以显示其合同已升级

查看您收到的错误消息,它在以下位置失败:

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]

该函数验证交易是否具有有效的公钥签名者:

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

我猜测这可能意味着签署了正在重播/重新发行的事务之一的节点之一在网络上不再可用,因此其公钥不再有效。

答案 1 :(得分:0)

请参阅此链接

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

  

创建或迁移到签名约束的状态不能使用合同升级事务显式升级。将来的版本中可能会添加此功能。

这是否意味着SignatureConstraint不支持显式升级权限?

答案 2 :(得分:0)

是的,Signature Constraint不支持正确的显式合同升级,实际上不需要执行繁琐的显式升级过程。

使用SignatureConstraint时,您必须用新的合约罐替换旧的罐。只要使用与签名旧jar相同的密钥对新jar进行签名,升级就可以进行。