Skip to content

Commit d0f9232

Browse files
committed
doc: Revamp verifyPreconf to better match derivation
1 parent 9ec7ad3 commit d0f9232

File tree

1 file changed

+33
-16
lines changed

1 file changed

+33
-16
lines changed

docs/permissionless-design-doc.md

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,23 @@ PRECONFER_SLASHER_ADDRESS = ....
313313

314314
# The currently expected preconfer
315315
currentPreconfer: LookaheadSlot
316-
# Node's canonical L2 head
317-
localL2Head: Block
316+
317+
# Node's preconfed L2 head state
318+
# Based on `ParentState` in Rust implementation, but extended with `rawTxListHash`:
319+
# https://github.com/taikoxyz/taiko-mono/blob/0ca71a425ecb75bec7ed737c258f1a35362f4873/packages/taiko-client-rs/crates/driver/src/derivation/pipeline/shasta/pipeline/state.rs#L12-L13
320+
class ParentState:
321+
header: Header # Standard block header (hash, number, timestamp, gasLimit, coinbase, etc.)
322+
anchorBlockNumber: uint256 # L1 anchor block ID
323+
rawTxListHash: bytes32 # New! Hash of raw transaction list
324+
...
325+
326+
localL2Head: ParentState
318327

319328
# Run this function on each reception of preconf
320-
def verifyPreconf(# CHANGE: Function now takes rawTxList instead of full L2 block
321-
rawTxList: List[Tx],
322-
signedCommitment: SignedCommitment):
329+
def verifyPreconfirmation(rawTxList: List[Tx], signedCommitment: SignedCommitment):
323330
"""
324331
Verifies a received preconfirmation against lookahead schedule, the signer,
325-
the expected slasher, and the provided rawTxList.
332+
the slasher address, and derive and execute the L2 block.
326333
"""
327334

328335
commitment = signedCommitment.commitment
@@ -355,15 +362,25 @@ def verifyPreconf(# CHANGE: Function now takes rawTxList instead of full L2 bloc
355362
# 7) Verify timestamp does not drift too far from current time
356363
assert abs(preconf.timestamp - now()) <= MAX_TIMESTAMP_DRIFT
357364

358-
# 8) Reconstruct full L2 block by adding anchor transaction
359-
anchorHash = L1.getBlockHash(preconf.anchorId)
360-
anchorTx = constructAnchorTx(anchorHash)
361-
l2Block = executeL2Block([anchorTx] + rawTxList)
362-
363-
# 9) Advance local canonical chain
364-
localL2Head = l2Block
365-
366-
# 10) Handle explicit EOP handoff
365+
# 8) Derive L2 block from preconfirmation and execute it
366+
# First construct block manifest from preconfirmation parameters.
367+
# Block manifest in Rust implementation::
368+
# https://github.com/taikoxyz/taiko-mono/blob/0ca71a425ecb75bec7ed737c258f1a35362f4873/packages/taiko-client-rs/crates/protocol/src/shasta/manifest.rs#L22-L23
369+
manifest = BlockManifest(
370+
anchorBlockNumber=preconf.anchorBlockNumber,
371+
timestamp=preconf.timestamp,
372+
gasLimit=preconf.gasLimit,
373+
coinbase=preconf.coinbase,
374+
transactions=rawTxList
375+
)
376+
# Then process block.
377+
# This validates constraints, constructs anchor tx, and executes the block.
378+
# Corresponds to `process_block_manifest` in Rust implementation:
379+
# https://github.com/taikoxyz/taiko-mono/blob/0ca71a425ecb75bec7ed737c258f1a35362f4873/packages/taiko-client-rs/crates/driver/src/derivation/pipeline/shasta/pipeline/payload.rs#L290
380+
# Note: This function will update the `parentState` with the newly processed block.
381+
processBlockManifest(manifest, parentState)
382+
383+
# 9) Handle explicit EOP handoff
367384
if preconf.eop:
368385
currentPreconfer = lookaheadStore.getNextPreconfer()
369386

@@ -548,4 +565,4 @@ sequenceDiagram
548565

549566
Requiring L1 validators to directly operate infrastructure for providing preconfs is undesirable, as it would increase complexity for participating validators. This additional complexity would introduce centralizing pressures not only within the L2 preconfer set but also potentially impact decentralization of the L1 validator set itself. To mitigate this, we would want to allow validators to outsource their preconfing duties, either partially or fully, analogous to "proposer-builder separation" (PBS) in L1.
550567

551-
A more comprehensive analysis of preconf PBS will be done in an upcoming write-up.
568+
A more comprehensive analysis of preconf PBS will be done in an upcoming write-up.

0 commit comments

Comments
 (0)