Skip to content

Commit

Permalink
Specs
Browse files Browse the repository at this point in the history
  • Loading branch information
shellygr committed Jan 16, 2025
1 parent b3bae63 commit 4641192
Show file tree
Hide file tree
Showing 20 changed files with 1,832 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ artifacts
.DS_Store
/contracts/dist/
/contracts/types/
.certora_internal
28 changes: 28 additions & 0 deletions certora/conf/EntryPoint.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"files": [
"contracts/core/EntryPoint.sol"
],
"hashing_length_bound": "96",
"loop_iter": "4",
"optimistic_fallback": true,
"optimistic_hashing": true,
"optimistic_loop": true,
"packages": [
"@openzeppelin=node_modules/@openzeppelin",
"@uniswap=node_modules/@uniswap"
],
"process": "emv",
"prover_args": [
"-canonicalizeTAC false",
"-assumeFPStrictlyMonotonic false",
"-enableSolidityBasedInlining true",
"-adaptiveSolverConfig false",
"-destructiveOptimizations enable",
"-enableFlowSensitivePartitioning true",
"-enableABIAnalysis true",
"-optimisticBufferContents true",
"-enableAggressiveABIOptimization true"
],
"smt_timeout": "1800",
"verify": "EntryPoint:certora/specs/entryPoint.spec",
}
28 changes: 28 additions & 0 deletions certora/conf/EntryPoint_sanity.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"files": [
"contracts/core/EntryPoint.sol"
],
"hashing_length_bound": "96",
"loop_iter": "4",
"optimistic_fallback": true,
"optimistic_hashing": true,
"optimistic_loop": true,
"packages": [
"@openzeppelin=node_modules/@openzeppelin",
"@uniswap=node_modules/@uniswap"
],
"process": "emv",
"prover_args": [
"-canonicalizeTAC false",
"-assumeFPStrictlyMonotonic false",
"-enableSolidityBasedInlining true",
"-adaptiveSolverConfig false",
"-destructiveOptimizations enable",
"-enableFlowSensitivePartitioning true",
"-enableABIAnalysis true",
"-optimisticBufferContents true",
"-enableAggressiveABIOptimization true"
],
"smt_timeout": "1800",
"verify": "EntryPoint:certora/specs/entryPointSanity.spec",
}
28 changes: 28 additions & 0 deletions certora/conf/alwaysRevert.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"files": [
"contracts/core/EntryPoint.sol"
],
"hashing_length_bound": "96",
"loop_iter": "3",
"optimistic_fallback": true,
"optimistic_hashing": true,
"optimistic_loop": true,
"packages": [
"@openzeppelin=node_modules/@openzeppelin",
"@uniswap=node_modules/@uniswap"
],
"process": "emv",
"prover_args": [
"-canonicalizeTAC false",
"-assumeFPStrictlyMonotonic false",
"-enableSolidityBasedInlining true",
"-adaptiveSolverConfig false",
"-destructiveOptimizations enable",
"-enableFlowSensitivePartitioning true",
"-enableABIAnalysis true",
"-optimisticBufferContents true",
"-enableAggressiveABIOptimization true"
],
"smt_timeout": "1800",
"verify": "EntryPoint:certora/specs/alwaysRevert.spec",
}
24 changes: 24 additions & 0 deletions certora/conf/nonHandleOps.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"files": [
"contracts/core/EntryPoint.sol"
],
"hashing_length_bound": "96",
"loop_iter": "3",
"optimistic_fallback": true,
"optimistic_hashing": true,
"optimistic_loop": true,
"packages": [
"@openzeppelin=node_modules/@openzeppelin",
"@uniswap=node_modules/@uniswap"
],
"process": "emv",
"prover_args": [
"-canonicalizeTAC false",
"-assumeFPStrictlyMonotonic false",
"-enableSolidityBasedInlining true",
"-destructiveOptimizations enable"
],
"rule_sanity": "basic",
"smt_timeout": "1800",
"verify": "EntryPoint:certora/specs/entryPoint.spec",
}
25 changes: 25 additions & 0 deletions certora/conf/residual.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"files": [
"contracts/core/EntryPoint.sol"
],
"hashing_length_bound": "96",
"independent_satisfy": true,
"loop_iter": "3",
"optimistic_fallback": true,
"optimistic_hashing": true,
"optimistic_loop": true,
"packages": [
"@openzeppelin=node_modules/@openzeppelin",
"@uniswap=node_modules/@uniswap"
],
"process": "emv",
"prover_args": [
"-canonicalizeTAC false",
"-assumeFPStrictlyMonotonic false",
"-enableSolidityBasedInlining true"
],
"rule_sanity": "basic",
"rule": ["checkInnerHandleOp"],
"smt_timeout": "1800",
"verify": "EntryPoint:certora/specs/residual.spec",
}
40 changes: 40 additions & 0 deletions certora/patch/prover_optimization.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/contracts/core/EntryPoint.sol b/contracts/core/EntryPoint.sol
index 058d8eb..8953da2 100644
--- a/contracts/core/EntryPoint.sol
+++ b/contracts/core/EntryPoint.sol
@@ -108,7 +108,7 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuardT
assembly ("memory-safe") {
success := call(gas(), address(), 0, add(innerCall, 0x20), mload(innerCall), 0, 32)
collected := mload(0)
- mstore(0x40, saveFreePtr)
+ // mstore(0x40, saveFreePtr) // make analysis succeed, no-op
}
}
if (!success) {
@@ -299,7 +299,7 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuardT
MemoryUserOp mUserOp;
bytes32 userOpHash;
uint256 prefund;
- uint256 contextOffset;
+ bytes contextOffset; // make analysis succeed, no-op
uint256 preOpGas;
}

@@ -780,7 +780,7 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuardT
*/
function getOffsetOfMemoryBytes(
bytes memory data
- ) internal pure returns (uint256 offset) {
+ ) internal pure returns (bytes memory offset /* make analysis succeed, no-op */) {
assembly {
offset := data
}
@@ -791,7 +791,7 @@ contract EntryPoint is IEntryPoint, StakeManager, NonceManager, ReentrancyGuardT
* @param offset - The offset to get the bytes from.
*/
function getMemoryBytesFromOffset(
- uint256 offset
+ bytes memory offset // make analysis succeed, no-op
) internal pure returns (bytes memory data) {
assembly ("memory-safe") {
data := offset
Loading

0 comments on commit 4641192

Please sign in to comment.