blocks

package
v1.9.17-rc.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package blocks is a generated GoMock package.

Index

Constants

View Source
const Version = txs.Version

Version is the current default codec version

Variables

View Source
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 added in v1.8.0

func RegisterApricotBlockTypes(targetCodec codec.Registry) error

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 added in v1.9.0

func RegisterBanffBlockTypes(targetCodec codec.Registry) error

Types

type ApricotAbortBlock added in v1.8.0

type ApricotAbortBlock struct {
	CommonBlock `serialize:"true"`
}

func NewApricotAbortBlock added in v1.8.0

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 added in v1.8.0

func (*ApricotAbortBlock) InitCtx(*snow.Context)

func (*ApricotAbortBlock) Txs added in v1.8.0

func (*ApricotAbortBlock) Txs() []*txs.Tx

func (*ApricotAbortBlock) Visit added in v1.8.0

func (b *ApricotAbortBlock) Visit(v Visitor) error

type ApricotAtomicBlock added in v1.8.0

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 added in v1.8.0

func NewApricotAtomicBlock(
	parentID ids.ID,
	height uint64,
	tx *txs.Tx,
) (*ApricotAtomicBlock, error)

func (*ApricotAtomicBlock) InitCtx added in v1.8.0

func (b *ApricotAtomicBlock) InitCtx(ctx *snow.Context)

func (*ApricotAtomicBlock) Txs added in v1.8.0

func (b *ApricotAtomicBlock) Txs() []*txs.Tx

func (*ApricotAtomicBlock) Visit added in v1.8.0

func (b *ApricotAtomicBlock) Visit(v Visitor) error

type ApricotCommitBlock added in v1.8.0

type ApricotCommitBlock struct {
	CommonBlock `serialize:"true"`
}

func NewApricotCommitBlock added in v1.8.0

func NewApricotCommitBlock(
	parentID ids.ID,
	height uint64,
) (*ApricotCommitBlock, error)

func (*ApricotCommitBlock) InitCtx added in v1.8.0

func (*ApricotCommitBlock) InitCtx(*snow.Context)

func (*ApricotCommitBlock) Txs added in v1.8.0

func (*ApricotCommitBlock) Txs() []*txs.Tx

func (*ApricotCommitBlock) Visit added in v1.8.0

func (b *ApricotCommitBlock) Visit(v Visitor) error

type ApricotProposalBlock added in v1.8.0

type ApricotProposalBlock struct {
	CommonBlock `serialize:"true"`
	Tx          *txs.Tx `serialize:"true" json:"tx"`
}

func NewApricotProposalBlock added in v1.8.0

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 added in v1.8.0

func (b *ApricotProposalBlock) InitCtx(ctx *snow.Context)

func (*ApricotProposalBlock) Txs added in v1.8.0

func (b *ApricotProposalBlock) Txs() []*txs.Tx

func (*ApricotProposalBlock) Visit added in v1.8.0

func (b *ApricotProposalBlock) Visit(v Visitor) error

type ApricotStandardBlock added in v1.8.0

type ApricotStandardBlock struct {
	CommonBlock  `serialize:"true"`
	Transactions []*txs.Tx `serialize:"true" json:"txs"`
}

func NewApricotStandardBlock added in v1.8.0

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 added in v1.8.0

func (b *ApricotStandardBlock) InitCtx(ctx *snow.Context)

func (*ApricotStandardBlock) Txs added in v1.8.0

func (b *ApricotStandardBlock) Txs() []*txs.Tx

func (*ApricotStandardBlock) Visit added in v1.8.0

func (b *ApricotStandardBlock) Visit(v Visitor) error

type BanffAbortBlock added in v1.9.0

type BanffAbortBlock struct {
	Time              uint64 `serialize:"true" json:"time"`
	ApricotAbortBlock `serialize:"true"`
}

func NewBanffAbortBlock added in v1.9.0

func NewBanffAbortBlock(
	timestamp time.Time,
	parentID ids.ID,
	height uint64,
) (*BanffAbortBlock, error)

func (*BanffAbortBlock) Timestamp added in v1.9.0

func (b *BanffAbortBlock) Timestamp() time.Time

func (*BanffAbortBlock) Visit added in v1.9.0

func (b *BanffAbortBlock) Visit(v Visitor) error

type BanffBlock added in v1.9.0

type BanffBlock interface {
	Block
	Timestamp() time.Time
}

type BanffCommitBlock added in v1.9.0

type BanffCommitBlock struct {
	Time               uint64 `serialize:"true" json:"time"`
	ApricotCommitBlock `serialize:"true"`
}

func NewBanffCommitBlock added in v1.9.0

func NewBanffCommitBlock(
	timestamp time.Time,
	parentID ids.ID,
	height uint64,
) (*BanffCommitBlock, error)

func (*BanffCommitBlock) Timestamp added in v1.9.0

func (b *BanffCommitBlock) Timestamp() time.Time

func (*BanffCommitBlock) Visit added in v1.9.0

func (b *BanffCommitBlock) Visit(v Visitor) error

type BanffProposalBlock added in v1.9.0

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 added in v1.9.0

func NewBanffProposalBlock(
	timestamp time.Time,
	parentID ids.ID,
	height uint64,
	tx *txs.Tx,
) (*BanffProposalBlock, error)

func (*BanffProposalBlock) InitCtx added in v1.9.0

func (b *BanffProposalBlock) InitCtx(ctx *snow.Context)

func (*BanffProposalBlock) Timestamp added in v1.9.0

func (b *BanffProposalBlock) Timestamp() time.Time

func (*BanffProposalBlock) Visit added in v1.9.0

func (b *BanffProposalBlock) Visit(v Visitor) error

type BanffStandardBlock added in v1.9.0

type BanffStandardBlock struct {
	Time                 uint64 `serialize:"true" json:"time"`
	ApricotStandardBlock `serialize:"true"`
}

func NewBanffStandardBlock added in v1.9.0

func NewBanffStandardBlock(
	timestamp time.Time,
	parentID ids.ID,
	height uint64,
	txs []*txs.Tx,
) (*BanffStandardBlock, error)

func (*BanffStandardBlock) Timestamp added in v1.9.0

func (b *BanffStandardBlock) Timestamp() time.Time

func (*BanffStandardBlock) Visit added in v1.9.0

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

func Parse

func Parse(c codec.Manager, b []byte) (Block, error)

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) Bytes

func (m *MockBlock) Bytes() []byte

Bytes mocks base method.

func (*MockBlock) EXPECT

func (m *MockBlock) EXPECT() *MockBlockMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBlock) Height

func (m *MockBlock) Height() uint64

Height mocks base method.

func (*MockBlock) ID

func (m *MockBlock) ID() ids.ID

ID mocks base method.

func (*MockBlock) InitCtx added in v1.8.0

func (m *MockBlock) InitCtx(arg0 *snow.Context)

InitCtx mocks base method.

func (*MockBlock) Parent

func (m *MockBlock) Parent() ids.ID

Parent mocks base method.

func (*MockBlock) Txs

func (m *MockBlock) Txs() []*txs.Tx

Txs mocks base method.

func (*MockBlock) Visit

func (m *MockBlock) Visit(arg0 Visitor) error

Visit 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) InitCtx added in v1.8.0

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
}

Directories

Path Synopsis
Package executor is a generated GoMock package.
Package executor is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL