edr
edr copied to clipboard
Add tests to validate `L1BlockInfo` in RPC receipts for Optimism hardforks
Currently, we only have one test validating L1BlockInfo for a remote transaction in crates/edr_optimism/tests/rpc.rs:
#[tokio::test(flavor = "multi_thread")]
async fn receipt_with_l1_block_info() -> anyhow::Result<()> {
const TRANSACTION_HASH: B256 =
b256!("f0b04a1c6f61b2818ac2c62ed0c3fc22cd7ebd2f51161759714f75dd27fa7caa");
let url = get_alchemy_url().replace("eth-", "opt-");
let rpc_client = EthRpcClient::<OptimismChainSpec>::new(&url, CACHE_DIR.into(), None)?;
let receipt = rpc_client
.get_transaction_receipt(TRANSACTION_HASH)
.await?
.expect("Receipt must exist");
assert_eq!(receipt.l1_block_info.l1_gas_price, Some(0x5f3a77dd6));
assert_eq!(receipt.l1_block_info.l1_gas_used, Some(0x640));
assert_eq!(receipt.l1_block_info.l1_fee, Some(0x1c3441e5e02));
assert_eq!(receipt.l1_block_info.l1_fee_scalar, None);
assert_eq!(receipt.l1_block_info.l1_base_fee_scalar, Some(0x146b));
assert_eq!(receipt.l1_block_info.l1_blob_base_fee, Some(0x3f5694c1f));
assert_eq!(receipt.l1_block_info.l1_blob_base_fee_scalar, Some(0xf79c5));
Ok(())
}
We should add more tests to validate:
- One test per supported Optimism-specific hardfork for remote RPC receipts
- One test per supported Optimism-specific hardfork for locally mined RPC receipts
A list of Optimism-specific hardforks can be found here.
I've added more information to the issue description that should provide you with a starting point to investigate the issue.