fix: widen trace gas fields from u32 to u64 to prevent overflow#259
Open
dylantirandaz wants to merge 1 commit intoparadigmxyz:mainfrom
Open
fix: widen trace gas fields from u32 to u64 to prevent overflow#259dylantirandaz wants to merge 1 commit intoparadigmxyz:mainfrom
dylantirandaz wants to merge 1 commit intoparadigmxyz:mainfrom
Conversation
On chains like BSC, transactions can have gas values exceeding u32::MAX (4,294,967,295). The action_gas and result_gas_used fields in both the Traces and TraceCalls datasets were stored as u32 and cast with `as u32`, silently truncating large values and causing incorrect data. Widen these fields to u64 to match the convention already used by the blocks and transactions datasets, as documented in the schema design guide (gas_used: u64, gas_limit: u64). Fixes paradigmxyz#173
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.
Motivation
On chains like BSC, transactions can have gas values exceeding
u32::MAX(4,294,967,295). Theaction_gasandresult_gas_usedfields in both theTracesandTraceCallsdatasets were stored asu32, and gas values were cast withas u32which silently truncates large values (#173).The blocks and transactions datasets already correctly use
u64for gas fields, consistent with the schema design guide which specifiesgas_used: u64andgas_limit: u64.Solution
Widen
action_gasandresult_gas_usedfromVec<Option<u32>>toVec<Option<u64>>in bothTracesandTraceCallsstructs, and update all corresponding casts fromas u32toas u64.Changed files:
crates/freeze/src/datasets/traces.rs— 2 field types + 4 castscrates/freeze/src/datasets/trace_calls.rs— 2 field types + 4 castsFixes #173
PR Checklist