genesis

package
v0.0.0-...-de38b6f Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// implementationSlot represents the EIP 1967 implementation storage slot
	ImplementationSlot = common.HexToHash("0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc")
	// implementationSlot represents the EIP 1967 admin storage slot
	AdminSlot = common.HexToHash("0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103")
)
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"),
}

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

Functions

func AddressToCodeNamespace

func AddressToCodeNamespace(addr common.Address) (common.Address, error)

AddressToCodeNamespace takes a predeploy address and computes the implmentation address that the implementation should be deployed at

func BuildL1DeveloperGenesis

func BuildL1DeveloperGenesis(hh *hardhat.Hardhat, config *DeployConfig) (*core.Genesis, error)

TODO(tynes): need bindings for all of the L1 contracts

func BuildOptimismGenesis

func BuildOptimismGenesis(hh *hardhat.Hardhat, config *DeployConfig, chain ethereum.ChainReader) (*core.Genesis, error)

BuildOptimismGenesis

func FundDevAccounts

func FundDevAccounts(db vm.StateDB)

FundDevAccounts will fund each of the development accounts.

func MigrateDepositHashes

func MigrateDepositHashes(hh *hardhat.Hardhat, db vm.StateDB) error

Get the storage layout of the L2ToL1MessagePasser Iterate over the storage layout to know which storage slots to ignore Iterate over each storage slot, compute the migration

func NewL1Genesis

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

NewL1Genesis will create a new L1 genesis config

func NewL2Genesis

func NewL2Genesis(config *DeployConfig, chain ethereum.ChainReader) (*core.Genesis, error)

NewL2Genesis will create a new L2 genesis

func SetImplementations

func SetImplementations(hh *hardhat.Hardhat, db vm.StateDB, storage StorageConfig) error

SetImplementations will set the implmentations of the contracts in the state and configure the proxies to point to the implementations. It also sets the appropriate storage values for each contract at the proxy address.

func SetProxies

func SetProxies(hh *hardhat.Hardhat, db vm.StateDB) error

SetProxies will set each of the proxies in the state. It requires a Proxy and ProxyAdmin deployment present so that the Proxy bytecode can be set in state and the ProxyAdmin can be set as the admin of the Proxy.

Types

type DeployConfig

type DeployConfig struct {
	L1StartingBlockTag               rpc.BlockNumberOrHash `json:"l1StartingBlockTag"`
	L1ChainID                        *big.Int              `json:"l1ChainID"`
	L2ChainID                        *big.Int              `json:"l2ChainID"`
	L2BlockTime                      uint                  `json:"l2BlockTime"`
	MaxSequencerDrift                uint                  `json:"maxSequencerDrift"`
	SequencerWindowSize              uint                  `json:"sequencerWindowSize"`
	ChannelTimeout                   uint                  `json:"channelTimeout"`
	P2PSequencerAddress              common.Address        `json:"p2pSequencerAddress"`
	OptimismL2FeeRecipient           common.Address        `json:"optimismL2FeeRecipient"`
	BatchInboxAddress                common.Address        `json:"batchInboxAddress"`
	BatchSenderAddress               common.Address        `json:"batchSenderAddress"`
	L2OutputOracleSubmissionInterval uint                  `json:"l2OutputOracleSubmissionInterval"`
	L2OutputOracleStartingTimestamp  int                   `json:"l2OutputOracleStartingTimestamp"`
	L2OutputOracleProposer           common.Address        `json:"l2OutputOracleProposer"`
	L2OutputOracleOwner              common.Address        `json:"l2OutputOracleOwner"`
	L1BlockTime                      uint64                `json:"l1BlockTime"`
	CliqueSignerAddress              common.Address        `json:"cliqueSignerAddress"`
	OptimismBaseFeeRecipient         common.Address        `json:"optimismBaseFeeRecipient"`
	OptimismL1FeeRecipient           common.Address        `json:"optimismL1FeeRecipient"`
	ProxyAdmin                       common.Address        `json:"proxyAdmin"`
	FundDevAccounts                  bool                  `json:"fundDevAccounts"`
	GasPriceOracleOwner              common.Address        `json:"gasPriceOracleOwner"`
	GasPriceOracleOverhead           uint                  `json:"gasPriceOracleOverhead"`
	GasPriceOracleScalar             uint                  `json:"gasPriceOracleScalar"`
	GasPriceOracleDecimals           uint                  `json:"gasPriceOracleDecimals"`
	L2CrossDomainMessengerOwner      common.Address        `json:"l2CrossDomainMessengerOwner"`
	L2GenesisBlockNonce              uint64                `json:"l2GenesisBlockNonce"`
	L2GenesisBlockExtraData          hexutil.Bytes         `json:"l2GenesisBlockExtraData"`
	L2GenesisBlockGasLimit           uint64                `json:"l2GenesisBlockGasLimit"`
	L2GenesisBlockDifficulty         *big.Int              `json:"l2GenesisBlockDifficulty"`
	L2GenesisBlockMixHash            common.Hash           `json:"l2GenesisBlockMixHash"`
	L2GenesisBlockCoinbase           common.Address        `json:"l2GenesisBlockCoinbase"`
	L2GenesisBlockNumber             uint64                `json:"l2GenesisBlockNumber"`
	L2GenesisBlockGasUsed            uint64                `json:"l2GenesisBlockGasUsed"`
	L2GenesisBlockParentHash         common.Hash           `json:"l2GenesisBlockParentHash"`
	L2GenesisBlockBaseFeePerGas      *big.Int              `json:"l2GenesisBlockBaseFeePerGas"`
	L1GenesisBlockTimestamp          uint64                `json:"l1GenesisBlockTimestamp"`
	L1GenesisBlockNonce              uint64                `json:"l1GenesisBlockNonce"`
	L1GenesisBlockGasLimit           uint64                `json:"l1GenesisBlockGasLimit"`
	L1GenesisBlockDifficulty         *big.Int              `json:"l1GenesisBlockDifficulty"`
	L1GenesisBlockMixHash            common.Hash           `json:"l1GenesisBlockMixHash"`
	L1GenesisBlockCoinbase           common.Address        `json:"l1GenesisBlockCoinbase"`
	L1GenesisBlockNumber             uint64                `json:"l1GenesisBlockNumber"`
	L1GenesisBlockGasUsed            uint64                `json:"l1GenesisBlockGasUsed"`
	L1GenesisBlockParentHash         common.Hash           `json:"l1GenesisBlockParentHash"`
	L1GenesisBlockBaseFeePerGas      *big.Int              `json:"l1GenesisBlockBaseFeePerGas"`
}

DeployConfig represents the deployment configuration for Optimism

func NewDeployConfig

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

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

type StorageConfig

type StorageConfig map[string]state.StorageValues

StorageConfig represents the storage configuration for the L2 predeploy contracts.

func NewStorageConfig

func NewStorageConfig(hh *hardhat.Hardhat, config *DeployConfig, chain ethereum.ChainReader) (StorageConfig, error)

NewStorageConfig will create a StorageConfig given an instance of a Hardhat and a DeployConfig.

Jump to

Keyboard shortcuts

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