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

Fix Review #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix Review #1

wants to merge 1 commit into from

Conversation

sherlock-admin
Copy link
Contributor

Fix Review of

Repo: Hats-Protocol/hats-zodiac
Commit Hash: a9e3f4f0e968fb332800a468eddcb993fc6d5cd2

Comment on lines +111 to +114
- Delegatecalls can modify Safe state if not properly restricted. Owners should NOT approve delegatecall targets that enable the following:
- Directly modifying any of the Safe's state, including the Safe's nonce.
- Additional delegatecalls. For example, the MultiSend library that is *not* MultiSendCallOnly should not be approved.
- HSG validates that approved delegatecalls don't modify critical Safe parameters, but relies on the Safe' nonce to do so.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: LGPL-3.0
pragma solidity >=0.8.13;
pragma solidity >=0.8.28;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#83.

Fixes issues: #19

@@ -95,28 +95,31 @@ contract HatsSignerGate is
/*//////////////////////////////////////////////////////////////
TRANSIENT STATE
//////////////////////////////////////////////////////////////*/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

/// @dev Temporary record of the existing owners on the `safe` when a transaction is submitted
bytes32 transient _existingOwnersHash;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

/// @dev Temporary record of the existing threshold on the `safe` when a transaction is submitted
uint256 transient _existingThreshold;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

/// @dev Temporary record of the existing fallback handler on the `safe` when a transaction is submitted
address transient _existingFallbackHandler;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +110 to +116

/// @dev Temporary record of whether we're inside an execTransaction call
bool transient _inSafeExecTransaction;

/// @dev Temporary record of whether we're inside an execTransactionFromModule call
bool transient _inModuleExecTransaction;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

/// @dev The safe's nonce at the beginning of a transaction
uint256 transient _initialNonce;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +121 to +122
uint256 transient _checkTransactionCounter;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +402 to +404
/// @notice Only approved delegatecall targets are allowed.
/// @notice This function cannot be entered from within itself, called directly from within Safe.execTransaction, or
/// from within an execTransactionFromModule or execTransactionFromModuleReturnData call.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +421 to +429
// Disallow entering this function from a) inside a Safe.execTransaction call or b) inside an
// execTransactionFromModule call
if (_inSafeExecTransaction || _inModuleExecTransaction) revert NoReentryAllowed();
_inSafeExecTransaction = true;

/// @dev We enforce that this function is called exactly once per Safe.execTransaction call. Leveraging the fact
/// that the Safe nonce increments exactly once per Safe.execTransaction call, we require that nonce diff matches
/// the number of times this function has been called.
// Record the initial nonce of the Safe at the beginning of the transaction
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

/// that the Safe nonce increments exactly once per Safe.execTransaction call, we require that nonce diff matches
/// the number of times this function has been called.
// Record the initial nonce of the Safe at the beginning of the transaction
if (_checkTransactionCounter == 0) _initialNonce = safe.nonce() - 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +431 to +433
// Increment the entrancy counter
_checkTransactionCounter++;
// Ensure that this function is called exactly once per Safe.execTransaction call
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

// Increment the entrancy counter
_checkTransactionCounter++;
// Ensure that this function is called exactly once per Safe.execTransaction call
if (safe.nonce() - _initialNonce != _checkTransactionCounter) revert NoReentryAllowed();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

@@ -450,7 +447,7 @@ contract HatsSignerGate is
address(0),
payable(0),
"",
address(0)
address(safe)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

@@ -511,18 +508,26 @@ contract HatsSignerGate is
* 2. changing any modules
* 3. changing the threshold
* 4. changing the owners
* 5. changing the fallback handler
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +519 to +520
// Ensure that this is only called in accordance with the Safe execTransaction flow
// And that it is not called from inside an execTransactionFromModule call
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

