-
Notifications
You must be signed in to change notification settings - Fork 8
/
consts.go
79 lines (61 loc) · 2.67 KB
/
consts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package cnc
import (
"bytes"
"math"
)
const (
headerEndpoint = "/header"
balanceEndpoint = "/balance"
submitTxEndpoint = "/submit_tx"
submitPFBEndpoint = "/submit_pfb"
namespacedSharesEndpoint = "/namespaced_shares"
namespacedDataEndpoint = "/namespaced_data"
heightKey = "height"
)
const (
// NamespaveVersionSize is the size of a namespace version in bytes.
NamespaceVersionSize = 1
// NamespaceIDSize is the size of a namespace ID in bytes.
NamespaceIDSize = 28
// NamespaceSize is the size of a namespace (version + ID) in bytes.
NamespaceSize = NamespaceVersionSize + NamespaceIDSize
// NamespaceVersionZero is the first namespace version.
NamespaceVersionZero = uint8(0)
// NamespaceVersionMax is the max namespace version.
NamespaceVersionMax = math.MaxUint8
// NamespaceZeroPrefixSize is the number of `0` bytes that are prefixed to
// namespace IDs for version 0.
NamespaceVersionZeroPrefixSize = 18
// NamespaceVersionZeroIDSize is the number of bytes available for
// user-specified namespace ID in a namespace ID for version 0.
NamespaceVersionZeroIDSize = NamespaceIDSize - NamespaceVersionZeroPrefixSize
)
var (
// NamespaceVersionZeroPrefix is the prefix of a namespace ID for version 0.
NamespaceVersionZeroPrefix = bytes.Repeat([]byte{0}, NamespaceVersionZeroPrefixSize)
// TxNamespace is the namespace reserved for transaction data.
TxNamespace = MustNewV0([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 1})
// IntermediateStateRootsNamespace is the namespace reserved for
// intermediate state root data.
IntermediateStateRootsNamespace = MustNewV0([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 2})
// PayForBlobNamespace is the namespace reserved for PayForBlobs transactions.
PayForBlobNamespace = MustNewV0([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 4})
// ReservedPaddingNamespace is the namespace used for padding after all
// reserved namespaces. In practice this padding is after transactions
// (ordinary and PFBs) but before blobs.
ReservedPaddingNamespace = MustNewV0([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 255})
// MaxReservedNamespace is lexicographically the largest namespace that is
// reserved for protocol use.
MaxReservedNamespace = MustNewV0([]byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 255})
// TailPaddingNamespace is the namespace reserved for tail padding. All data
// with this namespace will be ignored.
TailPaddingNamespace = Namespace{
Version: math.MaxUint8,
ID: append(bytes.Repeat([]byte{0xFF}, NamespaceIDSize-1), 0xFE),
}
// ParitySharesNamespace is the namespace reserved for erasure coded data.
ParitySharesNamespace = Namespace{
Version: math.MaxUint8,
ID: bytes.Repeat([]byte{0xFF}, NamespaceIDSize),
}
)