Skip to content

Commit

Permalink
[#4] Add test case: Non-enabled module should not be able to execute …
Browse files Browse the repository at this point in the history
…root tx
  • Loading branch information
akshay-ap committed Jun 26, 2023
1 parent 97fea95 commit eec4486
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .solcover.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
skipFiles: ['test/TestExecutor.sol', 'test/TestModule.sol']
skipFiles: ['test/TestExecutor.sol', 'test/TestModule.sol', 'test/TestDelegateCallReceiver.sol']
};
20 changes: 20 additions & 0 deletions test/SafeProtocolMediator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,25 @@ describe("SafeProtocolMediator", async () => {
.to.emit(safeProtocolMediator, "RootAccessActionExecuted")
.withArgs(await safe.getAddress(), safeTx.metaHash);
});

it("Should not allow non-enabled module to execute root tx from a safe", async () => {
const { safeProtocolMediator, safe } = await loadFixture(deployContractsFixture);
const module = await (await hre.ethers.getContractFactory("TestModuleWithRootAccess")).deploy();
// TODO: Replace with builder function
const safeTx = {
action: {
to: user2.address,
value: hre.ethers.parseEther("1"),
data: "0x",
},
nonce: 1,
metaHash: hre.ethers.randomBytes(32),
};

await expect(module.executeFromModule(safeProtocolMediator, safe, safeTx)).to.be.revertedWithCustomError(
safeProtocolMediator,
"MoudleNotEnabled",
);
});
});
});

0 comments on commit eec4486

Please sign in to comment.