* CAUTION: If the safe has any authority over the signersHat(s) — i.e. wears their admin hat(s) or is an
* eligibility or toggle module — then in some cases protections (3) and (4) may not hold. Proceed with caution if
* considering granting such authority to the safe.
* @dev Modified from
* https://github.com/gnosis/zodiac-guard-mod/blob/988ebc7b71e352f121a0be5f6ae37e79e47a4541/contracts/ModGuard.sol#L86
*/
function checkAfterExecution(bytes32, bool) public override {
// Ensure that this is only called in accordance with the Safe execTransaction flow
// And that it is not called from inside an execTransactionFromModule call
if (!_inSafeExecTransaction || _inModuleExecTransaction) revert NoReentryAllowed();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

// Ensure that this is only called in accordance with the Safe execTransaction flow
// And that it is not called from inside an execTransactionFromModule call
if (!_inSafeExecTransaction || _inModuleExecTransaction) revert NoReentryAllowed();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +528 to +530
// reset the reentrancy guard to enable subsequent legitimate Safe execTransactions in the same transaction
_inSafeExecTransaction = false;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +989 to +990
// Disallow entering this function from inside a Safe execTransaction call or another execTransactionFromModule call
if (_inSafeExecTransaction || _inModuleExecTransaction) revert NoReentryAllowed();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3


// set the reentrancy guard
_reentrancyGuard = 1;
_inModuleExecTransaction = true;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

@@ -1015,6 +1016,6 @@ contract HatsSignerGate is
if (operation_ == Enum.Operation.DelegateCall) _checkSafeState(_safe);

// reset the reentrancy guard to enable future legitimate calls within the same transaction
_reentrancyGuard = 0;
_inModuleExecTransaction = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +15 to +21
/*//////////////////////////////////////////////////////////////
CUSTOM ERRORS
//////////////////////////////////////////////////////////////*/

/// @notice Emitted when a call to the Safe's execTransactionFromModule fails
error SafeTransactionFailed();

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#82.

Fixes issues: #8

Comment on lines +172 to +175
bool success =
_safe.execTransactionFromModule({ to: address(_safe), value: 0, data: _data, operation: Enum.Operation.Call });

if (!success) revert SafeTransactionFailed();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#82.

Fixes issues: #8

@@ -4,16 +4,38 @@ pragma solidity ^0.8.13;
import { Test, console2 } from "../lib/forge-std/src/Test.sol";
import { WithHSGInstanceTest, Enum } from "./TestSuite.t.sol";
import { IHatsSignerGate } from "../src/interfaces/IHatsSignerGate.sol";
import { SafeManagerLib } from "../src/lib/SafeManagerLib.sol";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +10 to +30
address public maliciousFallbackHandler = makeAddr("maliciousFallbackHandler");
address public goodFallbackHandler;
bytes public setFallbackAction = abi.encodeWithSignature("setFallbackHandler(address)", maliciousFallbackHandler);
bytes public packedCalls;
bytes public multiSendData;
bytes32 public safeTxHash;
bytes public checkTransactionAction;
bytes public signatures;

bytes public checkAfterExecutionAction =
abi.encodeWithSignature("checkAfterExecution(bytes32,bool)", bytes32(0), false);

string public constant CHECK_TRANSACTION_SIGNATURE =
"checkTransaction(address,uint256,bytes,uint8,uint256,uint256,uint256,address,address,bytes,address)";

function setUp() public override {
super.setUp();

goodFallbackHandler = SafeManagerLib.getSafeFallbackHandler(safe);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

function testSignersCannotAddNewModules() public {
_addSignersSameHat(2, signerHat);

bytes memory addModuleData = abi.encodeWithSignature("enableModule(address)", address(tstModule1));

(bytes memory multisendCall, bytes32 txHash) = _constructSingleActionMultiSendTx(addModuleData);

bytes memory signatures = _createNSigsForTx(txHash, 2);
signatures = _createNSigsForTx(txHash, 2);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

@@ -67,7 +89,7 @@ contract AttacksScenarios is WithHSGInstanceTest {
// create the tx
bytes32 txHash = _getTxHash(destAddress, transferValue, Enum.Operation.Call, hex"00", safe);
// have them sign it
bytes memory signatures = _createNSigsForTx(txHash, 2);
signatures = _createNSigsForTx(txHash, 2);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +1385 to +1390
function test_revert_delegatecallTargetNotEnabled()
public
callerIsSafe(true)
inSafeExecTransaction(false)
inModuleExecTransaction(false)
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +1408 to +1418
// transient state should be cleared after revert
_assertTransientStateVariables({
_operation: Enum.Operation(uint8(0)),
_existingOwnersHash: bytes32(0),
_existingThreshold: 0,
_existingFallbackHandler: address(0),
_inSafeExecTransaction: false,
_inModuleExecTransaction: false,
_initialNonce: 0,
_checkTransactionCounter: 0
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +1421 to +1426
function test_revert_cannotCallSafe()
public
callerIsSafe(true)
inSafeExecTransaction(false)
inModuleExecTransaction(false)
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +1433 to +1443
// transient state should be cleared after revert
_assertTransientStateVariables({
_operation: Enum.Operation(uint8(0)),
_existingOwnersHash: bytes32(0),
_existingThreshold: 0,
_existingFallbackHandler: address(0),
_inSafeExecTransaction: false,
_inModuleExecTransaction: false,
_initialNonce: 0,
_checkTransactionCounter: 0
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +1446 to +1451
function test_revert_thresholdTooLow(uint8 _operation)
public
callerIsSafe(true)
inSafeExecTransaction(false)
inModuleExecTransaction(false)
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +1478 to +1488
// transient state should be cleared
_assertTransientStateVariables({
_operation: Enum.Operation(uint8(0)),
_existingOwnersHash: bytes32(0),
_existingThreshold: 0,
_existingFallbackHandler: address(0),
_inSafeExecTransaction: false,
_inModuleExecTransaction: false,
_initialNonce: 0,
_checkTransactionCounter: 0
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +1491 to +1496
function test_revert_insufficientValidSignatures(uint8 _operation)
public
callerIsSafe(true)
inSafeExecTransaction(false)
inModuleExecTransaction(false)
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +1524 to +1559
// transient state should be cleared after revert
_assertTransientStateVariables({
_operation: Enum.Operation(uint8(0)),
_existingOwnersHash: bytes32(0),
_existingThreshold: 0,
_existingFallbackHandler: address(0),
_inSafeExecTransaction: false,
_inModuleExecTransaction: false,
_initialNonce: 0,
_checkTransactionCounter: 0
});
}

function test_revert_inSafeExecTransaction(bool _inModuleExecTransaction)
public
callerIsSafe(true)
inSafeExecTransaction(true)
inModuleExecTransaction(_inModuleExecTransaction)
{
vm.expectRevert(IHatsSignerGate.NoReentryAllowed.selector);
vm.prank(caller);
harness.exposed_checkTransaction(
address(safe), 0, new bytes(0), Enum.Operation.Call, 0, 0, 0, address(0), payable(0), new bytes(0), address(0)
);

// transient state should be cleared after revert
_assertTransientStateVariables({
_operation: Enum.Operation(uint8(0)),
_existingOwnersHash: bytes32(0),
_existingThreshold: 0,
_existingFallbackHandler: address(0),
_inSafeExecTransaction: false,
_inModuleExecTransaction: false,
_initialNonce: 0,
_checkTransactionCounter: 0
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +1562 to +1592
function test_revert_inModuleExecTransaction(bool _inSafeExecTransaction)
public
callerIsSafe(true)
inSafeExecTransaction(_inSafeExecTransaction)
inModuleExecTransaction(true)
{
vm.expectRevert(IHatsSignerGate.NoReentryAllowed.selector);
vm.prank(caller);
harness.exposed_checkTransaction(
address(safe), 0, new bytes(0), Enum.Operation.Call, 0, 0, 0, address(0), payable(0), new bytes(0), address(0)
);

// transient state should be cleared after revert
_assertTransientStateVariables({
_operation: Enum.Operation(uint8(0)),
_existingOwnersHash: bytes32(0),
_existingThreshold: 0,
_existingFallbackHandler: address(0),
_inSafeExecTransaction: false,
_inModuleExecTransaction: false,
_initialNonce: 0,
_checkTransactionCounter: 0
});
}

function test_revert_noReentryAllowed()
public
callerIsSafe(true)
inSafeExecTransaction(false)
inModuleExecTransaction(false)
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +1639 to +1650

// transient state should be cleared after revert
_assertTransientStateVariables({
_operation: Enum.Operation(uint8(0)),
_existingOwnersHash: bytes32(0),
_existingThreshold: 0,
_existingFallbackHandler: address(0),
_inSafeExecTransaction: false,
_inModuleExecTransaction: false,
_initialNonce: 0,
_checkTransactionCounter: 0
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +1660 to +1664
function test_happy_checkAfterExecution(bytes32 _txHash, bool _success)
public
inSafeExecTransaction(true)
inModuleExecTransaction(false)
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +1667 to +1677

_assertTransientStateVariables({
_operation: Enum.Operation(uint8(0)),
_existingOwnersHash: bytes32(0),
_existingThreshold: 0,
_existingFallbackHandler: address(0),
_inSafeExecTransaction: false,
_inModuleExecTransaction: false,
_initialNonce: 0,
_checkTransactionCounter: 0
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +1680 to +1684
function test_revert_guardReverts(bytes32 _txHash, bool _success)
public
inSafeExecTransaction(true)
inModuleExecTransaction(false)
{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +1695 to +1750

// transient state should be cleared after revert
_assertTransientStateVariables({
_operation: Enum.Operation(uint8(0)),
_existingOwnersHash: bytes32(0),
_existingThreshold: 0,
_existingFallbackHandler: address(0),
_inSafeExecTransaction: false,
_inModuleExecTransaction: false,
_initialNonce: 0,
_checkTransactionCounter: 0
});
}

function test_revert_notInSafeExecTransaction(bytes32 _txHash, bool _success)
public
inSafeExecTransaction(false)
inModuleExecTransaction(false)
{
// should revert because we are not inside a Safe execTransaction call
vm.expectRevert(IHatsSignerGate.NoReentryAllowed.selector);
harness.exposed_checkAfterExecution(_txHash, _success);

// transient state should be cleared after revert
_assertTransientStateVariables({
_operation: Enum.Operation(uint8(0)),
_existingOwnersHash: bytes32(0),
_existingThreshold: 0,
_existingFallbackHandler: address(0),
_inSafeExecTransaction: false,
_inModuleExecTransaction: false,
_initialNonce: 0,
_checkTransactionCounter: 0
});
}

function test_revert_inModuleExecTransaction(bytes32 _txHash, bool _success)
public
inSafeExecTransaction(true)
inModuleExecTransaction(true)
{
// should revert because we are not inside a Safe execTransaction call
vm.expectRevert(IHatsSignerGate.NoReentryAllowed.selector);
harness.exposed_checkAfterExecution(_txHash, _success);

// transient state should be cleared after revert
_assertTransientStateVariables({
_operation: Enum.Operation(uint8(0)),
_existingOwnersHash: bytes32(0),
_existingThreshold: 0,
_existingFallbackHandler: address(0),
_inSafeExecTransaction: false,
_inModuleExecTransaction: false,
_initialNonce: 0,
_checkTransactionCounter: 0
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

@@ -106,6 +106,7 @@ contract SafeManagerLib_EncodingActions is Test {
contract SafeManagerLib_ExecutingActions is WithHSGHarnessInstanceTest {
/// @dev Since execSafeTransactionFromHSG is called by all the other exec* functions, we rely on tests for those
/// functions to verify that execSafeTransactionFromHSG is working correctly.
// TODO: add test for execSafeTransactionFromHSG
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#82.

Fixes issues: #8

Comment on lines +190 to +191
// the transaction should revert
vm.expectRevert(SafeManagerLib.SafeTransactionFailed.selector);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#82.

Fixes issues: #8

Comment on lines +1025 to +1026
bool _inSafeExecTransaction,
bool _inModuleExecTransaction,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

uint256 _initialNonce,
uint256 _entrancyCounter
uint256 _checkTransactionCounter
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +1030 to +1044
{
assertEq(uint8(harness.operation()), uint8(_operation), "operation should be set");
assertEq(harness.inSafeExecTransaction(), _inSafeExecTransaction, "inSafeExecTransaction should be set");
assertEq(harness.inModuleExecTransaction(), _inModuleExecTransaction, "inModuleExecTransaction should be set");
assertEq(harness.initialNonce(), _initialNonce, "initial nonce should be set");
assertEq(harness.checkTransactionCounter(), _checkTransactionCounter, "checkTransactionCounter should be set");
if (_operation == Enum.Operation.DelegateCall) {
assertEq(harness.existingOwnersHash(), _existingOwnersHash, "existing owners hash should be set");
assertEq(harness.existingThreshold(), _existingThreshold, "existing threshold should be set");
assertEq(harness.existingFallbackHandler(), _existingFallbackHandler, "existing fallback handler should be set");
} else {
assertEq(harness.existingOwnersHash(), bytes32(0), "existing owners hash should be empty");
assertEq(harness.existingThreshold(), 0, "existing threshold should be empty");
assertEq(harness.existingFallbackHandler(), address(0), "existing fallback handler should be empty");
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +1063 to +1074

/// @dev Forces the value of the `_inSafeExecTransaction` transient variable
modifier inSafeExecTransaction(bool _inSafeExecTransaction) {
harness.setInSafeExecTransaction(_inSafeExecTransaction);
_;
}

/// @dev Forces the value of the `_inModuleExecTransaction` transient variable
modifier inModuleExecTransaction(bool _inModuleExecTransaction) {
harness.setInModuleExecTransaction(_inModuleExecTransaction);
_;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +34 to +35
bool public inModuleExecTransaction;
bool public inSafeExecTransaction;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

uint256 public initialNonce;
uint256 public entrancyCounter;
uint256 public checkTransactionCounter;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +55 to +62
function setInModuleExecTransaction(bool inModuleExecTransaction_) public {
_inModuleExecTransaction = inModuleExecTransaction_;
}

function setInSafeExecTransaction(bool inSafeExecTransaction_) public {
_inSafeExecTransaction = inSafeExecTransaction_;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +163 to +168
function exposed_inModuleExecTransaction() public view returns (bool) {
return _inModuleExecTransaction;
}

function exposed_inSafeExecTransaction() public view returns (bool) {
return _inSafeExecTransaction;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +175 to +176
function exposed_checkTransactionCounter() public view returns (uint256) {
return _checkTransactionCounter;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Comment on lines +200 to +201
inModuleExecTransaction = _inModuleExecTransaction;
inSafeExecTransaction = _inSafeExecTransaction;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

initialNonce = _initialNonce;
entrancyCounter = _entrancyCounter;
checkTransactionCounter = _checkTransactionCounter;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

@@ -31,11 +31,12 @@ contract TestGuard is BaseGuard {
executionDisallowed = true;
}

/// @dev Modified to remove the operation restriction
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

function checkTransaction(
address to,
uint256 value,
bytes memory data,
Enum.Operation operation,
Enum.Operation, /* operation */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

@@ -47,7 +48,7 @@ contract TestGuard is BaseGuard {
require(to != address(0), "Cannot send to zero address");
require(value != 1337, "Cannot send 1337");
require(bytes3(data) != bytes3(0xbaddad), "Cannot call 0xbaddad");
require(operation != Enum.Operation(1), "No delegate calls");
// require(operation != Enum.Operation(1), "No delegate calls");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change related to Hats-Protocol/hats-zodiac#81.

Fixes issues: #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant