Repository navigation
Closed
Labels
bugSomething isn't working
Description
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 block21104086. - Filtering by
toaddress usingtopic2. - However for this very specific block,
log_decode::<Transfer>()fails withOverrun. - 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
yash-atreya commentedon Mar 25, 2025
@alrevuelta The filter is working correctly. It is matching
Transferevents withtopic2 == 0x0000000000000000000000002a3dd3eb832af982ec71669e178424b10dca2ede.However the log should get decoded correctly, investigating that now.
[-][Bug] get_logs does not respect event filter[/-][+][Bug] `Overrun` on log decoding[/+]iainnash commentedon Apr 30, 2025
I've been able to replicate this error:
fix(dyn-abi): validate event topic count before decoding body