state

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VMTypeAlphabet = "ALPHABET"
	VMTypeCannon1  = "CANNON1"
	VMTypeCannon2  = "CANNON2"
)

Variables

View Source
var ErrChainRoleZeroAddress = fmt.Errorf("ChainRole is set to zero address")
View Source
var ErrEip1559ZeroValue = fmt.Errorf("eip1559 param is set to zero value")
View Source
var ErrFeeVaultZeroAddress = fmt.Errorf("chain has a fee vault set to zero address")
View Source
var ErrL1ContractsLocatorUndefined = errors.New("L1ContractsLocator undefined")
View Source
var ErrL2ContractsLocatorUndefined = errors.New("L2ContractsLocator undefined")
View Source
var ErrNonStandardValue = fmt.Errorf("chain contains non-standard config value")
View Source
var ErrSuperchainRoleZeroAddress = errors.New("SuperchainRole is set to zero address")

Functions

func CombineDeployConfig

func CombineDeployConfig(intent *Intent, chainIntent *ChainIntent, state *State, chainState *ChainState) (genesis.DeployConfig, error)

Types

type AdditionalDisputeGame added in v1.11.0

type AdditionalDisputeGame struct {
	ChainProofParams
	VMType                       VMType
	UseCustomOracle              bool
	OracleMinProposalSize        uint64
	OracleChallengePeriodSeconds uint64
	MakeRespected                bool
}

type AdditionalDisputeGameState added in v1.11.0

type AdditionalDisputeGameState struct {
	GameType      uint32
	GameAddress   common.Address
	VMAddress     common.Address
	OracleAddress common.Address
	VMType        VMType
}

type Base64Bytes

type Base64Bytes []byte

func (Base64Bytes) MarshalJSON

func (b Base64Bytes) MarshalJSON() ([]byte, error)

func (*Base64Bytes) UnmarshalJSON

func (b *Base64Bytes) UnmarshalJSON(data []byte) error

type ChainIntent

type ChainIntent struct {
	ID                         common.Hash               `json:"id" toml:"id"`
	BaseFeeVaultRecipient      common.Address            `json:"baseFeeVaultRecipient" toml:"baseFeeVaultRecipient"`
	L1FeeVaultRecipient        common.Address            `json:"l1FeeVaultRecipient" toml:"l1FeeVaultRecipient"`
	SequencerFeeVaultRecipient common.Address            `json:"sequencerFeeVaultRecipient" toml:"sequencerFeeVaultRecipient"`
	Eip1559DenominatorCanyon   uint64                    `json:"eip1559DenominatorCanyon" toml:"eip1559DenominatorCanyon"`
	Eip1559Denominator         uint64                    `json:"eip1559Denominator" toml:"eip1559Denominator"`
	Eip1559Elasticity          uint64                    `json:"eip1559Elasticity" toml:"eip1559Elasticity"`
	Roles                      ChainRoles                `json:"roles" toml:"roles"`
	DeployOverrides            map[string]any            `json:"deployOverrides" toml:"deployOverrides"`
	DangerousAltDAConfig       genesis.AltDADeployConfig `json:"dangerousAltDAConfig,omitempty" toml:"dangerousAltDAConfig,omitempty"`
	AdditionalDisputeGames     []AdditionalDisputeGame   `json:"dangerousAdditionalDisputeGames" toml:"dangerousAdditionalDisputeGames,omitempty"`
	OperatorFeeScalar          uint32                    `json:"operatorFeeScalar,omitempty" toml:"operatorFeeScalar,omitempty"`
	OperatorFeeConstant        uint64                    `json:"operatorFeeConstant,omitempty" toml:"operatorFeeConstant,omitempty"`
}

func (*ChainIntent) Check

func (c *ChainIntent) Check() error

type ChainProofParams added in v1.11.0

type ChainProofParams struct {
	DisputeGameType                         uint32      `json:"respectedGameType" toml:"respectedGameType"`
	DisputeAbsolutePrestate                 common.Hash `json:"faultGameAbsolutePrestate" toml:"faultGameAbsolutePrestate"`
	DisputeMaxGameDepth                     uint64      `json:"faultGameMaxDepth" toml:"faultGameMaxDepth"`
	DisputeSplitDepth                       uint64      `json:"faultGameSplitDepth" toml:"faultGameSplitDepth"`
	DisputeClockExtension                   uint64      `json:"faultGameClockExtension" toml:"faultGameClockExtension"`
	DisputeMaxClockDuration                 uint64      `json:"faultGameMaxClockDuration" toml:"faultGameMaxClockDuration"`
	DangerouslyAllowCustomDisputeParameters bool        `json:"dangerouslyAllowCustomDisputeParameters" toml:"dangerouslyAllowCustomDisputeParameters"`
}

