Skip to content

Conversation

@JonoPrest
Copy link
Contributor

@JonoPrest JonoPrest commented Oct 16, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Improved deserialization handling to support null or missing gas price values, preventing errors during data processing and ensuring data consistency.
  • Chores

    • Updated package version to 0.5.7.

@JonoPrest JonoPrest requested a review from JasoonS October 16, 2025 15:22
@coderabbitai
Copy link

coderabbitai bot commented Oct 16, 2025

Walkthrough

Package version incremented from 0.5.6 to 0.5.7. Added support for deserializing null or undefined effective_gas_price values in TransactionReceipt through a new nullable_default helper function with accompanying tests.

Changes

Cohort / File(s) Summary
Version Management
hypersync-format/Cargo.toml
Package version updated from 0.5.6 to 0.5.7
Null Deserialization Support
hypersync-format/src/types/mod.rs
Introduced nullable_default helper function via serde attribute on TransactionReceipt.effective_gas_price field to handle null and undefined values during deserialization; added test case validating null and undefined effectiveGasPrice scenarios

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

  • JasoonS

Poem

🐰 A null gas price? No need to fear,
Our helper handles it crystal clear,
Version bumped to point-seven bright,
Deserialization done just right! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "Handle null effectiveGas for zeta receipts" directly aligns with the primary functional change in the changeset, which is adding support for deserializing null or undefined effective_gas_price values in the TransactionReceipt type via a nullable_default helper and serde attribute. The title is concise, specific, and clearly conveys the main intent of the change without vague terminology. While the changeset also includes a version bump to 0.5.7, this is a secondary consequence of the functional improvement and does not detract from the title's accuracy in capturing the core change.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch jp/fix-zeta

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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: null and the field being entirely absent. Using a real-world Zeta chain example provides valuable context.

Consider asserting the actual value of effective_gas_price after deserialization to verify it matches Quantity::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

📥 Commits

Reviewing files that changed from the base of the PR and between a1ec5d3 and 1fb10b4.

📒 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 Deserializer trait is correctly imported to support the nullable_default helper function.


178-185: Well-designed reusable helper.

The nullable_default function elegantly handles both null and present values by deserializing through Option<T> and falling back to T::default() for None. This is a good pattern that can be reused for other fields if similar issues arise on other chains.


146-148: Approve null/missing effective_gas_price handling.
The combination of #[serde(default)] and deserialize_with = "nullable_default" correctly defaults both absent and null values to Quantity::default(). Verified downstream (Option<Quantity>) never assumes a non-zero value.

Copy link
Contributor

@JasoonS JasoonS left a 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 👍

@JonoPrest JonoPrest merged commit 14920fe into main Oct 16, 2025
4 checks passed
JonoPrest added a commit that referenced this pull request Oct 24, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants