interface refinement

This commit is contained in:
chase-45 2023-02-10 13:36:08 -05:00 committed by chase-45
parent b62927362b
commit 67ff0b3baa
13 changed files with 280 additions and 287 deletions

View File

@ -11,23 +11,16 @@ import "./CoreRelayerStructs.sol";
contract CoreRelayer is CoreRelayerGovernance {
using BytesLib for bytes;
event DeliverySuccess(
bytes32 indexed deliveryVaaHash, address indexed recipientContract, uint16 sourceChain, uint64 indexed sequence
);
event DeliveryFailure(
bytes32 indexed deliveryVaaHash, address indexed recipientContract, uint16 sourceChain, uint64 indexed sequence
);
event ForwardRequestFailure(
bytes32 indexed deliveryVaaHash, address indexed recipientContract, uint16 sourceChain, uint64 indexed sequence
);
event ForwardRequestSuccess(
bytes32 indexed deliveryVaaHash, address indexed recipientContract, uint16 sourceChain, uint64 indexed sequence
);
event InvalidRedelivery(
bytes32 indexed redeliveryVaaHash,
address indexed recipientContract,
uint16 sourceChain,
uint64 indexed sequence
enum DeliveryStatus {
SUCCESS,
RECEIVER_FAILURE,
FORWARD_REQUEST_FAILURE,
FORWARD_REQUEST_SUCCESS,
INVALID_REDELIVERY
}
event Delivery(
address indexed recipientContract, uint16 indexed sourceChain, uint64 indexed sequence, bytes32 deliveryVaaHash, uint8 status
);
error InsufficientFunds(string reason);
@ -121,7 +114,10 @@ contract CoreRelayer is CoreRelayerGovernance {
uint256 applicationBudgetTarget,
uint256 maximumRefund,
IRelayProvider provider
) internal returns (uint64 sequence) {
)
internal
returns (uint64 sequence)
{
bytes memory instruction = convertToEncodedRedeliveryByTxHashInstruction(
request,
applicationBudgetTarget,
@ -366,12 +362,14 @@ contract CoreRelayer is CoreRelayerGovernance {
requestFee = args.computeBudgetSource + args.applicationBudgetSource;
applicationBudgetTarget =
convertApplicationBudgetAmount(args.applicationBudgetSource, args.targetChain, args.provider);
uint256 overheadFeeSource = args.isDelivery
uint256 overheadFeeSource =
args.isDelivery
? args.provider.quoteDeliveryOverhead(args.targetChain)
: args.provider.quoteRedeliveryOverhead(args.targetChain);
uint256 overheadBudgetTarget =
assetConversionHelper(args.sourceChain, overheadFeeSource, args.targetChain, 1, 1, true, args.provider);
maximumRefund = args.isDelivery
maximumRefund =
args.isDelivery
? calculateTargetDeliveryMaximumRefund(args.targetChain, args.computeBudgetSource, args.provider)
: calculateTargetRedeliveryMaximumRefund(args.targetChain, args.computeBudgetSource, args.provider);
@ -401,7 +399,9 @@ contract CoreRelayer is CoreRelayerGovernance {
address payable relayerRefund,
uint16 sourceChain,
uint64 sourceSequence
) internal {
)
internal
{
//REVISE Decide whether we want to remove the DeliveryInstructionContainer from encodedVMs.
// lock the contract to prevent reentrancy
@ -424,7 +424,8 @@ contract CoreRelayer is CoreRelayerGovernance {
// to setup the arguments for the call just after our measurement.
// This means the refund could be off by a few units of gas.
// Thus, we ensure the overhead doesn't cause an overflow in our refund formula here.
uint256 gasUsed = (preGas - postGas) > internalInstruction.executionParameters.gasLimit
uint256 gasUsed =
(preGas - postGas) > internalInstruction.executionParameters.gasLimit
? internalInstruction.executionParameters.gasLimit
: (preGas - postGas);
@ -608,7 +609,11 @@ contract CoreRelayer is CoreRelayerGovernance {
function validateRedeliverySingle(
RedeliveryByTxHashInstruction memory redeliveryInstruction,
DeliveryInstruction memory originalInstruction
) internal view returns (DeliveryInstruction memory deliveryInstruction, bool isValid) {
)
internal
view
returns (DeliveryInstruction memory deliveryInstruction, bool isValid)
{
//All the same checks as delivery single, with a couple additional
isValid = true;
@ -745,7 +750,7 @@ contract CoreRelayer is CoreRelayerGovernance {
/**
* Given a targetChain, computeBudget, and a relay provider, this function calculates what the gas limit of the delivery transaction
* should be.
* should be.
*/
function calculateTargetGasDeliveryAmount(uint16 targetChain, uint256 computeBudget, IRelayProvider provider)
internal
@ -769,7 +774,7 @@ contract CoreRelayer is CoreRelayerGovernance {
/**
* Given a targetChain, computeBudget, and a relay provider, this function calculates what the gas limit of the redelivery transaction
* should be.
* should be.
*/
function calculateTargetGasRedeliveryAmount(uint16 targetChain, uint256 computeBudget, IRelayProvider provider)
internal
@ -796,7 +801,11 @@ contract CoreRelayer is CoreRelayerGovernance {
uint256 computeBudget,
uint256 deliveryOverhead,
IRelayProvider provider
) internal view returns (uint32 gasAmount) {
)
internal
view
returns (uint32 gasAmount)
{
if (computeBudget <= deliveryOverhead) {
gasAmount = 0;
} else {
@ -814,7 +823,11 @@ contract CoreRelayer is CoreRelayerGovernance {
uint256 computeBudget,
uint256 deliveryOverhead,
IRelayProvider provider
) internal view returns (uint256 maximumRefund) {
)
internal
view
returns (uint256 maximumRefund)
{
if (computeBudget >= deliveryOverhead) {
uint256 remainder = computeBudget - deliveryOverhead;
maximumRefund = assetConversionHelper(chainId(), remainder, targetChain, 1, 1, false, provider);
@ -848,7 +861,11 @@ contract CoreRelayer is CoreRelayerGovernance {
uint256 multiplierDenominator,
bool roundUp,
IRelayProvider provider
) internal view returns (uint256 targetAmount) {
)
internal
view
returns (uint256 targetAmount)
{
uint256 srcNativeCurrencyPrice = provider.quoteAssetPrice(sourceChain);
if (srcNativeCurrencyPrice == 0) {
revert SrcNativeCurrencyPriceIsZero();
@ -899,7 +916,11 @@ contract CoreRelayer is CoreRelayerGovernance {
uint256 maximumRefund,
uint32 gasLimit,
IRelayProvider provider
) internal view returns (bytes memory encoded) {
)
internal
view
returns (bytes memory encoded)
{
encoded = abi.encodePacked(
uint8(2), //version payload number
uint16(request.sourceChain),

View File

@ -21,7 +21,9 @@ contract CoreRelayerSetup is CoreRelayerSetters, ERC1967Upgrade {
uint16 governanceChainId,
bytes32 governanceContract,
uint256 evmChainId
) public {
)
public
{
// sanity check initial values
if (implementation == address(0)) {
revert ImplementationAddressIsZero();

View File

@ -126,21 +126,4 @@ abstract contract CoreRelayerStructs {
bool isValid;
}
// struct DeliveryStatus {
// uint8 payloadID; // payloadID = 2;
// bytes32 batchHash;
// bytes32 emitterAddress;
// uint64 sequence;
// uint16 deliveryCount;
// bool deliverySuccess;
// }
// // TODO: WIP
// struct RewardPayout {
// uint8 payloadID; // payloadID = 100; prevent collisions with new blueprint payloads
// uint16 fromChain;
// uint16 chain;
// uint256 amount;
// bytes32 receiver;
// }
}

View File

@ -31,7 +31,9 @@ contract XmintHub is ERC20, IWormholeReceiver {
address coreBridgeAddress,
address tokenBridgeAddress,
address coreRelayerAddress
) ERC20(name_, symbol_) {
)
ERC20(name_, symbol_)
{
owner = msg.sender;
core_bridge = IWormhole(coreBridgeAddress);
token_bridge = ITokenBridge(tokenBridgeAddress);
@ -40,7 +42,7 @@ contract XmintHub is ERC20, IWormholeReceiver {
/**
* This function is used to add spoke contract deployments into the trusted addresses of this
* contract.
* contract.
*/
function registerApplicationContracts(uint16 chainId, bytes32 emitterAddr) public {
require(msg.sender == owner, "Only owner can register new chains!");

View File

@ -1,208 +0,0 @@
// contracts/Messages.sol
// SPDX-License-Identifier: Apache 2
pragma solidity ^0.8.0;
import "./IRelayProvider.sol";
interface ICoreRelayer {
error InsufficientFunds(string reason);
error MsgValueTooLow(); // msg.value must cover the budget specified
error NonceIsZero();
error NoDeliveryInProcess();
error CantRequestMultipleForwards();
error RelayProviderDoesNotSupportTargetChain();
error RolloverChainNotIncluded(); // Rollover chain was not included in the forwarding request
error ChainNotFoundInDeliveryRequests(uint16 chainId); // Required chain not found in the delivery requests
error ReentrantCall();
error InvalidEmitterInOriginalDeliveryVM(uint8 index);
error InvalidRedeliveryVM(string reason);
error InvalidEmitterInRedeliveryVM();
error MismatchingRelayProvidersInRedelivery(); // The same relay provider must be specified when doing a single VAA redeliver
error ProviderAddressIsNotSender(); // msg.sender must be the provider
error RedeliveryRequestDoesNotTargetThisChain();
error OriginalDeliveryRequestDidNotTargetThisChain();
error InvalidVaa(uint8 index);
error InvalidEmitter();
error DeliveryRequestNotSufficientlyFunded(); // This delivery request was not sufficiently funded, and must request redelivery
error UnexpectedRelayer(); // Specified relayer is not the relayer delivering the message
error InsufficientRelayerFunds(); // The relayer didn't pass sufficient funds (msg.value does not cover the necessary budget fees)
error AlreadyDelivered(); // The message was already delivered.
error TargetChainIsNotThisChain(uint16 targetChainId);
error SrcNativeCurrencyPriceIsZero();
error DstNativeCurrencyPriceIsZero();
/**
* @dev This is the basic function for requesting delivery
*/
function requestDelivery(DeliveryRequest memory request, uint32 nonce, IRelayProvider provider)
external
payable
returns (uint64 sequence);
function requestForward(DeliveryRequest memory request, uint32 nonce, IRelayProvider provider) external payable;
function requestRedelivery(RedeliveryByTxHashRequest memory request, uint32 nonce, IRelayProvider provider)
external
payable
returns (uint64 sequence);
function requestMultidelivery(DeliveryRequestsContainer memory deliveryRequests, uint32 nonce)
external
payable
returns (uint64 sequence);
/**
* @dev When requesting a multiforward, the rollover chain is the chain where any remaining funds should be sent once all
* the requested budgets have been covered. The remaining funds will be added to the computeBudget of the rollover chain.
*/
function requestMultiforward(DeliveryRequestsContainer memory deliveryRequests, uint16 rolloverChain, uint32 nonce)
external
payable;
function deliverSingle(TargetDeliveryParametersSingle memory targetParams) external payable;
function redeliverSingle(TargetRedeliveryByTxHashParamsSingle memory targetParams) external payable;
// function requestRewardPayout(uint16 rewardChain, bytes32 receiver, uint32 nonce) external payable returns (uint64 sequence);
// function collectRewards(bytes memory encodedVm) external;
function toWormholeFormat(address addr) external pure returns (bytes32 whFormat);
function fromWormholeFormat(bytes32 whFormatAddress) external pure returns (address addr);
function getDefaultRelayProvider() external view returns (IRelayProvider);
function getDefaultRelayParams() external pure returns (bytes memory relayParams);
function quoteGasDeliveryFee(uint16 targetChain, uint32 gasLimit, IRelayProvider relayProvider)
external
pure
returns (uint256 deliveryQuote);
function quoteGasRedeliveryFee(uint16 targetChain, uint32 gasLimit, IRelayProvider relayProvider)
external
pure
returns (uint256 redeliveryQuote);
function quoteApplicationBudgetFee(uint16 targetChain, uint256 targetAmount, IRelayProvider provider)
external
pure
returns (uint256 nativeQuote);
function getDeliveryInstructionsContainer(bytes memory encoded)
external
view
returns (DeliveryInstructionsContainer memory container);
function getRedeliveryByTxHashInstruction(bytes memory encoded)
external
view
returns (RedeliveryByTxHashInstruction memory instruction);
struct DeliveryRequestsContainer {
uint8 payloadId; // payloadID = 1
address relayProviderAddress;
DeliveryRequest[] requests;
}
/**
* targetChain - the chain to send to in Wormhole Chain ID format.
* targetAddress - is the recipient contract address on the target chain (in Wormhole 32-byte address format).
* refundAddress - is the address where any remaining computeBudget should be sent at the end of the transaction. (In Wormhole address format. Must be on the target chain.)
* computeBudget - is the maximum amount (denominated in this chain's wei) that the relayer should spend on transaction fees (gas) for this delivery. Usually calculated from quoteEvmDeliveryPrice.
* applicationBudget - this amount (denominated in this chain's wei) will be converted to the target native currency and given to the recipient contract at the beginning of the delivery execution.
* relayParameters - optional payload which can alter relayer behavior.
*/
struct DeliveryRequest {
uint16 targetChain;
bytes32 targetAddress;
bytes32 refundAddress;
uint256 computeBudget;
uint256 applicationBudget;
bytes relayParameters; //Optional
}
struct RedeliveryByTxHashRequest {
uint16 sourceChain;
bytes32 sourceTxHash;
uint32 sourceNonce;
uint16 targetChain;
uint8 deliveryIndex;
uint8 multisendIndex;
uint256 newComputeBudget;
uint256 newApplicationBudget;
bytes newRelayParameters;
}
struct TargetDeliveryParameters {
// encoded batchVM to be delivered on the target chain
bytes encodedVM;
// Index of the delivery VM in a batch
uint8 deliveryIndex;
// Index of the target chain inside the delivery VM
uint8 multisendIndex;
//refund address
address payable relayerRefundAddress;
}
// Optional gasOverride which can be supplied by the relayer
// uint32 targetCallGasOverride;
struct TargetDeliveryParametersSingle {
// encoded batchVM to be delivered on the target chain
bytes[] encodedVMs;
// Index of the delivery VM in a batch
uint8 deliveryIndex;
// Index of the target chain inside the delivery VM
uint8 multisendIndex;
//refund address
address payable relayerRefundAddress;
}
// Optional gasOverride which can be supplied by the relayer
// uint32 targetCallGasOverride;
struct TargetRedeliveryByTxHashParamsSingle {
bytes redeliveryVM;
bytes[] sourceEncodedVMs;
address payable relayerRefundAddress;
}
//REVISE consider removing this, or keeping for future compatibility
// struct RelayParameters {
// }
struct DeliveryInstructionsContainer {
uint8 payloadId; //1
bool sufficientlyFunded;
DeliveryInstruction[] instructions;
}
struct DeliveryInstruction {
uint16 targetChain;
bytes32 targetAddress;
bytes32 refundAddress;
uint256 maximumRefundTarget;
uint256 applicationBudgetTarget;
ExecutionParameters executionParameters; //Has the gas limit to execute with
}
struct RedeliveryByTxHashInstruction {
uint8 payloadId; //2
uint16 sourceChain;
bytes32 sourceTxHash;
uint32 sourceNonce;
uint16 targetChain;
uint8 deliveryIndex;
uint8 multisendIndex;
uint256 newMaximumRefundTarget;
uint256 newApplicationBudgetTarget;
ExecutionParameters executionParameters;
}
struct ExecutionParameters {
uint8 version;
uint32 gasLimit;
bytes32 providerDeliveryAddress;
}
}

View File

@ -1,12 +0,0 @@
// contracts/Messages.sol
// SPDX-License-Identifier: Apache 2
pragma solidity ^0.8.0;
import "./IRelayProvider.sol";
interface ICoreRelayerGovernance {
function setDefaultRelayProvider(bytes memory vaa) external;
function registerCoreRelayerContract(bytes memory vaa) external;
}

View File

@ -0,0 +1,40 @@
// contracts/Messages.sol
// SPDX-License-Identifier: Apache 2
pragma solidity ^0.8.0;
interface IDelivery {
function deliverSingle(TargetDeliveryParametersSingle memory targetParams) external payable;
function redeliverSingle(TargetRedeliveryByTxHashParamsSingle memory targetParams) external payable;
struct TargetDeliveryParametersSingle {
// encoded batchVM to be delivered on the target chain
bytes[] encodedVMs;
// Index of the delivery VM in a batch
uint8 deliveryIndex;
// Index of the target chain inside the delivery VM
uint8 multisendIndex;
//refund address
address payable relayerRefundAddress;
}
struct TargetRedeliveryByTxHashParamsSingle {
bytes redeliveryVM;
bytes[] sourceEncodedVMs;
address payable relayerRefundAddress;
}
error InvalidEmitterInOriginalDeliveryVM(uint8 index);
error InvalidRedeliveryVM(string reason);
error InvalidEmitterInRedeliveryVM();
error MismatchingRelayProvidersInRedelivery(); // The same relay provider must be specified when doing a single VAA redeliver
error ProviderAddressIsNotSender(); // msg.sender must be the provider
error RedeliveryRequestDoesNotTargetThisChain();
error OriginalDeliveryRequestDidNotTargetThisChain();
error InvalidVaa(uint8 index);
error InvalidEmitter();
error DeliveryRequestNotSufficientlyFunded(); // This delivery request was not sufficiently funded, and must request redelivery
error InsufficientRelayerFunds(); // The relayer didn't pass sufficient funds (msg.value does not cover the necessary budget fees)
error TargetChainIsNotThisChain(uint16 targetChainId);
}

View File

@ -82,7 +82,10 @@ interface ITokenBridge {
bytes32 recipient,
uint256 arbiterFee,
uint32 nonce
) external payable returns (uint64 sequence);
)
external
payable
returns (uint64 sequence);
function transferTokensWithPayload(
address token,
@ -91,7 +94,10 @@ interface ITokenBridge {
bytes32 recipient,
uint32 nonce,
bytes memory payload
) external payable returns (uint64 sequence);
)
external
payable
returns (uint64 sequence);
function updateWrapped(bytes memory encodedVm) external returns (address token);

View File

@ -0,0 +1,123 @@
// SPDX-License-Identifier: Apache 2
pragma solidity ^0.8.0;
interface IWormholeRelayer {
/**
* @dev This is the basic function for requesting delivery
*/
function send(
uint16 targetChain,
bytes32 targetAddress,
bytes32 refundAddress,
uint256 maxTransactionFee,
uint256 receiverValue,
uint32 nonce
)
external
payable
returns (uint64 sequence);
function forward(
uint16 targetChain,
bytes32 targetAddress,
bytes32 refundAddress,
uint256 maxTransactionFee,
uint256 receiverValue,
uint32 nonce
)
external
payable;
function send(Send memory request, uint32 nonce, address relayProvider)
external
payable
returns (uint64 sequence);
function forward(Send memory request, uint32 nonce, address relayProvider) external payable;
function resend(ResendByTx memory request, uint32 nonce, address relayProvider)
external
payable
returns (uint64 sequence);
function multichainSend(MultichainSend memory deliveryRequests, uint32 nonce)
external
payable
returns (uint64 sequence);
/**
* @dev When requesting a multiforward, the rollover chain is the chain where any remaining funds should be sent once all
* the requested budgets have been covered. The remaining funds will be added to the computeBudget of the rollover chain.
*/
function multichainForward(MultichainSend memory deliveryRequests, uint16 rolloverChain, uint32 nonce)
external
payable;
function toWormholeFormat(address addr) external pure returns (bytes32 whFormat);
function fromWormholeFormat(bytes32 whFormatAddress) external pure returns (address addr);
function getDefaultRelayProvider() external view returns (address relayProvider);
function getDefaultRelayParams() external pure returns (bytes memory relayParams);
function quoteGas(uint16 targetChain, uint32 gasLimit, address relayProvider)
external
pure
returns (uint256 maxTransactionFee);
function quoteGasResend(uint16 targetChain, uint32 gasLimit, address relayProvider)
external
pure
returns (uint256 maxTransactionFee);
function quoteReceiverValue(uint16 targetChain, uint256 targetAmount, address relayProvider)
external
pure
returns (uint256 nativeQuote);
struct MultichainSend {
address relayProviderAddress;
Send[] requests;
}
/**
* targetChain - the chain to send to in Wormhole Chain ID format.
* targetAddress - is the recipient contract address on the target chain (in Wormhole 32-byte address format).
* refundAddress - is the address where any remaining computeBudget should be sent at the end of the transaction. (In Wormhole address format. Must be on the target chain.)
* computeBudget - is the maximum amount (denominated in this chain's wei) that the relayer should spend on transaction fees (gas) for this delivery. Usually calculated from quoteEvmDeliveryPrice.
* applicationBudget - this amount (denominated in this chain's wei) will be converted to the target native currency and given to the recipient contract at the beginning of the delivery execution.
* relayParameters - optional payload which can alter relayer behavior.
*/
struct Send {
uint16 targetChain;
bytes32 targetAddress;
bytes32 refundAddress;
uint256 maxTransactionFee;
uint256 receiverValue;
bytes relayParameters;
}
struct ResendByTx {
uint16 sourceChain;
bytes32 sourceTxHash;
uint32 sourceNonce;
uint16 targetChain;
uint8 deliveryIndex;
uint8 multisendIndex;
uint256 newMaxTransactionFee;
uint256 newReceiverValue;
bytes newRelayParameters;
}
error InsufficientFunds(string reason);
error MsgValueTooLow(); // msg.value must cover the budget specified
error NonceIsZero();
error NoDeliveryInProcess();
error MultipleForwardsRequested();
error RelayProviderDoesNotSupportTargetChain();
error RolloverChainNotIncluded(); // Rollover chain was not included in the forwarding request
error ChainNotFoundInDeliveryRequests(uint16 chainId); // Required chain not found in the delivery requests
error ReentrantCall();
}

View File

@ -45,7 +45,10 @@ contract MockRelayerIntegration is IWormholeReceiver {
uint16 targetChainId,
address destination,
address refundAddress
) public payable {
)
public
payable
{
executeSend(abi.encodePacked(uint8(1), _message), targetChainId, destination, refundAddress, 0, 1);
}
@ -56,7 +59,10 @@ contract MockRelayerIntegration is IWormholeReceiver {
address refundAddress,
uint256 applicationBudget,
uint32 nonce
) public payable {
)
public
payable
{
executeSend(fullMessage, targetChainId, destination, refundAddress, applicationBudget, nonce);
}
@ -67,7 +73,9 @@ contract MockRelayerIntegration is IWormholeReceiver {
address refundAddress,
uint256 applicationBudget,
uint32 nonce
) internal {
)
internal
{
wormhole.publishMessage{value: wormhole.messageFee()}(nonce, fullMessage, 200);
ICoreRelayer.DeliveryRequest memory request = ICoreRelayer.DeliveryRequest({

View File

@ -173,7 +173,10 @@ contract TestCoreRelayer is Test {
GasParameters memory gasParams,
FeeParameters memory feeParams,
uint32 minTargetGasLimit
) public returns (StandardSetupTwoChains memory s) {
)
public
returns (StandardSetupTwoChains memory s)
{
vm.assume(gasParams.evmGasOverhead > 0);
vm.assume(gasParams.targetGasLimit > 0);
vm.assume(feeParams.targetNativePrice > 0);
@ -296,7 +299,9 @@ contract TestCoreRelayer is Test {
uint16 currentChainId,
uint16 chainId,
bytes32 coreRelayerContractAddress
) internal {
)
internal
{
bytes32 coreRelayerModule = 0x000000000000000000000000000000000000000000436f726552656c61796572;
bytes memory message =
abi.encodePacked(coreRelayerModule, uint8(2), uint16(currentChainId), chainId, coreRelayerContractAddress);
@ -413,7 +418,9 @@ contract TestCoreRelayer is Test {
GasParameters memory gasParams,
FeeParameters memory feeParams,
bytes memory message
) public {
)
public
{
StandardSetupTwoChains memory setup = standardAssumeAndSetupTwoChains(gasParams, feeParams, 1000000);
vm.recordLogs();
@ -554,7 +561,9 @@ contract TestCoreRelayer is Test {
GasParameters memory gasParams,
FeeParameters memory feeParams,
bytes memory message
) public {
)
public
{
StandardSetupTwoChains memory setup = standardAssumeAndSetupTwoChains(gasParams, feeParams, 1000000);
vm.assume(feeParams.applicationBudgetTarget > 0);
vm.recordLogs();
@ -642,7 +651,9 @@ contract TestCoreRelayer is Test {
FeeParameters memory feeParams,
bytes memory message,
bytes memory secondMessage
) public {
)
public
{
StandardSetupTwoChains memory setup = standardAssumeAndSetupTwoChains(gasParams, feeParams, 1000000);
// estimate the cost based on the intialized values
@ -741,7 +752,9 @@ contract TestCoreRelayer is Test {
GasParameters memory gasParams,
FeeParameters memory feeParams,
bytes memory message
) public {
)
public
{
StandardSetupTwoChains memory setup = standardAssumeAndSetupTwoChains(gasParams, feeParams, 1000000);
vm.recordLogs();
@ -997,7 +1010,9 @@ contract TestCoreRelayer is Test {
GasParameters memory gasParams,
FeeParameters memory feeParams,
bytes memory message
) public {
)
public
{
StandardSetupTwoChains memory setup = standardAssumeAndSetupTwoChains(gasParams, feeParams, 1000000);
vm.recordLogs();
@ -1146,7 +1161,9 @@ contract TestCoreRelayer is Test {
GasParameters memory gasParams,
FeeParameters memory feeParams,
bytes memory message
) public {
)
public
{
StandardSetupTwoChains memory setup = standardAssumeAndSetupTwoChains(gasParams, feeParams, 1000000);
vm.recordLogs();
@ -1276,7 +1293,9 @@ contract TestCoreRelayer is Test {
bytes memory encodedVM,
bytes[] memory deliveryInstructions,
IWormhole.VM memory parsed
) internal {
)
internal
{
uint8 payloadId = parsed.payload.toUint8(0);
if (payloadId == 1) {
ICoreRelayer.DeliveryInstructionsContainer memory container =

View File

@ -85,7 +85,9 @@ contract TestRelayProvider is Test {
uint16 updateChainId,
uint128 updateGasPrice,
uint128 updateNativeCurrencyPrice
) public {
)
public
{
vm.assume(oracleOwner != address(0));
vm.assume(oracleOwner != address(this));
vm.assume(updateChainId > 0);
@ -157,7 +159,9 @@ contract TestRelayProvider is Test {
uint32 gasLimit,
uint32 deliverGasOverhead,
uint32 targetWormholeFee
) public {
)
public
{
vm.assume(dstChainId > 0);
vm.assume(dstChainId != TEST_ORACLE_CHAIN_ID);
vm.assume(dstGasPrice > 0);
@ -194,7 +198,9 @@ contract TestRelayProvider is Test {
uint32 gasLimit,
uint32 deliverGasOverhead,
uint32 targetWormholeFee
) public {
)
public
{
vm.assume(dstChainId > 0);
vm.assume(dstChainId != TEST_ORACLE_CHAIN_ID); // wormhole.chainId()
vm.assume(dstGasPrice > 0);

View File

@ -216,7 +216,10 @@ contract WormholeSimulator {
uint32 nonce,
uint16 emitterChainId,
address emitterAddress
) public returns (bytes memory signedMessage) {
)
public
returns (bytes memory signedMessage)
{
uint8 numObservations = 0;
IWormhole.VM[] memory vm_ = new IWormhole.VM[](logs.length);