Skip to content
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
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ alloy-evm = { version = "0.39.0", path = "crates/evm", default-features = false
# alloy
alloy-eip2124 = { version = "0.2", default-features = false }
alloy-chains = { version = "0.2.0", default-features = false }
alloy-eips = { git = "https://github.com/Rimeeeeee/alloy", rev = "e2ac522f76175f18cbfe557a0770b0758a024432", default-features = false }
alloy-consensus = { git = "https://github.com/Rimeeeeee/alloy", rev = "e2ac522f76175f18cbfe557a0770b0758a024432", default-features = false }
alloy-eips = { git = "https://github.com/wevm/alloy", rev = "e9e217b0baa1045fb4de76cab9bbb703e3ca9898", default-features = false }
alloy-consensus = { git = "https://github.com/wevm/alloy", rev = "e9e217b0baa1045fb4de76cab9bbb703e3ca9898", default-features = false }
alloy-primitives = { version = "1.0.0", default-features = false }
alloy-sol-types = { version = "1.0.0", default-features = false }
alloy-hardforks = "0.4.8"
alloy-rpc-types-eth = { git = "https://github.com/Rimeeeeee/alloy", rev = "e2ac522f76175f18cbfe557a0770b0758a024432", default-features = false }
alloy-rpc-types-engine = { git = "https://github.com/Rimeeeeee/alloy", rev = "e2ac522f76175f18cbfe557a0770b0758a024432", default-features = false }
alloy-rpc-types-eth = { git = "https://github.com/wevm/alloy", rev = "e9e217b0baa1045fb4de76cab9bbb703e3ca9898", default-features = false }
alloy-rpc-types-engine = { git = "https://github.com/wevm/alloy", rev = "e9e217b0baa1045fb4de76cab9bbb703e3ca9898", default-features = false }

# revm
revm = { git = "https://github.com/Soubhik-10/revm", rev = "4531254f28ff8a14fcf8bb26bacc997ea8a4a6ce", default-features = false }
revm = { git = "https://github.com/wevm/revm", rev = "cfec0b31874b0da5db8c055df4e8de0556eac466", default-features = false }

# tracing
tracing = { version = "0.1", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions crates/evm/src/eth/receipt_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ mod tests {
payer,
logs: frame_receipts[0].logs.clone(),
frame_receipts: frame_receipts.clone(),
frame_outputs: vec![Default::default()],
};

let receipt = build_alloy_receipt(TxType::Eip8141, result, 100).unwrap();
Expand Down
18 changes: 13 additions & 5 deletions crates/evm/src/rpc/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ pub enum EthTxEnvError {
/// transaction envelope and therefore cannot be silently normalized away.
#[error("EIP-8141 transaction request contains non-canonical outer fields")]
Eip8141InvalidOuterFields,
/// A frame request must have both gas limits before execution.
#[error("{0}")]
Eip8141MissingLimit(&'static str),
}

impl<Spec, Block: BlockEnvironment> TryIntoTxEnv<TxEnv, Spec, Block> for TransactionRequest {
Expand Down Expand Up @@ -148,7 +151,12 @@ impl<Spec, Block: BlockEnvironment> TryIntoTxEnv<TxEnv, Spec, Block> for Transac
chain_id,
nonce,
sender: caller,
frames: frames.unwrap_or_default(),
frames: frames
.unwrap_or_default()
.into_iter()
.map(TryInto::try_into)
.collect::<Result<_, _>>()
.map_err(EthTxEnvError::Eip8141MissingLimit)?,
signatures: signatures.unwrap_or_default(),
fees: TransactionFees {
max_priority_fee_per_gas: requested_max_priority_fee_per_gas
Expand Down Expand Up @@ -222,7 +230,7 @@ mod tests {
max_priority_fee_per_gas: Some(0),
max_fee_per_blob_gas: Some(0),
blob_versioned_hashes: Some(Vec::new()),
frames: Some(vec![Frame::default()]),
frames: Some(vec![Frame::default().into()]),
signatures: Some(Vec::new()),
transaction_type: Some(TxType::Eip8141 as u8),
..Default::default()
Expand All @@ -249,7 +257,7 @@ mod tests {
max_priority_fee_per_gas: None,
max_fee_per_blob_gas: Some(0),
blob_versioned_hashes: Some(Vec::new()),
frames: Some(vec![Frame::default()]),
frames: Some(vec![Frame::default().into()]),
signatures: Some(Vec::<FrameSignature>::new()),
eip8141_fees: Some(fees),
transaction_type: Some(TxType::Eip8141 as u8),
Expand All @@ -267,7 +275,7 @@ mod tests {
#[test]
fn frame_request_explicit_fees_override_full_width_fallback() {
let request = TransactionRequest {
frames: Some(vec![Frame::default()]),
frames: Some(vec![Frame::default().into()]),
max_fee_per_gas: Some(20),
max_priority_fee_per_gas: Some(2),
max_fee_per_blob_gas: Some(0),
Expand All @@ -289,7 +297,7 @@ mod tests {
#[test]
fn frame_request_validates_full_width_fees() {
let request = TransactionRequest {
frames: Some(vec![Frame::default()]),
frames: Some(vec![Frame::default().into()]),
eip8141_fees: Some(TransactionFees {
max_fee_per_gas: U256::from(u128::MAX) + U256::from(1),
max_priority_fee_per_gas: U256::from(u128::MAX) + U256::from(2),
Expand Down
14 changes: 11 additions & 3 deletions crates/evm/tests/frame_adapters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ fn receipt_mismatches_return_errors() {
payer: SENDER,
logs: vec![],
frame_receipts: vec![],
frame_outputs: vec![],
}
};
let result = AlloyReceiptBuilder::default().build_receipt(ReceiptBuilderCtx {
Expand Down Expand Up @@ -311,14 +312,21 @@ fn failed_receipt_does_not_commit_state_or_counters() {

#[cfg(feature = "rpc")]
#[test]
fn rpc_frame_uses_custom_schedule_and_moves_request_buffers() {
fn rpc_frame_uses_custom_schedule_and_preserves_request_frames() {
use alloy_evm::rpc::TryIntoTxEnv;
let tx = frame_tx();
let request: alloy_rpc_types_eth::TransactionRequest = tx.into();
let frames = request.frames.as_ref().unwrap().as_ptr();
let frames: Vec<Frame> = request
.frames
.as_ref()
.unwrap()
.iter()
.cloned()
.map(|frame| frame.try_into().unwrap())
.collect();
let env = request.try_into_tx_env(&custom_env()).unwrap();
assert_eq!(env.gas_limit, 62_555);
assert_eq!(env.frame_transaction.as_ref().unwrap().frames.as_ptr(), frames);
assert_eq!(env.frame_transaction.as_ref().unwrap().frames, frames);
let mut evm = EthEvmFactory::default().create_evm(db(), custom_env());
assert!(evm.transact(env).is_ok());
}