eth

package
v1.16.13 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: MIT Imports: 35 Imported by: 133

Documentation

Index

Constants

View Source
const (
	BlobSize        = 4096 * 32
	MaxBlobDataSize = (4*31+3)*1024 - 4
	EncodingVersion = 0
	VersionOffset   = 1    // offset of the version byte in the blob encoding
	Rounds          = 1024 // number of encode/decode rounds
)
View Source
const (
	// Unsafe is:
	// - L1: absolute head of the chain
	// - L2: absolute head of the chain, not confirmed on L1
	Unsafe = "latest"
	// Safe is:
	// - L1: Justified checkpoint, beacon chain: 1 epoch of 2/3 of the validators attesting the epoch.
	// - L2: Derived chain tip from L1 data
	Safe = "safe"
	// Finalized is:
	// - L1: Finalized checkpoint, beacon chain: 2+ justified epochs with "supermajority link" (see FFG docs).
	//       More about FFG: https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/gasper/
	// - L2: Derived chain tip from finalized L1 data
	Finalized = "finalized"
)
View Source
const (
	// L1ScalarBedrock is implied pre-Ecotone, encoding just a regular-gas scalar.
	L1ScalarBedrock = byte(0)
	// L1ScalarEcotone is new in Ecotone, allowing configuration of both a regular and a blobs scalar.
	L1ScalarEcotone = byte(1)
)

The Ecotone upgrade introduces a versioned L1 scalar format that is backward-compatible with pre-Ecotone L1 scalar values.

View Source
const (

	// SuperRootVersionV1MinLen is the minimum length of a V1 super root prior to hashing
	// Must contain a 1 byte version, uint64 timestamp and at least one chain's output root hash
	SuperRootVersionV1MinLen = 1 + 8 + chainIDAndOutputLen
)

Variables

View Source
var (
	ErrBlobInvalidFieldElement        = errors.New("invalid field element")
	ErrBlobInvalidEncodingVersion     = errors.New("invalid encoding version")
	ErrBlobInvalidLength              = errors.New("invalid length for blob")
	ErrBlobInputTooLarge              = errors.New("too much data to encode in one blob")
	ErrBlobExtraneousData             = errors.New("non-zero data encountered where blob should be empty")
	ErrBlobExtraneousDataFieldElement = errors.New("non-zero data encountered where field element should be empty")
)
View Source
var (
	MaxU256Wei           = ETH(uint256.Int{0: ^uint64(0), 1: ^uint64(0), 2: ^uint64(0), 3: ^uint64(0)})
	MaxU128Wei           = ETH(uint256.Int{0: ^uint64(0), 1: ^uint64(0), 2: 0, 3: 0})
	MaxU64Wei            = ETH(uint256.Int{0: ^uint64(0), 1: 0, 2: 0, 3: 0})
	BillionEther         = Ether(1000_000_000)
	MillionEther         = Ether(1000_000)
	ThousandEther        = Ether(1000)
	HundredEther         = Ether(100)
	TenEther             = Ether(10)
	OneEther             = Ether(1)
	HalfEther            = GWei(500_000_000)
	OneThirdEther        = GWei(333_333_333)
	OneTenthEther        = GWei(100_000_000)
	NineHundredthsEther  = GWei(90_000_000)
	EightHundredthsEther = GWei(80_000_000)
	SevenHundredthsEther = GWei(70_000_000)
	SixHundredthsEther   = GWei(60_000_000)
	FiveHundredthsEther  = GWei(50_000_000)
	FourHundredthsEther  = GWei(40_000_000)
	ThreeHundredthsEther = GWei(30_000_000)
	TwoHundredthsEther   = GWei(20_000_000)
	OneHundredthEther    = GWei(10_000_000)
	OneGWei              = GWei(1)
	OneWei               = WeiU64(1)
	ZeroWei              = WeiU64(0)
)
View Source
var (
	ErrInvalidOutput        = errors.New("invalid output")
	ErrInvalidOutputVersion = errors.New("invalid output version")

	OutputVersionV0 = Bytes32{}
)
View Source
var (

	// ErrExtraDataTooLarge occurs when the ExecutionPayload's ExtraData field
	// is too large to be properly represented in SSZ.
	ErrExtraDataTooLarge = errors.New("extra data too large")

	ErrBadTransactionOffset = errors.New("transactions offset is smaller than extra data offset, aborting")
	ErrBadWithdrawalsOffset = errors.New("withdrawals offset is smaller than transaction offset, aborting")
	ErrBadExtraDataOffset   = errors.New("unexpected extra data offset")
	ErrScopeTooSmall        = errors.New("scope too small to decode execution payload")

	ErrMissingData = errors.New("execution payload envelope is missing data")
)
View Source
var (
	ErrInvalidSuperRoot        = errors.New("invalid super root")
	ErrInvalidSuperRootVersion = errors.New("invalid super root version")
	SuperRootVersionV1         = byte(1)
)
View Source
var ErrBedrockScalarPaddingNotEmpty = errors.New("version 0 scalar value has non-empty padding")

Functions

func AddressAsLeftPaddedHash

func AddressAsLeftPaddedHash(addr common.Address) (out common.Hash)

AddressAsLeftPaddedHash converts an address to a hash by left-padding it with zeros. No hashing is performed. This was previously known as Address.Hash(), but removed from go-ethereum in PR 28228, because the naming was not clear.

func CalcBlobFeeCancun

func CalcBlobFeeCancun(excessBlobGas uint64) *big.Int

CalcBlobFeeCancun calculates the blob fee for the given header using the default blob schedule for Cancun. This function only exists to support the L1 Pectra Blob Schedule Fix. The geth function eip4844.CalcBlobFee should be used instead.

func CheckEcotoneL1SystemConfigScalar

func CheckEcotoneL1SystemConfigScalar(scalar [32]byte) error

func CheckRecentTxs

func CheckRecentTxs(
	ctx context.Context,
	l1 L1Client,
	depth int,
	addr common.Address,
) (blockNum uint64, found bool, err error)

CheckRecentTxs checks the depth recent blocks for txs from the account with address addr and returns either:

  • blockNum containing the last tx and true if any was found
  • the oldest block checked and false if no nonce change was found

func DecodeRawReceipts

func DecodeRawReceipts(block BlockID, rawReceipts []hexutil.Bytes, txHashes []common.Hash) ([]*types.Receipt, error)

DecodeRawReceipts decodes receipts and adds additional blocks metadata. The contract-deployment addresses are not set however (high cost, depends on nonce values, unused by op-node).

func DecodeTransactions

func DecodeTransactions(data []hexutil.Bytes) ([]*types.Transaction, error)

DecodeTransactions decodes a list of opaque transactions into transactions.

func EncodeOperatorFeeParams

func EncodeOperatorFeeParams(params OperatorFeeParams) (scalar [32]byte)

EncodeOperatorFeeParams encodes the OperatorFeeParams into a 32-byte value

func EncodeReceipts

func EncodeReceipts(elems []*types.Receipt) ([]hexutil.Bytes, error)

EncodeReceipts encodes a list of receipts into raw receipts. Some non-consensus meta-data may be lost.

func EncodeScalar

func EncodeScalar(scalars EcotoneScalars) (scalar [32]byte)

EncodeScalar encodes the EcotoneScalars into a 32-byte scalar value for the Ecotone serialization format.

func EncodeTransactions

func EncodeTransactions(elems []*types.Transaction) ([]hexutil.Bytes, error)

EncodeTransactions encodes a list of transactions into opaque transactions.

func EvilChainIDToUInt64

func EvilChainIDToUInt64(id ChainID) uint64

