genesis

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: MIT Imports: 29 Imported by: 14

Documentation

Index

Constants

View Source
const (
	// MaxResourceLimit represents the maximum amount of L2 gas that a single deposit can use.
	MaxResourceLimit = 20_000_000
	// ElasticityMultiplier represents the elasticity of the deposit EIP-1559 fee market.
	ElasticityMultiplier = 10
	// BaseFeeMaxChangeDenominator represents the maximum change in base fee per block.
	BaseFeeMaxChangeDenominator = 8
	// MinimumBaseFee represents the minimum base fee for deposits.
	MinimumBaseFee = params.GWei
	// SystemTxMaxGas represents the maximum gas that a system transaction can use
	// when it is included with user deposits.
	SystemTxMaxGas = 1_000_000
)
View Source
const PrecompileCount = 256

PrecompileCount represents the number of precompile addresses starting from `address(0)` to PrecompileCount that are funded with a single wei in the genesis state.

Variables

View Source
var (
	ErrInvalidDeployConfig     = errors.New("invalid deploy config")
	ErrInvalidImmutablesConfig = errors.New("invalid immutables config")
	// MaximumBaseFee represents the max base fee for deposits, since
	// there is an on chain EIP-1559 curve for deposits purchasing L2 gas.
	// It is type(uint128).max in solidity.
	MaximumBaseFee, _ = new(big.Int).SetString("ffffffffffffffffffffffffffffffff", 16)
)
View Source
var (
	// ImplementationSlot represents the EIP 1967 implementation storage slot
	ImplementationSlot = common.HexToHash("0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc")
	// AdminSlot represents the EIP 1967 admin storage slot
	AdminSlot = common.HexToHash("0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103")
)
View Source
var BedrockTransitionBlockExtraData = []byte("BEDROCK")

BedrockTransitionBlockExtraData represents the default extra data for the bedrock transition block.

View Source
var DevAccounts = []common.Address{
	common.HexToAddress("0x14dC79964da2C08b23698B3D3cc7Ca32193d9955"),
	common.HexToAddress("0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65"),
	common.HexToAddress("0x1CBd3b2770909D4e10f157cABC84C7264073C9Ec"),
	common.HexToAddress("0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f"),
	common.HexToAddress("0x2546BcD3c84621e976D8185a91A922aE77ECEc30"),
	common.HexToAddress("0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"),
	common.HexToAddress("0x70997970C51812dc3A010C7d01b50e0d17dc79C8"),
	common.HexToAddress("0x71bE63f3384f5fb98995898A86B02Fb2426c5788"),
	common.HexToAddress("0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199"),
	common.HexToAddress("0x90F79bf6EB2c4f870365E785982E1f101E93b906"),
	common.HexToAddress("0x976EA74026E726554dB657fA54763abd0C3a0aa9"),
	common.HexToAddress("0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc"),
	common.HexToAddress("0xBcd4042DE499D14e55001CcbB24a551F3b954096"),
	common.HexToAddress("0xFABB0ac9d68B0B445fB7357272Ff202C5651694a"),
	common.HexToAddress("0xa0Ee7A142d267C1f36714E4a8F75612F20a79720"),
	common.HexToAddress("0xbDA5747bFD65F08deb54cb465eB87D40e51B197E"),
	common.HexToAddress("0xcd3B766CCDd6AE721141F452C550Ca635964ce71"),
	common.HexToAddress("0xdD2FD4581271e230360230F9337D5c0430Bf44C0"),
	common.HexToAddress("0xdF3e18d64BC6A983f673Ab319CCaE4f1a57C7097"),
	common.HexToAddress("0xDe3829A23DF1479438622a08a116E8Eb3f620BB5"),
	common.HexToAddress("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"),

	common.HexToAddress("0x71562b71999873DB5b286dF957af199Ec94617F7"),

	common.HexToAddress("0x3fab184622dc19b6109349b94811493bf2a45362"),
}

DevAccounts represent the standard hardhat development accounts. These are funded if the deploy config has funding development accounts enabled.

Functions

func BuildL1DeveloperGenesis

func BuildL1DeveloperGenesis(config *DeployConfig, dump *foundry.ForgeAllocs, l1Deployments *L1Deployments) (*core.Genesis, error)

BuildL1DeveloperGenesis will create a L1 genesis block after creating all of the state required for an Optimism network to function. It is expected that the dump contains all of the required state to bootstrap the L1 chain.

func BuildL2Genesis added in v1.1.2

func BuildL2Genesis(config *DeployConfig, dump *foundry.ForgeAllocs, l1StartBlock *types.Block) (*core.Genesis, error)

BuildL2Genesis will build the L2 genesis block.

func FundDevAccounts

func FundDevAccounts(gen *core.Genesis)

FundDevAccounts will fund each of the development accounts.

func GetBlockFromTag

func GetBlockFromTag(chain ethereum.ChainReader, tag *rpc.BlockNumberOrHash) (*types.Block, error)

GetBlockFromTag will resolve a Block given an rpc block tag

func HasAnyDevAccounts added in v1.7.4

func HasAnyDevAccounts(allocs types.GenesisAlloc) (bool, error)

func NewL1Genesis

func NewL1Genesis(config *DeployConfig) (*core.Genesis, error)

NewL1Genesis will create a new L1 genesis config

func NewL2Genesis

