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 · 3 comments
Open
Labels
good first issue Good for newcomers

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 Wodann added the good first issue Good for newcomers label Dec 10, 2024
@github-project-automation github-project-automation bot moved this to Unconfirmed in EDR Dec 10, 2024
@Wodann Wodann moved this from Unconfirmed to Todo in EDR Dec 10, 2024
@iosh
Copy link

iosh commented Dec 15, 2024

Hi @Wodann I want to contribute to this, but can you give me more information? I'm not entirely clear on what needs to be done for this issue.

@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.

@iosh
Copy link

iosh commented Dec 17, 2024

  1. I have check this, the optimism has six hardforks, so i need find the transaction hash after the hardfork block number, then write tests for the remote RPC receipts.(similar to receipt_with_l1_block_info function)

  2. What is locally mined RPC receipts ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: Todo
Development

No branches or pull requests

2 participants