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

[Bug] Provider - get_block_by_number deserializing error #1803

Open
hjawhar opened this issue Dec 16, 2024 · 3 comments
Open

[Bug] Provider - get_block_by_number deserializing error #1803

hjawhar opened this issue Dec 16, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@hjawhar
Copy link

hjawhar commented Dec 16, 2024

Component

provider, pubsub, serde

What version of Alloy are you on?

alloy v0.8.0

Operating System

None

Describe the bug

Fetching block by number is throwing the following error, the error can be reproduced using the following snippet:

The following works on ETH network but fails on Base.

let block = provider.get_block_by_number(BlockNumberOrTag::Number(block_number), BlockTransactionsKind::Full).await;
let block = match block {
    Ok(block) => block,
    Err(err) => {
        println!("{:#?}", err);
        return;
    }
};

println!("{:#?}", block);

Result:

DeserError {
    err: Error("data did not match any variant of untagged enum BlockTransactions", line: 1, column: 189508),
    text: "{\"baseFeePerGas\":\"0x9c30f7\",\"blobGasUsed\":\"0x0\",\"difficulty\":\"0x0\",\"excessBlobGas\":\"0x0\",\"extraData\":\"0x\",\"gasLimit\":\"0xcdfe600\",\"gasUsed\":\"0x260f128\",\"hash\":\"0xd2a577b4050a2612bffa90edbb7a53d27bdb9382cfb01c434476ad60ff7d0845\",\"logsBloom\":\"
...
[\"0x0000000000000000000000000000000000000000000000000000000000000008\"]}],\"chainId\":\"0x2105\",\"v\":\"0x0\",\"r\":\"0xfaef1202252b5b9ab86751ae53da468de98d6c5df2161da0953f9ff2b7823bc0\",\"s\":\"0x77d766a3dcba9164564e6167e048403c268aa921b4528edb9877c9f1de6ce600\",\"yParity\":\"0x0\"}],\"transactionsRoot\":\"0xa5c641792d3d02409c4921791fdf621dd92623351576668b34ee71ed03ab1a88\",\"uncles\":[],\"withdrawals\":[],\"withdrawalsRoot\":\"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421\"}",
}
@hjawhar hjawhar added the bug Something isn't working label Dec 16, 2024
@mattsse
Copy link
Member

mattsse commented Dec 16, 2024

are you using the AnyNetwork or Ethereum, for optimism you'd need the AnyNetwork or Optimism https://github.com/alloy-rs/op-alloy

@hjawhar
Copy link
Author

hjawhar commented Dec 16, 2024

I believe I was using Ethereum by default:

let provider = ProviderBuilder::new().on_http(rpc_url);

@mattsse
Copy link
Member

mattsse commented Dec 16, 2024

yeah this would fail for the deposit tx type on block level, which is not supported by the ethereum network impl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants