opdevnet

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

README

The secrets.go file is copied from the Optimism e2e tests here. Normally, we would import the definitions. Unfortunately, that would create a transitive dependency on the Optimism e2e tests' config package, which prints to stdout and messes with command line flags in an init function.

Documentation

Overview

Package opdevnet contains helpers to build and run an OP devnet, including the L1 but excluding the OP execution engine.

Index

Constants

This section is empty.

Variables

View Source
var DefaultMnemonicConfig = &MnemonicConfig{
	Mnemonic:     "test test test test test test test test test test test junk",
	CliqueSigner: "m/44'/60'/0'/0/0",
	Proposer:     "m/44'/60'/0'/0/1",
	Batcher:      "m/44'/60'/0'/0/2",
	Deployer:     "m/44'/60'/0'/0/3",
	Alice:        "m/44'/60'/0'/0/4",
	SequencerP2P: "m/44'/60'/0'/0/5",
	Bob:          "m/44'/60'/0'/0/7",
	Mallory:      "m/44'/60'/0'/0/8",
	SysCfgOwner:  "m/44'/60'/0'/0/9",
}

DefaultMnemonicConfig is the default mnemonic used in testing. We prefer a mnemonic rather than direct private keys to make it easier to export all testing keys in external tooling for use during debugging. If these values are changed, it is subject to breaking tests. They must be in sync with the values in the DeployConfig used to create the system.

Functions

func DefaultDeployConfig

func DefaultDeployConfig(l1Deployments *genesis.L1Deployments) (*genesis.DeployConfig, error)

func DefaultL1Allocs

func DefaultL1Allocs() (*foundry.ForgeAllocs, error)

func DefaultL1Deployments

func DefaultL1Deployments() (*genesis.L1Deployments, error)

func DefaultL2Allocs

func DefaultL2Allocs() (*foundry.ForgeAllocs, error)

func EncodePrivKey

func EncodePrivKey(priv *ecdsa.PrivateKey) hexutil.Bytes

EncodePrivKey encodes the given private key in 32 bytes

func EncodePrivKeyToString

func EncodePrivKeyToString(priv *ecdsa.PrivateKey) string

Types

type Addresses

type Addresses struct {
	Deployer     common.Address
	CliqueSigner common.Address
	SysCfgOwner  common.Address

	// rollup actors
	Proposer     common.Address
	Batcher      common.Address
	SequencerP2P common.Address

	// prefunded L1/L2 accounts for testing
	Alice   common.Address
	Bob     common.Address
	Mallory common.Address
}

Addresses bundles the addresses for all common rollup addresses for testing purposes.

func (*Addresses) All

func (a *Addresses) All() []common.Address

type L1Config

type L1Config struct {
	Genesis      *core.Genesis
	BlobsDirPath string
	BlockTime    uint64
	URL          *e2eurl.URL
	BeaconURL    *e2eurl.URL
}

func BuildL1Config

func BuildL1Config(
	deployConfig *genesis.DeployConfig,
	l1Deployments *genesis.L1Deployments,
	l1Allocs *foundry.ForgeAllocs,
	url *e2eurl.URL,
	beaconURL *e2eurl.URL,
	blobsDirPath string,
) (*L1Config, error)

func (*L1Config) Run

func (cfg *L1Config) Run(ctx context.Context, env *environment.Env, logger log.Logger) error

type MnemonicConfig

type MnemonicConfig struct {
	Mnemonic string

	CliqueSigner string
	Deployer     string
	SysCfgOwner  string

	// rollup actors
	Proposer     string
	Batcher      string
	SequencerP2P string

	// prefunded L1/L2 accounts for testing
	Alice   string
	Bob     string
	Mallory string
}

MnemonicConfig configures the private keys for the hive testnet. It's json-serializable, so we can ship it to e.g. the hardhat script client.

func (*MnemonicConfig) Secrets

func (m *MnemonicConfig) Secrets() (*Secrets, error)

Secrets computes the private keys for all mnemonic paths, which can then be kept around for fast precomputed private key access.

type OPConfig

type OPConfig struct {
	Proposer *proposer.CLIConfig
	Batcher  *batcher.CLIConfig
	Node     *opnode.Config
}

func BuildOPConfig

func BuildOPConfig(
	deployConfig *opgenesis.DeployConfig,
	batcherPrivKey *ecdsa.PrivateKey,
	proposerPrivKey *ecdsa.PrivateKey,
	l1Header *types.Header,
	l2OutputOracleAddr common.Address,
	l2Genesis eth.BlockID,
	l1URL *e2eurl.URL,
	opNodeURL *e2eurl.URL,
	l2EngineURL *e2eurl.URL,
	l2EthURL *e2eurl.URL,
	beaconURL *e2eurl.URL,
	jwtSecret [32]byte,
) (*OPConfig, error)

func (*OPConfig) Run

func (cfg *OPConfig) Run(ctx context.Context, env *environment.Env, logger log.Logger) error

Run may block until it can establish a connection with the Engine, L1, and DA layer. Otherwise, it is non-blocking.

type Secrets

type Secrets struct {
	Deployer     *ecdsa.PrivateKey
	CliqueSigner *ecdsa.PrivateKey
	SysCfgOwner  *ecdsa.PrivateKey

	// rollup actors
	Proposer     *ecdsa.PrivateKey
	Batcher      *ecdsa.PrivateKey
	SequencerP2P *ecdsa.PrivateKey

	// prefunded L1/L2 accounts for testing
	Alice   *ecdsa.PrivateKey
	Bob     *ecdsa.PrivateKey
	Mallory *ecdsa.PrivateKey

	// Share the wallet to be able to generate more accounts
	Wallet *hdwallet.Wallet
}

Secrets bundles secp256k1 private keys for all common rollup actors for testing purposes.

func (*Secrets) Addresses

func (s *Secrets) Addresses() *Addresses

Addresses computes the ethereum address of each account, which can then be kept around for fast precomputed address access.

Jump to

Keyboard shortcuts

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