opnode

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT, MIT Imports: 23 Imported by: 7

README

Table of Contents generated with DocToc

op-node

This is the reference implementation of the rollup-node spec. It can be thought of like the consensus layer client of an OP Stack chain where it must run with an OP Stack execution layer client like op-geth.

Compiling

Compile a binary:

make op-node

Testing

Run op-node unit tests:

make test

Running

Configuration options can be reviewed with:

./bin/op-node --help

To start syncing the rollup:

Connect to one L1 Execution Client that supports the Ethereum JSON-RPC spec, an L1 Consensus Client that supports the Beacon Node API and an OP Stack based Execution Client that supports the Ethereum JSON-RPC spec:

  • L1: use any L1 client, RPC, websocket, or IPC (connection config may differ)
  • L2: use any OP Stack Execution Client like op-geth

Note that websockets or IPC is preferred for event notifications to improve sync, http RPC works with adaptive polling.

./bin/op-node \
  --l1=ws://localhost:8546 \
  --l1.beacon=http://localhost:4000 \
  --l2=ws://localhost:9001 \
  --rollup.config=./path-to-network-config/rollup.json \
  --rpc.addr=127.0.0.1 \
  --rpc.port=7000

L2 Genesis Generation

The op-node can generate geth compatible genesis.json files. These files can be used with geth init to initialize the StateDB with accounts, storage, code and balances. The L2 state must be initialized with predeploy contracts that exist in the state and act as system level contracts. The op-node can generate a genesis file with these predeploys configured correctly given an L1 RPC URL, a deploy config, L2 genesis allocs and a L1 deployments artifact.

The deploy config contains all of the config required to deploy the system. Examples can be found in packages/contracts-bedrock/deploy-config. Each deploy config file is a JSON file. The L2 allocs can be generated using a forge script in the contracts-bedrock package and the L1 deployments are a JSON file that is the output of doing a L1 contracts deployment.

Example usage:

$ ./bin/op-node genesis l2 \
  --l1-rpc $ETH_RPC_URL \
  --deploy-config <PATH_TO_MY_DEPLOY_CONFIG> \
  --l2-allocs <PATH_TO_L2_ALLOCS> \
  --l1-deployments <PATH_TO_L1_DEPLOY_ARTIFACT> \
  --outfile.l2 <PATH_TO_WRITE_L2_GENESIS> \
  --outfile.rollup <PATH_TO_WRITE_OP_NODE_CONFIG>

L1 Devnet Genesis Generation

It is also possible to generate a devnet L1 genesis.json file. The L1 allocs can be generated with the foundry L1 contracts deployment script if the extra parameter --sig 'runWithStateDump() is added to the deployment command.

$ ./bin/op-node genesis l1 \
   --deploy-config $CONTRACTS_BEDROCK/deploy-config \
   --l1-deployments <PATH_TO_L1_DEPLOY_ARTIFACT> \
   --l1-allocs <PATH_TO_L1_ALLOCS>

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBeaconEndpointConfig added in v1.5.0

func NewBeaconEndpointConfig(ctx *cli.Context) node.L1BeaconEndpointSetup

func NewConfig

func NewConfig(ctx *cli.Context, log log.Logger) (*node.Config, error)

NewConfig creates a Config from the provided flags or environment variables.

func NewConfigPersistence added in v1.1.2

func NewConfigPersistence(ctx *cli.Context) node.ConfigPersistence

func NewDriverConfig

func NewDriverConfig(ctx *cli.Context) *driver.Config

func NewL1EndpointConfig

func NewL1EndpointConfig(ctx *cli.Context) *node.L1EndpointConfig

func NewL2EndpointConfig

func NewL2EndpointConfig(ctx *cli.Context, log log.Logger) (*node.L2EndpointConfig, error)

func NewRollupConfig

func NewRollupConfig(log log.Logger, network string, rollupConfigPath string) (*rollup.Config, error)

func NewRollupConfigFromCLI added in v1.7.0

func NewRollupConfigFromCLI(log log.Logger, ctx *cli.Context) (*rollup.Config, error)

func NewSupervisorEndpointConfig added in v1.9.3

func NewSupervisorEndpointConfig(ctx *cli.Context) node.SupervisorEndpointSetup

func NewSyncConfig added in v1.1.4

func NewSyncConfig(ctx *cli.Context, log log.Logger) (*sync.Config, error)

Types

This section is empty.

Directories

Path Synopsis
cmd
p2p
Package metrics provides a set of metrics for the op-node.
Package metrics provides a set of metrics for the op-node.
p2p
cli
derive
Package derive provides the data transformation functions that take L1 data and turn it into L2 blocks and results.
Package derive provides the data transformation functions that take L1 data and turn it into L2 blocks and results.
sync
Package sync is responsible for reconciling L1 and L2.
Package sync is responsible for reconciling L1 and L2.

Jump to

Keyboard shortcuts

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