type ChainRoles

type ChainRoles struct {
	L1ProxyAdminOwner common.Address `json:"l1ProxyAdminOwner" toml:"l1ProxyAdminOwner"`
	L2ProxyAdminOwner common.Address `json:"l2ProxyAdminOwner" toml:"l2ProxyAdminOwner"`
	SystemConfigOwner common.Address `json:"systemConfigOwner" toml:"systemConfigOwner"`
	UnsafeBlockSigner common.Address `json:"unsafeBlockSigner" toml:"unsafeBlockSigner"`
	Batcher           common.Address `json:"batcher" toml:"batcher"`
	Proposer          common.Address `json:"proposer" toml:"proposer"`
	Challenger        common.Address `json:"challenger" toml:"challenger"`
}

func (*ChainRoles) CheckNoZeroAddresses added in v1.11.0

func (cr *ChainRoles) CheckNoZeroAddresses() error

Returns an error if any fields in ChainRoles is set to common.Address{}

type ChainState

type ChainState struct {
	ID common.Hash `json:"id"`

	ProxyAdminAddress                         common.Address               `json:"proxyAdminAddress"`
	AddressManagerAddress                     common.Address               `json:"addressManagerAddress"`
	L1ERC721BridgeProxyAddress                common.Address               `json:"l1ERC721BridgeProxyAddress"`
	SystemConfigProxyAddress                  common.Address               `json:"systemConfigProxyAddress"`
	OptimismMintableERC20FactoryProxyAddress  common.Address               `json:"optimismMintableERC20FactoryProxyAddress"`
	L1StandardBridgeProxyAddress              common.Address               `json:"l1StandardBridgeProxyAddress"`
	L1CrossDomainMessengerProxyAddress        common.Address               `json:"l1CrossDomainMessengerProxyAddress"`
	OptimismPortalProxyAddress                common.Address               `json:"optimismPortalProxyAddress"`
	ETHLockboxProxyAddress                    common.Address               `json:"ethLockboxProxyAddress"`
	DisputeGameFactoryProxyAddress            common.Address               `json:"disputeGameFactoryProxyAddress"`
	AnchorStateRegistryProxyAddress           common.Address               `json:"anchorStateRegistryProxyAddress"`
	FaultDisputeGameAddress                   common.Address               `json:"faultDisputeGameAddress"`
	PermissionedDisputeGameAddress            common.Address               `json:"permissionedDisputeGameAddress"`
	DelayedWETHPermissionedGameProxyAddress   common.Address               `json:"delayedWETHPermissionedGameProxyAddress"`
	DelayedWETHPermissionlessGameProxyAddress common.Address               `json:"delayedWETHPermissionlessGameProxyAddress"`
	DataAvailabilityChallengeProxyAddress     common.Address               `json:"dataAvailabilityChallengeProxyAddress"`
	DataAvailabilityChallengeImplAddress      common.Address               `json:"dataAvailabilityChallengeImplAddress"`
	AdditionalDisputeGames                    []AdditionalDisputeGameState `json:"additionalDisputeGames"`

	Allocs *GzipData[foundry.ForgeAllocs] `json:"allocs"`

	StartBlock *L1BlockRefJSON `json:"startBlock"`
}

type GzipData

type GzipData[T any] struct {
	Data *T
}

func (*GzipData[T]) MarshalJSON

func (g *GzipData[T]) MarshalJSON() ([]byte, error)

func (*GzipData[T]) UnmarshalJSON

func (g *GzipData[T]) UnmarshalJSON(b []byte) error

type ImplementationsDeployment

