Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
3fd7b11f
Commit
3fd7b11f
authored
Dec 07, 2022
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-chain-ops: add legacy eth migration check
Very simple one for now
parent
62eaab9f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
cli.go
op-chain-ops/ether/cli.go
+4
-0
check.go
op-chain-ops/genesis/check.go
+17
-0
No files found.
op-chain-ops/ether/cli.go
View file @
3fd7b11f
...
...
@@ -21,6 +21,10 @@ func getOVMETHTotalSupplySlot() common.Hash {
return
key
}
func
GetOVMETHTotalSupplySlot
()
common
.
Hash
{
return
getOVMETHTotalSupplySlot
()
}
// getOVMETHBalance gets a user's OVM ETH balance from state by querying the
// appropriate storage slot directly.
func
getOVMETHBalance
(
db
*
state
.
StateDB
,
addr
common
.
Address
)
*
big
.
Int
{
...
...
op-chain-ops/genesis/check.go
View file @
3fd7b11f
package
genesis
import
(
"errors"
"fmt"
"math/big"
"github.com/ethereum-optimism/optimism/op-bindings/predeploys"
"github.com/ethereum-optimism/optimism/op-chain-ops/ether"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
...
...
@@ -41,6 +43,10 @@ func CheckMigratedDB(ldb ethdb.Database) error {
return
err
}
if
err
:=
CheckLegacyETH
(
db
);
err
!=
nil
{
return
err
}
return
nil
}
...
...
@@ -78,3 +84,14 @@ func CheckPredeploys(db vm.StateDB) error {
}
return
nil
}
// CheckLegacyETH checks that the legacy eth migration was successful.
// It currently only checks that the total supply was set to 0.
func
CheckLegacyETH
(
db
vm
.
StateDB
)
error
{
// Ensure total supply is set to 0
slot
:=
db
.
GetState
(
predeploys
.
LegacyERC20ETHAddr
,
ether
.
GetOVMETHTotalSupplySlot
())
if
slot
!=
(
common
.
Hash
{})
{
return
errors
.
New
(
"total supply not set to 0"
)
}
return
nil
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment