Skip to content
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
40948ec
feat(l2): pay base fee to coinbase
MegaRedHand Sep 17, 2025
875ed1b
Revert "feat(l2): pay base fee to coinbase"
avilagaston9 Sep 22, 2025
2f11290
feat(l2): pay base_fee to fee_vault
avilagaston9 Sep 22, 2025
a99d587
Add fee_vault to blockchain
avilagaston9 Sep 22, 2025
d6a8571
Update modules to use fee_vault
avilagaston9 Sep 23, 2025
92319c0
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Sep 23, 2025
107336d
Impplement feeVault endpoint
avilagaston9 Sep 23, 2025
c562dd2
Update replay to use fee_vault
avilagaston9 Sep 24, 2025
2fb0a58
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Sep 24, 2025
c51c603
Fix tdx
avilagaston9 Sep 24, 2025
002f151
Rename fee vault to coinbase in tests
avilagaston9 Sep 24, 2025
605f14a
Fix linter
avilagaston9 Sep 24, 2025
bb68f7f
Update tests
avilagaston9 Sep 24, 2025
33930ee
Fix workflow
avilagaston9 Sep 24, 2025
57e8526
Fix integration tests
avilagaston9 Sep 24, 2025
818eb12
Fix based workflow
avilagaston9 Sep 24, 2025
d7b02b9
Remove fee_Vault from add_block
avilagaston9 Sep 24, 2025
df483ca
Rename base_fees to priority fees in test
avilagaston9 Sep 24, 2025
d29b1a0
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Sep 24, 2025
e7ffedd
Update cli.md
avilagaston9 Sep 25, 2025
061a617
Add disclaimer to docs
avilagaston9 Sep 25, 2025
80d57dc
Move fee_vault to blockchain struct
avilagaston9 Sep 25, 2025
7beb781
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Sep 25, 2025
9aa0407
Fix linter
avilagaston9 Sep 25, 2025
6445c83
Use cfg! macro to resolve fee_vault
avilagaston9 Sep 25, 2025
9ae2402
separate payload builder interfaces
avilagaston9 Sep 25, 2025
65da300
Store fee_vault in l2_hook
avilagaston9 Sep 25, 2025
ef38d69
Improve docs
avilagaston9 Sep 25, 2025
4316a28
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Sep 25, 2025
7c692f2
Add disclaimer
avilagaston9 Sep 25, 2025
39d3a1b
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Sep 29, 2025
a564e8a
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Sep 29, 2025
8f57e41
Add fee_config to blockchain and vm l2 type
avilagaston9 Sep 30, 2025
df122ef
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Sep 30, 2025
2846e16
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Sep 30, 2025
3b3d001
Fix ethrex replay for l2
avilagaston9 Sep 30, 2025
aa01211
Fix tdx build
avilagaston9 Sep 30, 2025
9eaf648
Minor improvements
avilagaston9 Sep 30, 2025
d4dc659
Fix linter
avilagaston9 Sep 30, 2025
a364d37
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Oct 2, 2025
0075f72
Update docs
avilagaston9 Oct 3, 2025
4b536c2
Remove extra line
avilagaston9 Oct 3, 2025
39109f6
Update summary
avilagaston9 Oct 3, 2025
a02fcde
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Oct 3, 2025
ddb9a95
Restore replay
avilagaston9 Oct 3, 2025
ca0ce92
restore MAX_MEMPOOL_SIZE_DEFAULT
avilagaston9 Oct 11, 2025
39c196f
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Oct 11, 2025
7172748
Fix clippy
avilagaston9 Oct 11, 2025
652fa08
Restore genesis
avilagaston9 Oct 11, 2025
4eafeb4
register default fee vault pk
avilagaston9 Oct 11, 2025
950540e
Skip fee vault check in l2 dev tests
avilagaston9 Oct 13, 2025
11c9789
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Oct 13, 2025
749fda6
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Oct 13, 2025
1b71dd7
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Oct 13, 2025
c22ffc2
Free disk space in based
avilagaston9 Oct 13, 2025
29cacdf
Restore based workflow
avilagaston9 Oct 13, 2025
26e34c0
Merge based workflow in matrix
avilagaston9 Oct 14, 2025
704d9e6
Removed based from all-test
avilagaston9 Oct 14, 2025
e098174
Install rex in based
avilagaston9 Oct 14, 2025
e034fdc
Don't set fee vault in based
avilagaston9 Oct 14, 2025
fa54633
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Oct 14, 2025
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
1 change: 1 addition & 0 deletions .github/workflows/main_prover.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
ETHREX_PROPOSER_BLOCK_TIME=12000 \
ETHREX_COMMITTER_COMMIT_TIME=30000 \
ETHREX_WATCHER_WATCH_INTERVAL=1000 \
ETHREX_BLOCK_PRODUCER_FEE_VAULT_ADDRESS=0x000c0d6b7c4516a5b274c51ea331a9410fe69127 \
docker compose up --build --detach --no-deps ethrex_l2