func NewL2Genesis(config *DeployConfig, block *types.Block) (*core.Genesis, error)

NewL2Genesis will create a new L2 genesis

func SetPrecompileBalances

func SetPrecompileBalances(gen *core.Genesis)

SetPrecompileBalances will set a single wei at each precompile address. This is an optimization to make calling them cheaper.

Types

type AllocsLoader added in v1.7.4

type AllocsLoader func(mode L2AllocsMode) *foundry.ForgeAllocs

type ConfigChecker added in v1.9.0

type ConfigChecker interface {
	// Check verifies the contents of a config are correct.
	// Check may log warnings for non-critical configuration remarks.
	Check(log log.Logger) error
}

type DependencyContext added in v1.9.0

type DependencyContext struct {
	UsePlasma        bool
	DACommitmentType string
}

DependencyContext is the contextual configuration needed to verify the L1 dependencies, used by DeployConfig.CheckAddresses.

type DeployConfig

type DeployConfig struct {
	// Pre-L1-deployment L2 configs
	L2InitializationConfig

	// Development purposes only
	DevL1DeployConfig

	// L1StartingBlockTag anchors the L2 at an L1 block.
	// The timestamp of the block referenced by l1StartingBlockTag is used
	// in the L2 genesis block, rollup-config, and L1 output-oracle contract.
	// The Output oracle deploy script may use it if the L2 starting timestamp is nil, assuming the L2 genesis is set up with this.
	// The L2 genesis timestamp does not affect the initial L2 account state:
	// the storage of the L1Block contract at genesis is zeroed, since the adoption of
	// the L2-genesis allocs-generation through solidity script.
	L1StartingBlockTag *MarshalableRPCBlockNumberOrHash `json:"l1StartingBlockTag"`

	// L1 contracts configuration.
	// The deployer of the contracts chooses which sub-systems to deploy.
	SuperchainL1DeployConfig
	OutputOracleDeployConfig
	FaultProofDeployConfig

	// Post-L1-deployment L2 configs
	L1DependenciesConfig

	// Legacy, ignored, here for strict-JSON decoding to be accepted.
	LegacyDeployConfig
}

DeployConfig represents the deployment configuration for an OP Stack chain. It is used to deploy the L1 contracts as well as create the L2 genesis state.

func NewDeployConfig

func NewDeployConfig(path string) (*DeployConfig, error)

NewDeployConfig reads a config file given a path on the filesystem.

func NewDeployConfigWithNetwork

func NewDeployConfigWithNetwork(network, path string) (*DeployConfig, error)

NewDeployConfigWithNetwork takes a path to a deploy config directory and the network name. The config file in the deploy config directory must match the network name and be a JSON file.

func (*DeployConfig) Check

func (d *DeployConfig) Check(log log.Logger) error

Check will ensure that the config is sane and return an error when it is not

func (*DeployConfig) CheckAddresses added in v1.1.6

func (d *DeployConfig) CheckAddresses() error

CheckAddresses will return an error if the addresses are not set. These values are required to create the L2 genesis state and are present in the deploy config even though the deploy config is required to deploy the contracts on L1. This creates a circular dependency that should be resolved in the future.

func (*DeployConfig) Copy added in v1.1.4

func (d *DeployConfig) Copy() *DeployConfig

Copy will deeply copy the DeployConfig. This does a JSON roundtrip to copy which makes it easier to maintain, we do not need efficiency in this case.

func (*DeployConfig) RollupConfig

func (d *DeployConfig) RollupConfig(l1StartBlock *types.Block, l2GenesisBlockHash common.Hash, l2GenesisBlockNumber uint64) (*rollup.Config, error)

RollupConfig converts a DeployConfig to a rollup.Config. If Ecotone is active at genesis, the Overhead value is considered a noop.

func (*DeployConfig) SetDeployments added in v1.1.4

func (d *DeployConfig) SetDeployments(deployments *L1Deployments)

SetDeployments will merge a Deployments into a DeployConfig.

type DevDeployConfig added in v1.9.0

type DevDeployConfig struct {
	// FundDevAccounts configures whether to fund the dev accounts.
	// This should only be used during devnet deployments.
	FundDevAccounts bool `json:"fundDevAccounts"`
}

type DevL1DeployConfig added in v1.9.0

type DevL1DeployConfig struct {
	L1BlockTime                 uint64          `json:"l1BlockTime"`
	L1GenesisBlockTimestamp     hexutil.Uint64  `json:"l1GenesisBlockTimestamp"`
	L1GenesisBlockNonce         hexutil.Uint64  `json:"l1GenesisBlockNonce"`
	L1GenesisBlockGasLimit      hexutil.Uint64  `json:"l1GenesisBlockGasLimit"`
	L1GenesisBlockDifficulty    *hexutil.Big    `json:"l1GenesisBlockDifficulty"`
	L1GenesisBlockMixHash       common.Hash     `json:"l1GenesisBlockMixHash"`
	L1GenesisBlockCoinbase      common.Address  `json:"l1GenesisBlockCoinbase"`
	L1GenesisBlockNumber        hexutil.Uint64  `json:"l1GenesisBlockNumber"`
	L1GenesisBlockGasUsed       hexutil.Uint64  `json:"l1GenesisBlockGasUsed"`
	L1GenesisBlockParentHash    common.Hash     `json:"l1GenesisBlockParentHash"`
	L1GenesisBlockBaseFeePerGas *hexutil.Big    `json:"l1GenesisBlockBaseFeePerGas"`
	L1GenesisBlockExcessBlobGas *hexutil.Uint64 `json:"l1GenesisBlockExcessBlobGas,omitempty"` // EIP-4844
	L1GenesisBlockBlobGasUsed   *hexutil.Uint64 `json:"l1GenesisBlockblobGasUsed,omitempty"`   // EIP-4844
}

