blocks

package
v1.8.0-rc.11 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package blocks is a generated GoMock package.

Index

Constants

This section is empty.

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.

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)

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) 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) 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"`
}

As is, this is duplication of atomic block. But let's tolerate some code duplication for now

func NewApricotProposalBlock added in v1.8.0

func NewApricotProposalBlock(
	parentID ids.ID,
	height uint64,
	tx *txs.Tx,
) (*ApricotProposalBlock, error)

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,
	txes []*txs.Tx,
) (*ApricotStandardBlock, error)

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 Block

type Block interface {
	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) 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(visitor 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) 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(visitor interface{}) *gomock.Call

Visit indicates an expected call of Visit.

type Visitor

type Visitor interface {
	ApricotAbortBlock(*ApricotAbortBlock) error
	ApricotCommitBlock(*ApricotCommitBlock) error
	ApricotProposalBlock(*ApricotProposalBlock) error
	ApricotStandardBlock(*ApricotStandardBlock) error
	ApricotAtomicBlock(*ApricotAtomicBlock) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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