Skip to content
Merged
Show file tree
Hide file tree
Changes from 87 commits
Commits
Show all changes
111 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
228175a
feat(l2): implement operator fee
avilagaston9 Oct 1, 2025
a364d37
Merge branch 'main' into l2/dont-burn-base-fee
avilagaston9 Oct 2, 2025
88ab25e
Update deployer
avilagaston9 Oct 2, 2025
8d1d5a3
Fix clippy
avilagaston9 Oct 2, 2025
51809e4
Prove that the operator_fee is the configured one
avilagaston9 Oct 2, 2025
84f9d7a
Fix l2 hook
avilagaston9 Oct 2, 2025
b2aa76a
Style
avilagaston9 Oct 2, 2025
c6727ff
Merge branch 'l2/dont-burn-base-fee' into feat/l2/operator_fee
avilagaston9 Oct 2, 2025
dec1042
Set operator fee
avilagaston9 Oct 2, 2025
ff5af2b
Update cargo lock
avilagaston9 Oct 2, 2025
1e94dd6
Set fee vault address
avilagaston9 Oct 2, 2025
1db8ba7
Add operator fee to integration tests
avilagaston9 Oct 2, 2025
de54296
Fix env var
avilagaston9 Oct 2, 2025
6af8e5d
Pass operator fee address
avilagaston9 Oct 2, 2025
62e7148
Add test upgrade
avilagaston9 Oct 2, 2025
4b5dc0a
Fix dockers
avilagaston9 Oct 3, 2025
bd063f6
Fix public input length
avilagaston9 Oct 3, 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
82e4a39
Merge branch 'l2/dont-burn-base-fee' into feat/l2/operator_fee
avilagaston9 Oct 3, 2025
e765d7a
Update docs
avilagaston9 Oct 3, 2025
49b7525
Rename fee vault with base fee vault
avilagaston9 Oct 3, 2025
2537cce
Fix based deployment
avilagaston9 Oct 3, 2025
e955f21
Continue renaming fee vault to base fee vault
avilagaston9 Oct 3, 2025
7b64801
Don't call operator fee if based mode is enabled
avilagaston9 Oct 5, 2025
9abd637
Skip operator fee in tests
avilagaston9 Oct 5, 2025
fd2a5e1
Fix tests
avilagaston9 Oct 5, 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
717d838
Merge branch 'l2/dont-burn-base-fee' into feat/l2/operator_fee
avilagaston9 Oct 14, 2025
0b965c8
Fix clippy
avilagaston9 Oct 14, 2025
432e986
Merge branch 'main' into feat/l2/operator_fee
avilagaston9 Oct 14, 2025
f95a173
remove operator fee from onChainProposer
avilagaston9 Oct 14, 2025
c0652ab
Minor improvements
avilagaston9 Oct 14, 2025
a4ebd37
Change l2 hook behavior
avilagaston9 Oct 15, 2025
71290b6
Update tests
avilagaston9 Oct 15, 2025
d33a2e6
Merge branch 'main' into feat/l2/operator_fee
avilagaston9 Oct 15, 2025
df3bb70
Fix workflow linter
avilagaston9 Oct 15, 2025
a894ce9
Fix clippy
avilagaston9 Oct 15, 2025
c7bcf60
fix endpoint
avilagaston9 Oct 16, 2025
e413c06
Fix integration tests
avilagaston9 Oct 16, 2025
df4dc98
Update docs
avilagaston9 Oct 16, 2025
0fd9b2a
Correct env var
avilagaston9 Oct 16, 2025
64be8db
Fix clippy
avilagaston9 Oct 16, 2025
120698a
Update prover to work with multiple fee configs
avilagaston9 Oct 16, 2025
9635098
Merge branch 'main' into feat/l2/operator_fee
avilagaston9 Oct 16, 2025
121f052
Fix typo
avilagaston9 Oct 17, 2025
ff4a7dc
Merge branch 'main' into feat/l2/operator_fee
avilagaston9 Oct 17, 2025
6bb86e8
Remove GetTransactionByHashTransaction
avilagaston9 Oct 22, 2025
4c76c1a
Change operator fee to u64
avilagaston9 Oct 23, 2025
16d0075
Remove clone
avilagaston9 Oct 23, 2025
8822d68
Improve operator fee disable
avilagaston9 Oct 23, 2025
1576933
Remove unneeded clone
avilagaston9 Oct 23, 2025
42416cd
Remove unneeded clone
avilagaston9 Oct 23, 2025
d9f85ca
Merge branch 'main' into feat/l2/operator_fee
avilagaston9 Oct 23, 2025
2ccc672
Update cli.md
avilagaston9 Oct 23, 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
4 changes: 3 additions & 1 deletion .github/workflows/main_prover.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ jobs:
DOCKER_ETHREX_WORKDIR=/usr/local/bin \
ETHREX_DEPLOYER_DEPLOY_RICH=true \
ETHREX_DEPLOYER_SP1_DEPLOY_VERIFIER=true \
ETHREX_ON_CHAIN_PROPOSER_OPERATOR_FEE=0x3B9ACA00 \
docker compose up --build contract_deployer

