Skip to content

custom gas limit #292

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

Merged
merged 3 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions anchor/client/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,18 @@ pub struct Node {
)]
pub work_queue_size: Vec<String>,

#[clap(
long,
value_name = "INTEGER",
default_value_t = 36_000_000,
requires = "builder_proposals",
help = "The gas limit to be used in all builder proposals for all validators managed. \
Note this will not necessarily be used if the gas limit \
set here moves too far from the previous block's gas limit.",
display_order = 0
)]
pub gas_limit: u64,

#[clap(
long,
alias = "private-tx-proposals",
Expand Down
5 changes: 5 additions & 0 deletions anchor/client/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ pub struct Config {
pub disable_slashing_protection: bool,
/// Act as impostor
pub impostor: Option<OperatorId>,
/// Gas limit on blocks
pub gas_limit: u64,
/// Should payload construction be outsourced
pub builder_proposals: bool,
/// Block boost factor
Expand Down Expand Up @@ -116,6 +118,7 @@ impl Config {
builder_proposals: false,
builder_boost_factor: None,
prefer_builder_proposals: false,
gas_limit: 36_000_000,
}
}
}
Expand Down Expand Up @@ -209,6 +212,8 @@ pub fn from_cli(cli_args: &Node) -> Result<Config, String> {
config.builder_boost_factor = cli_args.builder_boost_factor;
config.prefer_builder_proposals = cli_args.prefer_builder_proposals;

config.gas_limit = cli_args.gas_limit;

// Http API server
config.http_api.enabled = cli_args.http;

Expand Down
1 change: 1 addition & 0 deletions anchor/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ impl Client {
genesis_validators_root,
config.impostor.is_none().then_some(key),
executor.clone(),
config.gas_limit,
config.builder_proposals,
config.builder_boost_factor,
config.prefer_builder_proposals,
Expand Down
7 changes: 4 additions & 3 deletions anchor/validator_store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ pub struct AnchorValidatorStore<T: SlotClock + 'static, E: EthSpec> {
genesis_validators_root: Hash256,
private_key: Option<Rsa<Private>>,
slot_metadata: watch::Sender<Option<Arc<SlotMetadata<E>>>>,
gas_limit: u64,
// MEV configuration is applied at the operator level and applies to all validators this
// operator controls
builder_proposals: bool,
Expand All @@ -120,6 +121,7 @@ impl<T: SlotClock, E: EthSpec> AnchorValidatorStore<T, E> {
genesis_validators_root: Hash256,
private_key: Option<Rsa<Private>>,
task_executor: TaskExecutor,
gas_limit: u64,
builder_proposals: bool,
builder_boost_factor: Option<u64>,
prefer_builder_proposals: bool,
Expand All @@ -137,6 +139,7 @@ impl<T: SlotClock, E: EthSpec> AnchorValidatorStore<T, E> {
genesis_validators_root,
private_key,
slot_metadata: watch::channel(None).0,
gas_limit,
builder_proposals,
builder_boost_factor,
prefer_builder_proposals,
Expand Down Expand Up @@ -1351,9 +1354,7 @@ impl<T: SlotClock, E: EthSpec> ValidatorStore for AnchorValidatorStore<T, E> {
self.validator(*pubkey).ok().map(|v| ProposalData {
validator_index: v.metadata.index.map(|idx| *idx as u64),
fee_recipient: Some(v.cluster.fee_recipient),
// TODO: Support custom gas limits
// https://github.com/sigp/anchor/issues/262
gas_limit: 36_000_000,
gas_limit: self.gas_limit,
builder_proposals: self.builder_proposals,
})
}
Expand Down
Loading