reth
reth copied to clipboard
Add intrinsic gas check to txpool validator
Describe the feature
we're lacking an intrisic gas heck here:
https://github.com/paradigmxyz/reth/blob/1049202f0fbb3da4a57817c73d14a5ae56b58c75/crates/transaction-pool/src/validate.rs#L161-L165
revm initial gas: https://github.com/bluealloy/revm/blob/5ca4741d69c508f41fd1aae780f5dcdf6e5f34a6/crates/interpreter/src/gas/calc.rs#L333
TODO
- add missing validation check
Additional context
ref https://github.com/ethereum/go-ethereum/blob/a8482127091edbcf3de4b515fd97ce904ac2acb8/core/txpool/validation.go#L97-L102
fyi @tcoratger maybe this is interesting
@mattsse I would like to work upon this as far as i understood we use Gas module from revm and the implementation will be something like this.
// Calculate intrinsic gas
let intrinsic_gas = initial_tx_gas(
&transaction.data,
transaction.to.is_none(),
&transaction.access_list,
);
// Compare transaction gas with intrinsic gas
if transaction.gas < intrinsic_gas {
// Raise an error indicating insufficient gas
return TransactionValidationOutcome::Err(core::ErrIntrinsicGas(format!(
"needed {}, allowed {}",
intrinsic_gas, transaction.gas
)));
}
Anything you would like to add.
this looks right!
fyi: there's a pending PR that will introduce conflicts here #3358
Ok I will wait till the branch is merged.
This issue is stale because it has been open for 14 days with no activity.
Still relevant
@startup-dreamer are u working on this one?
I don't think so, assigning you!
Sorry for the delay(was in paris). The calc module is private in revm . So I can't import the initial_tx_gas function. https://github.com/bluealloy/revm/blob/5ca4741d69c508f41fd1aae780f5dcdf6e5f34a6/crates/interpreter/src/gas/calc.rs
Thx
cc @mattsse
calc is now public, but we are not using the latest commit of revm , hence I'll wait for it
cool, thanks for this!
there'll be a new revm update within the next two weeks or so
closing in favor of #4504