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
86632a52
Commit
86632a52
authored
Feb 06, 2023
by
Joshua Gutow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
op-node: Log on L1 Info deposit mismatch
parent
0bf643c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
2 deletions
+38
-2
engine_consolidate.go
op-node/rollup/derive/engine_consolidate.go
+37
-1
engine_queue.go
op-node/rollup/derive/engine_queue.go
+1
-1
No files found.
op-node/rollup/derive/engine_consolidate.go
View file @
86632a52
...
...
@@ -5,13 +5,16 @@ import (
"fmt"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum-optimism/optimism/op-node/eth"
)
// AttributesMatchBlock checks if the L2 attributes pre-inputs match the output
// nil if it is a match. If err is not nil, the error contains the reason for the mismatch
func
AttributesMatchBlock
(
attrs
*
eth
.
PayloadAttributes
,
parentHash
common
.
Hash
,
block
*
eth
.
ExecutionPayload
)
error
{
func
AttributesMatchBlock
(
attrs
*
eth
.
PayloadAttributes
,
parentHash
common
.
Hash
,
block
*
eth
.
ExecutionPayload
,
l
log
.
Logger
)
error
{
if
parentHash
!=
block
.
ParentHash
{
return
fmt
.
Errorf
(
"parent hash field does not match. expected: %v. got: %v"
,
parentHash
,
block
.
ParentHash
)
}
...
...
@@ -26,6 +29,9 @@ func AttributesMatchBlock(attrs *eth.PayloadAttributes, parentHash common.Hash,
}
for
i
,
otx
:=
range
attrs
.
Transactions
{
if
expect
:=
block
.
Transactions
[
i
];
!
bytes
.
Equal
(
otx
,
expect
)
{
if
i
==
0
{
logL1InfoTxns
(
l
,
uint64
(
block
.
BlockNumber
),
uint64
(
block
.
Timestamp
),
otx
,
block
.
Transactions
[
i
])
}
return
fmt
.
Errorf
(
"transaction %d does not match. expected: %v. got: %v"
,
i
,
expect
,
otx
)
}
}
...
...
@@ -37,3 +43,33 @@ func AttributesMatchBlock(attrs *eth.PayloadAttributes, parentHash common.Hash,
}
return
nil
}
// logL1InfoTxns reports the values from the L1 info tx when they differ to aid
// debugging. This check is the one that has been most frequently triggered.
func
logL1InfoTxns
(
l
log
.
Logger
,
l2Number
,
l2Timestamp
uint64
,
safeTx
,
unsafeTx
hexutil
.
Bytes
)
{
// First decode into *types.Transaction to get the tx data.
var
safeTxValue
,
unsafeTxValue
types
.
Transaction
errSafe
:=
(
&
safeTxValue
)
.
UnmarshalBinary
(
safeTx
)
errUnsafe
:=
(
&
unsafeTxValue
)
.
UnmarshalBinary
(
unsafeTx
)
if
errSafe
!=
nil
||
errUnsafe
!=
nil
{
l
.
Error
(
"failed to umarshal tx"
,
"errSafe"
,
errSafe
,
"errUnsafe"
,
errUnsafe
)
}
// Then decode the ABI encoded parameters
var
safeInfo
,
unsafeInfo
L1BlockInfo
errSafe
=
(
&
safeInfo
)
.
UnmarshalBinary
(
safeTxValue
.
Data
())
errUnsafe
=
(
&
unsafeInfo
)
.
UnmarshalBinary
(
unsafeTxValue
.
Data
())
if
errSafe
!=
nil
||
errUnsafe
!=
nil
{
l
.
Error
(
"failed to umarshal l1 info"
,
"errSafe"
,
errSafe
,
"errUnsafe"
,
errUnsafe
)
}
l
.
Error
(
"L1 Info transaction differs"
,
"number"
,
l2Number
,
"time"
,
l2Timestamp
,
"safe_l1_number"
,
safeInfo
.
Number
,
"safe_l1_hash"
,
safeInfo
.
BlockHash
,
"safe_l1_time"
,
safeInfo
.
Time
,
"safe_seq_num"
,
safeInfo
.
SequenceNumber
,
"safe_l1_basefee"
,
safeInfo
.
BaseFee
,
"safe_batcher_add"
,
safeInfo
.
BlockHash
,
"safe_gpo_scalar"
,
safeInfo
.
L1FeeScalar
,
"safe_gpo_overhead"
,
safeInfo
.
L1FeeOverhead
,
"unsafe_l1_number"
,
unsafeInfo
.
Number
,
"unsafe_l1_hash"
,
unsafeInfo
.
BlockHash
,
"unsafe_l1_time"
,
unsafeInfo
.
Time
,
"unsafe_seq_num"
,
unsafeInfo
.
SequenceNumber
,
"unsafe_l1_basefee"
,
unsafeInfo
.
BaseFee
,
"unsafe_batcher_add"
,
unsafeInfo
.
BlockHash
,
"unsafe_gpo_scalar"
,
unsafeInfo
.
L1FeeScalar
,
"unsafe_gpo_overhead"
,
unsafeInfo
.
L1FeeOverhead
)
}
op-node/rollup/derive/engine_queue.go
View file @
86632a52
...
...
@@ -422,7 +422,7 @@ func (eq *EngineQueue) consolidateNextSafeAttributes(ctx context.Context) error
}
return
NewTemporaryError
(
fmt
.
Errorf
(
"failed to get existing unsafe payload to compare against derived attributes from L1: %w"
,
err
))
}
if
err
:=
AttributesMatchBlock
(
eq
.
safeAttributes
[
0
],
eq
.
safeHead
.
Hash
,
payload
);
err
!=
nil
{
if
err
:=
AttributesMatchBlock
(
eq
.
safeAttributes
[
0
],
eq
.
safeHead
.
Hash
,
payload
,
eq
.
log
);
err
!=
nil
{
eq
.
log
.
Warn
(
"L2 reorg: existing unsafe block does not match derived attributes from L1"
,
"err"
,
err
)
// geth cannot wind back a chain without reorging to a new, previously non-canonical, block
return
eq
.
forceNextSafeAttributes
(
ctx
)
...
...
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