aeternity/aepp-sdk-js

Use current nonce in contract call dry-run

davidyuk opened this issue · 3 comments

By default sdk uses next-nonce with max strategy, and dry-run would fail due to high nonce.

For future reference, this might help: a low-level call to send multiple reads (tx?) in one array (thanks @davidyuk):

https://docs.aeternity.com/aepp-sdk-js/v13.2.1/api/classes/Node.html#protectedDryRunTxs

And the most straight-forward way to avoid nonce problems for parallel reads is according to @davidyuk to use { onAccount: null } as the optional options parameter to a contract call through aeSdk, which will default to the zero account ak_11111111111111111111111111111111273Yts (or use any other unused account), and will thus use the nonce 1 always.

My guess is that the first solution will have the additional advantage of faster turn-around times.

@davidyuk by inference, does the alternate strategy of continue mean that the nonce would always be the same in calls that arrive at the same time, as the next nonce is always found as the gap.

Also if Æternity allows for gaps, why does it at the same time not allow for nonces to be skipped?

Also if Æternity allows for gaps, why does it at the same time not allow for nonces to be skipped?

Gaps is not allowed, I don't know a use case for continue strategy. The best to use a nonce returned by getAccount + 1 in case of static calls.