DevL1DeployConfig is used to configure a L1 chain for development/testing purposes. A production L2 deployment does not utilize this configuration, except of a L1BlockTime sanity-check (set this to 12 for L1 Ethereum).

type EIP1559DeployConfig added in v1.9.0

type EIP1559DeployConfig struct {
	// EIP1559Elasticity is the elasticity of the EIP1559 fee market.
	EIP1559Elasticity uint64 `json:"eip1559Elasticity"`
	// EIP1559Denominator is the denominator of EIP1559 base fee market.
	EIP1559Denominator uint64 `json:"eip1559Denominator"`
	// EIP1559DenominatorCanyon is the denominator of EIP1559 base fee market when Canyon is active.
	EIP1559DenominatorCanyon uint64 `json:"eip1559DenominatorCanyon"`
}

EIP1559DeployConfig configures the EIP-1559 parameters of the chain.

func (*EIP1559DeployConfig) Check added in v1.9.0

func (d *EIP1559DeployConfig) Check(log log.Logger) error

type FaultProofDeployConfig added in v1.9.0

type FaultProofDeployConfig struct {
	// UseFaultProofs is a flag that indicates if the system is using fault
	// proofs instead of the older output oracle mechanism.
	UseFaultProofs bool `json:"useFaultProofs"`
	// FaultGameAbsolutePrestate is the absolute prestate of Cannon. This is computed
	// by generating a proof from the 0th -> 1st instruction and grabbing the prestate from
	// the output JSON. All honest challengers should agree on the setup state of the program.
	FaultGameAbsolutePrestate common.Hash `json:"faultGameAbsolutePrestate"`
	// FaultGameMaxDepth is the maximum depth of the position tree within the fault dispute game.
	// `2^{FaultGameMaxDepth}` is how many instructions the execution trace bisection game
	// supports. Ideally, this should be conservatively set so that there is always enough
	// room for a full Cannon trace.
	FaultGameMaxDepth uint64 `json:"faultGameMaxDepth"`
	// FaultGameClockExtension is the amount of time that the dispute game will set the potential grandchild claim's,
	// clock to, if the remaining time is less than this value at the time of a claim's creation.
	FaultGameClockExtension uint64 `json:"faultGameClockExtension"`
	// FaultGameMaxClockDuration is the maximum amount of time that may accumulate on a team's chess clock before they
	// may no longer respond.
	FaultGameMaxClockDuration uint64 `json:"faultGameMaxClockDuration"`
	// FaultGameGenesisBlock is the block number for genesis.
	FaultGameGenesisBlock uint64 `json:"faultGameGenesisBlock"`
	// FaultGameGenesisOutputRoot is the output root for the genesis block.
	FaultGameGenesisOutputRoot common.Hash `json:"faultGameGenesisOutputRoot"`
	// FaultGameSplitDepth is the depth at which the fault dispute game splits from output roots to execution trace claims.
	FaultGameSplitDepth uint64 `json:"faultGameSplitDepth"`
	// FaultGameWithdrawalDelay is the number of seconds that users must wait before withdrawing ETH from a fault game.
	FaultGameWithdrawalDelay uint64 `json:"faultGameWithdrawalDelay"`
	// PreimageOracleMinProposalSize is the minimum number of bytes that a large preimage oracle proposal can be.
	PreimageOracleMinProposalSize uint64 `json:"preimageOracleMinProposalSize"`
	// PreimageOracleChallengePeriod is the number of seconds that challengers have to challenge a large preimage proposal.
	PreimageOracleChallengePeriod uint64 `json:"preimageOracleChallengePeriod"`
	// ProofMaturityDelaySeconds is the number of seconds that a proof must be
	// mature before it can be used to finalize a withdrawal.
	ProofMaturityDelaySeconds uint64 `json:"proofMaturityDelaySeconds"`
	// DisputeGameFinalityDelaySeconds is an additional number of seconds a
	// dispute game must wait before it can be used to finalize a withdrawal.
	DisputeGameFinalityDelaySeconds uint64 `json:"disputeGameFinalityDelaySeconds"`
	// RespectedGameType is the dispute game type that the OptimismPortal
	// contract will respect for finalizing withdrawals.
	RespectedGameType uint32 `json:"respectedGameType"`
}

FaultProofDeployConfig configures the fault-proof deployment to L1.

func (*FaultProofDeployConfig) Check added in v1.9.0

func (d *FaultProofDeployConfig) Check(log log.Logger) error

type GasPriceOracleDeployConfig added in v1.9.0

