Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is a token group with no assigned command #119

Open
nimmaj opened this issue Jul 16, 2019 · 3 comments
Open

There is a token group with no assigned command #119

nimmaj opened this issue Jul 16, 2019 · 3 comments
Labels
enhancement New feature or request

Comments

@nimmaj
Copy link
Contributor

nimmaj commented Jul 16, 2019

Hi All,

We had an issue today with 1.0 t-sdk. Thanks for all the help debugging. The conclusion seems to be that we called addMoveToken twice for tokens that have the same grouping, this pulls in two commands and then we blow up later with the following exception:

[WARN ] 2019-07-16T12:42:00,158Z [flow-worker] interceptors.DumpHistoryOnErrorInterceptor.executeTransition - Flow [04ff054d-19b7-4aca-b147-c736a66ce397] error [errorCode=x4riem, moreInformationAt=https://errors.corda.net/ENT/4.0/x4riem] {fiber-id=10000005, flow-id=04ff054d-19b7-4aca-b147-c736a66ce397, invocation_id=7e0e9204-a097-44dd-a075-1df8725c00a7, invocation_timestamp=2019-07-16T12:41:56.709Z, origin=com.sdx.token.db.size.DubiousService, session_id=7e0e9204-a097-44dd-a075-1df8725c00a7, session_timestamp=2019-07-16T12:41:56.709Z, thread-id=305, tx_id=6184FB49C9BD1A4C3DD4BD04DDE2AB8C37E474F3353B8FFA6843D3774492E6AD}
net.corda.core.contracts.TransactionVerificationException$ContractRejection: Contract verification failed: There is a token group with no assigned command!, contract: com.r3.corda.lib.tokens.contracts.FungibleTokenContract, transaction: 6184FB49C9BD1A4C3DD4BD04DDE2AB8C37E474F3353B8FFA6843D3774492E6AD
        at net.corda.core.internal.Verifier.verifyContracts(TransactionVerifierServiceInternal.kt:380) ~[corda-core-4.0.jar:?]
        at net.corda.core.internal.Verifier.verify(TransactionVerifierServiceInternal.kt:71) ~[corda-core-4.0.jar:?]
        at net.corda.core.transactions.LedgerTransaction.verify(LedgerTransaction.kt:134) ~[corda-core-4.0.jar:?]
        at net.corda.core.flows.FinalityFlow.verifyTx(FinalityFlow.kt:232) ~[corda-core-4.0.jar:?]
        at net.corda.core.flows.FinalityFlow.call(FinalityFlow.kt:133) ~[corda-core-4.0.jar:?]
        at net.corda.core.flows.FinalityFlow.call(FinalityFlow.kt:39) ~[corda-core-4.0.jar:?]
        at net.corda.node.services.statemachine.FlowStateMachineImpl.subFlow(FlowStateMachineImpl.kt:303) ~[corda-node-4.0.jar:?]
        at net.corda.core.flows.FlowLogic.subFlow(FlowLogic.kt:314) ~[corda-core-4.0.jar:?]
        at com.r3.corda.lib.tokens.workflows.internal.flows.finality.ObserverAwareFinalityFlow.call(ObserverAwareFinalityFlow.kt:75) ~[?:?]
        at com.r3.corda.lib.tokens.workflows.internal.flows.finality.ObserverAwareFinalityFlow.call(ObserverAwareFinalityFlow.kt:35) ~[?:?]
        at net.corda.node.services.statemachine.FlowStateMachineImpl.subFlow(FlowStateMachineImpl.kt:303) ~[corda-node-4.0.jar:?]
        at net.corda.core.flows.FlowLogic.subFlow(FlowLogic.kt:314) ~[corda-core-4.0.jar:?]
        at com.blah.token.db.size.TransferSpecificChfTo.call(DbSizeFlows.kt:193) ~[?:?]
        at com.blah.token.db.size.TransferSpecificChfTo.call(DbSizeFlows.kt:156) ~[?:?]
        at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:243) ~[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.11_r3-jdk8.jar:0.7.11_r3]
        at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]
        at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]
        at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) ~[quasar-core-0.7.11_r3-jdk8.jar:0.7.11_r3]
        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 io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.29.Final.jar:4.1.29.Final]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]
Caused by: java.lang.IllegalArgumentException: There is a token group with no assigned command!
        at com.r3.corda.lib.tokens.contracts.AbstractTokenContract.verify(AbstractTokenContract.kt:97) ~[?:?]
        at net.corda.core.internal.Verifier.verifyContracts(TransactionVerifierServiceInternal.kt:377) ~[corda-core-4.0.jar:?]
        ... 23 more

Thanks :-)

@roastario
Copy link
Contributor

Thanks!

Yes, we will extend the error message to display the groups detected, and the commands that match them, along with some extra documentation around making sure to add tokens of the same type+issuer at the same time.

hopefully this will help others facing the same issue.

@dbasbas
Copy link

dbasbas commented Jan 23, 2020

Any updates on this? Thanks!

@roger-that-dev roger-that-dev added the enhancement New feature or request label Jan 23, 2020
@roger-that-dev
Copy link

roger-that-dev commented Jan 23, 2020

Will be added in tokens 1.2 but for now... all tokens must be linked to a token command in a transaction. If any tokens can't be grouped then you get this error. See this test code for the three reasons why you can get the error:

@Test fun `no token with linked command`() {
        val issuedToken = RUB issuedBy ISSUER.party

        // no output index
        transaction {
            output(FungibleTokenContract.contractId, FungibleToken(10 of issuedToken, BOB.party, null))
            command(BOB.party.owningKey, IssueTokenCommand(issuedToken, outputs = listOf()))
            attachment(RUB.importAttachment(aliceServices.attachments))
            this.fails()
        }

        // output index is incorrect.
        transaction {
            output(FungibleTokenContract.contractId, FungibleToken(10 of issuedToken, BOB.party, null))
            command(BOB.party.owningKey, IssueTokenCommand(issuedToken, outputs = listOf(1)))
            attachment(RUB.importAttachment(aliceServices.attachments))
            this.fails()
        }

        // Issued tokentype doesn't match
        transaction {
            val otherToken = RUB issuedBy BOB.party
            output(FungibleTokenContract.contractId, FungibleToken(10 of issuedToken, BOB.party, null))
            command(BOB.party.owningKey, IssueTokenCommand(otherToken, outputs = listOf(0)))
            attachment(RUB.importAttachment(aliceServices.attachments))
            this.fails()
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants