-
Notifications
You must be signed in to change notification settings - Fork 84
Bump utxorpc version to 0.18.1 #716
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThis PR converts many numeric fields to BigInt representations across pallas-utxorpc: updates utxorpc-spec to 0.18.1, adds helpers (u64_to_bigint, i64_to_bigint), and wraps numeric coins/amounts in certs, params, lib mappings; test JSON updated to use Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code graph analysis (1)pallas-utxorpc/src/params.rs (1)
🔇 Additional comments (5)
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: 3
🧹 Nitpick comments (2)
pallas-utxorpc/src/params.rs (2)
223-236: Consider simplifying the optional BigInt conversion pattern.The pattern
.map(|v| u64_to_bigint(v)).flatten()is functionally correct but can be simplified using.and_then(u64_to_bigint)for better readability.- coins_per_utxo_byte: x.ada_per_utxo_byte.map(|v| u64_to_bigint(v)).flatten(), + coins_per_utxo_byte: x.ada_per_utxo_byte.and_then(u64_to_bigint), max_tx_size: x.max_transaction_size.unwrap_or_default(), - min_fee_coefficient: x.minfee_a.map(|v| u64_to_bigint(v.into())).flatten(), - min_fee_constant: x.minfee_b.map(|v| u64_to_bigint(v.into())).flatten(), + min_fee_coefficient: x.minfee_a.map(|v| v.into()).and_then(u64_to_bigint), + min_fee_constant: x.minfee_b.map(|v| v.into()).and_then(u64_to_bigint), max_block_body_size: x.max_block_body_size.unwrap_or_default(), max_block_header_size: x.max_block_header_size.unwrap_or_default(), - stake_key_deposit: x.key_deposit.map(|v| u64_to_bigint(v)).flatten(), - pool_deposit: x.pool_deposit.map(|v| u64_to_bigint(v)).flatten(), + stake_key_deposit: x.key_deposit.and_then(u64_to_bigint), + pool_deposit: x.pool_deposit.and_then(u64_to_bigint), pool_retirement_epoch_bound: x.maximum_epoch.unwrap_or_default(), desired_number_of_pools: x.desired_number_of_stake_pools.unwrap_or_default(), pool_influence: x.pool_pledge_influence.clone().map(rational_number_to_u5c), monetary_expansion: x.expansion_rate.clone().map(rational_number_to_u5c), treasury_expansion: x.treasury_growth_rate.clone().map(rational_number_to_u5c), - min_pool_cost: x.min_pool_cost.map(|v| u64_to_bigint(v)).flatten(), + min_pool_cost: x.min_pool_cost.and_then(u64_to_bigint),
297-301: Same simplification applies here.- governance_action_deposit: x - .governance_action_deposit - .map(|v| u64_to_bigint(v)) - .flatten(), - drep_deposit: x.drep_deposit.map(|v| u64_to_bigint(v)).flatten(), + governance_action_deposit: x.governance_action_deposit.and_then(u64_to_bigint), + drep_deposit: x.drep_deposit.and_then(u64_to_bigint),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
pallas-utxorpc/Cargo.toml(1 hunks)pallas-utxorpc/src/certs.rs(8 hunks)pallas-utxorpc/src/lib.rs(6 hunks)pallas-utxorpc/src/params.rs(8 hunks)test_data/u5c1.json(37 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
pallas-utxorpc/src/certs.rs (2)
pallas-utxorpc/src/lib.rs (2)
i64_to_bigint(39-43)u64_to_bigint(33-37)pallas-traverse/src/value.rs (1)
coin(67-79)
pallas-utxorpc/src/params.rs (1)
pallas-utxorpc/src/lib.rs (2)
rational_number_to_u5c(26-31)u64_to_bigint(33-37)
🔇 Additional comments (8)
test_data/u5c1.json (1)
1-3235: Test data properly updated to match BigInt schema.The numeric coin and fee fields have been consistently transformed from plain strings to nested objects with an
"int"property throughout the test data. All values are preserved correctly, and the transformation aligns with the PR's shift to BigInt representations across the codebase.pallas-utxorpc/src/certs.rs (1)
5-5: LGTM!The import of
i64_to_bigintandu64_to_biginthelpers is correct, and the conversions throughout this file are applied consistently to all certificate types. The use ofi64_to_bigintfordelta_coin(Line 83) is appropriate since that field can be negative, whileu64_to_bigintis correctly used for unsigned coin/pledge/cost fields.pallas-utxorpc/src/lib.rs (6)
39-43: LGTM!The
i64_to_bigintfunction is straightforward and correct since the input is alreadyi64.
208-208: LGTM!Correct usage of
u64_to_bigintfor coin value conversion.
270-270: LGTM!Correct usage of
u64_to_bigintfor withdrawal coin.
483-483: LGTM!Correct usage of
u64_to_bigintfor treasury withdrawal coin.
548-548: LGTM!Correct usage of
u64_to_bigintfor governance proposal deposit.
712-715: LGTM!Correct usage of
u64_to_bigintfortotal_collateralandfeefields.
| [dependencies] | ||
| # utxorpc-spec = { path = "../../../utxorpc/spec/gen/rust" } | ||
| utxorpc-spec = { version = "0.17.0" } | ||
| utxorpc-spec = { version = "0.18.1" } |
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.
🧩 Analysis chain
🌐 Web query:
utxorpc-spec 0.18.1 crates.io availability
💡 Result:
I couldn't find a published crates.io version 0.18.1 for utxorpc-spec. docs.rs shows the utxorpc_spec crates exist, and Libraries.io lists up to 0.17.0; the crates.io crate page for "utxorpc-spec" loads but does not show a 0.18.1 release in the searchable metadata I could access. [1][2][3]
Sources:
- docs.rs (utxorpc_spec crates). [1]
- Libraries.io (utxorpc-spec, shows 0.17.0). [2]
- crates.io crate page (utxorpc-spec). [3]
If you want, I can (a) re-check crates.io directly for a 0.18.1 release and fetch the exact version listing, or (b) check the uxtorpc GitHub/releases for a 0.18.1 tag — which would you prefer?
🌐 Web query:
utxorpc-spec security advisories CVE
💡 Result:
I found no public CVE entries or security advisories specifically for the utxorpc-spec package or the UTxORPC ecosystem. Sources checked: PyPI package page (release history), Safety DB package entry, and crate/docs pages for utxorpc-spec. [1][2][3]
If you want, I can:
- run a targeted NVD/CVE, GitHub advisory, and vendor-search now and report back with links and dates; or
- monitor these sources and email/notify you on new advisories.
Sources:
[1] PyPI — utxorpc-spec (release/history).
[2] Safety DB — utxorpc package vulnerability summary.
[3] docs.rs / crate docs — utxorpc-spec.
Correct utxorpc-spec version; 0.18.1 does not exist on crates.io.
The specified version 0.18.1 is not published on crates.io. The latest available version is 0.17.0. Update the dependency to an available version.
🤖 Prompt for AI Agents
In pallas-utxorpc/Cargo.toml at line 15, the dependency utxorpc-spec is pinned
to version "0.18.1" which does not exist on crates.io; change it to a published
version (e.g., "0.17.0") by updating the version string to an available release
so Cargo can resolve the dependency successfully.
This pull request updates the handling of coin and integer values throughout the
pallas-utxorpccrate to consistently use theBigInttype from the utxorpc spec, improving compatibility and correctness for large values. It introduces helper functions to convertu64andi64values toBigInt, and refactors multiple mapping methods to apply these conversions. Additionally, it updates the utxorpc spec dependency to the latest version.Dependency update:
utxorpc-specdependency inCargo.tomlfrom version0.17.0to0.18.1to ensure compatibility with the latest protocol changes.Helper functions and code consistency:
u64_to_bigintandi64_to_biginthelper functions insrc/lib.rsand used them throughout the codebase for converting coin and integer fields to theBigInttype.Refactoring of certificate and protocol parameter mapping:
src/certs.rsto useBigIntfor pledge, cost, coin, and delta_coin fields, ensuring all relevant fields are properly converted.src/params.rsto convert all coin and deposit-related fields toBigInt, including fee coefficients, deposits, pool costs, and governance deposits.Transaction and asset mapping improvements:
src/lib.rsto use the new helper functions for converting coin and quantity fields toBigInt, and refactored asset quantity representation for better clarity and correctness.Summary by CodeRabbit
Chores
Refactor
Chores / Data
✏️ Tip: You can customize this high-level summary in your review settings.