-
Notifications
You must be signed in to change notification settings - Fork 8
feat: per-address gas limit feature #13
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good and clean, good job. There are few design choices you need to make here.
Also please move this module under /pool/filters/
src/gas_limiter/metrics.rs
Outdated
use crate::gas_limiter::error::GasLimitError; | ||
|
||
#[derive(Metrics, Clone)] | ||
#[metrics(scope = "op_rbuilder.gas_limiter")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be #[derive(MetricsSet)]
See:
Line 170 in 592608a
#[derive(MetricsSet)] |
Pipeline steps learn about the name of their scope when the pipeline is instantiated. So far, the pattern that has emerged is that metrics are initialized (::with_scope(..)
) in Step::setup
. Try to find an elegant way to initialize the filter-specific metrics scope at runtime in the setup function. We might need to change the filter interface if there is no clean way of doing it.
/// Refreshes the gas buckets, typically called at the start of each block. | ||
/// This refills buckets and performs garbage collection of stale entries. | ||
pub fn refresh(&self, block_number: u64) { | ||
self.limiter.refresh(block_number); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright... we're seeing an emerging pattern here. Maybe more filters will need to have some logic that kicks in before or after a payload job.
Try to think about an interface design that optionally allows devs to add pre/post job logic, while still allowing the minimalistic syntax that we have right now.
pub struct AddressGasLimiter { | ||
inner: Option<AddressGasLimiterInner>, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, maybe this alternative shape of the data structure?
enum AddressGasLimiter {
Disabled,
Enabled { config, address_buckets, metrics }
}
Summary
This PR does the following:
op-rbuilder
, integrating thegas_limiter
module fromop-rbuilder
filters
field toAppendOrders
, allowing custom boolean functions to be used for filtering out transactions.gas_limiter
module to be used as a filter in theAppendOrders
step.Todo:
gas_limit
inpool/filters
folder.