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
d41b0061
Unverified
Commit
d41b0061
authored
Dec 22, 2023
by
protolambda
Committed by
GitHub
Dec 22, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8745 from ethereum-optimism/4844-encoding-v2
specs: 4844 blob encoding v2
parents
85a18f7d
8fd37354
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
11 deletions
+34
-11
derivation.md
specs/derivation.md
+34
-11
No files found.
specs/derivation.md
View file @
d41b0061
...
...
@@ -515,22 +515,45 @@ The field elements are encoded as big-endian integers (`KZG_ENDIANNESS = big`).
To save computational overhead, only
`254`
bits per field element are used for rollup data.
Data is encoded, 4 field elements,
`127`
bytes of rollup data, at a time
:
`127`
bytes of application-layer rollup data is encoded at a time, into 4 adjacent field elements of the blob
:
```
text
# Allocate 4 field elements (big-endian).
# Read 31 bytes into the low 31 bytes of each.
<----- element 0 -----><----- element 1 -----><----- element 2 -----><----- element 3 ----->
| byte A | read(31) || byte B | read(31) || byte C | read(31) || byte D | read(31) |
# Read 3 more bytes after the above.
```
python
# read(N): read the next N bytes from the application-layer rollup-data. The next read starts where the last stopped.
# write(V): append V (one or more bytes) to the raw blob.
bytes
tailA
=
read
(
31
)
byte
x
=
read
(
1
)
byte
A
=
x
&
0b0011_1111
write
(
A
)
write
(
tailA
)
bytes
tailB
=
read
(
31
)
byte
y
=
read
(
1
)
byte
B
=
(
y
&
0b0000_1111
)
|
(
x
&
0b1100_0000
)
>>
2
)
write
(
B
)
write
(
tailB
)
bytes
tailC
=
read
(
31
)
byte
z
=
read
(
1
)
# Split the 24 bits into 4 x 6 bits, to write into the leading (highest) byte of each element:
byte A = x & 0b0011_1111
byte B = y & 0b0011_1111
byte
C
=
z
&
0b0011_1111
byte D = ((x & 0b1100_0000) >> 2) | ((y & 0b1100_0000) >> 4) | ((z & 0b1100_0000) >> 6)
write
(
C
)
write
(
tailC
)
bytes
tailD
=
read
(
31
)
byte
D
=
((
z
&
0b1100_0000
)
>>
2
)
|
((
y
&
0b1111_0000
)
>>
4
)
write
(
D
)
write
(
tailD
)
```
Each written field element looks like this:
-
Starts with one of the prepared 6-bit left-padded byte values, to keep the field element within valid range.
-
Followed by 31 bytes of application-layer data, to fill the low 31 bytes of the field element.
The written output should look like this:
```
text
<----- element 0 -----><----- element 1 -----><----- element 2 -----><----- element 3 ----->
| byte A | tailA... || byte B | tailB... || byte C | tailC... || byte D | tailD... |
```
The above is repeated 1024 times, to fill all
`4096`
elements,
...
...
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