- name: Ensure admin permissions in _work
Expand All @@ -79,7 +80,8 @@ jobs:
ETHREX_PROPOSER_BLOCK_TIME=12000 \
ETHREX_COMMITTER_COMMIT_TIME=30000 \
ETHREX_WATCHER_WATCH_INTERVAL=1000 \
ETHREX_BLOCK_PRODUCER_FEE_VAULT_ADDRESS=0x000c0d6b7c4516a5b274c51ea331a9410fe69127 \
ETHREX_BLOCK_PRODUCER_BASE_FEE_VAULT_ADDRESS=0x000c0d6b7c4516a5b274c51ea331a9410fe69127 \
ETHREX_BLOCK_PRODUCER_OPERATOR_FEE_VAULT_ADDRESS=0xd5d2a85751b6F158e5b9B8cD509206A865672362 \
docker compose up --build --detach --no-deps ethrex_l2

- name: Copy env to host
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/pr-main_l2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ jobs:
if [ "${{ matrix.based }}" = true ]; then
export ETHREX_DEPLOYER_DEPLOY_BASED_CONTRACTS=true
export COMPILE_CONTRACTS=true
else
export ETHREX_ON_CHAIN_PROPOSER_OPERATOR_FEE=0x3B9ACA00
fi
DOCKER_ETHREX_WORKDIR=/usr/local/bin \
ETHREX_DEPLOYER_DEPLOY_RICH=true \
Expand Down Expand Up @@ -233,6 +235,7 @@ jobs:
cd ..
else
export ETHREX_BLOCK_PRODUCER_FEE_VAULT_ADDRESS=0x000c0d6b7c4516a5b274c51ea331a9410fe69127
export ETHREX_BLOCK_PRODUCER_OPERATOR_FEE_VAULT_ADDRESS=0xd5d2a85751b6F158e5b9B8cD509206A865672362
fi
cd crates/l2
DOCKER_ETHREX_WORKDIR=/usr/local/bin \
Expand Down Expand Up @@ -319,6 +322,7 @@ jobs:
ETHREX_DEPLOYER_DEPLOY_RICH=true \
ETHREX_DEPLOYER_TDX_DEPLOY_VERIFIER=true \
ETHREX_TDX_DEV_MODE=true \
ETHREX_ON_CHAIN_PROPOSER_OPERATOR_FEE=0x3B9ACA00 \
make deploy-l1

