You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: learn/infrastructure/vaas.md
+16-21
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,8 @@
1
1
---
2
2
title: VAAs
3
-
description: Learn about Verified Action Approvals (VAAs) in Wormhole, their structure, validation, and role in cross-chain communication.
3
+
description: Learn about Verified Action Approvals (VAAs) in Wormhole, their structure, validation, and role in cross-chain communication.
4
4
---
5
5
6
-
<!--
7
-
code boxes need to be displayed in another way
8
-
[link](#){target=\_blank}
9
-
-->
10
-
11
6
# Verified Action Approvals
12
7
13
8
VAAs are Wormhole's core messaging primitive. They are packets of cross-chain data that are emitted any time a cross-chain application contract interacts with the Core Contract.
@@ -42,20 +37,20 @@ Where each `signature` is:
42
37
43
38
### Body
44
39
45
-
The body is _deterministically_ derived from an on-chain message. Any two Guardians must derive the exact same body. This requirement exists so that there is always a one-to-one relationship between VAAs and messages to avoid doubleprocessing of messages.
40
+
The body is _deterministically_ derived from an on-chain message. Any two Guardians must derive the same body. This requirement exists so that there is always a one-to-one relationship between VAAs and messages to avoid double-processing of messages.
46
41
47
42
-`timestamp` ++"u32"++ - the timestamp of the block this message was published in
48
43
-`nonce` ++"u32"++
49
44
-`emitter_chain` ++"u16"++ - the id of the chain that emitted the message
50
45
-`emitter_address` ++"[32]byte"++ - the contract address (wormhole formatted) that called the core contract
51
-
-`sequence` ++"u64"++ - the autoincrementing integer that represents the number of messages published by this emitter
46
+
-`sequence` ++"u64"++ - the auto-incrementing integer that represents the number of messages published by this emitter
52
47
-`consistency_level` ++"u8"++ - the consistency level (finality) required by this emitter
53
48
-`payload` ++"[]byte"++ - arbitrary bytes containing the data to be acted on
54
49
55
-
The body is the relevant information for consumers and is handed back from a call like `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.
50
+
The body contains relevant information for consumers and is handed back from a call like `parseAndVerifyVAA`. Because the `emitterAddress` is included as part of the body, the developer can tell if this VAA originated from a trusted contract.
56
51
57
52
!!! note
58
-
Because VAAs have no destination, they are effectively multicast. They will be verified as authentic by any Core Contract on any chain in the network. If a VAA has a specific destination, it is entirely the responsibility of relayers to complete that delivery appropriately.
53
+
Because VAAs have no destination, they are effectively multicast. Any Core Contract on any chain in the network will verify them as authentic. If a VAA has a specific destination, relayers are entirely responsible for completing that delivery appropriately.
59
54
60
55
## Signatures
61
56
@@ -72,11 +67,11 @@ The body of the VAA is hashed twice with `keccak256` to produce the signed diges
72
67
73
68
## Payload Types
74
69
75
-
Different applications that are built on Wormhole may specify a format for the payloads attached to a VAA. This payload provides information on the target chain and contract so it can take some action (e.g., minting tokens to a receiver address).
70
+
Different applications built on Wormhole may specify a format for the payloads attached to a VAA. This payload provides information on the target chain and contract so it can take action (e.g., minting tokens to a receiver address).
76
71
77
72
### Token Transfer
78
73
79
-
Tokens are transferred from one chain to another using a lockup/mint and burn/unlock mechanism. While many bridges work on this basic premise, this implementation achieves this by relying on the generic message-passing protocol provided by Wormhole to support routing the lock and burn events from one chain to another. This makes Wormhole's token bridge ultimately chain-agnostic. An implementation can be quickly incorporated into the network as long as a wormhole contract exists on the chain we wish to transfer to. Due to the generic message-passing nature of Wormhole, programs emitting messages do not need to know anything about the implementation details of any other chain.
74
+
Tokens are transferred from one chain to another using a lockup/mint and burn/unlock mechanism. While many bridges work on this basic premise, this implementation achieves this by relying on the generic message-passing protocol provided by Wormhole to support routing the lock and burn events from one chain to another. This makes Wormhole's token bridge ultimately chain-agnostic. An implementation can be quickly incorporated into the network if a wormhole contract exists on the chain we wish to transfer to. Due to the generic message-passing nature of Wormhole, programs emitting messages do not need to know anything about the implementation details of any other chain.
80
75
81
76
To transfer tokens from A to B, we must lock the tokens on A and mint them on B. The tokens on A must be proven to be locked before the minting can occur on B. To facilitate this process, chain A first locks the tokens and emits a message indicating that the locking has been completed. This message has the following structure and is referred to as a transfer message:
82
77
@@ -96,7 +91,7 @@ Note that Chain B is agnostic regarding how the tokens on the sending side were
96
91
97
92
The Transfer event above needs an important detail added. While the program on Chain B can trust the message to inform it of token lockup events, it has no way of knowing what the token being locked up actually is. The address alone is a meaningless value to most users. To solve this, the Token Bridge supports token attestation.
98
93
99
-
For a token attestation, Chain A emits a message containing metadata about a token which Chain B may use to preserve the name, symbol, and decimal precision of a token address.
94
+
For a token attestation, Chain A emits a message containing metadata about a token, which Chain B may use to preserve the name, symbol, and decimal precision of a token address.
100
95
101
96
The message format for this action is as follows:
102
97
@@ -110,23 +105,23 @@ The message format for this action is as follows:
110
105
Attestations use a fixed-length byte array to encode UTF8 token name and symbol data.
111
106
112
107
!!! note
113
-
Because the byte array is fixed length, the data contained may truncate multibyte unicode characters.
108
+
Because the byte array is fixed length, the data contained may truncate multibyte Unicode characters.
114
109
115
110
When sending an attestation VAA, we recommend sending the longest UTF8 prefix that does NOT truncate a character and right-padding it with 0 bytes.
116
111
117
112
When parsing an attestation VAA, we recommend trimming all trailing 0 bytes and converting the remainder to UTF8 via any lossy algorithm.
118
113
119
114
!!! note
120
-
Be mindful that different on-chain systems may have different VAA parsers, which may result in different names/symbols on different chains if the string is long or contains invalid UTF8.
115
+
Be mindful that different on-chain systems may have different VAA parsers, resulting in different names/symbols on different chains if the string is long or contains invalid UTF8.
121
116
122
-
An essential detail of the token bridge is that an attestation is required before a token can be transferred. This is because without knowing a token's decimal precision, it is not possible for Chain B to correctly mint the correct amount of tokens when processing a transfer.
117
+
An essential detail of the token bridge is that an attestation is required before a token can be transferred. Without knowing a token's decimal precision, Chain B cannot correctly mint the correct amount of tokens when processing a transfer.
123
118
124
119
### Token + Message
125
120
126
121
!!! note
127
122
This VAA type is also referred to as a payload3 message or a Contract Controlled Transfer.
128
123
129
-
The Token + Message data structure is identical to the token-only data structure with the addition of a `payload` field that contains arbitrary bytes. This arbitrary byte field is where an app may include additional data in the transfer to inform some application-specific behavior.
124
+
The Token + Message data structure is identical to the token-only data structure with the addition of a `payload` field containing arbitrary bytes. In this arbitrary byte field, an app may include additional data in the transfer to inform some application-specific behavior.
130
125
131
126
-`payload_id = 3` ++"u8"++ - token transfer with wessage
132
127
-`amount` ++"u256"++ - amount of tokens being transferred
@@ -150,7 +145,7 @@ Governance messages contain pre-defined actions, which can target the various Wo
150
145
-`chain` ++"u16"++ - chain the action is targeting, 0 = all chains
151
146
-`args` ++"..."++ - arguments to the action
152
147
153
-
Here is an example message containing a governance action triggering a code upgrade to the Solana core contract. The module field here is a right-aligned encoding of the ASCII "Core", represented as a 32-byte hex string.
148
+
Below is an example message containing a governance action triggering a code upgrade to the Solana core contract. The module field here is a right-aligned encoding of the ASCII "Core", represented as a 32-byte hex string.
@@ -161,7 +156,7 @@ Here is an example message containing a governance action triggering a code upgr
161
156
The meaning of each numeric action is pre-defined and documented in the Wormhole design documents. For each application, the relevant definitions can be found via these links:
162
157
163
158
- Core governance actions are documented in the their [whitepaper](https://github.com/wormhole-foundation/wormhole/blob/main/whitepapers/0002_governance_messaging.md){target=\_blank}
164
-
- Token Bridge governance actions are documented in the their [whitepaper](https://github.com/wormhole-foundation/wormhole/blob/main/whitepapers/0003_token_bridge.md){target=\_blank}
159
+
- Token Bridge governance actions are documented in their [whitepaper](https://github.com/wormhole-foundation/wormhole/blob/main/whitepapers/0003_token_bridge.md){target=\_blank}
165
160
- NFT Bridge governance actions are documented in their [whitepaper](https://github.com/wormhole-foundation/wormhole/blob/main/whitepapers/0006_nft_bridge.md){target=\_blank}
166
161
167
162
## Lifetime of a Message
@@ -172,6 +167,6 @@ The meaning of each numeric action is pre-defined and documented in the Wormhole
172
167
With the concepts now defined, we can illustrate what a full flow for a message passing between two chains looks like. The following stages demonstrate each stage of processing the Wormhole network performs in order to route a message.
173
168
174
169
1.**A message is emitted by a contract running on chain A** - any contract can emit messages, and the Guardians are programmed to observe all chains for these events. Here, the Guardians are represented as a single entity to simplify the graphics, but the observation of the message must be performed individually by each of the 19 Guardians
175
-
2.**Signatures are aggregated** - Guardians observe and sign the message independently. Once enough Guardians have signed the message, the collection of signatures are combined with the message and metadata to produce a VAA
176
-
3.**VAA submitted to target chain** - the VAA acts as proof that the Guardians have collectively attested the existence of the message payload; in order to complete the final step, the VAA itself is submitted (or relayed) to the target chain to be processed by a receiving contract
170
+
2.**Signatures are aggregated** - Guardians observe and sign the message independently. Once enough Guardians have signed the message, the collection of signatures is combined with the message and metadata to produce a VAA
171
+
3.**VAA submitted to target chain** - the VAA acts as proof that the Guardians have collectively attested the existence of the message payload; to complete the final step, the VAA itself is submitted (or relayed) to the target chain to be processed by a receiving contract
0 commit comments