GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(id): currency.rate_authorisation + revoke types and fold (#3800) by dezren39 · Pull Request #3888 · developing-today/code

Conversation

@dezren39

@dezren39 dezren39 commented Nov 1, 2026 •
edited by blacksmith-sh Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Phase 1 of the #2290 RateAuthorisation set. Design record: task 5741 triage comment on #2290; field semantics: #2063 §2. Library-only in pkgs/id — no gateway or control-plane code (Phases 2–3 are #3801 / task 5790 and #3802 / task 5791).

What

New module pkgs/id/src/currency.rs, following the attestation.rs precedent (signed objects as ordinary chain events, state computed by a fold over the objects alone):

  • currency.rate_authorisation — RateAuthorisation body: authorisation_id (u128, stable across versions), version (monotonic), issuer_id (verifying-key bytes; must equal the event author), source_ledger / dest_ledger (one direction only), rate_num / rate_den (u128), min_amount / max_amount, total_cap, authorised_callers (Any | Allowlist | Single), not_before + mandatory expires_at, optional reversal_window_secs and fee_bps.
  • currency.rate_authorisation_revoke — RateAuthorisationRevoke body: {authorisation_id, revoked_version_from, effective_at, reason}.
  • fold_authorisation — live object = highest valid version; an issuer-signed revoke covering that version folds Revoked (terminal — no older version revives); a body naming an issuer other than its event author is invalid and ignored, as is a revoke signed by a stranger.
  • apply_rate — floor(x · rate_num / rate_den), checked arithmetic, rounding down per id: design: conversion engine — linked transfer pairs, rate authorisation, liquidity accounts #2063 §2.
  • Sign helpers (sign_authorisation / sign_revoke) mirroring attestation's.

Tests

cargo test --lib currency:: on the laptop: 7/7 pass —

  • Golden forward: ABC→123 at 0.8123 (8123/10000), 100 → 81 (floor).
  • Golden reverse: separate object 123→ABC at 1.20 (120/100), 100 → 120; neither direction implies the other (folding one id never sees the other).
  • Body issuer ≠ event author → invalid, ignored by the fold.
  • Superseded version does not fold as live.
  • Revoked authorisation folds as revoked from its effective version.
  • Revoke signed by a stranger does not revoke.
  • Signed-event round trip through the fold.

Queue: task 5789 (repo-health-code-pilot), lane A.

Closes #3800


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@dezren39
feat(id): currency.rate_authorisation + revoke types and fold (#3800)
e955216
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::).
@dezren39
dezren39 requested a review from a team as a code owner November 1, 2026 17:40
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Warning

Review limit reached

You'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 56 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ac0940d4-8f24-404b-9544-243002638c19
Commits

Reviewing files that changed from the base of the PR and between f3e9c19 and acf6d40.

Files selected for processing: 3
  • pkgs/id/src/currency.rs
  • pkgs/id/src/idset.rs
  • pkgs/id/src/lib.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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
  • X
  • Mastodon
  • Reddit
  • LinkedIn
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T23:14:10.856829Z acf6d40 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Nov 1, 2026
id(currency): RateAuthorisation + revoke schema types and fold in pkgs/id (Phase 1 of #2290) #3800
Closed
id(currency): gateway verification flow + revocation-set check for RateAuthorisation (Phase 2 of #2290) #3801
Closed
id(currency): quote issuance + binding for RateAuthorisation (Phase 3 of #2290) #3802
Closed
chatgpt-codex-connector[bot]
chatgpt-codex-connector Bot reviewed Nov 1, 2026
View reviewed changes

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e955216d9d

ℹ️ 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".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pkgs/id/src/currency.rs Outdated
Comment on lines +280 to +283
.filter(|(_, body)| body.authorisation_id == authorisation_id)
.filter(|(author, body)| body.validate(author).is_ok())
.max_by_key(|(_, body)| body.version)?;
let issuer = live.1.issuer_id;

@chatgpt-codex-connector chatgpt-codex-connector Bot Nov 1, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

P1 Badge Bind version selection to the expected issuer

When objects from multiple signers are folded, another signer can reuse an existing authorisation_id, set issuer_id to their own key, and publish a higher version. This passes validate and replaces the original LP's authorisation; the subsequent revoke filter also switches to the new signer, so even a revoked authorisation becomes Live. Matching the body issuer to its own event author does not establish ownership of the existing ID. Require an expected issuer (or an issuer-scoped authorisation key) and filter by it before selecting the highest version.

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@dezren39 dezren39 Nov 1, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Fixed in ea1f298 (queue task 5789, lane E): fold_authorisation now takes an expected_issuer and filters version selection to objects whose event author is that issuer before choosing the highest version — a foreign signer reusing the authorisation_id can no longer displace the original issuer's authorisation, and revokes are likewise bound to the expected issuer. Regression test: foreign_signer_cannot_hijack_authorisation_id. Currency tests 9/9 pass on laptop.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pkgs/id/src/currency.rs Outdated
.filter(|(author, _)| *author == issuer)
.filter(|(_, body)| body.authorisation_id == authorisation_id)
.filter(|(_, body)| body.revoked_version_from <= live.1.version)
.min_by_key(|(_, body)| body.revoked_version_from);

@chatgpt-codex-connector chatgpt-codex-connector Bot Nov 1, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

P2 Badge Preserve the earliest effective covering revocation

When multiple issuer-signed revokes cover the selected version, choosing the smallest revoked_version_from can discard an earlier effective revocation. For example, for version 2, a revoke from version 2 effective at time 100 and another from version 1 effective at time 200 produce a folded effective_at of 200, although version 2 was already revoked at 100. Consumers using the returned timestamp cannot enforce the correct cutoff because the earlier revoke has been discarded. Select the earliest effective covering revoke, with a deterministic tie-breaker.

Useful? React with 👍 / 👎.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@dezren39 dezren39 Nov 1, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Fixed in ea1f298 (queue task 5789, lane E): covering-revoke selection now picks the earliest effective_at (deterministic tie-break: smallest revoked_version_from) instead of the smallest revoked_version_from, so an earlier effective revocation is never discarded. Regression test: earliest_effective_covering_revoke_wins (from=2 @ t=100 vs from=1 @ t=200 folds effective_at=100). Currency tests 9/9 pass on laptop.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot assigned dezren39 Nov 1, 2026
dezren39 added 3 commits November 1, 2026 16:44
@dezren39
fix(id): bind currency fold to expected issuer, earliest effective re…
ea1f298
…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.
@dezren39
Merge remote-tracking branch 'origin/main' into queue/5789-3800-rate-…
504f65a
…authorisation

# Conflicts:
#	pkgs/id/src/lib.rs
@dezren39
fix(id): adapt to ChainExt note field after main merge (#3800)
acf6d40
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).
@dezren39
dezren39 merged commit c7f7e1f into main Nov 1, 2026
1 check passed

Uh oh!

There was an error while loading. Please reload this page.

@dezren39
dezren39 deleted the queue/5789-3800-rate-authorisation branch November 1, 2026 23:13
This was referenced Nov 1, 2026
id(currency): fold_authorisation duplicate highest version folds by input order — no deterministic tie-break #4069
Closed
id(currency): RateAuthorisation::validate accepts internally inconsistent bodies — min>max, empty/inverted window, fee_bps>10000, empty/same ledgers #4071
Closed
pkgs/id: build-time review — runtime performance first, then build time (cold check build ~16 min, tests run 12 s) #3195
Closed
id: design: RateAuthorisation as a signed ID-graph object — schema, signing, revocation #2290
Closed
id: design: conversion engine — linked transfer pairs, rate authorisation, liquidity accounts #2063
Closed
id: implement RateAuthorisation as a signed ID-graph object (design #2290) #5521
Closed
@dezren39
dezren39 restored the queue/5789-3800-rate-authorisation branch November 8, 2026 04:20
This was referenced Nov 8, 2026
id: design: writer sets v2 — composable views, set algebra, federation (extends #5545) #5789
Closed
Unowned PR batch from branch disposition (2026-11-07) #7297
Open
@developing-today developing-today Bot mentioned this pull request Nov 9, 2026
fix(id): adapt to ChainExt note field after main merge (#3800) #7231
Closed
@dezren39
dezren39 deleted the queue/5789-3800-rate-authorisation branch November 9, 2026 13:17
This was referenced Nov 21, 2026
Closure audit: every closed issue/PR verified; unmerged branches + unpushed worktrees inventoried #7079
Open
id: implement ID conversion engine - linked transfer pairs and rate authorisation (design #2063) #5536
Open
epic: ID platform expansion — apps, comms, currency, hosting, boards (2026-10-28 directive, LIST 6–15) #2056
Closed
id: implement ID currencies v1 (design #2043) #5522
Closed
@dezren39 dezren39 added the audit:complete PR fully implemented spawning issue label Nov 24, 2026
@dezren39 dezren39 mentioned this pull request Nov 27, 2026
id(conversion): conversion receipt carries offer version + all leg refs, and reversal reference (slice 2 of #5536, phase G) #15830
Closed
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chatgpt-codex-connector chatgpt-codex-connector[bot] chatgpt-codex-connector[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@dezren39 dezren39

Labels

audit:complete PR fully implemented spawning issue

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

id(currency): RateAuthorisation + revoke schema types and fold in pkgs/id (Phase 1 of #2290)

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dezren39
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.