serenity

package
v0.0.0-...-92d349b Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SerenityDifficulty = libcommon.Big0     // Serenity block's difficulty is always 0.
	SerenityNonce      = types.BlockNonce{} // Serenity chain's nonces are 0.
	RewardSerenity     = big.NewInt(300000000000000000)
)

Constants for Serenity as specified into https://eips.ethereum.org/EIPS/eip-2982

Functions

func IsPoSHeader

func IsPoSHeader(header *types.Header) bool

IsPoSHeader reports the header belongs to the PoS-stage with some special fields. This function is not suitable for a part of APIs like Prepare or CalcDifficulty because the header difficulty is not set yet.

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 Serenity

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

Serenity Consensus Engine for the Execution Layer. Serenity 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) *Serenity

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

func (*Serenity) APIs

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

func (*Serenity) Author

func (s *Serenity) 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 (*Serenity) CalcDifficulty

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

func (*Serenity) Close

func (s *Serenity) Close() error

func (*Serenity) Finalize

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

func (*Serenity) FinalizeAndAssemble

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

func (*Serenity) GenerateSeal

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

func (*Serenity) Initialize

func (s *Serenity) Initialize(config *chain.Config, chain consensus.ChainHeaderReader, header *types.Header, state *state.IntraBlockState, txs []types.Transaction, uncles []*types.Header, syscall consensus.SystemCall)

func (*Serenity) InnerEngine

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

InnerEngine returns the embedded eth1 consensus engine.

func (*Serenity) IsServiceTransaction

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

func (*Serenity) Prepare

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

Prepare makes sure difficulty and nonce are correct

func (*Serenity) Seal

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

func (*Serenity) SealHash

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

func (*Serenity) Type

Type returns the type of the underlying consensus engine.

func (*Serenity) VerifyHeader

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

VerifyHeader checks whether a header conforms to the consensus rules of the stock Ethereum serenity engine.

func (*Serenity) VerifyUncles

func (s *Serenity) 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