type ImplementationsDeployment struct {
	OpcmAddress                             common.Address `json:"opcmAddress"`
	OpcmGameTypeAdderAddress                common.Address `json:"opcmGameTypeAdderAddress"`
	OpcmDeployerAddress                     common.Address `json:"opcmDeployerAddress"`
	OpcmUpgraderAddress                     common.Address `json:"opcmUpgraderAddress"`
	OpcmInteropMigratorAddress              common.Address `json:"opcmInteropMigratorAddress"`
	DelayedWETHImplAddress                  common.Address `json:"delayedWETHImplAddress"`
	OptimismPortalImplAddress               common.Address `json:"optimismPortalImplAddress"`
	ETHLockboxImplAddress                   common.Address `json:"ethLockboxImplAddress"`
	PreimageOracleSingletonAddress          common.Address `json:"preimageOracleSingletonAddress"`
	MipsSingletonAddress                    common.Address `json:"mipsSingletonAddress"`
	SystemConfigImplAddress                 common.Address `json:"systemConfigImplAddress"`
	L1CrossDomainMessengerImplAddress       common.Address `json:"l1CrossDomainMessengerImplAddress"`
	L1ERC721BridgeImplAddress               common.Address `json:"l1ERC721BridgeImplAddress"`
	L1StandardBridgeImplAddress             common.Address `json:"l1StandardBridgeImplAddress"`
	OptimismMintableERC20FactoryImplAddress common.Address `json:"optimismMintableERC20FactoryImplAddress"`
	DisputeGameFactoryImplAddress           common.Address `json:"disputeGameFactoryImplAddress"`
	AnchorStateRegistryImplAddress          common.Address `json:"anchorStateRegistryImplAddress"`
}

type Intent

type Intent struct {
	ConfigType            IntentType         `json:"configType" toml:"configType"`
	L1ChainID             uint64             `json:"l1ChainID" toml:"l1ChainID"`
	SuperchainRoles       *SuperchainRoles   `json:"superchainRoles" toml:"superchainRoles,omitempty"`
	FundDevAccounts       bool               `json:"fundDevAccounts" toml:"fundDevAccounts"`
	UseInterop            bool               `json:"useInterop" toml:"useInterop"`
	L1ContractsLocator    *artifacts.Locator `json:"l1ContractsLocator" toml:"l1ContractsLocator"`
	L2ContractsLocator    *artifacts.Locator `json:"l2ContractsLocator" toml:"l2ContractsLocator"`
	Chains                []*ChainIntent     `json:"chains" toml:"chains"`
	GlobalDeployOverrides map[string]any     `json:"globalDeployOverrides" toml:"globalDeployOverrides"`
}

func NewIntent added in v1.11.0

func NewIntent(configType IntentType, l1ChainId uint64, l2ChainIds []common.Hash) (Intent, error)

func NewIntentCustom added in v1.11.0

func NewIntentCustom(l1ChainId uint64, l2ChainIds []common.Hash) (Intent, error)

Sets all Intent fields to their zero value with the expectation that the user will populate the values before running 'apply'

func NewIntentStandard added in v1.11.0

func NewIntentStandard(l1ChainId uint64, l2ChainIds []common.Hash) (Intent, error)

func NewIntentStandardOverrides added in v1.11.0

func NewIntentStandardOverrides(l1ChainId uint64, l2ChainIds []common.Hash) (Intent, error)

func (*Intent) Chain

func (c *Intent) Chain(id common.Hash) (*ChainIntent, error)

func (*Intent) Check

func (c *Intent) Check() error

func (*Intent) L1ChainIDBig

func (c *Intent) L1ChainIDBig() *big.Int

func (*Intent) WriteToFile

func (c *Intent) WriteToFile(path string) error

type IntentType added in v1.11.2

type IntentType string
const (
	IntentTypeStandard          IntentType = "standard"
	IntentTypeCustom            IntentType = "custom"
	IntentTypeStandardOverrides IntentType = "standard-overrides"
)

type L1BlockRefJSON added in v1.12.2

type L1BlockRefJSON struct {
	Hash       common.Hash    `json:"hash"`
	ParentHash common.Hash    `json:"parentHash"`
	Number     hexutil.Uint64 `json:"number"`
	Time       hexutil.Uint64 `json:"timestamp"`
}

func BlockRefJsonFromBlockRef added in v1.12.2

func BlockRefJsonFromBlockRef(br *eth.BlockRef) *L1BlockRefJSON

func BlockRefJsonFromHeader added in v1.12.2

func BlockRefJsonFromHeader(h *types.Header) *L1BlockRefJSON

