Documentation
¶
Index ¶
- type Block
- type Epoch
- type Header
- type ParseResult
- type SignedBlock
- func Build(parentID ids.ID, timestamp time.Time, pChainHeight uint64, epoch Epoch, ...) (SignedBlock, error)
- func BuildMLDSA(parentID ids.ID, timestamp time.Time, pChainHeight uint64, epoch Epoch, ...) (SignedBlock, error)
- func BuildUnsigned(parentID ids.ID, timestamp time.Time, pChainHeight uint64, epoch Epoch, ...) (SignedBlock, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block interface {
ID() ids.ID
ParentID() ids.ID
Block() []byte
Bytes() []byte
// contains filtered or unexported methods
}
func BuildOption ¶
BuildOption the option block [parentID] is the ID of this option's wrapper parent block [innerBytes] is the byte representation of a child option block
func Parse ¶
Parse a block and verify that the signature attached to the block is valid for the certificate provided in the block.
func ParseWithoutVerification ¶
ParseWithoutVerification parses a block without verifying that the signature on the block is correct. Dispatch is the 1-byte blockKind at object offset 0 of the leading self-delimiting zap message — no codec, no version.
type Epoch ¶ added in v1.16.56
type Epoch struct {
PChainHeight uint64 `json:"pChainHeight"`
Number uint64 `json:"number"`
StartTime int64 `json:"startTime"`
}
Epoch represents a P-Chain epoch for validator set coordination
type ParseResult ¶
func ParseBlocks ¶
func ParseBlocks(blks [][]byte, chainID ids.ID) []ParseResult
ParseBlocks parses the given raw blocks into tuples of (Block, error). Each ParseResult is returned in the same order as its corresponding bytes in the input.
type SignedBlock ¶
type SignedBlock interface {
Block
PChainHeight() uint64
PChainEpoch() Epoch
Timestamp() time.Time
// Proposer returns the ID of the node that proposed this block. If no node
// signed this block, [ids.EmptyNodeID] will be returned.
Proposer() ids.NodeID
// HasClassicalProposer reports whether this block carries a CLASSICAL
// (secp256k1/ECDSA) proposer identity. A strict-PQ chain refuses such a block
// — its proposer must be ML-DSA-65 to match the ML-DSA-keyed validator set.
// Unsigned blocks (transition / single-validator) return false.
HasClassicalProposer() bool
// Data Availability fields (v1.1 spec)
DARoot() [32]byte // Root of DA commitments
WitnessRoot() [32]byte // Root of witnesses/proofs
MessagesOutRoot() [32]byte // Root of outgoing cross-chain messages
BlobCount() uint32 // Number of DA blobs in block
}
func Build ¶
func Build( parentID ids.ID, timestamp time.Time, pChainHeight uint64, epoch Epoch, cert *staking.Certificate, blockBytes []byte, chainID ids.ID, key crypto.Signer, ) (SignedBlock, error)
Build produces a CLASSICAL (secp256k1/ECDSA TLS-leaf) signed block: identity slot = [schemeSecp256k1 | cert DER], signature = ECDSA over SHA256(header). Used on chains whose validator set is keyed by classical NodeIDs.
func BuildMLDSA ¶ added in v1.36.16
func BuildMLDSA( parentID ids.ID, timestamp time.Time, pChainHeight uint64, epoch Epoch, mldsaPub []byte, blockBytes []byte, chainID ids.ID, key *mldsa.PrivateKey, ) (SignedBlock, error)
BuildMLDSA produces a strict-PQ (ML-DSA-65, FIPS 204) signed block: identity slot = [schemeMLDSA65 | raw ML-DSA-65 pubkey], signature = ML-DSA over the raw header with the proposervm domain-separation context. The block's Proposer() NodeID derives via DeriveMLDSA, so it EQUALS the strict-PQ NodeID the windower elected — the fix for the height≥2 "unexpected proposer" verify failure.