EvilChainIDToUInt64 converts a ChainID to a uint64 and panic's if the ChainID is too large for a UInt64 It is "evil" because 32 byte ChainIDs should be universally supported which this method breaks. It is provided for legacy purposes to facilitate a transition to full 32 byte chain ID support and should not be used in new code. Existing calls should be replaced with full 32 byte support whenever possible.

func ForkchoiceUpdateErr

func ForkchoiceUpdateErr(payloadStatus PayloadStatusV1) error

func GetLogAtIndex

func GetLogAtIndex(receipts []*types.Receipt, logIndex uint) (*types.Log, error)

Assumes receipts are sorted by transaction index.

func GweiToWei

func GweiToWei(gwei float64) (*big.Int, error)

func KZGToVersionedHash

func KZGToVersionedHash(commitment kzg4844.Commitment) (out common.Hash)

KZGToVersionedHash computes the "blob hash" (a.k.a. versioned-hash) of a blob-commitment, as used in a blob-tx. We implement it here because it is unfortunately not (currently) exposed by geth.

func L1ChainConfigByChainID

func L1ChainConfigByChainID(chainID ChainID) *params.ChainConfig

L1ChainConfigByChainID returns the chain config for the given chain ID, if it is in the set of known chain IDs (Mainnet, Sepolia, Holesky, Hoodi). If the chain ID is not known, it returns nil.

func MaybeAsNotFoundErr

func MaybeAsNotFoundErr(err error) error

MaybeAsNotFoundErr checks if the error is an ethereum.NotFound error or has an error string that heuristically indicates that it is this error. If so, it returns ethereum.NotFound, otherwise it returns the original error.

Note that correct implementations of the execution layer API must return an empty result and no error if the block or header is not found. So using this translation hardens against wrong implementations of the execution layer API only.

func NewPayloadErr

func NewPayloadErr(payload *ExecutionPayload, payloadStatus *PayloadStatusV1) error

func PollBlockChanges

func PollBlockChanges(log log.Logger, src L1BlockRefsSource, fn HeadSignalFn,
	label BlockLabel, interval time.Duration, timeout time.Duration) ethereum.Subscription

PollBlockChanges opens a polling loop to fetch the L1 block reference with the given label, on provided interval and with request timeout. Results are returned with provided callback fn, which may block to pause/back-pressure polling.

func SortChainID

func SortChainID(ids []ChainID)

SortChainID sorts chain IDs in ascending order, in-place.

func TransactionsToHashes

func TransactionsToHashes(elems []*types.Transaction) []common.Hash

TransactionsToHashes computes the transaction-hash for every transaction in the input.

func VerifyBlobProof

func VerifyBlobProof(blob *Blob, commitment kzg4844.Commitment, proof kzg4844.Proof) error

VerifyBlobProof verifies that the given blob and proof corresponds to the given commitment, returning error if the verification fails.

func WatchHeadChanges

func WatchHeadChanges(ctx context.Context, src NewHeadSource, fn HeadSignalFn) (ethereum.Subscription, error)

WatchHeadChanges wraps a new-head subscription from NewHeadSource to feed the given Tracker. The ctx is only used to create the subscription, and does not affect the returned subscription.

func WeiToEther

func WeiToEther(wei *big.Int) float64

WeiToEther divides the wei value by 10^18 to get a number in ether as a float64

Types

type APIBeaconBlobsResponse

type APIBeaconBlobsResponse struct {
	Data []*Blob `json:"data"`
}

type APIBlobSidecar

type APIBlobSidecar struct {
	Index             Uint64String            `json:"index"`
	Blob              Blob                    `json:"blob"`
	KZGCommitment     Bytes48                 `json:"kzg_commitment"`
	KZGProof          Bytes48                 `json:"kzg_proof"`
	SignedBlockHeader SignedBeaconBlockHeader `json:"signed_block_header"`
	InclusionProof    []Bytes32               `json:"kzg_commitment_inclusion_proof"`
}

func (*APIBlobSidecar) BlobSidecar

func (sc *APIBlobSidecar) BlobSidecar() *BlobSidecar

type APIConfigResponse

type APIConfigResponse struct {
	Data ReducedConfigData `json:"data"`
}

type APIGenesisResponse

type APIGenesisResponse struct {
	Data ReducedGenesisData `json:"data"`
}

type APIGetBlobSidecarsResponse

type APIGetBlobSidecarsResponse struct {
	Data []*APIBlobSidecar `json:"data"`
}

type APIVersionResponse

type APIVersionResponse struct {
	Data VersionInformation `json:"data"`
}

type AccountResult

type AccountResult struct {
	AccountProof []hexutil.Bytes `json:"accountProof"`

	Address     common.Address `json:"address"`
	Balance     *hexutil.Big   `json:"balance"`
	CodeHash    common.Hash    `json:"codeHash"`
	Nonce       hexutil.Uint64 `json:"nonce"`
	StorageHash common.Hash    `json:"storageHash"`

	// Optional
	StorageProof []StorageProofEntry `json:"storageProof,omitempty"`
}

func (*AccountResult) Verify

func (res *AccountResult) Verify(stateRoot common.Hash) error

Verify an account (and optionally storage) proof from the getProof RPC. See https://eips.ethereum.org/EIPS/eip-1186

type BeaconBlockHeader

type BeaconBlockHeader struct {
	Slot          Uint64String `json:"slot"`
	ProposerIndex Uint64String `json:"proposer_index"`
	ParentRoot    Bytes32      `json:"parent_root"`
	StateRoot     Bytes32      `json:"state_root"`
	BodyRoot      Bytes32      `json:"body_root"`
}

type Blob

type Blob [BlobSize]byte

func (*Blob) Clear

func (b *Blob) Clear()

func (*Blob) ComputeKZGCommitment

func (b *Blob) ComputeKZGCommitment() (kzg4844.Commitment, error)

func (*Blob) FromData

func (b *Blob) FromData(data Data) error

FromData encodes the given input data into this blob. The encoding scheme is as follows:

In each round we perform 7 reads of input of lengths (31,1,31,1,31,1,31) bytes respectively for a total of 127 bytes. This data is encoded into the next 4 field elements of the output by placing each of the 4x31 byte chunks into bytes [1:32] of its respective field element. The three single byte chunks (24 bits) are split into 4x6-bit chunks, each of which is written into the top most byte of its respective field element, leaving the top 2 bits of each field element empty to avoid modulus overflow. This process is repeated for up to 1024 rounds until all data is encoded.

For only the very first output field, bytes [1:5] are used to encode the version and the length of the data.

func (*Blob) KZGBlob

func (b *Blob) KZGBlob() *kzg4844.Blob

func (*Blob) MarshalText

func (b *Blob) MarshalText() ([]byte, error)

func (*Blob) String

func (b *Blob) String() string

func (*Blob) TerminalString

func (b *Blob) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

func (*Blob) ToData

func (b *Blob) ToData() (Data, error)

ToData decodes the blob into raw byte data. See FromData above for details on the encoding format. If error is returned it will be one of InvalidFieldElementError, InvalidEncodingVersionError and InvalidLengthError.

func (*Blob) UnmarshalJSON

func (b *Blob) UnmarshalJSON(text []byte) error

func (*Blob) UnmarshalText

func (b *Blob) UnmarshalText(text []byte) error

type BlobSidecar

type BlobSidecar struct {
	Blob          Blob         `json:"blob"`
	Index         Uint64String `json:"index"`
	KZGCommitment Bytes48      `json:"kzg_commitment"`
	KZGProof      Bytes48      `json:"kzg_proof"`
}

type BlockID

type BlockID struct {
	Hash   common.Hash `json:"hash"`
	Number uint64      `json:"number"`
}

func HeaderBlockID

func HeaderBlockID(h *types.Header) BlockID

func ReceiptBlockID

func ReceiptBlockID(r *types.Receipt) BlockID

func ToBlockID

