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
3e74ce78
Unverified
Commit
3e74ce78
authored
Mar 08, 2023
by
protolambda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-wheel: update OVM owners cheat-code for migration testing
parent
c35b6e39
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
6 deletions
+33
-6
cheat.go
op-wheel/cheat/cheat.go
+33
-6
No files found.
op-wheel/cheat/cheat.go
View file @
3e74ce78
...
@@ -17,6 +17,7 @@ import (
...
@@ -17,6 +17,7 @@ import (
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie"
"github.com/ethereum/go-ethereum/trie"
...
@@ -316,6 +317,7 @@ func StoragePatch(patch io.Reader, address common.Address) HeadFn {
...
@@ -316,6 +317,7 @@ func StoragePatch(patch io.Reader, address common.Address) HeadFn {
}
}
type
OvmOwnersConfig
struct
{
type
OvmOwnersConfig
struct
{
Network
string
`json:"network"`
Owner
common
.
Address
`json:"owner"`
Owner
common
.
Address
`json:"owner"`
Sequencer
common
.
Address
`json:"sequencer"`
Sequencer
common
.
Address
`json:"sequencer"`
Proposer
common
.
Address
`json:"proposer"`
Proposer
common
.
Address
`json:"proposer"`
...
@@ -323,17 +325,42 @@ type OvmOwnersConfig struct {
...
@@ -323,17 +325,42 @@ type OvmOwnersConfig struct {
func
OvmOwners
(
conf
*
OvmOwnersConfig
)
HeadFn
{
func
OvmOwners
(
conf
*
OvmOwnersConfig
)
HeadFn
{
return
func
(
headState
*
state
.
StateDB
)
error
{
return
func
(
headState
*
state
.
StateDB
)
error
{
var
addressManager
common
.
Address
// Lib_AddressManager
var
l1SBProxy
common
.
Address
// Proxy__OVM_L1StandardBridge
var
l1XDMProxy
common
.
Address
// Proxy__OVM_L1CrossDomainMessenger
var
l1ERC721BridgeProxy
common
.
Address
switch
conf
.
Network
{
case
"mainnet"
:
addressManager
=
common
.
HexToAddress
(
"0xdE1FCfB0851916CA5101820A69b13a4E276bd81F"
)
l1SBProxy
=
common
.
HexToAddress
(
"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"
)
l1XDMProxy
=
common
.
HexToAddress
(
"0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1"
)
l1ERC721BridgeProxy
=
common
.
HexToAddress
(
"0x5a7749f83b81B301cAb5f48EB8516B986DAef23D"
)
case
"goerli"
:
addressManager
=
common
.
HexToAddress
(
"0xa6f73589243a6A7a9023b1Fa0651b1d89c177111"
)
l1SBProxy
=
common
.
HexToAddress
(
"0x636Af16bf2f682dD3109e60102b8E1A089FedAa8"
)
l1XDMProxy
=
common
.
HexToAddress
(
"0x5086d1eEF304eb5284A0f6720f79403b4e9bE294"
)
l1ERC721BridgeProxy
=
common
.
HexToAddress
(
"0x8DD330DdE8D9898d43b4dc840Da27A07dF91b3c9"
)
default
:
return
fmt
.
Errorf
(
"unknown network: %q"
,
conf
.
Network
)
}
// See Proxy.sol OWNER_KEY: https://eips.ethereum.org/EIPS/eip-1967#admin-address
ownerSlot
:=
common
.
HexToHash
(
"0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103"
)
// Address manager owner
// Address manager owner
headState
.
SetState
(
common
.
HexToAddress
(
"0xa6f73589243a6A7a9023b1Fa0651b1d89c177111"
),
common
.
Hash
{},
conf
.
Owner
.
Hash
())
// Ownable, first storage slot
headState
.
SetState
(
addressManager
,
common
.
Hash
{},
conf
.
Owner
.
Hash
())
// L1SB proxy owner
// L1SB proxy owner
headState
.
SetState
(
common
.
HexToAddress
(
"0x636Af16bf2f682dD3109e60102b8E1A089FedAa8"
),
common
.
HexToHash
(
"0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103"
)
,
conf
.
Owner
.
Hash
())
headState
.
SetState
(
l1SBProxy
,
ownerSlot
,
conf
.
Owner
.
Hash
())
// L1XDM owner
// L1XDM owner
headState
.
SetState
(
common
.
HexToAddress
(
"0x5086d1eEF304eb5284A0f6720f79403b4e9bE294"
),
common
.
Hash
{
31
:
0x33
},
conf
.
Owner
.
Hash
())
// 0x33 = 51. L1CrossDomainMessenger is L1CrossDomainMessenger (0) Lib_AddressResolver (1) OwnableUpgradeable (1, but covered by gap) + ContextUpgradeable (special gap of 50) and then _owner
headState
.
SetState
(
l1XDMProxy
,
common
.
Hash
{
31
:
0x33
},
conf
.
Owner
.
Hash
())
// L1 ERC721 bridge owner
// L1 ERC721 bridge owner
headState
.
SetState
(
common
.
HexToAddress
(
"0x8DD330DdE8D9898d43b4dc840Da27A07dF91b3c9"
),
common
.
HexToHash
(
"0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103"
)
,
conf
.
Owner
.
Hash
())
headState
.
SetState
(
l1ERC721BridgeProxy
,
ownerSlot
,
conf
.
Owner
.
Hash
())
// Legacy sequencer/proposer addresses
// Legacy sequencer/proposer addresses
headState
.
SetState
(
common
.
HexToAddress
(
"0xa6f73589243a6A7a9023b1Fa0651b1d89c177111"
),
common
.
HexToHash
(
"0x2e0dfce60e9e27f035ce28f63c1bdd77cff6b13d8909da4d81d623ff9123fbdc"
),
conf
.
Sequencer
.
Hash
())
// See AddressManager.sol "addresses" mapping(bytes32 => address), at slot position 1
headState
.
SetState
(
common
.
HexToAddress
(
"0xa6f73589243a6A7a9023b1Fa0651b1d89c177111"
),
common
.
HexToHash
(
"0x9776dbdebd0d5eedaea450b21da9901ecd5254e5136a3a9b7b0ecd532734d5b5"
),
conf
.
Proposer
.
Hash
())
addressesSlot
:=
common
.
BigToHash
(
big
.
NewInt
(
1
))
headState
.
SetState
(
addressManager
,
crypto
.
Keccak256Hash
(
crypto
.
Keccak256
([]
byte
(
"OVM_Sequencer"
)),
addressesSlot
.
Bytes
()),
conf
.
Sequencer
.
Hash
())
headState
.
SetState
(
addressManager
,
crypto
.
Keccak256Hash
(
crypto
.
Keccak256
([]
byte
(
"OVM_Proposer"
)),
addressesSlot
.
Bytes
()),
conf
.
Proposer
.
Hash
())
// Fund sequencer and proposer with 100 ETH
// Fund sequencer and proposer with 100 ETH
headState
.
SetBalance
(
conf
.
Sequencer
,
HundredETH
)
headState
.
SetBalance
(
conf
.
Sequencer
,
HundredETH
)
headState
.
SetBalance
(
conf
.
Proposer
,
HundredETH
)
headState
.
SetBalance
(
conf
.
Proposer
,
HundredETH
)
...
...
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