Skip to content

EVM: Add settler function to set safeguards with a signature - #84

Merged
alavarello merged 12 commits into
mainfrom
settler/add-policy-by-signature
Aug 27, 2026
Merged

EVM: Add settler function to set safeguards with a signature#84
alavarello merged 12 commits into
mainfrom
settler/add-policy-by-signature

Conversation

@alavarello

@alavarello alavarello commented Aug 19, 2026

Copy link
Copy Markdown
Member

Lets anyone submit a safeguard on a user's behalf with that user's EIP-712 signature. Previously setSafeguard took the user from msg.sender, so users had to send the tx themselves.

function setSafeguardWithSignature(                                                                                                                                                           
    address user, bytes memory safeguard, uint256 nonce, uint256 deadline, bytes memory signature                                                                                             
) external                                                                                                                                                                                    

Decisions worth review

User-chosen nonces (isUserSafeguardNonceUsed[user][nonce]), not a sequential counter. A counter forces signatures to be consumed in issue order, so one unsubmitted signature blocks
every later one. Each signature stays single-use; the deadline bounds how long an unsubmitted one lives.

ERC-1271 is supported, so Safe and other smart accounts work. ECDSA is tried first, unlike OZ's isValidSignatureNow which branches on code.length — post-Pectra an
EIP-7702-delegated EOA has code, and OZ's ordering would reject its valid ECDSA signature.

Two things integrators need to know: clients must sign through Safe's own message flow (protocol-kit), not by signing our digest directly; and an empty signature is valid for accounts
that record approved messages on-chain, so it must not be treated as a skip.

via-IR is now required, not an optimization. Every way of adding ERC-1271 overflowed EIP-170 under the legacy pipeline (24,726–24,823 vs. the 24,576 limit — externalizing the check was
the worst of them). With viaIR: true, Settler is 23,248 with 1,328 bytes spare.

alavarello and others added 7 commits August 19, 2026 10:57
Adds setSafeguardWithSignature so a safeguard can be set on behalf of a
user by anyone holding the user's EIP-712 signature, instead of requiring
the user to be msg.sender. The signature is bound to a per-user nonce and
a deadline to prevent replays of stale authorizations.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@alavarello
alavarello requested a review from lgalende August 26, 2026 16:01
@alavarello
alavarello marked this pull request as ready for review August 26, 2026 16:01
@lgalende
lgalende requested a lite review from Copilot August 26, 2026 16:39

This comment was marked as resolved.

Comment thread packages/evm/contracts/Settler.sol Outdated
Comment thread packages/evm/contracts/Settler.sol Outdated
Comment thread packages/evm/test/Settler.test.ts
Comment thread packages/evm/contracts/Settler.sol Outdated
alavarello and others added 2 commits August 26, 2026 15:15
Co-authored-by: lgalende <63872655+lgalende@users.noreply.github.com>
@alavarello
alavarello requested a review from lgalende August 26, 2026 18:28
Comment thread packages/evm/contracts/Settler.sol Outdated
Comment thread packages/evm/contracts/safeguards/Safeguards.sol Outdated
Comment thread packages/evm/contracts/Settler.sol Outdated
@alavarello
alavarello merged commit 73e09d4 into main Aug 27, 2026
4 checks passed
@alavarello
alavarello deleted the settler/add-policy-by-signature branch August 27, 2026 19:40
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.

3 participants