diff --git a/.gas-snapshot b/.gas-snapshot index a244163..986b0a2 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -135,7 +135,7 @@ ModifySafeOwners:testRevertSafeNotRegisteredRemoveOwner_EOA_Caller() (gas: 50526 ModifySafeOwners:testRevertSafeNotRegisteredRemoveOwner_SAFE_Caller() (gas: 509494) ModifySafeOwners:testRevertZeroAddressAddOwnerWithThreshold() (gas: 1672722) ModifySafeOwners:testRevertZeroAddressProvidedRemoveOwner() (gas: 3080094) -TestDeploy:testDeploy() (gas: 6283203) +TestDeploy:testDeploy() (gas: 6285029) TestDeploySafe:testTransferFundsSafe() (gas: 109672) TestEnableGuard:testEnableKeyperGuard() (gas: 120880) TestEnableGuard:testEnableKeyperModule() (gas: 122295) diff --git a/script/SkipExecutionOnBehalf.s.sol b/script/SkipExecutionOnBehalf.s.sol index e55d290..bb418b7 100644 --- a/script/SkipExecutionOnBehalf.s.sol +++ b/script/SkipExecutionOnBehalf.s.sol @@ -219,7 +219,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv { emptyData, Enum.Operation(0) ); - // ttry to encode the end of the signature, from EOA random the internal data to the Wrapper of + // try to encode the end of the signature, from EOA random the internal data to the Wrapper of // Execution On Behalf, with a rogue caller and that is secondary squad A1 over Root Safe bytes memory internalData = abi.encodeWithSignature( "execTransactionOnBehalf(bytes32,address,address,address,uint256,bytes,uint8,bytes)", @@ -467,7 +467,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv { Enum.Operation(0) ); - // vm.expectRevert("GS020"); // GS020: Invalid signatures provided + // GS020: Invalid signatures provided keyperModule.execTransactionOnBehalf( orgHash, rootAddr, @@ -523,7 +523,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv { Enum.Operation(0) ); - // vm.expectRevert("GS026"); // GS026: Invalid signatures provided + // GS026: Invalid signatures provided keyperModule.execTransactionOnBehalf( orgHash, rootAddr, @@ -581,7 +581,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv { ); setGnosisSafe(safeSubSquadA1Addr); - // vm.expectRevert(Errors.NotAuthorizedExecOnBehalf.selector); // NotAuthorizedExecOnBehalf: Caller is not authorized to execute on behalf + // NotAuthorizedExecOnBehalf: Caller is not authorized to execute on behalf bool result = execTransactionOnBehalfTx( orgHash, safeSubSquadA1Addr, @@ -625,7 +625,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv { Enum.Operation(0) ); - // vm.expectRevert("GS013"); // GS013: Invalid signatures provided + // GS013: Invalid signatures provided execTransactionOnBehalfTx( orgHash, rootAddr, @@ -639,16 +639,16 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv { vm.stopBroadcast(); } - // // Revert ZeroAddressProvided() execTransactionOnBehalf when arg "to" is address(0) - // // Scenario 1 - // // Caller: rootAddr (org) - // // Caller Type: rootSafe - // // Caller Role: ROOT_SAFE - // // TargerSafe: safeSquadA1 - // // TargetSafe Type: safe as a Child - // // rootSafe ----------- - // // | | - // // safeSquadA1 <-------- + // Revert ZeroAddressProvided() execTransactionOnBehalf when arg "to" is address(0) + // Scenario 1 + // Caller: rootAddr (org) + // Caller Type: rootSafe + // Caller Role: ROOT_SAFE + // TargerSafe: safeSquadA1 + // TargetSafe Type: safe as a Child + // rootSafe ----------- + // | | + // safeSquadA1 <-------- function testRevertInvalidAddressProvidedExecTransactionOnBehalfScenarioOne( ) public { vm.startBroadcast(); @@ -674,7 +674,6 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv { Enum.Operation(0) ); // Execute on behalf function with invalid receiver - // vm.expectRevert(Errors.InvalidAddressProvided.selector); // InvalidAddressProvided: Invalid address provided keyperModule.execTransactionOnBehalf( orgHash, rootAddr, @@ -688,16 +687,16 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv { vm.stopBroadcast(); } - // // Revert ZeroAddressProvided() execTransactionOnBehalf when param "targetSafe" is address(0) - // // Scenario 2 - // // Caller: rootAddr (org) - // // Caller Type: rootSafe - // // Caller Role: ROOT_SAFE - // // TargerSafe: safeSquadA1 - // // TargetSafe Type: safe as a Child - // // rootSafe ----------- - // // | | - // // safeSquadA1 <-------- + // Revert ZeroAddressProvided() execTransactionOnBehalf when param "targetSafe" is address(0) + // Scenario 2 + // Caller: rootAddr (org) + // Caller Type: rootSafe + // Caller Role: ROOT_SAFE + // TargerSafe: safeSquadA1 + // TargetSafe Type: safe as a Child + // rootSafe ----------- + // | | + // safeSquadA1 <-------- function testRevertZeroAddressProvidedExecTransactionOnBehalfScenarioTwo() public { @@ -723,12 +722,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv { Enum.Operation(0) ); - // Execute on behalf function from a not authorized caller - // vm.expectRevert( - // abi.encodeWithSelector( - // Errors.InvalidGnosisSafe.selector, address(0) - // ) - // ); // InvalidGnosisSafe: Invalid Gnosis Safe + // InvalidGnosisSafe: Invalid Gnosis Safe keyperModule.execTransactionOnBehalf( orgHash, rootAddr, @@ -742,16 +736,16 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv { vm.stopBroadcast(); } - // // Revert ZeroAddressProvided() execTransactionOnBehalf when param "org" is address(0) - // // Scenario 3 - // // Caller: rootAddr (org) - // // Caller Type: rootSafe - // // Caller Role: ROOT_SAFE - // // TargerSafe: safeSquadA1 - // // TargetSafe Type: safe as a Child - // // rootSafe ----------- - // // | | - // // safeSquadA1 <-------- + // Revert ZeroAddressProvided() execTransactionOnBehalf when param "org" is address(0) + // Scenario 3 + // Caller: rootAddr (org) + // Caller Type: rootSafe + // Caller Role: ROOT_SAFE + // TargerSafe: safeSquadA1 + // TargetSafe Type: safe as a Child + // rootSafe ----------- + // | | + // safeSquadA1 <-------- function testRevertOrgNotRegisteredExecTransactionOnBehalfScenarioThree() public { @@ -776,10 +770,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv { emptyData, Enum.Operation(0) ); - // Execute on behalf function from a not authorized caller - // vm.expectRevert( - // abi.encodeWithSelector(Errors.OrgNotRegistered.selector, address(0)) - // ); // OrgNotRegistered: Org not registered + // OrgNotRegistered: Org not registered keyperModule.execTransactionOnBehalf( bytes32(0), rootAddr, @@ -793,12 +784,12 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv { vm.stopBroadcast(); } - // // Revert InvalidGnosisSafe() execTransactionOnBehalf : when param "targetSafe" is not a safe - // // Caller: rootAddr (org) - // // Caller Type: rootSafe - // // Caller Role: ROOT_SAFE, SAFE_LEAD - // // TargerSafe: fakeTargetSafe - // // TargetSafe Type: EOA + // Revert InvalidGnosisSafe() execTransactionOnBehalf : when param "targetSafe" is not a safe + // Caller: rootAddr (org) + // Caller Type: rootSafe + // Caller Role: ROOT_SAFE, SAFE_LEAD + // TargerSafe: fakeTargetSafe + // TargetSafe Type: EOA function testRevertInvalidGnosisSafeExecTransactionOnBehalf() public { vm.startBroadcast(); (uint256 rootId, uint256 safeSquadA1) = @@ -822,12 +813,7 @@ contract SkipSeveralScenarios is Script, SkipSetupEnv { emptyData, Enum.Operation(0) ); - // Execute on behalf function from a not authorized caller - // vm.expectRevert( - // abi.encodeWithSelector( - // Errors.InvalidGnosisSafe.selector, fakeTargetSafe - // ) - // ); // InvalidGnosisSafe: Invalid Gnosis Safe + // InvalidGnosisSafe: Invalid Gnosis Safe keyperModule.execTransactionOnBehalf( orgHash, rootAddr, diff --git a/test/ExecTransactionOnBehalf.t.sol b/test/ExecTransactionOnBehalf.t.sol index 628b282..535d2ac 100644 --- a/test/ExecTransactionOnBehalf.t.sol +++ b/test/ExecTransactionOnBehalf.t.sol @@ -439,17 +439,17 @@ contract ExecTransactionOnBehalf is DeployHelper, SignersHelper { // // ! ********************** SUPER_SAFE ROLE ******************** - // // execTransactionOnBehalf - // // Caller: safeSquadA1 - // // Caller Type: safe - // // Caller Role: SUPER_SAFE of safeSubSquadA1 - // // TargerSafe: safeSubSquadA1 - // // TargetSafe Type: safe - // // rootSafe - // // | - // // safeSquadA1 as superSafe --- - // // | | - // // safeSubSquadA1 <------------ + // execTransactionOnBehalf + // Caller: safeSquadA1 + // Caller Type: safe + // Caller Role: SUPER_SAFE of safeSubSquadA1 + // TargerSafe: safeSubSquadA1 + // TargetSafe Type: safe + // rootSafe + // | + // safeSquadA1 as superSafe --- + // | | + // safeSubSquadA1 <------------ function testCan_ExecTransactionOnBehalf_SUPER_SAFE_as_SAFE_is_TARGETS_LEAD_SameTree( ) public { (, uint256 safeSquadA1Id, uint256 safeSubSquadA1Id,,) = @@ -700,19 +700,19 @@ contract ExecTransactionOnBehalf is DeployHelper, SignersHelper { ); } - // // Revert NotAuthorizedExecOnBehalf() execTransactionOnBehalf (safeSubSquadA1 is attempting to execute on its superSafe) - // // Caller: safeSubSquadA1 - // // Caller Type: safe - // // Caller Role: SUPER_SAFE - // // TargerSafe: safeSquadA1 - // // TargetSafe Type: safe as lead - // // rootSafe - // // | - // // safeSquadA1 <---- - // // | | - // // safeSubSquadA1 --- - // // | - // // safeSubSubSquadA1 + // Revert NotAuthorizedExecOnBehalf() execTransactionOnBehalf (safeSubSquadA1 is attempting to execute on its superSafe) + // Caller: safeSubSquadA1 + // Caller Type: safe + // Caller Role: SUPER_SAFE + // TargerSafe: safeSquadA1 + // TargetSafe Type: safe as lead + // rootSafe + // | + // safeSquadA1 <---- + // | | + // safeSubSquadA1 --- + // | + // safeSubSubSquadA1 function testRevertSuperSafeExecOnBehalf() public { (uint256 rootId, uint256 squadIdA1, uint256 subSquadIdA1,) = keyperSafeBuilder.setupOrgFourTiersTree( @@ -798,16 +798,16 @@ contract ExecTransactionOnBehalf is DeployHelper, SignersHelper { ); } - // // Revert ZeroAddressProvided() execTransactionOnBehalf when arg "to" is address(0) - // // Scenario 1 - // // Caller: rootAddr (org) - // // Caller Type: rootSafe - // // Caller Role: ROOT_SAFE - // // TargerSafe: safeSquadA1 - // // TargetSafe Type: safe as a Child - // // rootSafe ----------- - // // | | - // // safeSquadA1 <-------- + // Revert ZeroAddressProvided() execTransactionOnBehalf when arg "to" is address(0) + // Scenario 1 + // Caller: rootAddr (org) + // Caller Type: rootSafe + // Caller Role: ROOT_SAFE + // TargerSafe: safeSquadA1 + // TargetSafe Type: safe as a Child + // rootSafe ----------- + // | | + // safeSquadA1 <-------- function testRevertInvalidAddressProvidedExecTransactionOnBehalfScenarioOne( ) public { (uint256 rootId, uint256 safeSquadA1) = @@ -846,16 +846,16 @@ contract ExecTransactionOnBehalf is DeployHelper, SignersHelper { ); } - // // Revert ZeroAddressProvided() execTransactionOnBehalf when param "targetSafe" is address(0) - // // Scenario 2 - // // Caller: rootAddr (org) - // // Caller Type: rootSafe - // // Caller Role: ROOT_SAFE - // // TargerSafe: safeSquadA1 - // // TargetSafe Type: safe as a Child - // // rootSafe ----------- - // // | | - // // safeSquadA1 <-------- + // Revert ZeroAddressProvided() execTransactionOnBehalf when param "targetSafe" is address(0) + // Scenario 2 + // Caller: rootAddr (org) + // Caller Type: rootSafe + // Caller Role: ROOT_SAFE + // TargerSafe: safeSquadA1 + // TargetSafe Type: safe as a Child + // rootSafe ----------- + // | | + // safeSquadA1 <-------- function testRevertZeroAddressProvidedExecTransactionOnBehalfScenarioTwo() public { @@ -897,16 +897,16 @@ contract ExecTransactionOnBehalf is DeployHelper, SignersHelper { ); } - // // Revert ZeroAddressProvided() execTransactionOnBehalf when param "org" is address(0) - // // Scenario 3 - // // Caller: rootAddr (org) - // // Caller Type: rootSafe - // // Caller Role: ROOT_SAFE - // // TargerSafe: safeSquadA1 - // // TargetSafe Type: safe as a Child - // // rootSafe ----------- - // // | | - // // safeSquadA1 <-------- + // Revert ZeroAddressProvided() execTransactionOnBehalf when param "org" is address(0) + // Scenario 3 + // Caller: rootAddr (org) + // Caller Type: rootSafe + // Caller Role: ROOT_SAFE + // TargerSafe: safeSquadA1 + // TargetSafe Type: safe as a Child + // rootSafe ----------- + // | | + // safeSquadA1 <-------- function testRevertOrgNotRegisteredExecTransactionOnBehalfScenarioThree() public { @@ -945,12 +945,12 @@ contract ExecTransactionOnBehalf is DeployHelper, SignersHelper { ); } - // // Revert InvalidGnosisSafe() execTransactionOnBehalf : when param "targetSafe" is not a safe - // // Caller: rootAddr (org) - // // Caller Type: rootSafe - // // Caller Role: ROOT_SAFE, SAFE_LEAD - // // TargerSafe: fakeTargetSafe - // // TargetSafe Type: EOA + // Revert InvalidGnosisSafe() execTransactionOnBehalf : when param "targetSafe" is not a safe + // Caller: rootAddr (org) + // Caller Type: rootSafe + // Caller Role: ROOT_SAFE, SAFE_LEAD + // TargerSafe: fakeTargetSafe + // TargetSafe Type: EOA function testRevertInvalidGnosisSafeExecTransactionOnBehalf() public { (uint256 rootId, uint256 safeSquadA1) = keyperSafeBuilder.setupRootOrgAndOneSquad(orgName, squadA1Name); @@ -995,7 +995,6 @@ contract ExecTransactionOnBehalf is DeployHelper, SignersHelper { // Squad A starts a executeOnBehalf tx for his children B // -> The calldata for the function is another executeOnBehalfTx for children C // -> Verify that this wrapped executeOnBehalf tx does not work - // TODO: test this scenario in Live Testnet function testCannot_ExecTransactionOnBehalf_Wrapper_ExecTransactionOnBehalf_ChildSquad_over_RootSafe_With_SAFE( ) public { (uint256 rootId, uint256 safeSquadA1, uint256 childSquadA1,,) =