- name: Start Sequencer
Expand All @@ -328,7 +332,8 @@ 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_BLOCK_PRODUCER_BASE_FEE_VAULT_ADDRESS=0x000c0d6b7c4516a5b274c51ea331a9410fe69127 \
ETHREX_BLOCK_PRODUCER_OPERATOR_FEE_VAULT_ADDRESS=0xd5d2a85751b6F158e5b9B8cD509206A865672362 \
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 Expand Up @@ -386,6 +391,7 @@ jobs:
ETHREX_DEPLOYER_PICO_CONTRACT_ADDRESS=0x00000000000000000000000000000000000000aa \
ETHREX_DEPLOYER_SP1_CONTRACT_ADDRESS=0x00000000000000000000000000000000000000aa \
ETHREX_DEPLOYER_RISC0_CONTRACT_ADDRESS=0x00000000000000000000000000000000000000aa \
ETHREX_ON_CHAIN_PROPOSER_OPERATOR_FEE=0x0 \
COMPILE_CONTRACTS=true \
docker compose up contract_deployer

Expand Down
2 changes: 1 addition & 1 deletion 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, fee_config::FeeConfig};
use ethrex_common::types::{Block, Genesis, fee_config::FeeConfig, fee_config::FeeConfig};
use ethrex_p2p::{sync::SyncMode, tx_broadcaster::BROADCAST_INTERVAL_MS, types::Node};
use ethrex_rlp::encode::RLPEncode;
use ethrex_storage::error::StoreError;
Expand Down
12 changes: 11 additions & 1 deletion cmd/ethrex/l2/deployer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,14 @@ pub struct DeployerOptions {
help = "The L1 address of the L2 native token (e.g., USDC, USDT, DAI, etc. Use address(0) for ETH)"
)]
pub native_token_l1_address: Address,
#[arg(
long,
value_name = "UINT256",
env = "ETHREX_ON_CHAIN_PROPOSER_OPERATOR_FEE",
help_heading = "Deployer options",
help = "Fee that the operator will receive for each transaction included in a block."
)]
pub operator_fee: U256,
}

impl Default for DeployerOptions {
Expand Down Expand Up @@ -416,6 +424,7 @@ impl Default for DeployerOptions {
inclusion_max_wait: 3000,
use_compiled_genesis: true,
native_token_l1_address: H160::zero(),
operator_fee: U256::zero(),
}
}
}
Expand Down Expand Up @@ -495,7 +504,7 @@ const SP1_VERIFIER_BYTECODE: &[u8] = include_bytes!(concat!(
));

const INITIALIZE_ON_CHAIN_PROPOSER_SIGNATURE_BASED: &str = "initialize(bool,address,address,address,address,address,bytes32,bytes32,bytes32,address,uint256)";
const INITIALIZE_ON_CHAIN_PROPOSER_SIGNATURE: &str = "initialize(bool,address,address,address,address,address,bytes32,bytes32,bytes32,address[],uint256)";
const INITIALIZE_ON_CHAIN_PROPOSER_SIGNATURE: &str = "initialize(bool,address,address,address,address,address,bytes32,bytes32,bytes32,address[],uint256,uint256)";

