fix(protocol-kit): handle CONTRACT_SIGNATURE in toSafeTransactionType - #1301
Open
indexedfit wants to merge 1 commit into
Open
fix(protocol-kit): handle CONTRACT_SIGNATURE in toSafeTransactionType#1301indexedfit wants to merge 1 commit into
indexedfit wants to merge 1 commit into
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
indexedfit
force-pushed
the
fix/contract-signature-toSafeTransactionType
branch
from
February 14, 2026 11:24
d754891 to
d7a40be
Compare
`toSafeTransactionType` creates `EthSafeSignature` with
`isContractSignature=false` for all confirmations, including
CONTRACT_SIGNATURE types from the Safe Transaction Service.
This causes `buildSignatureBytes` to concatenate the full stored
signature blob (r+s+v+dynamic data) as-is instead of properly
splitting it into static part (r, s=offset, v=0) and dynamic part
(length + inner data). For multi-owner Safes, this breaks the
combined signatures layout — the second signer's 65-byte constant
part overlaps with the first signer's dynamic data, causing
GS021 ("Invalid contract signature provided") on execution.
The fix detects CONTRACT_SIGNATURE confirmations and:
1. Extracts the inner signature data from the stored format
using the s offset (which points to the length-prefixed data)
2. Creates EthSafeSignature with isContractSignature=true
3. This lets buildSignatureBytes properly compute dynamic offsets
Affects any Safe with EIP-1271 contract signature owners (passkey
signers via SafeWebAuthnSignerProxy, nested Safes, etc.) when
executing transactions that include contract signature confirmations
fetched from the Safe Transaction Service.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
indexedfit
force-pushed
the
fix/contract-signature-toSafeTransactionType
branch
from
February 14, 2026 11:25
d7a40be to
77fdb61
Compare
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.
Summary
toSafeTransactionTypeinSafe.tsto correctly handleCONTRACT_SIGNATUREconfirmations from the Safe Transaction ServicesignatureType === 'CONTRACT_SIGNATURE', extract the inner signature data from the stored format and createEthSafeSignaturewithisContractSignature=truebuildSignatureBytestreats contract signatures as EOA signatures and dumps the full stored blob (header + data) as a flat 65-byte signature, which corrupts the combined signature layout and causesGS021errors during on-chain executionCloses #1300
Problem
The Safe Transaction Service stores contract signatures in a specific format:
When
toSafeTransactionTypereconstructs aSafeTransactionfrom TX Service confirmations, it createsEthSafeSignature(owner, signature)for ALL confirmation types — includingCONTRACT_SIGNATURE. SinceisContractSignaturedefaults tofalse,buildSignatureByteslater treats these as EOA signatures and emits the entire stored blob as flat data in the constant part, instead of splitting it into a constant part (with a dynamic offset) and a dynamic part.This breaks
checkNSignatureson-chain when there are multiple signers, because the second signer's 65-byte chunk overlaps with the first signer's oversized blob.Fix
For
CONTRACT_SIGNATUREconfirmations:svalue (bytes 32–63) from the stored signature to find the offset to the length-prefixed inner dataEthSafeSignature(owner, innerData, true)sobuildSignatureBytescorrectly handles the static/dynamic splitTest plan
🤖 Generated with Claude Code