-
Couldn't load subscription status.
- Fork 5
Handle null effectiveGas for zeta receipts #81
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
Conversation
WalkthroughPackage version incremented from 0.5.6 to 0.5.7. Added support for deserializing null or undefined Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes The changes are focused and straightforward: a routine version bump and a targeted deserialization enhancement with consistent pattern application and test coverage. Low logic density and homogeneous changes across both modified files. Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
hypersync-format/src/types/mod.rs (1)
301-351: Comprehensive test covering both null and missing scenarios.The test correctly validates that deserialization succeeds for both
effectiveGasPrice: nulland the field being entirely absent. Using a real-world Zeta chain example provides valuable context.Consider asserting the actual value of
effective_gas_priceafter deserialization to verify it matchesQuantity::default():let _: TransactionReceipt = serde_json::from_value(json.clone()).expect("should handle null effective gas price"); + +let receipt: TransactionReceipt = + serde_json::from_value(json.clone()).expect("should handle null effective gas price"); +assert_eq!(receipt.effective_gas_price, Quantity::default()); // Also check that it still handles undefined as before let mut obj = json.as_object().unwrap().to_owned(); let _ = obj.remove("effectiveGasPrice"); let json = Value::Object(obj); -let _: TransactionReceipt = +let receipt: TransactionReceipt = serde_json::from_value(json).expect("should handle undefined effective gas price"); +assert_eq!(receipt.effective_gas_price, Quantity::default());
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
hypersync-format/Cargo.toml(1 hunks)hypersync-format/src/types/mod.rs(4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
hypersync-format/src/types/mod.rs (1)
hypersync-format/src/types/quantity.rs (1)
deserialize(135-140)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: lint
- GitHub Check: test_dev
- GitHub Check: test_release
🔇 Additional comments (4)
hypersync-format/Cargo.toml (1)
3-3: LGTM! Appropriate version bump.The patch version increment from 0.5.6 to 0.5.7 correctly follows semantic versioning for a bugfix that adds backward-compatible null-handling for
effective_gas_price.hypersync-format/src/types/mod.rs (3)
2-2: LGTM! Import is necessary for the custom deserializer.The
Deserializertrait is correctly imported to support thenullable_defaulthelper function.
178-185: Well-designed reusable helper.The
nullable_defaultfunction elegantly handles both null and present values by deserializing throughOption<T>and falling back toT::default()forNone. This is a good pattern that can be reused for other fields if similar issues arise on other chains.
146-148: Approve null/missingeffective_gas_pricehandling.
The combination of#[serde(default)]anddeserialize_with = "nullable_default"correctly defaults both absent and null values toQuantity::default(). Verified downstream (Option<Quantity>) never assumes a non-zero value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, cool, thanks makes sense 👍
commit f91c16a Author: Jono Prest <65739024+JonoPrest@users.noreply.github.com> Date: Fri Oct 24 14:25:31 2025 +0200 Allow defining "include" and "exclude" filters on selections in query (#80) * Add exclude selections to query * Bump version * Use empty vecs instead of optionals for exclude selections * Change structure to allow and or semantics * Add fmt and clippy * Bump minor versions since the public api breaks * Add backwards compatability tests * Add serialization test for new queries * Add pretty assertions * Fix serialization compatability test and improve serialization efficiency * Use checksum addresses for passing tests * Add rc flag for release commit 14920fe Author: Jono Prest <65739024+JonoPrest@users.noreply.github.com> Date: Thu Oct 16 17:34:00 2025 +0200 Handle null effectiveGas for zeta receipts (#81) commit a1ec5d3 Author: Özgür Akkurt <oezgurmakkurt@gmail.com> Date: Wed Sep 10 20:57:05 2025 +0600 format: make quantity compatible with bincode (#77) * format: make quantity compatible with bincode * improve code path * fix serde expect string * version bump commit 13b5362 Merge: fd505a4 0f67fb5 Author: Dmitry Zakharov <dzakh.dev@gmail.com> Date: Thu Sep 4 15:55:11 2025 +0400 Merge pull request #76 from enviodev/dz/improve-get-events-join-logic Improve Get Event join logic commit 0f67fb5 Author: Dmitry Zakharov <dzakh.dev@gmail.com> Date: Thu Sep 4 15:49:57 2025 +0400 Update EventResponse type commit 5f6d2a3 Author: Dmitry Zakharov <dzakh.dev@gmail.com> Date: Thu Sep 4 15:44:00 2025 +0400 Fixes after review commit 8208307 Author: Dmitry Zakharov <dzakh.dev@gmail.com> Date: Wed Sep 3 20:19:58 2025 +0400 Fix clippy commit 001c2ef Author: Dmitry Zakharov <dzakh.dev@gmail.com> Date: Wed Sep 3 20:05:20 2025 +0400 Improve Get Event join logic commit fd505a4 Author: Jason Smythe <jason@wildcards.world> Date: Thu Sep 4 13:17:47 2025 +0200 BlockNumber as integer rather than Hex for Sonic RPC (#72) * BlockNumber as integer rather than Hex for Sonic RPC Enhance Quantity deserialization to accept numeric values Updated the QuantityVisitor to handle both hex strings and numeric values (u64 and i64) for deserialization. Added tests to verify the correct handling of numeric JSON values. * bump hypersync format version * Improve deserializer for quantity * Bump versions again for release --------- Co-authored-by: Jono Prest <jjprest@gmail.com> Merge branch 'main' into jp/hack-efficient-queries
Summary by CodeRabbit
Bug Fixes
Chores