merge

package
v0.0.0-...-ff78b6e Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProofOfStakeDifficulty = libcommon.Big0     // PoS block's difficulty is always 0
	ProofOfStakeNonce      = types.BlockNonce{} // PoS block's have all-zero nonces
)

Constants for The Merge as specified by EIP-3675: Upgrade consensus to Proof-of-Stake

Functions

func IsTTDReached

func IsTTDReached(chain consensus.ChainHeaderReader, parentHash libcommon.Hash, number uint64) (bool, error)

IsTTDReached checks if the TotalTerminalDifficulty has been surpassed on the `parentHash` block. It depends on the parentHash already being stored in the database. If the total difficulty is not stored in the database a ErrUnknownAncestorTD error is returned.

Types

type Merge

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

Merge Consensus Engine for the Execution Layer. Merge is a consensus engine that combines the eth1 consensus and proof-of-stake algorithm. The transition rule is described in the eth1/2 merge spec: https://eips.ethereum.org/EIPS/eip-3675

Note: After the Merge the work is mostly done on the Consensus Layer, so nothing much is to be added on this side.

func New

func New(eth1Engine consensus.Engine) *Merge

New creates a new instance of the Merge Engine with the given embedded eth1 engine.

func (*Merge) APIs

func (s *Merge) APIs(chain consensus.ChainHeaderReader) []rpc.API

func (*Merge) Author

func (s *Merge) Author(header *types.Header) (libcommon.Address, error)

Author implements consensus.Engine, returning the header's coinbase as the proof-of-stake verified author of the block. This is thread-safe (only access the header.Coinbase or the underlying engine's thread-safe method)

func (*Merge) CalcDifficulty

func (s *Merge) CalcDifficulty(chain consensus.ChainHeaderReader, time, parentTime uint64, parentDifficulty *big.Int, parentNumber uint64, parentHash, parentUncleHash libcommon.Hash, parentAuRaStep uint64) *big.Int

func (*Merge) CalculateRewards

func (s *Merge) CalculateRewards(config *chain.Config, header *types.Header, uncles []*types.Header, syscall consensus.SystemCall,
) ([]consensus.Reward, error)

func (*Merge) Close

func (s *Merge) Close() error

func (*Merge) Finalize

func (s *Merge) Finalize(config *chain.Config, header *types.Header, state *state.IntraBlockState,
	txs types.Transactions, uncles []*types.Header, r types.Receipts, withdrawals []*types.Withdrawal,
	chain consensus.ChainReader, syscall consensus.SystemCall, logger log.Logger,
) (types.Transactions, types.Receipts, error)

func (*Merge) FinalizeAndAssemble

func (s *Merge) FinalizeAndAssemble(config *chain.Config, header *types.Header, state *state.IntraBlockState,
	txs types.Transactions, uncles []*types.Header, receipts types.Receipts, withdrawals []*types.Withdrawal,
	chain consensus.ChainReader, syscall consensus.SystemCall, call consensus.Call, logger log.Logger,
) (*types.Block, types.Transactions, types.Receipts, error)

func (*Merge) GenerateSeal

func (s *Merge) GenerateSeal(chain consensus.ChainHeaderReader, currnt, parent *types.Header, call consensus.Call) []byte

func (*Merge) Initialize

func (s *Merge) Initialize(config *chain.Config, chain consensus.ChainHeaderReader, header *types.Header,
	state *state.IntraBlockState, syscall consensus.SysCallCustom, logger log.Logger,
)

func (*Merge) InnerEngine

func (s *Merge) InnerEngine() consensus.Engine

InnerEngine returns the embedded eth1 consensus engine.

func (*Merge) IsServiceTransaction

func (s *Merge) IsServiceTransaction(sender libcommon.Address, syscall consensus.SystemCall) bool

func (*Merge) Prepare

func (s *Merge) Prepare(chain consensus.ChainHeaderReader, header *types.Header, state *state.IntraBlockState) error

Prepare makes sure difficulty and nonce are correct

func (*Merge) Seal

func (s *Merge) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error

func (*Merge) SealHash

func (s *Merge) SealHash(header *types.Header) (hash libcommon.Hash)

func (*Merge) Type

func (s *Merge) Type() chain.ConsensusName

Type returns the type of the underlying consensus engine.

func (*Merge) VerifyHeader

func (s *Merge) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error

func (*Merge) VerifyUncles

func (s *Merge) VerifyUncles(chain consensus.ChainReader, header *types.Header, uncles []*types.Header) error

VerifyUncles implements consensus.Engine, always returning an error for any uncles as this consensus mechanism doesn't permit uncles.

Jump to

Keyboard shortcuts

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