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
63aa42e9
Unverified
Commit
63aa42e9
authored
Mar 08, 2023
by
mergify[bot]
Committed by
GitHub
Mar 08, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5074 from ethereum-optimism/jg/json_encode_frames
op-node/derivation: JSON Encoding for Frames
parents
1786f370
30fdff6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
frame.go
op-node/rollup/derive/frame.go
+4
-4
params.go
op-node/rollup/derive/params.go
+15
-3
No files found.
op-node/rollup/derive/frame.go
View file @
63aa42e9
...
...
@@ -24,10 +24,10 @@ const MaxFrameLen = 1_000_000
// is_last = bool
type
Frame
struct
{
ID
ChannelID
FrameNumber
uint16
Data
[]
byte
IsLast
bool
ID
ChannelID
`json:"id"`
FrameNumber
uint16
`json:"frame_number"`
Data
[]
byte
`json:"data"`
IsLast
bool
`'json:"is_last"`
}
// MarshalBinary writes the frame to `w`.
...
...
op-node/rollup/derive/params.go
View file @
63aa42e9
package
derive
import
(
"encoding/
json
"
"encoding/
hex
"
"errors"
"fmt"
)
...
...
@@ -46,6 +46,18 @@ 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
())
func
(
id
ChannelID
)
MarshalText
()
([]
byte
,
error
)
{
return
[]
byte
(
id
.
String
()),
nil
}
func
(
id
*
ChannelID
)
UnmarshalText
(
text
[]
byte
)
error
{
h
,
err
:=
hex
.
DecodeString
(
string
(
text
))
if
err
!=
nil
{
return
err
}
if
len
(
h
)
!=
ChannelIDLength
{
return
errors
.
New
(
"invalid length"
)
}
copy
(
id
[
:
],
h
)
return
nil
}
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