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
2718b756
Unverified
Commit
2718b756
authored
Aug 23, 2024
by
zhiqiangxu
Committed by
GitHub
Aug 23, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make forks more maintainable (#11510)
parent
4b84a4a0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
23 deletions
+38
-23
config.go
op-chain-ops/genesis/config.go
+36
-14
setup.go
op-e2e/setup.go
+2
-9
No files found.
op-chain-ops/genesis/config.go
View file @
2718b756
...
...
@@ -394,6 +394,37 @@ func (d *UpgradeScheduleDeployConfig) InteropTime(genesisTime uint64) *uint64 {
return
offsetToUpgradeTime
(
d
.
L2GenesisInteropTimeOffset
,
genesisTime
)
}
func
(
d
*
UpgradeScheduleDeployConfig
)
AllocMode
(
genesisTime
uint64
)
L2AllocsMode
{
forks
:=
d
.
forks
()
for
i
:=
len
(
forks
)
-
1
;
i
>=
0
;
i
--
{
if
forkTime
:=
offsetToUpgradeTime
(
forks
[
i
]
.
L2GenesisTimeOffset
,
genesisTime
);
forkTime
!=
nil
&&
*
forkTime
==
0
{
return
L2AllocsMode
(
forks
[
i
]
.
Name
)
}
// the oldest L2AllocsMode is delta
if
forks
[
i
]
.
Name
==
string
(
L2AllocsDelta
)
{
return
L2AllocsDelta
}
}
panic
(
"should never reach here"
)
}
type
Fork
struct
{
L2GenesisTimeOffset
*
hexutil
.
Uint64
Name
string
}
func
(
d
*
UpgradeScheduleDeployConfig
)
forks
()
[]
Fork
{
return
[]
Fork
{
{
L2GenesisTimeOffset
:
d
.
L2GenesisRegolithTimeOffset
,
Name
:
"regolith"
},
{
L2GenesisTimeOffset
:
d
.
L2GenesisCanyonTimeOffset
,
Name
:
"canyon"
},
{
L2GenesisTimeOffset
:
d
.
L2GenesisDeltaTimeOffset
,
Name
:
string
(
L2AllocsDelta
)},
{
L2GenesisTimeOffset
:
d
.
L2GenesisEcotoneTimeOffset
,
Name
:
string
(
L2AllocsEcotone
)},
{
L2GenesisTimeOffset
:
d
.
L2GenesisFjordTimeOffset
,
Name
:
string
(
L2AllocsFjord
)},
{
L2GenesisTimeOffset
:
d
.
L2GenesisGraniteTimeOffset
,
Name
:
string
(
L2AllocsGranite
)},
}
}
func
(
d
*
UpgradeScheduleDeployConfig
)
Check
(
log
log
.
Logger
)
error
{
// checkFork checks that fork A is before or at the same time as fork B
checkFork
:=
func
(
a
,
b
*
hexutil
.
Uint64
,
aName
,
bName
string
)
error
{
...
...
@@ -411,20 +442,11 @@ func (d *UpgradeScheduleDeployConfig) Check(log log.Logger) error {
}
return
nil
}
if
err
:=
checkFork
(
d
.
L2GenesisRegolithTimeOffset
,
d
.
L2GenesisCanyonTimeOffset
,
"regolith"
,
"canyon"
);
err
!=
nil
{
return
err
}
if
err
:=
checkFork
(
d
.
L2GenesisCanyonTimeOffset
,
d
.
L2GenesisDeltaTimeOffset
,
"canyon"
,
"delta"
);
err
!=
nil
{
return
err
}
if
err
:=
checkFork
(
d
.
L2GenesisDeltaTimeOffset
,
d
.
L2GenesisEcotoneTimeOffset
,
"delta"
,
"ecotone"
);
err
!=
nil
{
return
err
}
if
err
:=
checkFork
(
d
.
L2GenesisEcotoneTimeOffset
,
d
.
L2GenesisFjordTimeOffset
,
"ecotone"
,
"fjord"
);
err
!=
nil
{
return
err
}
if
err
:=
checkFork
(
d
.
L2GenesisFjordTimeOffset
,
d
.
L2GenesisGraniteTimeOffset
,
"fjord"
,
"granite"
);
err
!=
nil
{
return
err
forks
:=
d
.
forks
()
for
i
:=
0
;
i
<
len
(
forks
)
-
1
;
i
++
{
if
err
:=
checkFork
(
forks
[
i
]
.
L2GenesisTimeOffset
,
forks
[
i
+
1
]
.
L2GenesisTimeOffset
,
forks
[
i
]
.
Name
,
forks
[
i
+
1
]
.
Name
);
err
!=
nil
{
return
err
}
}
return
nil
}
...
...
op-e2e/setup.go
View file @
2718b756
...
...
@@ -556,15 +556,8 @@ func (cfg SystemConfig) Start(t *testing.T, _opts ...SystemConfigOption) (*Syste
}
l1Block
:=
l1Genesis
.
ToBlock
()
var
allocsMode
genesis
.
L2AllocsMode
allocsMode
=
genesis
.
L2AllocsDelta
if
graniteTime
:=
cfg
.
DeployConfig
.
GraniteTime
(
l1Block
.
Time
());
graniteTime
!=
nil
&&
*
graniteTime
<=
0
{
allocsMode
=
genesis
.
L2AllocsGranite
}
else
if
fjordTime
:=
cfg
.
DeployConfig
.
FjordTime
(
l1Block
.
Time
());
fjordTime
!=
nil
&&
*
fjordTime
<=
0
{
allocsMode
=
genesis
.
L2AllocsFjord
}
else
if
ecotoneTime
:=
cfg
.
DeployConfig
.
EcotoneTime
(
l1Block
.
Time
());
ecotoneTime
!=
nil
&&
*
ecotoneTime
<=
0
{
allocsMode
=
genesis
.
L2AllocsEcotone
}
allocsMode
:=
cfg
.
DeployConfig
.
AllocMode
(
l1Block
.
Time
())
t
.
Log
(
"Generating L2 genesis"
,
"l2_allocs_mode"
,
string
(
allocsMode
))
l2Allocs
:=
config
.
L2Allocs
(
allocsMode
)
l2Genesis
,
err
:=
genesis
.
BuildL2Genesis
(
cfg
.
DeployConfig
,
l2Allocs
,
l1Block
)
...
...
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