Skip to content

Feat/exchange home page - #487

Merged
ltardivo merged 71 commits into
stagingfrom
feat/exchange-home-page
Nov 12, 2026
Merged

ltardivo merged 71 commits into
stagingfrom
feat/exchange-home-page

Conversation

@jonty007

@jonty007 jonty007 commented Aug 7, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Merges feat/exchange-home-page into staging:

  • New lib and node bundles with stricter rules for contract code, and docs for them.
  • Commodity becomes one fungible token per module, with a one-year issuance window.
  • TBC20 and TBC777 changes.
  • Mobile-friendly components.

Most lib changes change consensus, so every client must upgrade.

Lib (bundles and types in packages/lib)

Rules for contract code

  • Method arguments can be primitives, smart objects, the method's own this, mocks the caller passed in, and arrays of those. Functions and plain objects are refused.
  • _id, _rev, _root, _satoshis, _owners, _readers and _url are always the object's own data. A class that defines a member with one of these names is refused.
  • super(...) in a constructor is the only use of super. super.x is refused before any code runs, in expressions and in modules.
  • Contract code cannot run code built from a string: there is no eval or Compartment, and Function throws when called.
  • Contract and BaseContract are frozen. A class chain must end within 100 steps.
  • Constructor arguments keep the values new stored until new returns, and class setters do not run for them.
  • A module loads only by its exact txId:index specifier.
  • A call that changes nothing builds no transaction.

_root

  • A new object gets the root of the object whose method or getter is running when it is built, and its own id otherwise. An object built after an await inside a method starts its own family.

Replay, cache and lockdown

  • A replay is stored only when it accounts for the whole transaction (outputs, the inputs that spend the old revisions, satoshis and scripts). If it cannot, the read is refused with Invalid transaction.
  • After encode, the objects in effect cannot be read with sync, or used by another encode, until the transaction is broadcast. Each broadcast adds one read from the node.
  • Creating a client locks the process down (SES) in every mode, not only in prod.
  • In the browser every evaluation waits in line. Only a contract's own computer.sync or computer.load runs at once, inside its evaluation.
  • The lib no longer sends an Authentication header, so browsers can cache the node's GETs whose answer never changes.

Types

  • Three internal declaration files (constructor-args, db, transition) no longer export internal names.

Node (bundle in packages/node)

  • GETs whose answer can change send Cache-Control: no-store; routes whose answer never changes send immutable.
  • get-txos: opt-in orderBy=block with an (ltBlockHeight, ltBlockIndex, ltRev) cursor, newest first only (order=DESC). The default order is unchanged.
  • MWEB transactions are detected by the extended-serialization marker and the flag.

Tokens

Commodity

  • Mints of the same module are one fungible token. claim() stamps mod from the creation transaction, and root returns mod. isFungibleWith needs the same mod, a genuine bag, and a non-empty salt stored on the other bag's mint. The constructor takes no lineage. CommodityHelper deploys the full chain.
  • Flat 2^32 subsidy for 210000 host blocks; claim() throws after that.
  • A deposit from the same mint is credited.
  • Tests: the amount, salt and mod the constructor checked cannot be replaced before new returns.

TBC20

  • TBC20, TBC20Helper and TBC20ConstructorParams are the names now; Token and TokenHelper stay as deprecated aliases.
  • merge is async and runs only if isFungibleWith agrees. That check compares the stored _root.
  • The amount check and the debit of transfer sit in the method that creates the new token (also in TBC777 and Commodity).
  • Removed a wrong NOTE on transfer.

TBC777

  • Depends on @bitcoin-computer/TBC20 instead of its own copy. Inherits merge for clean bags and refuses bags with escrow history. Adds TBC777Helper.

Docs

  • how-it-works.md: how _root is chosen, and that the keywords are read only as an object's own data.
  • language.md: which method arguments are allowed.
  • Lib/Computer/encode.md: objects from encode before the broadcast.
  • Lib/Contract/sandbox-and-inner-computer.md: which calls nest in the browser.

