Skip to content

Commit

Permalink
[FIX] Fixed overriden changes [DONE]
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronnieraj37 committed Nov 20, 2024
1 parent c88da45 commit 3098def
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 26 deletions.
3 changes: 1 addition & 2 deletions solidity/src/AccessRegistry/AccessRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,8 @@ abstract contract AccessRegistry is Context, SuperAdmin2Step, FallbackAdmin2Step
}

function _removeSigner(address _signer) internal {
if (_signer == address(0)) revert CallerZeroAddress();
if (!isSigner(_signer)) revert NonExistingSigner();
if (_signer == superAdmin()) revert SuperAdminCannotRemoved();
if (_signer == _msgSender()) revert SuperAdminCannotRemoved();
if (totalSigners() == 1) revert WalletCannotBeSignerLess();
signers[_signer] = false;
assembly {
Expand Down
6 changes: 0 additions & 6 deletions solidity/src/OptimisticStack/OptimismMintableERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ contract OptimismMintableERC20 is IOptimismMintableERC20, ILegacyMintableERC20,
require(isAuthorizedBridge(_msgSender()), "OptimismMintableERC20: caller is not an authorized bridge");
_;
}
* @notice A modifier that restricts function access to authorized bridges only
*/
modifier onlyAuthorizedBridge() {
require(isAuthorizedBridge(_msgSender()), "OptimismMintableERC20: caller is not an authorized bridge");
_;
}

/**
* @custom:semver 1.0.0
Expand Down
40 changes: 22 additions & 18 deletions solidity/test/MultiSig.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ contract MultiSigContractTest is StdInvariant, Test {

// vm.expectRevert(MultiSigWallet.UnauthorizedCall.selector);
// vm.prank(fallbackAdmin);
// wrappedMultiSig.approveTransaction(txId);

vm.prank(superAdmin);
wrappedMultiSig.approveBatchTransaction(txId);
Expand Down Expand Up @@ -329,7 +328,6 @@ contract MultiSigContractTest is StdInvariant, Test {
txId = wrappedMultiSig.createBatchTransaction(selectors, params);

// Approve and wait for activation period
// wrappedMultiSig.approveTransaction(txId);
vm.stopPrank();

vm.prank(signer1);
Expand Down Expand Up @@ -395,7 +393,6 @@ contract MultiSigContractTest is StdInvariant, Test {

// vm.expectRevert(MultiSigWallet.InvalidState.selector);
// vm.prank(signer2);
// wrappedMultiSig.approveTransaction(txId);
}

function test_fallbackAdminBurnTransaction() public {
Expand All @@ -411,7 +408,6 @@ contract MultiSigContractTest is StdInvariant, Test {
txId = wrappedMultiSig.createBatchTransaction(selectors, params);

// Approve and wait for activation period
// wrappedMultiSig.approveTransaction(txId);
vm.stopPrank();

vm.prank(signer1);
Expand Down Expand Up @@ -601,13 +597,11 @@ contract MultiSigContractTest is StdInvariant, Test {

function test_TransactionCancellationDueToLackOfApprovals() public {
test_AddSigner();

bytes4 pauseSelector = bytes4(keccak256("pause()"));
vm.startPrank(signer1);
uint256 txId = createPauseTransaction();
uint256[] memory txId = createPauseTransaction();

// Approve partially
wrappedMultiSig.approveTransaction(txId);
wrappedMultiSig.approveBatchTransaction(txId);
vm.stopPrank();

// Advance time beyond expiration
Expand All @@ -616,7 +610,7 @@ contract MultiSigContractTest is StdInvariant, Test {
// Attempt to execute and expect failure due to insufficient approvals
vm.startPrank(fallbackAdmin);
vm.expectRevert();
wrappedMultiSig.executeTransaction(txId);
wrappedMultiSig.executeBatchTransaction(txId);
}

function test_InitializeOnlyOnce() public {
Expand Down Expand Up @@ -678,7 +672,9 @@ contract MultiSigContractTest is StdInvariant, Test {

// Attempt approval after renouncing (should fail)
vm.expectRevert();
wrappedMultiSig.approveTransaction(1);
uint256[] memory txIds = new uint256[](1);
txIds[0] = 1;
wrappedMultiSig.approveBatchTransaction(txIds);
vm.stopPrank();
}

Expand All @@ -694,28 +690,29 @@ contract MultiSigContractTest is StdInvariant, Test {
test_AddSigner();
vm.startPrank(address(0xDEADBEEF)); // A non-signer
vm.expectRevert();
wrappedMultiSig.approveTransaction(1);
uint256[] memory txIds = new uint256[](1);
txIds[0] = 1;
wrappedMultiSig.approveBatchTransaction(txIds);
vm.stopPrank();
}

function test_ExecuteTransaction_InsufficientApprovals() public {
test_AddSigner();
vm.startPrank(signer1);
uint256 txId = createPauseTransaction();
uint256[] memory txId = createPauseTransaction();
vm.expectRevert();
wrappedMultiSig.executeTransaction(txId);
wrappedMultiSig.executeBatchTransaction(txId);
vm.stopPrank();
}

function test_TransactionExpiration() public {
test_AddSigner();
vm.startPrank(signer1);
uint256 txId = createPauseTransaction();

wrappedMultiSig.approveTransaction(txId);
uint256[] memory txId = createPauseTransaction();
wrappedMultiSig.approveBatchTransaction(txId);
vm.warp(block.timestamp + 7 days + 1); // Fast-forward past expiration
wrappedMultiSig.updateTransactionState(txId);
(,,,,,, MultiSigWallet.TransactionState state,) = wrappedMultiSig.getTransaction(txId);
wrappedMultiSig.updateTransactionState(txId[0]);
(,,,,,, MultiSigWallet.TransactionState state,) = wrappedMultiSig.getTransaction(txId[0]);
assertEq(uint8(state), uint8(MultiSigWallet.TransactionState.Expired));
vm.stopPrank();
}
Expand Down Expand Up @@ -806,6 +803,13 @@ contract MultiSigContractTest is StdInvariant, Test {
console.log("Gas used", gasBefore - gasAfter);
}

function createPauseTransaction() public returns (uint256[] memory) {
selectors = [PAUSE_STATE_SELECTOR];
params = [abi.encode(2)];
uint256[] memory trnx = wrappedMultiSig.createBatchTransaction(selectors, params);
return trnx;
}

// function test_CreateTransaction() public {
// address to = address(1223);

Expand Down

0 comments on commit 3098def

Please sign in to comment.