fix(traces): use u64 for action_gas and result_gas_used to prevent overflow#256
Open
AuburyEssentian wants to merge 2 commits intoparadigmxyz:mainfrom
Open
fix(traces): use u64 for action_gas and result_gas_used to prevent overflow#256AuburyEssentian wants to merge 2 commits intoparadigmxyz:mainfrom
AuburyEssentian wants to merge 2 commits intoparadigmxyz:mainfrom
Conversation
added 2 commits
March 7, 2026 04:04
When --reorg-buffer N is set, apply_reorg_buffer previously filtered out any chunk whose max block exceeded latest_block - N. This silently dropped the partial tail chunk (e.g. blocks 20030000-20030787 when only up to 20029999 is safe), causing cryo to never collect those trailing blocks. Fix: replace the filter_map that drops whole chunks with clamp_chunk_to_max, which truncates Range chunks to max_allowed and filters Numbers vectors, preserving all safe blocks within a chunk. Fixes paradigmxyz#193
…erflow Closes paradigmxyz#173. On BSC and other high-throughput EVM chains, gas values can exceed u32::MAX (~4.29 billion). The alloy parity types already use u64 for gas fields, but cryo was truncating them with `as u32` before storing, causing integer overflow panics on any block containing a transaction with gas > 4,294,967,295. Fix: change action_gas and result_gas_used column types from u32 to u64 in both Traces and TraceCalls datasets, and remove the unsafe casts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Closes #173.
On BSC and other high-throughput EVM chains, gas values can exceed
u32::MAX(~4.29 billion). The alloy parity types already useu64for these fields, but cryo was narrowing them withas u32casts before storing, causing integer overflow panics on any block containing a transaction with gas above the u32 ceiling.The affected transaction in the issue (
0x33bd1edf...07920a6) has a gas limit larger thanu32::MAX, which panics in dev builds and silently wraps in release.Root cause
Two dataset structs both declared their gas columns as
u32:Traces:action_gas: Vec<Option<u32>>andresult_gas_used: Vec<Option<u32>>TraceCalls: same fields, same typesThe
store!calls then castaction.gas as u32andresult.gas_used as u32, truncating any value > 4,294,967,295.Fix
Change both column types to
u64and remove the casts. The underlying alloy types (Call::gas,CallOutput::gas_used,Create::gas,CreateOutput::gas_used) are alreadyu64, so no other changes are needed.Affected files:
crates/freeze/src/datasets/traces.rscrates/freeze/src/datasets/trace_calls.rs