Skip to content

Commit c3e58d4

Browse files
authored
fix: receipt conversion (foundry-rs#10853)
1 parent 6de8703 commit c3e58d4

File tree

1 file changed

+9
-1
lines changed
  • crates/anvil/core/src/eth/transaction

1 file changed

+9
-1
lines changed

crates/anvil/core/src/eth/transaction/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1441,6 +1441,7 @@ pub fn convert_to_anvil_receipt(receipt: AnyTransactionReceipt) -> Option<Receip
14411441
0x01 => TypedReceipt::EIP2930(receipt_with_bloom),
14421442
0x02 => TypedReceipt::EIP1559(receipt_with_bloom),
14431443
0x03 => TypedReceipt::EIP4844(receipt_with_bloom),
1444+
0x04 => TypedReceipt::EIP7702(receipt_with_bloom),
14441445
0x7E => TypedReceipt::Deposit(DepositReceipt {
14451446
inner: receipt_with_bloom,
14461447
deposit_nonce: other
@@ -1461,10 +1462,17 @@ pub fn convert_to_anvil_receipt(receipt: AnyTransactionReceipt) -> Option<Receip
14611462

14621463
#[cfg(test)]
14631464
mod tests {
1465+
use super::*;
14641466
use alloy_primitives::{b256, hex, LogData};
14651467
use std::str::FromStr;
14661468

1467-
use super::*;
1469+
// <https://github.com/foundry-rs/foundry/issues/10852>
1470+
#[test]
1471+
fn test_receipt_convert() {
1472+
let s = r#"{"type":"0x4","status":"0x1","cumulativeGasUsed":"0x903fd1","logs":[{"address":"0x0000d9fcd47bf761e7287d8ee09917d7e2100000","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000000000000000000000000000000000000000000","0x000000000000000000000000234ce51365b9c417171b6dad280f49143e1b0547"],"data":"0x00000000000000000000000000000000000000000000032139b42c3431700000","blockHash":"0xd26b59c1d8b5bfa9362d19eb0da3819dfe0b367987a71f6d30908dd45e0d7a60","blockNumber":"0x159663e","blockTimestamp":"0x68411f7b","transactionHash":"0x17a6af73d1317e69cfc3cac9221bd98261d40f24815850a44dbfbf96652ae52a","transactionIndex":"0x22","logIndex":"0x158","removed":false}],"logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000008100000000000000000000000000000000000000000000000020000200000000000000800000000800000000000000010000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000","transactionHash":"0x17a6af73d1317e69cfc3cac9221bd98261d40f24815850a44dbfbf96652ae52a","transactionIndex":"0x22","blockHash":"0xd26b59c1d8b5bfa9362d19eb0da3819dfe0b367987a71f6d30908dd45e0d7a60","blockNumber":"0x159663e","gasUsed":"0x28ee7","effectiveGasPrice":"0x4bf02090","from":"0x234ce51365b9c417171b6dad280f49143e1b0547","to":"0x234ce51365b9c417171b6dad280f49143e1b0547","contractAddress":null}"#;
1473+
let receipt: AnyTransactionReceipt = serde_json::from_str(s).unwrap();
1474+
let _converted = convert_to_anvil_receipt(receipt).unwrap();
1475+
}
14681476

14691477
#[test]
14701478
fn test_decode_call() {

0 commit comments

Comments
 (0)