kfastov / worldcoin-bridge-linea

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

Develop scheduled root propagation mechanism #42

Closed kfastov closed 1 month ago

kfastov commented 2 months ago

Description

Create a JavaScript module that periodically calls the propagateRoot method on the LineaStateBridge contract using ethers.js and the Linea SDK. This module will automate the process of propagating roots from L1 to L2.

Tasks

  1. Add necessary dependencies to the project (ethers.js, Linea SDK)
  2. Create a new JavaScript file for the purpose of this issue
  3. Create a main function that periodically calls propagateRoot on LineaStateBridge
  4. Implement error handling and logging for failed transactions
  5. Add configuration options for period, LineaStateBridge address, and other necessary parameters
  6. Set up secure environment variable handling for the private key

Acceptance Criteria

Caveats

Resources

Mystic-Nayy commented 2 months ago

Hi @kfastov i am interested in this issue I can work on it perfectly I will do the following

  1. Install dependencies (ethers, Linea SDK) and create a TypeScript file.
  2. Write a function to securely load the private key, configure the interval, and call propagateRoot using LineaStateBridge.
  3. Implement error handling, logging, and use environment variables for sensitive data.
onlydustapp[bot] commented 2 months ago

Hi @Gift-Naomi! 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.

Iwueseiter commented 2 months ago

Hi @kfastov can I work on this?

onlydustapp[bot] commented 2 months ago

Hi @od-hunter! 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.

onlydustapp[bot] commented 2 months ago

Hi @Iwueseiter! 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.

onlydustapp[bot] commented 2 months ago

Hi @Gift-Naomi! 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.

onlydustapp[bot] commented 2 months ago

Hi @od-hunter! 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

Hi @kfastov 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.

kfastov commented 2 months ago

Sorry changed the description and migrated it to Javascript

Dprof-in-tech commented 2 months ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

As an experienced Full Stack Blockchain Developer, I'm excited to contribute my expertise to Edition 7 of the OnlyDust hackathons. With a strong background in Next.js, TypeScript, JavaScript, React, Node.js, Solidity, and Cairo, I've honed my technical skills across the blockchain development landscape. My journey with OnlyDust began at Edition 2, and I've since made 28 contributions across 11 projects. This extensive experience on the platform has allowed me to develop a keen understanding of delivering high-quality solutions under tight deadlines. I bring a unique blend of technical prowess and user-centric design to every project, whether I'm crafting immersive 3D experiences or developing innovative smart contracts. My track record demonstrates my ability to adapt quickly and contribute effectively to diverse challenges. I'm confident in my capacity to tackle new problems and drive innovation in the blockchain space. As we embark on Edition 7, I'm eager to leverage my hackathon experience and technical skills to push the boundaries of what's possible in blockchain development. With a passion for creating cutting-edge solutions, I'm excited to collaborate with the OnlyDust community and contribute to the advancement of the blockchain ecosystem.

How I plan on tackling this issue

I will add the necessary dependencies (ethers and LineaStateBridge from @lineaprotocol/sdk) at the beginning of the file. I will create a new JavaScript file called propagateRoot.js to house the implementation. I will define the propagateRoots function, which takes the following parameters: period: The interval (in milliseconds) at which to call the propagateRoot function. lineaStateBridgeAddress: The address of the LineaStateBridge contract. privateKey: The private key used to sign the transactions. Inside the propagateRoots function: I will create an Ethereum provider using the ethers.providers.JsonRpcProvider class, connecting to the Linea node. I will create an instance of the LineaStateBridge contract using the provided lineaStateBridgeAddress. I will load the Ethereum wallet using the provided privateKey. I will set up a periodic interval (using setInterval) to call the propagateRoot function. I will call the propagateRoot function on the LineaStateBridge contract, setting the appropriate gas limit and gas price. I will wait for the transaction to be mined and log the successful propagation. I will implement error handling and logging for failed transactions within the try-catch block. I will add configuration options for the LINEA_STATE_BRIDGE_ADDRESS, PROPAGATION_PERIOD, and PRIVATE_KEY variables, which can be set as environment variables. I will set up secure environment variable handling for the PRIVATE_KEY variable, throwing an error if it's not provided. I will call the propagateRoots function at the end of the file, handling any unhandled errors. I will handle gas price fluctuations and implement a mechanism to retry failed transactions, as mentioned in the caveats. Additionally, i will ensure that the private key is never logged or exposed in the code or the logs.