func ToBlockID(b NumberAndHash) BlockID

func (BlockID) String

func (id BlockID) String() string

func (BlockID) TerminalString

func (id BlockID) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

type BlockInfo

type BlockInfo interface {
	Hash() common.Hash
	ParentHash() common.Hash
	Coinbase() common.Address
	Root() common.Hash // state-root
	NumberU64() uint64
	Time() uint64
	// MixDigest field, reused for randomness after The Merge (Bellatrix hardfork)
	MixDigest() common.Hash
	BaseFee() *big.Int
	// BlobBaseFee returns the result of computing the blob fee from excessDataGas, or nil if the
	// block isn't a Dencun (4844 capable) block
	BlobBaseFee(chainConfig *params.ChainConfig) *big.Int
	ExcessBlobGas() *uint64
	ReceiptHash() common.Hash
	GasUsed() uint64
	BlobGasUsed() *uint64
	GasLimit() uint64
	ParentBeaconRoot() *common.Hash // Dencun extension
	WithdrawalsRoot() *common.Hash  // Isthmus extension

	// HeaderRLP returns the RLP of the block header as per consensus rules
	// Returns an error if the header RLP could not be written
	HeaderRLP() ([]byte, error)
	Header() *types.Header
}

func BlockToInfo

func BlockToInfo(b *types.Block) BlockInfo

func HeaderBlockInfo

func HeaderBlockInfo(h *types.Header) BlockInfo

HeaderBlockInfo returns h as a BlockInfo implementation, with pre-cached blockhash.

func HeaderBlockInfoTrusted

func HeaderBlockInfoTrusted(hash common.Hash, h *types.Header) BlockInfo

HeaderBlockInfoTrusted returns a BlockInfo, with trusted pre-cached block-hash.

type BlockLabel

type BlockLabel string

func (BlockLabel) Arg

func (label BlockLabel) Arg() any

func (BlockLabel) CheckID

func (BlockLabel) CheckID(id BlockID) error

type BlockRef

type BlockRef = L1BlockRef

BlockRef is a Block Ref independent of L1 or L2 Because L1BlockRefs are strict subsets of L2BlockRefs, BlockRef is a direct alias of L1BlockRef

func BlockRefFromHeader

func BlockRefFromHeader(h *types.Header) *BlockRef

type BlockVersion

type BlockVersion int
const (
	BlockV1 BlockVersion = iota
	BlockV2
	BlockV3
	BlockV4
)

func (BlockVersion) HasBlobProperties

func (v BlockVersion) HasBlobProperties() bool

func (BlockVersion) HasParentBeaconBlockRoot

func (v BlockVersion) HasParentBeaconBlockRoot() bool

func (BlockVersion) HasWithdrawals

func (v BlockVersion) HasWithdrawals() bool

func (BlockVersion) HasWithdrawalsRoot

func (v BlockVersion) HasWithdrawalsRoot() bool

type Bytes8

type Bytes8 [8]byte

func (Bytes8) MarshalText

func (b Bytes8) MarshalText() ([]byte, error)

func (Bytes8) String

func (b Bytes8) String() string

func (Bytes8) TerminalString

func (b Bytes8) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

func (*Bytes8) UnmarshalJSON

func (b *Bytes8) UnmarshalJSON(text []byte) error

func (*Bytes8) UnmarshalText

func (b *Bytes8) UnmarshalText(text []byte) error

type Bytes32

type Bytes32 [32]byte

func OutputRoot

func OutputRoot(output Output) Bytes32

OutputRoot returns the keccak256 hash of the marshaled L2 output

func SuperRoot

func SuperRoot(super Super) Bytes32

func (Bytes32) MarshalText

func (b Bytes32) MarshalText() ([]byte, error)

func (Bytes32) String

func (b Bytes32) String() string

func (Bytes32) TerminalString

func (b Bytes32) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

func (*Bytes32) UnmarshalJSON

func (b *Bytes32) UnmarshalJSON(text []byte) error

func (*Bytes32) UnmarshalText

func (b *Bytes32) UnmarshalText(text []byte) error

type Bytes48

type Bytes48 [48]byte

func (Bytes48) MarshalText

func (b Bytes48) MarshalText() ([]byte, error)

func (Bytes48) String

func (b Bytes48) String() string

func (Bytes48) TerminalString

func (b Bytes48) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

func (*Bytes48) UnmarshalJSON

func (b *Bytes48) UnmarshalJSON(text []byte) error

func (*Bytes48) UnmarshalText

func (b *Bytes48) UnmarshalText(text []byte) error

type Bytes65

type Bytes65 [65]byte

Bytes65 is a 65-byte long byte string, and encoded with 0x-prefix in hex. This can be used to represent encoded secp256k ethereum signatures.

func (Bytes65) MarshalText

func (b Bytes65) MarshalText() ([]byte, error)

func (Bytes65) String

func (b Bytes65) String() string

func (Bytes65) TerminalString

func (b Bytes65) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

func (*Bytes65) UnmarshalJSON

func (b *Bytes65) UnmarshalJSON(text []byte) error

func (*Bytes65) UnmarshalText

func (b *Bytes65) UnmarshalText(text []byte) error

type Bytes96

type Bytes96 [96]byte

func (Bytes96) MarshalText

func (b Bytes96) MarshalText() ([]byte, error)

func (Bytes96) String

func (b Bytes96) String() string

func (Bytes96) TerminalString

func (b Bytes96) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

func (*Bytes96) UnmarshalJSON

func (b *Bytes96) UnmarshalJSON(text []byte) error

func (*Bytes96) UnmarshalText

func (b *Bytes96) UnmarshalText(text []byte) error

type Bytes256

type Bytes256 [256]byte

func (Bytes256) MarshalText

func (b Bytes256) MarshalText() ([]byte, error)

func (Bytes256) String

func (b Bytes256) String() string

func (Bytes256) TerminalString

func (b Bytes256) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

func (*Bytes256) UnmarshalJSON

func (b *Bytes256) UnmarshalJSON(text []byte) error

func (*Bytes256) UnmarshalText

func (b *Bytes256) UnmarshalText(text []byte) error

type BytesMax32

type BytesMax32 []byte

func (BytesMax32) MarshalText

func (b BytesMax32) MarshalText() ([]byte, error)

func (BytesMax32) String

func (b BytesMax32) String() string

func (*BytesMax32) UnmarshalJSON

func (b *BytesMax32) UnmarshalJSON(text []byte) error

func (*BytesMax32) UnmarshalText

func (b *BytesMax32) UnmarshalText(text []byte) error

type ChainID

type ChainID uint256.Int

func ChainIDFromBig

func ChainIDFromBig(chainID *big.Int) ChainID

func ChainIDFromBytes32

func ChainIDFromBytes32(b [32]byte) ChainID

func ChainIDFromString

func ChainIDFromString(id string) (ChainID, error)

func ChainIDFromUInt64

func ChainIDFromUInt64(i uint64) ChainID

func ParseDecimalChainID

func ParseDecimalChainID(chainID string) (ChainID, error)

func ParseHexChainID

func ParseHexChainID(chainID string) (ChainID, error)

func (ChainID) Bytes32

func (id ChainID) Bytes32() [32]byte

func (ChainID) Cmp

func (id ChainID) Cmp(other ChainID) int

func (ChainID) IsUint64

func (id ChainID) IsUint64() bool

IsUint64 reports if the chainID fits in 64 bits

func (ChainID) LogValue

func (id ChainID) LogValue() slog.Value

func (ChainID) MarshalText

func (id ChainID) MarshalText() ([]byte, error)

MarshalText marshals into the decimal representation of the chainID

func (ChainID) String

func (id ChainID) String() string

String encodes the chainID in decimal form.

func (ChainID) ToBig