- name: Copy env to host
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/pr-main_l2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ jobs:
ETHREX_WATCHER_BLOCK_DELAY=0 \
ETHREX_COMMITTER_COMMIT_TIME=15000 \
ETHREX_WATCHER_WATCH_INTERVAL=1000 \
ETHREX_BLOCK_PRODUCER_FEE_VAULT_ADDRESS=0x000c0d6b7c4516a5b274c51ea331a9410fe69127 \
docker compose -f ${{ join(matrix.compose_targets, ' -f ') }} up --detach --no-deps ethrex_l2

- name: Run test
Expand Down Expand Up @@ -275,7 +276,9 @@ jobs:
cd crates/l2
RUST_LOG=info,ethrex_prover_lib=debug make init-prover &
docker logs --follow ethrex_l2 &
PROPOSER_COINBASE_ADDRESS=0x0007a881CD95B1484fca47615B64803dad620C8d cargo test l2 --release -- --nocapture --test-threads=1
PROPOSER_COINBASE_ADDRESS=0x0007a881CD95B1484fca47615B64803dad620C8d \
INTEGRATION_TEST_SKIP_FEE_VAULT_CHECK=true \
cargo test l2 --release -- --nocapture --test-threads=1
killall ethrex -s SIGINT

integration-test-tdx:
Expand Down Expand Up @@ -352,6 +355,7 @@ jobs:
ETHREX_WATCHER_WATCH_INTERVAL=1000 \
DOCKER_ETHREX_WORKDIR=/usr/local/bin \
ETHREX_COMMITTER_COMMIT_TIME=15000 \
ETHREX_BLOCK_PRODUCER_FEE_VAULT_ADDRESS=0x000c0d6b7c4516a5b274c51ea331a9410fe69127 \
ETHREX_PROOF_COORDINATOR_ADDRESS=0.0.0.0 \
docker compose -f docker-compose.yaml -f docker-compose-l2-tdx.yaml up --detach --no-deps ethrex_l2