Apps, components and tooling

  • App unit tests (chat, explorer, wallet, nft, vite-template, chess-app) run in a jsdom environment that keeps this realm's ArrayBuffer and typed arrays, which lockdown needs.
  • Drawer is full-width on small screens; Modal is tighter on mobile.
  • TxWrapperHelper.create funds with one computer.encode({ exclude }), so it never spends the sale's inputs (missingorspent).
  • scripts/rerun-failed.js keeps --grep patterns with quotes intact; tests wait for indexing.

Breaking changes

  • Every client must upgrade: readers replay old transactions with the new rules.
  • These no longer run or replay: a class member named like a keyword; super.x; eval, Function or Compartment; a function or plain object as a method argument; a module specifier that is not exactly txId:index; replacing a constructor argument before new returns.
  • Lockdown runs in dev and debug too. Code that changes built-ins after a Computer is created fails, and vitest's jsdom needs the test environment above.
  • Commodity: modules that stored a lineage in the constructor are a different token; redeploy the token module.
  • TBC20: await token.merge(other). A class that overrides fungibility implements isFungibleWith.
  • get-txos refuses a block cursor without order=DESC.

Tests

  • 9 Nov, on 54ab5e9, fresh chain for each: TBC20 20, TBC721 8, TBC777 51, Commodity 67, plus the lib suites; no failures.
  • 6 Nov, app unit tests with the jsdom environment: chat 1, explorer 10, wallet 22, vite-template 1.
  • 12 Nov, at merge: npm run all:hard and npm run test:turbo pass in Node and in the browser.

🤖 Generated with Claude Code

@jonty007
jonty007 requested a review from ClemensLey August 7, 2026 15:49
jonty007 and others added 11 commits August 12, 2026 12:08
…into feat/exchange-home-page

Co-authored-by: Cursor <cursoragent@cursor.com>

# Conflicts:
#	package-lock.json
#	packages/lib/dist/bc-lib.browser.min.mjs
#	packages/lib/dist/bc-lib.commonjs.min.cjs
#	packages/lib/dist/bc-lib.main.es.mjs
#	packages/node/dist/bcn.es.mjs
#	packages/node/dist/bcn.sync.es.mjs
#	scripts/rerun-failed.js
Make TBC20.merge async and gate it on overridable isFungibleWith(root).
TBC777 inherits merge for clean bags and refuses bags with escrow
history; add TBC777Helper for full-chain deploy.

Commodity no longer takes a constructor lineage. claim() stamps `mod`
from the creation tx, `root` returns `mod`, and isFungibleWith requires
a non-empty matching mod plus isGenuine(). Add CommodityHelper.

Also reformat two nakamotojs union types.
Replace Bitcoin-style halvings with a one-year Litecoin-calibrated window.
getSubsidy inlines 210000 and 4294967296n so the deployed module source is
the schedule. claim() throws after the cutoff.
…ated

transfer() held the amount check and the debit, but _createTransferToken()
did the creating. `protected` is erased at runtime and the call proxy hands
back any function it is asked for, so a transaction could name the internal
method directly: it minted a token of any size and left the parent's balance
untouched, and the result was indistinguishable from real holdings
afterwards. Moving the check and the debit into the method that creates the
token makes every route to it safe, rather than only the polite one.

merge() summed each argument and then burned it, so two names bound to the
same revision counted a single output twice and created value out of
nothing. It now refuses a repeated revision outright, so the invariant does
not depend on the library also sharing one instance per revision.

Modules run from their deployed source, so existing deployments keep the old
behaviour until they are redeployed; the library-side guards cover them in
the meantime.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copied build output, not hand-edited source. The transaction-level guards
added in lib-secret — refusing an expression that names an internal method,
and binding one instance per revision when building the environment — reach
consumers of @bitcoin-computer/lib only through these bundles.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Conflicts resolved:
- TBC777, commodity, dao-contracts package.json: keep the TBC20 dependency this
  branch added, at staging's ^0.27.0-beta.2.
- components Drawer: take staging's rewrite; it already covers the mobile width
  change this branch made.
