util

package
v0.0.0-...-23d24bf Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AddressesFlags = []cli.Flag{
	&cli.StringFlag{
		Name:    "address-manager-address",
		Usage:   "AddressManager address",
		EnvVars: []string{"ADDRESS_MANAGER_ADDRESS"},
	},
	&cli.StringFlag{
		Name:    "patex-portal-address",
		Usage:   "PatexPortal address",
		EnvVars: []string{"PATEX_PORTAL_ADDRESS"},
	},
	&cli.StringFlag{
		Name:    "l1-standard-bridge-address",
		Usage:   "L1StandardBridge address",
		EnvVars: []string{"L1_STANDARD_BRIDGE_ADDRESS"},
	},
	&cli.StringFlag{
		Name:    "l1-crossdomain-messenger-address",
		Usage:   "L1CrossDomainMessenger address",
		EnvVars: []string{"L1_CROSSDOMAIN_MESSENGER_ADDRESS"},
	},
	&cli.StringFlag{
		Name:    "canonical-transaction-chain-address",
		Usage:   "CanonicalTransactionChain address",
		EnvVars: []string{"CANONICAL_TRANSACTION_CHAIN_ADDRESS"},
	},
	&cli.StringFlag{
		Name:    "state-commitment-chain-address",
		Usage:   "StateCommitmentChain address",
		EnvVars: []string{"STATE_COMMITMENT_CHAIN_ADDRESS"},
	},
}

AddressesFlags represent the flags associated with address parsing.

View Source
var ClientsFlags = []cli.Flag{
	&cli.StringFlag{
		Name:     "l1-rpc-url",
		Required: true,
		Usage:    "L1 RPC URL",
		EnvVars:  []string{"L1_RPC_URL"},
	},
	&cli.StringFlag{
		Name:     "l2-rpc-url",
		Required: true,
		Usage:    "L2 RPC URL",
		EnvVars:  []string{"L2_RPC_URL"},
	},
}

ClientsFlags represent the flags associated with creating RPC clients.

Functions

func IterateState

func IterateState(dbFactory DBFactory, address common.Address, cb StateCallback, workers int) error

func PartitionKeyspace

func PartitionKeyspace(i int, count int) (common.Hash, common.Hash)

PartitionKeyspace divides the key space into partitions by dividing the maximum keyspace by count then multiplying by i. This will leave some slots left over, which we handle below. It returns the start and end keys for the partition as a common.Hash. Note that the returned range of keys is inclusive, i.e., [start, end] NOT [start, end).

func ProgressLogger

func ProgressLogger(n int, msg string) func(...any)

Types

type Addresses

type Addresses struct {
	AddressManager            common.Address
	PatexPortal               common.Address
	L1StandardBridge          common.Address
	L1CrossDomainMessenger    common.Address
	CanonicalTransactionChain common.Address
	StateCommitmentChain      common.Address
}

Addresses represents the address values of various contracts. The values can be easily populated via a cli.Context.

func NewAddresses

func NewAddresses(ctx *cli.Context) (*Addresses, error)

NewAddresses populates an Addresses struct given a cli.Context. This is useful for writing scripts that interact with smart contracts.

type Clients

type Clients struct {
	L1Client     *ethclient.Client
	L2Client     *ethclient.Client
	L1RpcClient  *rpc.Client
	L2RpcClient  *rpc.Client
	L1GethClient *gethclient.Client
	L2GethClient *gethclient.Client
}

clients represents a set of initialized RPC clients

func NewClients

func NewClients(ctx *cli.Context) (*Clients, error)

NewClients will create new RPC clients from a CLI context

type DBFactory

type DBFactory func() (*state.StateDB, error)

type StateCallback

type StateCallback func(db *state.StateDB, key, value common.Hash) error

Jump to

Keyboard shortcuts

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