const INITIALIZE_BRIDGE_ADDRESS_SIGNATURE: &str = "initializeBridgeAddress(address)";
const TRANSFER_OWNERSHIP_SIGNATURE: &str = "transferOwnership(address)";
Expand Down Expand Up @@ -850,6 +859,7 @@ async fn initialize_contracts(
Value::Address(opts.proof_sender_l1_address),
]),
Value::Uint(genesis.config.chain_id.into()),
Value::Uint(opts.operator_fee),
];
trace!(calldata_values = ?calldata_values, "OnChainProposer initialization calldata values");
let on_chain_proposer_initialization_calldata =
Expand Down
65 changes: 61 additions & 4 deletions cmd/ethrex/l2/initializers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,25 @@ use crate::initializers::{
self, get_authrpc_socket_addr, get_http_socket_addr, get_local_node_record, get_local_p2p_node,
get_network, get_signer, init_blockchain, init_network, init_store,
};
use crate::l2::L2Options;
use crate::l2::{L2Options, SequencerOptions};
use crate::utils::{
NodeConfigFile, get_client_version, init_datadir, read_jwtsecret_file, store_node_config_file,
};
use ethrex_blockchain::{Blockchain, BlockchainType};
use ethrex_common::types::fee_config::FeeConfig;
use ethrex_common::U256;
use ethrex_common::types::fee_config::{FeeConfig, OperatorFeeConfig};
use ethrex_common::{Address, types::DEFAULT_BUILDER_GAS_CEIL};
use ethrex_l2::SequencerConfig;
use ethrex_l2_sdk::get_operator_fee;
use ethrex_p2p::{
discv4::peer_table::PeerTable,
peer_handler::PeerHandler,
rlpx::l2::l2_connection::P2PBasedContext,
sync_manager::SyncManager,
types::{Node, NodeRecord},
};
use ethrex_rpc::EthClient;
use ethrex_rpc::clients::EthClientError;
use ethrex_storage::Store;
use ethrex_storage_rollup::{EngineTypeRollup, StoreRollup};
use secp256k1::SecretKey;
Expand Down Expand Up @@ -156,9 +160,14 @@ pub async fn init_l2(
let store = init_store(&datadir, genesis).await;
let rollup_store = init_rollup_store(&rollup_store_dir).await;

let operator_fee_config = get_operator_fee_config(&opts.sequencer_opts).await?;

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

let blockchain_opts = ethrex_blockchain::BlockchainOptions {
Expand Down Expand Up @@ -288,3 +297,51 @@ pub async fn init_l2(
info!("Server shutting down!");
Ok(())
}

pub async fn get_operator_fee_config(
sequencer_opts: &SequencerOptions,
) -> eyre::Result<Option<OperatorFeeConfig>> {
if sequencer_opts.based {
// If based is enabled, operator fee is not applicable
return Ok(None);
}

// Fetch operator fee from the on-chain proposer contract
let operator_fee = fetch_operator_fee(
sequencer_opts.eth_opts.rpc_url.clone(),
sequencer_opts.committer_opts.on_chain_proposer_address,
)
.await?;

// Check if operator fee vault address is provided in the config
let operator_address = sequencer_opts
.block_producer_opts
.operator_fee_vault_address;

let operator_fee_config = if let Some(address) = operator_address {
Some(OperatorFeeConfig {
operator_fee,
operator_fee_vault: address,
})
} else {
if !operator_fee.is_zero() {
error!(
"The operator fee is set on-chain, but no operator fee vault address is provided in the configuration."
);
return Err(eyre::eyre!("Missing operator fee vault address"));
}
None
};
Ok(operator_fee_config)
}

pub async fn fetch_operator_fee(
rpc_urls: Vec<String>,
on_chain_proposer_address: Option<Address>,
) -> Result<U256, EthClientError> {
let contract_address = on_chain_proposer_address.ok_or(EthClientError::Custom(
"on_chain_proposer_address not set in config".to_string(),
))?;
let eth_client = EthClient::new_with_multiple_urls(rpc_urls)?;
get_operator_fee(&eth_client, contract_address).await
}
19 changes: 14 additions & 5 deletions cmd/ethrex/l2/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ impl TryFrom<SequencerOptions> for SequencerConfig {
.block_producer_opts
.coinbase_address
.ok_or(SequencerOptionsError::NoCoinbaseAddress)?,
fee_vault_address: opts.block_producer_opts.fee_vault_address,
base_fee_vault_address: opts.block_producer_opts.base_fee_vault_address,
operator_fee_vault_address: opts.block_producer_opts.operator_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 @@ -389,12 +390,19 @@ pub struct BlockProducerOptions {
)]
pub coinbase_address: Option<Address>,
#[arg(
long = "block-producer.fee-vault-address",
long = "block-producer.base-fee-vault-address",
value_name = "ADDRESS",
env = "ETHREX_BLOCK_PRODUCER_FEE_VAULT_ADDRESS",
env = "ETHREX_BLOCK_PRODUCER_BASE_FEE_VAULT_ADDRESS",
help_heading = "Block producer options"
)]
pub fee_vault_address: Option<Address>,
pub base_fee_vault_address: Option<Address>,
#[arg(
long = "block-producer.operator-fee-vault-address",
value_name = "ADDRESS",
env = "ETHREX_BLOCK_PRODUCER_OPERATOR_FEE_VAULT_ADDRESS",
help_heading = "Block producer options"
)]
pub operator_fee_vault_address: Option<Address>,
#[arg(
long,
default_value = "2",
Expand Down Expand Up @@ -423,7 +431,8 @@ impl Default for BlockProducerOptions {
.parse()
.unwrap(),
),
fee_vault_address: None,
base_fee_vault_address: None,
operator_fee_vault_address: None,
elasticity_multiplier: 2,
block_gas_limit: DEFAULT_BUILDER_GAS_CEIL,
}
Expand Down
9 changes: 5 additions & 4 deletions crates/common/types/l2/fee_config.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
use ethereum_types::Address;
use ethereum_types::{Address, U256};
use rkyv::{Archive, Deserialize as RDeserialize, Serialize as RSerialize};
use serde::{Deserialize, Serialize};

