From 54244cc95c58f9d1ac7e51429d0b720db73f0534 Mon Sep 17 00:00:00 2001 From: derpy-duck <115193320+derpy-duck@users.noreply.github.com> Date: Thu, 2 Mar 2023 21:51:21 +0000 Subject: [PATCH] WIP --- .../coreRelayer/CoreRelayerDelivery.sol | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/ethereum/contracts/coreRelayer/CoreRelayerDelivery.sol b/ethereum/contracts/coreRelayer/CoreRelayerDelivery.sol index 5c04a59..b7aa9f8 100644 --- a/ethereum/contracts/coreRelayer/CoreRelayerDelivery.sol +++ b/ethereum/contracts/coreRelayer/CoreRelayerDelivery.sol @@ -292,9 +292,8 @@ contract CoreRelayerDelivery is CoreRelayerGovernance { // - the permissioned address allowed to execute this redelivery instruction is the permissioned address allowed to execute the old instruction valid = checkRedeliveryInstructionTarget(redeliveryInstruction, originalInstruction); - // Emit an 'Invalid Redelivery' event if one of the following five checks failed: - // - msg.sender is the permissioned address allowed to execute this redelivery instruction - // - the redelivery instruction's target chain = this chain + // Emit an 'Invalid Redelivery' event if one of the following four checks failed: + // - the permissioned address allowed to execute this redelivery instruction is the permissioned address allowed to execute the old instruction // - the original instruction's target chain = this chain // - the new redelivery instruction's 'receiver value' amount >= the original instruction's 'receiver value' amount // - the new redelivery instruction's upper bound on gas >= the original instruction's upper bound on gas @@ -345,9 +344,16 @@ contract CoreRelayerDelivery is CoreRelayerGovernance { ) internal view returns (bool isValid) { address providerAddress = fromWormholeFormat(redeliveryInstruction.executionParameters.providerDeliveryAddress); - // Check that the permissioned address allowed to execute this redelivery instruction is the permissioned address allowed to execute the old instruction - if ((providerAddress != fromWormholeFormat(originalInstruction.executionParameters.providerDeliveryAddress))) { - revert IDelivery.MismatchingRelayProvidersInRedelivery(); + // Check that msg.sender is the permissioned address allowed to execute this redelivery instruction + if (providerAddress != msg.sender) { + revert IDelivery.UnexpectedRelayer(); + } + + uint16 whChainId = chainId(); + + // Check that the redelivery instruction's target chain = this chain + if (whChainId != redeliveryInstruction.targetChain) { + revert IDelivery.TargetChainIsNotThisChain(redeliveryInstruction.targetChain); } uint256 wormholeMessageFee = wormhole().messageFee(); @@ -361,12 +367,8 @@ contract CoreRelayerDelivery is CoreRelayerGovernance { revert IDelivery.InsufficientRelayerFunds(); } - uint16 whChainId = chainId(); - - // Check that msg.sender is the permissioned address allowed to execute this redelivery instruction - isValid = msg.sender == providerAddress - // Check that the redelivery instruction's target chain = this chain - && whChainId == redeliveryInstruction.targetChain + // Check that the permissioned address allowed to execute this redelivery instruction is the permissioned address allowed to execute the old instruction + isValid = (providerAddress == fromWormholeFormat(originalInstruction.executionParameters.providerDeliveryAddress)) // Check that the original instruction's target chain = this chain && whChainId == originalInstruction.targetChain // Check that the new redelivery instruction's 'receiver value' amount >= the original instruction's 'receiver value' amount