block

package
v0.0.0-...-3da4c06 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: LGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrHeaderIsNil ..
	ErrHeaderIsNil = errors.New("cannot encode nil header receiver")
)
View Source
var HeaderRegistry = taggedrlp.NewRegistry()

HeaderRegistry is the taggedrlp type registry for versioned headers.

Functions

This section is empty.

Types

type Header struct {
	blockif.Header
}

Header represents a block header in the Astra blockchain.

func (*Header) DecodeRLP

func (h *Header) DecodeRLP(s *rlp.Stream) error

DecodeRLP decodes the header using tagged RLP representation.

func (*Header) EncodeRLP

func (h *Header) EncodeRLP(w io.Writer) error

EncodeRLP encodes the header using tagged RLP representation.

func (*Header) Hash

func (h *Header) Hash() common.Hash

Hash returns the block hash of the header. This uses HeaderRegistry to choose and return the right tagged RLP form of the header.

func (*Header) IsLastBlockInEpoch

func (h *Header) IsLastBlockInEpoch() bool

IsLastBlockInEpoch returns True if it is the last block of the epoch. Note that the last block contains the shard state of the next epoch.

func (*Header) Logger

func (h *Header) Logger(logger *zerolog.Logger) *zerolog.Logger

Logger returns a sub-logger with block contexts added.

func (Header) MarshalJSON

func (h Header) MarshalJSON() ([]byte, error)

MarshalJSON ..

func (Header) String

func (h Header) String() string

String ..

func (*Header) With

func (h *Header) With() HeaderFieldSetter

With returns a field setter context for the header.

Call a chain of setters on the returned field setter, followed by a call of Header method. Example:

