Debugging EVM Signature Verification Issues
Debugging ERC-1271 Signature Issues on EVM

A field guide to diagnosing EVM cross-environment signature failures — told through one real case, written for engineers at any level. The junior reader gets a method to copy. The senior reader gets the reasoning to know when the method breaks.
The case
A partner reported this, with confidence:
"On Base Sepolia, our smart-account signature is accepted and the withdrawal succeeds. On ETH Sepolia, the identical flow reverts with
0x8baa579f. ETH Sepolia only supports plainecrecover— it doesn't accept smart-contract signatures like Base does. Please make ETH Sepolia work like Base."
By the end we had proven: the two chains are identical, the contracts are byte-for-byte the same, and the bug was a single wrong number in the reporter's own signing code. The scary revert was telling the truth the entire time — it just wasn't saying what everyone assumed.
This guide is how you get from that report to that conclusion, and — more importantly — the general technique underneath it that applies far beyond blockchains.
But before the debugging makes sense, you need to understand the world it happens in. So let's back up and tell the story of why any of this machinery exists.
Background: how we got to a world where a wallet checks its own signatures
The old world — one key, one signature, ecrecover
For most of Ethereum's life, an account was a keypair and nothing more. You had a private key; your address was derived from it; and "did the account owner authorize this?" was answered by a single piece of math called ecrecover.
The idea is elegant. When you sign a message, the signature is mathematically entangled with both your private key and the exact bytes of the message. Given the message and the signature, ecrecover runs the math backwards and returns the one address whose key could have produced it. A verifier just checks: does the recovered address equal who I expected? If yes, the signature is genuine. No database, no lookup — pure cryptography.
This is beautiful and it is also a cage. It assumes every account is exactly one private key. That means:
Lose the key, lose everything. No recovery, no reset, no "email us." Gone.
No shared control. You can't say "any 2 of these 3 people, together." One key, one signer, full stop.
No rules. You can't say "allow spends under $100 freely, but require a hardware key above that." The key can do everything or nothing.
People wanted wallets that behave like organizations — with recovery, co-signers, spending limits, session keys. None of that fits inside a single keypair.
The new world — the account becomes a program
The fix: make the account itself a smart contract. Instead of "an address = a key," an address becomes code — a little program that decides for itself what counts as authorization. Multisig, social recovery, spending policies: now they're just logic inside the wallet.
This unlocks everything the cage forbade — but it breaks the one beautiful thing we had. A smart-contract wallet has no private key of its own. So when some other contract needs to ask "did this wallet authorize this?", ecrecover is useless. There's no key to recover to. The old question has no answer.
The bridge — ERC-1271
ERC-1271 is the standard that fixes exactly this. It changes the question from math to a conversation:
Old way: verifier runs
ecrecover(message, sig)and checks the result itself. ERC-1271 way: verifier calls the wallet —wallet.isValidSignature(digest, sig)— and lets the wallet's own code answer. (From openzepplin)
The wallet returns one of two magic values:
0x1626ba7e→ "Yes, I authorize this."0xffffffff→ "No, I do not."
Why is this the whole ballgame? Because now each wallet defines "valid" however it wants. A multisig checks for 2-of-3 signatures. A social-recovery wallet checks its guardian rules. A session-key wallet checks the key hasn't expired. The verifier doesn't need to know any of that — it just asks, and honors the answer.
And here is the detail that will become the murder weapon later:
There is no universal definition of a valid signature anymore. Each vendor — Safe, Biconomy, ZeroDev Kernel — invents its own signature envelope. The same raw bytes can be accepted by one wallet's code and rejected by another's. "Valid" is now a property of the wallet, not of the signature.
One more wrinkle: EIP-7702, the wallet that is also still a key
The reporter (and we) used a newer trick called EIP-7702. Normally a smart wallet is a separate contract at its own address, with no key. EIP-7702 does something cleverer: it lets a plain EOA (a normal keypair account) also gain contract code — so the single address is now both a key-holding EOA and a smart wallet answering isValidSignature. One address, two natures. This matters only because it's the exact setup in the bug — but the mental model above is unchanged: something checks a signature, the address has code, so the check routes through the wallet's isValidSignature.
The actual workflow — where the withdrawal fits
Now the concrete flow. A user wants to withdraw collateral. The on-chain contract ("Coordinator") won't just release funds — it demands proof that the right people signed off. The withdrawal call carries two signatures:
The executor signature — produced by backend API. Proves Server (Admin) approved this withdrawal (amount, recipient, expiry).
The admin signature — produced by the collateral admin's wallet (the customer). Proves the account owner authorized it.
The contract verifies both. And it verifies the admin signature the smart way: it doesn't assume a key exists — it uses a helper (SignatureChecker) that says "if this admin address has code, ask it via ERC-1271; otherwise fall back to ecrecover." Because the reporter's admin wallet has code (via EIP-7702), the admin-signature check routes into isValidSignature on their wallet.
So the happy path is:
API ──(executor sig)──┐
├──► Coordinator.withdrawAsset(...) ──► checks BOTH sigs
Admin wallet ─(admin sig)───┘ │
├─ executor sig OK?
└─ admin sig OK? ──► asks the
admin wallet's
isValidSignature
→ 0x1626ba7e ✅ → funds released
What was breaking: on ETH Sepolia, that last step returned 0xffffffff instead of 0x1626ba7e — the admin wallet refused its own admin signature — and the contract, seeing an unauthorized withdrawal, reverted with 0x8baa579f. Everything upstream looked fine. The whole mystery is: why does the wallet reject a signature it should have produced correctly — but only on one chain?
That's the world. Now the investigation.
Principle 1 — A bug report is evidence and a hypothesis, fused. Separate them before you spend a minute.
Every report arrives as two things wearing one coat:
The observation:
0x8baa579fon ETH Sepolia, success on Base. This is data. Trust it.The interpretation: "ETH Sepolia runs different, ecrecover-only contract logic." This is a hypothesis. It happens to be wrong.
They arrive glued together and the interpretation is always the more confident-sounding half. The single most common way experienced engineers lose a day is by inheriting the reporter's hypothesis as if it were the observation — then debugging the wrong subsystem competently for hours.
For the junior: literally write two columns — "what was observed" / "what someone thinks it means." Only the left column is allowed to constrain your search.
For the senior: the interpretation isn't worthless — it's a prior. Weight it by the reporter's proximity to the evidence. "It reverts with 0x8baa579f" (they saw it) is strong. "Because ETH Sepolia is ecrecover-only" (they inferred it) is weak, and it's weak in a specific, checkable way — so make it the first thing you falsify, not the frame you accept.
Principle 2 — Learn the domain's error vocabulary before you touch the code.
You cannot debug what you can't read. Three values carry this entire case:
| Value | Meaning |
|---|---|
0x8baa579f |
InvalidSignature — the revert. "I reject this signature." |
0x1626ba7e |
ERC-1271 magic value — a contract saying "this signature is valid for me." |
0xffffffff |
ERC-1271's rejection — "this signature is not valid for me." |
The background section already gave us the crux — signatures are checked by asking the wallet (isValidSignature), and each wallet defines "valid" in its own code. Keep that front of mind, because it's the eventual murder weapon:
"Valid" is defined by the wallet's own code, not by any universal rule. The same bytes are accepted by one wallet and rejected by another.
Ten minutes learning this vocabulary is what converts 0x8baa579f from a scary omen into a specific, addressable claim: the admin wallet returned 0xffffffff where the contract needed 0x1626ba7e.
Principle 3 — Build a diagnostic ladder: ordered checks where the first failure is the root cause.
When a bug could live in five places, don't guess which. Enumerate the checks in order, cheapest and most-upstream first, so that the first rung that fails is the answer and you never climb past it. For "a smart-wallet signature was rejected," the ladder is:
Is the wallet a smart wallet on this chain at all? Smart-wallet powers (here via EIP-7702) are granted per chain.
eth_getCode(wallet)— if it's empty (0x) on ETH Sepolia, the wallet is just a plain address there and cannot do ERC-1271. (This alone explained the reporter's first wallet: code on Base, nothing on ETH Sepolia.)Is it the correct implementation, correctly configured? The code should point at the expected delegate; the wallet should report a sane domain when asked.
Does the wallet accept the signature? Call
wallet.isValidSignature(digest, sig)directly.0x1626ba7e→ signature is fine; the bug is downstream (who sent the tx? funding? a different signature?).0xffffffff→ the wallet rejects it. Signing-side bug. Stop. This is the floor.
If invalid — what did the signer actually sign? (Forensics, Principle 4.)
Control test: reproduce the whole thing with a key you control (Principle 5).
For the junior: the value of the ladder is that it makes "I don't know where to look" impossible. You always look at rung 1 next.
For the senior: the discipline the ladder enforces is not skipping rungs because you have a hunch. Your hunch might be right — but a skipped cheap check is how you end up three layers deep debugging a symptom of something a getCode call would have caught in one second. Order the rungs by cost ÷ information-gained, and respect the order even when you're sure.
Rung 3 is the highest-leverage check in the entire case. One call, against the wallet in isolation, cleanly partitions the universe into "signing problem" vs. "everything else." Before tracing a 10-argument transaction through a contract, ask the smallest question that halves the search space.
Applying the ladder
We ran rung 3 against the reporter's ETH Sepolia wallet:
wallet.isValidSignature(theirDigest, theirSignature) → 0xffffffff
The wallet rejected its own signature.
Notice what this instantly does to the reporter's hypothesis. Their theory was "the contract on ETH Sepolia is wrong." But we never reached the contract — the reporter's own wallet refused the signature before any withdrawal logic could run. The defect is upstream of everything they were pointing at. Rung 3 failed, so by the rules we stop climbing and dig in here.
Principle 4 — When a signature is rejected, make it confess what it actually signed.
A signature is a fingerprint of exactly one message. You can't read the message off it — but you can play a guessing game where certainty is on your side: guess a message, run recovery, and ask "if this sig signed that, whose key made it?" If the recovered address is the wallet's owner, your guess was right. Forgery without the key is infeasible, so a match is not a coincidence — it's a confession.
The Kernel wallet doesn't sign the plain withdrawal digest; it wraps it first — re-hashing it with context including the chainId — specifically to stop a signature from being replayed on another chain. So we recovered the signer while varying exactly one input: the chainId inside the wrap.
| Their signature | Chain it was used on | chainId in the wrap that recovers their wallet |
|---|---|---|
| Base signature | Base (84532) |
84532 ✅ correct |
| ETH Sepolia signature | ETH Sepolia (11155111) |
84532 ❌ that's Base's number |
Confession obtained. Their ETH Sepolia signature was wrapped with Base's chainId. Their signer defaulted to 84532 regardless of the target chain. On Base that's accidentally correct — so it "worked." On ETH Sepolia the wallet correctly rejects a wrong-chain wrap, which surfaces many layers later as 0x8baa579f.
For the junior: the technique — hold everything constant, vary one input, watch what changes — is the entire scientific method compressed into a loop. It works on signatures, config diffs, env vars, feature flags, anything.
For the senior: the subtlety is choosing the right single variable to sweep. We swept chainId because the vocabulary (Principle 2) told us the wrap was chain-bound and chains were the reported axis of difference. A blind sweep of every field would also have found it, slower. Domain knowledge is what turns an O(n) search into an O(1) hypothesis — that's the actual return on Principle 2.
Principle 5 — Don't finish on a claim. Finish on a reproduction you control.
A diagnosis you can't reproduce is a guess in a lab coat. So we ran rung 5: took a key we controlled, gave it the exact setup the reporter used (same Kernel implementation, via EIP-7702, on both chains), wrapped the signature correctly — each chain with its own chainId — and ran the full withdrawal end to end.
It settled on both chains. Real, confirmed transactions on Base and ETH Sepolia.
One result closed three questions at once:
Parity is proven. ETH Sepolia validates smart-wallet signatures exactly like Base — the core hypothesis is disproven by demonstration, not argument.
A correct signature works, so the reporter's failure was never the contract's fault.
The only remaining difference between our success and their failure was their signing code. Root cause by elimination — with receipts.
The fix was entirely on their side — bind the chainId in the wrap to the chain you're withdrawing on — with a 30-second self-verification so they never had to trust us on faith:
After the fix,
wallet.isValidSignature(digest, newSig)on ETH Sepolia must return0x1626ba7e. It returns0xfffffffftoday. When it flips green, you're done.
For the junior: "I think it's X" is an opinion; "here is X happening, and here is it stopping when I change X" is proof. Build the smallest thing that makes the bug appear and vanish on command.
For the senior: the control test is also how you protect the relationship. Telling a partner "your code is wrong, not ours" is a fight. Handing them a reproduction of their bug plus a one-line self-check they can run themselves turns an accusation into an artifact. Diagnoses that ship without a reproduction get re-litigated; diagnoses that ship with one get fixed.
The reusable playbook
Strip out the crypto and this is a general procedure for any "works in environment A, fails in B" defect:
Split observation from hypothesis. Two columns. Falsify the reporter's hypothesis first — never inherit it as the frame.
Learn the error vocabulary before the code. An opaque error code becomes a precise claim once you can read it, and that reading is what lets you pick the right variable to test later.
Build an ordered ladder. Cheapest, most-upstream checks first; the first failure is the root cause; don't skip rungs on a hunch.
Find the one call that halves the problem. Isolate the smallest question — here,
isValidSignaturealone — before tracing anything large.Sweep one variable at a time, and use domain knowledge to pick which variable, so it's a targeted test rather than a blind scan.
Finish on a controlled reproduction that makes the bug appear and disappear. Ship the repro and a self-check, not just a conclusion.
The lesson that outranks the rest
"Works on A but not B" almost never means "B is broken." It usually means B is stricter, and A was quietly tolerating a latent bug. The Base success was never evidence of correctness — it was the coincidence that hid the defect. When something works in only one place, your first suspicion should be that the working environment is the lucky one, and the failing one is simply the honest one.
The skill on display here isn't being clever enough to guess the answer. It's being disciplined enough to not believe the hypothesis — including your own — until the evidence forces you to. Start at the bottom of the ladder, ask the smallest question, make the signature confess, and prove it with your own two hands.
About the author
- AI Native FullStack Builder WEB3 Specialist On-Chain Payments AI Native FullStack
Comments
Join the discussionNo comments yet. Be the first to comment.





