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
5637410e
Commit
5637410e
authored
Nov 06, 2023
by
Joshua Gutow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-chain-ops: Better handle 1559 case
parent
cd156ff9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
27 deletions
+19
-27
main.go
op-chain-ops/cmd/check-canyon/main.go
+19
-27
No files found.
op-chain-ops/cmd/check-canyon/main.go
View file @
5637410e
...
...
@@ -139,11 +139,6 @@ func Validate1559Params(ctx Args, canyonActive bool) error {
return
err
}
if
block
.
BaseFee
()
.
Cmp
(
big
.
NewInt
(
1000
))
<
0
{
log
.
Info
(
"Basefee to low to properly validate"
,
"basefee"
,
block
.
BaseFee
())
return
nil
}
parent
,
err
:=
ctx
.
Client
.
InfoByNumber
(
context
.
Background
(),
ctx
.
Number
-
1
)
if
err
!=
nil
{
return
err
...
...
@@ -194,29 +189,19 @@ func ValidateCreate2Deployer(ctx Args, canyonActive bool) error {
}
// CheckActivation takes a function f which determines in a specific block follows the rules of a fork.
// forkActivated tells `f` if the fork is active or not. `f` is called twice: First to validate that
// there is no error when checking the new value and second to validate the it returns an error when
// attempting to validate the block against the opposite of what is is.
// If any error is encountered, valid is set to false.
func
CheckActivation
(
f
func
(
Args
,
bool
)
error
,
ctx
Args
,
forkActivated
bool
,
valid
*
bool
)
{
if
forkActivated
{
if
err
:=
f
(
ctx
,
true
);
err
!=
nil
{
log
.
Error
(
"Pre-state was invalid when it was expected to be valid"
,
"err"
,
err
)
*
valid
=
false
}
if
err
:=
f
(
ctx
,
false
);
err
==
nil
{
log
.
Error
(
"Post-state was valid when it was expected to be invalid"
)
*
valid
=
false
}
}
else
{
if
err
:=
f
(
ctx
,
true
);
err
==
nil
{
log
.
Error
(
"Pre-state was valid when it was expected to be invalid"
)
*
valid
=
false
}
if
err
:=
f
(
ctx
,
false
);
err
!=
nil
{
log
.
Error
(
"Post-state was invalid when it was expected to be valid"
,
"err"
,
err
)
*
valid
=
false
}
if
err
:=
f
(
ctx
,
forkActivated
);
err
!=
nil
{
log
.
Error
(
"Block did not follow fork rules"
,
"err"
,
err
)
*
valid
=
false
}
}
// CheckInactivation takes a function f which determines in a specific block follows the rules of a fork.
// It passes the oppose value of forkActivated & asserts that an error is returned.
func
CheckInactivation
(
f
func
(
Args
,
bool
)
error
,
ctx
Args
,
forkActivated
bool
,
valid
*
bool
)
{
if
err
:=
f
(
ctx
,
!
forkActivated
);
err
==
nil
{
log
.
Error
(
"Block followed the wrong side of the fork rules"
)
*
valid
=
false
}
}
...
...
@@ -266,9 +251,16 @@ func main() {
}
CheckActivation
(
ValidateReceipts
,
ctx
,
canyonActive
,
&
valid
)
CheckInactivation
(
ValidateReceipts
,
ctx
,
canyonActive
,
&
valid
)
CheckActivation
(
Validate1559Params
,
ctx
,
canyonActive
,
&
valid
)
// Don't check in-activation for 1559 b/c at low basefees the two cannot be differentiated
CheckActivation
(
ValidateWithdrawals
,
ctx
,
canyonActive
,
&
valid
)
CheckInactivation
(
ValidateWithdrawals
,
ctx
,
canyonActive
,
&
valid
)
CheckActivation
(
ValidateCreate2Deployer
,
ctx
,
canyonActive
,
&
valid
)
CheckInactivation
(
ValidateCreate2Deployer
,
ctx
,
canyonActive
,
&
valid
)
if
!
valid
{
os
.
Exit
(
1
)
...
...
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