Repository navigation
Conversation
Phase 1 of the #2290 RateAuthorisation set (design record: task 5741 on #2290; field semantics #2063 section 2). Library-only in pkgs/id: - RateAuthorisation body: authorisation_id (u128, stable across versions), version, issuer_id (must equal event author), source/dest ledgers (one direction only), rate_num/rate_den (u128), min/max amount, total_cap, authorised_callers (any|allowlist|single), not_before + mandatory expires_at, optional reversal_window_secs and fee_bps. - RateAuthorisationRevoke body: {authorisation_id, revoked_version_from, effective_at, reason}. - fold_authorisation: live = highest valid version; an issuer-signed revoke covering it folds Revoked (terminal, no older version revives); bodies naming another issuer are invalid and ignored. - apply_rate: floor(x * rate_num / rate_den), checked. Golden tests: ABC->123 at 0.8123 (8123/10000; 100 -> 81) and the separate reverse 123->ABC at 1.20; issuer-mismatch invalid; superseded not live; revoked folds revoked; stranger revoke ignored; signed-event round trip. 7/7 pass (cargo test --lib currency::).
…voke (#3800) Codex findings on PR #3888: (P1) fold_authorisation now takes expected_issuer and filters version selection to that issuer before choosing the highest version, so a foreign signer reusing an authorisation_id cannot hijack the fold; (P2) covering revoke selection picks the earliest effective_at (tie-break smallest revoked_version_from) instead of the smallest revoked_version_from. Adds regression tests for both; currency tests 9/9 on laptop.
…authorisation # Conflicts: # pkgs/id/src/lib.rs
Main added ChainExt.note: currency.rs sign helpers now set note: None, and the merge had silently dropped note: None from an idset.rs test literal (restored; file matches main again).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 42 minutes. View limit details
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. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: acf6d40b8f
ℹ️ 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 "@codex address that feedback".
| .filter(|(author, _)| author == expected_issuer) | ||
| .filter(|(_, body)| body.authorisation_id == authorisation_id) | ||
| .filter(|(author, body)| body.validate(author).is_ok()) | ||
| .max_by_key(|(_, body)| body.version)?; |
There was a problem hiding this comment.
Resolve conflicting highest versions deterministically
If the expected issuer signs two different bodies with the same authorisation ID and version, both pass validation, but max_by_key selects whichever appears last in the input slice. Reversing those same signed objects can therefore change the folded rate, cap, or caller policy. Neither signing nor validation rejects duplicate versions, and the fold documents no input-order requirement. Reject conflicting highest versions or introduce a deterministic tie-breaker so the same set of signed objects cannot produce different authorisation states.
Useful? React with 👍 / 👎.
| pub fn apply_rate(&self, amount: u128) -> Option<u128> { | ||
| amount | ||
| .checked_mul(self.rate_num)? | ||
| .checked_div(self.rate_den) |
There was a problem hiding this comment.
Normalize ledger scales before flooring the conversion
For ledgers with different scales, following the documented instruction to normalize the result after apply_rate loses fractional destination units irreversibly. For example, with source scale 0, destination scale 2, amount 1, and rate 8123/10000, this helper returns 0; subsequent scale normalization still produces 0 instead of the correct 81 destination minor units. Include scale normalization before the integer division, or explicitly require a rate already adjusted for both ledger scales rather than instructing callers to normalize the floored result.
Useful? React with 👍 / 👎.
|
🤖 Agent note · handed off
|
|
🤖 Agent note · handed off
|
|
🤖 Agent note · handed off
|
|
🤖 Agent note · handed off
|
|
🤖 Agent note · handed off
|
|
🤖 Agent note · handed off
|
|
agent-note:v1 task 13538 lane code-g: picked up, execution lane opencode (row 5114), handed off to claimant and parked 1200s. Fresh check: PR #7231 OPEN, no hard-stop labels. |
|
🤖 Agent note · handed off
|
|
🤖 Agent note · handed off
|
|
🤖 Agent note · handed off
|
|
🤖 Agent note · picked up
|
|
🤖 Agent note · done — closed as superseded, nothing unique to salvage
|
Opened by the branch-disposition execution (2026-11-07) from branch
queue/5789-3800-rate-authorisation.Branch origin: queue branch for issue #5789.
This branch was laptop-local work (or a stranded remote branch) with real changes ahead of
mainand no PR. Per Drew's 2026-11-07 branch-disposition ruling, ahead branches with real changes get a PR; this PR surfaces the work for triage instead of leaving it stranded on a branch.Triage owner: batch issue in developing-today/code, "Unowned PR batch from branch disposition (2026-11-07)". Outcome per batch triage: close with reason, or route to impl/finish/merge as a follow-on fix task.
Evidence: branch-ahead review
~/workspace/scratch/branch-ahead-review-2026-11-07.md; execution log~/workspace/scratch/branch-disposition-2026-11-07.md.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.