TropicalDog17 commented 2 months ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi, I'm a software engineer who have experience in Solidity, Javascript & Typescript and has helped with many open source projects. I also have previously contribute to the repository and am familiar with the flow of the bridge. I want to contribute and complete the issue to fulfill the bridge functionality.

How I plan on tackling this issue

I would first spend some time to work on how the PropagateRoot works, and try to do it successfully one time manually. After gaining a solid grasp of PropagateRoot, I'll research the library(Ethers.js, Linear SDK) thoroughly. Based on my research, I'll proceed to implement the necessary code changes. Finally, I'll implement unit tests and conduct e2e tests to verify the overall functionality and integration.

Ugo-X commented 2 months ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

My background and how it can be leveraged I am a Full Stack blockchain Developer with expertise in Next.js, Nest.js, TypeScript, JavaScript, React, Node.js, Three.js, and Solidity. My journey with OnlyDust hackathons began at Edition 1, and I've since made 47 contributions across 11 projects. With my extensive experience on the OnlyDust platform (profile: https://app.onlydust.com/u/Ugo-X), I've honed my skills in delivering quality solutions under pressure. I bring a unique blend of technical proficiency and user-focused design to every project, whether it's crafting immersive 3D experiences or developing smart contracts. My track record shows I can adapt quickly and contribute effectively to diverse challenges. As we surf through Edition 7, I'm excited to leverage my skills and hackathon experience to push the boundaries of blockchain development. I'm confident in my ability to tackle new challenges and drive innovation in this space.

How I plan on tackling this issue

I will employ the following comprehensive approach to solve the issue of creating a JavaScript module that periodically calls the propagateRoot method on the LineaStateBridge contract using ethers.js and the Linea SDK:

  1. Set up the Project Environment:

    • Install the necessary dependencies: ethers.js and the Linea SDK.
    • Create a new JavaScript/TypeScript file for the module.
    • Set up secure environment variable handling for the private key.
  2. Implement the Main Function:

    • Create a main function that will periodically call the propagateRoot method on the LineaStateBridge contract.
    • Use the ethers.js library to interact with the Ethereum blockchain and the LineaStateBridge contract.
    • Utilize the Linea SDK to simplify the interaction with the bridge contract.
    • Ensure the private key is securely read from an environment variable and never logged or exposed.
  3. Error Handling and Logging:

    • Implement proper error handling for the propagateRoot function calls, including retries and fallback mechanisms to handle failed transactions due to factors like gas price fluctuations.
    • Set up robust logging to capture any errors or issues that may arise during the execution of the module.
    • Ensure that the error handling and logging are well-documented and follow best practices.
  4. Configuration Options:

    • Add configuration options for the interval at which the propagateRoot method is called.
    • Allow the module to accept the address of the LineaStateBridge contract as a parameter.
    • Ensure the configuration options are easily customizable and well-documented.
  5. Documentation and Best Practices:

    • Thoroughly document the module, its usage, and any important considerations or caveats.
    • Adhere to best practices for JavaScript/TypeScript development, such as code organization, naming conventions, and modularity.
    • Ensure the code is well-structured, easy to understand, and maintainable.
  6. Testing and Validation:

    • Implement unit tests to verify the correct behavior of the module, including the periodic propagateRoot calls, error handling, and configuration options.
    • Perform end-to-end testing to ensure the module integrates seamlessly with the LineaStateBridge contract and the Linea SDK.
    • Validate the module's functionality and performance under various conditions, including failed transactions and gas price fluctuations.

By following this approach, I will create a comprehensive JavaScript module that reliably and securely automates the process of propagating roots from L1 to L2 using the LineaStateBridge contract. The module will be well-documented, adhere to best practices, and provide a robust and configurable solution to the problem.

onlydustapp[bot] commented 2 months ago

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