Skip to content

chore: bump pallas to v1#100

Merged
scarmuega merged 2 commits into
mainfrom
bump-pallas-v1
May 23, 2026
Merged

chore: bump pallas to v1#100
scarmuega merged 2 commits into
mainfrom
bump-pallas-v1

Conversation

@scarmuega

@scarmuega scarmuega commented May 22, 2026

Copy link
Copy Markdown
Member

Summary

  • bump pallas and pallas-* dependencies to 1.0.0
  • update txbuilder code for Pallas v1 Conway primitives and KeepRaw wrappers
  • align runtime signing RNG usage with pallas-crypto v1

Verification

  • cargo check --workspace
  • cargo test --workspace --lib

Note: cargo test --workspace compiles, but the existing balius-runtime u5c-chainsync integration test fails with a WIT component import mismatch unrelated to the Pallas v1 changes.

Summary by CodeRabbit

  • Chores

    • Upgraded core cryptography and codec dependencies to newer major versions for improved compatibility.
    • Updated random number generation path for more robust key creation.
  • Refactor

    • Streamlined transaction and asset construction/encoding to produce more consistent outputs and handle multi-asset cases more reliably.
    • Updated transaction-building APIs to produce stable, static-encoded transactions.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 52b41dd2-2b8c-45e5-9eb2-6ff11c6009d2

📥 Commits

Reviewing files that changed from the base of the PR and between 88ec2c4 and 2fad146.

📒 Files selected for processing (2)
  • balius-runtime/src/sign/in_memory.rs
  • balius-sdk/src/txbuilder/dsl.rs

📝 Walkthrough

Walkthrough

Upgrade Pallas crates to 1.0.0 across workspace and examples, migrate transaction output variants, parameterize transaction-related types with 'static lifetimes, refactor multi-asset math to use standard map types, adjust tx builder encoding to KeepRaw, and update RNG usage for ed25519 key generation.

Changes

Pallas 1.0.0 Upgrade and Type System Refactoring

