-
Notifications
You must be signed in to change notification settings - Fork 14
feat: Aiken Permissioned Candidates & D Parameter Migration #378
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
|
Great job! No new security vulnerabilities introduced in this pull request |
|
It would be confusing to land the documentation without the implementation. Currently in the repo we document only what's done rather than what potentially might be upcoming... |
|
I add the ADR as the first document as the record of architecture decisions should precede the implementation. Technically the test plan should also if TDD is followed. |
|
/bot rebuild-metadata |
|
❌ Metadata rebuild failed. Check the workflow logs for details. |
|
/bot rebuild-metadata |
|
✅ Metadata rebuild complete! Changes have been committed. |
NachoPal
left a 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.
I don't think we need to overcomplicate it with a DParamProvider as we don't expect other providers. See how the DParam is directly queried from the pallet-system-parameters in #387
This was a generic approach used for mocking. Now 'pallet-system-parameters' is available I'll integrate accordingly. |
- Add DParameterProvider trait for mockable D Parameter sourcing - Implement MockDParameterProvider (uses inherent data for backward compat) - Implement FixedDParameterProvider for testing - Update select_authorities to use select_authorities_with_provider - Remove DParameterOverride storage and override_d_parameter extrinsic - Update pc-chain-config.json with new Aiken policy IDs: - node-dev-01: 51f812332ccc276d1dfa9da923c2235b91a5150ff275b633a5fa1bdb - qa-net: 6c327f1fe5e3b2619c62ca642892146c7326a91dc47f6006f6cdf690 - preview: 4057188de00d74c6679263989745309f02bf55f8806061943124489b - preprod: 369ee95be4c68a2984733a8c727ecd28df3039a3e5f1e80290b08eec - Add test plan document WP: Aiken Permissioned Candidates & D Parameter Migration Ticket: PM-20994
- Change manual tests from ✅ to ⬜ (Not Started) - Add ⬜ Not Started to legend - Add Notes column to test matrix - Add detailed Manual Verification Procedures section - Include code review checklists for TC-0004-04/05/07
TC-0004-04 and TC-0004-05 are compile-time + code review only, not unit tests. Changed Unit Test column from ✅ to ➖ (N/A).
- TC-0004-04/05: Now 'verified by compilation' (not manual review) - TC-0004-07: Removed (config file content verified at dev time) - Removed Manual Verification Procedures for code review items
- Renumber tests sequentially (TC-01 through TC-06) - Remove compile-time verification entries (not tests) - Remove config file verification (dev-time check) - Remove future test cases section - Simplify test matrix (unit tests only) - Streamline test case descriptions
Document the migration from Haskell to Aiken Permissioned Candidates contracts and the D Parameter provider abstraction. WP: Aiken Permissioned Candidates Migration
The struct is only used in unit tests, not in runtime-benchmarks. Restricting to #[cfg(test)] fixes dead_code warning when building with --features runtime-benchmarks.
- Replace Good/Bad/Neutral format with flattened ✅/❌ icon list - Remove Implementation Approach section (design work, not decision) - Remove Technical Details section (policy IDs are implementation details) - Consolidate structure: Decision Drivers → Options → Decision → Consequences - Add proper Confirmation section with validation criteria ADRs document decisions, not design.
- docs/decisions/0005-aiken-permissioned-candidates-d-parameter-migration.md -> docs/decisions/adr-aiken-permissioned-candidates-d-parameter-migration.md - docs/tests/0005-aiken-permissioned-candidates-d-parameter-migration.md -> docs/tests/test-plan-aiken-permissioned-candidates-d-parameter-migration.md - Add ADR: prefix to title
- Remove d_parameter.rs module (trait abstraction no longer needed) - D Parameter now sourced directly from SystemParameters::get_d_parameter() - Update ADR status to Accepted - Update test plan to reflect pallet integration Depends-on: PR #387
d3685a0 to
cd09ff3
Compare
- Add PR link to header - Use PR378-TC-## format for Test IDs with hyperlinks to source - Add column width divs to table - Hyperlink symbols in Overview to source definitions - Use proper <br> format for multi-step entries
Add new RPC endpoint that returns Ariadne parameters with D Parameter sourced from pallet-system-parameters instead of Cardano contracts. Changes: - Add MidnightAriadneRpc module in node/src/ariadne_rpc.rs - Compose with SessionValidatorManagementQuery for candidate data - Override D Parameter with pallet-sourced value - Add 11 unit tests covering mock API, serialization, and override logic - Update UI config with new endpoint definition - Mark deprecated flag on old sidechain_getAriadneParameters endpoint - Update ADR with RPC migration notes The new endpoint midnight_getAriadneParameters provides the authoritative D Parameter value while maintaining backward-compatible response schema.
|
No need to create a new rpc file under node. |
- Move get_ariadne_parameters RPC from node/src/ariadne_rpc.rs to pallets/system-parameters/rpc/src/lib.rs per review feedback - Update SystemParametersRpc to include SessionValidatorManagementQueryApi - Remove standalone MidnightAriadneRpc module - Fix test plan line number reference (L1751 -> L1752)
- Add missing CHAINSPEC_SYSTEM_PARAMETERS_CONFIG env var required by pallet-system-parameters migration - Update D Parameter values (10, 0) to match genesis config in res/dev/system-parameters-config.json
…into feat/aiken-permissioned-candidates-migration
Add E2E test coverage for pallet-system-parameters RPC endpoints: - verify_system_parameters_genesis_via_rpc: validates genesis values - verify_system_parameters_response_format: checks camelCase format - query_system_parameters_at_historical_block: tests historical queries Add MidnightClient helper methods for system parameters RPC: - get_terms_and_conditions / get_terms_and_conditions_at - get_d_parameter / get_d_parameter_at - get_best_block_hash / wait_for_next_finalized_block Ref: PM-20991
Change TermsAndConditionsRpcResponse.hash from String to H256 for improved type safety. The JSON wire format remains unchanged as H256 serializes to the same hex string format (0x-prefixed).
- pallet-system-parameters: remove unused 'log' dep, ignore 'serde' (used by frame_support macros) - pallet-system-parameters-rpc: remove unused 'hex' dep (no longer needed after H256 refactor) - midnight-primitives-system-parameters: remove unused parity-scale-codec, scale-info, sp-runtime, sp-core
…into feat/aiken-permissioned-candidates-migration
Remove T&C-related additions from e2e tests that were out of scope for the Aiken permissioned candidates migration work package: - Remove TermsAndConditionsResponse struct from midnight.rs - Remove get_terms_and_conditions and get_terms_and_conditions_at methods - Remove T&C constants and assertions from e2e tests - Rename tests to focus on D Parameter verification only D Parameter RPC tests remain as they are in scope for this migration.

