Skip to content

Commit

Permalink
Merge pull request #15 from Certora/liav/more-reverting-conditions
Browse files Browse the repository at this point in the history
Liav/more reverting conditions
  • Loading branch information
liav-certora authored Jun 10, 2024
2 parents 021d60d + dba6d97 commit 08594cc
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion certora/confs/SafeWebAuthnSignerFactory.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": [
"certora/harnesses/SafeWebAuthnSignerFactoryHarness.sol",
"modules/passkey/contracts/SafeWebAuthnSignerSingleton.sol",
"modules/passkey/contracts/SafeWebAuthnSignerProxy.sol"
"modules/passkey/contracts/SafeWebAuthnSignerProxy.sol",
],
"link": [
"SafeWebAuthnSignerFactoryHarness:SINGLETON=SafeWebAuthnSignerSingleton"
Expand Down
15 changes: 14 additions & 1 deletion certora/specs/SafeWebAuthnSignerFactory.spec
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,17 @@ rule isValidSignatureForSignerConsistency()

assert firstRevert == secondRevert;
assert (!firstRevert && !secondRevert) => (magic1 == MAGIC_VALUE()) <=> (magic2 == MAGIC_VALUE());
}
}

rule getSignerRevertingConditions {
env e;
uint256 x;
uint256 y;
P256.Verifiers verifiers;

bool triedTransferringEth = e.msg.value != 0;

getSigner@withrevert(e, x, y, verifiers);

assert lastReverted <=> triedTransferringEth;
}
15 changes: 15 additions & 0 deletions certora/specs/SafeWebAuthnSignerSingleton.spec
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,18 @@ rule verifyIsValidSignatureWillContinueToSucceed(){
assert (!firstReverted && !secondRevert) => (firstVerified == secondVerify);
satisfy true;
}

rule isValidSignatureRevertingConditions {
env e;
bytes32 message;

WebAuthn.Signature sigStruct;
bytes signature = WebAuthnHarness.encodeSignature(e, sigStruct);

bool triedTransferringEth = e.msg.value != 0;
bool dataLengthInsufficient = sigStruct.authenticatorData.length <= 32;

isValidSignature@withrevert(e, message, signature);

assert lastReverted <=> (triedTransferringEth || dataLengthInsufficient);
}

0 comments on commit 08594cc

Please sign in to comment.