[go: up one dir, main page]

Etherlink: fast withdrawals (v1)

MR Owners

Context

MR is rebased on !16341 (merged).

Introduces the fast-withdrawal mechanism for Etherlink, introducing a new L1 fast withdrawal contract (we made a separate contract for the prototype) and adding a new entrypoint to the L2 withdrawal precompile contract. The main addition is the ability to handle fast-withdrawal orders, manage interactions between users and service providers, and validate withdrawal transactions across L1 and L2.

The fast-withdrawal feature allows users to receive their funds on L1 almost instantly, thanks to service providers who prepay the withdrawal before the L2 state is cemented. This provides a significant improvement in user experience by reducing waiting times for L1 transactions, particularly in scenarios requiring urgent liquidity. This feature is essential for scaling Tezos applications that use rollups and need rapid fund withdrawals.

How

The fast-withdrawal mechanism works thanks to code executed on L1 but also on L2.

L1

The fast-withdrawal functionality is implemented by introducing a new fast withdrawal L1 contract with these entrypoints:

  • %default: Handles withdrawals initiated by L2 and matches them with prepaid funds from service providers.
  • %payout_withdrawal: Allows service providers to prepay a user’s withdrawal, which is stored until the L2 state is finalized.

But also a service provider contract that will own the tickets and make the payout for users via a %payout_proxy entrypoint.

See !16341 (merged).

L2

On the L2 precompile contract side a new fast_withdrawal_base58 entrypoint was added:

  • An event is emitted when a user initiates a withdrawal. This will help the service provider to track whenever a fast withdrawal is executed through logs.
  • The event contains the necessary informations including, the timestamp, a unique withdrawal id, the amount and the base withdrawer address so that the service provider is able to make the fast payout.
  • An outbox message is posted so that the final payment is executed at some point (after cementation) in the fast withdrawal L1 contract. Either the payment is made to the base withdrawer if nobody did the payout, either the payment is made to the service provider which made the payment in advanced to the base withdrawer.

NB: A flag is added around the precompiled contract so that we have control on whenever we want the feature to be available for people on testnet(s) or mainnet.

Manually testing the MR

E2E FW test:

dune exec etherlink/tezt/tests/main.exe -- evm deposit fast_withdraw /dal latest alpha --file evm_rollup.ml

Feature flag test:

  • check fast withdrawal fails if feature flag is deactivated:
dune exec etherlink/tezt/tests/main.exe -- evm feature_flag fast_withdraw /dal latest alpha --file evm_rollup.ml
  • check feature flag is enabled in the smart rollup storage:
dune exec etherlink/tezt/tests/main.exe -- feature_flag fast_withdrawal  --file evm_sequencer.ml
Edited by Rodi-Can Bozman

Merge request reports

Loading