Taiko 백서

Taiko

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 3쪽 중 2쪽

tion that returns False if statement S throws an error; RLP′ is the RLP decoding function;T g is a transaction’s gasLimit; 5.2.4.Mapping.A proposed block where both V b( ˙B) and V l( ˙BL) hold true will map to an actual Taiko block. Taiko blocks are identical to Ethereum blocks, as defined by the Ethereum Yellow Paper[11]: BH ≡(H p,H o,H c,H r,H t,H e,H b,H d,(2) Hi,H l,H g,H s,H x,H m,H n) BU ≡[] (3) B≡(B H,B T,B U) (4) Where Hp is the block’s parentHash, Ho is the ommer- sHash, Hc is the beneficiary, Hr is the stateRoot, Ht is the transactionsRoot, He is the receiptsRoot, Hb is the logsBloom, Hd is the difficulty,Hi is the block number, Hl is the gasLimit, Hg is the gasUsed, Hs is the timestamp, Hx is the extraData, Hm is the mixHash, Hn is the nonce; BT a series of the transactions; and BU is a list of ommer block headers but this list will always be empty for Taiko because there is no Proof-of-Work. A proposed block can only be mapped to a Taiko block in aMapping Metadatawhich is the world stateσ: σ≡(δ,h[1..256],d,i,θ) Where δ is the state trie, h[1..256] are the most recent 256 ancestor block hashes, d is Taiko’s chain ID, θ is the anchor transaction, andiis the block number. Now we can define the block mapping functionMas: M(B)≡M(H,T,U),(5) ≡M(δ,h[1..256],d,i,θ, ˙B,) ≡M(δ,h[1..256],d,i,θ,C,L) such that: TAIKO: AN ETHEREUM-EQUIVALENT BASED ROLLUP 5 CHAINID=∧(6) NUMBER=i∧ U= []∧ T=θ::V t(RLP′(L))∧ Hp =h(1)∧ Ho =K EmptyOmmersHash ∧ Hc =C c ∧ Hd = 0∧ Hi =i∧ Hl =C l +K AnchorTxGasLimit ∧ Hs =C s ∧ Hx =C x ∧ Hm =C m ∧ (Hr,H t,H e,H l,H g) = Π(σ,(T 0,T 1,...)) Where Π is the block transition function; :: is the list concatenation operator; V t is the“Initial Tests of Intrinsic Validity”function defined in the Transaction Execution section of the Ethereum Yellow Paper. To avoid confu- sion, in this document, we call V t theMetadata Validity function. V t(RLP′(L)) yields a list of transactions that pass the tests; transactions that don’t pass the tests are ignored and will not be part of the actual L2 block. Note that it is perfectly valid for V t(RLP′(L)) to return an empty list. 5.3.Anchor Transaction.The anchor transaction is ex- ecuted by the TaikoAnchor contract and serves as a bridge between L1 and L2 state. Only the “golden touch address” is authorized to execute anchor transactions. The anchor transaction is required to be the first trans- action in a Taiko block (which is important to make the block deterministic). The anchor transaction is currently used as follows: (1) L1 Block Synchronization: Synchronizes L1 block data to L2, storing the L1 state root as a signal and updating the last synced L1 block height. (2) Public Input Hash Management: Maintains and updates a public input hash that tracks the in- tegrity of block-related inputs and prevents dupli- cate anchor transactions. (3) Gas Management: Calculates and updates EIP- 1559 base fee parameters, managing gas excess and target values. (4) Block Hash Storage: Stores block hashes in a map- ping for cross-layer verification. The anchor transaction should entail: (1) Persisting l1HeightCa and l1Hash Ch, data inher- ited from L1, to the storage trie. These values can be used by bridges to validate cross-chain messages (see Section 8). (2) Comparing ρi−1, thepublic input hashstored by the previous block, with KEC(i− 1,d,h [2..256]). The anchor transaction will throw an exception if such comparison fails. The protocol requires the anchor transaction to execute successfully and will not accept a proof for a block that fails to do so. Note that the genesis block has ρ0≡KEC(0,d,[0,...,0]). (3) Persisting a new public input hash With anchoring, the block mapping function M can be simplified to: B≡(H,T,U),(7) ≡M(δ,θ, ˙B,) ≡M(δ,θ,C,L) 5.3.1.Construction of Anchor Transactions.All anchor transactions are signed by aGolden Touchaddress with a revealed private key. Anchor transactions are constructed by Taiko Alethia L2 nodes as follows: θx = 0∧(8) θn =δ[K GoldenTouchAddress]n + 1∧ θp = 0∧ θg =K AnchorTxGasLimit ∧ θt =K GoldenTouchAddress ∧ θv = 0∧ (θr,δ s) =K1ECDSA(δ,K GoldenTouchPrivateKey) Where K1ECDSA is the ECDSA[12] signing function with the internal variablek set to 1, which guarantees the trans- action’s signature to only depend on the transaction data itself and is therefore deterministic. According to the ECDSA’s spec, when k is 1, θr must equal Gx, the value of the x-coordinate of the base point on the SECP-256k1 curve. The TaikoInbox contract verifies this assertion. 5.4.Proving Blocks.Proofs need to be submitted to Ethereum so that batches of blocks can be verified on- chain. We stress again that all proposed batches of blocks are verified immediately because proposed batches are de- terministic and cannot be reverted. The prover hasno impact on the post-batch state. The proof is only required to prove to the TaikoInbox smart contract that the L2 state transitions and the rollup protocol rules are fully constrained. These on-chain verified L2 states are made accessible to other smart contracts (and indirectly to other L2s) so they can have access to the full L2 state, which is critical for bridges (see Section 8). Batches of blocks can be proven in parallel and so proofs may be submitted out-of-order. As a result, when proofs are submitted for batches where the parent batch is not yet verified, we cannot know if the proof is for the correct state transition. A proof on its own can only verify that the state transition from one state to another state is done correctly, not that the initial state is the correct one. As such, proving a batch of blocks can create a State Tran- sition which is an attestation that the batch in question transits from a prover-selected parent batch to a correctly calculated new world state. It is important to note that there is only a single valid state transition per batch: the state transition that transitions from the last on-chain verified batch to the nextvalidproposed batch. All other state transitions use an incorrect pre-batch state. A State Transition is a simple structure with 3 elements: E≡(H p,H h,H s) (9) TAIKO: AN ETHEREUM-EQUIVALENT BASED ROLLUP 6 whereHp is the parent hash, Hh is the block hash, and Hs is the state root. External verifier contracts handle multiproving validation for batches of blocks through the TaikoInbox contract’s verification system. 5.4.1.Invalid Blocks.Invalid blocks are those that fail to pass the Intrinsic Validity Function V l (see Section 5.2.3) or contain malformed transaction data. Batches contain- ing invalid blocks will fail the proving process through the multiproving system, where verifier contracts validate batch execution and reject batches that do not conform to protocol rules. The proving system operates with asynchronous proof submission. The TaikoInbox contract’s proveBatches() function allows proving multiple batches with a single aggregated proof. Key characteristics of the proving system: (1) Asynchronous Proving: Block proposals and proofs are asynchronous - proofs can be submitted after batch proposal. (2) Batch Proving: Multiple batches can be proved together using aggregated proofs. (3) Verification: Uses an external verifier contract to validate proofs, with proofs presumed error-free and thoroughly validated. (4) Proving Window: Proofs must be submitted within a proving window timeframe. The TaikoInbox contract manages state transitions and tracks batch verification status. Conflicting proofs can trigger contract pausing for resolution. The proving sys- tem delegates subproof and multiproving management to verifier contracts. 5.5.On-chain Verification of Blocks.The verifica- tion process operates through the TaikoInbox contract’s verifyBatches() function, which validates multiple batch transitions using aggregated proofs. The process involves batch validation, proof verification, and state transition management. Verification workflow: (1) Batch Validation: Each batch metadata is verified against stored batch data, including metaHash matching and batch existence checks. (2) Transition Management: New transitions are cre- ated or existing ones overwritten based on parent hash matching, with transition IDs tracked in map- pings. (3) Proof Verification: The designated verifier con- tract validates the aggregated proof through the IVerifier interface’sverifyProof()function. (4) State Updates: Upon successful verification, tran- sition states are updated with block hashes, state roots, and prover information. (5) Proving Window: Transitions track whether they were created within the proving window, affecting prover attribution and verification status. Conflict resolution occurs when multiple proofs target the same parent hash but produce different block hashes or state roots. In such cases, the conflicting transition’s block hash is set to zero, a ConflictingProof event is emitted, and the contract pauses operations. After processing all transi- tions, successful verification triggers BatchesProved events and potential batch finalization through the verification process. The verifying process takes place when a batch is pro- posed or proven - the verifyBatches() function will be called, and verify up to N batches, which is configurable. A batch is only verifiable if the previous batch is also verified. Thus, batches can be proven out of order, but only verified in order. 6.Taiko Alethia Based Preconfirmations The aforementioned Taiko Alethia based preconfirma- tion system evolves through two phases, progressively de- centralizing from a whitelisted operator model to permis- sionless L1 validator participation. 6.1.Phase 1: Whitelisted Operators.Phase 1 imple- ments preconfirmations through whitelisted operators: 6.1.1.PreconfWhitelist Contract.The PreconfWhitelist contract manages authorized preconfirmation operators: • Operator Management:Tracks operators with activation and inactivation epochs • Epoch-Based Selection:Selects operators for specific epochs using beacon block root random- ness • Access Control:Allows adding/removing opera- tors by owner or designated “ejecters” • Consolidation:Implements a mechanism to con- solidate the operator list by removing inactive operators 6.1.2.PreconfRouter Contract.The PreconfRouter pro- vides controlled batch proposal routing: • Batch Proposal:Routes batch proposals from authorized preconfirmers to the TaikoInbox • Authorization:Ensures only whitelisted precon- firmers or fallback addresses can propose • Validation:Optionally validates expected last block ID before accepting proposals • Handover Slots:Configured with 8 handover slots for operator transitions 6.1.3.Integration with TaikoInbox.The TaikoInbox con- tract includes support for preconfirmation through: • An optional inboxWrapper address that can re- strict batch proposals • Support for both permissionless and restricted proposing modes In Phase 1, authorized operators can propose batches through the router, with the whitelist managing operator lifecycle and selection based on epochs. 6.2.Phase 2: L1 Validator Opt-in with Slash- ing.Phase 2 transitions to a permissionless model where Ethereum L1 validators can opt into providing preconfir- mations: 6.2.1.Validator Registration.L1 validators voluntarily reg- ister as preconfirmers by: • Staking ETH:Validators deposit ETH collat- eral into a slashing contract to align economic incentives • Opt-in Mechanism:Validators signal their in- tent to participate in preconfirmations TAIKO: AN ETHEREUM-EQUIVALENT BASED ROLLUP 7 • Infrastructure Requirements:Running ad- ditional preconfirmation infrastructure alongside their validator client 6.2.2.Economic Security Model.The Phase 2 model en- forces commitments through economic penalties: • Slashing Conditions:Validators face slashing for: – Failing to include preconfirmed transactions in proposed blocks – Providing invalid or conflicting preconfirma- tions • Reward Distribution:Validators earn fees from users for providing preconfirmations • Stake Requirements:Minimum ETH stake en- sures meaningful economic security 6.2.3.Decentralization Benefits.Phase 2 removes the whitelist requirement, enabling: • Permissionless Participation:Any L1 valida- tor can become a preconfirmer • Geographic Distribution:Global validator set provides worldwide coverage • Censorship Resistance:No central authority controls preconfirmer selection • Aligned Incentives:Validators naturally inte- grate preconfirmations with block production 6.2.4.Technical Implementation.Phase 2 requires new infrastructure: • Slashing Contract:Manages validator stakes and enforces penalties • Registration Contract:Handles validator opt- in and stake management • Coordination Layer:Enables validators to dis- cover and relay preconfirmations • Monitoring System:Tracks validator behavior and triggers slashing when violations occur • EIP-7917 on L1[4]: Fusaka will enable EIP-7917 on L1 to expose a stable proposer lookahead to the execution layer 6.3.Migration from Phase 1 to Phase 2.The transi- tion strategy includes: • Parallel Operation:Both systems run simulta- neously during transition period • Gradual Migration:Validators progressively opt in as infrastructure matures • Whitelist Sunset:Phase 1 whitelist deprecated once sufficient validators participate This phased approach enables immediate preconfirma- tion benefits while building toward full decentralization with L1 validator participation and cryptoeconomic secu- rity. 6.4.Sidecars.The preconfirming is done by sidecars run- ning in parallel to a Taiko execution and consensus layer. The sidecars interact with the suite of contracts de- scribed in Section 5.1. The job of the sidecar is to: •Wait for their epoch to be active •Accept transactions from users via the mempool • Create preconfirmation blocks with those transac- tions, which will be gossiped via the Taiko node connected to the sidecar • When a batch of blocks is deemed profitable or the window is over, submit them onchain for L1 finality • Handover the preconfirmation role to the next preconfirmer in the list when their epoch ends The current sidecars can be found at: •https://github.com/gattaca-com/taiko-gateway - Sidecar implementation by Gattaca •https://github.com/NethermindEth/Catalyst - Sidecar implementation by Nethermind •https://github.com/chainbound/taiko-mk1 - Sidecar implementation by Chainbound When phase 2 rolls out, any L1 validator will be able to run a sidecar and become a preconfirmer, as well as create their own sidecar to fit their needs, as long as it follows the protocol rules. Block building and preconfirming can be separated into a block building market and a sequencing market, thus L1 validaotors can opt-in to provide preconfirmations, but delegate their rights to the block building market. 7.Taiko L2 Hard Forks Taiko Alethia’s protocol evolution occurs through planned hard forks that introduce significant architectural improvements while maintaining backward compatibility and state continuity. 7.1.Ontake Fork.The Ontake fork represents Taiko Alethia’s initial mainnet protocol implementation: 7.1.1.Architecture. • Based Contestable Rollup (BCR):Original design with tier-based proof system • Block-by-Block Processing:Individual block proposals and verification • Contestation Mechanism:Proofs could be con- tested within validity windows • Core Contract:TaikoL1.sol managed L1 proto- col logic 7.1.2.Fork Heights. •Mainnet:Block 538,304 •Hekla Testnet:Block 840,512 7.2.Pacaya Fork.The Pacaya fork introduces a major architectural shift from block-based to batch-based pro- cessing: 7.2.1.Key Innovations. • Batch-Based Protocol:Blocks proposed in batches (zero, one, or multiple blocks per batch) • Simplified Proving:Removed proof contesta- tion in favor of multiproving • Multiproving System:Every batch uses mul- tiproving with support for SGX (sgxGeth + sgxReth), SP1, and Risc0 proof types • Preconfirmation Support:Architecture en- ables based preconfirmations TAIKO: AN ETHEREUM-EQUIVALENT BASED ROLLUP 8 7.2.2.Contract Changes. • TaikoInbox:Replaces TaikoL1.sol as primary L1 contract • TaikoAnchor:Replaces TaikoL2.sol for L2 an- choring • ComposeVerifier:New multiproof verification contract • ForcedInclusionStore:Ensures censorship re- sistance 7.2.3.Fork Heights. •Mainnet:Batch 1,166,000 •Hekla Testnet:Batch 1,299,888 7.3.Migration Architecture.Taiko Alethia implements sophisticated fork migration through a router pattern: 7.3.1.Fork Router System. • PacayaForkRouter:Routes function calls be- tween Ontake and Pacaya implementations • Delegatecall Pattern:Maintains state while switching logic contracts • Function Mapping:Legacy functions route to old contracts, new functions to updated ones 7.3.2.Storage Compatibility. • State Preservation:New contracts maintain storage layout compatibility • Seamless Transition:No state migration re- quired during fork activation • Backward Compatibility:Historical data re- mains accessible 7.4.Fork Measurement.Different forks use different measurement units: •Ontake:Measured by block numbers •Pacaya and beyond:Measured by batch IDs This change reflects the architectural shift from block- based to batch-based processing, enabling more efficient L1 operations and supporting advanced features like pre- confirmations. 8.Cross-Chain Communication Taiko Alethia enables third parties to develop cross- chain bridges. To facilitate this, the protocol ensures that a subset of L1 block hashes are accessible from L2 smart contracts and a subset of L2 block hashes are also accessible from the TaikoInbox smart contract. These block hashes can be used to verify the validity of cross-chain messages in standard smart contracts. Taiko Alethia does not have to provide any bridging solutions itself, as the supporting core functionality are ready for others to build upon. An exception to this is the Ether bridge which requires special handling (see Section 8.1). On Ethereum, the TaikoInbox contract persists the height and hash of the L2 blocks. On Taiko Alethia, the anchor function in the TaikoAnchor contract is used to persist the height and block hash of the previous Ethereum block (from when the L2 block was proposed), as well as the previous L2 block hash (which allows L2 smart contracts to easily fetch the full history of L2 block hashes). 8.1.Ether on L2.The Taiko Alethia Ether bridge allows users to bridge Ether from and to Taiko Alethia. 2128 Ether is minted to a special vault contract called the TokenVault in the genesis block. When a user deposits Ether to L2, the same amount of Ether will be transferred from the TokenVault to the user on L2. When a user withdraws some Ether from L2, Ether on L2 will be transferred back to TokenVault (no L2 Ether will ever be burnt). A small amount of Ether will also be minted to a few EOAs to bootstrap the L2 network, otherwise nobody would be able to transact. To make sure the Ether bridge is solvent, a corresponding amount of Ether will be de- posited to the Ether bridge on L1. 9.Future Improvements 9.1.Block Data Compression.A big part of the cost of a rollup block is the data that is required to be stored on L1. It has been shown that standard general compression schemes like DEFLATE[13] work well on transaction data. It is possible to implement these schemes efficiently in a circuit and so the data published on L1 can be compressed while the circuits can decompress the data again. This will make it possible to reduce the amount of data that needs to be published on L1, significantly reducing costs. 9.2.Shasta Fork Improvements.The Shasta fork rep- resents the next major protocol upgrade, currently in de- velopment: 9.2.1.Planned Features.Planned features include: • Optimized Batch Processing:Optimization of batch proposal, proving and verification that will reduce the cost of the protocol by 10x or more • Protocol Simplifications:Continued removal of complex logic, and pushing complexity off-chain • Bond Processing on L2:Proces
프로젝트로 돌아가기