Files
node/vms/platformvm/block/block.go
T
zeekay b6143b5d53 Block codec → native ZAP (struct-is-wire): builds + round-trips green
Blocks are now the zap buffer: kind + parentID@1 + height@33 + time@41 +
tx-length-list@49 + tx-blob@57 (+ proposal-tx@65). commonZapBlock embedded base
mirrors spendingTx. Parse = zap.Parse + kind dispatch (no codec, no version).
Deleted block/codec.go + block/v0 + lift_v0. Round-trip green for abort/commit/
proposal/standard incl real signed txs. go build + go test ./block/ = green.

FINDING: block.GenesisCodec was double-duty — also serialized NON-block STATE
values (feeState, owners, L1Validator, metadata, chains). That's a THIRD codec
surface (state DB serialization) still to migrate for the full kill.
2026-07-10 12:43:20 -07:00

43 lines
1.1 KiB
Go

// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package block
import (
"time"
"github.com/luxfi/ids"
"github.com/luxfi/node/vms/platformvm/txs"
"github.com/luxfi/runtime"
)
// RuntimeInitializable binds a runtime into a block's embedded txs.
type RuntimeInitializable interface {
InitRuntime(rt *runtime.Runtime)
}
// Block is the common stateless interface for all P-chain blocks. Every block
// is a single native-ZAP object; there is no codec and no initialize step —
// the bytes are authoritative and blocks are built by New*Block or read by
// Parse, both of which bind ID = hash(bytes).
type Block interface {
RuntimeInitializable
ID() ids.ID
Parent() ids.ID
Bytes() []byte
Height() uint64
// Txs returns the transactions contained in the block.
Txs() []*txs.Tx
// Visit calls [visitor] with this block's concrete type.
Visit(visitor Visitor) error
}
// TimestampedBlock is a Block that carries a per-block timestamp. Every
// canonical P-chain block kind is timestamped.
type TimestampedBlock interface {
Block
Timestamp() time.Time
}