@@ -35,7 +35,7 @@ use crate::{
3535 } ,
3636 evm:: OpBlockEvmFactory ,
3737 hardforks:: ActiveHardforks ,
38- limiter:: AddressLimiter ,
38+ limiter:: { AddressLimiter , AddressLimiterGuard } ,
3939 metrics:: OpRBuilderMetrics ,
4040 primitives:: reth:: { ExecutionInfo , TxnExecutionResult } ,
4141 traits:: PayloadTxsBounds ,
@@ -64,8 +64,9 @@ pub struct OpPayloadBuilderCtx {
6464 pub max_gas_per_txn : Option < u64 > ,
6565 /// Maximum cumulative uncompressed (EIP-2718 encoded) block size in bytes.
6666 pub max_uncompressed_block_size : Option < u64 > ,
67- /// Per-address rate limiting based on gas and/or compute time. This is an
68- /// optional feature.
67+ /// Canonical per-address rate limiter (gas and/or compute time). Each
68+ /// payload job begins a per-build [`AddressLimiterGuard`] off this; the
69+ /// only direct mutation here is the per-block `refill_buckets`.
6970 pub address_limiter : AddressLimiter ,
7071 /// Backrun bundle configuration.
7172 pub backrun_bundle_args : BackrunBundleArgs ,
@@ -82,6 +83,7 @@ pub struct OpPayloadBuilderCtx {
8283/// Container type that holds all necessities to build a new payload.
8384/// This struct is constructed once per payload job.
8485#[ derive( derive_more:: Constructor , derive_more:: Deref ) ]
86+ #[ allow( clippy:: too_many_arguments) ]
8587pub struct OpPayloadJobCtx {
8688 /// Builder-lifetime configuration shared with all other in-flight jobs.
8789 #[ deref]
@@ -98,6 +100,12 @@ pub struct OpPayloadJobCtx {
98100 cancel : FlashblockJobCancellation ,
99101 /// Per-block view into the global backrun bundle pool.
100102 backrun_pool : Option < BackrunBundlePayloadPool > ,
103+ /// Per-build guard onto the canonical [`AddressLimiter`] held by
104+ /// `builder_ctx`. Charges accumulate privately here and auto-commit back
105+ /// into the canonical when this ctx is dropped. Shadows the
106+ /// `address_limiter` field reached via `Deref` to `OpPayloadBuilderCtx`,
107+ /// so `self.address_limiter` inside this ctx always hits the guard.
108+ address_limiter : AddressLimiterGuard ,
101109}
102110
103111impl OpPayloadJobCtx {
0 commit comments