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
6f445b2f
Commit
6f445b2f
authored
Mar 07, 2023
by
Joshua Gutow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
batch_decoder: Attempt to parse frames
parent
ff947801
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
3 deletions
+27
-3
fetch.go
op-node/cmd/batch_decoder/fetch/fetch.go
+22
-3
params.go
op-node/rollup/derive/params.go
+5
-0
No files found.
op-node/cmd/batch_decoder/fetch/fetch.go
View file @
6f445b2f
...
...
@@ -10,6 +10,7 @@ import (
"path"
"time"
"github.com/ethereum-optimism/optimism/op-node/rollup/derive"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
...
...
@@ -23,6 +24,9 @@ type TransactionWithMeta struct {
ChainId
uint64
`json:"chain_id"`
Sender
common
.
Address
`json:"sender"`
ValidSender
bool
`json:"valid_sender"`
Frames
[]
derive
.
Frame
`json:"frames"`
FrameErr
string
`json:"frame_parse_error"`
ValidFrames
bool
`json:"valid_data"`
Tx
*
types
.
Transaction
`json:"tx"`
}
...
...
@@ -62,14 +66,26 @@ func fetchBatchesPerBlock(client *ethclient.Client, number *big.Int, signer type
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
va
r
validSender
bool
va
lidSender
:=
true
if
_
,
ok
:=
config
.
BatchSenders
[
sender
];
!
ok
{
fmt
.
Printf
(
"Found a transaction (%s) from an invalid sender (%s)
\n
"
,
tx
.
Hash
()
.
String
(),
sender
.
String
())
invalidBatchCount
+=
1
validSender
=
false
}
else
{
}
validFrames
:=
true
frameError
:=
""
frames
,
err
:=
derive
.
ParseFrames
(
tx
.
Data
())
if
err
!=
nil
{
fmt
.
Printf
(
"Found a transaction (%s) with invalid data: %v
\n
"
,
tx
.
Hash
()
.
String
(),
err
)
validFrames
=
false
frameError
=
err
.
Error
()
}
if
validSender
&&
validFrames
{
validBatchCount
+=
1
validSender
=
true
}
else
{
invalidBatchCount
+=
1
}
txm
:=
&
TransactionWithMeta
{
...
...
@@ -81,6 +97,9 @@ func fetchBatchesPerBlock(client *ethclient.Client, number *big.Int, signer type
BlockHash
:
block
.
Hash
(),
ChainId
:
config
.
ChainID
.
Uint64
(),
InboxAddr
:
config
.
BatchInbox
,
Frames
:
frames
,
FrameErr
:
frameError
,
ValidFrames
:
validFrames
,
}
filename
:=
path
.
Join
(
config
.
OutDirectory
,
fmt
.
Sprintf
(
"%s.json"
,
tx
.
Hash
()
.
String
()))
file
,
err
:=
os
.
Create
(
filename
)
...
...
op-node/rollup/derive/params.go
View file @
6f445b2f
package
derive
import
(
"encoding/json"
"errors"
"fmt"
)
...
...
@@ -44,3 +45,7 @@ func (id ChannelID) String() string {
func
(
id
ChannelID
)
TerminalString
()
string
{
return
fmt
.
Sprintf
(
"%x..%x"
,
id
[
:
3
],
id
[
13
:
])
}
func
(
id
ChannelID
)
MarshalJSON
()
([]
byte
,
error
)
{
return
json
.
Marshal
(
id
.
String
())
}
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