Skip to content

Add OffchainAsset (OA) magic numbers to KnownMagic enum#128

Open
thedavidmeister wants to merge 5 commits into
mainfrom
2026-06-14-issue-98
Open

Add OffchainAsset (OA) magic numbers to KnownMagic enum#128
thedavidmeister wants to merge 5 commits into
mainfrom
2026-06-14-issue-98

Conversation

@thedavidmeister

Copy link
Copy Markdown
Contributor

What

Adds the five OffchainAsset (OA) magic numbers used by the gildlab/SFT frontend and the h20.market tokenization UI to the KnownMagic enum in crates/cli/src/meta/magic.rs, so RainMetaDocumentV1Item can be used to encode/decode receipt information for OffchainAssetReceiptVault deposits and withdrawals.

Variant Value
OaSchema 0xffa8e8a9b9cf4a31
OaHashList 0xff9fae3cc645f463
OaStructure 0xffc47a6299e8a911
OaTokenImage 0xff8cd2927c8c86cb
OaTokenCredentialLinks 0xffbc38eb14ad2209

Details

  • Purely additive: all existing magic numbers are unchanged.
  • The new variants are also wired into the TryFrom<u64> match so they round-trip on decode (consistent with every other variant in that match).
  • Each new variant has a test asserting its exact u64 prefix bytes (mirroring the existing per-magic tests), plus a round-trip test through TryFrom<u64>.

cargo build, cargo test (126 passed, 0 failed), cargo fmt, and cargo clippy --all-targets --all-features are all green. Mutation-validated: flipping OaSchema's value made test_oa_schema fail, then restored.

Out of scope

The issue's "Additional consideration" about supporting OA_SCHEMA as an extra CBOR map key (extending RainMetaDocumentV1Item beyond keys 0-4) is a separate, larger change and is not addressed here.

Closes #98

🤖 Generated with Claude Code

Adds the five OffchainAsset magic numbers used by the gildlab/SFT
frontend and h20.market tokenization UI to the KnownMagic enum so
RainMetaDocumentV1Item can encode/decode receipt information:

- OaSchema = 0xffa8e8a9b9cf4a31
- OaHashList = 0xff9fae3cc645f463
- OaStructure = 0xffc47a6299e8a911
- OaTokenImage = 0xff8cd2927c8c86cb
- OaTokenCredentialLinks = 0xffbc38eb14ad2209

The new variants are also added to the TryFrom<u64> match so they
round-trip on decode. Existing magic values are unchanged.

Closes #98

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@thedavidmeister thedavidmeister self-assigned this Jun 14, 2026
@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@thedavidmeister, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 51 minutes and 36 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 361ea542-5b59-4688-ab94-423bbf709816

📥 Commits

Reviewing files that changed from the base of the PR and between 95f16ac and a81af0c.

📒 Files selected for processing (1)
  • crates/cli/src/meta/magic.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2026-06-14-issue-98

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.

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.

Add OA (OffchainAsset) magic numbers to KnownMagic enum

1 participant