Summary
Migrate PC (Partners Chain) validator selection from Haskell-based Permissioned Candidates contracts to Aiken-based contracts, and source the D Parameter from
pallet-system-parametersinstead of from Cardano D Parameter contract.🎫 Ticket #1 🎫 Ticket #2 📐 ADR 🧪 Test Plan
Motivation
The Haskell-based Permissioned Candidates contracts are being deprecated in favor of new Aiken-based contracts. Additionally, the D Parameter—which controls the ratio of permissioned to registered validators—was previously sourced from a Cardano contract, introducing latency and external dependencies.
By migrating to Aiken contracts and sourcing the D Parameter from
pallet-system-parameters, we:DParameterOverridemechanismChanges
New RPC Endpoint -
systemParameters_getAriadneParameters:sidechain_getAriadneParameterspallet-system-parameters(on-chain)sidechain_getAriadneParametersto this endpointRPC Deprecation:
sidechain_getAriadneParametersmarked as deprecated (still functional)D Parameter Integration:
pallet-system-parametersviaSystemParameters::get_d_parameter()systemParameters_getDParameteravailablepallet-midnight:
DParameterOverridestorage itemoverride_d_parameterextrinsicConfiguration:
pc-chain-config.jsonfiles with new Aiken policy IDs for all environmentsDepends on: PR #387 (Add System Parameters pallet)
📌 Submission Checklist
🔱 Fork Strategy
🗹 TODO before merging