Closed karlb closed 4 months ago
Coverage from tests in ./e2e_test/...
for ./consensus/istanbul/...
at commit f7be29c766cc732afcdca4ca0a693e0a63b48ef7
coverage: 63.2% of statements in consensus/istanbul coverage: 43.2% of statements in consensus/istanbul/announce coverage: 56.0% of statements in consensus/istanbul/backend coverage: 0.0% of statements in consensus/istanbul/backend/backendtest coverage: 24.3% of statements in consensus/istanbul/backend/internal/replica coverage: 65.9% of statements in consensus/istanbul/core coverage: 50.0% of statements in consensus/istanbul/db coverage: 0.0% of statements in consensus/istanbul/proxy coverage: 64.2% of statements in consensus/istanbul/uptime coverage: 51.8% of statements in consensus/istanbul/validator coverage: 79.2% of statements in consensus/istanbul/validator/random
Description
Txs must not fail during
debitGasFees
execution during the state transition, so we must remove problematic txs during the tx pool validation. We do this by executingdebitGasFees
inside the tx pool validation and discarding the resulting state changes. This is not overly efficient, but still better than the alternatives that have been considered so far.Other changes
ExecuteAndDiscardChanges
tovm.EVMRunner
. I would have liked to avoid this change, butStaticCall
does not allow (even temporary) changes and I didn't see a better way.debitGasFeesSelector
andcreditGasFeesSelector
and updated comment to show how to generate the selector withcast
instead of python.debitGasFees
and I want to avoid duplicate workValidateTransactorBalanceCoversTx
, since we don't need to support older forks in the tx poolTested
Manually by sending txs via Viem to a local mycelo. Adding a unit test would be desirable.
I'm haven't tested that the state revert works as expected and am also not sure about the performance impact.
Backwards compatibility
At the time of writing, we don't have any fee currencies on mainnet that can fail in
debitGasFees
. The error message for fee currencies without sufficient balance will change with this PR. The new error will contain the revert message from the token'sdebitGasFees
.