Documentation ¶
Overview ¶
Package blocks is a generated GoMock package.
Index ¶
- Constants
- Variables
- func RegisterApricotBlockTypes(targetCodec codec.Registry) error
- func RegisterBanffBlockTypes(targetCodec codec.Registry) error
- type ApricotAbortBlock
- type ApricotAtomicBlock
- type ApricotCommitBlock
- type ApricotProposalBlock
- type ApricotStandardBlock
- type BanffAbortBlock
- type BanffBlock
- type BanffCommitBlock
- type BanffProposalBlock
- type BanffStandardBlock
- type Block
- type CommonBlock
- 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) InitCtx(arg0 *snow.Context)
- func (m *MockBlock) Parent() ids.ID
- func (m *MockBlock) Txs() []*txs.Tx
- func (m *MockBlock) Visit(arg0 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) InitCtx(arg0 interface{}) *gomock.Call
- func (mr *MockBlockMockRecorder) Parent() *gomock.Call
- func (mr *MockBlockMockRecorder) Txs() *gomock.Call
- func (mr *MockBlockMockRecorder) Visit(arg0 interface{}) *gomock.Call
- type Visitor
Constants ¶
const Version = txs.Version
Version is the current default codec version
Variables ¶
var ( Codec codec.Manager GenesisCodec codec.Manager )
GenesisCode allows blocks of larger than usual size to be parsed. While this gives flexibility in accommodating large genesis blocks it must not be used to parse new, unverified blocks which instead must be processed by Codec
Functions ¶
func RegisterApricotBlockTypes ¶
RegisterApricotBlockTypes allows registering relevant type of blocks package in the right sequence. Following repackaging of platformvm package, a few subpackage-level codecs were introduced, each handling serialization of specific types.
func RegisterBanffBlockTypes ¶
Types ¶
type ApricotAbortBlock ¶
type ApricotAbortBlock struct {
CommonBlock `serialize:"true"`
}
func NewApricotAbortBlock ¶
func NewApricotAbortBlock( parentID ids.ID, height uint64, ) (*ApricotAbortBlock, error)
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
func (*ApricotAbortBlock) InitCtx ¶
func (*ApricotAbortBlock) InitCtx(*snow.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 (*ApricotAtomicBlock) InitCtx ¶
func (b *ApricotAtomicBlock) InitCtx(ctx *snow.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 ¶
func NewApricotCommitBlock( parentID ids.ID, height uint64, ) (*ApricotCommitBlock, error)
func (*ApricotCommitBlock) InitCtx ¶
func (*ApricotCommitBlock) InitCtx(*snow.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( 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
func (*ApricotProposalBlock) InitCtx ¶
func (b *ApricotProposalBlock) InitCtx(ctx *snow.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( 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
func (*ApricotStandardBlock) InitCtx ¶
func (b *ApricotStandardBlock) InitCtx(ctx *snow.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 (*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 (*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 is currently unused. This is populated so that introducing // them in the future will not require a codec change. // // TODO: when Transactions is used, we must correctly verify and apply their // changes. Transactions []*txs.Tx `serialize:"true" json:"-"` ApricotProposalBlock `serialize:"true"` }
func NewBanffProposalBlock ¶
func (*BanffProposalBlock) InitCtx ¶
func (b *BanffProposalBlock) InitCtx(ctx *snow.Context)
func (*BanffProposalBlock) Timestamp ¶
func (b *BanffProposalBlock) Timestamp() time.Time
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 (*BanffStandardBlock) Timestamp ¶
func (b *BanffStandardBlock) Timestamp() time.Time
func (*BanffStandardBlock) Visit ¶
func (b *BanffStandardBlock) Visit(v Visitor) error
type Block ¶
type Block interface { snow.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 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"` // 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 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.
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) InitCtx ¶
func (mr *MockBlockMockRecorder) InitCtx(arg0 interface{}) *gomock.Call
InitCtx indicates an expected call of InitCtx.
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.
func (*MockBlockMockRecorder) Visit ¶
func (mr *MockBlockMockRecorder) Visit(arg0 interface{}) *gomock.Call
Visit indicates an expected call of Visit.
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 }