diff --git a/src/testing/bridges/AMBBridgeTesting.sol b/src/testing/bridges/AMBBridgeTesting.sol index 32c3cec..0340e7d 100644 --- a/src/testing/bridges/AMBBridgeTesting.sol +++ b/src/testing/bridges/AMBBridgeTesting.sol @@ -71,7 +71,7 @@ library AMBBridgeTesting { return bridge; } - function relayMessagesToDestination(Bridge memory bridge, bool switchToDestinationFork) internal { + function relayMessagesToDestination(Bridge storage bridge, bool switchToDestinationFork) internal { bridge.destination.selectFork(); Vm.Log[] memory logs = bridge.ingestAndFilterLogs(true, USER_REQUEST_FOR_AFFIRMATION_TOPIC, USER_REQUEST_FOR_SIGNATURE_TOPIC, bridge.sourceCrossChainMessenger); @@ -82,7 +82,7 @@ library AMBBridgeTesting { } } - function relayMessagesToSource(Bridge memory bridge, bool switchToSourceFork) internal { + function relayMessagesToSource(Bridge storage bridge, bool switchToSourceFork) internal { bridge.source.selectFork(); Vm.Log[] memory logs = bridge.ingestAndFilterLogs(false, USER_REQUEST_FOR_AFFIRMATION_TOPIC, USER_REQUEST_FOR_SIGNATURE_TOPIC, bridge.destinationCrossChainMessenger); diff --git a/src/testing/bridges/ArbitrumBridgeTesting.sol b/src/testing/bridges/ArbitrumBridgeTesting.sol index 0046b88..4ab8ece 100644 --- a/src/testing/bridges/ArbitrumBridgeTesting.sol +++ b/src/testing/bridges/ArbitrumBridgeTesting.sol @@ -122,7 +122,7 @@ library ArbitrumBridgeTesting { return bridge; } - function relayMessagesToDestination(Bridge memory bridge, bool switchToDestinationFork) internal { + function relayMessagesToDestination(Bridge storage bridge, bool switchToDestinationFork) internal { bridge.destination.selectFork(); Vm.Log[] memory logs = RecordedLogs.getLogs(); @@ -149,7 +149,7 @@ library ArbitrumBridgeTesting { } } - function relayMessagesToSource(Bridge memory bridge, bool switchToSourceFork) internal { + function relayMessagesToSource(Bridge storage bridge, bool switchToSourceFork) internal { bridge.source.selectFork(); Vm.Log[] memory logs = bridge.ingestAndFilterLogs(false, SEND_TO_L1_TOPIC, bridge.destinationCrossChainMessenger); diff --git a/src/testing/bridges/CCTPBridgeTesting.sol b/src/testing/bridges/CCTPBridgeTesting.sol index bc91f6d..5a90714 100644 --- a/src/testing/bridges/CCTPBridgeTesting.sol +++ b/src/testing/bridges/CCTPBridgeTesting.sol @@ -71,7 +71,7 @@ library CCTPBridgeTesting { return bridge; } - function relayMessagesToDestination(Bridge memory bridge, bool switchToDestinationFork) internal { + function relayMessagesToDestination(Bridge storage bridge, bool switchToDestinationFork) internal { bridge.destination.selectFork(); Vm.Log[] memory logs = bridge.ingestAndFilterLogs(true, SENT_MESSAGE_TOPIC, bridge.sourceCrossChainMessenger); @@ -84,7 +84,7 @@ library CCTPBridgeTesting { } } - function relayMessagesToSource(Bridge memory bridge, bool switchToSourceFork) internal { + function relayMessagesToSource(Bridge storage bridge, bool switchToSourceFork) internal { bridge.source.selectFork(); Vm.Log[] memory logs = bridge.ingestAndFilterLogs(false, SENT_MESSAGE_TOPIC, bridge.destinationCrossChainMessenger); diff --git a/src/testing/bridges/OptimismBridgeTesting.sol b/src/testing/bridges/OptimismBridgeTesting.sol index 4e3fbee..7823e6f 100644 --- a/src/testing/bridges/OptimismBridgeTesting.sol +++ b/src/testing/bridges/OptimismBridgeTesting.sol @@ -78,7 +78,7 @@ library OptimismBridgeTesting { return bridge; } - function relayMessagesToDestination(Bridge memory bridge, bool switchToDestinationFork) internal { + function relayMessagesToDestination(Bridge storage bridge, bool switchToDestinationFork) internal { bridge.destination.selectFork(); address malias; @@ -100,7 +100,7 @@ library OptimismBridgeTesting { } } - function relayMessagesToSource(Bridge memory bridge, bool switchToSourceFork) internal { + function relayMessagesToSource(Bridge storage bridge, bool switchToSourceFork) internal { bridge.source.selectFork(); Vm.Log[] memory logs = bridge.ingestAndFilterLogs(false, SENT_MESSAGE_TOPIC, bridge.destinationCrossChainMessenger); diff --git a/src/testing/utils/RecordedLogs.sol b/src/testing/utils/RecordedLogs.sol index 0658f33..1ff477d 100644 --- a/src/testing/utils/RecordedLogs.sol +++ b/src/testing/utils/RecordedLogs.sol @@ -33,7 +33,7 @@ library RecordedLogs { return logs; } - function ingestAndFilterLogs(Bridge memory bridge, bool sourceToDestination, bytes32 topic0, bytes32 topic1, address emitter) internal returns (Vm.Log[] memory filteredLogs) { + function ingestAndFilterLogs(Bridge storage bridge, bool sourceToDestination, bytes32 topic0, bytes32 topic1, address emitter) internal returns (Vm.Log[] memory filteredLogs) { Vm.Log[] memory logs = RecordedLogs.getLogs(); uint256 lastIndex = sourceToDestination ? bridge.lastSourceLogIndex : bridge.lastDestinationLogIndex; uint256 pushedIndex = 0; @@ -53,7 +53,7 @@ library RecordedLogs { assembly { mstore(filteredLogs, pushedIndex) } } - function ingestAndFilterLogs(Bridge memory bridge, bool sourceToDestination, bytes32 topic, address emitter) internal returns (Vm.Log[] memory filteredLogs) { + function ingestAndFilterLogs(Bridge storage bridge, bool sourceToDestination, bytes32 topic, address emitter) internal returns (Vm.Log[] memory filteredLogs) { return ingestAndFilterLogs(bridge, sourceToDestination, topic, bytes32(0), emitter); } diff --git a/test/IntegrationBase.t.sol b/test/IntegrationBase.t.sol index 2f40cc9..aa16544 100644 --- a/test/IntegrationBase.t.sol +++ b/test/IntegrationBase.t.sol @@ -105,6 +105,16 @@ abstract contract IntegrationBaseTest is Test { assertEq(moSource.length(), 2); assertEq(moSource.messages(0), 3); assertEq(moSource.messages(1), 4); + + // One more message to destination + vm.startPrank(sourceAuthority); + queueSourceToDestination(abi.encodeCall(MessageOrdering.push, (5))); + vm.stopPrank(); + + relaySourceToDestination(); + + assertEq(moDestination.length(), 3); + assertEq(moDestination.messages(2), 5); } function initSourceReceiver() internal virtual returns (address);