- package-lock.json: staging's lock plus the three TBC20 dependency entries.
- lib/dist, lib/types, node/dist, components/built: rebuilt from the merged
  sources instead of merged by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rebuilt bc-lib bundles from lib-secret. The only source change behind
them is in db.ts, the replay branch of Db#eval.

Regression: commit 5d188654 ("refactor(db): simplify eval ...") dropped
the Update.testEqual call on replay. Since then, sync took the update
straight from the transaction and never compared it with the update the
contract's own computation implies. _satoshis and _owners are not
keyword-protected (transfer has to write them), so a contract could
report an amount its output does not hold, or an owner who cannot spend
it, and sync accepted it.

Restored: on replay, the owner outputs rebuilt from the contract's
result are compared with Update.testEqual against the outputs the
transaction records. A mismatch fails the sync with "Invalid
transaction.". Both sides use the transaction's inRevs, as before
5d188654, so outputs are what gets reconciled.

The transaction's update is sliced to ownerData.length before the
comparison. Replay can rebuild fewer owner objects than the transaction
records: an output the expression no longer produces is never handed
back to the caller. Comparing whole updates gave 22 false positives in
expression.async-test.ts. Each computed output is still compared with
the transaction's output at the same index. See LIB-SECURITY-FINDINGS.md
L-01 and L-02.

Tests (workspace repo, lib-secret attacks-advanced.async-test.ts,
"An object cannot misreport its own output"): a forged _satoshis and a
forged _owners are both refused on sync.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jonty007 and others added 3 commits September 29, 2026 12:38
Rebuilt bc-lib bundles from lib-secret. The source change is in db.ts,
the write path of Db#eval.

With the #8 check restored, other readers refused some honest
transactions with "Invalid transaction.". After an author synced its
own transaction, its next transaction could leave an object out.
Example: K = [], W = [K], V = [K], the author syncs V, then T = [K]
recorded T, K, V but not W, while every other reader rebuilds W too.

Why: after building a transaction the library forgot its txId, so
reading it back replayed it on top of a half-unlinked cache
(cleanupTemporaryVersion unlinks objects but not arrays). That left two
copies of K, and the next change to K skipped W.

Fix: keep the txId -> roots entry for a transaction just built, so
reading it back returns the objects that were built, without a replay.