func (id ChainID) ToBig() *big.Int

func (ChainID) Uint64

func (id ChainID) Uint64() (v uint64, ok bool)

Uint64 is a convenience function, to turn the chainID into 64 bits. Not all chain IDs fit in 64 bits. This should be used only for compatibility with legacy tools / libs that do not use the full 32 byte chainID type.

func (*ChainID) UnmarshalText

func (id *ChainID) UnmarshalText(data []byte) error

UnmarshalText can unmarshal both a hexadecimal (must have 0x prefix) or decimal chainID

type ChainIDAndOutput

type ChainIDAndOutput struct {
	ChainID ChainID
	Output  Bytes32
}

func (*ChainIDAndOutput) Marshal

func (c *ChainIDAndOutput) Marshal() []byte

type ChainRootInfo

type ChainRootInfo struct {
	ChainID ChainID `json:"chainID"`
	// Canonical is the output root of the latest canonical block at a particular Timestamp.
	Canonical Bytes32 `json:"canonical"`
	// Pending is the output root preimage for the latest block at a particular Timestamp prior to validation of
	// executing messages. If the original block was valid, this will be the preimage of the
	// output root from the Canonical array. If it was invalid, it will be the output root preimage from the
	// Optimistic Block Deposited Transaction added to the deposit-only block.
	Pending []byte `json:"pending"`
}

func (ChainRootInfo) MarshalJSON

func (i ChainRootInfo) MarshalJSON() ([]byte, error)

func (*ChainRootInfo) UnmarshalJSON

func (i *ChainRootInfo) UnmarshalJSON(input []byte) error

type Data

type Data = hexutil.Bytes

type ELSyncPolicy

type ELSyncPolicy interface {
	ELSyncStatus(num uint64) ExecutePayloadStatus
}

ELSyncPolicy defines the policy for determining the synchronization status of the execution layer (EL) during EL Sync, as triggered exclusively by ForkchoiceUpdated (FCU) calls.

In the EL Sync process, the consensus layer (CL) notifies the EL of the current head via FCU. The EL then evaluates its internal sync state and reports whether it is still syncing or fully in sync. An ELSyncPolicy implementation encapsulates this decision logic.

The purpose of this interface is to provide a configurable or mockable strategy for how the EL responds to FCU-triggered sync checks—useful in testing, simulation, or devnet environments where the real EL behavior needs to be emulated.

type ETH

type ETH uint256.Int

ETH is a typed ETH (test-)currency integer, expressed in number of wei. Most methods and usages prefer a flat value presentation, instead of pointer. And return the new value, instead of mutating in-place. This type is not optimized for speed, but is instead designed for readability and to remove mutability foot-guns.

func Ether

func Ether(ether uint64) ETH

Ether turns the given amount of ether into ETH-typed wei. I.e. this multiplies the amount by 1e18 to denominate into wei.

func GWei

func GWei(gwei uint64) (out ETH)

GWei turns the given amount of GWei into ETH-typed wei. I.e. this multiplies the amount by 1e9 to denominate into wei.

func WeiBig

func WeiBig(wei *big.Int) (out ETH)

WeiBig turns the given big.Int amount of wei into ETH-typed wei. This panics if the amount does not fit in 256 bits, or if it is negative.

func WeiU64

func WeiU64(wei uint64) (out ETH)

WeiU64 turns the given uint64 amount of wei into ETH-typed wei. The upper 192 bits are zeroed.

func WeiU256

func WeiU256(wei *uint256.Int) (out ETH)

WeiU256 turns the given uint256.Int amount of wei into ETH-typed wei.

func (ETH) Add

func (e ETH) Add(v ETH) (out ETH)

Add adds v and returns the result. No value is mutated. Add panics if the computation overflows uint256.

func (ETH) AddOverflow

func (e ETH) AddOverflow(v ETH) (out ETH, overflow bool)

AddOverflow adds v and returns the result. No value is mutated. This also returns a boolean indicating if the computation overflowed.

func (ETH) Bytes32

func (e ETH) Bytes32() [32]byte

Bytes32 converts to [32]byte, as big-endian uint256, in wei.

func (ETH) Decimal

func (e ETH) Decimal() string

Decimal returns the amount, in wei, in decimal form.

func (ETH) Div

func (e ETH) Div(denominator uint64) (out ETH)

Div returns the quotient self/denominator. Div performs integer division and always rounds down. No value is mutated. If denominator == 0, this returns 0.

func (ETH) EtherString

func (e ETH) EtherString() string

EtherString returns the amount, string-ified, forced in ether units (excl. unit suffix)

func (ETH) Format

func (e ETH) Format(s fmt.State, ch rune)

Format implements fmt.Formatter

func (ETH) Gt

func (e ETH) Gt(v ETH) bool

Gt returns if this is greater than the given ETH value.

func (ETH) Hex

func (e ETH) Hex() string

Hex returns the amount, in wei, in hexadecimal form with 0x prefix.

func (ETH) IsZero

func (e ETH) IsZero() bool

IsZero returns if this equals 0.

func (ETH) Lt

func (e ETH) Lt(v ETH) bool

Lt returns if this is less than the given ETH value.

func (ETH) MarshalText

func (e ETH) MarshalText() ([]byte, error)

MarshalText marshals as decimal number, without comma separators or unit

func (ETH) Mul

func (e ETH) Mul(scalar uint64) (out ETH)

Mul multiplies by the given uint64 scalar, and returns the result. No value is mutated. Mul panics if the given computation overflows uin256.

func (ETH) MulOverflow

func (e ETH) MulOverflow(scalar uint64) (out ETH, overflow bool)

MulOverflow multiplies by the given scalar, and returns the result. No value is mutated. This also returns a boolean indicating if the result overflowed.

func (ETH) String

func (e ETH) String() string

String prints the amount of ETH, with thousands comma-separators, and unit. If the amount is perfectly divisible by 1 ether, the amount is printed in ethers. If the amount is perfectly divisible by 1 gwei, the amount is printed in gwei. If not neatly divisible, the amount is printed in wei. This String function is optimized for readability, without precision loss, to not hide any precision data during debugging.

func (ETH) Sub

func (e ETH) Sub(v ETH) (out ETH)

Sub subtracts v and returns the result. No value is mutated. Sub panics if the computation underflows.

func (ETH) SubUnderflow

func (e ETH) SubUnderflow(v ETH) (out ETH, underflow bool)

SubUnderflow subtracts v and returns the result. No value is mutated. This also returns a boolean indicating if the computation underflowed.

func (ETH) ToBig

func (e ETH) ToBig() *big.Int

ToBig converts to *big.Int, in wei.

func (ETH) ToU256

func (e ETH) ToU256() *uint256.Int

ToU256 converts to *uint256.Int, in wei. This returns a clone, not the underlying uint256.Int type.

func (*ETH) UnmarshalJSON

func (e *ETH) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler. UnmarshalJSON accepts either - Quoted string: either hexadecimal OR decimal - Not quoted string: only decimal

func (*ETH) UnmarshalText

func (e *ETH) UnmarshalText(data []byte) error

UnmarshalText supports hexadecimal (0x prefix) and decimal.

func (ETH) WeiFloat

func (e ETH) WeiFloat() float64

WeiFloat returns the amount as floating point number, in wei (approximate). Warning: precision loss. This may not present the exact number of wei.

type EcotoneScalars

type EcotoneScalars struct {
	BlobBaseFeeScalar uint32
	BaseFeeScalar     uint32
}

func DecodeScalar

func DecodeScalar(scalar [32]byte) (EcotoneScalars, error)

DecodeScalar decodes the blobBaseFeeScalar and baseFeeScalar from a 32-byte scalar value. It uses the first byte to determine the scalar format.

type EngineAPIMethod

