Skip to content

Match JavaScript attention ledger semantics in Python verifier - #360

Merged
aruintelligence merged 1 commit into
mainfrom
fix/python-ledger-number-semantics-20261015
Oct 15, 2026
Merged

aruintelligence merged 1 commit into
mainfrom
fix/python-ledger-number-semantics-20261015

Conversation

@aruintelligence

Copy link
Copy Markdown
Owner

What changed

  • Replay attention charges using binary64 arithmetic, including rounding after each addition, so Python accepts signed JavaScript receipts whose cumulative total crosses 2**53.
  • Match Object.is for ledger balances: reject a boolean substituted for a number and distinguish -0 from +0 where JavaScript does. Retain negative zero when parsing raw integer tokens and accept it in fields where JavaScript Number.isInteger does.
  • Add four signed cross-runtime cases, including a re-signed malformed ledger whose capsule hashes and signature remain valid, plus document the evidence boundary. Ignore generated Python bytecode.

Reproduction

Before this patch, JavaScript verified a signed receipt with attention charges [9007199254740991, 1, 1] and final total 9007199254740992, but Python rejected its ledger. Conversely, Python reported verified: true for a correctly re-signed receipt with remaining: true where JavaScript rejected the ledger.

Checks

  • node --test: 797 passed
  • node scripts/check-evidence-capsule-python.mjs: 36 passed
  • node scripts/check-http-exchange-python.mjs: 28 passed
  • Archive, migration, shard, drill, repair, placement, API stability, upgrade, and local link checks passed

These are project-authored synthetic tests of verifier behavior, not independent validation or a claim about human outcomes.

@aruintelligence
aruintelligence merged commit 0551293 into main Oct 15, 2026
60 checks passed
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.

1 participant