use crate::rkyv_utils::{H160Wrapper, OptionH160Wrapper};
use crate::rkyv_utils::{H160Wrapper, OptionH160Wrapper, U256Wrapper};

#[derive(
Serialize, Deserialize, RDeserialize, RSerialize, Archive, Clone, Copy, Debug, Default,
)]
pub struct FeeConfig {
/// If set, the base fee is sent to this address instead of being burned.
#[rkyv(with=OptionH160Wrapper)]
pub fee_vault: Option<Address>,
pub base_fee_vault: Option<Address>,
pub operator_fee_config: Option<OperatorFeeConfig>,
}

Expand All @@ -22,5 +22,6 @@ pub struct FeeConfig {
pub struct OperatorFeeConfig {
#[rkyv(with=H160Wrapper)]
pub operator_fee_vault: Address,
pub operator_fee: u64,
#[rkyv(with=U256Wrapper)]
pub operator_fee: U256,
}
9 changes: 6 additions & 3 deletions crates/l2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ L1_AUTH_PORT=8551
L1_RPC_ADDRESS=0.0.0.0
L2_RPC_ADDRESS=0.0.0.0
PROOF_COORDINATOR_ADDRESS?=127.0.0.1
ETHREX_ON_CHAIN_PROPOSER_OPERATOR_FEE?=0x3B9ACA00 \

# Matches the ports used by the blockchain/metrics dir
L2_PROMETHEUS_METRICS_PORT = 3702
Expand Down Expand Up @@ -94,7 +95,8 @@ deploy-l1: ## 📜 Deploys the L1 contracts
--deposit-rich \
--private-keys-file-path ../../fixtures/keys/private_keys_l1.txt \
--genesis-l1-path ../../fixtures/genesis/l1-dev.json \
--genesis-l2-path ../../fixtures/genesis/l2.json
--genesis-l2-path ../../fixtures/genesis/l2.json \
--operator-fee ${ETHREX_ON_CHAIN_PROPOSER_OPERATOR_FEE}

## Same as deploy-l1 but deploys the SP1 verifier
deploy-l1-sp1: ## 📜 Deploys the L1 contracts
Expand Down Expand Up @@ -132,7 +134,8 @@ init-l2: ## 🚀 Initializes an L2 Lambda ethrex Client
--l1.on-chain-proposer-address ${DEFAULT_ON_CHAIN_PROPOSER_ADDRESS} \
--eth.rpc-url ${L1_RPC_URL} \
--block-producer.coinbase-address 0x0007a881CD95B1484fca47615B64803dad620C8d \
--block-producer.fee-vault-address 0x000c0d6b7c4516a5b274c51ea331a9410fe69127 \
--block-producer.base-fee-vault-address 0x000c0d6b7c4516a5b274c51ea331a9410fe69127 \
--block-producer.operator-fee-vault-address 0xd5d2a85751b6F158e5b9B8cD509206A865672362 \
--committer.l1-private-key 0x385c546456b6a603a1cfcaa9ec9494ba4832da08dd6bcf4de9a71e4a01b74924 \
--proof-coordinator.l1-private-key 0x39725efee3fb28614de3bacaffe4cc4bd8c436257e2c8bb887c4b5c4be45e76d \
--proof-coordinator.addr ${PROOF_COORDINATOR_ADDRESS}
Expand Down Expand Up @@ -181,7 +184,7 @@ build-prover:
../../target/release/ethrex: $(PROVER_SRC_FILES)
@if [ -z "$$PROVER" ]; then \
echo "Warn: ProverType (PROVER) is missing. Building only with exec mode."; \
echo "Please provide it as an argument:"; \
echo "You can provide it as an argument:"; \
echo "make init-prover PROVER=<prover_type: (risc0, sp1)> G=<true>"; \
echo "The prover can also be run with GPU (G)"; \
fi; \
Expand Down
15 changes: 13 additions & 2 deletions crates/l2/contracts/src/l1/OnChainProposer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ contract OnChainProposer is
/// @notice Chain ID of the network
uint256 public CHAIN_ID;

/// @notice Fee in wei to be paid to the operator fee vault on each transaction
uint256 public OPERATOR_FEE;

modifier onlySequencer() {
require(
authorizedSequencerAddresses[msg.sender],
Expand All @@ -117,7 +120,8 @@ contract OnChainProposer is
bytes32 risc0Vk,
bytes32 genesisStateRoot,
address[] calldata sequencerAddresses,
uint256 chainId
uint256 chainId,
uint256 operatorFee
) public initializer {
VALIDIUM = _validium;

Expand Down Expand Up @@ -166,6 +170,7 @@ contract OnChainProposer is
}

CHAIN_ID = chainId;
OPERATOR_FEE = operatorFee;

OwnableUpgradeable.__Ownable_init(owner);
}
Expand Down Expand Up @@ -471,7 +476,7 @@ contract OnChainProposer is
uint256 batchNumber,
bytes calldata publicData
) internal view returns (string memory) {
if (publicData.length != 256) {
if (publicData.length != 288) {
return "invalid public data length";
}
bytes32 initialStateRoot = bytes32(publicData[0:32]);
Expand Down Expand Up @@ -530,6 +535,12 @@ contract OnChainProposer is
return
"exceeded privileged transaction inclusion deadline, can't include non-privileged transactions";
}

uint256 operatorFee = uint256(bytes32(publicData[256:288]));
if (OPERATOR_FEE != operatorFee) {
return
"operator fee public input does not match with the configured operator fee";
}
return "";
}