type EngineAPIMethod string
const (
	FCUV1 EngineAPIMethod = "engine_forkchoiceUpdatedV1"
	FCUV2 EngineAPIMethod = "engine_forkchoiceUpdatedV2"
	FCUV3 EngineAPIMethod = "engine_forkchoiceUpdatedV3"

	NewPayloadV2 EngineAPIMethod = "engine_newPayloadV2"
	NewPayloadV3 EngineAPIMethod = "engine_newPayloadV3"
	NewPayloadV4 EngineAPIMethod = "engine_newPayloadV4"

	GetPayloadV2 EngineAPIMethod = "engine_getPayloadV2"
	GetPayloadV3 EngineAPIMethod = "engine_getPayloadV3"
	GetPayloadV4 EngineAPIMethod = "engine_getPayloadV4"
)

type ErrorCode

type ErrorCode int
const (
	MethodNotFound           ErrorCode = -32601 // RPC method not found or not available.
	InvalidParams            ErrorCode = -32602
	UnknownPayload           ErrorCode = -38001 // Payload does not exist / is not available.
	InvalidForkchoiceState   ErrorCode = -38002 // Forkchoice state is invalid / inconsistent.
	InvalidPayloadAttributes ErrorCode = -38003 // Payload attributes are invalid / inconsistent.
	TooLargeEngineRequest    ErrorCode = -38004 // Unused, here for completeness, only used by engine_getPayloadBodiesByHashV1
	UnsupportedFork          ErrorCode = -38005 // Unused, see issue #11130.
)

Engine error codes used to be -3200x, but were rebased to -3800x: https://github.com/ethereum/execution-apis/pull/214

func (ErrorCode) IsEngineError

func (c ErrorCode) IsEngineError() bool

func (ErrorCode) IsGenericRPCError

func (c ErrorCode) IsGenericRPCError() bool

type ExecutePayloadStatus

type ExecutePayloadStatus string
const (
	// given payload is valid
	ExecutionValid ExecutePayloadStatus = "VALID"
	// given payload is invalid
	ExecutionInvalid ExecutePayloadStatus = "INVALID"
	// sync process is in progress
	ExecutionSyncing ExecutePayloadStatus = "SYNCING"
	// returned if the payload is not fully validated, and does not extend the canonical chain,
	// but will be remembered for later (on reorgs or sync updates and such)
	ExecutionAccepted ExecutePayloadStatus = "ACCEPTED"
	// if the block-hash in the payload is not correct
	ExecutionInvalidBlockHash ExecutePayloadStatus = "INVALID_BLOCK_HASH"
	// proof-of-stake transition only, not used in rollup
	ExecutionInvalidTerminalBlock ExecutePayloadStatus = "INVALID_TERMINAL_BLOCK"
)

type ExecutionPayload

type ExecutionPayload struct {
	ParentHash    common.Hash     `json:"parentHash"`
	FeeRecipient  common.Address  `json:"feeRecipient"`
	StateRoot     Bytes32         `json:"stateRoot"`
	ReceiptsRoot  Bytes32         `json:"receiptsRoot"`
	LogsBloom     Bytes256        `json:"logsBloom"`
	PrevRandao    Bytes32         `json:"prevRandao"`
	BlockNumber   Uint64Quantity  `json:"blockNumber"`
	GasLimit      Uint64Quantity  `json:"gasLimit"`
	GasUsed       Uint64Quantity  `json:"gasUsed"`
	Timestamp     Uint64Quantity  `json:"timestamp"`
	ExtraData     BytesMax32      `json:"extraData"`
	BaseFeePerGas Uint256Quantity `json:"baseFeePerGas"`
	BlockHash     common.Hash     `json:"blockHash"`
	// Array of transaction objects, each object is a byte list (DATA) representing
	// TransactionType || TransactionPayload or LegacyTransaction as defined in EIP-2718
	Transactions []Data `json:"transactions"`
	// Nil if not present (Bedrock)
	Withdrawals *types.Withdrawals `json:"withdrawals,omitempty"`
	// Nil if not present (Bedrock, Canyon, Delta)
	BlobGasUsed *Uint64Quantity `json:"blobGasUsed,omitempty"`
	// Nil if not present (Bedrock, Canyon, Delta)
	ExcessBlobGas *Uint64Quantity `json:"excessBlobGas,omitempty"`
	// Nil if not present (Bedrock, Canyon, Delta, Ecotone, Fjord, Granite, Holocene)
	WithdrawalsRoot *common.Hash `json:"withdrawalsRoot,omitempty"`
}

func BlockAsPayload

func BlockAsPayload(bl *types.Block, config *params.ChainConfig) (*ExecutionPayload, error)

BlockAsPayload converts a *types.Block to an ExecutionPayload. It can only be used to convert OP-Stack blocks, as it follows Canyon and Isthmus rules to set the Withdrawals and WithdrawalsRoot fields.

func (*ExecutionPayload) BlockRef

func (payload *ExecutionPayload) BlockRef() BlockRef

func (*ExecutionPayload) CheckEqual

func (p *ExecutionPayload) CheckEqual(o *ExecutionPayload) error

func (*ExecutionPayload) ID

func (payload *ExecutionPayload) ID() BlockID

func (*ExecutionPayload) MarshalSSZ

func (payload *ExecutionPayload) MarshalSSZ(w io.Writer) (n int, err error)

MarshalSSZ encodes the ExecutionPayload as SSZ type

func (*ExecutionPayload) ParentID

func (payload *ExecutionPayload) ParentID() BlockID

func (*ExecutionPayload) SizeSSZ

func (payload *ExecutionPayload) SizeSSZ() (full uint32)

func (*ExecutionPayload) String

func (payload *ExecutionPayload) String() string

func (*ExecutionPayload) UnmarshalSSZ

func (payload *ExecutionPayload) UnmarshalSSZ(version BlockVersion, scope uint32, r io.Reader) error

UnmarshalSSZ decodes the ExecutionPayload as SSZ type

type ExecutionPayloadEnvelope

type ExecutionPayloadEnvelope struct {
	ParentBeaconBlockRoot *common.Hash      `json:"parentBeaconBlockRoot,omitempty"`
	ExecutionPayload      *ExecutionPayload `json:"executionPayload"`
}

func BlockAsPayloadEnv

func BlockAsPayloadEnv(bl *types.Block, config *params.ChainConfig) (*ExecutionPayloadEnvelope, error)

func (*ExecutionPayloadEnvelope) CheckBlockHash

func (envelope *ExecutionPayloadEnvelope) CheckBlockHash() (actual common.Hash, ok bool)

CheckBlockHash recomputes the block hash and returns if the embedded block hash matches.

func (*ExecutionPayloadEnvelope) ID

func (*ExecutionPayloadEnvelope) MarshalSSZ

func (envelope *ExecutionPayloadEnvelope) MarshalSSZ(w io.Writer) (n int, err error)

MarshalSSZ encodes the ExecutionPayload as SSZ type

func (*ExecutionPayloadEnvelope) String

func (env *ExecutionPayloadEnvelope) String() string

func (*ExecutionPayloadEnvelope) UnmarshalSSZ

func (envelope *ExecutionPayloadEnvelope) UnmarshalSSZ(version BlockVersion, scope uint32, r io.Reader) error

UnmarshalSSZ decodes the ExecutionPayloadEnvelope as SSZ type

type ExecutionWitness

type ExecutionWitness struct {
	Keys  []hexutil.Bytes `json:"keys"`
	Codes []hexutil.Bytes `json:"codes"`
	State []hexutil.Bytes `json:"state"`
}

type FCUState

type FCUState struct {
	Latest    uint64 `json:"latest"`
	Safe      uint64 `json:"safe"`
	Finalized uint64 `json:"finalized"`
}

