Documentation
¶
Index ¶
- Constants
- type HashComponent
- type StateKey
- func NewBasic(i uint8) StateKey
- func NewPreimageLookup(serviceId block.ServiceId, hash crypto.Hash) (StateKey, error)
- func NewPreimageMeta(serviceId block.ServiceId, hash crypto.Hash, length uint32) (StateKey, error)
- func NewService(s block.ServiceId) (StateKey, error)
- func NewServiceDict(s block.ServiceId, h HashComponent) (StateKey, error)
- func NewStorage(serviceId block.ServiceId, hash crypto.Hash) (StateKey, error)
- func (s StateKey) ExtractChapterServiceID() (uint8, block.ServiceId, error)
- func (s StateKey) ExtractServiceIDHash() (block.ServiceId, HashComponent, error)
- func (s StateKey) IsChapterKey() bool
- func (s StateKey) IsPreimageLookupKey() (bool, error)
- func (s StateKey) IsServiceKey() bool
- func (s StateKey) IsStorageKey() (bool, error)
Constants ¶
const ( // Chapter component for service account state keys. ChapterServiceIndex uint8 = 255 // Hash component for storage state keys begins this this value little endian encoded. HashStorageIndex uint32 = math.MaxUint32 // Hash component for preimage lookup state keys begins this this value little endian encoded. HashPreimageLookupIndex uint32 = math.MaxUint32 - 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HashComponent ¶
type HashComponent [27]byte
The hash component of the state key constructor function. See equation D.1 in the graypaper 0.6.6
type StateKey ¶
type StateKey [31]byte
The output of the state key constructor function.
func NewBasic ¶
First arity of the stake-key constructor function See equation D.1 in the graypaper 0.6.6
func NewPreimageLookup ¶
Create a new preimage state key. ∀(s ↦ a) ∈ δ, (h ↦ p) ∈ ap ∶ C(s, E4(2^32 −2) ⌢ k_1...24) See equation D.2 in the graypaper v0.6.6
func NewPreimageMeta ¶
Create a new preimage state key. ∀(s ↦ a) ∈ δ, ((h,l) ↦ t) ∈ al ∶ C(s, E4(l) ⌢ H(h)_2...25) See equation D.2 in the graypaper v0.6.6
func NewService ¶
Second arity of the stake-key constructor function, (uint8, N_S) See equation D.1 in the graypaper v0.6.6
func NewServiceDict ¶
func NewServiceDict(s block.ServiceId, h HashComponent) (StateKey, error)
Last airity of the stake-key constructor function, (N_S, Y_27) See equation D.1 in the graypaper v0.6.6
func NewStorage ¶
Create a new storage state key. ∀(s ↦ a) ∈ δ, (k ↦ v) ∈ as ∶ C(s, E4(2^32 − 1) ⌢ k_0...23) See equation D.2 in the graypaper v0.6.6
func (StateKey) ExtractChapterServiceID ¶
Extracts the chapter and service ID components from a state key of airty 2. State key is the format: [i, n0, 0, n1, 0, n2, 0, n3, 0, 0,...] where i is an uint8, and n is the service ID (uint32) little endian encoded.
func (StateKey) ExtractServiceIDHash ¶
func (s StateKey) ExtractServiceIDHash() (block.ServiceId, HashComponent, error)
Extracts the service ID and hash components from a state key of airty 3. The state key is the format: [n0, h0, n1, h1, n2, h2, n3, h3, h4, h5,...] Where n is the server ID uint32 little endian encoded, and h is the hash component.
func (StateKey) IsChapterKey ¶
Checks if the given state key is a chapter key of the format: [i, 0, 0,...]
func (StateKey) IsPreimageLookupKey ¶
Checks if the given state key is a preimage lookup key of the format: [n0, 0xFE, n1, 0xFF, n2, 0xFF, n3, 0xFF, h4, h5,...] Where n is the service ID (uint32) little endian encoded, and h is the hash component.
func (StateKey) IsServiceKey ¶
Checks if the given state key is a service account key of the format: [255, n0, 0, n1, 0, n2, 0, n3, 0, 0,...] Where n is the service ID (uint32) little endian encoded.
func (StateKey) IsStorageKey ¶
Checks if the given state key is a storage key of the format: [n0, 0xFF, n1, 0xFF, n2, 0xFF, n3, 0xFF, h4, h5,...] Where n is the service ID (uint32) little endian encoded, and h is the hash component.