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
1743dba4
Unverified
Commit
1743dba4
authored
Dec 01, 2022
by
Mark Tyneway
Committed by
GitHub
Dec 01, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4132 from ethereum-optimism/fix/no-check-migrate-eth
op-chain-ops: add no check to eth migration
parents
1c83162b
c69870c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
16 deletions
+42
-16
migrate.go
op-chain-ops/ether/migrate.go
+41
-15
db_migration.go
op-chain-ops/genesis/db_migration.go
+1
-1
No files found.
op-chain-ops/ether/migrate.go
View file @
1743dba4
...
...
@@ -34,7 +34,7 @@ var (
}
)
func
MigrateLegacyETH
(
db
ethdb
.
Database
,
addresses
[]
common
.
Address
,
allowances
[]
*
migration
.
Allowance
,
chainID
int
,
commit
bool
)
(
common
.
Hash
,
error
)
{
func
MigrateLegacyETH
(
db
ethdb
.
Database
,
addresses
[]
common
.
Address
,
allowances
[]
*
migration
.
Allowance
,
chainID
int
,
commit
,
noCheck
bool
)
(
common
.
Hash
,
error
)
{
// Set of addresses that we will be migrating.
addressesToMigrate
:=
make
(
map
[
common
.
Address
]
bool
)
// Set of storage slots that we expect to see in the OVM ETH contract.
...
...
@@ -125,7 +125,11 @@ func MigrateLegacyETH(db ethdb.Database, addresses []common.Address, allowances
default
:
// Check if this slot is a variable. If it isn't, abort.
if
!
ignoredSlots
[
k
]
{
log
.
Crit
(
"missed storage key"
,
"k"
,
k
.
String
(),
"v"
,
v
.
String
())
if
noCheck
{
log
.
Error
(
"missed storage key"
,
"k"
,
k
.
String
(),
"v"
,
v
.
String
())
}
else
{
log
.
Crit
(
"missed storage key"
,
"k"
,
k
.
String
(),
"v"
,
v
.
String
())
}
}
}
...
...
@@ -137,13 +141,23 @@ func MigrateLegacyETH(db ethdb.Database, addresses []common.Address, allowances
// had supply bugs.
delta
:=
new
(
big
.
Int
)
.
Sub
(
totalSupply
,
totalFound
)
if
delta
.
Cmp
(
params
.
ExpectedSupplyDelta
)
!=
0
{
log
.
Crit
(
"supply mismatch"
,
"migrated"
,
totalFound
.
String
(),
"supply"
,
totalSupply
.
String
(),
"delta"
,
delta
.
String
(),
"exp_delta"
,
params
.
ExpectedSupplyDelta
.
String
(),
)
if
noCheck
{
log
.
Error
(
"supply mismatch"
,
"migrated"
,
totalFound
.
String
(),
"supply"
,
totalSupply
.
String
(),
"delta"
,
delta
.
String
(),
"exp_delta"
,
params
.
ExpectedSupplyDelta
.
String
(),
)
}
else
{
log
.
Crit
(
"supply mismatch"
,
"migrated"
,
totalFound
.
String
(),
"supply"
,
totalSupply
.
String
(),
"delta"
,
delta
.
String
(),
"exp_delta"
,
params
.
ExpectedSupplyDelta
.
String
(),
)
}
}
log
.
Info
(
...
...
@@ -181,7 +195,11 @@ func MigrateLegacyETH(db ethdb.Database, addresses []common.Address, allowances
// No accounts should have a balance in state. If they do, bail.
if
data
.
Balance
.
Sign
()
>
0
{
log
.
Crit
(
"account has non-zero balance in state - should never happen"
,
"addr"
,
addr
)
if
noCheck
{
log
.
Error
(
"account has non-zero balance in state - should never happen"
,
"addr"
,
addr
)
}
else
{
log
.
Crit
(
"account has non-zero balance in state - should never happen"
,
"addr"
,
addr
)
}
}
// Actually perform the migration by setting the appropriate values in state.
...
...
@@ -214,11 +232,19 @@ func MigrateLegacyETH(db ethdb.Database, addresses []common.Address, allowances
// Make sure that the amount we migrated matches the amount in
// our original state.
if
totalMigrated
.
Cmp
(
totalFound
)
!=
0
{
log
.
Crit
(
"total migrated does not equal total OVM eth found"
,
"migrated"
,
totalMigrated
,
"found"
,
totalFound
,
)
if
noCheck
{
log
.
Debug
(
"total migrated does not equal total OVM eth found"
,
"migrated"
,
totalMigrated
,
"found"
,
totalFound
,
)
}
else
{
log
.
Crit
(
"total migrated does not equal total OVM eth found"
,
"migrated"
,
totalMigrated
,
"found"
,
totalFound
,
)
}
}
// Set the total supply to 0
...
...
op-chain-ops/genesis/db_migration.go
View file @
1743dba4
...
...
@@ -119,7 +119,7 @@ func MigrateDB(ldb ethdb.Database, config *DeployConfig, l1Block *types.Block, m
log
.
Info
(
"Starting to migrate ERC20 ETH"
)
addrs
:=
migrationData
.
Addresses
()
newRoot
,
err
:=
ether
.
MigrateLegacyETH
(
ldb
,
addrs
,
migrationData
.
OvmAllowances
,
int
(
config
.
L1ChainID
),
commit
)
newRoot
,
err
:=
ether
.
MigrateLegacyETH
(
ldb
,
addrs
,
migrationData
.
OvmAllowances
,
int
(
config
.
L1ChainID
),
commit
,
noCheck
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"cannot migrate legacy eth: %w"
,
err
)
}
...
...
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