You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem description: I have a contract with many owner-only methods, so I made a test with workspaces-js 2.0 that calls all those methods at the same time. Something like:
However with many calls, the tests would take an unusually long time: 12 calls took ~1.5 minutes to run, and going over 14 calls will fail the test.
Problem cause: Every time we run account.call(), the RPC is queried for the user's nonce in order to sign the transaction. Since we're running all 3 calls concurrently, the RPC would return the same nonce for all transactions, which means all transactions will be signed with the same nonce. The first signed transaction to arrive at the the RPC will be accepted, the other 2 will be rejected. Since the library has up to 10 automatic retries, it will retry to send the failed 2 transactions and the same will happen again. The first of the two will be accepted, the other one will be rejected. As you can see, this means there will be a lot of delay until all transactions get eventually accepted. Things get worse when trying to do this for a lot of transactions (>14 in my experience) since the library will run out of the 10 automatic retries and simply fail the test.
Possible solution: I think there should be a method that allows to sign & send multiple transactions from the same user. I remember seeing something similar last year in near-api-js but I couldn't find it anymore, so I made this method for my own tests and it's running fine. See this test for an example usage.
The text was updated successfully, but these errors were encountered:
Problem description: I have a contract with many owner-only methods, so I made a test with workspaces-js 2.0 that calls all those methods at the same time. Something like:
However with many calls, the tests would take an unusually long time: 12 calls took ~1.5 minutes to run, and going over 14 calls will fail the test.
Problem cause: Every time we run
account.call()
, the RPC is queried for the user's nonce in order to sign the transaction. Since we're running all 3 calls concurrently, the RPC would return the same nonce for all transactions, which means all transactions will be signed with the same nonce. The first signed transaction to arrive at the the RPC will be accepted, the other 2 will be rejected. Since the library has up to 10 automatic retries, it will retry to send the failed 2 transactions and the same will happen again. The first of the two will be accepted, the other one will be rejected. As you can see, this means there will be a lot of delay until all transactions get eventually accepted. Things get worse when trying to do this for a lot of transactions (>14 in my experience) since the library will run out of the 10 automatic retries and simply fail the test.Possible solution: I think there should be a method that allows to sign & send multiple transactions from the same user. I remember seeing something similar last year in near-api-js but I couldn't find it anymore, so I made this method for my own tests and it's running fine. See this test for an example usage.
The text was updated successfully, but these errors were encountered: