Skip to content
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

Feat/support 4844 #19

Closed
Closed
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
643 changes: 586 additions & 57 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ opt-level = 3
# use optimized risc0 circuit
revm = { git = "https://github.com/johntaiko/revm", branch = "feat/taiko" }
revm-primitives = { git = "https://github.com/johntaiko/revm", branch = "feat/taiko" }

ethers-core = {git = "https://github.com/smtmfft/ethers-rs", branch = "ethers-core-2.0.10"}
ethers-providers = {git = "https://github.com/smtmfft/ethers-rs", branch = "ethers-core-2.0.10"}

[workspace.dependencies]
bonsai-sdk = "0.4"
Expand Down
6 changes: 6 additions & 0 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ edition = "2021"
[dependencies]
anyhow = "1.0"
alloy-sol-types = { version = "0.4", optional = true }
reth-primitives = {git = "https://github.com/paradigmxyz/reth.git", branch = "main", features = ["c-kzg"]}
# reth = {git = "https://github.com/paradigmxyz/reth.git", branch = "main"}
ethers-core = { version = "2.0", features = ["optimism"] }
hashbrown = { workspace = true }
once_cell = "1.18"
Expand All @@ -17,6 +19,10 @@ zeth-primitives = { path = "../primitives", features = ["revm"] }
hex = "0.4.3"
rlp = "0.5.2"
tracing = "0.1"
reqwest = "0.11.22"
sha2 = "0.10.8"
proptest = "1.4.0"
c-kzg = "0.4.0"

[target.'cfg(not(target_os = "zkvm"))'.dependencies]
chrono = { version = "0.4", default-features = false }
Expand Down
10 changes: 0 additions & 10 deletions lib/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ pub static ETH_MAINNET_CHAIN_SPEC: Lazy<ChainSpec> = Lazy::new(|| {
elasticity_multiplier: uint!(2_U256),
},
l1_contract: None,
l1_signal_service: None,
l2_contract: None,
l2_signal_service: None,
}
});

Expand All @@ -86,9 +84,7 @@ macro_rules! taiko_chain_spec {
elasticity_multiplier: uint!(2_U256),
},
l1_contract: Some(*L1_CONTRACT),
l1_signal_service: Some(*L1_SIGNAL_SERVICE),
l2_contract: Some(*L2_CONTRACT),
l2_signal_service: Some(*L2_SIGNAL_SERVICE),
}
});
};
Expand Down Expand Up @@ -118,9 +114,7 @@ pub static OP_MAINNET_CHAIN_SPEC: Lazy<ChainSpec> = Lazy::new(|| ChainSpec {
elasticity_multiplier: uint!(6_U256),
},
l1_contract: None,
l1_signal_service: None,
l2_contract: None,
l2_signal_service: None,
});

/// The condition at which a fork is activated.
Expand Down Expand Up @@ -170,9 +164,7 @@ pub struct ChainSpec {
hard_forks: BTreeMap<SpecId, ForkCondition>,
eip_1559_constants: Eip1559Constants,
pub l1_contract: Option<Address>,
pub l1_signal_service: Option<Address>,
pub l2_contract: Option<Address>,
pub l2_signal_service: Option<Address>,
}

impl ChainSpec {
Expand All @@ -187,9 +179,7 @@ impl ChainSpec {
hard_forks: BTreeMap::from([(spec_id, ForkCondition::Block(0))]),
eip_1559_constants,
l1_contract: None,
l1_signal_service: None,
l2_contract: None,
l2_signal_service: None,
}
}
/// Returns the network chain ID.
Expand Down
16 changes: 16 additions & 0 deletions lib/src/execution/ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,22 @@ pub fn fill_eth_tx_env(tx_env: &mut TxEnv, essence: &EthereumTxEssence, caller:
tx_env.nonce = Some(tx.nonce);
tx_env.access_list = tx.access_list.clone().into();
}
EthereumTxEssence::Eip4844(tx) => {
tx_env.caller = caller;
tx_env.gas_limit = tx.gas_limit.try_into().unwrap();
tx_env.gas_price = tx.max_fee_per_gas;
tx_env.gas_priority_fee = Some(tx.max_priority_fee_per_gas);
tx_env.transact_to = if let TransactionKind::Call(to_addr) = tx.to {
TransactTo::Call(to_addr)
} else {
TransactTo::create()
};
tx_env.value = tx.value;
tx_env.data = tx.data.clone();
tx_env.chain_id = Some(tx.chain_id);
tx_env.nonce = Some(tx.nonce);
tx_env.access_list = tx.access_list.clone().into();
}
};
}

Expand Down
16 changes: 16 additions & 0 deletions lib/src/taiko/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,22 @@ pub fn fill_eth_tx_env(
tx_env.nonce = Some(tx.nonce);
tx_env.access_list = tx.access_list.clone().into();
}
EthereumTxEssence::Eip4844(tx) => {
tx_env.caller = caller;
tx_env.gas_limit = tx.gas_limit.try_into().unwrap();
tx_env.gas_price = tx.max_fee_per_gas;
tx_env.gas_priority_fee = Some(tx.max_priority_fee_per_gas);
tx_env.transact_to = if let TransactionKind::Call(to_addr) = tx.to {
TransactTo::Call(to_addr)
} else {
TransactTo::create()
};
tx_env.value = tx.value;
tx_env.data = tx.data.clone();
tx_env.chain_id = Some(tx.chain_id);
tx_env.nonce = Some(tx.nonce);
tx_env.access_list = tx.access_list.clone().into();
}
};
}

Expand Down
Loading
Loading