Skip to content

feat(icrc-ledger-types): add ICRC-124 block schema validators#9500

Draft
bogwar wants to merge 1 commit intomasterfrom
icrc-124-1-types
Draft

feat(icrc-ledger-types): add ICRC-124 block schema validators#9500
bogwar wants to merge 1 commit intomasterfrom
icrc-124-1-types

Conversation

@bogwar
Copy link
Contributor

@bogwar bogwar commented Mar 19, 2026

Summary

  • Add ICRC-124 block schema validators (validate_pause, validate_unpause, validate_deactivate) and ICRC-154 method name constants to icrc-ledger-types
  • Block schema: btype (required), ts (required), phash (optional 32-byte blob), tx map with all-optional provenance fields (mthd, caller, reason, ts)
  • First PR in a stacked series implementing ICRC-124/154 (pause/unpause/deactivate)

Test plan

  • Schema validators accept minimal blocks (empty tx) and full blocks (all provenance fields populated) for each of the 3 block types
  • Validators reject wrong btype, missing required fields (btype, ts, tx), invalid phash length (16 bytes instead of 32), and non-map inputs

🤖 Generated with Claude Code

Add schema validators for ICRC-124 pause, unpause, and deactivate
block types, along with ICRC-154 method name constants.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds initial ICRC-124/154 support to icrc-ledger-types by introducing schema validators for ICRC-124 management blocks (pause/unpause/deactivate) and exposing a new icrc124 module.

Changes:

  • Add new icrc124 module export from the crate root.
  • Implement shared ICRC-124 block/tx schema predicates plus validate_pause, validate_unpause, and validate_deactivate.
  • Add unit tests covering valid minimal/full blocks and several invalid cases (wrong btype, missing required fields, invalid phash, non-map inputs).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/icrc-ledger-types/src/lib.rs Exposes the new icrc124 module publicly from the crate root.
packages/icrc-ledger-types/src/icrc124/mod.rs Declares the schema submodule for ICRC-124.
packages/icrc-ledger-types/src/icrc124/schema.rs Implements ICRC-124 block schema validators and corresponding unit tests; defines ICRC-124 block type and ICRC-154 method name constants.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants