From 0f991cc0e40dac7a12e2b52fc3574a6715f2556d Mon Sep 17 00:00:00 2001 From: Francesco Dainese Date: Thu, 25 Apr 2024 16:59:22 +0200 Subject: [PATCH] fix(Forwarder): add forwardMessage mock in tests --- tests/BaseCCForwarder.t.sol | 5 ++++ tests/Forwarder.t.sol | 48 ++++++++++++++++++------------------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/tests/BaseCCForwarder.t.sol b/tests/BaseCCForwarder.t.sol index 1951faaf..d44f0ed6 100644 --- a/tests/BaseCCForwarder.t.sol +++ b/tests/BaseCCForwarder.t.sol @@ -239,6 +239,11 @@ contract BaseCCForwarderTest is BaseTest, CrossChainForwarder { abi.encodeWithSelector(IBaseAdapter.setupPayments.selector), abi.encode() ); + vm.mockCall( + address(currentChainBridgeAdapter), + abi.encodeWithSelector(IBaseAdapter.forwardMessage.selector), + abi.encode() + ); _enableBridgeAdapters(bridgeAdaptersInfo); } diff --git a/tests/Forwarder.t.sol b/tests/Forwarder.t.sol index 18d1a0e0..4a54bf80 100644 --- a/tests/Forwarder.t.sol +++ b/tests/Forwarder.t.sol @@ -74,30 +74,30 @@ contract ForwarderTest is BaseCCForwarderTest { _validateForwardMessageWhenAtLeastOneAdapterWorking(extendedTx); } - // function testRetryEnvelope( - // address destination, - // address origin, - // uint256 destinationChainId, - // address owner, - // uint256 envelopeNonce - // ) - // public - // executeAsOwner(owner) - // enableBridgeAdaptersForPath(destinationChainId, 5, AdapterSuccessType.ALL_SUCCESS) - // { - // ExtendedTransaction memory extendedTx = _generateExtendedTransaction( - // TestParams({ - // destination: destination, - // origin: origin, - // originChainId: block.chainid, - // destinationChainId: destinationChainId, - // envelopeNonce: envelopeNonce, - // transactionNonce: _currentTransactionNonce - // }) - // ); - // _registerEnvelope(extendedTx); - // _validateRetryEnvelopeSuccessful(extendedTx); - // } + function testRetryEnvelope( + address destination, + address origin, + uint256 destinationChainId, + address owner, + uint256 envelopeNonce + ) + public + executeAsOwner(owner) + enableBridgeAdaptersForPath(destinationChainId, 5, AdapterSuccessType.ALL_SUCCESS) + { + ExtendedTransaction memory extendedTx = _generateExtendedTransaction( + TestParams({ + destination: destination, + origin: origin, + originChainId: block.chainid, + destinationChainId: destinationChainId, + envelopeNonce: envelopeNonce, + transactionNonce: _currentTransactionNonce + }) + ); + _registerEnvelope(extendedTx); + _validateRetryEnvelopeSuccessful(extendedTx); + } function testRetryEnvelopeWhenNoAdapters( address destination,