func (*L1BlockRefJSON) ToBlockRef added in v1.12.2

func (b *L1BlockRefJSON) ToBlockRef() *eth.BlockRef

type State

type State struct {
	// Version versions the state so we can update it later.
	Version int `json:"version"`

	// Create2Salt is the salt used for CREATE2 deployments.
	Create2Salt common.Hash `json:"create2Salt"`

	// AppliedIntent contains the chain intent that was last
	// successfully applied. It is diffed against new intent
	// in order to determine what deployment steps to take.
	// This field is nil for new deployments.
	AppliedIntent *Intent `json:"appliedIntent"`

	// PrestateManifest contains the prestate generated by the op-program-svc
	PrestateManifest *prestate.PrestateManifest `json:"prestateManifest"`

	// InteropDepSet contains the interop dependency set render by the prestate SDK if interop is enabled
	InteropDepSet *prestate.DependencySet `json:"interopDepSet,omitempty"`

	// SuperchainDeployment contains the addresses of the Superchain
	// deployment. It only contains the proxies because the implementations
	// can be looked up on chain.
	SuperchainDeployment *SuperchainDeployment `json:"superchainDeployment"`

	// ImplementationsDeployment contains the addresses of the common implementation
	// contracts required for the Superchain to function.
	ImplementationsDeployment *ImplementationsDeployment `json:"implementationsDeployment"`

	// Chains contains data about L2 chain deployments.
	Chains []*ChainState `json:"opChainDeployments"`

	// L1StateDump contains the complete L1 state dump of the deployment.
	L1StateDump *GzipData[foundry.ForgeAllocs] `json:"l1StateDump"`

	// DeploymentCalldata contains the calldata of each transaction in the deployment. This is only
	// populated if apply is called with --deployment-target=calldata.
	DeploymentCalldata []broadcaster.CalldataDump
}

State contains the data needed to recreate the deployment as it progresses and once it is fully applied.

func (*State) Chain

func (s *State) Chain(id common.Hash) (*ChainState, error)

func (*State) WriteToFile

func (s *State) WriteToFile(path string) error

type SuperchainDeployment

type SuperchainDeployment struct {
	ProxyAdminAddress            common.Address `json:"proxyAdminAddress"`
	SuperchainConfigProxyAddress common.Address `json:"superchainConfigProxyAddress"`
	SuperchainConfigImplAddress  common.Address `json:"superchainConfigImplAddress"`
	ProtocolVersionsProxyAddress common.Address `json:"protocolVersionsProxyAddress"`
	ProtocolVersionsImplAddress  common.Address `json:"protocolVersionsImplAddress"`
}

type SuperchainProofParams added in v1.11.0

type SuperchainProofParams struct {
	WithdrawalDelaySeconds          uint64 `json:"faultGameWithdrawalDelay" toml:"faultGameWithdrawalDelay"`
	MinProposalSizeBytes            uint64 `json:"preimageOracleMinProposalSize" toml:"preimageOracleMinProposalSize"`
	ChallengePeriodSeconds          uint64 `json:"preimageOracleChallengePeriod" toml:"preimageOracleChallengePeriod"`
	ProofMaturityDelaySeconds       uint64 `json:"proofMaturityDelaySeconds" toml:"proofMaturityDelaySeconds"`
	DisputeGameFinalityDelaySeconds uint64 `json:"disputeGameFinalityDelaySeconds" toml:"disputeGameFinalityDelaySeconds"`
	MIPSVersion                     uint64 `json:"mipsVersion" toml:"mipsVersion"`
}

type SuperchainRoles

type SuperchainRoles struct {
	ProxyAdminOwner       common.Address `json:"proxyAdminOwner" toml:"proxyAdminOwner"`
	ProtocolVersionsOwner common.Address `json:"protocolVersionsOwner" toml:"protocolVersionsOwner"`
	Guardian              common.Address `json:"guardian" toml:"guardian"`
}

func GetStandardSuperchainRoles added in v1.12.1

func GetStandardSuperchainRoles(l1ChainId uint64) (*SuperchainRoles, error)

func (*SuperchainRoles) CheckNoZeroAddresses added in v1.11.0

func (s *SuperchainRoles) CheckNoZeroAddresses() error

type VMType added in v1.11.0

type VMType string

Jump to

Keyboard shortcuts

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