Align CLI, API, and schema with anchor_ref field#44
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| errors.Add(new("core.anchor.network_mismatch", $"anchor.chain '{anchor.Chain}' does not match configured network '{context!.Network}'", "anchor.chain")); | ||
| } | ||
|
|
||
| if (anchor.Chain.StartsWith("stellar:", StringComparison.OrdinalIgnoreCase) && !anchor.HashAlgorithm.Equals("sha-256", StringComparison.OrdinalIgnoreCase)) | ||
| if (anchor.Chain.StartsWith("stellar:", StringComparison.OrdinalIgnoreCase) && !StellarHashPattern.IsMatch(anchor.Reference)) | ||
| { | ||
| errors.Add(new("core.anchor.invalid_hash_algorithm", "Stellar anchors must use SHA-256", "anchor.hash_alg")); | ||
| errors.Add(new("core.anchor.invalid_anchor_ref", "stellar anchors must supply a 64-character hexadecimal anchor_ref", "anchor.anchor_ref")); | ||
| } | ||
| } | ||
|
|
||
| if (string.IsNullOrWhiteSpace(anchor.TransactionHash) || !HexPattern.IsMatch(anchor.TransactionHash)) | ||
| if (string.IsNullOrWhiteSpace(anchor.Reference)) | ||
| { | ||
| errors.Add(new("core.anchor.invalid_tx_hash", "anchor.tx_hash must be a hexadecimal transaction hash", "anchor.tx_hash")); | ||
| errors.Add(new("core.anchor.missing_anchor_ref", "anchor.anchor_ref is required", "anchor.anchor_ref")); |
There was a problem hiding this comment.
Continue validating blockchain anchor_ref as hexadecimal
The anchor validator no longer enforces any format on anchor_ref for CAIP‑2 blockchain anchors. The previous implementation required anchor.tx_hash to match a hexadecimal pattern, but after the rename to anchor_ref the check was narrowed to Stellar only and other chains are allowed to pass with arbitrary strings. Entries anchored to Ethereum or other blockchains can now be marked valid even though the reference is not a transaction hash, which will later cause verification/lookups to fail. Consider keeping the hex validation for all CAIP‑2 chains while still permitting free‑form identifiers for the new non‑blockchain anchor types.
Useful? React with 👍 / 👎.
Summary
tx_hashusage with the newanchor_reffield across core models, validators, signing/verifier flows, and specscreate/validatecommands plus refreshed documentation and project wiringTesting
dotnet test(fails: dotnet SDK not available in execution environment)https://chatgpt.com/codex/tasks/task_e_68e9dbf10558832d99a2d78590bdd9e8