type GasPriceOracleDeployConfig struct {
	// GasPriceOracleOverhead represents the initial value of the gas overhead in the GasPriceOracle predeploy.
	// Deprecated: Since Ecotone, this field is superseded by GasPriceOracleBaseFeeScalar and GasPriceOracleBlobBaseFeeScalar.
	GasPriceOracleOverhead uint64 `json:"gasPriceOracleOverhead"`
	// GasPriceOracleScalar represents the initial value of the gas scalar in the GasPriceOracle predeploy.
	// Deprecated: Since Ecotone, this field is superseded by GasPriceOracleBaseFeeScalar and GasPriceOracleBlobBaseFeeScalar.
	GasPriceOracleScalar uint64 `json:"gasPriceOracleScalar"`
	// GasPriceOracleBaseFeeScalar represents the value of the base fee scalar used for fee calculations.
	GasPriceOracleBaseFeeScalar uint32 `json:"gasPriceOracleBaseFeeScalar"`
	// GasPriceOracleBlobBaseFeeScalar represents the value of the blob base fee scalar used for fee calculations.
	GasPriceOracleBlobBaseFeeScalar uint32 `json:"gasPriceOracleBlobBaseFeeScalar"`
}

GasPriceOracleDeployConfig configures the GasPriceOracle L2 predeploy.

func (*GasPriceOracleDeployConfig) Check added in v1.9.0

func (*GasPriceOracleDeployConfig) FeeScalar added in v1.9.0

func (d *GasPriceOracleDeployConfig) FeeScalar() [32]byte

FeeScalar returns the raw serialized fee scalar. Uses pre-Ecotone if legacy config is present, otherwise uses the post-Ecotone scalar serialization.

type GasTokenDeployConfig added in v1.9.0

type GasTokenDeployConfig struct {
	// UseCustomGasToken is a flag to indicate that a custom gas token should be used
	UseCustomGasToken bool `json:"useCustomGasToken"`
	// CustomGasTokenAddress is the address of the ERC20 token to be used to pay for gas on L2.
	CustomGasTokenAddress common.Address `json:"customGasTokenAddress"`
}

GasTokenDeployConfig configures the optional custom gas token functionality.

func (*GasTokenDeployConfig) Check added in v1.9.0

func (d *GasTokenDeployConfig) Check(log log.Logger) error

type GovernanceDeployConfig added in v1.9.0

type GovernanceDeployConfig struct {
	// EnableGovernance configures whether or not include governance token predeploy.
	EnableGovernance bool `json:"enableGovernance"`
	// GovernanceTokenSymbol represents the  ERC20 symbol of the GovernanceToken.
	GovernanceTokenSymbol string `json:"governanceTokenSymbol"`
	// GovernanceTokenName represents the ERC20 name of the GovernanceToken
	GovernanceTokenName string `json:"governanceTokenName"`
	// GovernanceTokenOwner represents the owner of the GovernanceToken. Has the ability
	// to mint and burn tokens.
	GovernanceTokenOwner common.Address `json:"governanceTokenOwner"`
}

GovernanceDeployConfig is exclusive to OP-Mainnet and the testing of OP-Mainnet-like chains.

func (*GovernanceDeployConfig) Check added in v1.9.0

func (d *GovernanceDeployConfig) Check(log log.Logger) error

func (*GovernanceDeployConfig) GovernanceEnabled added in v1.9.0

func (d *GovernanceDeployConfig) GovernanceEnabled() bool

type L1DependenciesConfig added in v1.9.0

type L1DependenciesConfig struct {
	// L1StandardBridgeProxy represents the address of the L1StandardBridgeProxy on L1 and is used
	// as part of building the L2 genesis state.
	L1StandardBridgeProxy common.Address `json:"l1StandardBridgeProxy"`
	// L1CrossDomainMessengerProxy represents the address of the L1CrossDomainMessengerProxy on L1 and is used
	// as part of building the L2 genesis state.
	L1CrossDomainMessengerProxy common.Address `json:"l1CrossDomainMessengerProxy"`
	// L1ERC721BridgeProxy represents the address of the L1ERC721Bridge on L1 and is used
	// as part of building the L2 genesis state.
	L1ERC721BridgeProxy common.Address `json:"l1ERC721BridgeProxy"`
	// SystemConfigProxy represents the address of the SystemConfigProxy on L1 and is used
	// as part of the derivation pipeline.
	SystemConfigProxy common.Address `json:"systemConfigProxy"`
	// OptimismPortalProxy represents the address of the OptimismPortalProxy on L1 and is used
	// as part of the derivation pipeline.
	OptimismPortalProxy common.Address `json:"optimismPortalProxy"`

	// DAChallengeProxy represents the L1 address of the DataAvailabilityChallenge contract.
	DAChallengeProxy common.Address `json:"daChallengeProxy"`
}

L1DependenciesConfig is the set of addresses that affect the L2 genesis construction, and is dependent on prior deployment of contracts to L1. This is generally not configured in deploy-config JSON, but rather merged in through a L1 deployments JSON file.

func (*L1DependenciesConfig) CheckAddresses added in v1.9.0

func (d *L1DependenciesConfig) CheckAddresses(dependencyContext DependencyContext) error

type L1Deployments added in v1.1.4