Expand Down
2 changes: 1 addition & 1 deletion crates/l2/docker-compose-l2-store.overrides.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
--datadir /store
--proof-coordinator.addr 0.0.0.0
--block-producer.coinbase-address 0x0007a881CD95B1484fca47615B64803dad620C8d
--block-producer.fee-vault-address 0x000c0d6b7c4516a5b274c51ea331a9410fe69127
--block-producer.base-fee-vault-address 0x000c0d6b7c4516a5b274c51ea331a9410fe69127
--committer.l1-private-key 0x385c546456b6a603a1cfcaa9ec9494ba4832da08dd6bcf4de9a71e4a01b74924
--proof-coordinator.l1-private-key 0x39725efee3fb28614de3bacaffe4cc4bd8c436257e2c8bb887c4b5c4be45e76d
--no-monitor
2 changes: 1 addition & 1 deletion crates/l2/docker-compose-l2-web3signer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
--authrpc.port 8552
--proof-coordinator.addr 0.0.0.0
--block-producer.coinbase-address 0x0007a881CD95B1484fca47615B64803dad620C8d
--block-producer.fee-vault-address 0x000c0d6b7c4516a5b274c51ea331a9410fe69127
--block-producer.base-fee-vault-address 0x000c0d6b7c4516a5b274c51ea331a9410fe69127
--committer.remote-signer-url http://web3signer:9000
--committer.remote-signer-public-key 02eadbea0cdb17fda8d56fc9c51df8a6158c2ab157aabf2ca57c3a32cd69f98bbc
--proof-coordinator.remote-signer-url http://web3signer:9000
Expand Down
Loading
Loading