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
a35425c5
Commit
a35425c5
authored
Dec 06, 2023
by
pcw109550
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
specs: Add Span batch field protectedBits
parent
a87eb496
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
span-batches.md
specs/span-batches.md
+12
-5
No files found.
specs/span-batches.md
View file @
a35425c5
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
-
[
`Chain ID` removal from initial specs
](
#chain-id-removal-from-initial-specs
)
-
[
`Chain ID` removal from initial specs
](
#chain-id-removal-from-initial-specs
)
-
[
Reorganization of constant length transaction fields
](
#reorganization-of-constant-length-transaction-fields
)
-
[
Reorganization of constant length transaction fields
](
#reorganization-of-constant-length-transaction-fields
)
-
[
RLP encoding for only variable length fields
](
#rlp-encoding-for-only-variable-length-fields
)
-
[
RLP encoding for only variable length fields
](
#rlp-encoding-for-only-variable-length-fields
)
-
[
Store `y_parity`
instead of `v`
](
#store-y_parity
-instead-of-v
)
-
[
Store `y_parity`
and `protected_bit` instead of `v`
](
#store-y_parity-and-protected_bit
-instead-of-v
)
-
[
Adjust `txs` Data Layout for Better Compression
](
#adjust-txs-data-layout-for-better-compression
)
-
[
Adjust `txs` Data Layout for Better Compression
](
#adjust-txs-data-layout-for-better-compression
)
-
[
`fee_recipients` Encoding Scheme
](
#fee_recipients-encoding-scheme
)
-
[
`fee_recipients` Encoding Scheme
](
#fee_recipients-encoding-scheme
)
-
[
How derivation works with Span Batch?
](
#how-derivation-works-with-span-batch
)
-
[
How derivation works with Span Batch?
](
#how-derivation-works-with-span-batch
)
...
@@ -102,7 +102,8 @@ Where:
...
@@ -102,7 +102,8 @@ Where:
1 bit per L2 block, indicating if the L1 origin changed this L2 block.
1 bit per L2 block, indicating if the L1 origin changed this L2 block.
-
`block_tx_counts`
: for each block, a
`uvarint`
of
`len(block.transactions)`
.
-
`block_tx_counts`
: for each block, a
`uvarint`
of
`len(block.transactions)`
.
-
`txs`
: L2 transactions which is reorganized and encoded as below.
-
`txs`
: L2 transactions which is reorganized and encoded as below.
-
`txs = contract_creation_bits ++ y_parity_bits ++ tx_sigs ++ tx_tos ++ tx_datas ++ tx_nonces ++ tx_gases`
-
`txs = contract_creation_bits ++ y_parity_bits ++
tx_sigs ++ tx_tos ++ tx_datas ++ tx_nonces ++ tx_gases ++ protected_bits`
-
`contract_creation_bits`
: bit list of
`sum(block_tx_counts)`
bits, right-padded to a multiple of 8 bits,
-
`contract_creation_bits`
: bit list of
`sum(block_tx_counts)`
bits, right-padded to a multiple of 8 bits,
1 bit per L2 transactions, indicating if transaction is a contract creation transaction.
1 bit per L2 transactions, indicating if transaction is a contract creation transaction.
-
`y_parity_bits`
: bit list of
`sum(block_tx_counts)`
bits, right-padded to a multiple of 8 bits,
-
`y_parity_bits`
: bit list of
`sum(block_tx_counts)`
bits, right-padded to a multiple of 8 bits,
...
@@ -121,6 +122,8 @@ Where:
...
@@ -121,6 +122,8 @@ Where:
-
`legacy`
:
`gasLimit`
-
`legacy`
:
`gasLimit`
-
`1`
: (
[
EIP-2930
]
):
`gasLimit`
-
`1`
: (
[
EIP-2930
]
):
`gasLimit`
-
`2`
: (
[
EIP-1559
]
):
`gas_limit`
-
`2`
: (
[
EIP-1559
]
):
`gas_limit`
-
`protected_bits`
: bit list of length of number of legacy transactions, right-padded to a multiple of 8 bits,
1 bit per L2 legacy transactions, indicating if transacion is protected(
[
EIP-155
]
) or not.
Introduce version
`2`
to the
[
batch-format
](
./derivation.md#batch-format
)
table:
Introduce version
`2`
to the
[
batch-format
](
./derivation.md#batch-format
)
table:
...
@@ -147,6 +150,8 @@ Where:
...
@@ -147,6 +150,8 @@ Where:
[
EIP-1559
]:
https://eips.ethereum.org/EIPS/eip-1559
[
EIP-1559
]:
https://eips.ethereum.org/EIPS/eip-1559
[
EIP-155
]:
https://eips.ethereum.org/EIPS/eip-155
Total size of encoded span batch is limited to
`MAX_SPAN_BATCH_SIZE`
(currently 10,000,000 bytes,
Total size of encoded span batch is limited to
`MAX_SPAN_BATCH_SIZE`
(currently 10,000,000 bytes,
equal to
`MAX_RLP_BYTES_PER_CHANNEL`
). Therefore every field size of span batch will be implicitly limited to
equal to
`MAX_RLP_BYTES_PER_CHANNEL`
). Therefore every field size of span batch will be implicitly limited to
`MAX_SPAN_BATCH_SIZE`
. There can be at least single span batch per channel, and channel size is limited
`MAX_SPAN_BATCH_SIZE`
. There can be at least single span batch per channel, and channel size is limited
...
@@ -201,10 +206,12 @@ Our goal is to find the sweet spot on code complexity - span batch size tradeoff
...
@@ -201,10 +206,12 @@ Our goal is to find the sweet spot on code complexity - span batch size tradeoff
I decided that using RLP for all variable length fields will be the best option,
I decided that using RLP for all variable length fields will be the best option,
not risking codebase with gnarly custom encoding/decoding implementations.
not risking codebase with gnarly custom encoding/decoding implementations.
### Store `y_parity` instead of `v`
### Store `y_parity`
and `protected_bit`
instead of `v`
For legacy type transactions,
`v = 2 * ChainID + y_parity`
. For other types of transactions,
`v = y_parity`
.
Only legacy type transactions can be optionally protected. If protected(
[
EIP-155
]
),
`v = 2 * ChainID + y_parity`
.
We may only store
`y_parity`
, which is single bit per L2 transaction.
Else,
`v = 27 + y_parity`
. For other types of transactions,
`v = y_parity`
.
We store
`y_parity`
, which is single bit per L2 transaction.
We store
`protected_bit`
, which is single bit per L2 legacy type transactions to indicate that tx is protected.
This optimization will benefit more when ratio between number of legacy type transactions over number of transactions
This optimization will benefit more when ratio between number of legacy type transactions over number of transactions
excluding deposit tx is higher.
excluding deposit tx is higher.
...
...
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