-
Notifications
You must be signed in to change notification settings - Fork 55
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
[FPS] multisig task tests #485
base: main
Are you sure you want to change the base?
[FPS] multisig task tests #485
Conversation
Signed-off-by: Elliot <[email protected]> add example task template config files Signed-off-by: Elliot <[email protected]> add fps example templates Signed-off-by: Elliot <[email protected]> remove name and description, set task nonce to current multisig nonce Signed-off-by: Elliot <[email protected]> fmt and add TODO to switch to manual nonce later Signed-off-by: Elliot <[email protected]> templates Signed-off-by: Elliot <[email protected]> remove safeNonce from mock network config Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
…rchain-ops into feat/templates-pt2
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
…rchain-ops into feat/templates-pt2
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Co-authored-by: blaine <[email protected]>
Co-authored-by: blaine <[email protected]>
Signed-off-by: Elliot <[email protected]>
Co-authored-by: Elliot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need test/registry/.gitkeep
in this PR.
Made a first pass through this. Still need to go through SingleMultisig.t.sol
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few more comments
/// execute the child multisig approval of hashToApproveByChildMultisig | ||
bytes memory dataToSign = getNestedDataToSign(childOwnerMultisigs[i]); | ||
/// nonce is not decremented by 1 because in task simulation approveHash is called by | ||
/// the child multisig which does not increment the nonce |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct right?
/// the child multisig which does not increment the nonce | |
/// the child multisig owners which does not increment the nonce |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we call as the child multisig owners, we just prank as the child multisigs currently
test/task/SingleMultisigTask.t.sol
Outdated
import {MULTICALL3_ADDRESS} from "src/fps/utils/Constants.sol"; | ||
|
||
contract SingleMultisigTaskTest is Test { | ||
struct Call3Value { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we import this from IMultiCall3.sol
in. import {IMulticall3} from "forge-std/interfaces/IMulticall3.sol";
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
test/task/NestedMultisigTask.t.sol
Outdated
|
||
/// @notice This test is used to test the nested multisig task. | ||
contract NestedMultisigTaskTest is Test { | ||
struct Call3Value { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as comment below can we take this from import {IMulticall3} from "forge-std/interfaces/IMulticall3.sol";
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
MultisigTask private multisigTask; | ||
Addresses private addresses; | ||
string taskConfigFilePath = "src/fps/example/task-00/mainnetConfig.toml"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string taskConfigFilePath = "src/fps/example/task-00/mainnetConfig.toml"; | |
/// ProxyAdminOwner safe for task-00 is a single multisig. | |
string taskConfigFilePath = "src/fps/example/task-00/mainnetConfig.toml"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
MultisigTask private multisigTask; | ||
Addresses private addresses; | ||
string taskConfigFilePath = "src/fps/example/task-00/mainnetConfig.toml"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe src/fps/example/task-00/testnetConfig.toml
is used anywhere, can we delete this as part of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
bytes memory callData = multisigTask.getCalldata(); | ||
bytes memory dataToSign = multisigTask.getDataToSign(multisigTask.multisig(), callData); | ||
|
||
bytes memory expectedDataToSign = IGnosisSafe(multisigTask.multisig()).encodeTransactionData({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bytes memory expectedDataToSign = IGnosisSafe(multisigTask.multisig()).encodeTransactionData({ | |
/// The nonce is decremented by 1 because we want to recreate the data to sign with the same nonce | |
/// that was used in the simulation. The nonce was incremented as part of running the simulation. | |
bytes memory expectedDataToSign = IGnosisSafe(multisigTask.multisig()).encodeTransactionData({ |
|
||
/// @title IncorrectGasConfigTemplate1 | ||
/// @notice allowed storage write to incorrect address | ||
contract IncorrectGasConfigTemplate1 is MultisigTask { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking that we can cut a lot of code down in these IncorrectGasConfigTemplate*
files by making the relevant functions inside GasConfigTemplate vitrual
. e.g.
contract A {
function foo() internal pure virtual returns (string[] memory);
}
contract B is A {
function foo() internal pure virtual override returns (string[] memory) {
// Using virtual twice like this, what do people think?
}
}
contract C is B {
function foo() internal pure override returns (string[] memory) {
// Further override
}
}
IncorrectGasConfigTemplate*.sol
would become:
pragma solidity 0.8.15;
import {SystemConfig} from "@eth-optimism-bedrock/src/L1/SystemConfig.sol";
import {GasConfigTemplate} from "src/fps/example/template/GasConfigTemplate.sol";
import {AddressRegistry as Addresses} from "src/fps/AddressRegistry.sol";
/// @title IncorrectGasConfigTemplate2
/// @notice not all allowed storages writes are written to
contract IncorrectGasConfigTemplate2 is GasConfigTemplate {
function _taskStorageWrites() internal pure override returns (string[] memory) {
string[] memory storageWrites = new string[](2);
/// expected to be written to
storageWrites[0] = "SystemConfigOwner";
storageWrites[1] = "SystemConfigProxy";
return storageWrites;
}
}
pragma solidity 0.8.15;
import {SystemConfig} from "@eth-optimism-bedrock/src/L1/SystemConfig.sol";
import {GasConfigTemplate} from "src/fps/example/template/GasConfigTemplate.sol";
import {AddressRegistry as Addresses} from "src/fps/AddressRegistry.sol";
/// @title IncorrectGasConfigTemplate1
/// @notice allowed storage write to incorrect address
contract IncorrectGasConfigTemplate1 is GasConfigTemplate {
function _taskStorageWrites() internal pure override returns (string[] memory) {
string[] memory storageWrites = new string[](1);
/// wrong address
storageWrites[0] = "SystemConfigOwner";
return storageWrites;
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this is resolved now
…ord-template refactor virtual keyword template
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Signed-off-by: Elliot <[email protected]>
Description
Add tests for Single and Nested Multisig Tasks.
Tests
Additional context
Using
GasConfigTemplate
for Single multisig tests andDisputeGameUpgradeTemplate
for nested multisig testsMetadata