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

Latest L1->L2 transactions #11

Closed
saimeunt opened this issue Jun 20, 2024 · 5 comments
Closed

Latest L1->L2 transactions #11

saimeunt opened this issue Jun 20, 2024 · 5 comments
Assignees
Labels

Comments

@saimeunt
Copy link
Collaborator

saimeunt commented Jun 20, 2024

Latest L1->L2 transactions

⚠️ Reading contributors guidelines to get assigned is MANDATORY!

Read contributors guidelines

User stories

  • As a user, I want to see the 6 latest L1->L2 transactions (mainly bridging assets from L1 to L2) when I access the homepage, with the L1 block number and tx hash along with the corresponding L2 tx hash.

Validation

At the moment, the frontend part is fully functional and fed with placeholder data in the accompanying util function fetchLatestL1L2Transactions in src/lib/utils.ts.
You only need to implement this util function properly to return the same transactions displayed on Etherscan.

Image

Implementation

In the long run we'd like this data to be consumed from an indexer but we can build a functional POC to help us better understand how to retrieve the needed info from the blockchain. We will reuse this logic later when we build the indexer.
My take on this is to fetch the logs from the latest 1000 blocks both on the L1 and L2 chain and perform a matching between the SentMessage/SentMessageExtension1 events emitted on L1 by L1CrossDomainMessenger and RelayedMessage emitted on L2 by L2CrossDomainMessenger.
The contracts ABI and viem encapsulation is already available under src/lib/contracts.
The correct way to perform the matching is to recompute the msgHash emitted in RelayedMessage from the arguments of SentMessage and SentMessageExtension1.
Feel free to propose and implement an alternative method if you find something more simple and straightforward.

Resources

@EjembiEmmanuel
Copy link

EjembiEmmanuel commented Jun 20, 2024

@saimeunt I'd love to work on this. I'm an experienced frontend developer and have made contributions to several projects on OnlyDust. I can get it done in 2-3 working days. You can view my public profile at https://app.onlydust.com/u/EjembiEmmanuel.

@melnikga
Copy link
Contributor

melnikga commented Jun 20, 2024

Hi, can I take this? I have been a contributor to several projects of the walnut team. My profile on onlydust: https://app.onlydust.com/u/melnikga

@danielcdz
Copy link
Contributor

Hello, @saimeunt @mazurroman My name is Daniel Calderon I'm a software developer focused on backend and data development, in the last months I started to contribute through OnlyDust to multiple projects, here you have my OD Profile: https://app.onlydust.com/u/danielcdz, to solve this issue I will try the following:

  • I will implement the function fetchLatestL1L2Transactions in src/lib/utils.ts to fetch the logs from the latest 1000 blocks both on the L1 and L2 chain and perform matching between the SentMessage/SentMessageExtension1 events emitted on L1 by L1CrossDomainMessenger and RelayedMessage emitted on L2 by L2CrossDomainMessenge just as you mentioned in the description.
  • I will remove the placeholder data.
  • I will perform the correct matching to get the data.
  • Then I will filter the records to leave just the latest 6 L1 - L2 transactions
    Also, I would like to research and investigate other ways to retrieve the data, having another approach at least documented can be useful in the long run and when building the indexer.

@saimeunt
Copy link
Collaborator Author

@danielcdz Assigning it to you, good luck!

@danielcdz
Copy link
Contributor

Thank you @saimeunt!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

No branches or pull requests

4 participants