header := NewHeader(epoch).With().
	ParentHash(parent.Hash()).
	ShardID(parent.ShardID()).
	Number(new(big.Int).Add(parent.Number(), big.NewInt(1)).
	Header()

type HeaderFieldSetter

type HeaderFieldSetter struct {
	// contains filtered or unexported fields
}

HeaderFieldSetter is a header field setter.

See NewHeaderWith for how it is used.

func (HeaderFieldSetter) Bloom

func (s HeaderFieldSetter) Bloom(newBloom types.Bloom) HeaderFieldSetter

Bloom sets the smart contract log Bloom filter for this block.

func (HeaderFieldSetter) Coinbase

func (s HeaderFieldSetter) Coinbase(newCoinbase common.Address) HeaderFieldSetter

Coinbase sets the coinbase address field.

func (s HeaderFieldSetter) CrossLinks(newCrossLinks []byte) HeaderFieldSetter

CrossLinks sets the RLP-encoded form of non-beacon block headers chosen to be canonical by the beacon committee.

It stores a copy; the caller may freely modify the original.

func (HeaderFieldSetter) Epoch

func (s HeaderFieldSetter) Epoch(newEpoch *big.Int) HeaderFieldSetter

Epoch sets the epoch number of this block.

It stores a copy; the caller may freely modify the original.

func (HeaderFieldSetter) Extra

func (s HeaderFieldSetter) Extra(newExtra []byte) HeaderFieldSetter

Extra sets the extra data field of this block.

It stores a copy; the caller may freely modify the original.

func (HeaderFieldSetter) GasLimit

func (s HeaderFieldSetter) GasLimit(newGasLimit uint64) HeaderFieldSetter

GasLimit sets the gas limit for transactions in this block.

func (HeaderFieldSetter) GasUsed

func (s HeaderFieldSetter) GasUsed(newGasUsed uint64) HeaderFieldSetter

GasUsed sets the amount of gas used by transactions in this block.

func (HeaderFieldSetter) Header

func (s HeaderFieldSetter) Header() *Header

Header returns the header whose fields have been set. Call this at the end of a field setter chain.

func (HeaderFieldSetter) IncomingReceiptHash

func (s HeaderFieldSetter) IncomingReceiptHash(newIncomingReceiptHash common.Hash) HeaderFieldSetter

IncomingReceiptHash sets the ingress transaction receipt trie hash.

func (HeaderFieldSetter) LastCommitBitmap

func (s HeaderFieldSetter) LastCommitBitmap(newLastCommitBitmap []byte) HeaderFieldSetter

LastCommitBitmap sets the signatory bitmap of the previous block.

It stores a copy; the caller may freely modify the original.

func (HeaderFieldSetter) LastCommitSignature

func (s HeaderFieldSetter) LastCommitSignature(newLastCommitSignature [96]byte) HeaderFieldSetter

LastCommitSignature sets the FBFT commit group signature for the last block.

func (HeaderFieldSetter) MixDigest

func (s HeaderFieldSetter) MixDigest(newMixDigest common.Hash) HeaderFieldSetter

MixDigest sets the mixhash of this block.

func (HeaderFieldSetter) Number

func (s HeaderFieldSetter) Number(newNumber *big.Int) HeaderFieldSetter

Number sets the block number.

It stores a copy; the caller may freely modify the original.

func (HeaderFieldSetter) OutgoingReceiptHash

func (s HeaderFieldSetter) OutgoingReceiptHash(newOutgoingReceiptHash common.Hash) HeaderFieldSetter

OutgoingReceiptHash sets the egress transaction receipt trie hash.

func (HeaderFieldSetter) ParentHash

func (s HeaderFieldSetter) ParentHash(newParentHash common.Hash) HeaderFieldSetter

ParentHash sets the parent hash field.

func (HeaderFieldSetter) ReceiptHash

func (s HeaderFieldSetter) ReceiptHash(newReceiptHash common.Hash) HeaderFieldSetter

ReceiptHash sets the same-shard transaction receipt trie hash.

func (HeaderFieldSetter) Root

Root sets the state trie root hash field.

func (HeaderFieldSetter) ShardID

func (s HeaderFieldSetter) ShardID(newShardID uint32) HeaderFieldSetter

ShardID sets the shard ID to which this block belongs.

func (HeaderFieldSetter) ShardState

func (s HeaderFieldSetter) ShardState(newShardState []byte) HeaderFieldSetter

ShardState sets the RLP-encoded form of shard state

It stores a copy; the caller may freely modify the original.

func (HeaderFieldSetter) ShardStateHash

func (s HeaderFieldSetter) ShardStateHash(newShardStateHash common.Hash) HeaderFieldSetter

ShardStateHash sets the shard state hash.

func (HeaderFieldSetter) Time

func (s HeaderFieldSetter) Time(newTime *big.Int) HeaderFieldSetter

Time sets the UNIX timestamp of this block.

It stores a copy; the caller may freely modify the original.

func (HeaderFieldSetter) TxHash

func (s HeaderFieldSetter) TxHash(newTxHash common.Hash) HeaderFieldSetter

TxHash sets the transaction trie root hash field.

func (HeaderFieldSetter) Vdf

func (s HeaderFieldSetter) Vdf(newVdf []byte) HeaderFieldSetter

Vdf sets the output of the VDF for the epoch.

It stores a copy; the caller may freely modify the original.

func (HeaderFieldSetter) ViewID

func (s HeaderFieldSetter) ViewID(newViewID *big.Int) HeaderFieldSetter

ViewID sets the view ID in which the block was originally proposed.

It stores a copy; the caller may freely modify the original.

func (HeaderFieldSetter) Vrf

func (s HeaderFieldSetter) Vrf(newVrf []byte) HeaderFieldSetter

Vrf sets the output of the VRF for the epoch.

It stores a copy; the caller may freely modify the original.

type HeaderPair

type HeaderPair struct {
	BeaconHeader *Header `json:"beacon-chain-header"`
	ShardHeader  *Header `json:"shard-chain-header"`
}

HeaderPair ..

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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