misc

package
v0.0.0-...-1f8a15b Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBadProDAOExtra is returned if a header doesn't support the DAO fork on a
	// pro-fork client.
	ErrBadProDAOExtra = errors.New("bad DAO pro-fork extra-data")

	// ErrBadNoDAOExtra is returned if a header does support the DAO fork on a no-
	// fork client.
	ErrBadNoDAOExtra = errors.New("bad DAO no-fork extra-data")
)
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 ApplyBeaconRootEip4788

func ApplyBeaconRootEip4788(parentBeaconBlockRoot *libcommon.Hash, syscall consensus.SystemCall)

func ApplyDAOHardFork

func ApplyDAOHardFork(statedb *state.IntraBlockState)

ApplyDAOHardFork modifies the state database according to the DAO hard-fork rules, transferring all balances of a set of DAO accounts to a single refund contract.

func CalcBaseFee

func CalcBaseFee(config *chain.Config, parent *types.Header) *big.Int

CalcBaseFee calculates the basefee of the header.

func CalcExcessBlobGas

func CalcExcessBlobGas(config *chain.Config, parent *types.Header) uint64

CalcExcessBlobGas implements calc_excess_blob_gas from EIP-4844

func FakeExponential

func FakeExponential(factor, denom *uint256.Int, excessBlobGas uint64) (*uint256.Int, error)

FakeExponential approximates factor * e ** (num / denom) using a taylor expansion as described in the EIP-4844 spec.

func GetBlobGasPrice

func GetBlobGasPrice(config *chain.Config, excessBlobGas uint64) (*uint256.Int, error)

func GetBlobGasUsed

func GetBlobGasUsed(numBlobs int) uint64

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 VerifyAbsenceOfCancunHeaderFields

func VerifyAbsenceOfCancunHeaderFields(header *types.Header) error

VerifyAbsenceOfCancunHeaderFields checks that the header doesn't have any fields added in Cancun (EIP-4844, EIP-4788).

func VerifyDAOHeaderExtraData

func VerifyDAOHeaderExtraData(config *chain.Config, header *types.Header) error

VerifyDAOHeaderExtraData validates the extra-data field of a block header to ensure it conforms to DAO hard-fork rules.

DAO hard-fork extension to the header validity:

a) if the node is no-fork, do not accept blocks in the [fork, fork+10) range
   with the fork specific extra-data set
b) if the node is pro-fork, require blocks in the specific range to have the
   unique extra-data set.

func VerifyEip1559Header

func VerifyEip1559Header(config *chain.Config, parent, header *types.Header, skipGasLimit bool) error

VerifyEip1559Header verifies some header attributes which were changed in EIP-1559, - gas limit check - basefee check

func VerifyGaslimit

func VerifyGaslimit(parentGasLimit, headerGasLimit uint64) error

VerifyGaslimit verifies the header gas limit according increase/decrease in relation to the parent gas limit.

func VerifyPresenceOfCancunHeaderFields

func VerifyPresenceOfCancunHeaderFields(header *types.Header) error

VerifyPresenceOfCancunHeaderFields checks that the fields introduced in Cancun (EIP-4844, EIP-4788) are present.

Types

This section is empty.

Jump to

Keyboard shortcuts

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