trustless-generic-relayer/ethereum/contracts/coreRelayer/CoreRelayerMessages.sol

564 lines
24 KiB
Solidity
Raw Normal View History

Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
// contracts/Bridge.sol
// SPDX-License-Identifier: Apache 2
pragma solidity ^0.8.0;
import "../libraries/external/BytesLib.sol";
import "./CoreRelayerGetters.sol";
import "./CoreRelayerStructs.sol";
import "../interfaces/IWormholeRelayer.sol";
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
contract CoreRelayerMessages is CoreRelayerStructs, CoreRelayerGetters {
using BytesLib for bytes;
error InvalidPayloadId(uint8 payloadId);
error InvalidDeliveryInstructionsPayload(uint256 length);
/**
* @notice This function calculates the total fee to execute all of the Send requests in this MultichainSend container
* @param sendContainer A MultichainSend struct describing all of the Send requests
* @return totalFee
*/
function getTotalFeeMultichainSend(IWormholeRelayer.MultichainSend memory sendContainer, uint256 wormholeMessageFee)
internal
view
returns (uint256 totalFee)
{
totalFee = wormholeMessageFee;
uint256 length = sendContainer.requests.length;
for (uint256 i = 0; i < length; i++) {
IWormholeRelayer.Send memory request = sendContainer.requests[i];
totalFee += request.maxTransactionFee + request.receiverValue;
}
}
/**
* @notice This function converts a MultichainSend struct into a DeliveryInstructionsContainer struct that
* describes to the relayer exactly how to relay for each of the Send requests.
* Specifically, each Send is converted to a DeliveryInstruction, which is a struct that contains six fields:
* 1) targetChain, 2) targetAddress, 3) refundAddress (all which are part of the Send struct),
* 4) maximumRefundTarget: The maximum amount that can be refunded to 'refundAddress' (e.g. if the call to 'receiveWormholeMessages' takes 0 gas),
* 5) receiverValueTarget: The amount that will be passed into 'receiveWormholeMessages' as value, in target chain currency
* 6) executionParameters: a struct with information about execution, specifically:
* executionParameters.gasLimit: The maximum amount of gas 'receiveWormholeMessages' is allowed to use
* executionParameters.providerDeliveryAddress: The address of the relayer that will execute this Send request
* The latter 3 fields are calculated using the relayProvider's getters
* @param sendContainer A MultichainSend struct describing all of the Send requests
* @return instructionsContainer A DeliveryInstructionsContainer struct
*/
function convertMultichainSendToDeliveryInstructionsContainer(IWormholeRelayer.MultichainSend memory sendContainer)
internal
view
returns (DeliveryInstructionsContainer memory instructionsContainer)
{
instructionsContainer.payloadId = 1;
IRelayProvider relayProvider = IRelayProvider(sendContainer.relayProviderAddress);
uint256 length = sendContainer.requests.length;
instructionsContainer.instructions = new DeliveryInstruction[](length);
for (uint256 i = 0; i < length; i++) {
instructionsContainer.instructions[i] =
convertSendToDeliveryInstruction(sendContainer.requests[i], relayProvider);
}
}
/**
* @notice This function converts a Send struct into a DeliveryInstruction struct that
* describes to the relayer exactly how to relay for the Send.
* Specifically, the DeliveryInstruction struct that contains six fields:
* 1) targetChain, 2) targetAddress, 3) refundAddress (all which are part of the Send struct),
* 4) maximumRefundTarget: The maximum amount that can be refunded to 'refundAddress' (e.g. if the call to 'receiveWormholeMessages' takes 0 gas),
* 5) receiverValueTarget: The amount that will be passed into 'receiveWormholeMessages' as value, in target chain currency
* 6) executionParameters: a struct with information about execution, specifically:
* executionParameters.gasLimit: The maximum amount of gas 'receiveWormholeMessages' is allowed to use
* executionParameters.providerDeliveryAddress: The address of the relayer that will execute this Send request
* The latter 3 fields are calculated using the relayProvider's getters
* @param send A Send struct
* @param relayProvider The relay provider chosen for this Send
* @return instruction A DeliveryInstruction
*/
function convertSendToDeliveryInstruction(IWormholeRelayer.Send memory send, IRelayProvider relayProvider)
internal
view
returns (DeliveryInstruction memory instruction)
{
instruction.targetChain = send.targetChain;
instruction.targetAddress = send.targetAddress;
instruction.refundAddress = send.refundAddress;
instruction.maximumRefundTarget =
calculateTargetDeliveryMaximumRefund(send.targetChain, send.maxTransactionFee, relayProvider);
instruction.receiverValueTarget =
convertReceiverValueAmount(send.receiverValue, send.targetChain, relayProvider);
instruction.executionParameters = ExecutionParameters({
version: 1,
gasLimit: calculateTargetGasDeliveryAmount(send.targetChain, send.maxTransactionFee, relayProvider),
providerDeliveryAddress: relayProvider.getDeliveryAddress(send.targetChain)
});
}
/**
* @notice Check if for each instruction in the DeliveryInstructionContainer,
* - the total amount of target chain currency needed for execution of the instruction is within the maximum budget,
* i.e. (maximumRefundTarget + receiverValueTarget) <= (the relayProvider's maximum budget for the target chain)
* - the gasLimit is greater than 0
* @param container A DeliveryInstructionsContainer
* @param relayProvider The relayProvider whos maximum budget we are checking against
*/
function checkInstructions(DeliveryInstructionsContainer memory container, IRelayProvider relayProvider)
internal
view
{
uint256 length = container.instructions.length;
for (uint8 i = 0; i < length; i++) {
DeliveryInstruction memory instruction = container.instructions[i];
if (instruction.executionParameters.gasLimit == 0) {
revert IWormholeRelayer.MaxTransactionFeeNotEnough(i);
}
if (
instruction.maximumRefundTarget + instruction.receiverValueTarget
> relayProvider.quoteMaximumBudget(instruction.targetChain)
) {
revert IWormholeRelayer.FundsTooMuch(i);
}
}
}
/**
* @notice Check if for a redelivery instruction,
* - the total amount of target chain currency needed for execution of this instruction is within the maximum budget,
* i.e. (maximumRefundTarget + receiverValueTarget) <= (the relayProvider's maximum budget for the target chain)
* - the gasLimit is greater than 0
* @param instruction A RedeliveryByTxHashInstruction
* @param relayProvider The relayProvider whos maximum budget we are checking against
*/
function checkRedeliveryInstruction(
RedeliveryByTxHashInstruction memory instruction,
IRelayProvider relayProvider,
uint256 wormholeMessageFee
) internal view {
if (instruction.executionParameters.gasLimit == 0) {
revert IWormholeRelayer.MaxTransactionFeeNotEnough(0);
}
if (
instruction.newMaximumRefundTarget + instruction.newReceiverValueTarget + wormholeMessageFee
> relayProvider.quoteMaximumBudget(instruction.targetChain)
) {
revert IWormholeRelayer.FundsTooMuch(0);
}
}
/**
* @notice This function converts a ResendByTx struct into a RedeliveryByTxHashInstruction struct that
* describes to the relayer exactly how to relay for the ResendByTx.
* Specifically, the RedeliveryByTxHashInstruction struct that contains nine fields:
* 1) sourceChain, 2) sourceTxHash, 3) sourceNonce, 4) targetChain, 5) deliveryIndex, 6) multisendIndex (all which are part of the ResendByTxHash struct),
* 7) newMaximumRefundTarget: The new maximum amount that can be refunded to 'refundAddress' (e.g. if the call to 'receiveWormholeMessages' takes 0 gas),
* 8) newReceiverValueTarget: The new amount that will be passed into 'receiveWormholeMessages' as value, in target chain currency
* 9) executionParameters: a struct with information about execution, specifically:
* executionParameters.gasLimit: The maximum amount of gas 'receiveWormholeMessages' is allowed to use
* executionParameters.providerDeliveryAddress: The address of the relayer that will execute this ResendByTx request
* The latter 3 fields are calculated using the relayProvider's getters
* @param resend A ResendByTx struct
* @param relayProvider The relay provider chosen for this ResendByTx
* @return instruction A DeliveryInstruction
*/
function convertResendToRedeliveryInstruction(
IWormholeRelayer.ResendByTx memory resend,
IRelayProvider relayProvider
) internal view returns (RedeliveryByTxHashInstruction memory instruction) {
instruction.payloadId = 2;
instruction.sourceChain = resend.sourceChain;
instruction.sourceTxHash = resend.sourceTxHash;
instruction.sourceNonce = resend.sourceNonce;
instruction.targetChain = resend.targetChain;
instruction.deliveryIndex = resend.deliveryIndex;
instruction.multisendIndex = resend.multisendIndex;
instruction.newMaximumRefundTarget =
calculateTargetRedeliveryMaximumRefund(resend.targetChain, resend.newMaxTransactionFee, relayProvider);
instruction.newReceiverValueTarget =
convertReceiverValueAmount(resend.newReceiverValue, resend.targetChain, relayProvider);
instruction.executionParameters = ExecutionParameters({
version: 1,
gasLimit: calculateTargetGasRedeliveryAmount(resend.targetChain, resend.newMaxTransactionFee, relayProvider),
providerDeliveryAddress: relayProvider.getDeliveryAddress(resend.targetChain)
});
}
// encode a 'RedeliveryByTxHashInstruction' into bytes
function encodeRedeliveryInstruction(RedeliveryByTxHashInstruction memory instruction)
2023-01-05 16:46:58 -08:00
internal
pure
returns (bytes memory encoded)
{
encoded = abi.encodePacked(
instruction.payloadId,
instruction.sourceChain,
instruction.sourceTxHash,
instruction.sourceNonce,
instruction.targetChain,
instruction.deliveryIndex,
instruction.multisendIndex,
instruction.newMaximumRefundTarget,
instruction.newReceiverValueTarget,
instruction.executionParameters.version,
instruction.executionParameters.gasLimit,
instruction.executionParameters.providerDeliveryAddress
);
}
// encode a 'DeliveryInstructionsContainer' into bytes
function encodeDeliveryInstructionsContainer(DeliveryInstructionsContainer memory container)
internal
pure
returns (bytes memory encoded)
{
encoded = abi.encodePacked(
container.payloadId, uint8(container.sufficientlyFunded ? 1 : 0), uint8(container.instructions.length)
);
for (uint256 i = 0; i < container.instructions.length; i++) {
encoded = abi.encodePacked(encoded, encodeDeliveryInstruction(container.instructions[i]));
}
}
// encode a 'DeliveryInstruction' into bytes
function encodeDeliveryInstruction(DeliveryInstruction memory instruction)
internal
pure
returns (bytes memory encoded)
{
encoded = abi.encodePacked(
instruction.targetChain,
instruction.targetAddress,
instruction.refundAddress,
instruction.maximumRefundTarget,
instruction.receiverValueTarget,
instruction.executionParameters.version,
instruction.executionParameters.gasLimit,
instruction.executionParameters.providerDeliveryAddress
);
}
/**
* Given a targetChain, maxTransactionFee, and a relay provider, this function calculates what the gas limit of the delivery transaction
* should be
*
* It does this by calculating (maxTransactionFee - deliveryOverhead)/gasPrice
* where 'deliveryOverhead' is the relayProvider's base fee for delivering to targetChain (in units of source chain currency)
* and 'gasPrice' is the relayProvider's fee per unit of target chain gas (in units of source chain currency)
*
* @param targetChain target chain
* @param maxTransactionFee uint256
* @param provider IRelayProvider
* @return gasAmount
*/
function calculateTargetGasDeliveryAmount(uint16 targetChain, uint256 maxTransactionFee, IRelayProvider provider)
internal
view
returns (uint32 gasAmount)
{
gasAmount = calculateTargetGasDeliveryAmountHelper(
targetChain, maxTransactionFee, provider.quoteDeliveryOverhead(targetChain), provider
);
}
/**
* Given a targetChain, maxTransactionFee, and a relay provider, this function calculates what the maximum refund of the delivery transaction
* should be, in terms of target chain currency
*
* The maximum refund is the amount that would be refunded to refundAddress if the call to 'receiveWormholeMessages' takes 0 gas
*
* It does this by calculating (maxTransactionFee - deliveryOverhead) and converting (using the relay provider's prices) to target chain currency
* (where 'deliveryOverhead' is the relayProvider's base fee for delivering to targetChain [in units of source chain currency])
*
* @param targetChain target chain
* @param maxTransactionFee uint256
* @param provider IRelayProvider
* @return maximumRefund uint256
*/
function calculateTargetDeliveryMaximumRefund(
uint16 targetChain,
uint256 maxTransactionFee,
IRelayProvider provider
) internal view returns (uint256 maximumRefund) {
maximumRefund = calculateTargetDeliveryMaximumRefundHelper(
targetChain, maxTransactionFee, provider.quoteDeliveryOverhead(targetChain), provider
);
}
/**
* Given a targetChain, maxTransactionFee, and a relay provider, this function calculates what the gas limit of the redelivery transaction
* should be
*
* It does this by calculating (maxTransactionFee - redeliveryOverhead)/gasPrice
* where 'redeliveryOverhead' is the relayProvider's base fee for redelivering to targetChain (in units of source chain currency)
* and 'gasPrice' is the relayProvider's fee per unit of target chain gas (in units of source chain currency)
*
* @param targetChain target chain
* @param maxTransactionFee uint256
* @param provider IRelayProvider
* @return gasAmount
*/
function calculateTargetGasRedeliveryAmount(uint16 targetChain, uint256 maxTransactionFee, IRelayProvider provider)
internal
view
returns (uint32 gasAmount)
{
gasAmount = calculateTargetGasDeliveryAmountHelper(
targetChain, maxTransactionFee, provider.quoteRedeliveryOverhead(targetChain), provider
);
}
/**
* Given a targetChain, maxTransactionFee, and a relay provider, this function calculates what the maximum refund of the redelivery transaction
* should be, in terms of target chain currency
*
* The maximum refund is the amount that would be refunded to refundAddress if the call to 'receiveWormholeMessages' takes 0 gas
*
* It does this by calculating (maxTransactionFee - redeliveryOverhead) and converting (using the relay provider's prices) to target chain currency
* (where 'redeliveryOverhead' is the relayProvider's base fee for redelivering to targetChain [in units of source chain currency])
*
* @param targetChain target chain
* @param maxTransactionFee uint256
* @param provider IRelayProvider
* @return maximumRefund uint256
*/
function calculateTargetRedeliveryMaximumRefund(
uint16 targetChain,
uint256 maxTransactionFee,
IRelayProvider provider
) internal view returns (uint256 maximumRefund) {
maximumRefund = calculateTargetDeliveryMaximumRefundHelper(
targetChain, maxTransactionFee, provider.quoteRedeliveryOverhead(targetChain), provider
);
}
/**
* Performs the calculation (maxTransactionFee - overhead)/(price of 1 unit of target chain gas, in source chain currency)
* and bounds the result between 0 and 2^32-1, inclusive
*
* @param targetChain uint16
* @param maxTransactionFee uint256
* @param overhead uint256
* @param provider IRelayProvider
*/
function calculateTargetGasDeliveryAmountHelper(
uint16 targetChain,
uint256 maxTransactionFee,
uint256 overhead,
IRelayProvider provider
) internal view returns (uint32 gasAmount) {
if (maxTransactionFee <= overhead) {
gasAmount = 0;
} else {
uint256 gas = (maxTransactionFee - overhead) / provider.quoteGasPrice(targetChain);
if (gas > type(uint32).max) {
gasAmount = type(uint32).max;
} else {
gasAmount = uint32(gas);
}
}
}
/**
* Converts (maxTransactionFee - overhead) from source to target chain currency, using the provider's prices
*
* @param targetChain uint16
* @param maxTransactionFee uint256
* @param overhead uint256
* @param provider IRelayProvider
*/
function calculateTargetDeliveryMaximumRefundHelper(
uint16 targetChain,
uint256 maxTransactionFee,
uint256 overhead,
IRelayProvider provider
) internal view returns (uint256 maximumRefund) {
if (maxTransactionFee >= overhead) {
uint256 remainder = maxTransactionFee - overhead;
maximumRefund = assetConversionHelper(chainId(), remainder, targetChain, 1, 1, false, provider);
} else {
maximumRefund = 0;
}
}
/**
* Converts 'sourceAmount' of source chain currency to units of target chain currency
* using the prices of 'provider'
* and also multiplying by a specified fraction 'multiplier/multiplierDenominator',
* rounding up or down specified by 'roundUp', and without performing intermediate rounding,
* i.e. the result should be as if float arithmetic was done and the rounding performed at the end
*
* @param sourceChain source chain
* @param sourceAmount amount of source chain currency to be converted
* @param targetChain target chain
* @param multiplier numerator of a fraction to multiply by
* @param multiplierDenominator denominator of a fraction to multiply by
* @param roundUp whether or not to round up
* @param provider relay provider
* @return targetAmount amount of target chain currency
*/
function assetConversionHelper(
uint16 sourceChain,
uint256 sourceAmount,
uint16 targetChain,
uint256 multiplier,
uint256 multiplierDenominator,
bool roundUp,
IRelayProvider provider
) internal view returns (uint256 targetAmount) {
uint256 srcNativeCurrencyPrice = provider.quoteAssetPrice(sourceChain);
if (srcNativeCurrencyPrice == 0) {
revert IWormholeRelayer.RelayProviderDoesNotSupportTargetChain();
}
uint256 dstNativeCurrencyPrice = provider.quoteAssetPrice(targetChain);
if (dstNativeCurrencyPrice == 0) {
revert IWormholeRelayer.RelayProviderDoesNotSupportTargetChain();
}
uint256 numerator = sourceAmount * srcNativeCurrencyPrice * multiplier;
uint256 denominator = dstNativeCurrencyPrice * multiplierDenominator;
if (roundUp) {
targetAmount = (numerator + denominator - 1) / denominator;
} else {
targetAmount = numerator / denominator;
}
}
/**
* If the user specifies (for 'receiverValue) 'sourceAmount' of source chain currency, with relay provider 'provider',
* then this function calculates how much the relayer will pass into receiveWormholeMessages on the target chain (in target chain currency)
*
* The calculation simply converts this amount to target chain currency, but also applies a multiplier of 'denominator/(denominator + buffer)'
* where these values are also specified by the relay provider 'provider'
*
* @param sourceAmount amount of source chain currency
* @param targetChain target chain
* @param provider relay provider
* @return targetAmount amount of target chain currency
*/
function convertReceiverValueAmount(uint256 sourceAmount, uint16 targetChain, IRelayProvider provider)
internal
view
returns (uint256 targetAmount)
{
(uint16 buffer, uint16 denominator) = provider.getAssetConversionBuffer(targetChain);
targetAmount = assetConversionHelper(
chainId(), sourceAmount, targetChain, denominator, uint256(0) + denominator + buffer, false, provider
);
}
// decode a 'RedeliveryByTxHashInstruction' from bytes
function decodeRedeliveryInstruction(bytes memory encoded)
public
pure
2023-01-05 16:46:58 -08:00
returns (RedeliveryByTxHashInstruction memory instruction)
{
uint256 index = 0;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
2023-01-05 16:46:58 -08:00
instruction.payloadId = encoded.toUint8(index);
if (instruction.payloadId != 2) {
revert InvalidPayloadId(instruction.payloadId);
}
2023-01-05 16:46:58 -08:00
index += 1;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
2023-01-05 16:46:58 -08:00
instruction.sourceChain = encoded.toUint16(index);
index += 2;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
2023-01-05 16:46:58 -08:00
instruction.sourceTxHash = encoded.toBytes32(index);
index += 32;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
2023-01-05 16:46:58 -08:00
instruction.sourceNonce = encoded.toUint32(index);
index += 4;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
2023-01-05 16:46:58 -08:00
instruction.targetChain = encoded.toUint16(index);
index += 2;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
instruction.deliveryIndex = encoded.toUint8(index);
index += 1;
instruction.multisendIndex = encoded.toUint8(index);
index += 1;
2023-01-05 16:46:58 -08:00
instruction.newMaximumRefundTarget = encoded.toUint256(index);
index += 32;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
2023-02-10 12:52:39 -08:00
instruction.newReceiverValueTarget = encoded.toUint256(index);
2023-01-05 16:46:58 -08:00
index += 32;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
2023-01-05 16:46:58 -08:00
instruction.executionParameters.version = encoded.toUint8(index);
index += 1;
Move development branch to main (#23) * refactoring for multidelivery * partial ts-test fixes * use typechain in integration tests, update prettier, fix remaining integration tests * run formatter on solidity files * gas refunding * gas forwarding logic * msg.send -> refundAmount * minor test refactor & additions * created relayer engine directory * more testing & tilt environment config for relayer engine * starting work on the xMint example contracts * additions for relayer engine * minor modifications & todos * fixed some errors * refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend * Merged refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend with new interface' * refactoring interfaces & files for single VAA design * GasOracle implementation of new interface * GasOracle compiles * Gas oracle upgradable * Fix compile errors in GasOracleGovernance * minor core relayer cleanup * Changes to getters, setters, state * implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer * Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer * Fix encodeDeliveryRequestsContainer * added single vaa delivery entrypoint logic * Encode and Decode delivery instructions * Fixed many compile errors * First attempt at removing stacktoodeep error * Commenting out chunks of code to identify stack too deep error * Continue stack too deep quest * Revert "Commenting out chunks of code to identify stack too deep error" This reverts commit 8cd55d26cea2c49dc6e6bfa481c310f1a1c1143a. * Revert "Continue stack too deep quest" This reverts commit f0cde6871e26a7063e20d9a83b63b6a50e32bf37. * Fix stack too deep error in CoreRelayerMessages * tests compile, run, pass * fixing up fee collection assertions * GasOracle tests altering * Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction * adding evm events to delivery execution * forwarding refactor for single vaa * relay provider name refactor * Test file slight refactor to allow for multiple chains * first impl of hub and spoke example * Forward test progress * Forwarding test passes! * More general parameters for test * Testing file more modular, calls 'generic relayer' * redelivery implementation * removing todos * Tests can use arbitrary amount of chains * Address various TODOs * refactored RelayProvider to be upgradeable via proxy * Add overhead inteface to RelayProvider & adjusted necessary fee calculations * added TODOs related to rewardAddress payout * provider price quoting changes * provider payments made at source * Fixed all compile errors * testForward and testSend pass again! * Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface * First round of changes to support individual vaas in offchain relayer - Use new custom plugin event source api in relayer engine - Supports mulit delivery - Config for celo and fuji * contracts deploy successfully to tilt * bug fixes, contracts deploy to tilt * Starting the redelivery test * Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished * small plugin changes * MockRelayerIntegration is used for sending * prepare offchain relayer to run in both tilt and testnet * update readme and npm scripts for offchain relayer * nit: remove console.log(argv) * solc version bump * Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete * chain registration typescript scripts * Redeliver works! * Redelivery test works! * testnet deploy + relayer engine test * Testing two sends * Friday changes to round trip on testnet * Shortening current tests * Funds are correct! Relayer gets paid! * Remove extraneous comments * ts scripts for deployment and config * Wormhole Fee Test Co-authored-by: chase-45 <chasemoran45@gmail.com> Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 14:26:27 -08:00
2023-01-05 16:46:58 -08:00
instruction.executionParameters.gasLimit = encoded.toUint32(index);
index += 4;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
2023-01-05 16:46:58 -08:00
instruction.executionParameters.providerDeliveryAddress = encoded.toBytes32(index);
index += 32;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
}
// decode a 'DeliveryInstructionsContainer' from bytes
Move development branch to main (#23) * refactoring for multidelivery * partial ts-test fixes * use typechain in integration tests, update prettier, fix remaining integration tests * run formatter on solidity files * gas refunding * gas forwarding logic * msg.send -> refundAmount * minor test refactor & additions * created relayer engine directory * more testing & tilt environment config for relayer engine * starting work on the xMint example contracts * additions for relayer engine * minor modifications & todos * fixed some errors * refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend * Merged refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend with new interface' * refactoring interfaces & files for single VAA design * GasOracle implementation of new interface * GasOracle compiles * Gas oracle upgradable * Fix compile errors in GasOracleGovernance * minor core relayer cleanup * Changes to getters, setters, state * implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer * Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer * Fix encodeDeliveryRequestsContainer * added single vaa delivery entrypoint logic * Encode and Decode delivery instructions * Fixed many compile errors * First attempt at removing stacktoodeep error * Commenting out chunks of code to identify stack too deep error * Continue stack too deep quest * Revert "Commenting out chunks of code to identify stack too deep error" This reverts commit 8cd55d26cea2c49dc6e6bfa481c310f1a1c1143a. * Revert "Continue stack too deep quest" This reverts commit f0cde6871e26a7063e20d9a83b63b6a50e32bf37. * Fix stack too deep error in CoreRelayerMessages * tests compile, run, pass * fixing up fee collection assertions * GasOracle tests altering * Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction * adding evm events to delivery execution * forwarding refactor for single vaa * relay provider name refactor * Test file slight refactor to allow for multiple chains * first impl of hub and spoke example * Forward test progress * Forwarding test passes! * More general parameters for test * Testing file more modular, calls 'generic relayer' * redelivery implementation * removing todos * Tests can use arbitrary amount of chains * Address various TODOs * refactored RelayProvider to be upgradeable via proxy * Add overhead inteface to RelayProvider & adjusted necessary fee calculations * added TODOs related to rewardAddress payout * provider price quoting changes * provider payments made at source * Fixed all compile errors * testForward and testSend pass again! * Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface * First round of changes to support individual vaas in offchain relayer - Use new custom plugin event source api in relayer engine - Supports mulit delivery - Config for celo and fuji * contracts deploy successfully to tilt * bug fixes, contracts deploy to tilt * Starting the redelivery test * Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished * small plugin changes * MockRelayerIntegration is used for sending * prepare offchain relayer to run in both tilt and testnet * update readme and npm scripts for offchain relayer * nit: remove console.log(argv) * solc version bump * Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete * chain registration typescript scripts * Redeliver works! * Redelivery test works! * testnet deploy + relayer engine test * Testing two sends * Friday changes to round trip on testnet * Shortening current tests * Funds are correct! Relayer gets paid! * Remove extraneous comments * ts scripts for deployment and config * Wormhole Fee Test Co-authored-by: chase-45 <chasemoran45@gmail.com> Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 14:26:27 -08:00
function decodeDeliveryInstructionsContainer(bytes memory encoded)
public
Move development branch to main (#23) * refactoring for multidelivery * partial ts-test fixes * use typechain in integration tests, update prettier, fix remaining integration tests * run formatter on solidity files * gas refunding * gas forwarding logic * msg.send -> refundAmount * minor test refactor & additions * created relayer engine directory * more testing & tilt environment config for relayer engine * starting work on the xMint example contracts * additions for relayer engine * minor modifications & todos * fixed some errors * refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend * Merged refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend with new interface' * refactoring interfaces & files for single VAA design * GasOracle implementation of new interface * GasOracle compiles * Gas oracle upgradable * Fix compile errors in GasOracleGovernance * minor core relayer cleanup * Changes to getters, setters, state * implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer * Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer * Fix encodeDeliveryRequestsContainer * added single vaa delivery entrypoint logic * Encode and Decode delivery instructions * Fixed many compile errors * First attempt at removing stacktoodeep error * Commenting out chunks of code to identify stack too deep error * Continue stack too deep quest * Revert "Commenting out chunks of code to identify stack too deep error" This reverts commit 8cd55d26cea2c49dc6e6bfa481c310f1a1c1143a. * Revert "Continue stack too deep quest" This reverts commit f0cde6871e26a7063e20d9a83b63b6a50e32bf37. * Fix stack too deep error in CoreRelayerMessages * tests compile, run, pass * fixing up fee collection assertions * GasOracle tests altering * Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction * adding evm events to delivery execution * forwarding refactor for single vaa * relay provider name refactor * Test file slight refactor to allow for multiple chains * first impl of hub and spoke example * Forward test progress * Forwarding test passes! * More general parameters for test * Testing file more modular, calls 'generic relayer' * redelivery implementation * removing todos * Tests can use arbitrary amount of chains * Address various TODOs * refactored RelayProvider to be upgradeable via proxy * Add overhead inteface to RelayProvider & adjusted necessary fee calculations * added TODOs related to rewardAddress payout * provider price quoting changes * provider payments made at source * Fixed all compile errors * testForward and testSend pass again! * Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface * First round of changes to support individual vaas in offchain relayer - Use new custom plugin event source api in relayer engine - Supports mulit delivery - Config for celo and fuji * contracts deploy successfully to tilt * bug fixes, contracts deploy to tilt * Starting the redelivery test * Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished * small plugin changes * MockRelayerIntegration is used for sending * prepare offchain relayer to run in both tilt and testnet * update readme and npm scripts for offchain relayer * nit: remove console.log(argv) * solc version bump * Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete * chain registration typescript scripts * Redeliver works! * Redelivery test works! * testnet deploy + relayer engine test * Testing two sends * Friday changes to round trip on testnet * Shortening current tests * Funds are correct! Relayer gets paid! * Remove extraneous comments * ts scripts for deployment and config * Wormhole Fee Test Co-authored-by: chase-45 <chasemoran45@gmail.com> Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 14:26:27 -08:00
pure
returns (DeliveryInstructionsContainer memory)
{
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
uint256 index = 0;
Move development branch to main (#23) * refactoring for multidelivery * partial ts-test fixes * use typechain in integration tests, update prettier, fix remaining integration tests * run formatter on solidity files * gas refunding * gas forwarding logic * msg.send -> refundAmount * minor test refactor & additions * created relayer engine directory * more testing & tilt environment config for relayer engine * starting work on the xMint example contracts * additions for relayer engine * minor modifications & todos * fixed some errors * refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend * Merged refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend with new interface' * refactoring interfaces & files for single VAA design * GasOracle implementation of new interface * GasOracle compiles * Gas oracle upgradable * Fix compile errors in GasOracleGovernance * minor core relayer cleanup * Changes to getters, setters, state * implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer * Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer * Fix encodeDeliveryRequestsContainer * added single vaa delivery entrypoint logic * Encode and Decode delivery instructions * Fixed many compile errors * First attempt at removing stacktoodeep error * Commenting out chunks of code to identify stack too deep error * Continue stack too deep quest * Revert "Commenting out chunks of code to identify stack too deep error" This reverts commit 8cd55d26cea2c49dc6e6bfa481c310f1a1c1143a. * Revert "Continue stack too deep quest" This reverts commit f0cde6871e26a7063e20d9a83b63b6a50e32bf37. * Fix stack too deep error in CoreRelayerMessages * tests compile, run, pass * fixing up fee collection assertions * GasOracle tests altering * Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction * adding evm events to delivery execution * forwarding refactor for single vaa * relay provider name refactor * Test file slight refactor to allow for multiple chains * first impl of hub and spoke example * Forward test progress * Forwarding test passes! * More general parameters for test * Testing file more modular, calls 'generic relayer' * redelivery implementation * removing todos * Tests can use arbitrary amount of chains * Address various TODOs * refactored RelayProvider to be upgradeable via proxy * Add overhead inteface to RelayProvider & adjusted necessary fee calculations * added TODOs related to rewardAddress payout * provider price quoting changes * provider payments made at source * Fixed all compile errors * testForward and testSend pass again! * Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface * First round of changes to support individual vaas in offchain relayer - Use new custom plugin event source api in relayer engine - Supports mulit delivery - Config for celo and fuji * contracts deploy successfully to tilt * bug fixes, contracts deploy to tilt * Starting the redelivery test * Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished * small plugin changes * MockRelayerIntegration is used for sending * prepare offchain relayer to run in both tilt and testnet * update readme and npm scripts for offchain relayer * nit: remove console.log(argv) * solc version bump * Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete * chain registration typescript scripts * Redeliver works! * Redelivery test works! * testnet deploy + relayer engine test * Testing two sends * Friday changes to round trip on testnet * Shortening current tests * Funds are correct! Relayer gets paid! * Remove extraneous comments * ts scripts for deployment and config * Wormhole Fee Test Co-authored-by: chase-45 <chasemoran45@gmail.com> Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 14:26:27 -08:00
uint8 payloadId = encoded.toUint8(index);
if (payloadId != 1) {
revert InvalidPayloadId(payloadId);
}
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
index += 1;
Move development branch to main (#23) * refactoring for multidelivery * partial ts-test fixes * use typechain in integration tests, update prettier, fix remaining integration tests * run formatter on solidity files * gas refunding * gas forwarding logic * msg.send -> refundAmount * minor test refactor & additions * created relayer engine directory * more testing & tilt environment config for relayer engine * starting work on the xMint example contracts * additions for relayer engine * minor modifications & todos * fixed some errors * refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend * Merged refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend with new interface' * refactoring interfaces & files for single VAA design * GasOracle implementation of new interface * GasOracle compiles * Gas oracle upgradable * Fix compile errors in GasOracleGovernance * minor core relayer cleanup * Changes to getters, setters, state * implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer * Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer * Fix encodeDeliveryRequestsContainer * added single vaa delivery entrypoint logic * Encode and Decode delivery instructions * Fixed many compile errors * First attempt at removing stacktoodeep error * Commenting out chunks of code to identify stack too deep error * Continue stack too deep quest * Revert "Commenting out chunks of code to identify stack too deep error" This reverts commit 8cd55d26cea2c49dc6e6bfa481c310f1a1c1143a. * Revert "Continue stack too deep quest" This reverts commit f0cde6871e26a7063e20d9a83b63b6a50e32bf37. * Fix stack too deep error in CoreRelayerMessages * tests compile, run, pass * fixing up fee collection assertions * GasOracle tests altering * Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction * adding evm events to delivery execution * forwarding refactor for single vaa * relay provider name refactor * Test file slight refactor to allow for multiple chains * first impl of hub and spoke example * Forward test progress * Forwarding test passes! * More general parameters for test * Testing file more modular, calls 'generic relayer' * redelivery implementation * removing todos * Tests can use arbitrary amount of chains * Address various TODOs * refactored RelayProvider to be upgradeable via proxy * Add overhead inteface to RelayProvider & adjusted necessary fee calculations * added TODOs related to rewardAddress payout * provider price quoting changes * provider payments made at source * Fixed all compile errors * testForward and testSend pass again! * Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface * First round of changes to support individual vaas in offchain relayer - Use new custom plugin event source api in relayer engine - Supports mulit delivery - Config for celo and fuji * contracts deploy successfully to tilt * bug fixes, contracts deploy to tilt * Starting the redelivery test * Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished * small plugin changes * MockRelayerIntegration is used for sending * prepare offchain relayer to run in both tilt and testnet * update readme and npm scripts for offchain relayer * nit: remove console.log(argv) * solc version bump * Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete * chain registration typescript scripts * Redeliver works! * Redelivery test works! * testnet deploy + relayer engine test * Testing two sends * Friday changes to round trip on testnet * Shortening current tests * Funds are correct! Relayer gets paid! * Remove extraneous comments * ts scripts for deployment and config * Wormhole Fee Test Co-authored-by: chase-45 <chasemoran45@gmail.com> Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 14:26:27 -08:00
bool sufficientlyFunded = encoded.toUint8(index) == 1;
index += 1;
uint8 arrayLen = encoded.toUint8(index);
index += 1;
2023-01-05 16:46:58 -08:00
Move development branch to main (#23) * refactoring for multidelivery * partial ts-test fixes * use typechain in integration tests, update prettier, fix remaining integration tests * run formatter on solidity files * gas refunding * gas forwarding logic * msg.send -> refundAmount * minor test refactor & additions * created relayer engine directory * more testing & tilt environment config for relayer engine * starting work on the xMint example contracts * additions for relayer engine * minor modifications & todos * fixed some errors * refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend * Merged refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend with new interface' * refactoring interfaces & files for single VAA design * GasOracle implementation of new interface * GasOracle compiles * Gas oracle upgradable * Fix compile errors in GasOracleGovernance * minor core relayer cleanup * Changes to getters, setters, state * implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer * Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer * Fix encodeDeliveryRequestsContainer * added single vaa delivery entrypoint logic * Encode and Decode delivery instructions * Fixed many compile errors * First attempt at removing stacktoodeep error * Commenting out chunks of code to identify stack too deep error * Continue stack too deep quest * Revert "Commenting out chunks of code to identify stack too deep error" This reverts commit 8cd55d26cea2c49dc6e6bfa481c310f1a1c1143a. * Revert "Continue stack too deep quest" This reverts commit f0cde6871e26a7063e20d9a83b63b6a50e32bf37. * Fix stack too deep error in CoreRelayerMessages * tests compile, run, pass * fixing up fee collection assertions * GasOracle tests altering * Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction * adding evm events to delivery execution * forwarding refactor for single vaa * relay provider name refactor * Test file slight refactor to allow for multiple chains * first impl of hub and spoke example * Forward test progress * Forwarding test passes! * More general parameters for test * Testing file more modular, calls 'generic relayer' * redelivery implementation * removing todos * Tests can use arbitrary amount of chains * Address various TODOs * refactored RelayProvider to be upgradeable via proxy * Add overhead inteface to RelayProvider & adjusted necessary fee calculations * added TODOs related to rewardAddress payout * provider price quoting changes * provider payments made at source * Fixed all compile errors * testForward and testSend pass again! * Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface * First round of changes to support individual vaas in offchain relayer - Use new custom plugin event source api in relayer engine - Supports mulit delivery - Config for celo and fuji * contracts deploy successfully to tilt * bug fixes, contracts deploy to tilt * Starting the redelivery test * Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished * small plugin changes * MockRelayerIntegration is used for sending * prepare offchain relayer to run in both tilt and testnet * update readme and npm scripts for offchain relayer * nit: remove console.log(argv) * solc version bump * Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete * chain registration typescript scripts * Redeliver works! * Redelivery test works! * testnet deploy + relayer engine test * Testing two sends * Friday changes to round trip on testnet * Shortening current tests * Funds are correct! Relayer gets paid! * Remove extraneous comments * ts scripts for deployment and config * Wormhole Fee Test Co-authored-by: chase-45 <chasemoran45@gmail.com> Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 14:26:27 -08:00
DeliveryInstruction[] memory instructionArray = new DeliveryInstruction[](arrayLen);
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
Move development branch to main (#23) * refactoring for multidelivery * partial ts-test fixes * use typechain in integration tests, update prettier, fix remaining integration tests * run formatter on solidity files * gas refunding * gas forwarding logic * msg.send -> refundAmount * minor test refactor & additions * created relayer engine directory * more testing & tilt environment config for relayer engine * starting work on the xMint example contracts * additions for relayer engine * minor modifications & todos * fixed some errors * refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend * Merged refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend with new interface' * refactoring interfaces & files for single VAA design * GasOracle implementation of new interface * GasOracle compiles * Gas oracle upgradable * Fix compile errors in GasOracleGovernance * minor core relayer cleanup * Changes to getters, setters, state * implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer * Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer * Fix encodeDeliveryRequestsContainer * added single vaa delivery entrypoint logic * Encode and Decode delivery instructions * Fixed many compile errors * First attempt at removing stacktoodeep error * Commenting out chunks of code to identify stack too deep error * Continue stack too deep quest * Revert "Commenting out chunks of code to identify stack too deep error" This reverts commit 8cd55d26cea2c49dc6e6bfa481c310f1a1c1143a. * Revert "Continue stack too deep quest" This reverts commit f0cde6871e26a7063e20d9a83b63b6a50e32bf37. * Fix stack too deep error in CoreRelayerMessages * tests compile, run, pass * fixing up fee collection assertions * GasOracle tests altering * Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction * adding evm events to delivery execution * forwarding refactor for single vaa * relay provider name refactor * Test file slight refactor to allow for multiple chains * first impl of hub and spoke example * Forward test progress * Forwarding test passes! * More general parameters for test * Testing file more modular, calls 'generic relayer' * redelivery implementation * removing todos * Tests can use arbitrary amount of chains * Address various TODOs * refactored RelayProvider to be upgradeable via proxy * Add overhead inteface to RelayProvider & adjusted necessary fee calculations * added TODOs related to rewardAddress payout * provider price quoting changes * provider payments made at source * Fixed all compile errors * testForward and testSend pass again! * Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface * First round of changes to support individual vaas in offchain relayer - Use new custom plugin event source api in relayer engine - Supports mulit delivery - Config for celo and fuji * contracts deploy successfully to tilt * bug fixes, contracts deploy to tilt * Starting the redelivery test * Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished * small plugin changes * MockRelayerIntegration is used for sending * prepare offchain relayer to run in both tilt and testnet * update readme and npm scripts for offchain relayer * nit: remove console.log(argv) * solc version bump * Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete * chain registration typescript scripts * Redeliver works! * Redelivery test works! * testnet deploy + relayer engine test * Testing two sends * Friday changes to round trip on testnet * Shortening current tests * Funds are correct! Relayer gets paid! * Remove extraneous comments * ts scripts for deployment and config * Wormhole Fee Test Co-authored-by: chase-45 <chasemoran45@gmail.com> Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 14:26:27 -08:00
for (uint8 i = 0; i < arrayLen; i++) {
DeliveryInstruction memory instruction;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
Move development branch to main (#23) * refactoring for multidelivery * partial ts-test fixes * use typechain in integration tests, update prettier, fix remaining integration tests * run formatter on solidity files * gas refunding * gas forwarding logic * msg.send -> refundAmount * minor test refactor & additions * created relayer engine directory * more testing & tilt environment config for relayer engine * starting work on the xMint example contracts * additions for relayer engine * minor modifications & todos * fixed some errors * refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend * Merged refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend with new interface' * refactoring interfaces & files for single VAA design * GasOracle implementation of new interface * GasOracle compiles * Gas oracle upgradable * Fix compile errors in GasOracleGovernance * minor core relayer cleanup * Changes to getters, setters, state * implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer * Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer * Fix encodeDeliveryRequestsContainer * added single vaa delivery entrypoint logic * Encode and Decode delivery instructions * Fixed many compile errors * First attempt at removing stacktoodeep error * Commenting out chunks of code to identify stack too deep error * Continue stack too deep quest * Revert "Commenting out chunks of code to identify stack too deep error" This reverts commit 8cd55d26cea2c49dc6e6bfa481c310f1a1c1143a. * Revert "Continue stack too deep quest" This reverts commit f0cde6871e26a7063e20d9a83b63b6a50e32bf37. * Fix stack too deep error in CoreRelayerMessages * tests compile, run, pass * fixing up fee collection assertions * GasOracle tests altering * Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction * adding evm events to delivery execution * forwarding refactor for single vaa * relay provider name refactor * Test file slight refactor to allow for multiple chains * first impl of hub and spoke example * Forward test progress * Forwarding test passes! * More general parameters for test * Testing file more modular, calls 'generic relayer' * redelivery implementation * removing todos * Tests can use arbitrary amount of chains * Address various TODOs * refactored RelayProvider to be upgradeable via proxy * Add overhead inteface to RelayProvider & adjusted necessary fee calculations * added TODOs related to rewardAddress payout * provider price quoting changes * provider payments made at source * Fixed all compile errors * testForward and testSend pass again! * Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface * First round of changes to support individual vaas in offchain relayer - Use new custom plugin event source api in relayer engine - Supports mulit delivery - Config for celo and fuji * contracts deploy successfully to tilt * bug fixes, contracts deploy to tilt * Starting the redelivery test * Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished * small plugin changes * MockRelayerIntegration is used for sending * prepare offchain relayer to run in both tilt and testnet * update readme and npm scripts for offchain relayer * nit: remove console.log(argv) * solc version bump * Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete * chain registration typescript scripts * Redeliver works! * Redelivery test works! * testnet deploy + relayer engine test * Testing two sends * Friday changes to round trip on testnet * Shortening current tests * Funds are correct! Relayer gets paid! * Remove extraneous comments * ts scripts for deployment and config * Wormhole Fee Test Co-authored-by: chase-45 <chasemoran45@gmail.com> Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 14:26:27 -08:00
// target chain of the delivery instruction
instruction.targetChain = encoded.toUint16(index);
index += 2;
2023-01-05 16:46:58 -08:00
Move development branch to main (#23) * refactoring for multidelivery * partial ts-test fixes * use typechain in integration tests, update prettier, fix remaining integration tests * run formatter on solidity files * gas refunding * gas forwarding logic * msg.send -> refundAmount * minor test refactor & additions * created relayer engine directory * more testing & tilt environment config for relayer engine * starting work on the xMint example contracts * additions for relayer engine * minor modifications & todos * fixed some errors * refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend * Merged refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend with new interface' * refactoring interfaces & files for single VAA design * GasOracle implementation of new interface * GasOracle compiles * Gas oracle upgradable * Fix compile errors in GasOracleGovernance * minor core relayer cleanup * Changes to getters, setters, state * implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer * Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer * Fix encodeDeliveryRequestsContainer * added single vaa delivery entrypoint logic * Encode and Decode delivery instructions * Fixed many compile errors * First attempt at removing stacktoodeep error * Commenting out chunks of code to identify stack too deep error * Continue stack too deep quest * Revert "Commenting out chunks of code to identify stack too deep error" This reverts commit 8cd55d26cea2c49dc6e6bfa481c310f1a1c1143a. * Revert "Continue stack too deep quest" This reverts commit f0cde6871e26a7063e20d9a83b63b6a50e32bf37. * Fix stack too deep error in CoreRelayerMessages * tests compile, run, pass * fixing up fee collection assertions * GasOracle tests altering * Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction * adding evm events to delivery execution * forwarding refactor for single vaa * relay provider name refactor * Test file slight refactor to allow for multiple chains * first impl of hub and spoke example * Forward test progress * Forwarding test passes! * More general parameters for test * Testing file more modular, calls 'generic relayer' * redelivery implementation * removing todos * Tests can use arbitrary amount of chains * Address various TODOs * refactored RelayProvider to be upgradeable via proxy * Add overhead inteface to RelayProvider & adjusted necessary fee calculations * added TODOs related to rewardAddress payout * provider price quoting changes * provider payments made at source * Fixed all compile errors * testForward and testSend pass again! * Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface * First round of changes to support individual vaas in offchain relayer - Use new custom plugin event source api in relayer engine - Supports mulit delivery - Config for celo and fuji * contracts deploy successfully to tilt * bug fixes, contracts deploy to tilt * Starting the redelivery test * Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished * small plugin changes * MockRelayerIntegration is used for sending * prepare offchain relayer to run in both tilt and testnet * update readme and npm scripts for offchain relayer * nit: remove console.log(argv) * solc version bump * Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete * chain registration typescript scripts * Redeliver works! * Redelivery test works! * testnet deploy + relayer engine test * Testing two sends * Friday changes to round trip on testnet * Shortening current tests * Funds are correct! Relayer gets paid! * Remove extraneous comments * ts scripts for deployment and config * Wormhole Fee Test Co-authored-by: chase-45 <chasemoran45@gmail.com> Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 14:26:27 -08:00
// target contract address
instruction.targetAddress = encoded.toBytes32(index);
index += 32;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
Move development branch to main (#23) * refactoring for multidelivery * partial ts-test fixes * use typechain in integration tests, update prettier, fix remaining integration tests * run formatter on solidity files * gas refunding * gas forwarding logic * msg.send -> refundAmount * minor test refactor & additions * created relayer engine directory * more testing & tilt environment config for relayer engine * starting work on the xMint example contracts * additions for relayer engine * minor modifications & todos * fixed some errors * refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend * Merged refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend with new interface' * refactoring interfaces & files for single VAA design * GasOracle implementation of new interface * GasOracle compiles * Gas oracle upgradable * Fix compile errors in GasOracleGovernance * minor core relayer cleanup * Changes to getters, setters, state * implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer * Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer * Fix encodeDeliveryRequestsContainer * added single vaa delivery entrypoint logic * Encode and Decode delivery instructions * Fixed many compile errors * First attempt at removing stacktoodeep error * Commenting out chunks of code to identify stack too deep error * Continue stack too deep quest * Revert "Commenting out chunks of code to identify stack too deep error" This reverts commit 8cd55d26cea2c49dc6e6bfa481c310f1a1c1143a. * Revert "Continue stack too deep quest" This reverts commit f0cde6871e26a7063e20d9a83b63b6a50e32bf37. * Fix stack too deep error in CoreRelayerMessages * tests compile, run, pass * fixing up fee collection assertions * GasOracle tests altering * Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction * adding evm events to delivery execution * forwarding refactor for single vaa * relay provider name refactor * Test file slight refactor to allow for multiple chains * first impl of hub and spoke example * Forward test progress * Forwarding test passes! * More general parameters for test * Testing file more modular, calls 'generic relayer' * redelivery implementation * removing todos * Tests can use arbitrary amount of chains * Address various TODOs * refactored RelayProvider to be upgradeable via proxy * Add overhead inteface to RelayProvider & adjusted necessary fee calculations * added TODOs related to rewardAddress payout * provider price quoting changes * provider payments made at source * Fixed all compile errors * testForward and testSend pass again! * Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface * First round of changes to support individual vaas in offchain relayer - Use new custom plugin event source api in relayer engine - Supports mulit delivery - Config for celo and fuji * contracts deploy successfully to tilt * bug fixes, contracts deploy to tilt * Starting the redelivery test * Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished * small plugin changes * MockRelayerIntegration is used for sending * prepare offchain relayer to run in both tilt and testnet * update readme and npm scripts for offchain relayer * nit: remove console.log(argv) * solc version bump * Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete * chain registration typescript scripts * Redeliver works! * Redelivery test works! * testnet deploy + relayer engine test * Testing two sends * Friday changes to round trip on testnet * Shortening current tests * Funds are correct! Relayer gets paid! * Remove extraneous comments * ts scripts for deployment and config * Wormhole Fee Test Co-authored-by: chase-45 <chasemoran45@gmail.com> Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 14:26:27 -08:00
// address to send the refund to
instruction.refundAddress = encoded.toBytes32(index);
index += 32;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
Move development branch to main (#23) * refactoring for multidelivery * partial ts-test fixes * use typechain in integration tests, update prettier, fix remaining integration tests * run formatter on solidity files * gas refunding * gas forwarding logic * msg.send -> refundAmount * minor test refactor & additions * created relayer engine directory * more testing & tilt environment config for relayer engine * starting work on the xMint example contracts * additions for relayer engine * minor modifications & todos * fixed some errors * refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend * Merged refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend with new interface' * refactoring interfaces & files for single VAA design * GasOracle implementation of new interface * GasOracle compiles * Gas oracle upgradable * Fix compile errors in GasOracleGovernance * minor core relayer cleanup * Changes to getters, setters, state * implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer * Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer * Fix encodeDeliveryRequestsContainer * added single vaa delivery entrypoint logic * Encode and Decode delivery instructions * Fixed many compile errors * First attempt at removing stacktoodeep error * Commenting out chunks of code to identify stack too deep error * Continue stack too deep quest * Revert "Commenting out chunks of code to identify stack too deep error" This reverts commit 8cd55d26cea2c49dc6e6bfa481c310f1a1c1143a. * Revert "Continue stack too deep quest" This reverts commit f0cde6871e26a7063e20d9a83b63b6a50e32bf37. * Fix stack too deep error in CoreRelayerMessages * tests compile, run, pass * fixing up fee collection assertions * GasOracle tests altering * Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction * adding evm events to delivery execution * forwarding refactor for single vaa * relay provider name refactor * Test file slight refactor to allow for multiple chains * first impl of hub and spoke example * Forward test progress * Forwarding test passes! * More general parameters for test * Testing file more modular, calls 'generic relayer' * redelivery implementation * removing todos * Tests can use arbitrary amount of chains * Address various TODOs * refactored RelayProvider to be upgradeable via proxy * Add overhead inteface to RelayProvider & adjusted necessary fee calculations * added TODOs related to rewardAddress payout * provider price quoting changes * provider payments made at source * Fixed all compile errors * testForward and testSend pass again! * Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface * First round of changes to support individual vaas in offchain relayer - Use new custom plugin event source api in relayer engine - Supports mulit delivery - Config for celo and fuji * contracts deploy successfully to tilt * bug fixes, contracts deploy to tilt * Starting the redelivery test * Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished * small plugin changes * MockRelayerIntegration is used for sending * prepare offchain relayer to run in both tilt and testnet * update readme and npm scripts for offchain relayer * nit: remove console.log(argv) * solc version bump * Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete * chain registration typescript scripts * Redeliver works! * Redelivery test works! * testnet deploy + relayer engine test * Testing two sends * Friday changes to round trip on testnet * Shortening current tests * Funds are correct! Relayer gets paid! * Remove extraneous comments * ts scripts for deployment and config * Wormhole Fee Test Co-authored-by: chase-45 <chasemoran45@gmail.com> Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 14:26:27 -08:00
instruction.maximumRefundTarget = encoded.toUint256(index);
index += 32;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
2023-02-10 12:33:00 -08:00
instruction.receiverValueTarget = encoded.toUint256(index);
Move development branch to main (#23) * refactoring for multidelivery * partial ts-test fixes * use typechain in integration tests, update prettier, fix remaining integration tests * run formatter on solidity files * gas refunding * gas forwarding logic * msg.send -> refundAmount * minor test refactor & additions * created relayer engine directory * more testing & tilt environment config for relayer engine * starting work on the xMint example contracts * additions for relayer engine * minor modifications & todos * fixed some errors * refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend * Merged refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend with new interface' * refactoring interfaces & files for single VAA design * GasOracle implementation of new interface * GasOracle compiles * Gas oracle upgradable * Fix compile errors in GasOracleGovernance * minor core relayer cleanup * Changes to getters, setters, state * implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer * Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer * Fix encodeDeliveryRequestsContainer * added single vaa delivery entrypoint logic * Encode and Decode delivery instructions * Fixed many compile errors * First attempt at removing stacktoodeep error * Commenting out chunks of code to identify stack too deep error * Continue stack too deep quest * Revert "Commenting out chunks of code to identify stack too deep error" This reverts commit 8cd55d26cea2c49dc6e6bfa481c310f1a1c1143a. * Revert "Continue stack too deep quest" This reverts commit f0cde6871e26a7063e20d9a83b63b6a50e32bf37. * Fix stack too deep error in CoreRelayerMessages * tests compile, run, pass * fixing up fee collection assertions * GasOracle tests altering * Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction * adding evm events to delivery execution * forwarding refactor for single vaa * relay provider name refactor * Test file slight refactor to allow for multiple chains * first impl of hub and spoke example * Forward test progress * Forwarding test passes! * More general parameters for test * Testing file more modular, calls 'generic relayer' * redelivery implementation * removing todos * Tests can use arbitrary amount of chains * Address various TODOs * refactored RelayProvider to be upgradeable via proxy * Add overhead inteface to RelayProvider & adjusted necessary fee calculations * added TODOs related to rewardAddress payout * provider price quoting changes * provider payments made at source * Fixed all compile errors * testForward and testSend pass again! * Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface * First round of changes to support individual vaas in offchain relayer - Use new custom plugin event source api in relayer engine - Supports mulit delivery - Config for celo and fuji * contracts deploy successfully to tilt * bug fixes, contracts deploy to tilt * Starting the redelivery test * Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished * small plugin changes * MockRelayerIntegration is used for sending * prepare offchain relayer to run in both tilt and testnet * update readme and npm scripts for offchain relayer * nit: remove console.log(argv) * solc version bump * Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete * chain registration typescript scripts * Redeliver works! * Redelivery test works! * testnet deploy + relayer engine test * Testing two sends * Friday changes to round trip on testnet * Shortening current tests * Funds are correct! Relayer gets paid! * Remove extraneous comments * ts scripts for deployment and config * Wormhole Fee Test Co-authored-by: chase-45 <chasemoran45@gmail.com> Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 14:26:27 -08:00
index += 32;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
Move development branch to main (#23) * refactoring for multidelivery * partial ts-test fixes * use typechain in integration tests, update prettier, fix remaining integration tests * run formatter on solidity files * gas refunding * gas forwarding logic * msg.send -> refundAmount * minor test refactor & additions * created relayer engine directory * more testing & tilt environment config for relayer engine * starting work on the xMint example contracts * additions for relayer engine * minor modifications & todos * fixed some errors * refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend * Merged refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend with new interface' * refactoring interfaces & files for single VAA design * GasOracle implementation of new interface * GasOracle compiles * Gas oracle upgradable * Fix compile errors in GasOracleGovernance * minor core relayer cleanup * Changes to getters, setters, state * implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer * Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer * Fix encodeDeliveryRequestsContainer * added single vaa delivery entrypoint logic * Encode and Decode delivery instructions * Fixed many compile errors * First attempt at removing stacktoodeep error * Commenting out chunks of code to identify stack too deep error * Continue stack too deep quest * Revert "Commenting out chunks of code to identify stack too deep error" This reverts commit 8cd55d26cea2c49dc6e6bfa481c310f1a1c1143a. * Revert "Continue stack too deep quest" This reverts commit f0cde6871e26a7063e20d9a83b63b6a50e32bf37. * Fix stack too deep error in CoreRelayerMessages * tests compile, run, pass * fixing up fee collection assertions * GasOracle tests altering * Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction * adding evm events to delivery execution * forwarding refactor for single vaa * relay provider name refactor * Test file slight refactor to allow for multiple chains * first impl of hub and spoke example * Forward test progress * Forwarding test passes! * More general parameters for test * Testing file more modular, calls 'generic relayer' * redelivery implementation * removing todos * Tests can use arbitrary amount of chains * Address various TODOs * refactored RelayProvider to be upgradeable via proxy * Add overhead inteface to RelayProvider & adjusted necessary fee calculations * added TODOs related to rewardAddress payout * provider price quoting changes * provider payments made at source * Fixed all compile errors * testForward and testSend pass again! * Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface * First round of changes to support individual vaas in offchain relayer - Use new custom plugin event source api in relayer engine - Supports mulit delivery - Config for celo and fuji * contracts deploy successfully to tilt * bug fixes, contracts deploy to tilt * Starting the redelivery test * Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished * small plugin changes * MockRelayerIntegration is used for sending * prepare offchain relayer to run in both tilt and testnet * update readme and npm scripts for offchain relayer * nit: remove console.log(argv) * solc version bump * Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete * chain registration typescript scripts * Redeliver works! * Redelivery test works! * testnet deploy + relayer engine test * Testing two sends * Friday changes to round trip on testnet * Shortening current tests * Funds are correct! Relayer gets paid! * Remove extraneous comments * ts scripts for deployment and config * Wormhole Fee Test Co-authored-by: chase-45 <chasemoran45@gmail.com> Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 14:26:27 -08:00
instruction.executionParameters.version = encoded.toUint8(index);
index += 1;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
Move development branch to main (#23) * refactoring for multidelivery * partial ts-test fixes * use typechain in integration tests, update prettier, fix remaining integration tests * run formatter on solidity files * gas refunding * gas forwarding logic * msg.send -> refundAmount * minor test refactor & additions * created relayer engine directory * more testing & tilt environment config for relayer engine * starting work on the xMint example contracts * additions for relayer engine * minor modifications & todos * fixed some errors * refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend * Merged refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend with new interface' * refactoring interfaces & files for single VAA design * GasOracle implementation of new interface * GasOracle compiles * Gas oracle upgradable * Fix compile errors in GasOracleGovernance * minor core relayer cleanup * Changes to getters, setters, state * implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer * Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer * Fix encodeDeliveryRequestsContainer * added single vaa delivery entrypoint logic * Encode and Decode delivery instructions * Fixed many compile errors * First attempt at removing stacktoodeep error * Commenting out chunks of code to identify stack too deep error * Continue stack too deep quest * Revert "Commenting out chunks of code to identify stack too deep error" This reverts commit 8cd55d26cea2c49dc6e6bfa481c310f1a1c1143a. * Revert "Continue stack too deep quest" This reverts commit f0cde6871e26a7063e20d9a83b63b6a50e32bf37. * Fix stack too deep error in CoreRelayerMessages * tests compile, run, pass * fixing up fee collection assertions * GasOracle tests altering * Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction * adding evm events to delivery execution * forwarding refactor for single vaa * relay provider name refactor * Test file slight refactor to allow for multiple chains * first impl of hub and spoke example * Forward test progress * Forwarding test passes! * More general parameters for test * Testing file more modular, calls 'generic relayer' * redelivery implementation * removing todos * Tests can use arbitrary amount of chains * Address various TODOs * refactored RelayProvider to be upgradeable via proxy * Add overhead inteface to RelayProvider & adjusted necessary fee calculations * added TODOs related to rewardAddress payout * provider price quoting changes * provider payments made at source * Fixed all compile errors * testForward and testSend pass again! * Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface * First round of changes to support individual vaas in offchain relayer - Use new custom plugin event source api in relayer engine - Supports mulit delivery - Config for celo and fuji * contracts deploy successfully to tilt * bug fixes, contracts deploy to tilt * Starting the redelivery test * Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished * small plugin changes * MockRelayerIntegration is used for sending * prepare offchain relayer to run in both tilt and testnet * update readme and npm scripts for offchain relayer * nit: remove console.log(argv) * solc version bump * Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete * chain registration typescript scripts * Redeliver works! * Redelivery test works! * testnet deploy + relayer engine test * Testing two sends * Friday changes to round trip on testnet * Shortening current tests * Funds are correct! Relayer gets paid! * Remove extraneous comments * ts scripts for deployment and config * Wormhole Fee Test Co-authored-by: chase-45 <chasemoran45@gmail.com> Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 14:26:27 -08:00
instruction.executionParameters.gasLimit = encoded.toUint32(index);
index += 4;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
Move development branch to main (#23) * refactoring for multidelivery * partial ts-test fixes * use typechain in integration tests, update prettier, fix remaining integration tests * run formatter on solidity files * gas refunding * gas forwarding logic * msg.send -> refundAmount * minor test refactor & additions * created relayer engine directory * more testing & tilt environment config for relayer engine * starting work on the xMint example contracts * additions for relayer engine * minor modifications & todos * fixed some errors * refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend * Merged refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend with new interface' * refactoring interfaces & files for single VAA design * GasOracle implementation of new interface * GasOracle compiles * Gas oracle upgradable * Fix compile errors in GasOracleGovernance * minor core relayer cleanup * Changes to getters, setters, state * implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer * Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer * Fix encodeDeliveryRequestsContainer * added single vaa delivery entrypoint logic * Encode and Decode delivery instructions * Fixed many compile errors * First attempt at removing stacktoodeep error * Commenting out chunks of code to identify stack too deep error * Continue stack too deep quest * Revert "Commenting out chunks of code to identify stack too deep error" This reverts commit 8cd55d26cea2c49dc6e6bfa481c310f1a1c1143a. * Revert "Continue stack too deep quest" This reverts commit f0cde6871e26a7063e20d9a83b63b6a50e32bf37. * Fix stack too deep error in CoreRelayerMessages * tests compile, run, pass * fixing up fee collection assertions * GasOracle tests altering * Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction * adding evm events to delivery execution * forwarding refactor for single vaa * relay provider name refactor * Test file slight refactor to allow for multiple chains * first impl of hub and spoke example * Forward test progress * Forwarding test passes! * More general parameters for test * Testing file more modular, calls 'generic relayer' * redelivery implementation * removing todos * Tests can use arbitrary amount of chains * Address various TODOs * refactored RelayProvider to be upgradeable via proxy * Add overhead inteface to RelayProvider & adjusted necessary fee calculations * added TODOs related to rewardAddress payout * provider price quoting changes * provider payments made at source * Fixed all compile errors * testForward and testSend pass again! * Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface * First round of changes to support individual vaas in offchain relayer - Use new custom plugin event source api in relayer engine - Supports mulit delivery - Config for celo and fuji * contracts deploy successfully to tilt * bug fixes, contracts deploy to tilt * Starting the redelivery test * Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished * small plugin changes * MockRelayerIntegration is used for sending * prepare offchain relayer to run in both tilt and testnet * update readme and npm scripts for offchain relayer * nit: remove console.log(argv) * solc version bump * Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete * chain registration typescript scripts * Redeliver works! * Redelivery test works! * testnet deploy + relayer engine test * Testing two sends * Friday changes to round trip on testnet * Shortening current tests * Funds are correct! Relayer gets paid! * Remove extraneous comments * ts scripts for deployment and config * Wormhole Fee Test Co-authored-by: chase-45 <chasemoran45@gmail.com> Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 14:26:27 -08:00
instruction.executionParameters.providerDeliveryAddress = encoded.toBytes32(index);
index += 32;
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
Move development branch to main (#23) * refactoring for multidelivery * partial ts-test fixes * use typechain in integration tests, update prettier, fix remaining integration tests * run formatter on solidity files * gas refunding * gas forwarding logic * msg.send -> refundAmount * minor test refactor & additions * created relayer engine directory * more testing & tilt environment config for relayer engine * starting work on the xMint example contracts * additions for relayer engine * minor modifications & todos * fixed some errors * refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend * Merged refactoring + cleaned up some TODOs * updated ICoreRelayer interface * adjusted tests for new interface * Working testSend with new interface' * refactoring interfaces & files for single VAA design * GasOracle implementation of new interface * GasOracle compiles * Gas oracle upgradable * Fix compile errors in GasOracleGovernance * minor core relayer cleanup * Changes to getters, setters, state * implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer * Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer * Fix encodeDeliveryRequestsContainer * added single vaa delivery entrypoint logic * Encode and Decode delivery instructions * Fixed many compile errors * First attempt at removing stacktoodeep error * Commenting out chunks of code to identify stack too deep error * Continue stack too deep quest * Revert "Commenting out chunks of code to identify stack too deep error" This reverts commit 8cd55d26cea2c49dc6e6bfa481c310f1a1c1143a. * Revert "Continue stack too deep quest" This reverts commit f0cde6871e26a7063e20d9a83b63b6a50e32bf37. * Fix stack too deep error in CoreRelayerMessages * tests compile, run, pass * fixing up fee collection assertions * GasOracle tests altering * Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction * adding evm events to delivery execution * forwarding refactor for single vaa * relay provider name refactor * Test file slight refactor to allow for multiple chains * first impl of hub and spoke example * Forward test progress * Forwarding test passes! * More general parameters for test * Testing file more modular, calls 'generic relayer' * redelivery implementation * removing todos * Tests can use arbitrary amount of chains * Address various TODOs * refactored RelayProvider to be upgradeable via proxy * Add overhead inteface to RelayProvider & adjusted necessary fee calculations * added TODOs related to rewardAddress payout * provider price quoting changes * provider payments made at source * Fixed all compile errors * testForward and testSend pass again! * Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface * First round of changes to support individual vaas in offchain relayer - Use new custom plugin event source api in relayer engine - Supports mulit delivery - Config for celo and fuji * contracts deploy successfully to tilt * bug fixes, contracts deploy to tilt * Starting the redelivery test * Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished * small plugin changes * MockRelayerIntegration is used for sending * prepare offchain relayer to run in both tilt and testnet * update readme and npm scripts for offchain relayer * nit: remove console.log(argv) * solc version bump * Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete * chain registration typescript scripts * Redeliver works! * Redelivery test works! * testnet deploy + relayer engine test * Testing two sends * Friday changes to round trip on testnet * Shortening current tests * Funds are correct! Relayer gets paid! * Remove extraneous comments * ts scripts for deployment and config * Wormhole Fee Test Co-authored-by: chase-45 <chasemoran45@gmail.com> Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 14:26:27 -08:00
instructionArray[i] = instruction;
}
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
if (index != encoded.length) {
revert InvalidDeliveryInstructionsPayload(encoded.length);
}
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
return DeliveryInstructionsContainer({
payloadId: payloadId,
sufficientlyFunded: sufficientlyFunded,
instructions: instructionArray
});
Add tests for send and deliver functionality (#9) * Complete send and deliver functionality * Clean up * Add tests for relayer send method * ethereum: remove interfaces * ethereum: fix test * ethereum: rename directory * ethereum: clean up; add ts tests * Add tests and clean up * ethereum: fix test * ethereum: fix output * Add reentrancy protection and reduce gas overhead for relayers * Add tests for full batch delivery * Update relayer contracts to reflect changes to batch VAA implementation * add rewards payout * implement redeliveries, replay protection * Complete full batch test suite * sdk: add sdk * sdk: fix package.json * Add partial batch unit test and add to integration test * Fix comments in integration test * sdk: fix tsconfig.json * ethereum: fix build * Add relayer registration to integration test * Finish integration test suite * ethereum: fix readAbi * ethereum: fix merge conflict * Complete full batch test suite * Add partial batch unit test and add to integration test * Finish integration test suite * Fix local validator test * Fix merge conflict * Add Makefile * Add documentation to relayer contracts * Fix Makefile * ethereum: clean up * ethereum: fix interface * ethereum: fix method names and tests * Prepare integration test for off-chain relayer changes * Refactor contracts Co-authored-by: Drew <dsterioti@users.noreply.github.com> Co-authored-by: Karl Kempe <karlkempe@users.noreply.github.com> Co-authored-by: valentin <valentinvonalbrecht@yahoo.de> Co-authored-by: justinschuldt <justinschuldt@gmail.com>
2022-09-30 09:18:49 -07:00
}
}