Skip to content

fix(configs): ensure shelley devnet config parses correctly#710

Merged
scarmuega merged 1 commit into
mainfrom
codex/update-pallas-configs-to-support-genesis-stake-pools
Feb 4, 2026
Merged

fix(configs): ensure shelley devnet config parses correctly#710
scarmuega merged 1 commit into
mainfrom
codex/update-pallas-configs-to-support-genesis-stake-pools

Conversation

@scarmuega
Copy link
Copy Markdown
Member

@scarmuega scarmuega commented Nov 13, 2025

Summary by CodeRabbit

  • Documentation

    • Added comprehensive README with examples for loading and using Shelley genesis configurations in the library.
  • New Features

    • Enhanced Shelley genesis configuration parsing with improved field support for more complete genesis data handling.
  • Tests

    • Added test suite verifying correct parsing of Shelley genesis staking configurations and associated parameters.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 13, 2025

Walkthrough

This PR adds documentation to the pallas-configs README with usage examples, extends the Pool struct in shelley.rs with two new optional fields (owners and registration_deposit) using serde defaults, and introduces comprehensive partner genesis test data in JSON format.

Changes

Cohort / File(s) Summary
Documentation
pallas-configs/README.md
Added descriptive text and Rust code example demonstrating how to load Shelley genesis config and access staking pools with their pledge information.
Core Data Structures
pallas-configs/src/shelley.rs
Added Pool.owners field (Vec) and Pool.registration_deposit field (Option), both with serde(default) to handle missing fields during deserialization. Added comprehensive test suite for partner genesis staking parsing, validating pool attributes and stake mappings.
Test Data
test_data/partner-shelley-genesis.json
Introduced complete test genesis configuration in JSON format covering network parameters, protocol settings, staking pools, relay configurations, and fund allocations.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review serde(default) attribute application and deserialization behavior for both new Pool fields
  • Validate the new test suite logic, particularly pool field assertions and stake mapping verification
  • Verify partner genesis test data structure aligns with expected schema and covers realistic configurations

Poem

🐰 A pool of new fields now takes shape,
With owners and deposits to escape,
The genesis data, shiny and new,
Tests hopping through—it all rings true!
Configuration's ready, let's stake with care,
Pallas configs blooming everywhere! 🌱

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions 'ensure shelley devnet config parses correctly' but the PR objectives indicate the main change is removing unnecessary serde aliases from the staking pool config because partner genesis now uses canonical keys. Update the title to accurately reflect the primary change: 'fix(configs): remove unnecessary serde aliases from staking pool config' to better match the stated objectives and actual modifications.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ 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 codex/update-pallas-configs-to-support-genesis-stake-pools

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
Copy Markdown

@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: 1

🧹 Nitpick comments (1)
pallas-configs/src/shelley.rs (1)

274-319: Test coverage missing for the new registration_deposit field.

The test thoroughly validates most Pool fields including the defaulted owners field, but doesn't verify that registration_deposit correctly defaults to None when absent from the JSON.

Add an assertion after line 308 to verify the new field:

     );
     assert_eq!(pool.margin.numerator, 0);
+    assert_eq!(pool.registration_deposit, None);
 
     let stake = staking
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between df1cd7a and 932f2dc.

📒 Files selected for processing (3)
  • pallas-configs/README.md (1 hunks)
  • pallas-configs/src/shelley.rs (2 hunks)
  • test_data/partner-shelley-genesis.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
pallas-configs/src/shelley.rs (1)
pallas-configs/src/alonzo.rs (1)
  • load_test_data_config (248-255)
🪛 Gitleaks (8.29.0)
test_data/partner-shelley-genesis.json

[high] 67-67: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 83-83: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 99-99: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ 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). (8)
  • GitHub Check: Check (ubuntu-latest, stable)
  • GitHub Check: Check (macOS-latest, stable)
  • GitHub Check: Check (windows-latest, stable)
  • GitHub Check: Test Suite (ubuntu-latest, stable)
  • GitHub Check: Test Suite (windows-latest, stable)
  • GitHub Check: Check (windows-latest, stable)
  • GitHub Check: Test Suite (ubuntu-latest, stable)
  • GitHub Check: Test Suite (windows-latest, stable)
🔇 Additional comments (3)
test_data/partner-shelley-genesis.json (1)

67-67: Static analysis false positive: These are legitimate test data.

The static analysis tool flagged the keyHash values as potential API keys. These are actually Cardano credential key hashes (public identifiers) within the staking pool reward account structures, which is the expected format for Shelley genesis configurations. Since this is test data for a Testnet environment, there's no security concern.

Also applies to: 83-83, 99-99

pallas-configs/README.md (1)

3-19: LGTM!

The documentation clearly explains the crate's purpose and provides a practical example demonstrating how to load and access staking pool data from Shelley genesis files.

pallas-configs/src/shelley.rs (1)

167-168: LGTM! Default handling correctly implemented.

The #[serde(default)] attributes are properly applied:

  • owners: Vec<String> will default to an empty vector if omitted
  • registration_deposit: Option<u64> will default to None if omitted

This allows the deserializer to handle partner genesis files that may not include these fields, maintaining backward compatibility.

Also applies to: 174-175

Comment on lines +167 to +175
#[serde(default)]
pub owners: Vec<String>,
pub pledge: u64,
pub public_key: String, // pool ID
pub relays: Vec<HashMap<String, Relay>>,
pub reward_account: RewardAccount,
pub vrf: String,
#[serde(default)]
pub registration_deposit: Option<u64>,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

The PR description doesn't match the actual changes.

The PR title states "Remove unnecessary serde aliases" and the description says "Removes unused serde alias attributes," but the actual changes show:

  1. Adding #[serde(default)] to the existing owners field (line 167)
  2. Adding a new registration_deposit field with #[serde(default)] (lines 174-175)

These are additions, not removals. Additionally, #[serde(default)] is not a serde "alias" attribute—it provides default values for missing fields during deserialization. Please update the PR title and description to accurately reflect that this PR adds default handling for optional Pool fields to support partner genesis configurations.

@scarmuega scarmuega changed the title Remove unnecessary serde aliases from staking pool config fix(configs): ensure shelley devnet config parses correctly Nov 13, 2025
@scarmuega scarmuega merged commit 2a01e80 into main Feb 4, 2026
13 of 15 checks passed
@scarmuega scarmuega deleted the codex/update-pallas-configs-to-support-genesis-stake-pools branch February 4, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant