commitment

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2023 License: Apache-2.0, BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const Size = unsafe.Sizeof(commitment{})

Variables

This section is empty.

Functions

This section is empty.

Types

type Commitment

type Commitment struct {
	model.Immutable[Commitment, *Commitment, commitment] `serix:"0"`
}

func New

func New(index slot.Index, prevID ID, rootsID types.Identifier, cumulativeWeight int64) (newCommitment *Commitment)

func NewEmptyCommitment

func NewEmptyCommitment() (newCommitment *Commitment)

func (*Commitment) CumulativeWeight

func (c *Commitment) CumulativeWeight() (cumulativeWeight int64)

func (*Commitment) Equals

func (c *Commitment) Equals(other *Commitment) bool

func (*Commitment) ID

func (c *Commitment) ID() (id ID)

func (*Commitment) Index

func (c *Commitment) Index() (index slot.Index)

func (*Commitment) PrevID

func (c *Commitment) PrevID() (prevID ID)

func (*Commitment) RootsID

func (c *Commitment) RootsID() (rootsID types.Identifier)

type ID

type ID struct {
	SlotIndex  slot.Index       `serix:"0"`
	Identifier types.Identifier `serix:"1"`
}

func NewID

func NewID(index slot.Index, idBytes []byte) (newCommitmentID ID)

func (ID) Alias

func (b ID) Alias() (alias string)

Alias returns the human-readable alias of the ID (or the base58 encoded bytes if no alias was set).

func (ID) Base58

func (b ID) Base58() (base58Encoded string)

Base58 returns a base58 encoded version of the ID.

func (ID) Bytes

func (b ID) Bytes() (serialized []byte, err error)

Bytes returns a serialized version of the ID.

func (ID) CompareTo

func (b ID) CompareTo(other ID) int

CompareTo does a lexicographical comparison to another blockID. Returns 0 if equal, -1 if smaller, or 1 if larger than other. Passing nil as other will result in a panic.

func (*ID) DecodeJSON

func (b *ID) DecodeJSON(val any) error

func (ID) EncodeJSON

func (b ID) EncodeJSON() (any, error)

func (*ID) FromBase58

func (b *ID) FromBase58(base58EncodedString string) (err error)

FromBase58 un-serializes a ID from a base58 encoded string.

func (*ID) FromBytes

func (b *ID) FromBytes(serialized []byte) (consumedBytes int, err error)

FromBytes deserializes a ID from a byte slice.

func (*ID) FromRandomness

func (b *ID) FromRandomness(optionalSlot ...slot.Index) (err error)

FromRandomness generates a random ID.

func (ID) Index

func (b ID) Index() slot.Index

func (ID) Length

func (b ID) Length() int

Length returns the byte length of a serialized ID.

func (ID) RegisterAlias

func (b ID) RegisterAlias(alias string)

RegisterAlias allows to register a human-readable alias for the ID which will be used as a replacement for the String method.

func (ID) String

func (b ID) String() (humanReadable string)

String returns a human-readable version of the ID.

func (ID) UnregisterAlias

func (b ID) UnregisterAlias()

UnregisterAlias allows to unregister a previously registered alias.

type Roots

type Roots struct {
	model.Immutable[Roots, *Roots, roots] `serix:"0"`
}

func NewRoots

func NewRoots(meshRoot, stateMutationRoot, activityRoot, stateRoot, manaRoot types.Identifier) (newRoots *Roots)

func (*Roots) ActivityRoot

func (r *Roots) ActivityRoot() (activityRoot types.Identifier)

func (*Roots) ID

func (r *Roots) ID() (id types.Identifier)

func (*Roots) ManaRoot

func (r *Roots) ManaRoot() (manaRoot types.Identifier)

func (*Roots) MeshRoot

func (r *Roots) MeshRoot() (meshRoot types.Identifier)

func (*Roots) StateMutationRoot

func (r *Roots) StateMutationRoot() (stateMutationRoot types.Identifier)

func (*Roots) StateRoot

func (r *Roots) StateRoot() (stateRoot types.Identifier)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL