-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relayer: Implement prover rules (#105)
- Loading branch information
Showing
8 changed files
with
524 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Prover Relayer | ||
|
||
env: | ||
CI: true | ||
|
||
on: | ||
pull_request: | ||
branches: "*" | ||
paths: | ||
- packages/relayer/** | ||
|
||
jobs: | ||
prove: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Prove | ||
uses: ./.github/actions/certora | ||
with: | ||
workspace: '@mimic-fi/v3-relayer' | ||
certora-key: ${{ secrets.CERTORA_KEY }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"files": [ | ||
"certora/harnesses/RelayerHarness.sol", | ||
"certora/helpers/Helpers.sol", | ||
"certora/helpers/Depositor.sol" | ||
], | ||
"verify": "RelayerHarness:certora/specs/Relayer.spec", | ||
"loop_iter": "3", | ||
"rule_sanity": "basic", | ||
"send_only": true, | ||
"optimistic_hashing": true, | ||
"prover_args": [ | ||
"-copyLoopUnroll 8", | ||
"-optimisticFallback true" | ||
], | ||
"optimistic_loop": true, | ||
"packages": [ | ||
"@mimic-fi/v3-authorizer=../../node_modules/@mimic-fi/v3-authorizer", | ||
"@mimic-fi/v3-smart-vault=../../node_modules/@mimic-fi/v3-smart-vault", | ||
"@mimic-fi/v3-tasks=../../node_modules/@mimic-fi/v3-tasks", | ||
"@openzeppelin=../../node_modules/@openzeppelin" | ||
], | ||
"solc_allow_path": ".", | ||
"process": "emv", | ||
"msg": "RelayerHarness" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.17; | ||
|
||
import '../../contracts/Relayer.sol'; | ||
|
||
contract RelayerHarness is Relayer { | ||
constructor(address executor, address collector, address owner) Relayer(executor, collector, owner) { | ||
// solhint-disable-previous-line no-empty-blocks | ||
} | ||
|
||
function payTransactionGasToRelayer(address smartVault, uint256 amount) external { | ||
_payTransactionGasToRelayer(smartVault, amount); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
contract Depositor { | ||
fallback() external payable { | ||
// solhint-disable-previous-line no-empty-blocks | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import '@mimic-fi/v3-smart-vault/contracts/interfaces/ISmartVault.sol'; | ||
import '@mimic-fi/v3-tasks/contracts/interfaces/ITask.sol'; | ||
|
||
contract Helpers { | ||
function balanceOf(address account) external view returns (uint256) { | ||
return address(account).balance; | ||
} | ||
|
||
function areValidTasks(address[] memory tasks) external view returns (bool) { | ||
if (tasks.length == 0) return false; | ||
|
||
address smartVault = ITask(tasks[0]).smartVault(); | ||
|
||
for (uint256 i = 0; i < tasks.length; i++) { | ||
address taskSmartVault = ITask(tasks[i]).smartVault(); | ||
if (taskSmartVault != smartVault) return false; | ||
|
||
bool hasPermissions = ISmartVault(smartVault).hasPermissions(tasks[i]); | ||
if (!hasPermissions) return false; | ||
} | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
rule sanity(method f) good_description "Sanity" { | ||
env e; | ||
calldataarg args; | ||
f(e, args); | ||
assert false; | ||
} |
Oops, something went wrong.