Skip to content

Conversation

akundaz
Copy link
Contributor

@akundaz akundaz commented Sep 22, 2025

📝 Summary

So we have a good idea of how much execution resources is taken up by reverting txs

💡 Motivation and Context

Unfortunately reth only tracks gas used by blocks, which isn't accurate for us since we don't include reverting txs in the block: https://github.com/paradigmxyz/reth/blob/main/crates/evm/evm/src/metrics.rs


✅ I have completed the following steps:

  • Run make lint
  • Run make test
  • Added tests (if applicable)

@akundaz akundaz self-assigned this Sep 22, 2025
if result.is_success() {
log_txn(TxnExecutionResult::Success);
num_txs_simulated_success += 1;
self.metrics.successful_tx_gas_used.record(gas_used as f64);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this not need reverted_gas_used += gas_used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no i'm only tracking reverted gas when the tx reverts

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I meant successful_tx_gas_used += gas_used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would calculate the cumulative gas used by successful txs in a block. reth already tracks this in the reth_sync_execution_gas_processed_total metrics. successful_tx_gas_used is a histogram metric so it will tell us what the distribution of gas looks like used by each tx

}

impl OpRBuilderMetrics {
#[expect(clippy::too_many_arguments)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can group these metrics as a struct instead of adding more args

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean a type where each field is one of these args? i'm not sure that's a good idea it would introduce more complexity than just having the directive to ignore the lint here

@akundaz akundaz merged commit 4cd0be6 into main Sep 30, 2025
4 checks passed
@akundaz akundaz deleted the ak-revert-tx-gas branch September 30, 2025 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants