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

Add tests to validate L1BlockInfo in RPC receipts for Optimism hardforks #742

Open
Wodann opened this issue Dec 10, 2024 · 1 comment
Open

Comments

@Wodann
Copy link
Member

Wodann commented Dec 10, 2024

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.

@Wodann
Copy link
Member Author

Wodann commented Dec 16, 2024

I've added more information to the issue description that should provide you with a starting point to investigate the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

2 participants