Test lives in the workspace repo (lib-secret attacks-advanced,
"still reads an honest transaction built after its author read back an
earlier one").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rebuilt from lib-secret: builds stay out of the cache until they are
broadcast, and replay compares every output and input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rebuilt from lib-secret: a build is attached when its transaction is
read from the chain, and replay compares only the outputs a reader
computes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

It changes on-chain token semantics (re-enabling merge, a new fungibility model, and a changed economic subsidy schedule) across multiple contract packages, which carries economic/consensus risk that warrants human review.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

This PR brings the TBC20 naming alignment and exchange/mobile public-side support into staging, plus a swap funding fix. The largest part is a token-contract refactor: Token/TokenHelper are renamed to TBC20/TBC20Helper (with deprecated aliases), TBC777 drops its duplicated local tbc20.ts and depends on @bitcoin-computer/TBC20, merge() is re-enabled across TBC20/TBC777/Commodity with a new module-level fungibility model (isFungibleWith), and Commodity switches from a Bitcoin-style halving schedule to a flat 2^32-unit subsidy over 210000 host blocks. It also fixes swap wrapper funding and tightens responsive styling for Modal.

Changes:

  • Rename Token→TBC20/TokenHelper→TBC20Helper; move the transfer debit into _createTransferToken; make merge() async with same-token dedup and isFungibleWith-based lineage checks.
  • Re-enable merge() on TBC777 (escrow-history guard) and Commodity (module-level fungibility via mod/root), add TBC777Helper/CommodityHelper and exportClasses/stripContractComments; change Commodity subsidy to flat 4294967296n for [0,210000).
  • Fix TxWrapperHelper.createWrappedTx to fund in a single encode({ exclude }) pass; add waitForIndexed throughout swap/token tests; Modal mobile tweaks; root tsconfig noEmit.
File Description
tsconfig.json Adds noEmit to the root (editor-only) config; package builds use local tsconfigs, so unaffected.
packages/​TBC20/​src/​token.ts Core rename, deprecated aliases, debit moved to _createTransferToken, async merge with dedup + isFungibleWith.
packages/​TBC20/​test/​token.test.ts Updates to new names, alias assertions, waitForIndexed/waitForBalance polling.
packages/​TBC20/​build/​* Regenerated JS/d.ts matching source.
packages/​TBC777/​src/​tbc777.ts New merge() with escrow guard, _createTransferToken debit, TBC777Helper, exportClasses.
packages/​TBC777/​src/​{tbc777m,index}.ts Import TBC20 from @bitcoin-computer/TBC20; drop local tbc20.ts.
packages/​TBC777/​{build/​*,README.md,package.json} Regenerated artifacts, docs, and new TBC20 dependency.
packages/​commodity/​src/​commodity.ts Module-level fungibility (mod/root), merge via inheritance, flat subsidy schedule.
packages/​commodity/​src/​{helper,index}.ts New CommodityHelper (deploy/mint/balanceOf/transfer) and package entry.
packages/​commodity/​{test,README.md,package.json,tsconfig.release.json} Updated tests/docs, declaration, main/types, bundle rename, TBC20 dep.
packages/​swap/​src/​tx-wrapper.ts Single-pass funded encode with exclude to avoid spending sale inputs.
packages/​swap/​test/​*.ts, packages/​swap/​build/​* waitForIndexed sequencing and regenerated wrapper.
packages/​components/​src/​Modal.tsx, built/​Modal.js Responsive mobile padding/title sizing.
packages/​{dao-contracts,TBC777,commodity}/​package.json, package-lock.json Add @bitcoin-computer/TBC20 dependency.
packages/​lib/​types/​src/​types.d.ts Adds block ordering + keyset-pagination fields to TXOQuery.
packages/​node/​dist/​bcn.sync.es.mjs Regenerated committed obfuscated node build.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/TBC20/src/token.ts Outdated
Comment on lines +60 to +62
* NOTE: Subclasses that must sanitize per-instance state on transfer (e.g.
* TBC777, which strips escrow/claim history) override this method to route
* full transfers through `_createTransferToken` as well.
Keep this branch's fungible merge tests and staging's escrow deposit tests. Drop the staging test that merge() always throws. Describe claim() as the one-row previous:NULL query, including the closed issuance window.
jonty007 and others added 10 commits October 26, 2026 14:24
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fix(lib): replay reconciliation, author cache, and `_root` from the running method
Conflicts: packages/commodity/package.json keeps TBC20, TBC777 and lib.
The lib and node bundles are rebuilt in the next commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Staging removed it in fec19ae because nothing imports it. This branch
kept it, and after the staging merge it no longer compiles: inside a
contract, computer.sync now returns plain data, not an Escrow. Nothing on
this branch imports it either, so drop the contract, its test and its
build output as staging did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Built from the merged lib-secret and node-secret sources (workspace
6ba8d779). The lib and node tests, the package tests and the browser
suite ran on these bundles, with the node image rebuilt from them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lib bundles take feat's copies here; they are rebuilt from the
updated source in a later commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Built from the workspace lib-secret on fix/browser-eval-frames, after the
merge of feat and the refactor without the tie.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lib: bundles and docs for browser invalidation frames

@ClemensLey ClemensLey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary

Thanks to jonty007 for the exchange home-page work: the TBC20 rename, the single-encode swap funding fix, and module-level commodity fungibility. This is not mergeable. merge adds other.amount after a check an attacker can satisfy without sharing _root. On Commodity the check calls isGenuine, and the empty-salt constructor will store a caller's function under that name. On TBC20 and TBC777 the check compares the root getter, which a subclass can override. The private node and app half of this pair is Bitcoin-Computer-Secrets/workspace PR 215; this review does not repeat it.

Issue counts by severity

  • bugs: 2
  • suggestions: 1
  • nits: 0

Comment thread packages/commodity/src/commodity.ts Outdated
const o = other as Commodity
if (!this.mod || this.mod !== o.mod) return false
if (!(await this.isGenuine())) return false
if (typeof o.isGenuine === 'function') return o.isGenuine()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[bug] isFungibleWith returns o.isGenuine() whenever that property is a function. The empty-salt constructor forwards every extra field, and an own function shadows the class method, so this object passes:

new Commodity({ to, salt: '', amount: 1000n, mod: real.mod, isGenuine: async () => true })

A subclass that overrides isGenuine does the same. merge then adds other.amount and burns other. isEqualTo uses the same check. Empty salt is what lets the constructor keep a positive amount and the caller's mod. The salt check on _root just below rejects that forgery, and an own salt: '' shadows a getter, so the getter cannot hide it. Calling the function skips that check. The object can be built in the same expression as merge. It does not need its own module. The comment above this line says a synced revision has no methods. A lying function never needs that path.

Suggestion: Do not call a function on the other object. Use the stored salt of its _root, which the fallback already does.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 4ae394a: the call is gone, so the other bag is checked only by the salt stored on its _root.

Comment thread packages/TBC20/src/token.ts Outdated
* both bags to be genuine mints of that module).
*/
protected async isFungibleWith(other: TBC20): Promise<boolean> {
return this.root === other.root

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[bug] isFungibleWith returns this.root === other.root. root is a getter. A subclass get root() can return the victim's root, and merge adds that object's amount. Passing root as a constructor field does not stick: the getter has no setter, so that assignment throws. The previous merge compared _root, which the constructor refuses to set. TBC777.merge inherits this check and does not override it. Same-lineage tests pass an honest child, so they do not catch the getter. Commodity overrides isFungibleWith and is not on this path.

Suggestion: Compare this._root === other._root. Remote-root bags are a separate rule: the TBC777 constructor already rejects remoteRoot together with a non-zero amount, so copying remoteRoot does not mint. If those bags must still merge, do that in a TBC777 override that reads the stored remoteRoot field. Do not read root.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 525c785: merge compares this._root === other._root. No TBC777 override for remote-root bags, since nothing merges them today.

Comment thread packages/TBC20/src/token.ts Outdated
* `_createTransferToken`.
*
* NOTE: Subclasses that must sanitize per-instance state on transfer (e.g.
* TBC777, which strips escrow/claim history) override this method to route

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[suggestion] The NOTE says TBC777 overrides transfer so a full transfer goes through _createTransferToken. It does not. transfer(to) with no amount only assigns _owners and returns undefined. Sale.exec calls o.transfer(ownerP) with no amount and returns [p, o]. That in-place update is what a SIGHASH_SINGLE sale needs. An explicit amount, including the full balance, already goes through _createTransferToken. The escrow test passes that explicit amount (transfer of token with active escrow produces fresh recipient state), so it never runs the no-amount path.

Suggestion: Delete the NOTE. Do not route the no-amount transfer through _createTransferToken: Sale.exec would return the parent after its balance had moved to a new output. Do not clear withdrawn on the same _id. _withdraw refuses a repeated escrow revision only because that array already contains it. The auditor still reports that _id's claimable amount, and a non-negative available balance does not block paying it again.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Deleted the NOTE in e9f6f4b, no code change. "withdrawn[] array prevents replay (even after transfer)" already runs the no-amount transfer and checks the replay is still refused.

jonty007 and others added 4 commits November 4, 2026 16:52
isFungibleWith returned this.root === other.root. root is a getter, so
another class can define it to return any value, and merge then added
that token's amount. It now compares _root, which is the object's own
data and which no class can define. TBC777 inherits this check.
Commodity has its own rule and is not on this path.

Remote-root TBC777 bags now merge only when their _root is the same.
Nothing merges them today, so there is no TBC777 override.

Tests: in TBC20 and TBC777, merge refuses a token of another lineage
whose class returns the same root. The TBC20 build is rebuilt (one line).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Genuine

isFungibleWith returned o.isGenuine() whenever the other bag had a
function under that name. The bag's own class or its own fields decide
what that function returns, so the call was not a check. The line is
gone: the other bag is checked only by the salt stored on its _root,
which the code below it already read. isEqualTo uses the same function.

Test: an empty-salt bag of the same module whose class answers
isGenuine itself is refused by isEqualTo and by merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The NOTE said TBC777 overrides transfer so a full transfer goes through
_createTransferToken. It does not, and should not: a transfer with no
amount changes the owner in place, which Sale.exec needs, and the token
keeps its withdrawn history, which refuses a repeated claim. No code
change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Built from node-secret with GETs sent no-store by default and the block
cursor refused unless order=DESC. A build of the previous node-secret
source gives the committed bundles byte for byte; with these fixes only
bcn.es.mjs changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@ClemensLey ClemensLey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary

Thanks to jonty007 for the exchange home-page work. Comparing the stored _root is the right fungibility check: a class that defines _root is refused with A class cannot define _root: it is the object's own data. Deleting the transfer NOTE is right too: a transfer with no amount still updates the owner in place, which Sale.exec needs. This is not mergeable. On Commodity, merge still adds the other bag's amount when that bag is created in the same expression and its salt getter hides an empty salt.

The private node and app half of this pair is Bitcoin-Computer-Secrets/workspace PR 215. The cache, cursor, and eat-retry fixes there hold. This review does not repeat them.

Issue counts by severity

  • bugs: 1
  • suggestions: 0
  • nits: 0

Comment thread packages/commodity/src/commodity.ts Outdated
if (!this.mod || this.mod !== o.mod) return false
if (!(await this.isGenuine())) return false
const root = o._root === o._rev ? o : await computer.sync<typeof Commodity>(o._root)
return !!root.salt

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[bug] return !!root.salt reads a getter. For a bag created in this expression, _root === _rev, so root is that bag rather than a synced revision. A subclass can define get salt() { return 'x' } and set salt() {}. The empty-salt constructor assigns salt: '', and the setter swallows the assignment, so the bag has no own salt. It still keeps a positive amount and the caller's mod. this.isGenuine() on the honest receiver passes. This line then sees the getter, and merge adds the bag's amount.

I ran that shape in one expression against the local node. _root === _rev was true, the own descriptor for salt was absent, the read was x, and the receiver's amount went from 0 to 1000.

The new test does not catch this. It overrides isGenuine, broadcasts the bag, and merges in a later call on the object from that expression. This function never calls the other bag's isGenuine. That bag is constructed with salt: '' and no setter, so this line reads the empty string.

isGenuine uses the same read when the bag is its own root, so a same-expression call returns true as well.

Suggestion: In both functions, read the own value of salt: Object.getOwnPropertyDescriptor(root, 'salt'), and only a value field. An absent or empty own value is not genuine. Test the merge in the same expression as the setter and the getter, with the honest bag's amount unchanged.

ClemensLey and others added 8 commits November 5, 2026 11:57
A setter must not plant salt, amount, or mod over the values Commodity
checked, and a method the subclass constructor calls must not replace
them either. The checks read the descriptors after new. They do not
encode.
…perclass

An anonymous explicit superclass, or a cleared Commodity.name, must not let
the subclass constructor replace the amount and mod the mint branch checked.
The tests construct only. They do not encode.
Lockdown now runs in every mode, so it runs when the components package
creates its Computer at import. vitest's jsdom environment puts jsdom's
ArrayBuffer and typed arrays on the global object. They come from jsdom's
own realm, and lockdown refuses them, so the app tests failed at import.

Each app now tests in an environment that runs vitest's jsdom setup, then
puts back this realm's own constructors, as in a browser: chat, explorer,
wallet, nft, vite-template and chess-app.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@ClemensLey ClemensLey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me.

@ltardivo
ltardivo merged commit 761c305 into staging Nov 12, 2026
1 check passed
@ltardivo
ltardivo deleted the feat/exchange-home-page branch November 12, 2026 21:32
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.

4 participants