Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(l2): l1_watcher make deposits unique #1321

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

fborello-lambda
Copy link
Contributor

@fborello-lambda fborello-lambda commented Nov 27, 2024

Motivation

We need a way to identify deposit. In order to do it, we can use a "depositId" that works as a counter. It is being incremented every time a deposit event is emitted.

We've been starting the l1_watcher from block 0. Fetching logs from block 0 will throw errors if asking light_nodes and it's wasteful. We will need a more robust way to keep track of it, for now, we should start from the first block in which the CommonBridge was deployed.

Description

  • [CommonBridge] Use the depositId to construct the deposit_hash (keccak(to || value || depositId))
  • [L1Watcher] Use the depositId from the logs to avoid duplicating the mint transaction. And use it as the mint transaction's nonce. In this way, the [Committer] can create the StateDiff to send the commit transaction to the OnChainProposer.
  • Add useful Makefile targets.
  • Add simple command to fetch the depositId.
  • Start from the block in which the CommonBridge was deployed.

Closes #1191

@fborello-lambda fborello-lambda self-assigned this Nov 27, 2024
@fborello-lambda fborello-lambda changed the title refactor(l2): l1_watcher refactor(l2): l1_watcher make deposits unique Nov 28, 2024
@fborello-lambda fborello-lambda marked this pull request as ready for review November 28, 2024 20:55
@fborello-lambda fborello-lambda requested a review from a team as a code owner November 28, 2024 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

fix(L2): add uniqueness to deposit logs on L1
1 participant