Most forge tests pass

This commit is contained in:
derpy-duck 2023-02-10 20:52:39 +00:00 committed by chase-45
parent 1f69c238d7
commit 346df2e017
5 changed files with 26 additions and 26 deletions

View File

@ -89,8 +89,8 @@ contract CoreRelayer is CoreRelayerGovernance {
provider: provider,
sourceChain: chainId(),
targetChain: request.targetChain,
maxTransactionFeeSource: request.newComputeBudget,
receiverValueSource: request.newApplicationBudget,
maxTransactionFeeSource: request.newMaxTransactionFee,
receiverValueSource: request.newReceiverValue,
isDelivery: false
})
);
@ -122,7 +122,7 @@ contract CoreRelayer is CoreRelayerGovernance {
request,
receiverValueTarget,
maximumRefund,
calculateTargetGasRedeliveryAmount(request.targetChain, request.newComputeBudget, provider),
calculateTargetGasRedeliveryAmount(request.targetChain, request.newMaxTransactionFee, provider),
provider
);
@ -645,7 +645,7 @@ contract CoreRelayer is CoreRelayerGovernance {
}
//maxTransactionFee & receiverValue must be at least as large as the initial delivery
if (originalInstruction.receiverValueTarget > redeliveryInstruction.newApplicationBudgetTarget) {
if (originalInstruction.receiverValueTarget > redeliveryInstruction.newReceiverValueTarget) {
isValid = false; //new application budget is smaller than the original
}
@ -656,14 +656,14 @@ contract CoreRelayer is CoreRelayerGovernance {
//relayer must have covered the necessary funds
if (
msg.value
< redeliveryInstruction.newMaximumRefundTarget + redeliveryInstruction.newApplicationBudgetTarget
< redeliveryInstruction.newMaximumRefundTarget + redeliveryInstruction.newReceiverValueTarget
+ wormhole().messageFee()
) {
revert InsufficientRelayerFunds();
}
//Overwrite compute budget and application budget on the original request and proceed.
originalInstruction.maximumRefundTarget = redeliveryInstruction.newMaximumRefundTarget;
originalInstruction.receiverValueTarget = redeliveryInstruction.newApplicationBudgetTarget;
originalInstruction.receiverValueTarget = redeliveryInstruction.newReceiverValueTarget;
originalInstruction.executionParameters = redeliveryInstruction.executionParameters;
deliveryInstruction = originalInstruction;
}

View File

@ -46,7 +46,7 @@ contract CoreRelayerMessages is CoreRelayerStructs, CoreRelayerGetters {
instruction.newMaximumRefundTarget = encoded.toUint256(index);
index += 32;
instruction.newApplicationBudgetTarget = encoded.toUint256(index);
instruction.newReceiverValueTarget = encoded.toUint256(index);
index += 32;
instruction.executionParameters.version = encoded.toUint8(index);

View File

@ -59,8 +59,8 @@ abstract contract CoreRelayerStructs {
uint16 targetChain;
uint8 deliveryIndex;
uint8 multisendIndex;
uint256 newComputeBudget;
uint256 newApplicationBudget;
uint256 newMaxTransactionFee;
uint256 newReceiverValue;
bytes newRelayParameters;
}
@ -102,7 +102,7 @@ abstract contract CoreRelayerStructs {
uint8 deliveryIndex;
uint8 multisendIndex;
uint256 newMaximumRefundTarget;
uint256 newApplicationBudgetTarget;
uint256 newReceiverValueTarget;
ExecutionParameters executionParameters;
}

View File

@ -523,10 +523,10 @@ contract TestCoreRelayer is Test {
(keccak256(setup.target.integration.getMessage()) != keccak256(message))
|| (keccak256(message) == keccak256(bytes("")))
);
Vm.Log[] memory logs = vm.getRecordedLogs();
bytes32 deliveryVaaHash = logs[0].data.toBytes32(0);
bytes32 deliveryVaaHash = vm.getRecordedLogs()[0].topics[1];
uint256 newApplicationBudgetFee = setup.source.coreRelayer.quoteReceiverValue(
uint256 newMaxTransactionFeeFee = setup.source.coreRelayer.quoteReceiverValue(
setup.targetChainId, feeParams.receiverValueTarget, address(setup.source.relayProvider)
);
@ -538,11 +538,11 @@ contract TestCoreRelayer is Test {
deliveryIndex: uint8(1),
multisendIndex: uint8(0),
newMaxTransactionFee: payment - setup.source.wormhole.messageFee(),
newReceiverValue: newApplicationBudgetFee,
newReceiverValue: newMaxTransactionFeeFee,
newRelayParameters: setup.source.coreRelayer.getDefaultRelayParams()
});
setup.source.coreRelayer.resend{value: payment + newApplicationBudgetFee}(
setup.source.coreRelayer.resend{value: payment + newMaxTransactionFeeFee}(
redeliveryRequest, 1, address(setup.source.relayProvider)
);
@ -581,9 +581,9 @@ contract TestCoreRelayer is Test {
|| (keccak256(message) == keccak256(bytes("")))
);
bytes32 deliveryVaaHash = vm.getRecordedLogs()[0].topics[1];
bytes32 deliveryVaaHash = vm.getRecordedLogs()[0].data.toBytes32(0);
uint256 newApplicationBudgetFee = setup.source.coreRelayer.quoteReceiverValue(
uint256 newMaxTransactionFeeFee = setup.source.coreRelayer.quoteReceiverValue(
setup.targetChainId, feeParams.receiverValueTarget, address(setup.source.relayProvider)
);
@ -595,13 +595,13 @@ contract TestCoreRelayer is Test {
deliveryIndex: 1,
multisendIndex: 0,
newMaxTransactionFee: payment - setup.source.wormhole.messageFee(),
newReceiverValue: newApplicationBudgetFee,
newReceiverValue: newMaxTransactionFeeFee,
newRelayParameters: setup.source.coreRelayer.getDefaultRelayParams()
});
vm.deal(address(this), type(uint256).max);
setup.source.coreRelayer.resend{value: payment + newApplicationBudgetFee}(
setup.source.coreRelayer.resend{value: payment + newMaxTransactionFeeFee}(
redeliveryRequest, 1, address(setup.source.relayProvider)
);
@ -621,13 +621,13 @@ contract TestCoreRelayer is Test {
deliveryIndex: 1,
multisendIndex: 0,
newMaxTransactionFee: payment - setup.source.wormhole.messageFee(),
newReceiverValue: newApplicationBudgetFee - 1,
newReceiverValue: newMaxTransactionFeeFee - 1,
newRelayParameters: setup.source.coreRelayer.getDefaultRelayParams()
});
vm.deal(address(this), payment + newApplicationBudgetFee - 1);
vm.deal(address(this), payment + newMaxTransactionFeeFee - 1);
setup.source.coreRelayer.resend{value: payment + newApplicationBudgetFee - 1}(
setup.source.coreRelayer.resend{value: payment + newMaxTransactionFeeFee - 1}(
redeliveryRequest, 1, address(setup.source.relayProvider)
);
@ -761,7 +761,7 @@ contract TestCoreRelayer is Test {
|| (keccak256(message) == keccak256(bytes("")))
);
stack.deliveryVaaHash = vm.getRecordedLogs()[0].topics[1];
stack.deliveryVaaHash = vm.getRecordedLogs()[0].data.toBytes32(0);
stack.payment = setup.source.coreRelayer.quoteGas(
setup.targetChainId, gasParams.targetGasLimit, address(setup.source.relayProvider)
@ -808,7 +808,7 @@ contract TestCoreRelayer is Test {
stack.parsed = relayerWormhole.parseVM(stack.redeliveryVM);
stack.instruction = setup.target.coreRelayerFull.getRedeliveryByTxHashInstruction(stack.parsed.payload);
stack.budget = stack.instruction.newMaximumRefundTarget + stack.instruction.newApplicationBudgetTarget
stack.budget = stack.instruction.newMaximumRefundTarget + stack.instruction.newReceiverValueTarget
+ setup.target.wormhole.messageFee();
vm.prank(setup.target.relayer);
@ -1284,7 +1284,7 @@ contract TestCoreRelayer is Test {
CoreRelayer.TargetDeliveryParametersSingle memory originalDelivery =
pastDeliveries[keccak256(abi.encodePacked(instruction.sourceTxHash, instruction.multisendIndex))];
uint16 targetChain = instruction.targetChain;
uint256 budget = instruction.newMaximumRefundTarget + instruction.newApplicationBudgetTarget
uint256 budget = instruction.newMaximumRefundTarget + instruction.newReceiverValueTarget
+ map[targetChain].wormhole.messageFee();
CoreRelayerStructs.TargetRedeliveryByTxHashParamsSingle memory package = CoreRelayerStructs
.TargetRedeliveryByTxHashParamsSingle({

View File

@ -46,7 +46,7 @@ async function run(
deliveryIndex: 1,
multisendIndex: 0,
newComputeBudget: relayQuote,
newApplicationBudget: BigNumber.from(0),
newMaxTransactionFee: BigNumber.from(0),
newRelayParameters: new Uint8Array(),
},
nonce,