scroll-tech / contribute-to-scroll

This repository guides developers wanting to contribute to the Scroll ecosystem.
https://scroll.io
994 stars 621 forks source link

L2 tx finality Metamask Snap #21

Open pajicf opened 1 year ago

pajicf commented 1 year ago

Name of the project

L2 tx finality Metamask Snap

Project abstract

Create a Metamask Snap which will display finality of a TX on the Scroll Rollup inside the browser extension.

Specification

How does block finalisation process work on Scroll?

Scroll blocks are finalised on L1 in a multi-step process. Each L2 block will progress through the following three stages until it is finalised.

  1. Precommitted indicates a block has been proposed by a Sequencer and sent to Rollers. Although Precommitted blocks are not yet a canonical part of the Scroll L2 chain because they have not been posted on the Ethereum base layer, users who trust the Sequencer can choose to take action on them in anticipation.
  2. Committed indicates the transaction data of this block has been posted on the rollup contract on Ethereum. This ensures that the block data is available, but does not prove that it has been executed in a valid way.
  3. Finalized indicates the correct execution of transactoins in this block has been proven by verifying a validity proof on-chain on Ethereum. Finalized blocks are considered canonical parts of the Scroll L2 chain.

Problem

Metamask being primarily a wallet for the L1 (Ethereum) isn't aware of the other steps of tx finalisation other than them being executed by the node (sequencer). Users aren't aware what the status of their transaction is by just using the wallet.

Solution

Extend Metamask wallet using Snaps to be aware of complete tx finalisation process.

Useful Links

https://scroll.io/blog/architecture https://scroll.io/bridge https://metamask.io/snaps/

0x4r45h commented 11 months ago

I think this is not possible at the moment. the snap documentation explicitly mentions the limitation of snap on UI modification.
However, I tried to bake something using Snap-Notifications but, it seems there is no way to access the transactions history of Metamask through Snap.