Skip to content

Commit

Permalink
wrong rules list length test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipp Makarov authored and Filipp Makarov committed Jan 15, 2024
1 parent 2118575 commit 5df0325
Showing 1 changed file with 3 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ describe("SessionKey: ABI Session Validation Module", async () => {
sessionKeyData7,
ethers.utils.hexZeroPad(ethers.utils.hexlify(0), 2), // offset is uint16, so there can't be more than 2**16/32 args = 2**11
ethers.utils.hexZeroPad(ethers.utils.hexlify(0), 1), // condition uint8
ethers.utils.hexZeroPad(mockProtocol.address, 32),
ethers.utils.hexZeroPad(charlie.address, 32),
]);

const leafData7 = ethers.utils.hexConcat([
Expand Down Expand Up @@ -716,22 +716,13 @@ describe("SessionKey: ABI Session Validation Module", async () => {
ethers.utils.keccak256(approvePermissionLeafData)
)
);

const charlieTokenBalanceBefore = await mockToken.balanceOf(
charlie.address
);

await expect(
entryPoint.handleOps([approveUserOp], alice.address, {
gasLimit: 10000000,
})
)
.to.be.revertedWith("FailedOp")
.withArgs(0, "AA23 reverted: ABISV Arg Rule Violated");

expect(await mockToken.balanceOf(charlie.address)).to.equal(
charlieTokenBalanceBefore
);
});

it("Reverts Rule condition == 1 (less than or equal) is violated", async () => {
Expand Down Expand Up @@ -1048,7 +1039,7 @@ describe("SessionKey: ABI Session Validation Module", async () => {
mockToken.address,
ethers.utils.parseEther("0"),
IERC20.interface.encodeFunctionData("approve", [
bob.address, // should be equal to charlie but it is not
charlie.address,
tokenAmountToApprove,
]),
],
Expand All @@ -1065,21 +1056,13 @@ describe("SessionKey: ABI Session Validation Module", async () => {
)
);

const charlieTokenBalanceBefore = await mockToken.balanceOf(
charlie.address
);

await expect(
entryPoint.handleOps([approveUserOp], alice.address, {
gasLimit: 10000000,
})
)
.to.be.revertedWith("FailedOp")
.withArgs(0, "AA23 reverted: ABISV Arg Rule Violated");

expect(await mockToken.balanceOf(charlie.address)).to.equal(
charlieTokenBalanceBefore
);
.withArgs(0, "AA23 reverted (or OOG)");
});
});
});

0 comments on commit 5df0325

Please sign in to comment.