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) *MockBlockfunc (m *MockBlock) Bytes() []bytefunc (m *MockBlock) EXPECT() *MockBlockMockRecorderfunc (m *MockBlock) Height() uint64func (m *MockBlock) ID() ids.IDfunc (m *MockBlock) MerkleRoot() ids.IDfunc (m *MockBlock) Parent() ids.IDfunc (m *MockBlock) Timestamp() time.Timefunc (m *MockBlock) Txs() []*txs.TxMockBlockMockRecorder
MockBlockMockRecorder is the mock recorder for MockBlock.
func (mr *MockBlockMockRecorder) Bytes() *gomock.Callfunc (mr *MockBlockMockRecorder) Height() *gomock.Callfunc (mr *MockBlockMockRecorder) ID() *gomock.Callfunc (mr *MockBlockMockRecorder) MerkleRoot() *gomock.Callfunc (mr *MockBlockMockRecorder) Parent() *gomock.Callfunc (mr *MockBlockMockRecorder) Timestamp() *gomock.Callfunc (mr *MockBlockMockRecorder) Txs() *gomock.CallParser
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() []bytefunc (b *StandardBlock) Height() uint64func (b *StandardBlock) ID() ids.IDfunc (b *StandardBlock) MerkleRoot() ids.IDfunc (b *StandardBlock) Parent() ids.IDfunc (b *StandardBlock) Timestamp() time.Timefunc (b *StandardBlock) Txs() []*txs.Tx