Skip to content

fix(client): skip ecrecover for non-ECDSA contract-wallet signatures - #219

Open
rome-xi wants to merge 1 commit into
spruceid:mainfrom
rome-xi:contrib/siwe-216
Open

fix(client): skip ecrecover for non-ECDSA contract-wallet signatures#219
rome-xi wants to merge 1 commit into
spruceid:mainfrom
rome-xi:contrib/siwe-216

Conversation

@rome-xi

@rome-xi rome-xi commented Aug 17, 2026

Copy link
Copy Markdown

Summary

verify() always ran ethers verifyMessage before the EIP-1271 fallback.

Multisig and other contract-wallet signatures are longer than a 65-byte ECDSA signature,
so ethers throws invalid raw signature length (and the catch logs it) even though
checkContractWalletSignature then succeeds.

Skip ecrecover when the signature is not 65 bytes (r||s||v) or 64 bytes (EIP-2098 compact)
and go straight to EIP-1271.

Test plan

  • Hermetic unit test with a mocked contract-wallet signature (>65 bytes)
  • 66-byte (Loopring-style) signatures take the same path
  • 65-byte EOA signatures still go through ecrecover
  • 64-byte compact signatures still go through ecrecover

Fixes #216

Signed-off-by: rome-xi <rome-xi@users.noreply.github.com>
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.

SIWE Doesn't properly handle Multisig Wallet Signatures

1 participant