Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass state accesses / simPayload to _postCheck #103

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion script/deploy/l1/SetGasLimitBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ abstract contract SetGasLimitBuilder is MultisigBuilder {
* Implemented Functions
* -----------------------------------------------------------
*/
function _postCheck() internal view override {
function _postCheck(Vm.AccountAccess[] memory, Simulation.Payload memory) internal view override {
assert(SystemConfig(L1_SYSTEM_CONFIG).gasLimit() == _toGasLimit());
}

Expand Down
8 changes: 4 additions & 4 deletions script/universal/MultisigBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract contract MultisigBuilder is MultisigBase {
/**
* @notice Follow up assertions to ensure that the script ran to completion.
*/
function _postCheck() internal virtual;
function _postCheck(Vm.AccountAccess[] memory accesses, Simulation.Payload memory simPayload) internal virtual;

/**
* @notice Follow up assertions on state and simulation after a `sign` call.
Expand Down Expand Up @@ -70,7 +70,7 @@ abstract contract MultisigBuilder is MultisigBase {
IMulticall3.Call3[] memory calls = _buildCalls();
(Vm.AccountAccess[] memory accesses, Simulation.Payload memory simPayload) = _simulateForSigner(safe, calls);
_postSign(accesses, simPayload);
_postCheck();
_postCheck(accesses, simPayload);

// Restore the original nonce.
vm.store(address(safe), SAFE_NONCE_SLOT, bytes32(_nonce));
Expand Down Expand Up @@ -104,7 +104,7 @@ abstract contract MultisigBuilder is MultisigBase {
_executeTransaction(safe, _buildCalls(), _signatures);

_postRun(accesses, simPayload);
_postCheck();
_postCheck(accesses, simPayload);
}

/**
Expand All @@ -123,7 +123,7 @@ abstract contract MultisigBuilder is MultisigBase {
vm.stopBroadcast();

_postRun(accesses, simPayload);
_postCheck();
_postCheck(accesses, simPayload);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions script/universal/NestedMultisigBuilder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract contract NestedMultisigBuilder is MultisigBase {
* @notice Follow up assertions to ensure that the script ran to completion.
* @dev Called after `sign` and `run`, but not `approve`.
*/
function _postCheck() internal virtual;
function _postCheck(Vm.AccountAccess[] memory accesses, Simulation.Payload memory simPayload) internal virtual;

/**
* @notice Follow up assertions on state and simulation after a `sign` call.
Expand Down Expand Up @@ -77,7 +77,7 @@ abstract contract NestedMultisigBuilder is MultisigBase {
(Vm.AccountAccess[] memory accesses, Simulation.Payload memory simPayload) =
_simulateForSigner(_signerSafe, nestedSafe, nestedCalls);
_postSign(accesses, simPayload);
_postCheck();
_postCheck(accesses, simPayload);

// Restore the original nonce.
vm.store(address(nestedSafe), SAFE_NONCE_SLOT, bytes32(originalNonce));
Expand Down Expand Up @@ -138,7 +138,7 @@ abstract contract NestedMultisigBuilder is MultisigBase {
vm.stopBroadcast();

_postRun(accesses, simPayload);
_postCheck();
_postCheck(accesses, simPayload);
}

function _readFrom_SAFE_NONCE() internal pure override returns (bool) {
Expand Down
3 changes: 2 additions & 1 deletion test/universal/MultisigBuilder.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {console} from "forge-std/console.sol";
import {IMulticall3} from "forge-std/interfaces/IMulticall3.sol";
import {Preinstalls} from "@eth-optimism-bedrock/src/libraries/Preinstalls.sol";
import {MultisigBuilder} from "../../script/universal/MultisigBuilder.sol";
import {Simulation} from "../../script/universal/Simulation.sol";
import {IGnosisSafe} from "@eth-optimism-bedrock/scripts/interfaces/IGnosisSafe.sol";
import {Counter} from "./Counter.sol";

Expand All @@ -30,7 +31,7 @@ contract MultisigBuilderTest is Test, MultisigBuilder {
safe.setup(owners, 2, address(0), "", address(0), address(0), 0, address(0));
}

function _postCheck() internal view override {
function _postCheck(Vm.AccountAccess[] memory, Simulation.Payload memory) internal view override {
// Check that the counter has been incremented
uint256 counterValue = counter.count();
require(counterValue == 1, "Counter value is not 1");
Expand Down
3 changes: 2 additions & 1 deletion test/universal/NestedMultisigBuilder.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {console} from "forge-std/console.sol";
import {IMulticall3} from "forge-std/interfaces/IMulticall3.sol";
import {Preinstalls} from "@eth-optimism-bedrock/src/libraries/Preinstalls.sol";
import {NestedMultisigBuilder} from "../../script/universal/NestedMultisigBuilder.sol";
import {Simulation} from "../../script/universal/Simulation.sol";
import {IGnosisSafe} from "@eth-optimism-bedrock/scripts/interfaces/IGnosisSafe.sol";
import {Counter} from "./Counter.sol";

Expand Down Expand Up @@ -45,7 +46,7 @@ contract NestedMultisigBuilderTest is Test, NestedMultisigBuilder {
safe3.setup(owners3, 2, address(0), "", address(0), address(0), 0, address(0));
}

function _postCheck() internal view override {
function _postCheck(Vm.AccountAccess[] memory, Simulation.Payload memory) internal view override {
// Check that the counter has been incremented
uint256 counterValue = counter.count();
require(counterValue == 1, "Counter value is not 1");
Expand Down