Skip to content

[Bug] Overrun on log decoding #1123

Closed

Description

@alrevuelta

Component

rpc

What version of Alloy are you on?

0.12.6

Operating System

macOS (Apple Silicon)

Describe the bug

  • I'm indexing the ERC20 Transfer event Transfer(address,address,uint256) of a given block 21104086.
  • Filtering by to address using topic2.
  • However for this very specific block, log_decode::<Transfer>() fails with Overrun.
  • Looking at etherscan that event seems to have 4 topics. However it fails to parse it.

To reproduce. Use this with the the ERC20 abi placed in ERC20.json.

sol!(
    #[allow(missing_docs)]
    #[sol(rpc)]
    ERC20,
    "abi/ERC20.json"
);

And run this. It will result in an error Overrun. With other "normal" event it works as expected, eg block 21102905.

let provider = ProviderBuilder::new().on_client(
            RpcClient::builder()
                .layer(RetryBackoffLayer::new(30, 2000, 100))
                .http(
                    "https://mainnet.infura.io/v3/XXX"
                        .parse()
                        .unwrap(),
                ),
        );

        pub fn address_to_topic(address: Address) -> Topic {
            let mut address_bytes = [0u8; 32];
            address_bytes[12..].copy_from_slice(address.as_slice());
            FilterSet::from(FixedBytes::<32>::from_slice(&address_bytes))
        }

        let bridge_in_events = provider
            .get_logs(
                &Filter::new()
                    .from_block(21104086)
                    .to_block(21104086)
                    .event("Transfer(address,address,uint256)")
                    .topic2(address_to_topic(address!(
                        "0x2a3dd3eb832af982ec71669e178424b10dca2ede"
                    ))),
            )
            .await
            .unwrap();

        for log in &bridge_in_events {
            println!("log {:?}", log);
            let dec = log.log_decode::<Transfer>().unwrap();
        }

Activity

  1. added
    bug
    on Mar 24, 2025
  2. yash-atreya commented on Mar 25, 2025

    @yash-atreya
    Contributor

    @alrevuelta The filter is working correctly. It is matching Transfer events with topic2 == 0x0000000000000000000000002a3dd3eb832af982ec71669e178424b10dca2ede.

    However the log should get decoded correctly, investigating that now.

  3. changed the title [-][Bug] get_logs does not respect event filter[/-] [+][Bug] `Overrun` on log decoding[/+] on Mar 25, 2025
  4. iainnash commented on Apr 30, 2025

    @iainnash

    I've been able to replicate this error:

    log Log { inner: Log { address: 0xd1695969df9ba23a3beb5a30164256aebae9bbf0, data: LogData { topics: [0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef, 0x000000000000000000000000d9a442856c234a39a81a089c06451ebaa4306a72, 0x0000000000000000000000002a3dd3eb832af982ec71669e178424b10dca2ede, 0x0000000000000000000000000000000000000000000000000000000000000290], data: 0x } }, block_hash: Some(0xe7d31b62f4e78a661c355f40d4901ca37f9c525b9c7f20c35a95ba4c53f0ceb5), block_number: Some(21104086), block_timestamp: None, transaction_hash: Some(0x9ad6242267967bbf8ab2181a3451e2549048cc652a0ab7fe16014715b993959b), transaction_index: Some(4), log_index: Some(98), removed: false }
    has log
    
    thread 'main' panicked at src/main.rs:37:48:
    called `Result::unwrap()` on an `Err` value: Overrun
    
  5. transferred this issue fromalloy-rs/alloyon Jun 10, 2026
  6. moved this from Todo to Done in Alloyon Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions