# L2.Finance-zk Markdown version of https://l2beat.com/layer2s/projects/layer2financezk ## Summary **Warning:** This project is archived and no longer maintained. **Warning:** Critical contracts can be upgraded by an EOA which could result in the loss of all funds. - Total Value Secured: $4.45 K (-7.71% compared to seven days ago; canonically bridged $4.45 K, natively minted $0.00, externally bridged $0.00; 0.00% with additional trust assumptions compared to the tokens involved and the Stage assigned to the project's canonical messaging bridge) - Proof system: Validity - Purpose: Exchange - Host chain: Ethereum ### Risks - Sequencer failure: Force via L1 (sentiment: good) - State validation: Validity proofs (ST) (sentiment: good) - Data availability: External (DAC) (sentiment: bad) - Exit window: None (sentiment: bad) - Proposer failure: Use escape hatch (sentiment: good) ### About Celer's Layer2.finance in ZK proofs Mode Built with StarkEx from StarkWare. ## Value Secured Shown as an interactive chart or widget on [the HTML page](https://l2beat.com/layer2s/projects/layer2financezk#tvs). - [TVS chart (JSON)](https://l2beat.com/api/scaling/tvs/layer2financezk) - [TVS breakdown by token (JSON)](https://l2beat.com/api/scaling/tvs/layer2financezk/breakdown) ## Risk summary **Warning:** 1 address has unverified source code (CRITICAL). - Committee: 0xF000A3B10e1920aDC6e7D829828e3357Fc5128A9 **Warning:** Layer2.finance-ZK has been shut down, users are encouraged to use optimistic rollup version. ### Funds can be stolen if 1. a contract receives a malicious code upgrade. There is no delay on code upgrades, (CRITICAL) 2. the source code of unverified contracts contains malicious code (CRITICAL). ### Funds can be lost if 3. the external data becomes unavailable (CRITICAL). ### Users can be censored if 4. the committee restricts their access to the external data, 5. the operator refuses to include their transactions. However, there exists a mechanism to independently exit the system. ### MEV can be extracted if 6. the operator exploits their centralized position and frontruns user transactions. ## Risk analysis **Warning:** Critical contracts can be upgraded by an EOA which could result in the loss of all funds. **Warning:** Layer2.finance-ZK has been shut down, users are encouraged to use optimistic rollup version. ### Sequencer failure Force via L1 (sentiment: good) Users can force the sequencer to include a transaction by submitting a request through L1. If the sequencer censors or is down for , users can use the exit hatch to withdraw their funds. ### State validation Validity proofs (ST) (sentiment: good) STARKs are zero knowledge proofs that ensure state correctness. ### Data availability External (DAC) (sentiment: bad) Proof construction relies fully on data that is NOT published onchain. There exists a Data Availability Committee (DAC) that is tasked with protecting and supplying the data. ### Exit window None (sentiment: bad) There is no window for users to exit in case of an unwanted upgrade since contracts are instantly upgradable. ### Proposer failure Use escape hatch (sentiment: good) Users are able to trustlessly exit by submitting a Merkle proof of funds. ## Data availability ### Data is not stored on chain The balances of the users are not published onchain, but rather sent to external trusted parties, also known as committee members. A state update is valid and accepted onchain only if at least a quorum of the committee members sign a state update. **Risks** - Funds can be lost if the external data becomes unavailable (CRITICAL). - Users can be censored if the committee restricts their access to the external data. **References** - [Data Availability Modes - StarkEx documentation](https://docs.starkware.co/starkex/con_data_availability.html#data_availability_modes) - [Validium - StarkEx documentation](https://docs.starkware.co/starkex/con_data_availability.html#validium_starkex) - [Availability Verifiers - StarkEx documentation](https://docs.starkware.co/starkex/spot/shared/contract-management.html#availability_verifiers_spot) ## State validation ### Validity proofs Each update to the system state must be accompanied by a ZK proof that ensures that the new state was derived by correctly applying a series of valid user transactions to the previous state. These proofs are then verified on Ethereum by a smart contract. The system state is represented using Merkle roots. **References** - [Enforcing Consistency on the On-Chain State - StarkEx documentation](https://docs.starkware.co/starkex/spot/shared/README-off-chain-state.html#enforcing_consistency_in_the_on_chain_state_spot) ## Upgrades & Governance ## Updates Shown as an interactive chart or widget on [the HTML page](https://l2beat.com/layer2s/projects/layer2financezk#updates). ## Operator ### The system has a centralized operator The operator is the only entity that can propose blocks. A live and trustworthy operator is vital to the health of the system. Typically, the Operator is the hot wallet of the StarkEx service submitting state updates for which proofs have been already submitted and verified. **Risks** - MEV can be extracted if the operator exploits their centralized position and frontruns user transactions. **References** - [Operator - StarkEx documentation](https://docs.starkware.co/starkex/perpetual/shared/contract-management.html#operator_perpetual) ### Users can force exit the system Force exit allows the users to escape censorship by withdrawing their funds. The system allows users to force the withdrawal of funds by submitting a request directly to the contract onchain. The request must be served within a defined time period. If this does not happen, the system will halt regular operation and permit trustless withdrawal of funds. **Risks** - Users can be censored if the operator refuses to include their transactions. However, there exists a mechanism to independently exit the system. **References** - [Censorship Prevention - StarkEx documentation](https://docs.starkware.co/starkex/architecture/solution-architecture.html#8-censorship-prevention) ## Withdrawals ### Regular exit The user initiates the withdrawal by submitting a regular transaction on this chain. When the block containing that transaction is settled the funds become available for withdrawal on L1. ZK proofs are required to settle blocks. Finally the user submits an L1 transaction to claim the funds. **References** - [Withdrawal - StarkEx documentation](https://docs.starkware.co/starkex/perpetual/withdrawal-perpetual.html) ### Forced exit If the user experiences censorship from the operator with regular exit they can submit their withdrawal requests directly on L1. The system is then obliged to service this request. Once the force operation is submitted and if the request is serviced, the operation follows the flow of a regular exit. **References** - [Forced Operations - StarkEx documentation](https://docs.starkware.co/starkex/perpetual/shared/README-forced-operations.html) - [Forced Withdrawal - StarkEx documentation](https://docs.starkware.co/starkex/perpetual/perpetual-trading-forced-withdrawal-and-forced-trade.html#forced_withdrawal) - [Forced Trade - StarkEx documentation](https://docs.starkware.co/starkex/perpetual/perpetual-trading-forced-withdrawal-and-forced-trade.html#forced_trade) ### Emergency exit If the enough time deadline passes and the forced exit is still ignored the user can put the system into a frozen state, disallowing further state updates. In that case everybody can withdraw by submitting a merkle proof of their funds with their L1 transaction. **References** - [Forced Operations - StarkEx documentation](https://docs.starkware.co/starkex/perpetual/shared/README-forced-operations.html) - [Forced Withdrawal - StarkEx documentation](https://docs.starkware.co/starkex/perpetual/perpetual-trading-forced-withdrawal-and-forced-trade.html#forced_withdrawal) - [Forced Trade - StarkEx documentation](https://docs.starkware.co/starkex/perpetual/perpetual-trading-forced-withdrawal-and-forced-trade.html#forced_trade) ## Permissions ### Ethereum #### Actors ##### Governor Addresses: [0x1E153596BceB29c6EAE88DDB290eBeCC3FE9735e](https://etherscan.io/address/0x1E153596BceB29c6EAE88DDB290eBeCC3FE9735e) Can upgrade implementation of the system, potentially gaining access to all funds stored in the bridge. Currently there is no delay before the upgrade, so the users will not have time to migrate. ##### Data Availability Committee Addresses: There exists a Data Availability Committee with unknown members and an unverified smart contract. ##### SHARP Verifier Governor Addresses: [0x3DE55343499f59CEB3f1dE47F2Cd7Eab28F2F5C6](https://etherscan.io/address/0x3DE55343499f59CEB3f1dE47F2Cd7Eab28F2F5C6) Can upgrade implementation of SHARP Verifier, potentially with code approving fraudulent state. Currently there is no delay before the upgrade, so the users will not have time to migrate. ##### Broker Owner Addresses: [0xe0b79Cf6311E72caF7D31a552BFec67841Dd5988](https://etherscan.io/address/0xe0b79Cf6311E72caF7D31a552BFec67841Dd5988) Most Broker functionality is restricted only for the owner, it includes managing rides, setting prices or slippages, burning shares. ##### Broker Owner Addresses: [0x85A732d8e21f1890BdeA4eDddCf4Dd0E70a31EA5](https://etherscan.io/address/0x85A732d8e21f1890BdeA4eDddCf4Dd0E70a31EA5) Most Broker functionality is restricted only for the owner, it includes managing rides, setting prices or slippages, burning shares. ## Smart contracts ### Ethereum #### StarkExchange Addresses: [0x82123571C8a5e0910280C066bc634c4945FFcbC8](https://etherscan.io/address/0x82123571C8a5e0910280C066bc634c4945FFcbC8#code), [0x4EDD62189732e9fF476ABa880b48c29432A7AC9B](https://etherscan.io/address/0x4EDD62189732e9fF476ABa880b48c29432A7AC9B#code) (Implementation #1 (Upgradable)), [0x62BCA4DB742A99c834e2c24b609656A70EA25379](https://etherscan.io/address/0x62BCA4DB742A99c834e2c24b609656A70EA25379#code) (Implementation #2 (Upgradable)), [0x8536850750956c2FEebeCAB786d82271a5467687](https://etherscan.io/address/0x8536850750956c2FEebeCAB786d82271a5467687#code) (Implementation #3 (Upgradable)), [0x1c3A4EfF75a287Fe6249CAb49606FA25659929A2](https://etherscan.io/address/0x1c3A4EfF75a287Fe6249CAb49606FA25659929A2#code) (Implementation #4 (Upgradable)), [0x3799ad2a4Eb4E882219B02C036656d4ECbD437A1](https://etherscan.io/address/0x3799ad2a4Eb4E882219B02C036656d4ECbD437A1#code) (Implementation #5 (Upgradable)), [0x1688abB0B5c72F34B7f78e857Aa317deD5B5D339](https://etherscan.io/address/0x1688abB0B5c72F34B7f78e857Aa317deD5B5D339#code) (Implementation #6 (Upgradable)), [0xB3788a88F063B217227E27ae16Ba550db3132bE6](https://etherscan.io/address/0xB3788a88F063B217227E27ae16Ba550db3132bE6#code) (Implementation #7 (Upgradable)), [0x1E153596BceB29c6EAE88DDB290eBeCC3FE9735e](https://etherscan.io/address/0x1E153596BceB29c6EAE88DDB290eBeCC3FE9735e#code) (Admin) #### Committee Addresses: [0xF000A3B10e1920aDC6e7D829828e3357Fc5128A9](https://etherscan.io/address/0xF000A3B10e1920aDC6e7D829828e3357Fc5128A9#code) (unverified) The source code of this contract is not verified on Etherscan. #### Broker Addresses: [0xe7c753895d492f8D4B06a2A1B16c1aEF2A7d16E5](https://etherscan.io/address/0xe7c753895d492f8D4B06a2A1B16c1aEF2A7d16E5#code) Broker manages investment strategies on L1 for tokens deposited to the system. Strategies invest in specific protocols, e.g. Compound and they escrow LP tokens as custom Wrapped tokens. #### StrategyCompound Addresses: [0x5b000954F70B0410685193B0afd3074B744B5C97](https://etherscan.io/address/0x5b000954F70B0410685193B0afd3074B744B5C97#code) It is through this contract that groups of users interact with the Compound DeFi protocol. #### GpsFactRegistryAdapter Addresses: [0x6e3AbCE72A3CD5edc05E59283c733Fd4bF8B3baE](https://etherscan.io/address/0x6e3AbCE72A3CD5edc05E59283c733Fd4bF8B3baE#code) #### OrderRegistry Addresses: [0x518c4A79a1102eEDc987005CA8cE6B87Ca14dDf8](https://etherscan.io/address/0x518c4A79a1102eEDc987005CA8cE6B87Ca14dDf8#code) #### SHARPVerifierCallProxy Addresses: [0x47312450B3Ac8b5b8e247a6bB6d523e7605bDb60](https://etherscan.io/address/0x47312450B3Ac8b5b8e247a6bB6d523e7605bDb60#code), [0x3597c5CBCbCB30079a0bD2A68cDE5f98272f9feb](https://etherscan.io/address/0x3597c5CBCbCB30079a0bD2A68cDE5f98272f9feb#code) (Implementation (Upgradable)), [0x21F9eC47b19d95b5C2DDFB6Ae5D4F92fAdacAEc4](https://etherscan.io/address/0x21F9eC47b19d95b5C2DDFB6Ae5D4F92fAdacAEc4#code) (Admin) CallProxy for GpsStatementVerifier. #### SHARPVerifier Addresses: [0x4956bda1d23F75B988644329c5B06BD1494a72b6](https://etherscan.io/address/0x4956bda1d23F75B988644329c5B06BD1494a72b6#code) Starkware SHARP verifier used collectively by Starknet, Sorare, ImmutableX, Apex, Myria, rhino.fi and Canvas Connect. It receives STARK proofs from the Prover attesting to the integrity of the Execution Trace of these Programs including correctly computed state root which is part of the Program Output. #### FriStatementContract Addresses: [0x30EfaAA99f8eFe310D9FdC83072e2a04c093d400](https://etherscan.io/address/0x30EfaAA99f8eFe310D9FdC83072e2a04c093d400#code) Part of STARK Verifier. #### MerkleStatementContract Addresses: [0x32a91Ff604AB2aDCd832e91D68b2f3f25358FdAd](https://etherscan.io/address/0x32a91Ff604AB2aDCd832e91D68b2f3f25358FdAd#code) Part of STARK Verifier. #### CairoBootloaderProgram Addresses: [0x24105e6697AdD9B4B1BDE04079a91BDFCCa24A47](https://etherscan.io/address/0x24105e6697AdD9B4B1BDE04079a91BDFCCa24A47#code) Part of STARK Verifier. #### MemoryPageFactRegistry Addresses: [0xe583BcDE0160b637330b27a3ea1F3c02ba2eC460](https://etherscan.io/address/0xe583BcDE0160b637330b27a3ea1F3c02ba2eC460#code) MemoryPageFactRegistry is one of the many contracts used by SHARP verifier. This one is important as it registers all necessary onchain data. The current deployment carries some associated risks: - Funds can be stolen if a contract receives a malicious code upgrade. There is no delay on code upgrades (CRITICAL). - Funds can be stolen if the source code of unverified contracts contains malicious code (CRITICAL).