Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add fix for checking for correct messageId in OPL2ToL1Ism and ArbL2ToL1Ism via external call #4437

Merged
merged 29 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
minor edits
  • Loading branch information
aroralanuk committed Sep 18, 2024
commit ac3613e132d21ca580dbbb56306e2c407e63001b
7 changes: 2 additions & 5 deletions solidity/test/isms/ArbL2ToL1Ism.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,12 @@ contract ArbL2ToL1IsmTest is ExternalBridgeTest {
MockArbBridge internal arbBridge;

function setUp() public override {
ORIGIN_DOMAIN = 42161;
DESTINATION_DOMAIN = 1;
GAS_QUOTE = 120_000;
super.setUp();

// Arbitrum bridge mock setup
GAS_QUOTE = 120_000;
vm.etch(L2_ARBSYS_ADDRESS, address(new MockArbSys()).code);

deployAll();
super.setUp();
}

///////////////////////////////////////////////////////////////////
Expand Down
5 changes: 1 addition & 4 deletions solidity/test/isms/ERC5164ISM.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ contract ERC5164IsmTest is ExternalBridgeTest {
///////////////////////////////////////////////////////////////////

function setUp() public override {
ORIGIN_DOMAIN = 1;
DESTINATION_DOMAIN = 2;
super.setUp();

dispatcher = new MockMessageDispatcher();
executor = new MockMessageExecutor();
originMailbox = new TestMailbox(ORIGIN_DOMAIN);
Expand All @@ -56,6 +52,7 @@ contract ERC5164IsmTest is ExternalBridgeTest {
address(dispatcher)
);
ism.setAuthorizedHook(TypeCasts.addressToBytes32(address(hook)));
super.setUp();
}

///////////////////////////////////////////////////////////////////
Expand Down
18 changes: 5 additions & 13 deletions solidity/test/isms/ExternalBridgeTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ abstract contract ExternalBridgeTest is Test {
using MessageUtils for bytes;

uint8 internal constant HYPERLANE_VERSION = 1;
uint32 internal ORIGIN_DOMAIN;
uint32 internal DESTINATION_DOMAIN;
uint32 internal constant ORIGIN_DOMAIN = 1;
uint32 internal constant DESTINATION_DOMAIN = 2;
uint256 internal GAS_QUOTE;

bytes internal unauthorizedHookError;
Expand Down Expand Up @@ -52,13 +52,9 @@ abstract contract ExternalBridgeTest is Test {
}

function test_postDispatch_revertWhen_chainIDNotSupported() public {
bytes memory message = MessageUtils.formatMessage(
0,
uint32(0),
DESTINATION_DOMAIN,
bytes memory message = originMailbox.buildOutboundMessage(
3,
TypeCasts.addressToBytes32(address(this)),
3, // wrong domain
TypeCasts.addressToBytes32(address(testRecipient)),
testMessage
);

Expand Down Expand Up @@ -223,11 +219,7 @@ abstract contract ExternalBridgeTest is Test {

function _encodeTestMessage() internal view returns (bytes memory) {
return
MessageUtils.formatMessage(
HYPERLANE_VERSION,
uint32(0),
ORIGIN_DOMAIN,
TypeCasts.addressToBytes32(address(this)),
originMailbox.buildOutboundMessage(
DESTINATION_DOMAIN,
TypeCasts.addressToBytes32(address(testRecipient)),
testMessage
Expand Down
7 changes: 2 additions & 5 deletions solidity/test/isms/OPL2ToL1Ism.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,15 @@ contract OPL2ToL1IsmTest is ExternalBridgeTest {
///////////////////////////////////////////////////////////////////

function setUp() public override {
ORIGIN_DOMAIN = 10;
DESTINATION_DOMAIN = 1;
GAS_QUOTE = 120_000;
super.setUp();

// Optimism messenger mock setup
GAS_QUOTE = 120_000;
vm.etch(
L2_MESSENGER_ADDRESS,
address(new MockOptimismMessenger()).code
);

deployAll();
super.setUp();
}

function deployHook() public {
Expand Down
4 changes: 1 addition & 3 deletions solidity/test/isms/OPStackIsm.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ contract OPStackIsmTest is ExternalBridgeTest {
event ReceivedMessage(bytes32 indexed messageId);

function setUp() public override {
ORIGIN_DOMAIN = 1;
DESTINATION_DOMAIN = 10;
GAS_QUOTE = 1_920_000; // optimism subsidized gas limit
super.setUp();

vm.etch(
L1_MESSENGER_ADDRESS,
Expand All @@ -66,6 +63,7 @@ contract OPStackIsmTest is ExternalBridgeTest {
l2Messenger = MockOptimismMessenger(L2_MESSENGER_ADDRESS);

deployAll();
super.setUp();
}

///////////////////////////////////////////////////////////////////
Expand Down
Loading