Testnet似乎不支持带有SignatureConstraint的Corda4

时间:2019-03-25 07:14:35

标签: corda

我使用SignatureConstraint构建Corda4,并使用Testnet进行部署。然后当我进行交易时,我得到了这个异常

net.corda.core.node.ZoneVersionTooLowException: Signature constraints requires all nodes on the Corda compatibility zone to be running at least platform version 4. The current zone is only enforcing a minimum platform version of 1. Please contact your zone operator.
    at net.corda.core.internal.CordaUtilsKt.checkMinimumPlatformVersion(CordaUtils.kt:36) ~[corda-core-4.0.jar:?]
    at net.corda.core.internal.Verifier.verifyConstraints(TransactionVerifierServiceInternal.kt:332) ~[corda-core-4.0.jar:?]
    at net.corda.core.internal.Verifier.verify(TransactionVerifierServiceInternal.kt:61) ~[corda-core-4.0.jar:?]
    at net.corda.core.transactions.LedgerTransaction.verify(LedgerTransaction.kt:125) ~[corda-core-4.0.jar:?]
    at net.corda.core.transactions.TransactionBuilder.addMissingDependency(TransactionBuilder.kt:173) ~[corda-core-4.0.jar:?]
    at net.corda.core.transactions.TransactionBuilder.toWireTransactionWithContext$core(TransactionBuilder.kt:160) ~[corda-core-4.0.jar:?]
    at net.corda.core.transactions.TransactionBuilder.toWireTransactionWithContext$core$default(TransactionBuilder.kt:128) ~[corda-core-4.0.jar:?]
    at net.corda.core.transactions.TransactionBuilder.toWireTransaction(TransactionBuilder.kt:125) ~[corda-core-4.0.jar:?]
    at net.corda.core.transactions.TransactionBuilder.toLedgerTransaction(TransactionBuilder.kt:451) ~[corda-core-4.0.jar:?]
    at net.corda.core.transactions.TransactionBuilder.verify(TransactionBuilder.kt:459) ~[corda-core-4.0.jar:?]
    at th.co.jventures.ddlp.cordapp.flows.CustomerIssueFlow.call(CustomerIssueFlow.kt:166) ~[cordapp-flows-1.0.jar:?]
    at th.co.jventures.ddlp.cordapp.flows.CustomerIssueFlow.call(CustomerIssueFlow.kt:32) ~[cordapp-flows-1.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_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:63) ~[corda-node-4.0.jar:?]

这是否意味着Testnet不支持签名约束?

2 个答案:

答案 0 :(得分:1)

此时,Corda Testnet是最低平台版本1。我们将适时推出一个新的Testnet,其最低平台版本为4,它将支持Corda V4,从而支持签名限制。

来源:我是R3 Corda Testnet的技术负责人。

答案 1 :(得分:0)

如果您要测试并要调试,则Mock网络也不支持V4,因此您也将无法对其进行模拟。

另一种方法是在本地运行节点,并使用 https://docs.corda.net/debugging-a-cordapp.html

中所述的Corda节点驱动程序连接调试器。

这是我启用模拟测试的方式:

 HashSet<TestCordapp> cordapps = new HashSet<>(asList( TestCordapp.findCordapp("com.r3.corda.lib.tokens.money"),
            TestCordapp.findCordapp("com.r3.corda.lib.tokens.contracts"),
            TestCordapp.findCordapp("com.r3.corda.lib.tokens.workflows")));

        List<String> packages = Arrays.asList("[your packages]");

        #Create new drive parameters and generate new network parameters copying defult
        # except the minimun supported version
        DriverParameters driverParameters = new DriverParameters().withIsDebug(true).withCordappsForAllNodes(cordapps);
        NetworkParameters networkParameters = driverParameters.getNetworkParameters();
        NetworkParameters parameters = networkParameters.copy(4, networkParameters.getNotaries(), networkParameters.getMaxMessageSize(), networkParameters.getMaxTransactionSize(), networkParameters.getModifiedTime(), networkParameters.getEpoch(), networkParameters.getWhitelistedContractImplementations());

        InMemoryMessagingNetwork.ServicePeerAllocationStrategy servicePeerAllocationStrategy = new InMemoryMessagingNetwork.ServicePeerAllocationStrategy.Random();
        MockNetworkParameters mockNetworkParameters = new MockNetworkParameters(cordapps);
        MockNetworkNotarySpec mockNetworkNotarySpec = new MockNetworkNotarySpec(new CordaX500Name("Notary", "London", "GB"), false);
        mockNet =  new MockNetwork(packages,mockNetworkParameters,false,false,servicePeerAllocationStrategy,Arrays.asList(mockNetworkNotarySpec),parameters);
        issuerNode = mockNet.createNode(new CordaX500Name("Issuer", "London", "GB"));

        issuer = issuerNode.getInfo().getLegalIdentities().get(0);