-
Notifications
You must be signed in to change notification settings - Fork 403
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
Ethereum adapter needs better nonce management #776
Comments
Regarding out of order transactions, so far these are the solutions I've come up with. I'm not overly pleased with them however, so I'd appreciate suggestions for better alternatives.
Approach 1 is easiest. I've already implemented and tested this locally. It fixes the transaction ordering issue, but it adds significant transaction latency and significantly limits potential TPS, as we must delay until the transaction hash is read. For this reason I think it's not feasible. Approach 2 is more difficult, but minimizes the problems from approach 1 without switching to a native solution. Unfortunately it complicates the process of nonce management in the face of other transaction submission failures, and would make it impossible for such errors to be handled without cascading into at least a few other transactions, depending on submission rate. Approach 3 is likely to be even lower latency than approach 2, however it suffers from the same drawbacks as approach 2, while making the code harder to maintain, harder to build, and less portable. For the moment I think that I prefer approach 2, however I'll keep trying to think of other solutions, and I'd appreciate other ideas from the community before we proceed. |
I originally assumed that this was happening at the level of libuv or node I/O scheduling, but it may actually be an issue in web3.js. To that end, I went bug hunting in their issues list. I've definitely seen web3/web3.js#3425 pop up when the RPC endpoint can't be reached, not sure if it's causing nonce ordering issues for us. web3/web3.js#1846 also looks relevant, though this appears to be specific to cases where web3.js is managing the nonce. |
Web3 has recently added features that lazily fetches missing information when signing and sending transactions. In our case, this was the chainId, and the current gasPrice. Because transactions are submitted asynchronously, these additional requests would sometimes cause transactions to be submitted out of order. Even if this probelm were mitigated, these additional requests added spurious latency spikes to some transactions, negatively impacting the test results. This partially addresses hyperledger-caliper#776 by eliminating request reordering issues for stable websocket connections. This change does not however address transaction reordering for HTTP connections, or for websocket connections that require reconnects. It also does not solve the "christmas tree light" issue w.r.t. nonce errors. Signed-off-by: Ben Burns <[email protected]>
Web3 has recently added features that lazily fetches missing information when signing and sending transactions. In our case, this was the chainId, and the current gasPrice. Because transactions are submitted asynchronously, these additional requests would sometimes cause transactions to be submitted out of order. Even if this probelm were mitigated, these additional requests added spurious latency spikes to some transactions, negatively impacting the test results. This partially addresses hyperledger-caliper#776 by eliminating request reordering issues for stable websocket connections. This change does not however address transaction reordering for HTTP connections, or for websocket connections that require reconnects. It also does not solve the "christmas tree light" issue w.r.t. nonce errors. Signed-off-by: Ben Burns <[email protected]>
Web3 has recently added features that lazily fetches missing information when signing and sending transactions. In our case, this was the chainId, and the current gasPrice. Because transactions are submitted asynchronously, these additional requests would sometimes cause transactions to be submitted out of order. Even if this probelm were mitigated, these additional requests added spurious latency spikes to some transactions, negatively impacting the test results. This partially addresses hyperledger-caliper#776 by eliminating request reordering issues for stable websocket connections. This change does not however address transaction reordering for HTTP connections, or for websocket connections that require reconnects. It also does not solve the "christmas tree light" issue w.r.t. nonce errors. Signed-off-by: Ben Burns <[email protected]>
I've been testing the now-merged PRs that address this issue for about a month now, and things are working well. Those PRs however don't address the issue for RPC connections over HTTP. Unfortunately, it seems the best course of action is to error when HTTP connections are used. My rationale here is threefold.
I'll be submitting a PR shortly that introduces this error, and another to the docs pages explaining this rationale. |
fixes hyperledger-caliper#776 Signed-off-by: Ben Burns <[email protected]>
fixes hyperledger-caliper#776 Signed-off-by: Ben Burns <[email protected]>
fixes hyperledger-caliper#776 Signed-off-by: Ben Burns <[email protected]>
Context
Ethereum transactions are required to contain a nonce. The nonce of a transaction is zero-based, and must be equal to the number of transactions previously submitted (and accepted into the mempool) by the account signing the transaction. If a transaction is submitted with an incorrect nonce, it is rejected before entering the mempool. This includes cases when transactions are submitted in rapid succession, but out of order.
Expected Behavior
Actual Behavior
Possible Fix
There are actually three issues here.
Steps to Reproduce
Context
This bug is impacting users' ability to benchmark Besu and other compatible ethereum client implementations.
Your Environment
The text was updated successfully, but these errors were encountered: