filter functions that should revert

This commit is contained in:
Hadrien Croubois
2023-03-14 15:51:22 +01:00
parent 728e2c8899
commit 397f4cdfe2

View File

@ -108,9 +108,11 @@ rule noExecuteBeforeDeadline(uint256 pId, env e, method f, calldataarg args) {
attribute to the execute() function, showing that only execute() can change it, and that it will always change it. attribute to the execute() function, showing that only execute() can change it, and that it will always change it.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/ */
rule allFunctionsRevertIfExecuted(uint256 pId, env e, method f, calldataarg args) rule allFunctionsRevertIfExecuted(uint256 pId, env e, method f, calldataarg args) filtered { f ->
filtered { f -> !skip(f) } !skip(f) &&
{ f.selector != updateQuorumNumerator(uint256).selector &&
f.selector != updateTimelock(address).selector
} {
require isExecuted(pId); require isExecuted(pId);
requireInvariant noBothExecutedAndCanceled(pId); requireInvariant noBothExecutedAndCanceled(pId);
requireInvariant executedImplyCreated(pId); requireInvariant executedImplyCreated(pId);
@ -129,9 +131,11 @@ rule allFunctionsRevertIfExecuted(uint256 pId, env e, method f, calldataarg args
attribute to the execute() function, showing that only execute() can change it, and that it will always change it. attribute to the execute() function, showing that only execute() can change it, and that it will always change it.
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
*/ */
rule allFunctionsRevertIfCanceled(uint256 pId, env e, method f, calldataarg args) rule allFunctionsRevertIfCanceled(uint256 pId, env e, method f, calldataarg args) filtered { f ->
filtered { f -> !skip(f) } !skip(f) &&
{ f.selector != updateQuorumNumerator(uint256).selector &&
f.selector != updateTimelock(address).selector
} {
require isCanceled(pId); require isCanceled(pId);
requireInvariant noBothExecutedAndCanceled(pId); requireInvariant noBothExecutedAndCanceled(pId);
requireInvariant canceledImplyCreated(pId); requireInvariant canceledImplyCreated(pId);