Add comments on vaa min length (#1206)
* Add proof of work on minVAALength * Change minVAALength to 57
This commit is contained in:
parent
e63d7f5b77
commit
1e6611ebb6
|
@ -198,7 +198,25 @@ const (
|
|||
// ChainIDEthereumRopsten is the ChainID of Ethereum Ropsten
|
||||
ChainIDEthereumRopsten ChainID = 10001
|
||||
|
||||
minVAALength = 1 + 4 + 52 + 4 + 1 + 1
|
||||
// Minimum VAA size is derrived from the following assumptions:
|
||||
// HEADER
|
||||
// - Supported VAA Version (1 byte)
|
||||
// - Guardian Set Index (4 bytes)
|
||||
// - Length of Signatures (1 byte) <== assume no signatures
|
||||
// - Actual Signatures (0 bytes)
|
||||
// BODY
|
||||
// - timestamp (4 bytes)
|
||||
// - nonce (4 bytes)
|
||||
// - emitter chain (2 bytes)
|
||||
// - emitter address (32 bytes)
|
||||
// - sequence (8 bytes)
|
||||
// - consistency level (1 byte)
|
||||
// - payload (0 bytes)
|
||||
//
|
||||
// From Above: 1 + 4 + 1 + 0 + 4 + 4 + 2 + 32 + 8 + 1 + 0 // Equals 57
|
||||
//
|
||||
// More details here: https://docs.wormholenetwork.com/wormhole/vaas
|
||||
minVAALength = 57
|
||||
SupportedVAAVersion = 0x01
|
||||
)
|
||||
|
||||
|
|
|
@ -114,6 +114,10 @@ func TestSignature_DataString(t *testing.T) {
|
|||
assert.Equal(t, sigData.String(), expected)
|
||||
}
|
||||
|
||||
func TestMinVAALength(t *testing.T) {
|
||||
assert.Equal(t, minVAALength, 57)
|
||||
}
|
||||
|
||||
func TestChainId_String(t *testing.T) {
|
||||
type test struct {
|
||||
input ChainID
|
||||
|
|
Loading…
Reference in New Issue