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
f49b5572
Commit
f49b5572
authored
Aug 17, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-chain-ops: fixup tests
parent
e1e87d51
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
layer_two_test.go
op-chain-ops/genesis/layer_two_test.go
+8
-2
setters.go
op-chain-ops/genesis/setters.go
+6
-1
No files found.
op-chain-ops/genesis/layer_two_test.go
View file @
f49b5572
...
...
@@ -66,6 +66,12 @@ func testBuildL2Genesis(t *testing.T, config *genesis.DeployConfig) *core.Genesi
}
}
// All of the precompile addresses should be funded with a single wei
for
i
:=
0
;
i
<
genesis
.
PrecompileCount
;
i
++
{
addr
:=
common
.
BytesToAddress
([]
byte
{
byte
(
i
)})
require
.
Equal
(
t
,
common
.
Big1
,
gen
.
Alloc
[
addr
]
.
Balance
)
}
if
writeFile
{
file
,
_
:=
json
.
MarshalIndent
(
gen
,
""
,
" "
)
_
=
os
.
WriteFile
(
"genesis.json"
,
file
,
0644
)
...
...
@@ -79,7 +85,7 @@ func TestBuildL2MainnetGenesis(t *testing.T) {
config
.
EnableGovernance
=
true
config
.
FundDevAccounts
=
false
gen
:=
testBuildL2Genesis
(
t
,
config
)
require
.
Equal
(
t
,
2
066
,
len
(
gen
.
Alloc
))
require
.
Equal
(
t
,
2
322
,
len
(
gen
.
Alloc
))
}
func
TestBuildL2MainnetNoGovernanceGenesis
(
t
*
testing
.
T
)
{
...
...
@@ -88,5 +94,5 @@ func TestBuildL2MainnetNoGovernanceGenesis(t *testing.T) {
config
.
EnableGovernance
=
false
config
.
FundDevAccounts
=
false
gen
:=
testBuildL2Genesis
(
t
,
config
)
require
.
Equal
(
t
,
2
066
,
len
(
gen
.
Alloc
))
require
.
Equal
(
t
,
2
322
,
len
(
gen
.
Alloc
))
}
op-chain-ops/genesis/setters.go
View file @
f49b5572
...
...
@@ -13,6 +13,11 @@ import (
"github.com/ethereum/go-ethereum/log"
)
// PrecompileCount represents the number of precompile addresses
// starting from `address(0)` to PrecompileCount that are funded
// with a single wei in the genesis state.
const
PrecompileCount
=
256
// FundDevAccounts will fund each of the development accounts.
func
FundDevAccounts
(
db
vm
.
StateDB
)
{
for
_
,
account
:=
range
DevAccounts
{
...
...
@@ -52,7 +57,7 @@ func setProxies(db vm.StateDB, proxyAdminAddr common.Address, namespace *big.Int
// This is an optimization to make calling them cheaper. This should only
// be used for devnets.
func
SetPrecompileBalances
(
db
vm
.
StateDB
)
{
for
i
:=
0
;
i
<
256
;
i
++
{
for
i
:=
0
;
i
<
PrecompileCount
;
i
++
{
addr
:=
common
.
BytesToAddress
([]
byte
{
byte
(
i
)})
db
.
CreateAccount
(
addr
)
db
.
AddBalance
(
addr
,
common
.
Big1
)
...
...
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