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 **
|
* @notice *** This will only be able to succeed if the following is true **
|
||||||
* - newGasLimit >= gas limit of the old instruction
|
* - newGasLimit >= gas limit of the old instruction
|
||||||
* - newReceiverValue >= receiver value of the old instruction
|
* - newReceiverValue >= receiver value of the old instruction
|
||||||
* - newDeliveryProvider's `targetChainRefundPerGasUnused` >= old relay provider's `targetChainRefundPerGasUnused`
|
|
||||||
*/
|
*/
|
||||||
function resendToEvm(
|
function resendToEvm(
|
||||||
VaaKey memory deliveryVaaKey,
|
VaaKey memory deliveryVaaKey,
|
||||||
|
@ -427,7 +426,10 @@ interface IWormholeRelayerSend is IWormholeRelayerBase {
|
||||||
* @param gasLimit gas limit with which to call `targetAddress`.
|
* @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 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,
|
* @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(
|
function quoteEVMDeliveryPrice(
|
||||||
uint16 targetChain,
|
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 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,
|
* @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(
|
function quoteEVMDeliveryPrice(
|
||||||
uint16 targetChain,
|
uint16 targetChain,
|
||||||
|
|
|
@ -382,7 +382,6 @@ interface IWormholeRelayerSend is IWormholeRelayerBase {
|
||||||
* @notice *** This will only be able to succeed if the following is true **
|
* @notice *** This will only be able to succeed if the following is true **
|
||||||
* - newGasLimit >= gas limit of the old instruction
|
* - newGasLimit >= gas limit of the old instruction
|
||||||
* - newReceiverValue >= receiver value of the old instruction
|
* - newReceiverValue >= receiver value of the old instruction
|
||||||
* - newDeliveryProvider's `targetChainRefundPerGasUnused` >= old relay provider's `targetChainRefundPerGasUnused`
|
|
||||||
*/
|
*/
|
||||||
function resendToEvm(
|
function resendToEvm(
|
||||||
VaaKey memory deliveryVaaKey,
|
VaaKey memory deliveryVaaKey,
|
||||||
|
@ -429,7 +428,10 @@ interface IWormholeRelayerSend is IWormholeRelayerBase {
|
||||||
* @param gasLimit gas limit with which to call `targetAddress`.
|
* @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 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,
|
* @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(
|
function quoteEVMDeliveryPrice(
|
||||||
uint16 targetChain,
|
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 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,
|
* @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(
|
function quoteEVMDeliveryPrice(
|
||||||
uint16 targetChain,
|
uint16 targetChain,
|
||||||
|
|
|
@ -12,7 +12,6 @@ import {
|
||||||
VaaKeysDoNotMatchVaas,
|
VaaKeysDoNotMatchVaas,
|
||||||
InvalidOverrideGasLimit,
|
InvalidOverrideGasLimit,
|
||||||
InvalidOverrideReceiverValue,
|
InvalidOverrideReceiverValue,
|
||||||
InvalidOverrideRefundPerGasUnused,
|
|
||||||
RequesterNotWormholeRelayer,
|
RequesterNotWormholeRelayer,
|
||||||
DeliveryProviderCannotReceivePayment,
|
DeliveryProviderCannotReceivePayment,
|
||||||
MessageKey,
|
MessageKey,
|
||||||
|
@ -219,12 +218,6 @@ abstract contract WormholeRelayerDelivery is WormholeRelayerBase, IWormholeRelay
|
||||||
decodeEvmExecutionInfoV1(deliveryOverrides.newExecutionInfo);
|
decodeEvmExecutionInfoV1(deliveryOverrides.newExecutionInfo);
|
||||||
deliveryOverridesReceiverValue = deliveryOverrides.newReceiverValue;
|
deliveryOverridesReceiverValue = deliveryOverrides.newReceiverValue;
|
||||||
|
|
||||||
if (
|
|
||||||
deliveryOverridesExecutionInfo.targetChainRefundPerGasUnused.unwrap()
|
|
||||||
< executionInfo.targetChainRefundPerGasUnused.unwrap()
|
|
||||||
) {
|
|
||||||
revert InvalidOverrideRefundPerGasUnused();
|
|
||||||
}
|
|
||||||
if (deliveryOverridesExecutionInfo.gasLimit < executionInfo.gasLimit) {
|
if (deliveryOverridesExecutionInfo.gasLimit < executionInfo.gasLimit) {
|
||||||
revert InvalidOverrideGasLimit();
|
revert InvalidOverrideGasLimit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1843,7 +1843,7 @@ contract WormholeRelayerTests is Test {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testRevertDeliveryWithOverrideMaximumRefund(
|
function testAllowDeliveryWithOverrideMaximumRefund(
|
||||||
GasParameters memory gasParams,
|
GasParameters memory gasParams,
|
||||||
FeeParameters memory feeParams,
|
FeeParameters memory feeParams,
|
||||||
bytes memory message
|
bytes memory message
|
||||||
|
@ -1877,7 +1877,6 @@ contract WormholeRelayerTests is Test {
|
||||||
stack.deliveryVaaHash //really redeliveryHash
|
stack.deliveryVaaHash //really redeliveryHash
|
||||||
);
|
);
|
||||||
|
|
||||||
vm.expectRevert(abi.encodeWithSignature("InvalidOverrideRefundPerGasUnused()"));
|
|
||||||
setup.target.coreRelayerFull.deliver{value: stack.budget}(
|
setup.target.coreRelayerFull.deliver{value: stack.budget}(
|
||||||
stack.encodedVMs,
|
stack.encodedVMs,
|
||||||
stack.encodedDeliveryVAA,
|
stack.encodedDeliveryVAA,
|
||||||
|
|
Loading…
Reference in New Issue