Fix to PR 3043

This commit is contained in:
derpy-duck 2023-06-08 19:55:55 +00:00
parent 5130eff0ef
commit b18a1a8c44
2 changed files with 6 additions and 6 deletions

View File

@ -577,7 +577,7 @@ abstract contract WormholeRelayerDelivery is WormholeRelayerBase, IWormholeRelay
}
// assuming refund chain is an EVM chain
if (refundAmount <= baseDeliveryPrice) {
if (refundAmount <= getWormholeMessageFee() + baseDeliveryPrice) {
return RefundStatus.CROSS_CHAIN_REFUND_FAIL_NOT_ENOUGH;
}
try IWormholeRelayerSend(address(this)).send{value: refundAmount.unwrap()}(
@ -585,7 +585,7 @@ abstract contract WormholeRelayerDelivery is WormholeRelayerBase, IWormholeRelay
bytes32(0),
bytes(""),
TargetNative.wrap(0),
refundAmount - baseDeliveryPrice,
refundAmount - getWormholeMessageFee() - baseDeliveryPrice,
encodeEvmExecutionParamsV1(getEmptyEvmExecutionParamsV1()),
refundChain,
refundAddress,

View File

@ -1139,18 +1139,18 @@ contract WormholeRelayerTests is Test {
uint256 amountToGetInRefundTarget =
(setup.target.rewardAddress.balance - refundRewardAddressBalance);
vm.assume(amountToGetInRefundTarget > 0);
uint256 refundSource;
(LocalNative baseFee,) = setup.target.coreRelayer.quoteEVMDeliveryPrice(setup.sourceChain, TargetNative.wrap(0), Gas.wrap(0));
vm.assume(amountToGetInRefundTarget > baseFee.unwrap());
if (amountToGetInRefundTarget > baseFee.unwrap()) {
TargetNative tmp = setup.target.coreRelayer.quoteNativeForChain(
setup.sourceChain,
LocalNative.wrap(amountToGetInRefundTarget - baseFee.unwrap()),
LocalNative.wrap(amountToGetInRefundTarget + feeParams.wormholeFeeOnTarget - baseFee.unwrap()),
setup.target.coreRelayer.getDefaultDeliveryProvider()
);
refundSource = tmp.unwrap();
}
// Calculate amount that must have been spent on gas, by reverse engineering from the amount that was paid to the provider's reward address on the target chain
test.gasAmount = uint32(