type L1Deployments struct {
	AddressManager                    common.Address `json:"AddressManager"`
	DisputeGameFactory                common.Address `json:"DisputeGameFactory"`
	DisputeGameFactoryProxy           common.Address `json:"DisputeGameFactoryProxy"`
	L1CrossDomainMessenger            common.Address `json:"L1CrossDomainMessenger"`
	L1CrossDomainMessengerProxy       common.Address `json:"L1CrossDomainMessengerProxy"`
	L1ERC721Bridge                    common.Address `json:"L1ERC721Bridge"`
	L1ERC721BridgeProxy               common.Address `json:"L1ERC721BridgeProxy"`
	L1StandardBridge                  common.Address `json:"L1StandardBridge"`
	L1StandardBridgeProxy             common.Address `json:"L1StandardBridgeProxy"`
	L2OutputOracle                    common.Address `json:"L2OutputOracle"`
	L2OutputOracleProxy               common.Address `json:"L2OutputOracleProxy"`
	OptimismMintableERC20Factory      common.Address `json:"OptimismMintableERC20Factory"`
	OptimismMintableERC20FactoryProxy common.Address `json:"OptimismMintableERC20FactoryProxy"`
	OptimismPortal                    common.Address `json:"OptimismPortal"`
	OptimismPortalProxy               common.Address `json:"OptimismPortalProxy"`
	ProxyAdmin                        common.Address `json:"ProxyAdmin"`
	SystemConfig                      common.Address `json:"SystemConfig"`
	SystemConfigProxy                 common.Address `json:"SystemConfigProxy"`
	ProtocolVersions                  common.Address `json:"ProtocolVersions"`
	ProtocolVersionsProxy             common.Address `json:"ProtocolVersionsProxy"`
	DataAvailabilityChallenge         common.Address `json:"DataAvailabilityChallenge"`
	DataAvailabilityChallengeProxy    common.Address `json:"DataAvailabilityChallengeProxy"`
}

L1Deployments represents a set of L1 contracts that are deployed. This should be consolidated with https://github.com/ethereum-optimism/superchain-registry/blob/f9702a89214244c8dde39e45f5c2955f26d857d0/superchain/superchain.go#L227

func NewL1Deployments added in v1.1.4

func NewL1Deployments(path string) (*L1Deployments, error)

NewL1Deployments will create a new L1Deployments from a JSON file on disk at the given path.

func (*L1Deployments) Check added in v1.1.4

func (d *L1Deployments) Check(deployConfig *DeployConfig) error

Check will ensure that the L1Deployments are sane

func (*L1Deployments) Copy added in v1.1.4

func (d *L1Deployments) Copy() *L1Deployments

Copy will copy the L1Deployments struct

func (*L1Deployments) ForEach added in v1.1.4

func (d *L1Deployments) ForEach(cb func(name string, addr common.Address))

ForEach will iterate over each contract in the L1Deployments

func (*L1Deployments) GetName added in v1.1.4

func (d *L1Deployments) GetName(addr common.Address) string

GetName will return the name of the contract given an address.

type L2AllocsMode added in v1.7.4

type L2AllocsMode string
const (
	L2AllocsDelta   L2AllocsMode = "delta"
	L2AllocsEcotone L2AllocsMode = "ecotone"
	L2AllocsFjord   L2AllocsMode = "fjord"
	L2AllocsGranite L2AllocsMode = "granite"
)

type L2CoreDeployConfig added in v1.9.0

type L2CoreDeployConfig struct {
	// L1ChainID is the chain ID of the L1 chain.
	L1ChainID uint64 `json:"l1ChainID"`

	// L2ChainID is the chain ID of the L2 chain.
	L2ChainID uint64 `json:"l2ChainID"`

	// L2BlockTime is the number of seconds between each L2 block.
	L2BlockTime uint64 `json:"l2BlockTime"`
	// FinalizationPeriodSeconds represents the number of seconds before an output is considered
	// finalized. This impacts the amount of time that withdrawals take to finalize and is
	// generally set to 1 week.
	FinalizationPeriodSeconds uint64 `json:"finalizationPeriodSeconds"`
	// MaxSequencerDrift is the number of seconds after the L1 timestamp of the end of the
	// sequencing window that batches must be included, otherwise L2 blocks including
	// deposits are force included.
	MaxSequencerDrift uint64 `json:"maxSequencerDrift"`
	// SequencerWindowSize is the number of L1 blocks per sequencing window.
	SequencerWindowSize uint64 `json:"sequencerWindowSize"`
	// ChannelTimeoutBedrock is the number of L1 blocks that a frame stays valid when included in L1.
	ChannelTimeoutBedrock uint64 `json:"channelTimeout"`
	// ChannelTimeoutGranite is the number of L1 blocks that a frame stays valid when included in L1 after granite.
	ChannelTimeoutGranite uint64 `json:"channelTimeoutGranite,omitempty"`
	// BatchInboxAddress is the L1 account that batches are sent to.
	BatchInboxAddress common.Address `json:"batchInboxAddress"`

	// SystemConfigStartBlock represents the block at which the op-node should start syncing
	// from. It is an override to set this value on legacy networks where it is not set by
	// default. It can be removed once all networks have this value set in their storage.
	SystemConfigStartBlock uint64 `json:"systemConfigStartBlock"`
}

L2CoreDeployConfig configures the core protocol parameters of the chain.

func (*L2CoreDeployConfig) Check added in v1.9.0

func (d *L2CoreDeployConfig) Check(log log.Logger) error

type L2GenesisBlockDeployConfig added in v1.9.0

