【问题标题】:Corda explicit contract upgrade NoSuchElementException: List is emptyCorda 显式合约升级 NoSuchElementException: List is empty
【发布时间】:2023-03-23 16:59:01
【问题描述】:

我正在尝试升级 Corda 合同。目前我们有一个包含状态、流程和合同的 uber jar。我们正在使用显式升级机制,利用 UpgradeContractUsingLegacyConstraint 接口将 uber jar 分解为单独的 jar。

在我们的网络中,有一个观察者节点,它跟踪网络中其他节点之间发生的所有交易。因此,在这种情况下,我们在网络中的所有节点中运行 Authorize flow,然后在观察者节点中运行 Initiate flow。虽然授权流在所有节点中成功运行且没有任何错误,但启动流有两个问题。

  1. 某些流失败。我们收到错误 NoSuchElementException 的多个实例。下面提到了堆栈跟踪
  2. 一些流仍处于待处理状态。在 Jolokia 监控中,我们得到了类似的统计数据,其中一些仍处于飞行状态。在 Corda SSH shell 中,我们也在运行 flow watch 命令后得到待处理的交易。我们尝试重新启动系统,但问题仍然存在于观察者节点中。

升级合约的下一步或推荐方法应该是什么。我在 Ubuntu 16.04 上使用 Corda v3.3,Cordite 网络地图并参考 github 存储库来升级合同 (https://github.com/amolpednekar/contract-state-upgrades/blob/master/cordapp/src/main/kotlin/com/upgrade/Client.kt)。

堆栈跟踪:

[WARN ] 2019-05-22T22:16:31,568Z [Node thread-1] flow.[fa8a213f-8de7-4cd8-8d41-8493bbc9cecf].run - Terminated by unexpected exception {}
java.util.NoSuchElementException: List is empty.
    at kotlin.collections.CollectionsKt___CollectionsKt.single(_Collections.kt:472) ~[kotlin-stdlib-1.1.60.jar:1.1.60-release-55 (1.1.60)]
    at kotlin.collections.CollectionsKt___CollectionsKt.single(_Collections.kt:454) ~[kotlin-stdlib-1.1.60.jar:1.1.60-release-55 (1.1.60)]
    at net.corda.core.flows.ContractUpgradeFlow$Initiate.assembleTx(ContractUpgradeFlow.kt:77) ~[corda-core-3.3-corda.jar:?]
    at net.corda.core.flows.AbstractStateReplacementFlow$Instigator.call(AbstractStateReplacementFlow.kt:64) ~[corda-core-3.3-corda.jar:?]
    at net.corda.core.flows.AbstractStateReplacementFlow$Instigator.call(AbstractStateReplacementFlow.kt:50) ~[corda-core-3.3-corda.jar:?]
    at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:96) [corda-node-3.3-corda.jar:?]
    at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:44) [corda-node-3.3-corda.jar:?]
    at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1092) [quasar-core-0.7.9-jdk8.jar:0.7.9]
    at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) [quasar-core-0.7.9-jdk8.jar:0.7.9]
    at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) [quasar-core-0.7.9-jdk8.jar:0.7.9]
    at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) [quasar-core-0.7.9-jdk8.jar:0.7.9]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_201]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_201]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_201]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_201]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_201]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_201]
    at net.corda.node.utilities.AffinityExecutor$ServiceAffinityExecutor$1$thread$1.run(AffinityExecutor.kt:62) [corda-node-3.3-corda.jar:?]
[WARN ] 2019-05-22T22:16:31,574Z [Node thread-1] flow.[5856148a-d233-43c4-ac20-396b9a91f6c0].run - Terminated by unexpected exception {}

编辑:捕获的其他一些错误:

[WARN ] 2019-06-03T16:36:22,357Z [Node thread-1] flow.[2aec6ee2-2e14-43f5-81ce-b301c4876e0a].run - Terminated by unexpected exception {}
java.lang.ClassCastException: io.corp.contract.DefaultContract cannot be cast to net.corda.core.contracts.UpgradedContract
        at net.corda.core.flows.ContractUpgradeFlow$Authorise.call(ContractUpgradeFlow.kt:38) ~[corda-core-3.3-corda.jar:?]
        at net.corda.core.flows.ContractUpgradeFlow$Authorise.call(ContractUpgradeFlow.kt:31) ~[corda-core-3.3-corda.jar:?]
        at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:96) [corda-node-3.3-corda.jar:?]
        at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:44) [corda-node-3.3-corda.jar:?]
        at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1092) [quasar-core-0.7.9-jdk8.jar:0.7.9]
        at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) [quasar-core-0.7.9-jdk8.jar:0.7.9]
        at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) [quasar-core-0.7.9-jdk8.jar:0.7.9]
        at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) [quasar-core-0.7.9-jdk8.jar:0.7.9]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_201]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_201]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_201]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_201]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_201]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_201]
        at net.corda.node.utilities.AffinityExecutor$ServiceAffinityExecutor$1$thread$1.run(AffinityExecutor.kt:62) [corda-node-3.3-corda.jar:?]

这也是我们的合同升级之一

[WARN ] 2019-06-03T17:44:26,859Z [Messaging DLJKqkjV9pKTqG5nKbQQ3o5B1hPj1zjrYxDYpbhPENXdR] messaging.P2PMessagingClient.sendWithRetry - Reached the maximum number of retries (3) for message ClientMessageImpl[messageID=0, durable=true, address=internal.peers.DL8itTRrD1LvKjd5sQ9DwX59KmZ42PTa964nJPfL6jf1VC,userID=null,properties=TypedProperties[platform-version=3,corda-vendor=Corda Open Source,release-version=3.3-corda,platform-topic=platform.session,_AMQ_DUPL_ID=23190134-6514-4165-8277-0e3df48e2678,corda_p2p_message_type=session_init]] redelivery to internal.peers.DL8itTRrD1LvKjd5sQ9DwX59KmZ42PTa964nJPfL6jf1VC {}
[WARN ] 2019-06-03T17:44:26,941Z [Messaging DLJKqkjV9pKTqG5nKbQQ3o5B1hPj1zjrYxDYpbhPENXdR] messaging.P2PMessagingClient.sendWithRetry - Reached the maximum number of retries (3) for message ClientMessageImpl[messageID=0, durable=true, address=internal.peers.DL8itTRrD1LvKjd5sQ9DwX59KmZ42PTa964nJPfL6jf1VC,userID=null,properties=TypedProperties[platform-version=3,corda-vendor=Corda Open Source,release-version=3.3-corda,platform-topic=platform.session,_AMQ_DUPL_ID=2e2cde97-1e3d-4ce9-b7af-01ab61a88114,corda_p2p_message_type=session_init]] redelivery to internal.peers.DL8itTRrD1LvKjd5sQ9DwX59KmZ42PTa964nJPfL6jf1VC {}

【问题讨论】:

    标签: corda


    【解决方案1】:

    从堆栈跟踪来看,发起者似乎不是原始状态的参与者。

    【讨论】:

    • 然而,为什么一些流进入成功而一些总是处于挂起状态仍然是一个问题。我们是否有过滤掉状态以仅升级所需状态的解决方案?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-07
    • 2020-01-22
    • 1970-01-01
    相关资源
    最近更新 更多