forge fmt'

This commit is contained in:
derpy-duck 2023-03-01 23:22:44 +00:00 committed by chase-45
parent 81cb32981a
commit 27cbbc7804
4 changed files with 58 additions and 70 deletions

View File

@ -196,7 +196,7 @@ contract CoreRelayer is CoreRelayerDelivery {
if (nonce == 0) { if (nonce == 0) {
revert IWormholeRelayer.NonceIsZero(); revert IWormholeRelayer.NonceIsZero();
} }
if(sendContainer.requests.length == 0) { if (sendContainer.requests.length == 0) {
revert IWormholeRelayer.MultichainSendEmpty(); revert IWormholeRelayer.MultichainSendEmpty();
} }
@ -255,7 +255,7 @@ contract CoreRelayer is CoreRelayerDelivery {
if (msg.sender != lockedTargetAddress()) { if (msg.sender != lockedTargetAddress()) {
revert IWormholeRelayer.ForwardRequestFromWrongAddress(); revert IWormholeRelayer.ForwardRequestFromWrongAddress();
} }
if(sendContainer.requests.length == 0) { if (sendContainer.requests.length == 0) {
revert IWormholeRelayer.MultichainSendEmpty(); revert IWormholeRelayer.MultichainSendEmpty();
} }

View File

@ -27,14 +27,14 @@ contract CoreRelayerDelivery is CoreRelayerGovernance {
/** /**
* - Checks if enough funds were passed into a forward * - Checks if enough funds were passed into a forward
* - Increases the maxTransactionFee of the first forward in the MultichainSend container * - Increases the maxTransactionFee of the first forward in the MultichainSend container
* in order to use all of the funds * in order to use all of the funds
* - Publishes the DeliveryInstruction, with a 'sufficientlyFunded' flag indicating whether the forward had enough funds * - Publishes the DeliveryInstruction, with a 'sufficientlyFunded' flag indicating whether the forward had enough funds
* - If the forward was funded, pay the relayer's reward address to deliver the forward * - If the forward was funded, pay the relayer's reward address to deliver the forward
* *
* @param transactionFeeRefundAmount amount of maxTransactionFee that was unused * @param transactionFeeRefundAmount amount of maxTransactionFee that was unused
* @param forwardInstruction A struct containing information about the user's forward/multichainForward request * @param forwardInstruction A struct containing information about the user's forward/multichainForward request
* *
* @return forwardIsFunded whether or not the funds for the forward were enough * @return forwardIsFunded whether or not the funds for the forward were enough
*/ */
function emitForward(uint256 transactionFeeRefundAmount, ForwardInstruction memory forwardInstruction) function emitForward(uint256 transactionFeeRefundAmount, ForwardInstruction memory forwardInstruction)
@ -43,18 +43,17 @@ contract CoreRelayerDelivery is CoreRelayerGovernance {
{ {
DeliveryInstructionsContainer memory container = forwardInstruction.container; DeliveryInstructionsContainer memory container = forwardInstruction.container;
// Add any additional funds which were passed in to the forward as msg.value // Add any additional funds which were passed in to the forward as msg.value
transactionFeeRefundAmount = transactionFeeRefundAmount + forwardInstruction.msgValue; transactionFeeRefundAmount = transactionFeeRefundAmount + forwardInstruction.msgValue;
// Checks if enough funds were passed into the forward // Checks if enough funds were passed into the forward
forwardIsFunded = (transactionFeeRefundAmount >= forwardInstruction.totalFee); forwardIsFunded = (transactionFeeRefundAmount >= forwardInstruction.totalFee);
IRelayProvider relayProvider = IRelayProvider(forwardInstruction.relayProvider); IRelayProvider relayProvider = IRelayProvider(forwardInstruction.relayProvider);
IWormhole wormhole = wormhole(); IWormhole wormhole = wormhole();
uint256 wormholeMessageFee = wormhole.messageFee(); uint256 wormholeMessageFee = wormhole.messageFee();
// Increases the maxTransactionFee of the first forward in the MultichainSend container // Increases the maxTransactionFee of the first forward in the MultichainSend container
// in order to use all of the funds // in order to use all of the funds
if (forwardIsFunded) { if (forwardIsFunded) {
uint256 amountUnderMaximum = relayProvider.quoteMaximumBudget(container.instructions[0].targetChain) uint256 amountUnderMaximum = relayProvider.quoteMaximumBudget(container.instructions[0].targetChain)
@ -92,16 +91,16 @@ contract CoreRelayerDelivery is CoreRelayerGovernance {
* Performs the following actions: * Performs the following actions:
* - Calls the 'receiveWormholeMessages' endpoint on the contract 'internalInstruction.targetAddress' * - Calls the 'receiveWormholeMessages' endpoint on the contract 'internalInstruction.targetAddress'
* (with the gas limit and value specified in internalInstruction, and 'encodedVMs' as the input) * (with the gas limit and value specified in internalInstruction, and 'encodedVMs' as the input)
* *
* - Calculates how much of 'maxTransactionFee' is left * - Calculates how much of 'maxTransactionFee' is left
* - If the call succeeded and during execution of 'receiveWormholeMessages' there was a forward/multichainForward, then: * - If the call succeeded and during execution of 'receiveWormholeMessages' there was a forward/multichainForward, then:
* if there is enough 'maxTransactionFee' left to execute the forward, then execute the forward * if there is enough 'maxTransactionFee' left to execute the forward, then execute the forward
* else emit the forward instruction but with a flag (sufficientlyFunded = false) indicating that it wasn't paid for * else emit the forward instruction but with a flag (sufficientlyFunded = false) indicating that it wasn't paid for
* - else: * - else:
* refund any of the 'maxTransactionFee' not used to internalInstruction.refundAddress * refund any of the 'maxTransactionFee' not used to internalInstruction.refundAddress
* if the call reverted, refund the 'receiverValue' to internalInstruction.refundAddress * if the call reverted, refund the 'receiverValue' to internalInstruction.refundAddress
* - refund anything leftover to the relayer * - refund anything leftover to the relayer
* *
* @param internalInstruction instruction to execute * @param internalInstruction instruction to execute
* @param encodedVMs list of signed wormhole messages (VAAs) * @param encodedVMs list of signed wormhole messages (VAAs)
* @param deliveryVaaHash hash of delivery VAA * @param deliveryVaaHash hash of delivery VAA
@ -117,7 +116,6 @@ contract CoreRelayerDelivery is CoreRelayerGovernance {
uint16 sourceChain, uint16 sourceChain,
uint64 sourceSequence uint64 sourceSequence
) internal { ) internal {
// lock the contract to prevent reentrancy // lock the contract to prevent reentrancy
if (isContractLocked()) { if (isContractLocked()) {
revert IDelivery.ReentrantCall(); revert IDelivery.ReentrantCall();
@ -204,14 +202,14 @@ contract CoreRelayerDelivery is CoreRelayerGovernance {
/** /**
* @notice The relay provider calls 'redeliverSingle' to relay messages as described by one redelivery instruction * @notice The relay provider calls 'redeliverSingle' to relay messages as described by one redelivery instruction
* *
* The instruction specifies, among other things, the target chain (must be this chain), refund address, new maximum refund (in this chain's currency), * The instruction specifies, among other things, the target chain (must be this chain), refund address, new maximum refund (in this chain's currency),
* new receiverValue (in this chain's currency), new upper bound on gas * new receiverValue (in this chain's currency), new upper bound on gas
* *
* The relay provider must pass in the original signed wormhole messages from the source chain of the same nonce * The relay provider must pass in the original signed wormhole messages from the source chain of the same nonce
* (the wormhole message with the original delivery instructions (the delivery VAA) must be one of these messages) * (the wormhole message with the original delivery instructions (the delivery VAA) must be one of these messages)
* as well as the wormhole message with the new redelivery instruction (the redelivery VAA) * as well as the wormhole message with the new redelivery instruction (the redelivery VAA)
* *
* The messages will be relayed to the target address (with the specified gas limit and receiver value) iff the following checks are met: * The messages will be relayed to the target address (with the specified gas limit and receiver value) iff the following checks are met:
* - the redelivery VAA (targetParams.redeliveryVM) has a valid signature * - the redelivery VAA (targetParams.redeliveryVM) has a valid signature
* - the redelivery VAA's emitter is one of these CoreRelayer contracts * - the redelivery VAA's emitter is one of these CoreRelayer contracts
@ -221,14 +219,13 @@ contract CoreRelayerDelivery is CoreRelayerGovernance {
* - the new redelivery instruction's 'receiver value' amount >= the original instruction's 'receiver value' amount * - the new redelivery instruction's 'receiver value' amount >= the original instruction's 'receiver value' amount
* - the redelivery instruction's target chain = this chain * - the redelivery instruction's target chain = this chain
* - the original instruction's target chain = this chain * - the original instruction's target chain = this chain
* - for the redelivery instruction, the relay provider passed in at least [(one wormhole message fee) + instruction.newMaximumRefundTarget + instruction.newReceiverValueTarget] of this chain's currency as msg.value * - for the redelivery instruction, the relay provider passed in at least [(one wormhole message fee) + instruction.newMaximumRefundTarget + instruction.newReceiverValueTarget] of this chain's currency as msg.value
* - msg.sender is the permissioned address allowed to execute this redelivery instruction * - msg.sender is the permissioned address allowed to execute this redelivery instruction
* - the permissioned address allowed to execute this redelivery instruction is the permissioned address allowed to execute the old instruction * - the permissioned address allowed to execute this redelivery instruction is the permissioned address allowed to execute the old instruction
* *
* @param targetParams struct containing the signed wormhole messages and encoded redelivery instruction (and other information) * @param targetParams struct containing the signed wormhole messages and encoded redelivery instruction (and other information)
*/ */
function redeliverSingle(IDelivery.TargetRedeliveryByTxHashParamsSingle memory targetParams) public payable { function redeliverSingle(IDelivery.TargetRedeliveryByTxHashParamsSingle memory targetParams) public payable {
IWormhole wormhole = wormhole(); IWormhole wormhole = wormhole();
(IWormhole.VM memory redeliveryVM, bool valid, string memory reason) = (IWormhole.VM memory redeliveryVM, bool valid, string memory reason) =
@ -246,7 +243,7 @@ contract CoreRelayerDelivery is CoreRelayerGovernance {
RedeliveryByTxHashInstruction memory redeliveryInstruction = decodeRedeliveryInstruction(redeliveryVM.payload); RedeliveryByTxHashInstruction memory redeliveryInstruction = decodeRedeliveryInstruction(redeliveryVM.payload);
// Obtain the original delivery VAA // Obtain the original delivery VAA
IWormhole.VM memory originalDeliveryVM; IWormhole.VM memory originalDeliveryVM;
(originalDeliveryVM, valid, reason) = (originalDeliveryVM, valid, reason) =
wormhole.parseAndVerifyVM(targetParams.sourceEncodedVMs[redeliveryInstruction.deliveryIndex]); wormhole.parseAndVerifyVM(targetParams.sourceEncodedVMs[redeliveryInstruction.deliveryIndex]);
@ -264,20 +261,18 @@ contract CoreRelayerDelivery is CoreRelayerGovernance {
// Obtain the specific old instruction that was originally executed (and is meant to be re-executed with new parameters) // Obtain the specific old instruction that was originally executed (and is meant to be re-executed with new parameters)
// specifying the the target chain (must be this chain), target address, refund address, old maximum refund (in this chain's currency), // specifying the the target chain (must be this chain), target address, refund address, old maximum refund (in this chain's currency),
// old receiverValue (in this chain's currency), old upper bound on gas, and the permissioned address allowed to execute this instruction // old receiverValue (in this chain's currency), old upper bound on gas, and the permissioned address allowed to execute this instruction
DeliveryInstruction memory originalInstruction = decodeDeliveryInstructionsContainer(originalDeliveryVM.payload).instructions[redeliveryInstruction DeliveryInstruction memory originalInstruction = decodeDeliveryInstructionsContainer(originalDeliveryVM.payload)
.multisendIndex]; .instructions[redeliveryInstruction.multisendIndex];
// Perform the following checks: // Perform the following checks:
// - the new redelivery instruction's upper bound on gas >= the original instruction's upper bound on gas // - the new redelivery instruction's upper bound on gas >= the original instruction's upper bound on gas
// - the new redelivery instruction's 'receiver value' amount >= the original instruction's 'receiver value' amount // - the new redelivery instruction's 'receiver value' amount >= the original instruction's 'receiver value' amount
// - the redelivery instruction's target chain = this chain // - the redelivery instruction's target chain = this chain
// - the original instruction's target chain = this chain // - the original instruction's target chain = this chain
// - for the redelivery instruction, the relay provider passed in at least [(one wormhole message fee) + instruction.newMaximumRefundTarget + instruction.newReceiverValueTarget] of this chain's currency as msg.value // - for the redelivery instruction, the relay provider passed in at least [(one wormhole message fee) + instruction.newMaximumRefundTarget + instruction.newReceiverValueTarget] of this chain's currency as msg.value
// - msg.sender is the permissioned address allowed to execute this redelivery instruction // - msg.sender is the permissioned address allowed to execute this redelivery instruction
// - the permissioned address allowed to execute this redelivery instruction is the permissioned address allowed to execute the old instruction // - the permissioned address allowed to execute this redelivery instruction is the permissioned address allowed to execute the old instruction
valid = checkRedeliveryInstructionTarget( valid = checkRedeliveryInstructionTarget(redeliveryInstruction, originalInstruction);
redeliveryInstruction, originalInstruction
);
// Emit an 'Invalid Redelivery' event if one of the following five checks failed: // 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 // - msg.sender is the permissioned address allowed to execute this redelivery instruction
@ -297,7 +292,7 @@ contract CoreRelayerDelivery is CoreRelayerGovernance {
return; return;
} }
// Replace maximumRefund, receiverValue, and the gasLimit on the original request // Replace maximumRefund, receiverValue, and the gasLimit on the original request
originalInstruction.maximumRefundTarget = redeliveryInstruction.newMaximumRefundTarget; originalInstruction.maximumRefundTarget = redeliveryInstruction.newMaximumRefundTarget;
originalInstruction.receiverValueTarget = redeliveryInstruction.newReceiverValueTarget; originalInstruction.receiverValueTarget = redeliveryInstruction.newReceiverValueTarget;
originalInstruction.executionParameters = redeliveryInstruction.executionParameters; originalInstruction.executionParameters = redeliveryInstruction.executionParameters;
@ -318,9 +313,9 @@ contract CoreRelayerDelivery is CoreRelayerGovernance {
* - the new redelivery instruction's 'receiver value' amount >= the original instruction's 'receiver value' amount * - the new redelivery instruction's 'receiver value' amount >= the original instruction's 'receiver value' amount
* - the redelivery instruction's target chain = this chain * - the redelivery instruction's target chain = this chain
* - the original instruction's target chain = this chain * - the original instruction's target chain = this chain
* - for the redelivery instruction, the relay provider passed in at least [(one wormhole message fee) + instruction.newMaximumRefundTarget + instruction.newReceiverValueTarget] of this chain's currency as msg.value * - for the redelivery instruction, the relay provider passed in at least [(one wormhole message fee) + instruction.newMaximumRefundTarget + instruction.newReceiverValueTarget] of this chain's currency as msg.value
* - msg.sender is the permissioned address allowed to execute this redelivery instruction * - msg.sender is the permissioned address allowed to execute this redelivery instruction
* - the permissioned address allowed to execute this redelivery instruction is the permissioned address allowed to execute the old instruction * - the permissioned address allowed to execute this redelivery instruction is the permissioned address allowed to execute the old instruction
* @param redeliveryInstruction redelivery instruction * @param redeliveryInstruction redelivery instruction
* @param originalInstruction old instruction * @param originalInstruction old instruction
*/ */
@ -328,17 +323,16 @@ contract CoreRelayerDelivery is CoreRelayerGovernance {
RedeliveryByTxHashInstruction memory redeliveryInstruction, RedeliveryByTxHashInstruction memory redeliveryInstruction,
DeliveryInstruction memory originalInstruction DeliveryInstruction memory originalInstruction
) internal view returns (bool isValid) { ) internal view returns (bool isValid) {
address providerAddress = fromWormholeFormat(redeliveryInstruction.executionParameters.providerDeliveryAddress); 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 // 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))) { if ((providerAddress != fromWormholeFormat(originalInstruction.executionParameters.providerDeliveryAddress))) {
revert IDelivery.MismatchingRelayProvidersInRedelivery(); revert IDelivery.MismatchingRelayProvidersInRedelivery();
} }
uint256 wormholeMessageFee = wormhole().messageFee(); uint256 wormholeMessageFee = wormhole().messageFee();
// Check that for the redelivery instruction, the relay provider passed in at least [(one wormhole message fee) + instruction.newMaximumRefundTarget + instruction.newReceiverValueTarget] of this chain's currency as msg.value // Check that for the redelivery instruction, the relay provider passed in at least [(one wormhole message fee) + instruction.newMaximumRefundTarget + instruction.newReceiverValueTarget] of this chain's currency as msg.value
if ( if (
msg.value msg.value
< redeliveryInstruction.newMaximumRefundTarget + redeliveryInstruction.newReceiverValueTarget < redeliveryInstruction.newMaximumRefundTarget + redeliveryInstruction.newReceiverValueTarget
@ -348,48 +342,43 @@ contract CoreRelayerDelivery is CoreRelayerGovernance {
} }
uint16 whChainId = chainId(); uint16 whChainId = chainId();
// Check that msg.sender is the permissioned address allowed to execute this redelivery instruction // Check that msg.sender is the permissioned address allowed to execute this redelivery instruction
isValid = msg.sender == providerAddress isValid = msg.sender == providerAddress
// Check that the redelivery instruction's target chain = this chain // Check that the redelivery instruction's target chain = this chain
&& whChainId == redeliveryInstruction.targetChain && whChainId == redeliveryInstruction.targetChain
// Check that the original instruction's target chain = this chain // Check that the original instruction's target chain = this chain
&& whChainId == originalInstruction.targetChain && whChainId == originalInstruction.targetChain
// Check that the new redelivery instruction's 'receiver value' amount >= the original instruction's 'receiver value' amount // Check that the new redelivery instruction's 'receiver value' amount >= the original instruction's 'receiver value' amount
&& originalInstruction.receiverValueTarget <= redeliveryInstruction.newReceiverValueTarget && originalInstruction.receiverValueTarget <= redeliveryInstruction.newReceiverValueTarget
// Check that the new redelivery instruction's upper bound on gas >= the original instruction's upper bound on gas // Check that the new redelivery instruction's upper bound on gas >= the original instruction's upper bound on gas
&& originalInstruction.executionParameters.gasLimit <= redeliveryInstruction.executionParameters.gasLimit; && originalInstruction.executionParameters.gasLimit <= redeliveryInstruction.executionParameters.gasLimit;
} }
/** /**
* @notice The relay provider calls 'deliverSingle' to relay messages as described by one delivery instruction * @notice The relay provider calls 'deliverSingle' to relay messages as described by one delivery instruction
* *
* The instruction specifies the target chain (must be this chain), target address, refund address, maximum refund (in this chain's currency), * The instruction specifies the target chain (must be this chain), target address, refund address, maximum refund (in this chain's currency),
* receiver value (in this chain's currency), upper bound on gas, and the permissioned address allowed to execute this instruction * receiver value (in this chain's currency), upper bound on gas, and the permissioned address allowed to execute this instruction
* *
* The relay provider must pass in the signed wormhole messages (VAAs) from the source chain of the same nonce * The relay provider must pass in the signed wormhole messages (VAAs) from the source chain of the same nonce
* (the wormhole message with the delivery instructions (the delivery VAA) must be one of these messages) * (the wormhole message with the delivery instructions (the delivery VAA) must be one of these messages)
* as well as identify which of these messages is the delivery VAA and which of the many instructions in the multichainSend container is meant to be executed * as well as identify which of these messages is the delivery VAA and which of the many instructions in the multichainSend container is meant to be executed
* *
* The messages will be relayed to the target address (with the specified gas limit and receiver value) iff the following checks are met: * The messages will be relayed to the target address (with the specified gas limit and receiver value) iff the following checks are met:
* - the delivery VAA has a valid signature * - the delivery VAA has a valid signature
* - the delivery VAA's emitter is one of these CoreRelayer contracts * - the delivery VAA's emitter is one of these CoreRelayer contracts
* - the delivery instruction container in the delivery VAA was fully funded * - the delivery instruction container in the delivery VAA was fully funded
* - the instruction's target chain is this chain * - the instruction's target chain is this chain
* - the relay provider passed in at least [(one wormhole message fee) + instruction.maximumRefundTarget + instruction.receiverValueTarget] of this chain's currency as msg.value * - the relay provider passed in at least [(one wormhole message fee) + instruction.maximumRefundTarget + instruction.receiverValueTarget] of this chain's currency as msg.value
* - msg.sender is the permissioned address allowed to execute this instruction * - msg.sender is the permissioned address allowed to execute this instruction
* *
* @param targetParams struct containing the signed wormhole messages and encoded delivery instruction container (and other information) * @param targetParams struct containing the signed wormhole messages and encoded delivery instruction container (and other information)
*/ */
function deliverSingle(IDelivery.TargetDeliveryParametersSingle memory targetParams) public payable { function deliverSingle(IDelivery.TargetDeliveryParametersSingle memory targetParams) public payable {
IWormhole wormhole = wormhole(); IWormhole wormhole = wormhole();
// Obtain the delivery VAA // Obtain the delivery VAA
(IWormhole.VM memory deliveryVM, bool valid, string memory reason) = (IWormhole.VM memory deliveryVM, bool valid, string memory reason) =
wormhole.parseAndVerifyVM(targetParams.encodedVMs[targetParams.deliveryIndex]); wormhole.parseAndVerifyVM(targetParams.encodedVMs[targetParams.deliveryIndex]);

View File

@ -131,10 +131,10 @@ contract CoreRelayerMessages is CoreRelayerStructs, CoreRelayerGetters {
* @param instruction A RedeliveryByTxHashInstruction * @param instruction A RedeliveryByTxHashInstruction
* @param relayProvider The relayProvider whos maximum budget we are checking against * @param relayProvider The relayProvider whos maximum budget we are checking against
*/ */
function checkRedeliveryInstruction( function checkRedeliveryInstruction(RedeliveryByTxHashInstruction memory instruction, IRelayProvider relayProvider)
RedeliveryByTxHashInstruction memory instruction, internal
IRelayProvider relayProvider view
) internal view { {
if (instruction.executionParameters.gasLimit == 0) { if (instruction.executionParameters.gasLimit == 0) {
revert IWormholeRelayer.MaxTransactionFeeNotEnough(0); revert IWormholeRelayer.MaxTransactionFeeNotEnough(0);
} }

View File

@ -4,11 +4,10 @@
pragma solidity ^0.8.0; pragma solidity ^0.8.0;
interface IDelivery { interface IDelivery {
/** /**
* @notice TargetDeliveryParametersSingle is the struct that the relay provider passes into 'deliverSingle' * @notice TargetDeliveryParametersSingle is the struct that the relay provider passes into 'deliverSingle'
* containing an array of the signed wormhole messages that are to be relayed * containing an array of the signed wormhole messages that are to be relayed
* *
* @custom:member encodedVMs An array of signed wormhole messages (all of the same nonce, and from the same source chain transaction) * @custom:member encodedVMs An array of signed wormhole messages (all of the same nonce, and from the same source chain transaction)
* @custom:member deliveryIndex index such that encodedVMs[deliveryIndex] is the signed wormhole message from the source chain's CoreRelayer contract with payload being the encoded delivery instruction container * @custom:member deliveryIndex index such that encodedVMs[deliveryIndex] is the signed wormhole message from the source chain's CoreRelayer contract with payload being the encoded delivery instruction container
* @custom:member multisendIndex The delivery instruction container at 'encodedVMs[deliveryIndex]' contains many delivery instructions, each specifying a different destination address * @custom:member multisendIndex The delivery instruction container at 'encodedVMs[deliveryIndex]' contains many delivery instructions, each specifying a different destination address
@ -21,33 +20,33 @@ interface IDelivery {
uint8 multisendIndex; uint8 multisendIndex;
address payable relayerRefundAddress; address payable relayerRefundAddress;
} }
/** /**
* @notice The relay provider calls 'deliverSingle' to relay messages as described by one delivery instruction * @notice The relay provider calls 'deliverSingle' to relay messages as described by one delivery instruction
* *
* The instruction specifies the target chain (must be this chain), target address, refund address, maximum refund (in this chain's currency), * The instruction specifies the target chain (must be this chain), target address, refund address, maximum refund (in this chain's currency),
* receiver value (in this chain's currency), upper bound on gas, and the permissioned address allowed to execute this instruction * receiver value (in this chain's currency), upper bound on gas, and the permissioned address allowed to execute this instruction
* *
* The relay provider must pass in the signed wormhole messages (VAAs) from the source chain of the same nonce * The relay provider must pass in the signed wormhole messages (VAAs) from the source chain of the same nonce
* (the wormhole message with the delivery instructions (the delivery VAA) must be one of these messages) * (the wormhole message with the delivery instructions (the delivery VAA) must be one of these messages)
* as well as identify which of these messages is the delivery VAA and which of the many instructions in the multichainSend container is meant to be executed * as well as identify which of these messages is the delivery VAA and which of the many instructions in the multichainSend container is meant to be executed
* *
* The messages will be relayed to the target address (with the specified gas limit and receiver value) iff the following checks are met: * The messages will be relayed to the target address (with the specified gas limit and receiver value) iff the following checks are met:
* - the delivery VAA has a valid signature * - the delivery VAA has a valid signature
* - the delivery VAA's emitter is one of these CoreRelayer contracts * - the delivery VAA's emitter is one of these CoreRelayer contracts
* - the delivery instruction container in the delivery VAA was fully funded * - the delivery instruction container in the delivery VAA was fully funded
* - the instruction's target chain is this chain * - the instruction's target chain is this chain
* - the relay provider passed in at least [(one wormhole message fee) + instruction.maximumRefundTarget + instruction.receiverValueTarget] of this chain's currency as msg.value * - the relay provider passed in at least [(one wormhole message fee) + instruction.maximumRefundTarget + instruction.receiverValueTarget] of this chain's currency as msg.value
* - msg.sender is the permissioned address allowed to execute this instruction * - msg.sender is the permissioned address allowed to execute this instruction
* *
* @param targetParams struct containing the signed wormhole messages and encoded delivery instruction container (and other information) * @param targetParams struct containing the signed wormhole messages and encoded delivery instruction container (and other information)
*/ */
function deliverSingle(TargetDeliveryParametersSingle memory targetParams) external payable; function deliverSingle(TargetDeliveryParametersSingle memory targetParams) external payable;
/** /**
* @notice TargetRedeliveryByTxHashParamsSingle is the struct that the relay provider passes into 'redeliverSingle' * @notice TargetRedeliveryByTxHashParamsSingle is the struct that the relay provider passes into 'redeliverSingle'
* containing an array of the signed wormhole messages that are to be relayed * containing an array of the signed wormhole messages that are to be relayed
* *
* @custom:member redeliveryVM The signed wormhole message from the source chain's CoreRelayer contract with payload being the encoded redelivery instruction * @custom:member redeliveryVM The signed wormhole message from the source chain's CoreRelayer contract with payload being the encoded redelivery instruction
* @custom:member sourceEncodedVMs An array of signed wormhole messages (all of the same nonce, and from the same source chain transaction), which are the original messages that are meant to be redelivered * @custom:member sourceEncodedVMs An array of signed wormhole messages (all of the same nonce, and from the same source chain transaction), which are the original messages that are meant to be redelivered
* @custom:member relayerRefundAddress The address to which any refunds to the relay provider should be sent * @custom:member relayerRefundAddress The address to which any refunds to the relay provider should be sent
@ -60,14 +59,14 @@ interface IDelivery {
/** /**
* @notice The relay provider calls 'redeliverSingle' to relay messages as described by one redelivery instruction * @notice The relay provider calls 'redeliverSingle' to relay messages as described by one redelivery instruction
* *
* The instruction specifies, among other things, the target chain (must be this chain), refund address, new maximum refund (in this chain's currency), * The instruction specifies, among other things, the target chain (must be this chain), refund address, new maximum refund (in this chain's currency),
* new receiverValue (in this chain's currency), new upper bound on gas * new receiverValue (in this chain's currency), new upper bound on gas
* *
* The relay provider must pass in the original signed wormhole messages from the source chain of the same nonce * The relay provider must pass in the original signed wormhole messages from the source chain of the same nonce
* (the wormhole message with the original delivery instructions (the delivery VAA) must be one of these messages) * (the wormhole message with the original delivery instructions (the delivery VAA) must be one of these messages)
* as well as the wormhole message with the new redelivery instruction (the redelivery VAA) * as well as the wormhole message with the new redelivery instruction (the redelivery VAA)
* *
* The messages will be relayed to the target address (with the specified gas limit and receiver value) iff the following checks are met: * The messages will be relayed to the target address (with the specified gas limit and receiver value) iff the following checks are met:
* - the redelivery VAA (targetParams.redeliveryVM) has a valid signature * - the redelivery VAA (targetParams.redeliveryVM) has a valid signature
* - the redelivery VAA's emitter is one of these CoreRelayer contracts * - the redelivery VAA's emitter is one of these CoreRelayer contracts
@ -76,23 +75,23 @@ interface IDelivery {
* - the new redelivery instruction's upper bound on gas >= the original instruction's upper bound on gas * - the new redelivery instruction's upper bound on gas >= the original instruction's upper bound on gas
* - the new redelivery instruction's 'receiver value' amount >= the original instruction's 'receiver value' amount * - the new redelivery instruction's 'receiver value' amount >= the original instruction's 'receiver value' amount
* - the redelivery instruction's target chain = the original instruction's target chain = this chain * - the redelivery instruction's target chain = the original instruction's target chain = this chain
* - for the redelivery instruction, the relay provider passed in at least [(one wormhole message fee) + instruction.newMaximumRefundTarget + instruction.newReceiverValueTarget] of this chain's currency as msg.value * - for the redelivery instruction, the relay provider passed in at least [(one wormhole message fee) + instruction.newMaximumRefundTarget + instruction.newReceiverValueTarget] of this chain's currency as msg.value
* - msg.sender is the permissioned address allowed to execute this redelivery instruction * - msg.sender is the permissioned address allowed to execute this redelivery instruction
* - msg.sender is the permissioned address allowed to execute the old instruction * - msg.sender is the permissioned address allowed to execute the old instruction
* *
* @param targetParams struct containing the signed wormhole messages and encoded redelivery instruction (and other information) * @param targetParams struct containing the signed wormhole messages and encoded redelivery instruction (and other information)
*/ */
function redeliverSingle(TargetRedeliveryByTxHashParamsSingle memory targetParams) external payable; function redeliverSingle(TargetRedeliveryByTxHashParamsSingle memory targetParams) external payable;
error InvalidEmitterInRedeliveryVM(); // The redelivery VAA (signed wormhole message with redelivery instructions) has an invalid sender error InvalidEmitterInRedeliveryVM(); // The redelivery VAA (signed wormhole message with redelivery instructions) has an invalid sender
error InvalidEmitterInOriginalDeliveryVM(uint8 index); // The original delivery VAA (original signed wormhole message with delivery instructions) has an invalid sender error InvalidEmitterInOriginalDeliveryVM(uint8 index); // The original delivery VAA (original signed wormhole message with delivery instructions) has an invalid sender
error InvalidRedeliveryVM(string reason); // The redelivery VAA is not valid error InvalidRedeliveryVM(string reason); // The redelivery VAA is not valid
error InvalidVaa(uint8 index, string reason); // The VAA is not valid error InvalidVaa(uint8 index, string reason); // The VAA is not valid
error MismatchingRelayProvidersInRedelivery(); // The relay provider specified for the redelivery is different from the relay provider specified for the original delivery error MismatchingRelayProvidersInRedelivery(); // The relay provider specified for the redelivery is different from the relay provider specified for the original delivery
error UnexpectedRelayer(); // msg.sender must be the delivery address of the specified relay provider error UnexpectedRelayer(); // msg.sender must be the delivery address of the specified relay provider
error InvalidEmitter(); // The delivery VAA (signed wormhole message with delivery instructions) has an invalid sender error InvalidEmitter(); // The delivery VAA (signed wormhole message with delivery instructions) has an invalid sender
error SendNotSufficientlyFunded(); // The container of delivery instructions (for which this current delivery was in) was not fully funded on the source chain error SendNotSufficientlyFunded(); // The container of delivery instructions (for which this current delivery was in) was not fully funded on the source chain
error InsufficientRelayerFunds(); // The relay provider didn't pass in sufficient funds (msg.value does not cover the necessary budget fees) error InsufficientRelayerFunds(); // The relay provider didn't pass in sufficient funds (msg.value does not cover the necessary budget fees)
error TargetChainIsNotThisChain(uint16 targetChainId); // The specified target chain is not the current chain error TargetChainIsNotThisChain(uint16 targetChainId); // The specified target chain is not the current chain
error ReentrantCall(); // A delivery cannot occur during another delivery error ReentrantCall(); // A delivery cannot occur during another delivery
} }