Etherlink/Tezt: basic E2E test for fast withdrawals of FA tokens
Checklist
-
Provide automatic testing. -
Add an item in the changelog
What
Fast withdrawals overview
This MR is part of the fast withdrawals task.
Deposits of tokens from L1 to L2 (Etherlink) are confirmed with a low latency. This is however not the case for withdrawals (moving back tokens from L2 to L1), due to the refutation period for the state of the optimistic L2. At a high level, fast withdrawals of tokens from L2 (Etherlink) to L1 are made possible thanks to liquidity providers on L1 that prepay withdrawals and receive the withdrawals back later (once the refutation period ended) in exchange for a small fee. This allows to reduce the time for withdrawals from two weeks down to a few minutes (if not less) depending on the service provider.
Workflow: !16341 (diffs)
Fast withdrawals documentation:
- High level: https://docs.google.com/document/d/1ChMxGcOVNTLA1hpmXwzMsSSb2zMbRjddAMH4OcJbl1U/edit?tab=t.0
- Slightly more detailed spec: https://docs.google.com/document/d/1iF_kZguY8e1Vyl1DD2jwe_OyrPvzsWdvLvwdmTs36JE/edit?tab=t.0#heading=h.4hunbtv7tfkq
Changes in this MR
This merge request implements a basic E2E deposit and fast withdrawal of FA tokens wrapping Tez.
How
-
L1 contract ( !17115 (merged)):
The contract now parses the incoming ticket to determine whether it should route the transfer to the TezTicket
%burnentrypoint (for Tez transfers) or the FA%withdrawentrypoint (for FA tokens). For reference:- TezTicket
%burn: tzkt.io KT1CeFqjJRJPNVvhvznQrWfHad2jCiDZ6Lyj - FA ($OTTEZ)
%withdraw: tzkt.io KT1CaP2apQz1fMExBA7igaQeUjFJc42aZsQ8
- TezTicket
-
L2 precompile( !17114 (merged)): Implements logic to emit a fast withdrawal event and create a fast withdrawal message in the smart rollup outbox.
-
Testing ( !17449 (merged)): A basic E2E test has been written, following the existing test for regular Tez fast withdrawals, to validate the fast withdrawal process for both Tez and FA tokens. <--- This MR
Manually testing the MR
dune exec etherlink/tezt/tests/main.exe -- deposit fa_tokens fast_withdrawal /dal /threshold_encryption latest alpha --file evm_sequencer.ml --keep-temp --verbose
Summary by CodeRabbit
-
Tests
- Added validations confirming that token deposit and fast withdrawal processes perform as expected.
- Verified that the withdrawal feature remains inactive when the corresponding setting is disabled.
- Introduced security tests to ensure that token deposits are safeguarded against reentrancy issues.