migration

package
v0.10.14 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ParamsByChainID = map[int]*Params{
	1: {

		new(big.Int).SetUint64(1627270011999999992),
	},
	5: {
		new(big.Int),
	},
}

Functions

This section is empty.

Types

type Allowance

type Allowance struct {
	From common.Address `json:"fr"`
	To   common.Address `json:"to"`
}

Allowance represents the allowances that were set in the legacy ERC20 representation of ether

func NewAllowances

func NewAllowances(path string) ([]*Allowance, error)

NewAllowances will read the ovm-allowances.json from the file system.

type LegacyReceipt

type LegacyReceipt struct {
	// Consensus fields: These fields are defined by the Yellow Paper
	PostState         []byte       `json:"root"`
	Status            uint64       `json:"status"`
	CumulativeGasUsed uint64       `json:"cumulativeGasUsed" gencodec:"required"`
	Bloom             types.Bloom  `json:"logsBloom"         gencodec:"required"`
	Logs              []*types.Log `json:"logs"              gencodec:"required"`

	// Implementation fields: These fields are added by geth when processing a transaction.
	// They are stored in the chain database.
	TxHash          common.Hash    `json:"transactionHash" gencodec:"required"`
	ContractAddress common.Address `json:"contractAddress"`
	GasUsed         uint64         `json:"gasUsed" gencodec:"required"`

	// Inclusion information: These fields provide information about the inclusion of the
	// transaction corresponding to this receipt.
	BlockHash        common.Hash `json:"blockHash,omitempty"`
	BlockNumber      *big.Int    `json:"blockNumber,omitempty"`
	TransactionIndex uint        `json:"transactionIndex"`

	// UsingOVM
	L1GasPrice *big.Int   `json:"l1GasPrice" gencodec:"required"`
	L1GasUsed  *big.Int   `json:"l1GasUsed" gencodec:"required"`
	L1Fee      *big.Int   `json:"l1Fee" gencodec:"required"`
	FeeScalar  *big.Float `json:"l1FeeScalar" gencodec:"required"`
}

func ReadLegacyReceipts

func ReadLegacyReceipts(db ethdb.Reader, hash common.Hash, number uint64) ([]*LegacyReceipt, error)

func (*LegacyReceipt) DecodeRLP

func (r *LegacyReceipt) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder, and loads both consensus and implementation fields of a receipt from an RLP stream.

type MigrationData

type MigrationData struct {
	// OvmAddresses represents the set of addresses that interacted with the
	// LegacyERC20ETH contract before the evm equivalence upgrade
	OvmAddresses OVMETHAddresses
	// EvmAddresses represents the set of addresses that interacted with the
	// LegacyERC20ETH contract after the evm equivalence upgrade
	EvmAddresses OVMETHAddresses
	// OvmAllowances represents the set of allowances in the LegacyERC20ETH from
	// before the evm equivalence upgrade
	OvmAllowances []*Allowance
	// OvmMessages represents the set of withdrawals through the
	// L2CrossDomainMessenger from before the evm equivalence upgrade
	OvmMessages []*SentMessage
	// OvmMessages represents the set of withdrawals through the
	// L2CrossDomainMessenger from after the evm equivalence upgrade
	EvmMessages []*SentMessage
}

MigrationData represents all of the data required to do a migration

func (*MigrationData) Addresses

func (m *MigrationData) Addresses() []common.Address

func (*MigrationData) ToWithdrawals

func (m *MigrationData) ToWithdrawals() ([]*crossdomain.LegacyWithdrawal, error)

type OVMETHAddresses

type OVMETHAddresses map[common.Address]bool

OVMETHAddresses represents a list of addresses that interacted with the ERC20 representation of ether in the pre-bedrock system.

func NewAddresses

func NewAddresses(path string) (OVMETHAddresses, error)

NewAddresses will read an addresses.json file from the filesystem.

type Params added in v0.10.5

type Params struct {
	// ExpectedSupplyDelta is the expected delta between the total supply of OVM ETH,
	// and ETH we were able to migrate. This is used to account for supply bugs in
	//previous regenesis events.
	ExpectedSupplyDelta *big.Int
}

Params contains the configuration parameters used for verifying the integrity of the migration.

type SentMessage

type SentMessage struct {
	Who common.Address `json:"who"`
	Msg hexutil.Bytes  `json:"msg"`
}

SentMessageJSON represents an entry in the JSON file that is created by the `migration-data` package. Each entry represents a call to the `LegacyMessagePasser`. The `who` should always be the `L2CrossDomainMessenger` and the `msg` should be an abi encoded `relayMessage(address,address,bytes,uint256)`

func NewSentMessage

func NewSentMessage(path string) ([]*SentMessage, error)

NewSentMessageJSON will read a JSON file from disk given a path to the JSON file. The JSON file this function reads from disk is an output from the `migration-data` package.

func (*SentMessage) ToLegacyWithdrawal

func (s *SentMessage) ToLegacyWithdrawal() (*crossdomain.LegacyWithdrawal, error)

ToLegacyWithdrawal will convert a SentMessageJSON to a LegacyWithdrawal struct. This is useful because the LegacyWithdrawal struct has helper functions on it that can compute the withdrawal hash and the storage slot.

Jump to

Keyboard shortcuts

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