type L2GenesisBlockDeployConfig struct {
	L2GenesisBlockNonce         hexutil.Uint64 `json:"l2GenesisBlockNonce"`
	L2GenesisBlockGasLimit      hexutil.Uint64 `json:"l2GenesisBlockGasLimit"`
	L2GenesisBlockDifficulty    *hexutil.Big   `json:"l2GenesisBlockDifficulty"`
	L2GenesisBlockMixHash       common.Hash    `json:"l2GenesisBlockMixHash"`
	L2GenesisBlockNumber        hexutil.Uint64 `json:"l2GenesisBlockNumber"`
	L2GenesisBlockGasUsed       hexutil.Uint64 `json:"l2GenesisBlockGasUsed"`
	L2GenesisBlockParentHash    common.Hash    `json:"l2GenesisBlockParentHash"`
	L2GenesisBlockBaseFeePerGas *hexutil.Big   `json:"l2GenesisBlockBaseFeePerGas"`
	// L2GenesisBlockExtraData is configurable extradata. Will default to []byte("BEDROCK") if left unspecified.
	L2GenesisBlockExtraData []byte `json:"l2GenesisBlockExtraData"`
}

func (*L2GenesisBlockDeployConfig) Check added in v1.9.0

type L2InitializationConfig added in v1.9.0

L2InitializationConfig represents all L2 configuration data that can be configured before the deployment of any L1 contracts.

func (*L2InitializationConfig) Check added in v1.9.0

func (d *L2InitializationConfig) Check(log log.Logger) error

type L2VaultsDeployConfig added in v1.9.0

type L2VaultsDeployConfig struct {
	// BaseFeeVaultRecipient represents the recipient of fees accumulated in the BaseFeeVault.
	// Can be an account on L1 or L2, depending on the BaseFeeVaultWithdrawalNetwork value.
	BaseFeeVaultRecipient common.Address `json:"baseFeeVaultRecipient"`
	// L1FeeVaultRecipient represents the recipient of fees accumulated in the L1FeeVault.
	// Can be an account on L1 or L2, depending on the L1FeeVaultWithdrawalNetwork value.
	L1FeeVaultRecipient common.Address `json:"l1FeeVaultRecipient"`
	// SequencerFeeVaultRecipient represents the recipient of fees accumulated in the SequencerFeeVault.
	// Can be an account on L1 or L2, depending on the SequencerFeeVaultWithdrawalNetwork value.
	SequencerFeeVaultRecipient common.Address `json:"sequencerFeeVaultRecipient"`
	// BaseFeeVaultMinimumWithdrawalAmount represents the minimum withdrawal amount for the BaseFeeVault.
	BaseFeeVaultMinimumWithdrawalAmount *hexutil.Big `json:"baseFeeVaultMinimumWithdrawalAmount"`
	// L1FeeVaultMinimumWithdrawalAmount represents the minimum withdrawal amount for the L1FeeVault.
	L1FeeVaultMinimumWithdrawalAmount *hexutil.Big `json:"l1FeeVaultMinimumWithdrawalAmount"`
	// SequencerFeeVaultMinimumWithdrawalAmount represents the minimum withdrawal amount for the SequencerFeeVault.
	SequencerFeeVaultMinimumWithdrawalAmount *hexutil.Big `json:"sequencerFeeVaultMinimumWithdrawalAmount"`
	// BaseFeeVaultWithdrawalNetwork represents the withdrawal network for the BaseFeeVault.
	BaseFeeVaultWithdrawalNetwork WithdrawalNetwork `json:"baseFeeVaultWithdrawalNetwork"`
	// L1FeeVaultWithdrawalNetwork represents the withdrawal network for the L1FeeVault.
	L1FeeVaultWithdrawalNetwork WithdrawalNetwork `json:"l1FeeVaultWithdrawalNetwork"`
	// SequencerFeeVaultWithdrawalNetwork represents the withdrawal network for the SequencerFeeVault.
	SequencerFeeVaultWithdrawalNetwork WithdrawalNetwork `json:"sequencerFeeVaultWithdrawalNetwork"`
}

func (*L2VaultsDeployConfig) Check added in v1.9.0

func (d *L2VaultsDeployConfig) Check(log log.Logger) error

type LegacyDeployConfig added in v1.9.0

type LegacyDeployConfig struct {
	// CliqueSignerAddress represents the signer address for the clique consensus engine.
	// It is used in the multi-process devnet to sign blocks.
	CliqueSignerAddress common.Address `json:"cliqueSignerAddress"`
	// L1UseClique represents whether or not to use the clique consensus engine.
	L1UseClique bool `json:"l1UseClique"`

	// DeploymentWaitConfirmations is the number of confirmations to wait during
	// deployment. This is DEPRECATED and should be removed in a future PR.
	DeploymentWaitConfirmations int `json:"deploymentWaitConfirmations"`
}

LegacyDeployConfig retains legacy DeployConfig attributes. The genesis generation may log warnings, do a best-effort support attempt, or ignore these attributes completely.

type MarshalableRPCBlockNumberOrHash

type MarshalableRPCBlockNumberOrHash rpc.BlockNumberOrHash

func (*MarshalableRPCBlockNumberOrHash) Hash added in v1.0.3

Hash wraps the rpc.BlockNumberOrHash Hash method.

func (*MarshalableRPCBlockNumberOrHash) MarshalJSON

func (m *MarshalableRPCBlockNumberOrHash) MarshalJSON() ([]byte, error)

func (*MarshalableRPCBlockNumberOrHash) Number added in v1.0.3

Number wraps the rpc.BlockNumberOrHash Number method.

