relayer: allow override target chain refund (#3430)
* refund address handling improvement * fix compilation error * Remove unnecessary line * restrict to view * fix comment * Improve handling of gas limits * get test to pass - check that the return data is appropriately long before decoding * modification to checking inequality * modification to checking inequality - use unchecked * clean functions around - add untrustedBaseDeliveryPrice * make quote_length_bytes a constant * seperate pay into two overloads * change inequality to equality for checking return data length * renaming functions * allow override of refund per gas unused * test modification * note
This commit is contained in:
parent
4e588fe119
commit
bebcf281e6
|
@ -380,7 +380,6 @@ interface IWormholeRelayerSend is IWormholeRelayerBase {
|
|||
* @notice *** This will only be able to succeed if the following is true **
|
||||
* - newGasLimit >= gas limit of the old instruction
|
||||
* - newReceiverValue >= receiver value of the old instruction
|
||||
* - newDeliveryProvider's `targetChainRefundPerGasUnused` >= old relay provider's `targetChainRefundPerGasUnused`
|
||||
*/
|
||||
function resendToEvm(
|
||||
VaaKey memory deliveryVaaKey,
|
||||
|
@ -427,7 +426,10 @@ interface IWormholeRelayerSend is IWormholeRelayerBase {
|
|||
* @param gasLimit gas limit with which to call `targetAddress`.
|
||||
* @return nativePriceQuote Price, in units of current chain currency, that the delivery provider charges to perform the relay
|
||||
* @return targetChainRefundPerGasUnused amount of target chain currency that will be refunded per unit of gas unused,
|
||||
* if a refundAddress is specified
|
||||
* if a refundAddress is specified.
|
||||
* Note: This value can be overridden by the delivery provider on the target chain. The returned value here should be considered to be a
|
||||
* promise by the delivery provider of the amount of refund per gas unused that will be returned to the refundAddress at the target chain.
|
||||
* If a delivery provider decides to override, this will be visible as part of the emitted Delivery event on the target chain.
|
||||
*/
|
||||
function quoteEVMDeliveryPrice(
|
||||
uint16 targetChain,
|
||||
|
@ -445,6 +447,9 @@ interface IWormholeRelayerSend is IWormholeRelayerBase {
|
|||
* @return nativePriceQuote Price, in units of current chain currency, that the delivery provider charges to perform the relay
|
||||
* @return targetChainRefundPerGasUnused amount of target chain currency that will be refunded per unit of gas unused,
|
||||
* if a refundAddress is specified
|
||||
* Note: This value can be overridden by the delivery provider on the target chain. The returned value here should be considered to be a
|
||||
* promise by the delivery provider of the amount of refund per gas unused that will be returned to the refundAddress at the target chain.
|
||||
* If a delivery provider decides to override, this will be visible as part of the emitted Delivery event on the target chain.
|
||||
*/
|
||||
function quoteEVMDeliveryPrice(
|
||||
uint16 targetChain,
|
||||
|
|
|
@ -382,7 +382,6 @@ interface IWormholeRelayerSend is IWormholeRelayerBase {
|
|||
* @notice *** This will only be able to succeed if the following is true **
|
||||
* - newGasLimit >= gas limit of the old instruction
|
||||
* - newReceiverValue >= receiver value of the old instruction
|
||||
* - newDeliveryProvider's `targetChainRefundPerGasUnused` >= old relay provider's `targetChainRefundPerGasUnused`
|
||||
*/
|
||||
function resendToEvm(
|
||||
VaaKey memory deliveryVaaKey,
|
||||
|
@ -429,7 +428,10 @@ interface IWormholeRelayerSend is IWormholeRelayerBase {
|
|||
* @param gasLimit gas limit with which to call `targetAddress`.
|
||||
* @return nativePriceQuote Price, in units of current chain currency, that the delivery provider charges to perform the relay
|
||||
* @return targetChainRefundPerGasUnused amount of target chain currency that will be refunded per unit of gas unused,
|
||||
* if a refundAddress is specified
|
||||
* if a refundAddress is specified.
|
||||
* Note: This value can be overridden by the delivery provider on the target chain. The returned value here should be considered to be a
|
||||
* promise by the delivery provider of the amount of refund per gas unused that will be returned to the refundAddress at the target chain.
|
||||
* If a delivery provider decides to override, this will be visible as part of the emitted Delivery event on the target chain.
|
||||
*/
|
||||
function quoteEVMDeliveryPrice(
|
||||
uint16 targetChain,
|
||||
|
@ -447,6 +449,9 @@ interface IWormholeRelayerSend is IWormholeRelayerBase {
|
|||
* @return nativePriceQuote Price, in units of current chain currency, that the delivery provider charges to perform the relay
|
||||
* @return targetChainRefundPerGasUnused amount of target chain currency that will be refunded per unit of gas unused,
|
||||
* if a refundAddress is specified
|
||||
* Note: This value can be overridden by the delivery provider on the target chain. The returned value here should be considered to be a
|
||||
* promise by the delivery provider of the amount of refund per gas unused that will be returned to the refundAddress at the target chain.
|
||||
* If a delivery provider decides to override, this will be visible as part of the emitted Delivery event on the target chain.
|
||||
*/
|
||||
function quoteEVMDeliveryPrice(
|
||||
uint16 targetChain,
|
||||
|
|
|
@ -12,7 +12,6 @@ import {
|
|||
VaaKeysDoNotMatchVaas,
|
||||
InvalidOverrideGasLimit,
|
||||
InvalidOverrideReceiverValue,
|
||||
InvalidOverrideRefundPerGasUnused,
|
||||
RequesterNotWormholeRelayer,
|
||||
DeliveryProviderCannotReceivePayment,
|
||||
MessageKey,
|
||||
|
@ -219,12 +218,6 @@ abstract contract WormholeRelayerDelivery is WormholeRelayerBase, IWormholeRelay
|
|||
decodeEvmExecutionInfoV1(deliveryOverrides.newExecutionInfo);
|
||||
deliveryOverridesReceiverValue = deliveryOverrides.newReceiverValue;
|
||||
|
||||
if (
|
||||
deliveryOverridesExecutionInfo.targetChainRefundPerGasUnused.unwrap()
|
||||
< executionInfo.targetChainRefundPerGasUnused.unwrap()
|
||||
) {
|
||||
revert InvalidOverrideRefundPerGasUnused();
|
||||
}
|
||||
if (deliveryOverridesExecutionInfo.gasLimit < executionInfo.gasLimit) {
|
||||
revert InvalidOverrideGasLimit();
|
||||
}
|
||||
|
|
|
@ -1843,7 +1843,7 @@ contract WormholeRelayerTests is Test {
|
|||
);
|
||||
}
|
||||
|
||||
function testRevertDeliveryWithOverrideMaximumRefund(
|
||||
function testAllowDeliveryWithOverrideMaximumRefund(
|
||||
GasParameters memory gasParams,
|
||||
FeeParameters memory feeParams,
|
||||
bytes memory message
|
||||
|
@ -1877,7 +1877,6 @@ contract WormholeRelayerTests is Test {
|
|||
stack.deliveryVaaHash //really redeliveryHash
|
||||
);
|
||||
|
||||
vm.expectRevert(abi.encodeWithSignature("InvalidOverrideRefundPerGasUnused()"));
|
||||
setup.target.coreRelayerFull.deliver{value: stack.budget}(
|
||||
stack.encodedVMs,
|
||||
stack.encodedDeliveryVAA,
|
||||
|
|
Loading…
Reference in New Issue