FCUState represents the Fork Choice Update state with Latest, Safe, and Finalized block numbers

type ForkchoiceState

type ForkchoiceState struct {
	// block hash of the head of the canonical chain
	HeadBlockHash common.Hash `json:"headBlockHash"`
	// safe block hash in the canonical chain
	SafeBlockHash common.Hash `json:"safeBlockHash"`
	// block hash of the most recent finalized block
	FinalizedBlockHash common.Hash `json:"finalizedBlockHash"`
}

type ForkchoiceUpdatedResult

type ForkchoiceUpdatedResult struct {
	// the result of the payload execution
	PayloadStatus PayloadStatusV1 `json:"payloadStatus"`
	// the payload id if requested
	PayloadID *PayloadID `json:"payloadId"`
}

type HeadSignalFn

type HeadSignalFn func(ctx context.Context, sig L1BlockRef)

HeadSignalFn is used as callback function to accept head-signals

type IndexedBlobHash

type IndexedBlobHash struct {
	Index uint64      // absolute index in the block, a.k.a. position in sidecar blobs array
	Hash  common.Hash // hash of the blob, used for consistency checks
}

IndexedBlobHash represents a blob hash that commits to a single blob confirmed in a block. The index helps us avoid unnecessary blob to blob hash conversions to find the right content in a sidecar.

type InputError

type InputError struct {
	Inner error
	Code  ErrorCode
}

InputError can be used to create rpc.Error instances with a specific error code.

func (InputError) Error

func (ie InputError) Error() string

func (InputError) ErrorCode

func (ie InputError) ErrorCode() int

Makes InputError implement the rpc.Error interface

func (InputError) Is

func (ie InputError) Is(target error) bool

Is checks if the error is the given target type. Any type of InputError counts, regardless of code.

func (InputError) Unwrap

func (ie InputError) Unwrap() error

type L1BlockRef

type L1BlockRef struct {
	Hash       common.Hash `json:"hash"`
	Number     uint64      `json:"number"`
	ParentHash common.Hash `json:"parentHash"`
	Time       uint64      `json:"timestamp"`
}

func InfoToL1BlockRef

func InfoToL1BlockRef(info BlockInfo) L1BlockRef

func (L1BlockRef) ID

func (id L1BlockRef) ID() BlockID

func (L1BlockRef) ParentID

func (id L1BlockRef) ParentID() BlockID

func (L1BlockRef) String

func (id L1BlockRef) String() string

func (L1BlockRef) TerminalString

func (id L1BlockRef) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

type L1BlockRefsSource

type L1BlockRefsSource interface {
	L1BlockRefByLabel(ctx context.Context, label BlockLabel) (L1BlockRef, error)
}

type L1Client

type L1Client interface {
	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
	NonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)
}

type L2BlockRef

type L2BlockRef struct {
	Hash           common.Hash `json:"hash"`
	Number         uint64      `json:"number"`
	ParentHash     common.Hash `json:"parentHash"`
	Time           uint64      `json:"timestamp"`
	L1Origin       BlockID     `json:"l1origin"`
	SequenceNumber uint64      `json:"sequenceNumber"` // distance to first block of epoch
}

func (L2BlockRef) BlockRef

func (id L2BlockRef) BlockRef() BlockRef

func (L2BlockRef) ID

func (id L2BlockRef) ID() BlockID

func (L2BlockRef) ParentID

func (id L2BlockRef) ParentID() BlockID

func (L2BlockRef) String

func (id L2BlockRef) String() string

func (L2BlockRef) TerminalString

func (id L2BlockRef) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

type NewHeadSource

type NewHeadSource interface {
	SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)
}

type NumberAndHash

type NumberAndHash interface {
	Hash() common.Hash
	NumberU64() uint64
}

type OperatorFeeParams

type OperatorFeeParams struct {
	Scalar   uint32
	Constant uint64
}

func DecodeOperatorFeeParams

func DecodeOperatorFeeParams(scalar [32]byte) OperatorFeeParams

DecodeScalar decodes the operatorFeeScalar and operatorFeeConstant from a 32-byte scalar value. It uses the first byte to determine the scalar format.

type Output

type Output interface {
	// Version returns the version of the L2 output
	Version() Bytes32

	// Marshal a L2 output into a byte slice for hashing
	Marshal() []byte
}

func UnmarshalOutput

func UnmarshalOutput(data []byte) (Output, error)

type OutputResponse

type OutputResponse struct {
	Version               Bytes32     `json:"version"`
	OutputRoot            Bytes32     `json:"outputRoot"`
	BlockRef              L2BlockRef  `json:"blockRef"`
	WithdrawalStorageRoot common.Hash `json:"withdrawalStorageRoot"`
	StateRoot             common.Hash `json:"stateRoot"`
	Status                *SyncStatus `json:"syncStatus"`
}

type OutputV0

type OutputV0 struct {
	StateRoot                Bytes32     `json:"stateRoot"`
	MessagePasserStorageRoot Bytes32     `json:"messagePasserStorageRoot"`
	BlockHash                common.Hash `json:"blockHash"`
}

func (*OutputV0) Marshal

func (o *OutputV0) Marshal() []byte

func (*OutputV0) Version

func (o *OutputV0) Version() Bytes32

type OutputWithRequiredL1

type OutputWithRequiredL1 struct {
	Output     *OutputV0 `json:"output"`
	OutputRoot Bytes32   `json:"output_root"`
	RequiredL1 BlockID   `json:"required_l1"`
}

OutputWithRequiredL1 is the OutputV0 pre-image, its hash, and its source L1 block

type PayloadAttributes

type PayloadAttributes struct {
	// value for the timestamp field of the new payload
	Timestamp Uint64Quantity `json:"timestamp"`
	// value for the random field of the new payload
	PrevRandao Bytes32 `json:"prevRandao"`
	// suggested value for the coinbase field of the new payload
	SuggestedFeeRecipient common.Address `json:"suggestedFeeRecipient"`
	// Withdrawals to include into the block -- should be nil or empty depending on Shanghai enablement
	Withdrawals *types.Withdrawals `json:"withdrawals,omitempty"`
	// parentBeaconBlockRoot optional extension in Dencun
	ParentBeaconBlockRoot *common.Hash `json:"parentBeaconBlockRoot,omitempty"`

	// Transactions to force into the block (always at the start of the transactions list).
	Transactions []Data `json:"transactions,omitempty"`
	// NoTxPool to disable adding any transactions from the transaction-pool.
	NoTxPool bool `json:"noTxPool,omitempty"`
	// GasLimit override
	GasLimit *Uint64Quantity `json:"gasLimit,omitempty"`
	// EIP-1559 parameters, to be specified only post-Holocene
	EIP1559Params *Bytes8 `json:"eip1559Params,omitempty"`
	// MinBaseFee is the minimum base fee, to be specified only post-Jovian
	MinBaseFee *uint64 `json:"minBaseFee,omitempty"`
}

func (*PayloadAttributes) IsDepositsOnly

func (a *PayloadAttributes) IsDepositsOnly() bool

IsDepositsOnly returns whether all transactions of the PayloadAttributes are of Deposit type. Empty transactions are also considered non-Deposit transactions.

func (*PayloadAttributes) WithDepositsOnly

func (a *PayloadAttributes) WithDepositsOnly() *PayloadAttributes

WithDepositsOnly return a shallow clone with all non-Deposit transactions stripped from its transactions. The order is preserved.

type PayloadID

type PayloadID = engine.PayloadID

type PayloadInfo

type PayloadInfo struct {
	ID        PayloadID `json:"id"`
	Timestamp uint64    `json:"timestamp"`
}

type PayloadStatusV1

