Skip to content

Use a placeholder leaf for empty recovery trees and move recovery to rc6 - #1048

Merged
ScreamingHawk merged 5 commits into
masterfrom
fix/no-blank-recovery-leaf
Oct 27, 2026
Merged

ScreamingHawk merged 5 commits into
masterfrom
fix/no-blank-recovery-leaf

Conversation

@Agusx1211

@Agusx1211 Agusx1211 commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

When the last recovery signer goes away (logging out the only device, a remote logout, removing the last login or recovery signer) the WDK left a recovery leaf for the zero address in the tree. That leaf should never be there, so now the tree holds a placeholder leaf instead

The placeholder signer is the last 20 bytes of keccak256("Sequence recovery placeholder signer"), so nobody has a key for it, and its minTimestamp is the max uint64, so it can never queue a payload. The recovery module stays in the config, which keeps the current behavior: the next device or recovery signer replaces the placeholder, and wallets created without recovery stay without it

  • every config update cleans up recovery modules (of any known recovery extension) that have a zero address leaf, and refuses configs whose recovery trees have one or can't be read
  • recovery.addSigner rejects the zero address and the placeholder signer
  • primitives: PLACEHOLDER_LEAF, PLACEHOLDER_SIGNER and isPlaceholderLeaf; fromRecoveryLeaves rejects zero address signers

It also moves the WDK to the rc6 Recovery module (0x0000000002BEFBcfaF3a7Cd665AbBbe234672b2F). Only the recovery module changes; sessions, passkeys and the context stay on rc5. New wallets get rc6 in their initial config (so their counterfactual address changes), and existing wallets move on their next config update:

  • wallets with the rc3, rc4 or rc5 Recovery module are treated as having recovery, so login, logout and add/remove signer keep working and never add a second module
  • the next config update points the recovery leaf at rc6 and keeps the same tree, since the tree doesn't depend on the module address; if a config has two recovery modules they are merged into one
  • queuing, fetching queued payloads and signing with the recovery module use the module the wallet config references, so a wallet that hasn't moved yet keeps using its current module
  • configs that still reference an earlier recovery module, or more than one, are refused

Note that config updates now fail if a recovery tree is missing from the state provider, and anything reading raw recovery trees sees the placeholder signer instead of 0x0 (getSigners still returns [])

Tested with the new recovery-config.test.ts, which goes through every flow that updates the config, including configs that already have a zero address leaf and configs on an earlier recovery module, plus an on-chain test that queues payloads before and after a wallet moves to rc6. rc6 isn't deployed on Arbitrum yet, so the fork tests put the rc5 code at the rc6 address; I also ran them against the real rc6 bytecode deployed on a fork. I also ran the placeholder change end to end against the dev guard and the keymachine: logging out the only device and logging in from a new one both get co-signed, and the keymachine serves the placeholder tree

@Agusx1211
Agusx1211 requested a review from a team October 26, 2026 12:11
@Agusx1211
Agusx1211 requested a review from a team as a code owner October 26, 2026 12:11
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

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-10-26T12:13:25.357857Z 28122e8 PR opened
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 28122e8f8a

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

@Agusx1211
Agusx1211 requested a review from taylanpince October 26, 2026 13:04
ScreamingHawk
ScreamingHawk previously approved these changes Oct 26, 2026

@ScreamingHawk ScreamingHawk 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.

LGTM! Left some comments, mostly confirming they're intentional.

The guards in the WDK are solid. address(0) signers can still be constructed directly via the SDK. Integrators at this level are responsible for their own configuration, forcing migration would break this responsibility model. Legacy trees also have to stay decodable so keeping validation in fromRecoveryLeaves is the right split.

One suggestion: Consider emitting a note via console.warn when an address(0) leaf is detected (fromGenericTree?) to alert primitive integrators without forcing anything.

Agusx1211 and others added 2 commits October 27, 2026 12:48
setRecoveryLeaves now runs the same tree check as assertConfiguration on the
tree it saves, so a caller that skips assertConfiguration still can't end up
with an unreadable tree or a zero address leaf

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

@ScreamingHawk ScreamingHawk 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.

LGTM!

@ScreamingHawk
ScreamingHawk merged commit 012973f into master Oct 27, 2026
10 checks passed
@ScreamingHawk
ScreamingHawk deleted the fix/no-blank-recovery-leaf branch October 27, 2026 22:07
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.

2 participants