txDryRun call results in error

Hey everyone,

I’m trying to call txDryRun API with array of two transactions, both of them having the same callerId. Transactions are actually contract calls of the same function on two deployed instances of the same contract. First transaction in response array contains expected result values but second transaction results in error:

[ { callObj: [Object], result: 'ok', type: 'contract_call' },
     { reason: 'Error: account_nonce_too_high',
       result: 'error',
       type: 'contract_call' } ] }

What could be the issue here?

dry-run will apply the list of transactions in order onto the given chain state (default is at the top of the chain), and only afterwards will it discard all the effects on the chain state. Thus when you have applied the first transaction with nonce N the chain state is updated and the next transaction should then have nonce N+1 if it is for the same account.

2 Likes

I’m not providing nonce for my transaction, I am creating it using contractCallTx() api - in that case I assume it is fetched automatically for given caller id. Also, I’m calling read-only function (not stateful) therefore no changes happen at all right? Also if nonce should be n+1 for second tx shouldn’t error message be “nonce too low” ?

Tnx!

Regardless of how you created the transaction the nonce is wrong.

Yes, the error message should really be “nonce too low” but for some reason whoever wrote that code flipped the errors - and it hasn’t been fixed yet…

All transactions will increase the nonce, or else it could be replayed over and over again. Stateful (or not) does not affect this.

2 Likes