Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto relayer allow override target chain refund #3430

Merged
merged 21 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0cef5da
refund address handling improvement
derpy-duck Oct 5, 2023
9cebfcd
fix compilation error
derpy-duck Oct 5, 2023
2c540cf
Remove unnecessary line
derpy-duck Oct 5, 2023
31ec752
restrict to view
derpy-duck Oct 5, 2023
bd56198
fix comment
derpy-duck Oct 5, 2023
81c5a09
Improve handling of gas limits
derpy-duck Oct 6, 2023
8476b96
get test to pass - check that the return data is appropriately long b…
derpy-duck Oct 8, 2023
7d6b615
modification to checking inequality
derpy-duck Oct 9, 2023
b1e037d
modification to checking inequality - use unchecked
derpy-duck Oct 9, 2023
de2b44a
clean functions around - add untrustedBaseDeliveryPrice
derpy-duck Oct 9, 2023
f6d6a28
make quote_length_bytes a constant
derpy-duck Oct 9, 2023
a3519df
seperate pay into two overloads
derpy-duck Oct 9, 2023
7b1ee51
change inequality to equality for checking return data length
derpy-duck Oct 9, 2023
1ea5809
renaming functions
derpy-duck Oct 10, 2023
b26c2ab
allow override of refund per gas unused
derpy-duck Oct 10, 2023
a56d532
test modification
derpy-duck Oct 10, 2023
60a9cd8
Merge branch 'main' into auto-relayer-allow-override-target-chain-refund
derpy-duck Oct 13, 2023
c05e2bc
note
derpy-duck Oct 13, 2023
2bb53ca
Merge branch 'main' into auto-relayer-allow-override-target-chain-refund
derpy-duck Oct 13, 2023
653b943
Merge branch 'main' into auto-relayer-allow-override-target-chain-refund
derpy-duck Oct 13, 2023
2d02494
Merge branch 'main' into auto-relayer-allow-override-target-chain-refund
derpy-duck Oct 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions ethereum/contracts/interfaces/relayer/IWormholeRelayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
VaaKeysDoNotMatchVaas,
InvalidOverrideGasLimit,
InvalidOverrideReceiverValue,
InvalidOverrideRefundPerGasUnused,
RequesterNotWormholeRelayer,
DeliveryProviderCannotReceivePayment,
MessageKey,
Expand Down Expand Up @@ -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();
}
Expand Down
3 changes: 1 addition & 2 deletions ethereum/forge-test/relayer/WormholeRelayer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1843,7 +1843,7 @@ contract WormholeRelayerTests is Test {
);
}

function testRevertDeliveryWithOverrideMaximumRefund(
function testAllowDeliveryWithOverrideMaximumRefund(
GasParameters memory gasParams,
FeeParameters memory feeParams,
bytes memory message
Expand Down Expand Up @@ -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,
Expand Down