fix(session): open a new channel when the authorizedSigner changes#632
Open
saneGuy wants to merge 1 commit into
Open
fix(session): open a new channel when the authorizedSigner changes#632saneGuy wants to merge 1 commit into
saneGuy wants to merge 1 commit into
Conversation
Legacy session auto-management cached channels by payee, currency, and escrow only, so a cached entry kept being reused after the account's authorizedSigner changed. The next credential was emitted as a voucher for the old channel — signed by the new signer — which the escrow rejects, instead of opening a new channel. Track the voucher authority on each cached channel entry and skip reuse when it no longer matches the resolved signer, falling through to the existing open path. Recovered channels record their on-chain authorizedSigner (normalizing the zero address to the payer, which is what the escrow verifies vouchers against in that case). Fixes wevm#471
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.
Fixes #471
Bug
In auto-managed legacy sessions,
session()reuses an existing channel after the client account'sauthorizedSignerchanges. The next credential is emitted as a voucher for the old channel — signed by the new signer, which the escrow rejects — instead of opening a new channel.Root cause
The legacy session client caches channels keyed by
payee:currency:escrowonly, andChannelEntrydoes not record the voucher authority the channel was opened with.autoManageCredentialtherefore has no way to notice that the resolved signer can no longer produce valid vouchers for the cached channel. (The TIP-1034 precompile client already guards this viacanSignDescriptorinplanCredential; this brings the legacy client to parity.)Fix
authorizedSigneron the legacyChannelEntry:createOpenPayloadrecords the authority it opens with, andtryRecoverChannelrecords the on-chain authority (normalizing the zero address to the payer, since that is what the escrow verifies vouchers against in that case).autoManageCredential, skip reuse of a cached or recovered entry whose authority no longer matches the resolved voucher signer, falling through to the existing open path.Tests
reuses the cached channel while the voucher signer is unchanged(guards the reuse path)opens a new channel instead of reusing when the authorizedSigner changes(fails before this change with the exact reported symptom: voucher for the old channel)tryRecoverChannelassertions for zero-address → payer normalization and for preserving a non-zero on-chainauthorizedSignercheck:typesandcheck:ciclean