Documentation
¶
Overview ¶
Package block is a generated GoMock package.
Index ¶
- Constants
- func RegisterApricotTypes(targetCodec LinearRegistry) error
- func RegisterBanffTypes(targetCodec LinearRegistry) error
- func RegisterDurangoTypes(targetCodec LinearRegistry) error
- func RegisterQuasarTypes(targetCodec LinearRegistry) error
- func RegisterTypes(targetCodec LinearRegistry) error
- type ApricotAbortBlock
- type ApricotAtomicBlock
- type ApricotCommitBlock
- type ApricotProposalBlock
- type ApricotStandardBlock
- type BanffAbortBlock
- type BanffBlock
- type BanffCommitBlock
- type BanffProposalBlock
- type BanffStandardBlock
- type Block
- type Codec
- type CommonBlock
- type ContextInitializable
- type LinearRegistry
- type 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) InitRuntime(ctx *context.Context)
- func (m *MockBlock) Parent() ids.ID
- func (m *MockBlock) Txs() []*txs.Tx
- func (m *MockBlock) Visit(visitor Visitor) error
- type MockBlockMockRecorder
- func (mr *MockBlockMockRecorder) Bytes() *gomock.Call
- func (mr *MockBlockMockRecorder) Height() *gomock.Call
- func (mr *MockBlockMockRecorder) ID() *gomock.Call
- func (mr *MockBlockMockRecorder) InitRuntime(ctx any) *gomock.Call
- func (mr *MockBlockMockRecorder) Parent() *gomock.Call
- func (mr *MockBlockMockRecorder) Txs() *gomock.Call
- func (mr *MockBlockMockRecorder) Visit(visitor any) *gomock.Call
- type Registry
- type Visitor
Constants ¶
const CodecVersion = txs.CodecVersion
Variables ¶
This section is empty.
Functions ¶
func RegisterApricotTypes ¶
func RegisterApricotTypes(targetCodec LinearRegistry) error
RegisterApricotTypes registers the type information for blocks that were valid during the Apricot series of upgrades.
func RegisterBanffTypes ¶
func RegisterBanffTypes(targetCodec LinearRegistry) error
RegisterBanffTypes registers the type information for blocks that were valid during the Banff series of upgrades.
func RegisterDurangoTypes ¶
func RegisterDurangoTypes(targetCodec LinearRegistry) error
RegisterDurangoTypes registers the type information for blocks that were valid during the Durango series of upgrades.
func RegisterQuasarTypes ¶ added in v1.2.0
func RegisterQuasarTypes(targetCodec LinearRegistry) error
RegisterQuasarTypes registers the type information for blocks that were valid during the Quasar Edition series of upgrades.
func RegisterTypes ¶ added in v1.2.0
func RegisterTypes(targetCodec LinearRegistry) error
RegisterTypes is the canonical full-history block-and-tx registrar. It seeds Apricot, Banff, Durango, and Quasar block + tx types in the order required by the historical PVM layout. Callers that need a codec capable of decoding any historic PVM block invoke this. The caller is responsible for additionally registering any state-only types (e.g. state.stateBlk for legacy block storage) on the genesis codec via RegisterGenesisStateBlockType.
Types ¶
type ApricotAbortBlock ¶
type ApricotAbortBlock struct {
CommonBlock `serialize:"true"`
}
func NewApricotAbortBlock ¶
NewApricotAbortBlock is kept for testing purposes only. Following Banff activation and subsequent code cleanup, Apricot Abort blocks should be only verified (upon bootstrap), never created anymore. It builds and initializes the block against the supplied block Codec.
func (*ApricotAbortBlock) InitRuntime ¶
func (*ApricotAbortBlock) InitRuntime(*runtime.Runtime)
func (*ApricotAbortBlock) InitializeWithContext ¶
func (b *ApricotAbortBlock) InitializeWithContext(ctx context.Context) error
InitializeWithContext initializes the block with consensus context
func (*ApricotAbortBlock) Txs ¶
func (*ApricotAbortBlock) Txs() []*txs.Tx
func (*ApricotAbortBlock) Visit ¶
func (b *ApricotAbortBlock) Visit(v Visitor) error
type ApricotAtomicBlock ¶
type ApricotAtomicBlock struct {
CommonBlock `serialize:"true"`
Tx *txs.Tx `serialize:"true" json:"tx"`
}
ApricotAtomicBlock being accepted results in the atomic transaction contained in the block to be accepted and committed to the chain.
func NewApricotAtomicBlock ¶
func NewApricotAtomicBlock( c Codec, parentID ids.ID, height uint64, tx *txs.Tx, ) (*ApricotAtomicBlock, error)
NewApricotAtomicBlock builds and initializes an ApricotAtomicBlock against the supplied block Codec.
func (*ApricotAtomicBlock) InitRuntime ¶
func (b *ApricotAtomicBlock) InitRuntime(rt *runtime.Runtime)
func (*ApricotAtomicBlock) InitializeWithContext ¶
func (b *ApricotAtomicBlock) InitializeWithContext(ctx context.Context) error
InitializeWithContext initializes the block with consensus context
func (*ApricotAtomicBlock) Txs ¶
func (b *ApricotAtomicBlock) Txs() []*txs.Tx
func (*ApricotAtomicBlock) Visit ¶
func (b *ApricotAtomicBlock) Visit(v Visitor) error
type ApricotCommitBlock ¶
type ApricotCommitBlock struct {
CommonBlock `serialize:"true"`
}
func NewApricotCommitBlock ¶
NewApricotCommitBlock builds and initializes an ApricotCommitBlock against the supplied block Codec.
func (*ApricotCommitBlock) InitRuntime ¶
func (*ApricotCommitBlock) InitRuntime(*runtime.Runtime)
func (*ApricotCommitBlock) InitializeWithContext ¶
func (b *ApricotCommitBlock) InitializeWithContext(ctx context.Context) error
InitializeWithContext initializes the block with consensus context
func (*ApricotCommitBlock) Txs ¶
func (*ApricotCommitBlock) Txs() []*txs.Tx
func (*ApricotCommitBlock) Visit ¶
func (b *ApricotCommitBlock) Visit(v Visitor) error
type ApricotProposalBlock ¶
type ApricotProposalBlock struct {
CommonBlock `serialize:"true"`
Tx *txs.Tx `serialize:"true" json:"tx"`
}
func NewApricotProposalBlock ¶
func NewApricotProposalBlock( c Codec, parentID ids.ID, height uint64, tx *txs.Tx, ) (*ApricotProposalBlock, error)
NewApricotProposalBlock is kept for testing purposes only. Following Banff activation and subsequent code cleanup, Apricot Proposal blocks should be only verified (upon bootstrap), never created anymore. It builds and initializes the block against the supplied block Codec.
func (*ApricotProposalBlock) InitRuntime ¶
func (b *ApricotProposalBlock) InitRuntime(rt *runtime.Runtime)
func (*ApricotProposalBlock) InitializeWithContext ¶
func (b *ApricotProposalBlock) InitializeWithContext(ctx context.Context) error
InitializeWithContext initializes the block with consensus context
func (*ApricotProposalBlock) Txs ¶
func (b *ApricotProposalBlock) Txs() []*txs.Tx
func (*ApricotProposalBlock) Visit ¶
func (b *ApricotProposalBlock) Visit(v Visitor) error
type ApricotStandardBlock ¶
type ApricotStandardBlock struct {
CommonBlock `serialize:"true"`
Transactions []*txs.Tx `serialize:"true" json:"txs"`
}
func NewApricotStandardBlock ¶
func NewApricotStandardBlock( c Codec, parentID ids.ID, height uint64, txs []*txs.Tx, ) (*ApricotStandardBlock, error)
NewApricotStandardBlock is kept for testing purposes only. Following Banff activation and subsequent code cleanup, Apricot Standard blocks should be only verified (upon bootstrap), never created anymore. It builds and initializes the block against the supplied block Codec.
func (*ApricotStandardBlock) InitRuntime ¶
func (b *ApricotStandardBlock) InitRuntime(rt *runtime.Runtime)
func (*ApricotStandardBlock) InitializeWithContext ¶
func (b *ApricotStandardBlock) InitializeWithContext(ctx context.Context) error
InitializeWithContext initializes the block with consensus context
func (*ApricotStandardBlock) Txs ¶
func (b *ApricotStandardBlock) Txs() []*txs.Tx
func (*ApricotStandardBlock) Visit ¶
func (b *ApricotStandardBlock) Visit(v Visitor) error
type BanffAbortBlock ¶
type BanffAbortBlock struct {
Time uint64 `serialize:"true" json:"time"`
ApricotAbortBlock `serialize:"true"`
}
func NewBanffAbortBlock ¶
func NewBanffAbortBlock( c Codec, timestamp time.Time, parentID ids.ID, height uint64, ) (*BanffAbortBlock, error)
NewBanffAbortBlock builds and initializes a BanffAbortBlock against the supplied block Codec.
func (*BanffAbortBlock) InitializeWithContext ¶
func (b *BanffAbortBlock) InitializeWithContext(ctx context.Context) error
InitializeWithContext initializes the block with consensus context
func (*BanffAbortBlock) Timestamp ¶
func (b *BanffAbortBlock) Timestamp() time.Time
func (*BanffAbortBlock) Visit ¶
func (b *BanffAbortBlock) Visit(v Visitor) error
type BanffBlock ¶
type BanffCommitBlock ¶
type BanffCommitBlock struct {
Time uint64 `serialize:"true" json:"time"`
ApricotCommitBlock `serialize:"true"`
}
func NewBanffCommitBlock ¶
func NewBanffCommitBlock( c Codec, timestamp time.Time, parentID ids.ID, height uint64, ) (*BanffCommitBlock, error)
NewBanffCommitBlock builds and initializes a BanffCommitBlock against the supplied block Codec.
func (*BanffCommitBlock) InitializeWithContext ¶
func (b *BanffCommitBlock) InitializeWithContext(ctx context.Context) error
InitializeWithContext initializes the block with consensus context
func (*BanffCommitBlock) Timestamp ¶
func (b *BanffCommitBlock) Timestamp() time.Time
func (*BanffCommitBlock) Visit ¶
func (b *BanffCommitBlock) Visit(v Visitor) error
type BanffProposalBlock ¶
type BanffProposalBlock struct {
Time uint64 `serialize:"true" json:"time"`
Transactions []*txs.Tx `serialize:"true" json:"txs"`
ApricotProposalBlock `serialize:"true"`
}
func NewBanffProposalBlock ¶
func NewBanffProposalBlock( c Codec, timestamp time.Time, parentID ids.ID, height uint64, proposalTx *txs.Tx, decisionTxs []*txs.Tx, ) (*BanffProposalBlock, error)
NewBanffProposalBlock builds and initializes a BanffProposalBlock against the supplied block Codec.
func (*BanffProposalBlock) InitRuntime ¶
func (b *BanffProposalBlock) InitRuntime(rt *runtime.Runtime)
func (*BanffProposalBlock) InitializeWithContext ¶
func (b *BanffProposalBlock) InitializeWithContext(ctx context.Context) error
InitializeWithContext initializes the block with consensus context
func (*BanffProposalBlock) Timestamp ¶
func (b *BanffProposalBlock) Timestamp() time.Time
func (*BanffProposalBlock) Txs ¶
func (b *BanffProposalBlock) Txs() []*txs.Tx
func (*BanffProposalBlock) Visit ¶
func (b *BanffProposalBlock) Visit(v Visitor) error
type BanffStandardBlock ¶
type BanffStandardBlock struct {
Time uint64 `serialize:"true" json:"time"`
ApricotStandardBlock `serialize:"true"`
}
func NewBanffStandardBlock ¶
func NewBanffStandardBlock( c Codec, timestamp time.Time, parentID ids.ID, height uint64, txs []*txs.Tx, ) (*BanffStandardBlock, error)
NewBanffStandardBlock builds and initializes a BanffStandardBlock against the supplied block Codec.
func (*BanffStandardBlock) InitializeWithContext ¶
func (b *BanffStandardBlock) InitializeWithContext(ctx context.Context) error
InitializeWithContext initializes the block with consensus context
func (*BanffStandardBlock) Timestamp ¶
func (b *BanffStandardBlock) Timestamp() time.Time
func (*BanffStandardBlock) Visit ¶
func (b *BanffStandardBlock) Visit(v Visitor) error
type Block ¶
type Block interface {
ContextInitializable
ID() ids.ID
Parent() ids.ID
Bytes() []byte
Height() uint64
// Txs returns list of transactions contained in the block
Txs() []*txs.Tx
// Visit calls [visitor] with this block's concrete type
Visit(visitor Visitor) error
// contains filtered or unexported methods
}
Block defines the common stateless interface for all blocks
type Codec ¶
type Codec interface {
Marshal(version uint16, source interface{}) ([]byte, error)
Unmarshal(bytes []byte, dest interface{}) (uint16, error)
Size(version uint16, value interface{}) (int, error)
}
Codec is the proto/p/block-local wire codec interface. It is structurally identical to the legacy codec.Manager surface that lived in `github.com/luxfi/codec`, but defined locally so proto/p carries no import of that package. Block consumers (state, executor, parser, builder) thread their concrete codec instance through this interface.
Wave 2A of the codec rip (#101). Stays byte-compatible with codec.Manager so existing wire bytes continue to roundtrip during the multi-wave migration.
type CommonBlock ¶
type CommonBlock struct {
// parent's ID
PrntID ids.ID `serialize:"true" json:"parentID"`
// This block's height. The genesis block is at height 0.
Hght uint64 `serialize:"true" json:"height"`
BlockID ids.ID `json:"id"`
// contains filtered or unexported fields
}
CommonBlock contains fields and methods common to all blocks in this VM.
func (*CommonBlock) Bytes ¶
func (b *CommonBlock) Bytes() []byte
func (*CommonBlock) Height ¶
func (b *CommonBlock) Height() uint64
func (*CommonBlock) ID ¶
func (b *CommonBlock) ID() ids.ID
func (*CommonBlock) Parent ¶
func (b *CommonBlock) Parent() ids.ID
type ContextInitializable ¶
ContextInitializable defines the interface for initializing context
type LinearRegistry ¶ added in v1.2.0
LinearRegistry extends Registry with SkipRegistrations so the txs.RegisterTypes pre-amble (which reserves head slots for blocks) can fan in.
type MockBlock ¶
type MockBlock struct {
// contains filtered or unexported fields
}
MockBlock is a mock of Block interface.
func NewMockBlock ¶
func NewMockBlock(ctrl *gomock.Controller) *MockBlock
NewMockBlock creates a new mock instance.
func (*MockBlock) EXPECT ¶
func (m *MockBlock) EXPECT() *MockBlockMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockBlock) InitRuntime ¶
InitRuntime mocks base method.
type MockBlockMockRecorder ¶
type MockBlockMockRecorder struct {
// contains filtered or unexported fields
}
MockBlockMockRecorder is the mock recorder for MockBlock.
func (*MockBlockMockRecorder) Bytes ¶
func (mr *MockBlockMockRecorder) Bytes() *gomock.Call
Bytes indicates an expected call of Bytes.
func (*MockBlockMockRecorder) Height ¶
func (mr *MockBlockMockRecorder) Height() *gomock.Call
Height indicates an expected call of Height.
func (*MockBlockMockRecorder) ID ¶
func (mr *MockBlockMockRecorder) ID() *gomock.Call
ID indicates an expected call of ID.
func (*MockBlockMockRecorder) InitRuntime ¶
func (mr *MockBlockMockRecorder) InitRuntime(ctx any) *gomock.Call
InitRuntime indicates an expected call of InitRuntime.
func (*MockBlockMockRecorder) Parent ¶
func (mr *MockBlockMockRecorder) Parent() *gomock.Call
Parent indicates an expected call of Parent.
func (*MockBlockMockRecorder) Txs ¶
func (mr *MockBlockMockRecorder) Txs() *gomock.Call
Txs indicates an expected call of Txs.
type Registry ¶ added in v1.2.0
type Registry interface {
RegisterType(interface{}) error
}
Registry mirrors the legacy codec.Registry / linearcodec.Codec surface needed by the block-type registrar.
type Visitor ¶
type Visitor interface {
BanffAbortBlock(*BanffAbortBlock) error
BanffCommitBlock(*BanffCommitBlock) error
BanffProposalBlock(*BanffProposalBlock) error
BanffStandardBlock(*BanffStandardBlock) error
ApricotAbortBlock(*ApricotAbortBlock) error
ApricotCommitBlock(*ApricotCommitBlock) error
ApricotProposalBlock(*ApricotProposalBlock) error
ApricotStandardBlock(*ApricotStandardBlock) error
ApricotAtomicBlock(*ApricotAtomicBlock) error
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package executor is a generated GoMock package.
|
Package executor is a generated GoMock package. |
|
executormock
Package executormock is a generated GoMock package.
|
Package executormock is a generated GoMock package. |