Cleans up `validateRedeliverySingle`.
This commit is contained in:
parent
d814cd99a3
commit
9acc9fcbd6
|
@ -620,7 +620,6 @@ contract CoreRelayer is CoreRelayerGovernance {
|
||||||
DeliveryInstruction memory originalInstruction
|
DeliveryInstruction memory originalInstruction
|
||||||
) internal view returns (DeliveryInstruction memory deliveryInstruction, bool isValid) {
|
) internal view returns (DeliveryInstruction memory deliveryInstruction, bool isValid) {
|
||||||
// All the same checks as delivery single, with a couple additional
|
// All the same checks as delivery single, with a couple additional
|
||||||
isValid = true;
|
|
||||||
|
|
||||||
// The same relay provider must be specified when doing a single VAA redeliver.
|
// The same relay provider must be specified when doing a single VAA redeliver.
|
||||||
address providerAddress = fromWormholeFormat(redeliveryInstruction.executionParameters.providerDeliveryAddress);
|
address providerAddress = fromWormholeFormat(redeliveryInstruction.executionParameters.providerDeliveryAddress);
|
||||||
|
@ -628,30 +627,6 @@ contract CoreRelayer is CoreRelayerGovernance {
|
||||||
revert MismatchingRelayProvidersInRedelivery();
|
revert MismatchingRelayProvidersInRedelivery();
|
||||||
}
|
}
|
||||||
|
|
||||||
//msg.sender must be the provider
|
|
||||||
if (msg.sender != providerAddress) {
|
|
||||||
isValid = false; //"Relay provider differed from the specified address");
|
|
||||||
}
|
|
||||||
|
|
||||||
//redelivery must target this chain
|
|
||||||
if (chainId() != redeliveryInstruction.targetChain) {
|
|
||||||
isValid = false; //"Redelivery request does not target this chain.");
|
|
||||||
}
|
|
||||||
|
|
||||||
//original delivery must target this chain
|
|
||||||
if (chainId() != originalInstruction.targetChain) {
|
|
||||||
isValid = false; //"Original delivery request did not target this chain.");
|
|
||||||
}
|
|
||||||
|
|
||||||
//maxTransactionFee & receiverValue must be at least as large as the initial delivery
|
|
||||||
if (originalInstruction.receiverValueTarget > redeliveryInstruction.newReceiverValueTarget) {
|
|
||||||
isValid = false; //new application budget is smaller than the original
|
|
||||||
}
|
|
||||||
|
|
||||||
if (originalInstruction.executionParameters.gasLimit > redeliveryInstruction.executionParameters.gasLimit) {
|
|
||||||
isValid = false; //new gasLimit is smaller than the original
|
|
||||||
}
|
|
||||||
|
|
||||||
// relayer must have covered the necessary funds
|
// relayer must have covered the necessary funds
|
||||||
if (
|
if (
|
||||||
msg.value
|
msg.value
|
||||||
|
@ -660,11 +635,28 @@ contract CoreRelayer is CoreRelayerGovernance {
|
||||||
) {
|
) {
|
||||||
revert InsufficientRelayerFunds();
|
revert InsufficientRelayerFunds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16 whChainId = chainId();
|
||||||
|
// msg.sender must be the provider
|
||||||
|
// "Relay provider differed from the specified address");
|
||||||
|
isValid = msg.sender == providerAddress
|
||||||
|
// redelivery must target this chain
|
||||||
|
// "Redelivery request does not target this chain.");
|
||||||
|
&& whChainId == redeliveryInstruction.targetChain
|
||||||
|
// original delivery must target this chain
|
||||||
|
// "Original delivery request did not target this chain.");
|
||||||
|
&& whChainId == originalInstruction.targetChain
|
||||||
|
// gasLimit & receiverValue must be at least as large as the initial delivery
|
||||||
|
// "New receiver value is smaller than the original"
|
||||||
|
&& originalInstruction.receiverValueTarget <= redeliveryInstruction.newReceiverValueTarget
|
||||||
|
// "New gasLimit is smaller than the original"
|
||||||
|
&& originalInstruction.executionParameters.gasLimit <= redeliveryInstruction.executionParameters.gasLimit;
|
||||||
|
|
||||||
// Overwrite compute budget and application budget on the original request and proceed.
|
// Overwrite compute budget and application budget on the original request and proceed.
|
||||||
originalInstruction.maximumRefundTarget = redeliveryInstruction.newMaximumRefundTarget;
|
|
||||||
originalInstruction.receiverValueTarget = redeliveryInstruction.newReceiverValueTarget;
|
|
||||||
originalInstruction.executionParameters = redeliveryInstruction.executionParameters;
|
|
||||||
deliveryInstruction = originalInstruction;
|
deliveryInstruction = originalInstruction;
|
||||||
|
deliveryInstruction.maximumRefundTarget = redeliveryInstruction.newMaximumRefundTarget;
|
||||||
|
deliveryInstruction.receiverValueTarget = redeliveryInstruction.newReceiverValueTarget;
|
||||||
|
deliveryInstruction.executionParameters = redeliveryInstruction.executionParameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
function deliverSingle(TargetDeliveryParametersSingle memory targetParams) public payable {
|
function deliverSingle(TargetDeliveryParametersSingle memory targetParams) public payable {
|
||||||
|
|
Loading…
Reference in New Issue