func (*MarshalableRPCBlockNumberOrHash) String added in v1.0.3

String wraps the rpc.BlockNumberOrHash String method.

func (*MarshalableRPCBlockNumberOrHash) UnmarshalJSON

func (m *MarshalableRPCBlockNumberOrHash) UnmarshalJSON(b []byte) error

type OperatorDeployConfig added in v1.9.0

type OperatorDeployConfig struct {
	// P2PSequencerAddress is the address of the key the sequencer uses to sign blocks on the P2P layer.
	P2PSequencerAddress common.Address `json:"p2pSequencerAddress"`
	// BatchSenderAddress represents the initial sequencer account that authorizes batches.
	// Transactions sent from this account to the batch inbox address are considered valid.
	BatchSenderAddress common.Address `json:"batchSenderAddress"`
}

OperatorDeployConfig configures the hot-key addresses for operations such as sequencing and batch-submission.

func (*OperatorDeployConfig) Check added in v1.9.0

func (d *OperatorDeployConfig) Check(log log.Logger) error

type OutputOracleDeployConfig added in v1.9.0

type OutputOracleDeployConfig struct {
	// L2OutputOracleSubmissionInterval is the number of L2 blocks between outputs that are submitted
	// to the L2OutputOracle contract located on L1.
	L2OutputOracleSubmissionInterval uint64 `json:"l2OutputOracleSubmissionInterval"`
	// L2OutputOracleStartingTimestamp is the starting timestamp for the L2OutputOracle.
	// MUST be the same as the timestamp of the L2OO start block.
	L2OutputOracleStartingTimestamp int `json:"l2OutputOracleStartingTimestamp"`
	// L2OutputOracleStartingBlockNumber is the starting block number for the L2OutputOracle.
	// Must be greater than or equal to the first Bedrock block. The first L2 output will correspond
	// to this value plus the submission interval.
	L2OutputOracleStartingBlockNumber uint64 `json:"l2OutputOracleStartingBlockNumber"`
	// L2OutputOracleProposer is the address of the account that proposes L2 outputs.
	L2OutputOracleProposer common.Address `json:"l2OutputOracleProposer"`
	// L2OutputOracleChallenger is the address of the account that challenges L2 outputs.
	L2OutputOracleChallenger common.Address `json:"l2OutputOracleChallenger"`
}

OutputOracleDeployConfig configures the legacy OutputOracle deployment to L1. This is obsoleted with Fault Proofs. See FaultProofDeployConfig.

func (*OutputOracleDeployConfig) Check added in v1.9.0

func (d *OutputOracleDeployConfig) Check(log log.Logger) error

type OwnershipDeployConfig added in v1.9.0

type OwnershipDeployConfig struct {
	// ProxyAdminOwner represents the owner of the ProxyAdmin predeploy on L2.
	ProxyAdminOwner common.Address `json:"proxyAdminOwner"`
	// FinalSystemOwner is the owner of the system on L1. Any L1 contract that is ownable has
	// this account set as its owner.
	FinalSystemOwner common.Address `json:"finalSystemOwner"`
}

OwnershipDeployConfig defines the ownership of an L2 chain deployment. This excludes superchain-wide contracts.

func (*OwnershipDeployConfig) Check added in v1.9.0

func (d *OwnershipDeployConfig) Check(log log.Logger) error

type PlasmaDeployConfig added in v1.9.0

type PlasmaDeployConfig struct {
	// UsePlasma is a flag that indicates if the system is using op-plasma
	UsePlasma bool `json:"usePlasma"`
	// DACommitmentType specifies the allowed commitment
	DACommitmentType string `json:"daCommitmentType"`
	// DAChallengeWindow represents the block interval during which the availability of a data commitment can be challenged.
	DAChallengeWindow uint64 `json:"daChallengeWindow"`
	// DAResolveWindow represents the block interval during which a data availability challenge can be resolved.
	DAResolveWindow uint64 `json:"daResolveWindow"`
	// DABondSize represents the required bond size to initiate a data availability challenge.
	DABondSize uint64 `json:"daBondSize"`
	// DAResolverRefundPercentage represents the percentage of the resolving cost to be refunded to the resolver
	// such as 100 means 100% refund.
	DAResolverRefundPercentage uint64 `json:"daResolverRefundPercentage"`
}

PlasmaDeployConfig configures optional Alt-DA and Plasma functionality.

func (*PlasmaDeployConfig) Check added in v1.9.0

func (d *PlasmaDeployConfig) Check(log log.Logger) error

type SuperchainL1DeployConfig added in v1.9.0

type SuperchainL1DeployConfig struct {
	// RequiredProtocolVersion indicates the protocol version that
	// nodes are required to adopt, to stay in sync with the network.
	RequiredProtocolVersion params.ProtocolVersion `json:"requiredProtocolVersion"`
	// RequiredProtocolVersion indicates the protocol version that
	// nodes are recommended to adopt, to stay in sync with the network.
	RecommendedProtocolVersion params.ProtocolVersion `json:"recommendedProtocolVersion"`

	// SuperchainConfigGuardian represents the GUARDIAN account in the SuperchainConfig. Has the ability to pause withdrawals.
	SuperchainConfigGuardian common.Address `json:"superchainConfigGuardian"`
}

SuperchainL1DeployConfig configures parameters of the superchain-wide deployed contracts to L1. This deployment is global, and can be reused between L2s that target the same superchain.

