From 979bb56a8b749df3300b605d525f1fac9419ce91 Mon Sep 17 00:00:00 2001 From: howydev <132113803+howydev@users.noreply.github.com> Date: Mon, 22 Apr 2024 12:17:57 -0400 Subject: [PATCH 1/2] fix: failing tests --- test/comparison/CompareSimpleAccount.t.sol | 2 +- test/plugin/TokenReceiverPlugin.t.sol | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/test/comparison/CompareSimpleAccount.t.sol b/test/comparison/CompareSimpleAccount.t.sol index 1179dac3..93b75ebe 100644 --- a/test/comparison/CompareSimpleAccount.t.sol +++ b/test/comparison/CompareSimpleAccount.t.sol @@ -39,7 +39,7 @@ contract CompareSimpleAccountTest is Test { // helper function to compress 2 gas values into a single bytes32 function _encodeGas(uint256 g1, uint256 g2) internal pure returns (bytes32) { - return bytes32(uint256(g1 << 128 + uint128(g2))); + return bytes32(uint256((g1 << 128) + uint128(g2))); } function setUp() public { diff --git a/test/plugin/TokenReceiverPlugin.t.sol b/test/plugin/TokenReceiverPlugin.t.sol index add51384..7a7433af 100644 --- a/test/plugin/TokenReceiverPlugin.t.sol +++ b/test/plugin/TokenReceiverPlugin.t.sol @@ -75,12 +75,24 @@ contract TokenReceiverPluginTest is OptimizedTest, IERC1155Receiver { } function test_failERC1155Transfer() public { - // for 1155, reverts are caught in a try catch and bubbled up with a diff reason - vm.expectRevert("ERC1155: transfer to non-ERC1155Receiver implementer"); + // for 1155, reverts are caught in a try catch and bubbled up with the reason from the account + vm.expectRevert( + abi.encodePacked( + UpgradeableModularAccount.UnrecognizedFunction.selector, + IERC1155Receiver.onERC1155Received.selector, + bytes28(0) + ) + ); t1.safeTransferFrom(address(this), address(acct), _TOKEN_ID, _TOKEN_AMOUNT, ""); - // for 1155, reverts are caught in a try catch and bubbled up with a diff reason - vm.expectRevert("ERC1155: transfer to non-ERC1155Receiver implementer"); + // for 1155, reverts are caught in a try catch and bubbled up with the reason from the account + vm.expectRevert( + abi.encodePacked( + UpgradeableModularAccount.UnrecognizedFunction.selector, + IERC1155Receiver.onERC1155BatchReceived.selector, + bytes28(0) + ) + ); t1.safeBatchTransferFrom(address(this), address(acct), tokenIds, tokenAmts, ""); } From 747639d950e867551feb0c18b9e7af35842538d9 Mon Sep 17 00:00:00 2001 From: howydev <132113803+howydev@users.noreply.github.com> Date: Tue, 23 Apr 2024 14:02:09 -0400 Subject: [PATCH 2/2] fix: failing test --- test/utils/AccountTestBase.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/utils/AccountTestBase.sol b/test/utils/AccountTestBase.sol index e23ed1ee..5d9880f9 100644 --- a/test/utils/AccountTestBase.sol +++ b/test/utils/AccountTestBase.sol @@ -42,6 +42,6 @@ abstract contract AccountTestBase is OptimizedTest { // helper function to compress 2 gas values into a single bytes32 function _encodeGas(uint256 g1, uint256 g2) internal pure returns (bytes32) { - return bytes32(uint256(g1 << 128 + uint128(g2))); + return bytes32(uint256((g1 << 128) + uint128(g2))); } }