Repository navigation
feat(backup): a full backup's contract part always fits what its import accepts - #2035
Merged
Merged
Conversation
…rt accepts The export writes the account-state part so that the import's part cap and both file checks (the sealed text and the pretty text) accept it. Past that size it leaves out whole class-table entries: app classes first, then the wallet's own, each largest in the file first, ties by class id. Every network item, contract entry and saved sender stays, and a part that already fits is written unchanged. - `fitAccountStatePart` sits beside `encodeAccountState` and is called once by `AccountStateService.backup()`. It sizes each class once in the wire form the file carries, and measures the final part once with `accountStatePartCodeUnits`, the measure the import's cap reads. - The page fetches the account-state part last and passes what the rest of the file takes (`BackupFileRest`); `MAX_SEALABLE_TEXT_BYTES` is the compact text a sealed file can hold. `ServiceClient.backup` forwards its arguments as `restore` does. - One warn line names the classes left out and their sizes, never an address. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…own copy of its class The restore takes the wallet's own copy of a class in the wire form a file's artifacts have, so its class-id check parses it once and a contract of a class the wallet ships registers from that copy. The restore tests' artifact schema now refuses a value already parsed, as the real one does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Extension preview build —
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
nulo-landing | e054777 | Commit Preview URL Branch Preview URL |
Nov 26 2026, 10:51 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The owner's pick of 2026-11-26:
Owner sign-off
The owner's word in chat, 2026-11-27: "land 2035". On the restore commit: "Yes, keep the fix in this PR please." On the transaction history, which the fit leaves whole: "ok known issue", filed as #2036 (a full backup with tens of thousands of transactions is too large to create).
Match: head
e054777dfbuilds the pick quoted above. Its second commit makes a contract of a class the wallet ships, left without code, restore from the wallet's own copy, which the pick's restore sentence needs. No screen, word or layout changes.The rule
JSON.stringify(part).lengthon the file's form of the part, after the import rewrites each network id to its seeded one). Second, the sealed file's limit. Third, the pretty file's limit. The page fetches the contract part after every other part and passes it what the rest of the file takes, so both file checks see the whole file.fitAccountStatePartinaccount-state/normalize.ts), called once by the export. It sizes each class once and measures the final part once with the import's own measure. If the two disagree, or if the entries alone are over the import's cap, the export stops with an error. If the file still fails a file check with every class out, the page's existing "Backup is too large to create" refuses it.No stored shape changes.
UI impact: none. No screen, word or layout changes.
Tests
normalize-fit.test.ts): a part under budget is returned as the same object; at the budget and one code unit over; the order (app before wallet, largest first, ties by class id, kept entries in table order); entries and senders untouched; the file's form of the code (realBufferbytecode, realFrclass ids, the production sanitizer); the UTF-8 and pretty budgets; the network-id rewrite; every class must go; idempotent; a bound on the serializations over 2,000 classes; the refusals.backup-fit.composition.test.ts): the real export, file assembly, network rewrite and chain-sync tail, then a fresh profile's restore. The largest app code is left out, every entry and sender restores, and the left-out contracts read the existing error. With every class out, the wallet's own contracts restore from its catalog.toolbar-panelruns on Firefox only).backup-restore-sw-restartruns on Chrome only) (34 min). Smoke, 36 of 36 passed.backup-restore-integrity,restore-again,backup-migration-roundtrip,backup-import-stalled-network,backup-edited-local-network,import-handshake-note,import-handshake-note-matrix,account-balance-orphans,same-token-concurrent-sends,backup-restore-sw-restart,profile-reimport-matrix.backup-roundtrip,backup-imported-account,security-backup,passkey-backup,passkey-retry,legal-acceptance,toolbar-panel.Evidence (scratch spec, not committed; proverless, retry 0)
The base build is dev at
8a90f146fwith the same e2e flags. The e2e and evidence ran on these two commits on top of8a90f146f. The rebase onto6d722c105adds only #2033 (where the PXE route snapshot schema lives), and every local gate (lint,typecheck:all,test,audit:vue,test:ci-gating, Storybook) passed after it. In E2 this build's export runs right after an in-place update and an unlock, so its time includes that cold start. Fitting a 6.36M part that already fits takes 0.35 to 0.6 s in a unit run.sendTxreturns a tx hash.🤖 Generated with Claude Code