Skip to content

Commit 73ee842

Browse files
Add CodecID to ICM README (#3759)
Co-authored-by: Stephen Buttolph <[email protected]>
1 parent c84be10 commit 73ee842

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

vms/platformvm/warp/README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,20 @@ BLS provides a way to aggregate signatures off chain into a single signature tha
2727
Unsigned Message:
2828

2929
```
30-
+-----------------+----------+--------------------------+
31-
| network_id : uint32 | 4 bytes |
32-
+-----------------+----------+--------------------------+
33-
| source_chain_id : [32]byte | 32 bytes |
34-
+-----------------+----------+--------------------------+
35-
| payload : []byte | 4 + size(payload) |
36-
+-----------------+----------+--------------------------+
37-
| 40 + size(payload) bytes|
38-
+--------------------------+
30+
+---------------+----------+--------------------------+
31+
| codecID : uint16 | 2 bytes |
32+
+---------------+----------+--------------------------+
33+
| networkID : uint32 | 4 bytes |
34+
+---------------+----------+--------------------------+
35+
| sourceChainId : [32]byte | 32 bytes |
36+
+---------------+----------+--------------------------+
37+
| payload : []byte | 4 + size(payload) |
38+
+---------------+----------+--------------------------+
39+
| 42 + size(payload) bytes|
40+
+--------------------------+
3941
```
4042

43+
- `codecID` is the codec version used to serialize the payload and is hardcoded to `0x0000`
4144
- `networkID` is the unique ID of an Avalanche Network (Mainnet/Testnet) and provides replay protection for BLS Signers across different Avalanche Networks
4245
- `sourceChainID` is the hash of the transaction that created the blockchain on the Avalanche P-Chain. It serves as the unique identifier for the blockchain across the Avalanche Network so that each blockchain can only sign a message with its own id.
4346
- `payload` provides an arbitrary byte array containing the contents of the message. VMs define their own message types to include in the `payload`

vms/platformvm/warp/message_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ import (
1717
func TestMessage(t *testing.T) {
1818
require := require.New(t)
1919

20+
payload := []byte("payload")
21+
2022
unsignedMsg, err := NewUnsignedMessage(
2123
constants.UnitTestID,
2224
ids.GenerateTestID(),
23-
[]byte("payload"),
25+
payload,
2426
)
2527
require.NoError(err)
28+
require.Len(unsignedMsg.Bytes(), 42+len(payload))
2629

2730
msg, err := NewMessage(
2831
unsignedMsg,

0 commit comments

Comments
 (0)