consistency level changes

This commit is contained in:
chase-45 2022-10-17 13:44:28 -04:00
parent 7232b5e4a6
commit 0867523fc3
5 changed files with 21 additions and 19 deletions

View File

@ -17,7 +17,7 @@ When sending messages, you should follow the same paradigm as is used by the Wor
// A module is just a piece of code which knows how to emit a composable message
// which can be utilized by other contracts.
function emitMyMessage(address intendedRecipient, uint32 nonce)
public returns (uint64 sequence) {
public payable returns (uint64 sequence) {
// Nonce is passed though to the core bridge.
// This allows other contracts to utilize it for batching or processing.
@ -26,9 +26,8 @@ function emitMyMessage(address intendedRecipient, uint32 nonce)
// This field will allow the destination contract to enforce
// that the correct contract is submitting this VAA.
// 1 is the consistency level,
// this message will be emitted after only 1 block
sequence = core_bridge.publishMessage(nonce, "My Message to " + intendedRecipient, 1);
// consistency level 200 means instant emission
sequence = core_bridge.publishMessage(nonce, "My Message to " + intendedRecipient, 200);
// The sequence is passed back to the caller, which can be useful relay information.
// Relaying is not done here, because it would 'lock' others into the same relay mechanism.

View File

@ -32,8 +32,11 @@ To emit a VAA, always use `publishMessage` which takes in the following argument
1. `nonce` (uint32): a number assigned to each message
- The `nonce` provides a mechanism by which to group messages together within a Batch VAA. How the `nonce` is used is described below.
2. `Consistency` (uint8): the number of blocks that Guardians will wait before signing a message
- Each blockchain has different finality periods based on the consensus mechanism. In general, higher consistency values provides more security against blockchain reorgs. [Here](../../reference/contracts.md) are the consistency levels by blockchain that are used by the xAsset layer to have a high level of guarantee against reorgs.
2. `Consistency` (uint8): the level of finality the guardians will reach before signing the message
- Consistency should be considered an enum, not an integer.
- On all EVM chains, 200 will result in an instant message, while all other values will wait for finality.
- On BSC, the consistency denotes how many block confirmations will be waited before producing the message.
- More information about finality can be found [Here](../../reference/contracts.md)
3. `Payload` (bytes[]): raw bytes to emit
- It is up to the emitting contract to properly define this arbitrary set of bytes.

View File

@ -61,7 +61,7 @@ struct DeliveryParameters {
- `relayParameters`: information required to relay to the target env. Contains compute budget
- `chainPayload`: information used for computation efficiency when relaying to other ecosystems
- `nonce` (_optional_): If included, only messages with this nonce will be relayed
- `consistencyLevel`: how long to wait before emitting the relay request
- `consistencyLevel`: what level of consistency / finality to reach before emitting the message
- `msg.value`: payment in native currency to relayer that must cover the compute budget specified in the relayer parameters
## Compute Budget

View File

@ -8,7 +8,7 @@ In general, Core Contracts are simple and can be broekn down to a **sending** an
### Sending
Below is the mechanism by which Wormhole messages (aka Verified ACtion Approval, VAA) are emitted:
Below is the mechanism by which Wormhole messages (aka Verified Action Approval, VAA) are emitted:
publishMessage(
int nonce,
@ -16,17 +16,17 @@ Below is the mechanism by which Wormhole messages (aka Verified ACtion Approval,
int consistencyLevel
) returns int sequenceNumber
Let's break it down a bit:
Let's break it down a bit:
- **payload** - The content of the emitted message and an arbitrary byte array. It may be capped to a certain maximum length due to the constraints of individual blockchains.
- **consistencyLevel** - The number of blocks which the Guardians should wait prior to emitting a VAA for this message. This number is usually either 1 or equal to the chain's finality period. This is a defense against transactions being orphaned.
- **consistencyLevel** - The level of finality to reach before emitting the Wormhole VAA. This is a defense against reorgs and rollbacks.
- **nonce** - An index number for the message that is used to produce Batch VAAs. How this is generated is elaborated in the [CoreLayer](../technical/evm/coreLayer.md) section.
- **nonce** - An index number for the message that is used to produce Batch VAAs. How this is generated is elaborated in the [CoreLayer](../technical/evm/coreLayer.md) section.
- **sequenceNumber** - A unique index number for the message. When combined with the emitter contract address and emitter chain ID, the corresponding VAA can be retrieved from a guardian network node.
The implementation strategy for publishMessage differs by chain, but the general strategy consists of the Core Contract posting the emitterAddress (the contract which called publishMessage), sequenceNumber, and consistencyLevel into the blockchain logs. Once the desired consistencyLevel has elapsed and the message passes all of the Guardians' optional checks, the Guardian Network will produce the requested VAAs.
The implementation strategy for publishMessage differs by chain, but the general strategy consists of the Core Contract posting the emitterAddress (the contract which called publishMessage), sequenceNumber, and consistencyLevel into the blockchain logs. Once the desired consistencyLevel has been reached and the message passes all of the Guardians' optional checks, the Guardian Network will produce the requested VAAs.
Currently there are no fees to publish a message (with the exception of publishing on Solana) but this is not guaranteed to always be the case in the future.

View File

@ -20,7 +20,7 @@ The Header is used by the Core Contract to determine the authenticity of the VAA
u16 emitter_chain (Wormhole ChainId of emitter contract)
[32]byte emitter_address (Emitter contract address, in Wormhole format)
u64 sequence (Strictly increasing sequence, tied to emitter address & chain)
u8 consistency_level (How many blocks were waited before emitting this VAA)
u8 consistency_level (What finality level was reached before emitting this message)
[]byte payload (VAA message content)
The Body is the relevant information for consumers and is handed back from parseAndVerifyVAA. Because the emitterAddress is included as part of the Body, the developer is able to tell if this VAA originated from a trusted contract.