Documentation
¶
Index ¶
- Variables
- func IsPoSHeader(header *types.Header) bool
- func IsTTDReached(chain consensus.ChainHeaderReader, parentHash libcommon.Hash, number uint64) (bool, error)
- type Serenity
- func (s *Serenity) APIs(chain consensus.ChainHeaderReader) []rpc.API
- func (s *Serenity) Author(header *types.Header) (libcommon.Address, error)
- func (s *Serenity) CalcDifficulty(chain consensus.ChainHeaderReader, time, parentTime uint64, ...) *big.Int
- func (s *Serenity) Close() error
- func (s *Serenity) Finalize(config *chain.Config, header *types.Header, state *state.IntraBlockState, ...) (types.Transactions, types.Receipts, error)
- func (s *Serenity) FinalizeAndAssemble(config *chain.Config, header *types.Header, state *state.IntraBlockState, ...) (*types.Block, types.Transactions, types.Receipts, error)
- func (s *Serenity) GenerateSeal(chain consensus.ChainHeaderReader, currnt, parent *types.Header, ...) []byte
- func (s *Serenity) Initialize(config *chain.Config, chain consensus.ChainHeaderReader, header *types.Header, ...)
- func (s *Serenity) InnerEngine() consensus.Engine
- func (s *Serenity) IsServiceTransaction(sender libcommon.Address, syscall consensus.SystemCall) bool
- func (s *Serenity) Prepare(chain consensus.ChainHeaderReader, header *types.Header, ...) error
- func (s *Serenity) Seal(chain consensus.ChainHeaderReader, block *types.Block, ...) error
- func (s *Serenity) SealHash(header *types.Header) (hash libcommon.Hash)
- func (s *Serenity) Type() erigonchain.ConsensusName
- func (s *Serenity) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error
- func (s *Serenity) VerifyUncles(chain consensus.ChainReader, header *types.Header, uncles []*types.Header) error
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 (*Serenity) Author ¶
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 (*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 (*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 ¶
InnerEngine returns the embedded eth1 consensus engine.
func (*Serenity) IsServiceTransaction ¶
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) Type ¶
func (s *Serenity) Type() erigonchain.ConsensusName
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.