Run NodesReferencevmsxvm

block

Package block is a generated GoMock package.

import "github.com/luxfi/node/vms/xvm/block"

Package block is a generated GoMock package.

Types

Block

Block defines the common stateless interface for all blocks. There is no codec: a block is a self-describing native-ZAP buffer whose bytes are authoritative (ID = hash(bytes)); see Parser.ParseBlock.

MockBlock

MockBlock is a mock of Block interface.

func NewMockBlock(ctrl *gomock.Controller) *MockBlock
func (m *MockBlock) Bytes() []byte
func (m *MockBlock) EXPECT() *MockBlockMockRecorder
func (m *MockBlock) Height() uint64
func (m *MockBlock) ID() ids.ID
func (m *MockBlock) MerkleRoot() ids.ID
func (m *MockBlock) Parent() ids.ID
func (m *MockBlock) Timestamp() time.Time
func (m *MockBlock) Txs() []*txs.Tx

MockBlockMockRecorder

MockBlockMockRecorder is the mock recorder for MockBlock.

func (mr *MockBlockMockRecorder) Bytes() *gomock.Call
func (mr *MockBlockMockRecorder) Height() *gomock.Call
func (mr *MockBlockMockRecorder) ID() *gomock.Call
func (mr *MockBlockMockRecorder) MerkleRoot() *gomock.Call
func (mr *MockBlockMockRecorder) Parent() *gomock.Call
func (mr *MockBlockMockRecorder) Timestamp() *gomock.Call
func (mr *MockBlockMockRecorder) Txs() *gomock.Call

Parser

Parser parses both X-chain txs and blocks. It embeds the codec-free txs.Parser (for ParseTx / ParseGenesisTx) and adds native-ZAP block parsing.

func NewCustomParser(
	fxIndex *txs.FxIndex,
	clock *mockable.Clock,
	log log.Logger,
	fxs []fxs.Fx,
) (Parser, error)
func NewParser(fxs []fxs.Fx) (Parser, error)

StandardBlock

StandardBlock is the X-chain block. The struct is the source of truth; bytes is the cached native-ZAP wire encoding. Txs are self-describing via their own tx.Bytes(), so a block stores the per-tx byte lengths as a u32 list plus the concatenated tx bytes, and Parse re-splits them through txs.Parse (zero copy).

Object fixed section (all offsets object-relative):

ParentID 32B @ 0 Height u64 @ 32 Time u64 @ 40 Root 32B @ 48 (merkle execution root; ids.Empty pre-activation) TxLengths 8B @ 80 (u32 list ptr — one entry per tx) TxBlob 8B @ 88 (bytes ptr — concat of each tx.Bytes())

func NewStandardBlock(
	parentID ids.ID,
	height uint64,
	timestamp time.Time,
	txList []*txs.Tx,
) (*StandardBlock, error)
func NewStandardBlockWithRoot(
	parentID ids.ID,
	height uint64,
	timestamp time.Time,
	root ids.ID,
	txList []*txs.Tx,
) (*StandardBlock, error)
func (b *StandardBlock) Bytes() []byte
func (b *StandardBlock) Height() uint64
func (b *StandardBlock) ID() ids.ID
func (b *StandardBlock) MerkleRoot() ids.ID
func (b *StandardBlock) Parent() ids.ID
func (b *StandardBlock) Timestamp() time.Time
func (b *StandardBlock) Txs() []*txs.Tx