func (*SuperchainL1DeployConfig) Check added in v1.9.0

func (d *SuperchainL1DeployConfig) Check(log log.Logger) error

type UpgradeScheduleDeployConfig added in v1.9.0

type UpgradeScheduleDeployConfig struct {
	// L2GenesisRegolithTimeOffset is the number of seconds after genesis block that Regolith hard fork activates.
	// Set it to 0 to activate at genesis. Nil to disable Regolith.
	L2GenesisRegolithTimeOffset *hexutil.Uint64 `json:"l2GenesisRegolithTimeOffset,omitempty"`
	// L2GenesisCanyonTimeOffset is the number of seconds after genesis block that Canyon hard fork activates.
	// Set it to 0 to activate at genesis. Nil to disable Canyon.
	L2GenesisCanyonTimeOffset *hexutil.Uint64 `json:"l2GenesisCanyonTimeOffset,omitempty"`
	// L2GenesisDeltaTimeOffset is the number of seconds after genesis block that Delta hard fork activates.
	// Set it to 0 to activate at genesis. Nil to disable Delta.
	L2GenesisDeltaTimeOffset *hexutil.Uint64 `json:"l2GenesisDeltaTimeOffset,omitempty"`
	// L2GenesisEcotoneTimeOffset is the number of seconds after genesis block that Ecotone hard fork activates.
	// Set it to 0 to activate at genesis. Nil to disable Ecotone.
	L2GenesisEcotoneTimeOffset *hexutil.Uint64 `json:"l2GenesisEcotoneTimeOffset,omitempty"`
	// L2GenesisFjordTimeOffset is the number of seconds after genesis block that Fjord hard fork activates.
	// Set it to 0 to activate at genesis. Nil to disable Fjord.
	L2GenesisFjordTimeOffset *hexutil.Uint64 `json:"l2GenesisFjordTimeOffset,omitempty"`
	// L2GenesisGraniteTimeOffset is the number of seconds after genesis block that Granite hard fork activates.
	// Set it to 0 to activate at genesis. Nil to disable Granite.
	L2GenesisGraniteTimeOffset *hexutil.Uint64 `json:"l2GenesisGraniteTimeOffset,omitempty"`
	// L2GenesisInteropTimeOffset is the number of seconds after genesis block that the Interop hard fork activates.
	// Set it to 0 to activate at genesis. Nil to disable Interop.
	L2GenesisInteropTimeOffset *hexutil.Uint64 `json:"l2GenesisInteropTimeOffset,omitempty"`

	// When Cancun activates. Relative to L1 genesis.
	L1CancunTimeOffset *hexutil.Uint64 `json:"l1CancunTimeOffset,omitempty"`

	// UseInterop is a flag that indicates if the system is using interop
	UseInterop bool `json:"useInterop,omitempty"`
}

UpgradeScheduleDeployConfig configures when network upgrades activate.

func (*UpgradeScheduleDeployConfig) CanyonTime added in v1.9.0

func (d *UpgradeScheduleDeployConfig) CanyonTime(genesisTime uint64) *uint64

func (*UpgradeScheduleDeployConfig) Check added in v1.9.0

func (*UpgradeScheduleDeployConfig) DeltaTime added in v1.9.0

func (d *UpgradeScheduleDeployConfig) DeltaTime(genesisTime uint64) *uint64

func (*UpgradeScheduleDeployConfig) EcotoneTime added in v1.9.0

func (d *UpgradeScheduleDeployConfig) EcotoneTime(genesisTime uint64) *uint64

func (*UpgradeScheduleDeployConfig) FjordTime added in v1.9.0

func (d *UpgradeScheduleDeployConfig) FjordTime(genesisTime uint64) *uint64

func (*UpgradeScheduleDeployConfig) GraniteTime added in v1.9.0

func (d *UpgradeScheduleDeployConfig) GraniteTime(genesisTime uint64) *uint64

func (*UpgradeScheduleDeployConfig) InteropTime added in v1.9.0

func (d *UpgradeScheduleDeployConfig) InteropTime(genesisTime uint64) *uint64

func (*UpgradeScheduleDeployConfig) RegolithTime added in v1.9.0

func (d *UpgradeScheduleDeployConfig) RegolithTime(genesisTime uint64) *uint64

type WithdrawalNetwork added in v1.1.4

type WithdrawalNetwork string

WithdrawalNetwork represents the network that withdrawals are sent to. Its value when marshalled in json is intended to be a consistent with its internal string type but is backwards-compatible with uint8 values. That is, WithdrawalNetwork can be unmarshalled from a JSON field into a uint8.

func FromUint8 added in v1.1.4

func FromUint8(i uint8) WithdrawalNetwork

FromUint8 converts a uint8 to a WithdrawalNetwork.

func (*WithdrawalNetwork) ToUint8 added in v1.1.4

func (w *WithdrawalNetwork) ToUint8() uint8

ToUint8 converts a WithdrawalNetwork to a uint8.

func (*WithdrawalNetwork) UnmarshalJSON added in v1.1.4

func (w *WithdrawalNetwork) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaler interface, which allows us to ingest values of any json type as an int and run our custom conversion

func (*WithdrawalNetwork) Valid added in v1.1.4

func (w *WithdrawalNetwork) Valid() bool

Valid returns if the withdrawal network is valid.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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