type PayloadStatusV1 struct {
	// the result of the payload execution
	Status ExecutePayloadStatus `json:"status"`
	// the hash of the most recent valid block in the branch defined by payload and its ancestors (optional field)
	LatestValidHash *common.Hash `json:"latestValidHash,omitempty"`
	// additional details on the result (optional field)
	ValidationError *string `json:"validationError,omitempty"`
}

type ReducedConfigData

type ReducedConfigData struct {
	SecondsPerSlot Uint64String `json:"SECONDS_PER_SLOT"`
}

type ReducedGenesisData

type ReducedGenesisData struct {
	GenesisTime Uint64String `json:"genesis_time"`
}

type SafeHeadResponse

type SafeHeadResponse struct {
	L1Block  BlockID `json:"l1Block"`
	SafeHead BlockID `json:"safeHead"`
}

type SignedBeaconBlockHeader

type SignedBeaconBlockHeader struct {
	Message   BeaconBlockHeader `json:"message"`
	Signature hexutil.Bytes     `json:"signature"`
}

type StorageKey

type StorageKey []byte

StorageKey is a marshaling utility for hex-encoded storage keys, which can have leading 0s and are an arbitrary length.

func (StorageKey) MarshalText

func (k StorageKey) MarshalText() ([]byte, error)

func (StorageKey) String

func (k StorageKey) String() string

func (*StorageKey) UnmarshalText

func (k *StorageKey) UnmarshalText(text []byte) error

type StorageProofEntry

type StorageProofEntry struct {
	Key   StorageKey      `json:"key"`
	Value hexutil.Big     `json:"value"`
	Proof []hexutil.Bytes `json:"proof"`
}

type Super

type Super interface {
	Version() byte
	Marshal() []byte
}

func UnmarshalSuperRoot

func UnmarshalSuperRoot(data []byte) (Super, error)

type SuperNodeSyncStatusResponse

type SuperNodeSyncStatusResponse struct {
	// Chains contains the per-chain op-node sync status.
	Chains map[ChainID]SyncStatus `json:"chains"`

	// ChainIDs are the chain IDs in the dependency set, sorted ascending.
	ChainIDs []ChainID `json:"chain_ids"`

	// CurrentL1 is the highest L1 block ID that has been fully derived and verified by all chains.
	// This value is derived from the minimum per-chain current L1 block IDs, including validators.
	CurrentL1 BlockID `json:"current_l1"`

	// SafeTimestamp is the highest L2 timestamp that is safe across the dependency set at the CurrentL1.
	// This value is derived from the minimum per-chain safe L2 head timestamp.
	SafeTimestamp uint64 `json:"safe_timestamp"`

	// LocalSafeTimestamp is the highest L2 timestamp that is local-safe across the dependency set at the CurrentL1.
	// This value is derived from the minimum per-chain local safe L2 head timestamp.
	LocalSafeTimestamp uint64 `json:"local_safe_timestamp"`

	// FinalizedTimestamp is the highest L2 timestamp that is finalized across the dependency set at the CurrentL1.
	// This value is derived from the minimum per-chain finalized L2 head timestamp.
	FinalizedTimestamp uint64 `json:"finalized_timestamp"`
}

SuperNodeSyncStatusResponse is the response returned by supernode_syncStatus.

type SuperRootAtTimestampResponse

type SuperRootAtTimestampResponse struct {
	// CurrentL1 is the highest L1 block that has been fully derived and verified by all chains.
	CurrentL1 BlockID `json:"current_l1"`

	// CurrentSafeTimestamp is the highest L2 timestamp that is safe across the dependency set at the CurrentL1.
	// This value is derived from the minimum per-chain safe L2 head timestamp.
	CurrentSafeTimestamp uint64 `json:"safe_timestamp"`

	// CurrentSafeTimestamp is the highest L2 timestamp that is safe across the dependency set at the CurrentL1.
	// This value is derived from the minimum per-chain local-safe L2 head timestamp.
	CurrentLocalSafeTimestamp uint64 `json:"local_safe_timestamp"`

	// CurrentFinalizedTimestamp is the highest L2 timestamp that is finalized across the dependency set at the CurrentL1.
	// This value is derived from the minimum per-chain finalized L2 head timestamp.
	CurrentFinalizedTimestamp uint64 `json:"finalized_timestamp"`

	// OptimisticAtTimestamp is the L2 block that would be applied if verification were assumed to be successful,
	// and the minimum L1 block required to derive them. If Data is nil, some chains may be absent from this map,
	// indicating that there is no optimistic block for the chain at the requested timestamp that can be derived
	// from the L1 data currently processed.
	OptimisticAtTimestamp map[ChainID]OutputWithRequiredL1 `json:"optimistic_at_timestamp"`

	// ChainIDs are the chain IDs in the dependency set at the requested timestamp, sorted ascending.
	ChainIDs []ChainID `json:"chain_ids"`

	// Data provides information about the super root at the requested timestamp if present. If block data at the
	// requested timestamp is not present, the data will be nil.
	Data *SuperRootResponseData `json:"data,omitempty"`
}

AtTimestampResponse is the response superroot_atTimestamp

type SuperRootResponse

type SuperRootResponse struct {
	CrossSafeDerivedFrom BlockID `json:"crossSafeDerivedFrom"`
	Timestamp            uint64  `json:"timestamp"`
	SuperRoot            Bytes32 `json:"superRoot"`
	Version              byte    `json:"version"`
	// Chains is the list of ChainRootInfo for each chain in the dependency set.
	// It represents the state of the chain at or before the Timestamp.
	Chains []ChainRootInfo `json:"chains"`
}

func (SuperRootResponse) MarshalJSON

func (r SuperRootResponse) MarshalJSON() ([]byte, error)

func (SuperRootResponse) ToSuper

func (s SuperRootResponse) ToSuper() (Super, error)

func (*SuperRootResponse) UnmarshalJSON

func (r *SuperRootResponse) UnmarshalJSON(input []byte) error

type SuperRootResponseData

type SuperRootResponseData struct {

	// VerifiedRequiredL1 is the minimum L1 block including the required data to fully verify all blocks at this timestamp
	VerifiedRequiredL1 BlockID `json:"verified_required_l1"`

	// Super is the unhashed data for the superroot at the given timestamp after all verification is applied.
	Super Super `json:"super"`

	// SuperRoot is the superroot at the given timestamp after all verification is applied.
	SuperRoot Bytes32 `json:"super_root"`
}

func (*SuperRootResponseData) UnmarshalJSON

func (d *SuperRootResponseData) UnmarshalJSON(input []byte) error

UnmarshalJSON implements custom JSON unmarshaling for SuperRootResponseData

type SuperV1

type SuperV1 struct {
	Timestamp uint64
	Chains    []ChainIDAndOutput
}

func NewSuperV1

func NewSuperV1(timestamp uint64, chains ...ChainIDAndOutput) *SuperV1

func (*SuperV1) Marshal

func (o *SuperV1) Marshal() []byte

func (*SuperV1) MarshalJSON

func (o *SuperV1) MarshalJSON() ([]byte, error)

func (*SuperV1) UnmarshalJSON

func (o *SuperV1) UnmarshalJSON(input []byte) error

func (*SuperV1) Version

func (o *SuperV1) Version() byte

type SupervisorChainSyncStatus

type SupervisorChainSyncStatus struct {
	// LocalUnsafe is the latest L2 block that has been processed by the supervisor.
	LocalUnsafe BlockRef `json:"localUnsafe"`
	LocalSafe   BlockID  `json:"localSafe"`
	CrossUnsafe BlockID  `json:"crossUnsafe"`
	// Some fault-proof releases may already depend on `safe`, so we keep JSON field name as `safe`.
	CrossSafe BlockID `json:"safe"`
	Finalized BlockID `json:"finalized"`
}

