feat(icrc-ledger-types): add ICRC-124 block schema validators#9500
Draft
feat(icrc-ledger-types): add ICRC-124 block schema validators#9500
Conversation
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>
Contributor
There was a problem hiding this comment.
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
icrc124module export from the crate root. - Implement shared ICRC-124 block/tx schema predicates plus
validate_pause,validate_unpause, andvalidate_deactivate. - Add unit tests covering valid minimal/full blocks and several invalid cases (wrong
btype, missing required fields, invalidphash, 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.
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
validate_pause,validate_unpause,validate_deactivate) and ICRC-154 method name constants toicrc-ledger-typesbtype(required),ts(required),phash(optional 32-byte blob),txmap with all-optional provenance fields (mthd,caller,reason,ts)Test plan
tx) and full blocks (all provenance fields populated) for each of the 3 block typesbtype, missing required fields (btype,ts,tx), invalidphashlength (16 bytes instead of 32), and non-map inputs🤖 Generated with Claude Code