Layer / File(s) Summary
Dependency version upgrades across Cargo.toml files
balius-runtime/Cargo.toml, balius-sdk/Cargo.toml, baliusd/Cargo.toml, examples/*/Cargo.toml
Bump pallas-related crates to 1.0.0 and upgrade rand to 0.10.1 with sys_rng feature enabled where applicable.
RNG migration for ed25519 key generation
balius-runtime/src/sign/in_memory.rs
Replace OsRng-based secret-key creation with rand::rngs::SysRng.try_fill_bytes(&mut bytes) via rand::TryRng.
Transaction output representation updates
balius-runtime/src/ledgers/mock.rs, examples/minter/offchain/src/lib.rs
Replace MintedTransactionOutput::PostAlonzo usage with TransactionOutput::PostAlonzo and PostAlonzoTransactionOutput struct in mocks/tests, preserving fields.
Asset aggregation refactored without NonEmptyKeyValuePairs
balius-sdk/src/txbuilder/asset_math.rs
Refactor multi-asset handling to use BTreeMap/conway::Multiasset and conway::Mint directly; update fold, aggregate, mint application, subtraction, mint validation, and tests to use map-based constructs and emptiness checks.
DSL and BuildContext 'static lifetime parameterization
balius-sdk/src/txbuilder/dsl.rs, balius-sdk/src/txbuilder/mod.rs
Make transaction types returned by the DSL 'static (TransactionBody<'static>, TransactionOutput<'static>, WitnessSet<'static>, ScriptRef<'static>); add KeepRaw alias and update trait/impl signatures and BuildContext fields.
Transaction builder integration with refactored asset system
balius-sdk/src/txbuilder/build.rs
build() now returns primitives::Tx<'static>; input values converted via txo.value().into_conway(); output_into_conway rewritten to produce Conway multiassets with per-policy emptiness filtering; final tx uses KeepRaw::from(...) for body and witness set.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • txpipe/balius#97: Overlaps on min-UTXO lovelace calculation and matching PostAlonzo output variant changes in the txbuilder DSL.

Suggested reviewers

  • SupernaviX

Poem

A rabbit hops through Pallas fields,
The upgrade's path now gently yields,
Lifetimes settled, maps set free,
Old wrappers gone — clean clarity,
A tiny hop, a tidy crate, hooray! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title "chore: bump pallas to v1" accurately summarizes the main change: upgrading pallas and pallas-* dependencies from 0.32.0 to 1.0.0 across the codebase, which is the primary focus of all modifications.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bump-pallas-v1

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
balius-sdk/src/txbuilder/dsl.rs (1)

569-580: 💤 Low value

Consider returning None when mint is empty.

MintBuilder::eval now always returns Ok(Some(mint)) even when the resulting mint map is empty (all policies filtered out). While downstream code handles this via mint.is_empty() checks, returning None for an empty mint would be semantically cleaner and consistent with aggregate_assets behavior.

Suggested improvement
         let mint = out
             .into_iter()
             .filter_map(|(policy, assets)| {
                 if assets.is_empty() {
                     None
                 } else {
                     Some((policy, assets.into_iter().collect()))
                 }
             })
             .collect();

-        Ok(Some(mint))
+        if mint.is_empty() {
+            Ok(None)
+        } else {
+            Ok(Some(mint))
+        }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@balius-sdk/src/txbuilder/dsl.rs` around lines 569 - 580, MintBuilder::eval
currently always returns Ok(Some(mint)) even when the collected mint map is
empty; change it to mirror aggregate_assets behavior by checking the collected
value (the local variable mint produced from
out.into_iter().filter_map(...).collect()) and return Ok(None) when
mint.is_empty(), otherwise return Ok(Some(mint)); this keeps the semantic
meaning consistent and avoids downstream checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@balius-runtime/src/sign/in_memory.rs`:
- Around line 33-36: Replace the non-CSPRNG usage of rand::rng() when creating
an Ed25519 secret key: in the keys.entry(key_name).or_insert_with closure that
calls ed25519::SecretKey::new(&mut rng).into(), instantiate a cryptographically
secure OsRng (rand::rngs::OsRng) and pass it to SecretKey::new instead of
ThreadRng/rand::rng(); ensure you import OsRng and adjust the closure to create
the key via OsRng so the generated key uses a CSPRNG.

---

Nitpick comments:
In `@balius-sdk/src/txbuilder/dsl.rs`:
- Around line 569-580: MintBuilder::eval currently always returns Ok(Some(mint))
even when the collected mint map is empty; change it to mirror aggregate_assets
behavior by checking the collected value (the local variable mint produced from
out.into_iter().filter_map(...).collect()) and return Ok(None) when
mint.is_empty(), otherwise return Ok(Some(mint)); this keeps the semantic
meaning consistent and avoids downstream checks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5669d515-d43e-47aa-9eda-3df21ff6b8a1

📥 Commits

Reviewing files that changed from the base of the PR and between e3ed784 and 88ec2c4.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (17)
  • balius-runtime/Cargo.toml
  • balius-runtime/src/ledgers/mock.rs
  • balius-runtime/src/sign/in_memory.rs
  • balius-sdk/Cargo.toml
  • balius-sdk/src/txbuilder/asset_math.rs
  • balius-sdk/src/txbuilder/build.rs
  • balius-sdk/src/txbuilder/dsl.rs
  • balius-sdk/src/txbuilder/mod.rs
  • baliusd/Cargo.toml
  • examples/asteria-admin/Cargo.toml
  • examples/basic/Cargo.toml
  • examples/minter/offchain/Cargo.toml
  • examples/minter/offchain/src/lib.rs
  • examples/sundae-stop-loss-strategy/Cargo.toml
  • examples/telchar/Cargo.toml
  • examples/ticket-vending-machine/Cargo.toml
  • examples/wallet/offchain/Cargo.toml

Comment thread balius-runtime/src/sign/in_memory.rs
@scarmuega scarmuega merged commit 528ca26 into main May 23, 2026
7 of 8 checks passed
@scarmuega scarmuega deleted the bump-pallas-v1 branch May 23, 2026 12:30
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.

1 participant