Documentation ¶
Index ¶
- Variables
- func NewAdminAPI(dr driverClient, m metrics.RPCMetricer, log log.Logger) *adminAPI
- func NewNodeAPI(config *rollup.Config, l2Client l2EthClient, dr driverClient, log log.Logger, ...) *nodeAPI
- type ActiveConfigPersistence
- type ConductorClient
- type Config
- type ConfigPersistence
- type DisabledConfigPersistence
- type HeartbeatConfig
- type L1BeaconEndpointConfig
- type L1BeaconEndpointSetup
- type L1EndpointConfig
- type L1EndpointSetup
- type L2EndpointConfig
- type L2EndpointSetup
- type MetricsConfig
- type OpNode
- func (n *OpNode) HTTPEndpoint() string
- func (n *OpNode) OnNewL1Finalized(ctx context.Context, sig eth.L1BlockRef)
- func (n *OpNode) OnNewL1Head(ctx context.Context, sig eth.L1BlockRef)
- func (n *OpNode) OnNewL1Safe(ctx context.Context, sig eth.L1BlockRef)
- func (n *OpNode) OnUnsafeL2Payload(ctx context.Context, from peer.ID, envelope *eth.ExecutionPayloadEnvelope) error
- func (n *OpNode) P2P() p2p.Node
- func (n *OpNode) PublishL2Payload(ctx context.Context, envelope *eth.ExecutionPayloadEnvelope) error
- func (n *OpNode) RequestL2Range(ctx context.Context, start, end eth.L2BlockRef) error
- func (n *OpNode) RuntimeConfig() ReadonlyRuntimeConfig
- func (n *OpNode) Start(ctx context.Context) error
- func (n *OpNode) Stop(ctx context.Context) error
- func (n *OpNode) Stopped() bool
- type PreparedL1Endpoint
- type PreparedL2Endpoints
- type RPCConfig
- type ReadonlyRuntimeConfig
- type RunningState
- type RuntimeCfgL1Source
- type RuntimeConfig
- type Tracer
Constants ¶
This section is empty.
Variables ¶
var ( // UnsafeBlockSignerAddressSystemConfigStorageSlot is the storage slot identifier of the unsafeBlockSigner // `address` storage value in the SystemConfig L1 contract. Computed as `keccak256("systemconfig.unsafeblocksigner")` UnsafeBlockSignerAddressSystemConfigStorageSlot = common.HexToHash("0x65a7ed542fb37fe237fdfbdd70b31598523fe5b32879e307bae27a0bd9581c08") // RequiredProtocolVersionStorageSlot is the storage slot that the required protocol version is stored at. // Computed as: `bytes32(uint256(keccak256("protocolversion.required")) - 1)` RequiredProtocolVersionStorageSlot = common.HexToHash("0x4aaefe95bd84fd3f32700cf3b7566bc944b73138e41958b5785826df2aecace0") // RecommendedProtocolVersionStorageSlot is the storage slot that the recommended protocol version is stored at. // Computed as: `bytes32(uint256(keccak256("protocolversion.recommended")) - 1)` RecommendedProtocolVersionStorageSlot = common.HexToHash("0xe314dfc40f0025322aacc0ba8ef420b62fb3b702cf01e0cdf3d829117ac2ff1a") )
var ErrAlreadyClosed = errors.New("node is already closed")
Functions ¶
func NewAdminAPI ¶
func NewAdminAPI(dr driverClient, m metrics.RPCMetricer, log log.Logger) *adminAPI
func NewNodeAPI ¶
Types ¶
type ActiveConfigPersistence ¶ added in v1.1.2
type ActiveConfigPersistence struct {
// contains filtered or unexported fields
}
func NewConfigPersistence ¶ added in v1.1.2
func NewConfigPersistence(file string) *ActiveConfigPersistence
func (*ActiveConfigPersistence) SequencerStarted ¶ added in v1.1.2
func (p *ActiveConfigPersistence) SequencerStarted() error
func (*ActiveConfigPersistence) SequencerState ¶ added in v1.1.2
func (p *ActiveConfigPersistence) SequencerState() (RunningState, error)
func (*ActiveConfigPersistence) SequencerStopped ¶ added in v1.1.2
func (p *ActiveConfigPersistence) SequencerStopped() error
type ConductorClient ¶ added in v1.5.0
type ConductorClient struct {
// contains filtered or unexported fields
}
ConductorClient is a client for the op-conductor RPC service.
func NewConductorClient ¶ added in v1.5.0
NewConductorClient returns a new conductor client for the op-conductor RPC service.
func (*ConductorClient) Close ¶ added in v1.5.0
func (c *ConductorClient) Close()
func (*ConductorClient) CommitUnsafePayload ¶ added in v1.5.0
func (c *ConductorClient) CommitUnsafePayload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope) error
CommitUnsafePayload commits an unsafe payload to the conductor log.
type Config ¶
type Config struct { L1 L1EndpointSetup L2 L2EndpointSetup Beacon L1BeaconEndpointSetup Driver driver.Config Rollup rollup.Config // P2PSigner will be used for signing off on published content // if the node is sequencing and if the p2p stack is enabled P2PSigner p2p.SignerSetup RPC RPCConfig P2P p2p.SetupP2P Metrics MetricsConfig Pprof oppprof.CLIConfig // Used to poll the L1 for new finalized or safe blocks L1EpochPollInterval time.Duration ConfigPersistence ConfigPersistence // RuntimeConfigReloadInterval defines the interval between runtime config reloads. // Disabled if <= 0. // Runtime config changes should be picked up from log-events, // but if log-events are not coming in (e.g. not syncing blocks) then the reload ensures the config stays accurate. RuntimeConfigReloadInterval time.Duration // Optional Tracer Tracer Heartbeat HeartbeatConfig Sync sync.Config // To halt when detecting the node does not support a signaled protocol version // change of the given severity (major/minor/patch). Disabled if empty. RollupHalt string // Cancel to request a premature shutdown of the node itself, e.g. when halting. This may be nil. Cancel context.CancelCauseFunc // [OPTIONAL] The reth DB path to read receipts from RethDBPath string // Conductor is used to determine this node is the leader sequencer. ConductorEnabled bool ConductorRpc string ConductorRpcTimeout time.Duration }
type ConfigPersistence ¶ added in v1.1.2
type ConfigPersistence interface { SequencerStarted() error SequencerStopped() error SequencerState() (RunningState, error) }
type DisabledConfigPersistence ¶ added in v1.1.2
type DisabledConfigPersistence struct { }
DisabledConfigPersistence provides an implementation of config persistence that does not persist anything and reports unset for all values
func (DisabledConfigPersistence) SequencerStarted ¶ added in v1.1.2
func (d DisabledConfigPersistence) SequencerStarted() error
func (DisabledConfigPersistence) SequencerState ¶ added in v1.1.2
func (d DisabledConfigPersistence) SequencerState() (RunningState, error)
func (DisabledConfigPersistence) SequencerStopped ¶ added in v1.1.2
func (d DisabledConfigPersistence) SequencerStopped() error
type HeartbeatConfig ¶
type L1BeaconEndpointConfig ¶ added in v1.5.0
type L1BeaconEndpointConfig struct { BeaconAddr string // Address of L1 User Beacon-API endpoint to use (beacon namespace required) BeaconCheckIgnore bool // When false, halt startup if the beacon version endpoint fails BeaconFetchAllSidecars bool // Whether to fetch all blob sidecars and filter locally }
func (*L1BeaconEndpointConfig) Check ¶ added in v1.5.0
func (cfg *L1BeaconEndpointConfig) Check() error
func (*L1BeaconEndpointConfig) ShouldFetchAllSidecars ¶ added in v1.5.0
func (cfg *L1BeaconEndpointConfig) ShouldFetchAllSidecars() bool
func (*L1BeaconEndpointConfig) ShouldIgnoreBeaconCheck ¶ added in v1.5.0
func (cfg *L1BeaconEndpointConfig) ShouldIgnoreBeaconCheck() bool
type L1BeaconEndpointSetup ¶ added in v1.5.0
type L1EndpointConfig ¶
type L1EndpointConfig struct { L1NodeAddr string // Address of L1 User JSON-RPC endpoint to use (eth namespace required) // L1TrustRPC: if we trust the L1 RPC we do not have to validate L1 response contents like headers // against block hashes, or cached transaction sender addresses. // Thus we can sync faster at the risk of the source RPC being wrong. L1TrustRPC bool // L1RPCKind identifies the RPC provider kind that serves the RPC, // to inform the optimal usage of the RPC for transaction receipts fetching. L1RPCKind sources.RPCProviderKind // RateLimit specifies a self-imposed rate-limit on L1 requests. 0 is no rate-limit. RateLimit float64 // BatchSize specifies the maximum batch-size, which also applies as L1 rate-limit burst amount (if set). BatchSize int // MaxConcurrency specifies the maximum number of concurrent requests to the L1 RPC. MaxConcurrency int // HttpPollInterval specifies the interval between polling for the latest L1 block, // when the RPC is detected to be an HTTP type. // It is recommended to use websockets or IPC for efficient following of the changing block. // Setting this to 0 disables polling. HttpPollInterval time.Duration }
func (*L1EndpointConfig) Check ¶
func (cfg *L1EndpointConfig) Check() error
type L1EndpointSetup ¶
type L1EndpointSetup interface { // Setup a RPC client to a L1 node to pull rollup input-data from. // The results of the RPC client may be trusted for faster processing, or strictly validated. // The kind of the RPC may be non-basic, to optimize RPC usage. Setup(ctx context.Context, log log.Logger, rollupCfg *rollup.Config) (cl client.RPC, rpcCfg *sources.L1ClientConfig, err error) Check() error }
type L2EndpointConfig ¶
type L2EndpointConfig struct { // L2EngineAddr is the address of the L2 Engine JSON-RPC endpoint to use. The engine and eth // namespaces must be enabled by the endpoint. L2EngineAddr string // JWT secrets for L2 Engine API authentication during HTTP or initial Websocket communication. // Any value for an IPC connection. L2EngineJWTSecret [32]byte }
func (*L2EndpointConfig) Check ¶
func (cfg *L2EndpointConfig) Check() error
type L2EndpointSetup ¶
type MetricsConfig ¶
func (MetricsConfig) Check ¶
func (m MetricsConfig) Check() error
type OpNode ¶
type OpNode struct {
// contains filtered or unexported fields
}
func New ¶
func New(ctx context.Context, cfg *Config, log log.Logger, snapshotLog log.Logger, appVersion string, m *metrics.Metrics) (*OpNode, error)
New creates a new OpNode instance. The provided ctx argument is for the span of initialization only; the node will immediately Stop(ctx) before finishing initialization if the context is canceled during initialization.
func (*OpNode) HTTPEndpoint ¶
func (*OpNode) OnNewL1Finalized ¶
func (n *OpNode) OnNewL1Finalized(ctx context.Context, sig eth.L1BlockRef)
func (*OpNode) OnNewL1Head ¶
func (n *OpNode) OnNewL1Head(ctx context.Context, sig eth.L1BlockRef)
func (*OpNode) OnNewL1Safe ¶
func (n *OpNode) OnNewL1Safe(ctx context.Context, sig eth.L1BlockRef)
func (*OpNode) OnUnsafeL2Payload ¶
func (*OpNode) PublishL2Payload ¶
func (*OpNode) RequestL2Range ¶
func (*OpNode) RuntimeConfig ¶ added in v1.1.6
func (n *OpNode) RuntimeConfig() ReadonlyRuntimeConfig
type PreparedL1Endpoint ¶
type PreparedL1Endpoint struct { Client client.RPC TrustRPC bool RPCProviderKind sources.RPCProviderKind }
PreparedL1Endpoint enables testing with an in-process pre-setup RPC connection to L1
func (*PreparedL1Endpoint) Check ¶
func (cfg *PreparedL1Endpoint) Check() error
type PreparedL2Endpoints ¶
PreparedL2Endpoints enables testing with in-process pre-setup RPC connections to L2 engines
func (*PreparedL2Endpoints) Check ¶
func (p *PreparedL2Endpoints) Check() error
type RPCConfig ¶
func (*RPCConfig) HttpEndpoint ¶
type ReadonlyRuntimeConfig ¶ added in v1.1.6
type ReadonlyRuntimeConfig interface { P2PSequencerAddress() common.Address RequiredProtocolVersion() params.ProtocolVersion RecommendedProtocolVersion() params.ProtocolVersion }
type RunningState ¶ added in v1.1.2
type RunningState int
const ( StateUnset RunningState = iota StateStarted StateStopped )
type RuntimeCfgL1Source ¶
type RuntimeConfig ¶
type RuntimeConfig struct {
// contains filtered or unexported fields
}
RuntimeConfig maintains runtime-configurable options. These options are loaded based on initial loading + updates for every subsequent L1 block. Only the *latest* values are maintained however, the runtime config has no concept of chain history, does not require any archive data, and may be out of sync with the rollup derivation process.
func NewRuntimeConfig ¶
func NewRuntimeConfig(log log.Logger, l1Client RuntimeCfgL1Source, rollupCfg *rollup.Config) *RuntimeConfig
func (*RuntimeConfig) Load ¶
func (r *RuntimeConfig) Load(ctx context.Context, l1Ref eth.L1BlockRef) error
Load resets the runtime configuration by fetching the latest config data from L1 at the given L1 block. Load is safe to call concurrently, but will lock the runtime configuration modifications only, and will thus not block other Load calls with possibly alternative L1 block views.
func (*RuntimeConfig) P2PSequencerAddress ¶
func (r *RuntimeConfig) P2PSequencerAddress() common.Address
func (*RuntimeConfig) RecommendedProtocolVersion ¶ added in v1.1.6
func (r *RuntimeConfig) RecommendedProtocolVersion() params.ProtocolVersion
func (*RuntimeConfig) RequiredProtocolVersion ¶ added in v1.1.6
func (r *RuntimeConfig) RequiredProtocolVersion() params.ProtocolVersion
type Tracer ¶
type Tracer interface { OnNewL1Head(ctx context.Context, sig eth.L1BlockRef) OnUnsafeL2Payload(ctx context.Context, from peer.ID, payload *eth.ExecutionPayloadEnvelope) OnPublishL2Payload(ctx context.Context, payload *eth.ExecutionPayloadEnvelope) }
Tracer configures the OpNode to share events