Skip to content

Commit d543e3f

Browse files
authored
specs: Specify derivation of future tx types (#518)
* specs: Specify derivation of future tx types * rewrite * clarify * lint * LINT * address gk's review
1 parent ee00f2b commit d543e3f

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

specs/protocol/derivation.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
- [GasPriceOracle Enable Ecotone](#gaspriceoracle-enable-ecotone)
5151
- [Beacon block roots contract deployment (EIP-4788)](#beacon-block-roots-contract-deployment-eip-4788)
5252
- [Building Individual Payload Attributes](#building-individual-payload-attributes)
53+
- [On Future-Proof Transaction Log Derivation](#on-future-proof-transaction-log-derivation)
5354

5455
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
5556

@@ -507,6 +508,9 @@ transaction is one with the following properties:
507508

508509
- The [`to`] field is equal to the configured batcher inbox address.
509510

511+
- The transaction type is one of `0`, `1`, `2`, `3`, or `0x7e` (L2 [Deposited transaction type][g-deposit-tx-type], to
512+
support force-inclusion of batcher transactions on nested OP Stack chains).
513+
510514
- The sender, as recovered from the transaction signature (`v`, `r`, and `s`), is the batcher
511515
address loaded from the system config matching the L1 block of the data.
512516

@@ -1022,6 +1026,9 @@ entries.
10221026

10231027
[deposit-contract-spec]: deposits.md#deposit-contract
10241028

1029+
Logs are derived from transactions following the future-proof best-effort process described in
1030+
[On Future-Proof Transaction Log Derivation][#on-future-proof-transaction-log-derivation]
1031+
10251032
### Network upgrade automation transactions
10261033

10271034
[network upgrade automation transactions]: #network-upgrade-automation-transactions
@@ -1286,3 +1293,28 @@ follows:
12861293

12871294
[extended-attributes]: exec-engine.md#extended-payloadattributesv1
12881295
[Fee Vaults]: exec-engine.md#fee-vaults
1296+
1297+
## On Future-Proof Transaction Log Derivation
1298+
1299+
As described in [L1 Retrieval][#l1-retrieval], batcher transactions' types are required to be from a fixed allow-list.
1300+
1301+
However, we want to allow deposit transactions and `SystemConfig` update events to get derived even from receipts of
1302+
future transaction types, as long as the receipts can be decoded following a best-effort process:
1303+
1304+
As long as a future transaction type follows the [EIP-2718][https://eips.ethereum.org/EIPS/eip-2718] specification, the
1305+
type can be decoded from the first byte of the transaction's (or its receipt's) binary encoding. We can then proceed as
1306+
follows to get the logs of such a future transaction, or discard the transaction's receipt as invalid.
1307+
1308+
- If it's a known transaction type, that is, legacy (first byte of the encoding is in the range `[0xc0, 0xfe]`) or its
1309+
first byte is in the range `[0, 4]` or `0x7e` (_deposited_), then it's not a _future transaction_ and we know how to
1310+
decode the receipt and this process is irrelevant.
1311+
- If a transaction's first byte is in the range `[0x05, 0x7d]`, it is expected to be a _future_ EIP-2718 transaction, so
1312+
we can proceed to the receipt. Note that we excluded `0x7e` because that's the deposit transaction type, which is known.
1313+
- The _future_ receipt encoding's first byte must be the same byte as the transaction encoding's first byte, or it is
1314+
discarded as invalid, because we require it to be an EIP-2718-encoded receipt to continue.
1315+
- The receipt payload is decoded as if it is encoded as `rlp([status, cumulative_transaction_gas_used, logs_bloom,
1316+
logs])`, which is the encoding of the known non-legacy transaction types.
1317+
- If this decoding fails, the transaction's receipt is discarded as invalid.
1318+
- If this decoding succeeds, the `logs` have been obtained and can be processed as those of known transaction types.
1319+
1320+
The intention of this best-effort decoding process is to future-proof the protocol for new L1 transaction types.

specs/protocol/system-config.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ A rollup node initializes its derivation process by finding a starting point bas
144144
After preparing the initial system configuration for the given L1 starting input,
145145
the system configuration is updated by processing all receipts from each new L1 block.
146146

147+
Logs are derived from transactions following the future-proof best-effort process described in
148+
[On Future-Proof Transaction Log Derivation][derivation.md#on-future-proof-transaction-log-derivation]
149+
147150
The contained log events are filtered and processed as follows:
148151

149152
- the log event contract address must match the rollup `SystemConfig` deployment

0 commit comments

Comments
 (0)