Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
test(contracts): fix tests to new input encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
guidanoli committed Aug 16, 2023
1 parent 799c86f commit 50acf2d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 22 deletions.
16 changes: 2 additions & 14 deletions onchain/rollups/test/foundry/portals/ERC20Portal.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,7 @@ contract ERC20PortalTest is Test {
token = new NormalToken(_amount);

// Construct the ERC-20 deposit input
bytes memory input = abi.encodePacked(
true,
token,
alice,
_amount,
_data
);
bytes memory input = abi.encode(true, token, alice, _amount, _data);

// Transfer ERC-20 tokens to Alice and start impersonating her
require(token.transfer(alice, _amount), "token transfer fail");
Expand Down Expand Up @@ -167,13 +161,7 @@ contract ERC20PortalTest is Test {
token = new UntransferableToken(_amount);

// Construct the ERC-20 deposit input
bytes memory input = abi.encodePacked(
false,
token,
alice,
_amount,
_data
);
bytes memory input = abi.encode(false, token, alice, _amount, _data);

// Start impersonating Alice
vm.startPrank(alice);
Expand Down
15 changes: 9 additions & 6 deletions onchain/rollups/test/foundry/portals/ERC721Portal.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,12 @@ contract ERC721PortalTest is Test {
token = new NormalToken(alice, _tokenId);

// Construct the ERC-721 deposit input
bytes memory input = abi.encodePacked(
bytes memory input = abi.encode(
token,
alice,
_tokenId,
abi.encode(_baseLayerData, _execLayerData)
_baseLayerData,
_execLayerData
);

// Start impersonating Alice
Expand Down Expand Up @@ -184,11 +185,12 @@ contract ERC721PortalTest is Test {
token = new NormalToken(alice, _tokenId);

// Construct the ERC-721 deposit input
bytes memory input = abi.encodePacked(
bytes memory input = abi.encode(
token,
alice,
_tokenId,
abi.encode(_baseLayerData, _execLayerData)
_baseLayerData,
_execLayerData
);

// Start impersonating Alice
Expand Down Expand Up @@ -301,11 +303,12 @@ contract ERC721PortalTest is Test {
token = new NormalToken(alice, _tokenId);

// Construct the ERC-721 deposit input
bytes memory input = abi.encodePacked(
bytes memory input = abi.encode(
token,
alice,
_tokenId,
abi.encode(_baseLayerData, _execLayerData)
_baseLayerData,
_execLayerData
);

// Start impersonating Alice
Expand Down
2 changes: 1 addition & 1 deletion onchain/rollups/test/foundry/portals/EtherPortal.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ contract EtherPortalTest is Test {

function testEtherDeposit(uint256 value, bytes calldata data) public {
// Construct the Ether deposit input
bytes memory input = abi.encodePacked(alice, value, data);
bytes memory input = abi.encode(alice, value, data);

// Transfer Ether to Alice and start impersonating her
startHoax(alice, value);
Expand Down
2 changes: 1 addition & 1 deletion onchain/rollups/test/foundry/relays/DAppAddressRelay.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ contract DAppAddressRelayTest is Test {
assertEq(inputBox.getNumberOfInputs(_dapp), 0);

// Construct the DApp address relay input
bytes memory input = abi.encodePacked(_dapp);
bytes memory input = abi.encode(_dapp);

// Expect InputAdded to be emitted with the right arguments
vm.expectEmit(true, true, false, true, address(inputBox));
Expand Down

0 comments on commit 50acf2d

Please sign in to comment.