kfastov / worldcoin-bridge-linea

World ID state bridge for Linea
MIT License
6 stars 24 forks source link

Create L2 monitor for Anchor events #44

Closed kfastov closed 2 months ago

kfastov commented 2 months ago

Description

Develop a JavaScript module that listens to L1L2MessageHashesAddedToInbox events on Linea (L2) for messages processed by L2MessageService and LineaWorldID. This module will identify and output known message hashes, facilitating the monitoring of root propagation on L2.

Tasks

  1. Set up necessary dependencies (ethers.js, Linea SDK if required)
  2. Create a new JavaScript file for the L2 event listener
  3. Implement function to connect to Linea network and set up event listeners. It should take contract addresses and Linea endpoint, and also an array of known message hashes as parameters
  4. Develop logic to process L1L2MessageHashesAddedToInbox events and extract message hashes
  5. Implement console logging for known message hashes

Acceptance Criteria

Resources

EjembiEmmanuel commented 2 months ago

@kfastov can I hop on this issue? I'm an experienced JavaScript Developer and tackle this issue by:

async function setupEventListeners(contractAddresses, knownMessageHashes) {
  try {
    // Get contract instances
    const l2MessageService = new ethers.Contract(contractAddresses.l2MessageService, abi, provider);
    // Initialize other contracts if needed

    // Listen for L1L2MessageHashesAddedToInbox events
    l2MessageService.on('L1L2MessageHashesAddedToInbox', (root, messageHashes) => {
      messageHashes.forEach((hash) => {
        if (knownMessageHashes.includes(hash)) {
          //  logic to process L1L2MessageHashesAddedToInbox events and extract message hashes       
         }
      });
    });

    console.log('Event listener set up successfully.');
  } catch (error) {
    console.error('Error setting up event listener:', error);
  }
}
onlydustapp[bot] commented 2 months ago

Hi @EjembiEmmanuel! Maintainers during the ODHack # 7.0 will be tracking applications via OnlyDust. Therefore, in order for you to have a chance at being assigned to this issue, please apply directly here, or else your application may not be considered.

ShantelPeters commented 2 months ago

Can I work on this ?

onlydustapp[bot] commented 2 months ago

Hi @ShantelPeters! Maintainers during the ODHack # 7.0 will be tracking applications via OnlyDust. Therefore, in order for you to have a chance at being assigned to this issue, please apply directly here, or else your application may not be considered.

ikemHood commented 2 months ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hey, I am ikem Peter. a fullstack software developer with 3+ years of working experience, I would love to help out with this issue...

How I plan on tackling this issue

To tackle this task, I'd start by creating a new JavaScript file and importing ethers.js and any necessary parts of the Linea SDK. I'd then write a main function that takes the Linea endpoint, L2MessageService address, LineaWorldID address, and an array of known message hashes as parameters. This function would use ethers.js to connect to the Linea network using the provided endpoint. Once connected, I'd set up event listeners for the L1L2MessageHashesAddedToInbox events on both the L2MessageService and LineaWorldID contracts. In the event handler, I'd extract the message hashes from the event data and compare them against the array of known hashes. When a match is found, I'd log it to the console with relevant details. Throughout the development, I'd focus on making the code efficient, well-documented, and easy to understand. I'd also implement error handling to manage any network issues or unexpected events. Finally, I'd test the module thoroughly to ensure it correctly identifies and logs known message hashes from both contracts.

fishonamos commented 2 months ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Backend developer

How I plan on tackling this issue

I will create a JavaScript module using ethers.js to listen for L1L2MessageHashesAddedToInbox events on Linea (L2). Next, I will identify known message hashes, and log them.

EjembiEmmanuel commented 2 months ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

@kfastov can I hop on this issue? I'm an experienced JavaScript Developer

How I plan on tackling this issue

async function setupEventListeners(contractAddresses, knownMessageHashes) {
  try {
    // Get contract instances
    const l2MessageService = new ethers.Contract(contractAddresses.l2MessageService, abi, provider);
    // Initialize other contracts if needed

    // Listen for L1L2MessageHashesAddedToInbox events
    l2MessageService.on('L1L2MessageHashesAddedToInbox', (root, messageHashes) => {
      messageHashes.forEach((hash) => {
        if (knownMessageHashes.includes(hash)) {
          //  logic to process L1L2MessageHashesAddedToInbox events and extract message hashes       
         }
      });
    });

    console.log('Event listener set up successfully.');
  } catch (error) {
    console.error('Error setting up event listener:', error);
  }
}
estherbreath commented 2 months ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi I am a Blockchain developer, very swift with Javascript and Web3 frontend.

My expertise in JavaScript and Web3 frontend development positions you perfectly to tackle this issue. By leveraging my skills, I can efficiently set up a JavaScript module that connects to the Linea network, listens for L1L2MessageHashesAddedToInbox events, and identify known message hashes. My familiarity with Web3.js will enable me to interact with smart contracts and process blockchain events smoothly, ensuring the module meets all acceptance criteria while adhering to best coding practices.

How I plan on tackling this issue

Below are the summary of how I’m going o tackle this issue.

• Create the Module File: Make a new JavaScript file dedicated to the event listener logic. 
• Connect to Linea Network: Write a function in the file that connects to the Linea network using the provided endpoint. This function will also set up event listeners for the L1L2MessageHashesAddedToInbox events on the specified contracts. 
• Listen for Events: Implement the logic to listen for these events, extract message hashes, and compare them with known hashes. Log any matches to the console. 
• Test and Document: Test the module thoroughly to ensure it works as expected.
onlydustapp[bot] commented 2 months ago

The maintainer kfastov has assigned EjembiEmmanuel to this issue via OnlyDust Platform. Good luck!