Expand Down
4 changes: 2 additions & 2 deletions cmd/ethrex/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{

use clap::{ArgAction, Parser as ClapParser, Subcommand as ClapSubcommand};
use ethrex_blockchain::{BlockchainOptions, BlockchainType, error::ChainError};
use ethrex_common::types::{Block, Genesis};
use ethrex_common::types::{Block, Genesis, fee_config::FeeConfig};
use ethrex_p2p::sync::SyncMode;
use ethrex_p2p::types::Node;
use ethrex_rlp::encode::RLPEncode;
Expand Down Expand Up @@ -336,7 +336,7 @@ impl Subcommand {
let network = get_network(opts);
let genesis = network.get_genesis()?;
let blockchain_type = if l2 {
BlockchainType::L2
BlockchainType::L2(FeeConfig::default())
} else {
BlockchainType::L1
};
Expand Down
8 changes: 7 additions & 1 deletion cmd/ethrex/l2/initializers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::time::Duration;
use ethrex_blockchain::{Blockchain, BlockchainType};
use ethrex_common::Address;
use ethrex_common::types::DEFAULT_BUILDER_GAS_CEIL;
use ethrex_common::types::fee_config::FeeConfig;
use ethrex_l2::SequencerConfig;
use ethrex_p2p::kademlia::Kademlia;
use ethrex_p2p::network::peer_table;
Expand Down Expand Up @@ -167,9 +168,14 @@ pub async fn init_l2(
let store = init_store(&datadir, genesis).await;
let rollup_store = init_rollup_store(&rollup_store_dir).await;

let fee_config = FeeConfig {
fee_vault: opts.sequencer_opts.block_producer_opts.fee_vault_address,
..Default::default()
};

let blockchain_opts = ethrex_blockchain::BlockchainOptions {
max_mempool_size: opts.node_opts.mempool_max_size,
r#type: BlockchainType::L2,
r#type: BlockchainType::L2(fee_config),
perf_logs_enabled: true,
};

Expand Down
9 changes: 9 additions & 0 deletions cmd/ethrex/l2/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ impl TryFrom<SequencerOptions> for SequencerConfig {
.block_producer_opts
.coinbase_address
.ok_or(SequencerOptionsError::NoCoinbaseAddress)?,
fee_vault_address: opts.block_producer_opts.fee_vault_address,
elasticity_multiplier: opts.block_producer_opts.elasticity_multiplier,
block_gas_limit: opts.block_producer_opts.block_gas_limit,
},
Expand Down Expand Up @@ -387,6 +388,13 @@ pub struct BlockProducerOptions {
required_unless_present = "dev"
)]
pub coinbase_address: Option<Address>,
#[arg(
long = "block-producer.fee-vault-address",
value_name = "ADDRESS",
env = "ETHREX_BLOCK_PRODUCER_FEE_VAULT_ADDRESS",
help_heading = "Block producer options"
)]
pub fee_vault_address: Option<Address>,
#[arg(
long,
default_value = "2",
Expand Down Expand Up @@ -415,6 +423,7 @@ impl Default for BlockProducerOptions {
.parse()
.unwrap(),
),
fee_vault_address: None,
elasticity_multiplier: 2,
block_gas_limit: DEFAULT_BUILDER_GAS_CEIL,
}
Expand Down
11 changes: 3 additions & 8 deletions cmd/ethrex_replay/src/cache.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use ethrex_common::types::Block;
use ethrex_common::types::ChainConfig;
use ethrex_common::types::blobs_bundle;
use ethrex_common::types::fee_config::FeeConfig;
use ethrex_config::networks::Network;
use ethrex_rpc::debug::execution_witness::RpcExecutionWitness;
use eyre::OptionExt;
Expand All @@ -22,6 +23,7 @@ pub struct L2Fields {
pub blob_commitment: blobs_bundle::Commitment,
#[serde_as(as = "[_; 48]")]
pub blob_proof: blobs_bundle::Proof,
pub fee_config: FeeConfig,
}
/// Structure holding input data needed to execute or prove blocks.
/// Optional fields are included only when relevant (e.g. L2 or custom chain).
Expand Down Expand Up @@ -75,18 +77,11 @@ impl Cache {
witness: RpcExecutionWitness,
chain_config: ChainConfig,
dir: PathBuf,
l2_fields: Option<L2Fields>,
) -> Self {
let network = network_from_chain_id(chain_config.chain_id);
#[cfg(feature = "l2")]
let l2_fields = Some(L2Fields {
blob_commitment: [0u8; 48],
blob_proof: [0u8; 48],
});
#[cfg(feature = "l2")]
let chain_config = Some(chain_config);

#[cfg(not(feature = "l2"))]
let l2_fields = None;
#[cfg(not(feature = "l2"))]
let chain_config = None;
Self {
Expand Down
59 changes: 51 additions & 8 deletions cmd/ethrex_replay/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ use ethrex_blockchain::{
fork_choice::apply_fork_choice,
payload::{BuildPayloadArgs, PayloadBuildResult, create_payload},
};
#[cfg(feature = "l2")]
use ethrex_common::types::fee_config::FeeConfig;
use ethrex_common::{
Address, H256,
types::{
AccountState, AccountUpdate, Block, BlockHeader, DEFAULT_BUILDER_GAS_CEIL,
ELASTICITY_MULTIPLIER, Receipt, block_execution_witness::GuestProgramState,
},
};
#[cfg(feature = "l2")]
use ethrex_l2_rpc::clients::get_fee_vault_address;
use ethrex_prover_lib::backend::Backend;
use ethrex_rlp::{decode::RLPDecode, encode::RLPEncode};
use ethrex_rpc::{
Expand Down Expand Up @@ -355,6 +359,8 @@ pub struct BatchOptions {
pub struct CustomBlockOptions {
#[command(flatten)]
common: CommonOptions,
#[arg(long, help = "Fee vault address to use in L2 blocks.")]
fee_vault: Option<Address>,
}

#[derive(Parser)]
Expand All @@ -367,6 +373,8 @@ pub struct CustomBatchOptions {
n_blocks: u64,
#[command(flatten)]
common: CommonOptions,
#[arg(long, help = "Fee vault address to use in L2 blocks.")]
fee_vault: Option<Address>,
}

impl EthrexReplayCommand {
Expand Down Expand Up @@ -509,19 +517,24 @@ impl EthrexReplayCommand {
}
}
#[cfg(not(feature = "l2"))]
Self::Custom(CustomSubcommand::Block(CustomBlockOptions { common })) => {
Self::Custom(CustomSubcommand::Block(CustomBlockOptions { common, fee_vault })) => {
Box::pin(async move {
Self::Custom(CustomSubcommand::Batch(CustomBatchOptions {
n_blocks: 1,
common,
fee_vault,
}))
.run()
.await
})
.await?;
}
#[cfg(not(feature = "l2"))]
Self::Custom(CustomSubcommand::Batch(CustomBatchOptions { n_blocks, common })) => {
Self::Custom(CustomSubcommand::Batch(CustomBatchOptions {
n_blocks,
common,
fee_vault: _,
})) => {
let opts = EthrexReplayOptions {
rpc_url: Some(Url::parse("http://localhost:8545")?),
cached: false,
Expand Down Expand Up @@ -596,7 +609,13 @@ impl EthrexReplayCommand {

let (eth_client, network) = setup_rpc(&opts).await?;

let cache = get_batchdata(eth_client, network, batch, opts.cache_dir).await?;
let fee_config = FeeConfig {
fee_vault: get_fee_vault_address(&eth_client).await?,
..Default::default()
};

let cache =
get_batchdata(eth_client, network, batch, opts.cache_dir, fee_config).await?;

let backend = backend(&opts.common.zkvm)?;

Expand All @@ -618,12 +637,14 @@ impl EthrexReplayCommand {
#[cfg(feature = "l2")]
Self::L2(L2Subcommand::Custom(CustomSubcommand::Block(CustomBlockOptions {
common,
fee_vault,
}))) => {
Box::pin(async move {
Self::L2(L2Subcommand::Custom(CustomSubcommand::Batch(
CustomBatchOptions {
n_blocks: 1,
common,
fee_vault,
},
)))
.run()
Expand All @@ -635,6 +656,7 @@ impl EthrexReplayCommand {
Self::L2(L2Subcommand::Custom(CustomSubcommand::Batch(CustomBatchOptions {
n_blocks,
common,
fee_vault,
}))) => {
let opts = EthrexReplayOptions {
common,
Expand All @@ -649,7 +671,12 @@ impl EthrexReplayCommand {
network: None,
};

let report = replay_custom_l2_blocks(max(1, n_blocks), opts).await?;
let fee_config = FeeConfig {
fee_vault: fee_vault,
..Default::default()
};

let report = replay_custom_l2_blocks(max(1, n_blocks), fee_config, opts).await?;

println!("{report}");
}
Expand Down Expand Up @@ -827,6 +854,7 @@ async fn replay_transaction(tx_opts: TransactionOpts) -> eyre::Result<()> {
.get_transaction_by_hash(tx_hash)
.await?
.ok_or(eyre::Error::msg("error fetching transaction"))?;

get_blockdata(tx_opts.opts, Some(tx.block_number.as_u64()))
.await?
.0
Expand Down Expand Up @@ -1042,6 +1070,7 @@ pub async fn replay_custom_l1_blocks(
RpcExecutionWitness::from(execution_witness),
chain_config,
opts.cache_dir,
None,
);

let execution_result = exec(backend(&opts.common.zkvm)?, cache.clone()).await;
Expand Down Expand Up @@ -1155,9 +1184,11 @@ use ethrex_vm::BlockExecutionResult;
#[cfg(feature = "l2")]
pub async fn replay_custom_l2_blocks(
n_blocks: u64,
fee_config: FeeConfig,
opts: EthrexReplayOptions,
) -> eyre::Result<Report> {
use ethrex_blockchain::{BlockchainOptions, BlockchainType};
use crate::cache::L2Fields;
use ethrex_blockchain::{BlockchainOptions, BlockchainType, MAX_MEMPOOL_SIZE_DEFAULT};

let network = Network::LocalDevnetL2;

Expand All @@ -1179,9 +1210,14 @@ pub async fn replay_custom_l2_blocks(
rollup_store
};

let mut blockchain_options = BlockchainOptions::default();
blockchain_options.r#type = BlockchainType::L2;
let blockchain = Arc::new(Blockchain::new(store.clone(), blockchain_options));
let blockchain = Arc::new(Blockchain::new(
store.clone(),
BlockchainOptions {
max_mempool_size: MAX_MEMPOOL_SIZE_DEFAULT,
r#type: BlockchainType::L2(fee_config.clone()),
..Default::default()
},
));

let genesis_hash = genesis.get_block().hash();

Expand All @@ -1197,11 +1233,18 @@ pub async fn replay_custom_l2_blocks(

let execution_witness = blockchain.generate_witness_for_blocks(&blocks).await?;

let l2_fields = Some(L2Fields {
blob_commitment: [0u8; 48],
blob_proof: [0u8; 48],
fee_config,
});

let cache = Cache::new(
blocks,
RpcExecutionWitness::from(execution_witness),
genesis.config,
opts.cache_dir.clone(),
l2_fields,
);

let backend = backend(&opts.common.zkvm)?;
Expand Down
Loading
Loading