SupervisorChainSyncStatus is the status of a chain as seen by the supervisor.

type SupervisorSyncStatus

type SupervisorSyncStatus struct {
	// MinSyncedL1 is the highest L1 block that has been processed by all supervisor nodes.
	// This is not the same as the latest L1 block known to the supervisor,
	// but rather the L1 block view of the supervisor nodes.
	// This L1 block may not be fully derived into L2 data on all nodes yet.
	MinSyncedL1        L1BlockRef                             `json:"minSyncedL1"`
	SafeTimestamp      uint64                                 `json:"safeTimestamp"`
	FinalizedTimestamp uint64                                 `json:"finalizedTimestamp"`
	Chains             map[ChainID]*SupervisorChainSyncStatus `json:"chains"`
}

type SyncStatus

type SyncStatus struct {
	// CurrentL1 is the L1 block that the derivation process is last idled at.
	// This may not be fully derived into L2 data yet.
	// The safe L2 blocks were produced/included fully from the L1 chain up to _but excluding_ this L1 block.
	// If the node is synced, this matches the HeadL1, minus the verifier confirmation distance.
	CurrentL1 L1BlockRef `json:"current_l1"`
	// CurrentL1Finalized is a legacy sync-status attribute. This is deprecated.
	// A previous version of the L1 finalization-signal was updated only after the block was retrieved by number.
	// This attribute just matches FinalizedL1 now.
	CurrentL1Finalized L1BlockRef `json:"current_l1_finalized"`
	// HeadL1 is the perceived head of the L1 chain, no confirmation distance.
	// The head is not guaranteed to build on the other L1 sync status fields,
	// as the node may be in progress of resetting to adapt to a L1 reorg.
	HeadL1      L1BlockRef `json:"head_l1"`
	SafeL1      L1BlockRef `json:"safe_l1"`
	FinalizedL1 L1BlockRef `json:"finalized_l1"`
	// UnsafeL2 is the absolute tip of the L2 chain,
	// pointing to block data that has not been submitted to L1 yet.
	// The sequencer is building this, and verifiers may also be ahead of the
	// SafeL2 block if they sync blocks via p2p or other offchain sources.
	// This is considered to only be local-unsafe post-interop, see CrossUnsafe for cross-L2 guarantees.
	UnsafeL2 L2BlockRef `json:"unsafe_l2"`
	// SafeL2 points to the L2 block that was derived from the L1 chain.
	// This point may still reorg if the L1 chain reorgs.
	// This is considered to be cross-safe post-interop, see LocalSafe to ignore cross-L2 guarantees.
	SafeL2 L2BlockRef `json:"safe_l2"`
	// FinalizedL2 points to the L2 block that was derived fully from
	// finalized L1 information, thus irreversible.
	FinalizedL2 L2BlockRef `json:"finalized_l2"`
	// PendingSafeL2 points to the L2 block processed from the batch, but not consolidated to the safe block yet.
	PendingSafeL2 L2BlockRef `json:"pending_safe_l2"`
	// CrossUnsafeL2 is an unsafe L2 block, that has been verified to match cross-L2 dependencies.
	// Pre-interop every unsafe L2 block is also cross-unsafe.
	CrossUnsafeL2 L2BlockRef `json:"cross_unsafe_l2"`
	// LocalSafeL2 is an L2 block derived from L1, not yet verified to have valid cross-L2 dependencies.
	LocalSafeL2 L2BlockRef `json:"local_safe_l2"`
}

SyncStatus is a snapshot of the driver. Values may be zeroed if not yet initialized.

type SyncTesterSession

type SyncTesterSession struct {
	sync.Mutex

	SessionID string `json:"session_id"`

	// Non canonical view of the chain
	Validated uint64 `json:"validated"`
	// Canonical view of the chain
	CurrentState FCUState `json:"current_state"`
	// payloads
	Payloads map[PayloadID]*ExecutionPayloadEnvelope `json:"-"`

	ELSyncPolicy ELSyncPolicy `json:"-"`
	ELSyncActive bool         `json:"el_sync_active"`

	InitialState FCUState `json:"initial_state"`
}

func NewSyncTesterSession

func NewSyncTesterSession(sessionID string, latest, safe, finalized uint64, elSyncActive bool, elSyncState ELSyncPolicy) *SyncTesterSession

func (*SyncTesterSession) IsELSyncActive

func (s *SyncTesterSession) IsELSyncActive() bool

func (*SyncTesterSession) ResetSession

func (s *SyncTesterSession) ResetSession()

func (*SyncTesterSession) UpdateFCUFinalized

func (s *SyncTesterSession) UpdateFCUFinalized(finalized uint64)

func (*SyncTesterSession) UpdateFCULatest

func (s *SyncTesterSession) UpdateFCULatest(latest uint64)

func (*SyncTesterSession) UpdateFCUSafe

func (s *SyncTesterSession) UpdateFCUSafe(safe uint64)

type SystemConfig

type SystemConfig struct {
	// BatcherAddr identifies the batch-sender address used in batch-inbox data-transaction filtering.
	BatcherAddr common.Address `json:"batcherAddr"`
	// Overhead identifies the L1 fee overhead.
	// Pre-Ecotone this is passed as-is to the engine.
	// Post-Ecotone this is always zero, and not passed into the engine.
	Overhead Bytes32 `json:"overhead"`
	// Scalar identifies the L1 fee scalar
	// Pre-Ecotone this is passed as-is to the engine.
	// Post-Ecotone this encodes multiple pieces of scalar data.
	Scalar Bytes32 `json:"scalar"`
	// GasLimit identifies the L2 block gas limit
	GasLimit uint64 `json:"gasLimit"`
	// EIP1559Params contains the Holocene-encoded EIP-1559 parameters. This
	// value will be 0 if Holocene is not active, or if derivation has yet to
	// process any EIP_1559_PARAMS system config update events.
	EIP1559Params Bytes8 `json:"eip1559Params"`
	// OperatorFeeParams identifies the operator fee parameters.
	OperatorFeeParams Bytes32 `json:"operatorFeeParams"`
	// MinBaseFee identifies the minimum base fee.
	MinBaseFee uint64 `json:"minBaseFee"`
	// DAFootprintGasScalar identifies the DA footprint gas scalar.
	DAFootprintGasScalar uint16 `json:"daFootprintGasScalar"`

	// MarshalPreHolocene indicates whether or not this struct should be
	// marshaled in the pre-Holocene format. The pre-Holocene format does
	// not marshal the EIP1559Params field. The presence of this field in
	// pre-Holocene codebases causes the rollup config to be rejected.
	MarshalPreHolocene bool `json:"-"`
}

SystemConfig represents the rollup system configuration that carries over in every L2 block, and may be changed through L1 system config events. The initial SystemConfig at rollup genesis is embedded in the rollup configuration.

func (*SystemConfig) EcotoneScalars

func (sysCfg *SystemConfig) EcotoneScalars() (EcotoneScalars, error)

func (SystemConfig) MarshalJSON

func (sysCfg SystemConfig) MarshalJSON() ([]byte, error)

func (*SystemConfig) OperatorFee

func (sysCfg *SystemConfig) OperatorFee() OperatorFeeParams

type Uint64Quantity

type Uint64Quantity = hexutil.Uint64

type Uint64String

type Uint64String uint64

Uint64String is a decimal string representation of an uint64, for usage in the Beacon API JSON encoding

func (Uint64String) MarshalText

func (v Uint64String) MarshalText() (out []byte, err error)

func (*Uint64String) UnmarshalText

func (v *Uint64String) UnmarshalText(b []byte) error

type Uint256Quantity

type Uint256Quantity = hexutil.U256

type VersionInformation

type VersionInformation struct {
	Version string `json:"version"`
}

Jump to

Keyboard shortcuts

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