Skip to content

Commit

Permalink
Merge pull request #1 from Certora/niv/Orgenazie-Files
Browse files Browse the repository at this point in the history
Organize project setup files
  • Loading branch information
nivcertora authored May 15, 2024
2 parents aca3afc + 9488e45 commit 9545b45
Show file tree
Hide file tree
Showing 20 changed files with 173 additions and 15 deletions.
34 changes: 34 additions & 0 deletions certora/confs/SafeWebAuthnSignerProxy.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"assert_autofinder_success": true,
"files": [
"modules/passkey/contracts/SafeWebAuthnSignerProxy.sol",
"modules/passkey/contracts/SafeWebAuthnSignerSingleton.sol",
"certora/harnesses/ERC20Like/DummyWeth.sol",
"certora/harnesses/Utilities.sol",
"modules/passkey/contracts/libraries/P256.sol"
],
"link": [
"SafeWebAuthnSignerProxy:_VERIFIERS=P256",
"SafeWebAuthnSignerProxy:_SINGLETON=SafeWebAuthnSignerSingleton"
],
"java_args": [
" -ea -Dlevel.setup.helpers=info"
],
"msg": "sanity_with_all_default_summaries",
"process": "emv",
"prover_args": [
" -verifyCache -verifyTACDumps -testMode -checkRuleDigest -callTraceHardFail on"
],
"packages":[
"@safe-global=node_modules/@safe-global",
"@account-abstraction=node_modules/@account-abstraction"
],
"solc": "solc8.23",
"solc_via_ir": false,
"optimistic_loop": true,
"loop_iter": "6",
"optimistic_hashing": true,
"prover_version": "master",
"server": "production",
"verify": "SafeWebAuthnSignerProxy:certora/specs/SafeWebAuthnSignerProxy.spec"
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
{
"assert_autofinder_success": true,
"files": [
"modules/passkey/contracts/SafeWebAuthnSigner.sol",
"modules/passkey/contracts/SafeWebAuthnSignerSingleton.sol",
"certora/harnesses/ERC20Like/DummyWeth.sol",
"certora/harnesses/Utilities.sol",
"modules/passkey/contracts/libraries/P256.sol"
],
"link": [
"SafeWebAuthnSigner:VERIFIERS=P256"
],
"java_args": [
" -ea -Dlevel.setup.helpers=info"
Expand All @@ -24,9 +20,8 @@
"solc": "solc8.23",
"solc_via_ir": false,
"optimistic_loop": true,
"loop_iter": "6",
"optimistic_hashing": true,
"prover_version": "master",
"server": "production",
"verify": "SafeWebAuthnSigner:certora/specs/SafeWebAuthnSigner.spec"
"verify": "SafeWebAuthnSignerSingleton:certora/specs/SafeWebAuthnSignerSingleton.spec"
}
27 changes: 27 additions & 0 deletions certora/confs/WebAuthn.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"assert_autofinder_success": true,
"files": [
"certora/harnesses/WebAuthnHarness.sol",
"certora/harnesses/ERC20Like/DummyWeth.sol",
"certora/harnesses/Utilities.sol",
],
"java_args": [
" -ea -Dlevel.setup.helpers=info"
],
"msg": "sanity_with_all_default_summaries",
"process": "emv",
"prover_args": [
" -verifyCache -verifyTACDumps -testMode -checkRuleDigest -callTraceHardFail on"
],
"packages":[
"@safe-global=node_modules/@safe-global",
"@account-abstraction=node_modules/@account-abstraction"
],
"solc": "solc8.23",
"solc_via_ir": false,
"optimistic_loop": true,
"optimistic_hashing": true,
"prover_version": "master",
"server": "production",
"verify": "WebAuthnHarness:certora/specs/WebAuthn.spec"
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
56 changes: 56 additions & 0 deletions certora/harnesses/WebAuthnHarness.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.0;

import {P256, WebAuthn} from "../../modules/passkey/contracts/libraries/WebAuthn.sol";

contract WebAuthnHarness {

function castSignature(bytes calldata signature) internal pure returns (bool isValid, WebAuthn.Signature calldata data){
return WebAuthn.castSignature(signature);
}

function encodeClientDataJson(
bytes32 challenge,
string calldata clientDataFields
) public pure returns (string memory clientDataJson){
return WebAuthn.encodeClientDataJson(challenge, clientDataFields);
}

function encodeSigningMessage(
bytes32 challenge,
bytes calldata authenticatorData,
string calldata clientDataFields
) public view returns (bytes memory message) {
return WebAuthn.encodeSigningMessage(challenge, authenticatorData, clientDataFields);
}

function checkAuthenticatorFlags(
bytes calldata authenticatorData,
WebAuthn.AuthenticatorFlags authenticatorFlags
) public pure returns (bool success){
return WebAuthn.checkAuthenticatorFlags(authenticatorData, authenticatorFlags);
}

function verifySignature(
bytes32 challenge,
bytes calldata signature,
WebAuthn.AuthenticatorFlags authenticatorFlags,
uint256 x,
uint256 y,
P256.Verifiers verifiers
) public view returns (bool success) {
return WebAuthn.verifySignature(challenge, signature, authenticatorFlags, x, y, verifiers);
}

function verifySignature(
bytes32 challenge,
WebAuthn.Signature calldata signature,
WebAuthn.AuthenticatorFlags authenticatorFlags,
uint256 x,
uint256 y,
P256.Verifiers verifiers
) public view returns (bool success) {
return WebAuthn.verifySignature(challenge, signature, authenticatorFlags, x, y, verifiers);
}

}
8 changes: 4 additions & 4 deletions certora/specs/SafeWebAuthnSignerFactory.spec
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import "ERC1967/erc1967.spec";
import "PriceAggregators/chainlink.spec";
import "PriceAggregators/tellor.spec";

import "problems.spec";
import "unresolved.spec";
import "optimizations.spec";
import "spec_utils/problems.spec";
import "spec_utils/unresolved.spec";
import "spec_utils/optimizations.spec";

import "generic.spec"; // pick additional rules from here
import "spec_utils/generic.spec"; // pick additional rules from here

use builtin rule sanity filtered { f -> f.contract == currentContract }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import "ERC1967/erc1967.spec";
import "PriceAggregators/chainlink.spec";
import "PriceAggregators/tellor.spec";

import "problems.spec";
import "unresolved.spec";
import "optimizations.spec";
import "spec_utils/problems.spec";
import "spec_utils/unresolved.spec";
import "spec_utils/optimizations.spec";

import "generic.spec"; // pick additional rules from here
import "spec_utils/generic.spec"; // pick additional rules from here

use builtin rule sanity filtered { f -> f.contract == currentContract }

Expand Down
23 changes: 23 additions & 0 deletions certora/specs/SafeWebAuthnSignerSingleton.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import "ERC20/erc20cvl.spec";
import "ERC20/WETHcvl.spec";
import "ERC721/erc721.spec";
import "ERC1967/erc1967.spec";
import "PriceAggregators/chainlink.spec";
import "PriceAggregators/tellor.spec";

import "spec_utils/problems.spec";
import "spec_utils/unresolved.spec";
import "spec_utils/optimizations.spec";

import "spec_utils/generic.spec"; // pick additional rules from here

use builtin rule sanity filtered { f -> f.contract == currentContract }

use builtin rule hasDelegateCalls filtered { f -> f.contract == currentContract }
use builtin rule msgValueInLoopRule;
use builtin rule viewReentrancy;
use rule privilegedOperation filtered { f -> f.contract == currentContract }
use rule timeoutChecker filtered { f -> f.contract == currentContract }
use rule simpleFrontRunning filtered { f -> f.contract == currentContract }
use rule noRevert filtered { f -> f.contract == currentContract }
use rule alwaysRevert filtered { f -> f.contract == currentContract }
23 changes: 23 additions & 0 deletions certora/specs/WebAuthn.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import "ERC20/erc20cvl.spec";
import "ERC20/WETHcvl.spec";
import "ERC721/erc721.spec";
import "ERC1967/erc1967.spec";
import "PriceAggregators/chainlink.spec";
import "PriceAggregators/tellor.spec";

import "spec_utils/problems.spec";
import "spec_utils/unresolved.spec";
import "spec_utils/optimizations.spec";

import "spec_utils/generic.spec"; // pick additional rules from here

use builtin rule sanity filtered { f -> f.contract == currentContract }

use builtin rule hasDelegateCalls filtered { f -> f.contract == currentContract }
use builtin rule msgValueInLoopRule;
use builtin rule viewReentrancy;
use rule privilegedOperation filtered { f -> f.contract == currentContract }
use rule timeoutChecker filtered { f -> f.contract == currentContract }
use rule simpleFrontRunning filtered { f -> f.contract == currentContract }
use rule noRevert filtered { f -> f.contract == currentContract }
use rule alwaysRevert filtered { f -> f.contract == currentContract }
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 9545b45

Please sign in to comment.