wire

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Overview

nolint

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActivationTxFromBytes

func ActivationTxFromBytes(data []byte) (*types.ActivationTx, error)

Decode ActivationTx from bytes. In future it should decide which version of ActivationTx to decode based on the publish epoch.

func ActivationTxFromWireV1

func ActivationTxFromWireV1(atx *ActivationTxV1) *types.ActivationTx

func NIPostChallengeFromWireV1

func NIPostChallengeFromWireV1(ch NIPostChallengeV1) *types.NIPostChallenge

Types

type ATXMetadataV1

type ATXMetadataV1 struct {
	Publish types.EpochID
	MsgHash types.Hash32
}

func (*ATXMetadataV1) DecodeScale

func (t *ATXMetadataV1) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*ATXMetadataV1) EncodeScale

func (t *ATXMetadataV1) EncodeScale(enc *scale.Encoder) (total int, err error)

type ActivationTxV1

type ActivationTxV1 struct {
	InnerActivationTxV1

	SmesherID types.NodeID
	Signature types.EdSignature
}

func ActivationTxToWireV1

func ActivationTxToWireV1(a *types.ActivationTx) *ActivationTxV1

func (*ActivationTxV1) DecodeScale

func (t *ActivationTxV1) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*ActivationTxV1) EncodeScale

func (t *ActivationTxV1) EncodeScale(enc *scale.Encoder) (total int, err error)

func (*ActivationTxV1) HashInnerBytes

func (atx *ActivationTxV1) HashInnerBytes() (result types.Hash32)

func (*ActivationTxV1) SignedBytes

func (atx *ActivationTxV1) SignedBytes() []byte

type InnerActivationTxV1

type InnerActivationTxV1 struct {
	NIPostChallengeV1

	Coinbase types.Address
	NumUnits uint32

	NIPost   *NIPostV1
	NodeID   *types.NodeID // only present in initial ATX to make hash of the first InnerActivationTxV2 unique
	VRFNonce *uint64       // only present when the nonce changed (or initial ATX)
}

InnerActivationTxV1 is a set of all of an ATX's fields, except the signature. To generate the ATX signature, this structure is serialized and signed.

func (*InnerActivationTxV1) DecodeScale

func (t *InnerActivationTxV1) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*InnerActivationTxV1) EncodeScale

func (t *InnerActivationTxV1) EncodeScale(enc *scale.Encoder) (total int, err error)

type MerkleProofV1

type MerkleProofV1 struct {
	// Nodes on path from leaf to root (not including leaf)
	Nodes     []types.Hash32 `scale:"max=32"`
	LeafIndex uint64
}

func (*MerkleProofV1) DecodeScale

func (t *MerkleProofV1) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*MerkleProofV1) EncodeScale

func (t *MerkleProofV1) EncodeScale(enc *scale.Encoder) (total int, err error)

type NIPostChallengeV1

type NIPostChallengeV1 struct {
	Publish types.EpochID
	// Sequence number counts the number of ancestors of the ATX. It sequentially increases for each ATX in the chain.
	// Two ATXs with the same sequence number from the same miner can be used as the proof of malfeasance against
	// that miner.
	Sequence uint64
	// the previous ATX's ID (for all but the first in the sequence)
	PrevATXID      types.ATXID
	PositioningATX types.ATXID

	// CommitmentATX is the ATX used in the commitment for initializing the PoST of the node.
	CommitmentATX *types.ATXID
	InitialPost   *PostV1
}

func NIPostChallengeToWireV1

func NIPostChallengeToWireV1(c *types.NIPostChallenge) *NIPostChallengeV1

func (*NIPostChallengeV1) DecodeScale

func (t *NIPostChallengeV1) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*NIPostChallengeV1) EncodeScale

func (t *NIPostChallengeV1) EncodeScale(enc *scale.Encoder) (total int, err error)

func (*NIPostChallengeV1) Hash

func (challenge *NIPostChallengeV1) Hash() types.Hash32

Hash serializes the NIPostChallenge and returns its hash. The serialized challenge is first prepended with a byte 0x00, and then hashed for second preimage resistance of poet membership merkle tree.

type NIPostV1

type NIPostV1 struct {
	// Membership proves that the challenge for the PoET, which is
	// constructed from fields in the activation transaction,
	// is a member of the poet's proof.
	// Proof.Root must match the Poet's POSW statement.
	Membership MerkleProofV1

	// Post is the proof that the prover data is still stored (or was recomputed) at
	// the time he learned the challenge constructed from the PoET.
	Post *PostV1

	// PostMetadata is the Post metadata, associated with the proof.
	// The proof should be verified upon the metadata during the syntactic validation,
	// while the metadata should be verified during the contextual validation.
	PostMetadata *PostMetadataV1
}

func (*NIPostV1) DecodeScale

func (t *NIPostV1) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*NIPostV1) EncodeScale

func (t *NIPostV1) EncodeScale(enc *scale.Encoder) (total int, err error)

type PostMetadataV1

type PostMetadataV1 struct {
	Challenge     []byte `scale:"max=32"`
	LabelsPerUnit uint64
}

func (*PostMetadataV1) DecodeScale

func (t *PostMetadataV1) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*PostMetadataV1) EncodeScale

func (t *PostMetadataV1) EncodeScale(enc *scale.Encoder) (total int, err error)

type PostV1

type PostV1 struct {
	Nonce   uint32
	Indices []byte `scale:"max=800"` // up to K2=100
	Pow     uint64
}

func (*PostV1) DecodeScale

func (t *PostV1) DecodeScale(dec *scale.Decoder) (total int, err error)

func (*PostV1) EncodeScale

func (t *PostV1) EncodeScale(enc *scale.Encoder) (total int, err error)

Jump to

Keyboard shortcuts

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