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
47e58e44
Unverified
Commit
47e58e44
authored
Oct 28, 2022
by
mergify[bot]
Committed by
GitHub
Oct 28, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into jg/split_batch_submitter
parents
0f63b191
7ad4ed3d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
326 deletions
+14
-326
big-starfishes-jump.md
.changeset/big-starfishes-jump.md
+5
-0
main.go
op-chain-ops/cmd/migrate/main.go
+9
-12
wrapped_db.go
op-chain-ops/state/wrapped_db.go
+0
-313
package.json
package.json
+0
-1
2022_10_Drippie_Spearbit.pdf
...l-documents/security-reviews/2022_10_Drippie_Spearbit.pdf
+0
-0
No files found.
.changeset/big-starfishes-jump.md
0 → 100644
View file @
47e58e44
---
'
@eth-optimism/core-utils'
:
minor
---
Changes the type for Bedrock withdrawal proofs
op-chain-ops/cmd/migrate/main.go
View file @
47e58e44
...
...
@@ -7,13 +7,13 @@ import (
"path/filepath"
"strings"
"github.com/ethereum-optimism/optimism/l2geth/core/rawdb"
"github.com/ethereum-optimism/optimism/l2geth/core/state"
"github.com/ethereum-optimism/optimism/l2geth/log"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-bindings/hardhat"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
op_state
"github.com/ethereum-optimism/optimism/op-chain-ops/state
"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis
"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/mattn/go-isatty"
...
...
@@ -137,7 +137,8 @@ func main() {
}
chaindataPath
:=
filepath
.
Join
(
ctx
.
String
(
"db-path"
),
"geth"
,
"chaindata"
)
ldb
,
err
:=
rawdb
.
NewLevelDBDatabase
(
chaindataPath
,
1024
,
64
,
""
)
ancientPath
:=
filepath
.
Join
(
ctx
.
String
(
"db-path"
),
"ancient"
)
ldb
,
err
:=
rawdb
.
NewLevelDBDatabaseWithFreezer
(
chaindataPath
,
int
(
1024
),
int
(
60
),
ancientPath
,
""
,
true
)
if
err
!=
nil
{
return
err
}
...
...
@@ -149,11 +150,7 @@ func main() {
num
:=
rawdb
.
ReadHeaderNumber
(
ldb
,
hash
)
header
:=
rawdb
.
ReadHeader
(
ldb
,
hash
,
*
num
)
sdb
,
err
:=
state
.
New
(
header
.
Root
,
state
.
NewDatabase
(
ldb
))
if
err
!=
nil
{
return
err
}
wrappedDB
,
err
:=
op_state
.
NewWrappedStateDB
(
nil
,
sdb
)
sdb
,
err
:=
state
.
New
(
header
.
Root
,
state
.
NewDatabase
(
ldb
),
nil
)
if
err
!=
nil
{
return
err
}
...
...
@@ -179,7 +176,7 @@ func main() {
L1ERC721BridgeProxy
:
l1ERC721BridgeProxyDeployment
.
Address
,
}
if
err
:=
genesis
.
MigrateDB
(
wrappedDB
,
config
,
block
,
&
l2Addrs
,
&
migrationData
);
err
!=
nil
{
if
err
:=
genesis
.
MigrateDB
(
sdb
,
config
,
block
,
&
l2Addrs
,
&
migrationData
);
err
!=
nil
{
return
err
}
...
...
op-chain-ops/state/wrapped_db.go
deleted
100644 → 0
View file @
0f63b191
package
state
import
(
"errors"
"math/big"
lcommon
"github.com/ethereum-optimism/optimism/l2geth/common"
lstate
"github.com/ethereum-optimism/optimism/l2geth/core/state"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
)
// WrappedStateDB wraps both the StateDB types from l2geth and upstream geth.
// This allows for a l2geth StateDB to be passed to functions that expect an
// upstream geth StateDB.
type
WrappedStateDB
struct
{
statedb
*
state
.
StateDB
legacyStatedb
*
lstate
.
StateDB
}
// NewWrappedStateDB will create a WrappedStateDB. It can wrap either an
// upstream geth database or a legacy l2geth database.
func
NewWrappedStateDB
(
statedb
*
state
.
StateDB
,
legacyStatedb
*
lstate
.
StateDB
)
(
*
WrappedStateDB
,
error
)
{
if
statedb
==
nil
&&
legacyStatedb
==
nil
{
return
nil
,
errors
.
New
(
"must pass at least 1 database"
)
}
if
statedb
!=
nil
&&
legacyStatedb
!=
nil
{
return
nil
,
errors
.
New
(
"cannot pass both databases"
)
}
return
&
WrappedStateDB
{
statedb
:
statedb
,
legacyStatedb
:
legacyStatedb
,
},
nil
}
func
(
w
*
WrappedStateDB
)
CreateAccount
(
addr
common
.
Address
)
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
w
.
legacyStatedb
.
CreateAccount
(
address
)
}
else
{
w
.
statedb
.
CreateAccount
(
addr
)
}
}
func
(
w
*
WrappedStateDB
)
SubBalance
(
addr
common
.
Address
,
value
*
big
.
Int
)
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
w
.
legacyStatedb
.
SubBalance
(
address
,
value
)
}
else
{
w
.
statedb
.
SubBalance
(
addr
,
value
)
}
}
func
(
w
*
WrappedStateDB
)
AddBalance
(
addr
common
.
Address
,
value
*
big
.
Int
)
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
w
.
legacyStatedb
.
AddBalance
(
address
,
value
)
}
else
{
w
.
statedb
.
AddBalance
(
addr
,
value
)
}
}
func
(
w
*
WrappedStateDB
)
GetBalance
(
addr
common
.
Address
)
*
big
.
Int
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
return
w
.
legacyStatedb
.
GetBalance
(
address
)
}
else
{
return
w
.
statedb
.
GetBalance
(
addr
)
}
}
func
(
w
*
WrappedStateDB
)
GetNonce
(
addr
common
.
Address
)
uint64
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
return
w
.
legacyStatedb
.
GetNonce
(
address
)
}
else
{
return
w
.
statedb
.
GetNonce
(
addr
)
}
}
func
(
w
*
WrappedStateDB
)
SetNonce
(
addr
common
.
Address
,
nonce
uint64
)
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
w
.
legacyStatedb
.
SetNonce
(
address
,
nonce
)
}
else
{
w
.
statedb
.
SetNonce
(
addr
,
nonce
)
}
}
func
(
w
*
WrappedStateDB
)
GetCodeHash
(
addr
common
.
Address
)
common
.
Hash
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
hash
:=
w
.
legacyStatedb
.
GetCodeHash
(
address
)
return
common
.
BytesToHash
(
hash
.
Bytes
())
}
else
{
return
w
.
statedb
.
GetCodeHash
(
addr
)
}
}
func
(
w
*
WrappedStateDB
)
GetCode
(
addr
common
.
Address
)
[]
byte
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
return
w
.
legacyStatedb
.
GetCode
(
address
)
}
else
{
return
w
.
statedb
.
GetCode
(
addr
)
}
}
func
(
w
*
WrappedStateDB
)
SetCode
(
addr
common
.
Address
,
code
[]
byte
)
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
w
.
legacyStatedb
.
SetCode
(
address
,
code
)
}
else
{
w
.
statedb
.
SetCode
(
addr
,
code
)
}
}
func
(
w
*
WrappedStateDB
)
GetCodeSize
(
addr
common
.
Address
)
int
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
return
w
.
legacyStatedb
.
GetCodeSize
(
address
)
}
else
{
return
w
.
statedb
.
GetCodeSize
(
addr
)
}
}
func
(
w
*
WrappedStateDB
)
AddRefund
(
refund
uint64
)
{
if
w
.
legacyStatedb
!=
nil
{
w
.
legacyStatedb
.
AddRefund
(
refund
)
}
else
{
w
.
statedb
.
AddRefund
(
refund
)
}
}
func
(
w
*
WrappedStateDB
)
SubRefund
(
refund
uint64
)
{
if
w
.
legacyStatedb
!=
nil
{
w
.
legacyStatedb
.
SubRefund
(
refund
)
}
else
{
w
.
statedb
.
SubRefund
(
refund
)
}
}
func
(
w
*
WrappedStateDB
)
GetRefund
()
uint64
{
if
w
.
legacyStatedb
!=
nil
{
return
w
.
legacyStatedb
.
GetRefund
()
}
else
{
return
w
.
statedb
.
GetRefund
()
}
}
func
(
w
*
WrappedStateDB
)
GetCommittedState
(
addr
common
.
Address
,
key
common
.
Hash
)
common
.
Hash
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
lkey
:=
lcommon
.
BytesToHash
(
key
.
Bytes
())
value
:=
w
.
legacyStatedb
.
GetCommittedState
(
address
,
lkey
)
return
common
.
BytesToHash
(
value
.
Bytes
())
}
else
{
return
w
.
statedb
.
GetCommittedState
(
addr
,
key
)
}
}
func
(
w
*
WrappedStateDB
)
GetState
(
addr
common
.
Address
,
key
common
.
Hash
)
common
.
Hash
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
lkey
:=
lcommon
.
BytesToHash
(
key
.
Bytes
())
value
:=
w
.
legacyStatedb
.
GetState
(
address
,
lkey
)
return
common
.
BytesToHash
(
value
.
Bytes
())
}
else
{
return
w
.
statedb
.
GetState
(
addr
,
key
)
}
}
func
(
w
*
WrappedStateDB
)
SetState
(
addr
common
.
Address
,
key
,
value
common
.
Hash
)
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
lkey
:=
lcommon
.
BytesToHash
(
key
.
Bytes
())
lvalue
:=
lcommon
.
BytesToHash
(
value
.
Bytes
())
w
.
legacyStatedb
.
SetState
(
address
,
lkey
,
lvalue
)
}
else
{
w
.
statedb
.
SetState
(
addr
,
key
,
value
)
}
}
func
(
w
*
WrappedStateDB
)
Suicide
(
addr
common
.
Address
)
bool
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
return
w
.
legacyStatedb
.
Suicide
(
address
)
}
else
{
return
w
.
statedb
.
Suicide
(
addr
)
}
}
func
(
w
*
WrappedStateDB
)
HasSuicided
(
addr
common
.
Address
)
bool
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
return
w
.
legacyStatedb
.
HasSuicided
(
address
)
}
else
{
return
w
.
statedb
.
HasSuicided
(
addr
)
}
}
func
(
w
*
WrappedStateDB
)
Exist
(
addr
common
.
Address
)
bool
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
return
w
.
legacyStatedb
.
Exist
(
address
)
}
else
{
return
w
.
statedb
.
Exist
(
addr
)
}
}
func
(
w
*
WrappedStateDB
)
Empty
(
addr
common
.
Address
)
bool
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
return
w
.
legacyStatedb
.
Empty
(
address
)
}
else
{
return
w
.
statedb
.
Empty
(
addr
)
}
}
func
(
w
*
WrappedStateDB
)
PrepareAccessList
(
sender
common
.
Address
,
dest
*
common
.
Address
,
precompiles
[]
common
.
Address
,
txAccesses
types
.
AccessList
)
{
if
w
.
legacyStatedb
!=
nil
{
panic
(
"PrepareAccessList unimplemented"
)
}
else
{
w
.
statedb
.
PrepareAccessList
(
sender
,
dest
,
precompiles
,
txAccesses
)
}
}
func
(
w
*
WrappedStateDB
)
AddressInAccessList
(
addr
common
.
Address
)
bool
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
return
w
.
legacyStatedb
.
AddressInAccessList
(
address
)
}
else
{
return
w
.
statedb
.
AddressInAccessList
(
addr
)
}
}
func
(
w
*
WrappedStateDB
)
SlotInAccessList
(
addr
common
.
Address
,
slot
common
.
Hash
)
(
addressOk
bool
,
slotOk
bool
)
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
lslot
:=
lcommon
.
BytesToHash
(
slot
.
Bytes
())
return
w
.
legacyStatedb
.
SlotInAccessList
(
address
,
lslot
)
}
else
{
return
w
.
statedb
.
SlotInAccessList
(
addr
,
slot
)
}
}
func
(
w
*
WrappedStateDB
)
AddAddressToAccessList
(
addr
common
.
Address
)
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
w
.
legacyStatedb
.
AddAddressToAccessList
(
address
)
}
else
{
w
.
statedb
.
AddAddressToAccessList
(
addr
)
}
}
func
(
w
*
WrappedStateDB
)
AddSlotToAccessList
(
addr
common
.
Address
,
slot
common
.
Hash
)
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
lslot
:=
lcommon
.
BytesToHash
(
slot
.
Bytes
())
w
.
legacyStatedb
.
AddSlotToAccessList
(
address
,
lslot
)
}
else
{
w
.
statedb
.
AddSlotToAccessList
(
addr
,
slot
)
}
}
func
(
w
*
WrappedStateDB
)
RevertToSnapshot
(
snapshot
int
)
{
if
w
.
legacyStatedb
!=
nil
{
w
.
legacyStatedb
.
RevertToSnapshot
(
snapshot
)
}
else
{
w
.
statedb
.
RevertToSnapshot
(
snapshot
)
}
}
func
(
w
*
WrappedStateDB
)
Snapshot
()
int
{
if
w
.
legacyStatedb
!=
nil
{
return
w
.
legacyStatedb
.
Snapshot
()
}
else
{
return
w
.
statedb
.
Snapshot
()
}
}
func
(
w
*
WrappedStateDB
)
AddLog
(
log
*
types
.
Log
)
{
if
w
.
legacyStatedb
!=
nil
{
panic
(
"AddLog unimplemented"
)
}
else
{
w
.
statedb
.
AddLog
(
log
)
}
}
func
(
w
*
WrappedStateDB
)
AddPreimage
(
hash
common
.
Hash
,
preimage
[]
byte
)
{
if
w
.
legacyStatedb
!=
nil
{
lhash
:=
lcommon
.
BytesToHash
(
hash
.
Bytes
())
w
.
legacyStatedb
.
AddPreimage
(
lhash
,
preimage
)
}
else
{
w
.
statedb
.
AddPreimage
(
hash
,
preimage
)
}
}
func
(
w
*
WrappedStateDB
)
ForEachStorage
(
addr
common
.
Address
,
cb
func
(
common
.
Hash
,
common
.
Hash
)
bool
)
error
{
if
w
.
legacyStatedb
!=
nil
{
address
:=
lcommon
.
BytesToAddress
(
addr
.
Bytes
())
return
w
.
legacyStatedb
.
ForEachStorage
(
address
,
func
(
lkey
,
lvalue
lcommon
.
Hash
)
bool
{
key
:=
common
.
BytesToHash
(
lkey
.
Bytes
())
value
:=
common
.
BytesToHash
(
lvalue
.
Bytes
())
return
cb
(
key
,
value
)
})
}
else
{
return
w
.
statedb
.
ForEachStorage
(
addr
,
cb
)
}
}
package.json
View file @
47e58e44
...
...
@@ -29,7 +29,6 @@
"@eth-optimism/contracts-bedrock/ds-test"
,
"@eth-optimism/contracts-bedrock/forge-std"
,
"@eth-optimism/contracts-bedrock/@rari-capital/solmate"
,
"@eth-optimism/contracts-bedrock/excessively-safe-call"
,
"@eth-optimism/contracts-bedrock/@openzeppelin/contracts"
,
"@eth-optimism/contracts-bedrock/@openzeppelin/contracts-upgradeable"
,
"@eth-optimism/contracts-periphery/ds-test"
,
...
...
technical-documents/security-reviews/2022_10_Drippie_Spearbit.pdf
0 → 100644
View file @
47e58e44
File added
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