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

✨ Feature: Replace hardhatExec with Hardcoded Bytecode Deployment in testUtils #100

Open
1 task done
joepegler opened this issue Oct 22, 2024 · 0 comments
Open
1 task done
Assignees
Labels
enhancement New feature or request

Comments

@joepegler
Copy link
Collaborator

Feature or Improvement Description

Remove the hardhatExec functionality from the testUtils file and replace it with hardcoded bytecode deployment using setCode on the Anvil instance. Add K1_VALIDATOR_FACTORY_BYTECODE, K1_VALIDATOR_BYTECODE, and NEXUS_IMPLEMENTATION_BYTECODE to callData.ts.

Benefits & Outcomes

  • Enable our code to be included in viem's repository for testing purposes
  • Simplify the testing setup by removing the dependency on hardhat execution
  • Improve test reliability by using consistent, hardcoded bytecode
  • Reduce external dependencies in the testing process
  • Speed up test execution by eliminating the need for hardhat compilation and deployment

Implementation Ideas

  1. Remove hardhatExec imports and related functions from testUtils.ts

  2. Add new constants to callData.ts:

    export const K1_VALIDATOR_FACTORY_BYTECODE: Hex = "0x..."
    export const K1_VALIDATOR_BYTECODE: Hex = "0x..."
    export const NEXUS_IMPLEMENTATION_BYTECODE: Hex = "0x..."

    (Fetch these bytecodes from the Base Sepolia explorer)

  3. Update the initDeployments function in testUtils.ts:

    • Remove calls to hardhatExec.init() and hardhatExec.deploy()
    • Implement setCode calls using the new bytecode constants:
      await testClient.setCode({
        address: K1_VALIDATOR_FACTORY_ADDRESS,
        bytecode: K1_VALIDATOR_FACTORY_BYTECODE
      })
      // Repeat for K1_VALIDATOR and NEXUS_IMPLEMENTATION
  4. Update any other functions in testUtils.ts that relied on hardhatExec

  5. Modify the toConfiguredAnvil function to remove any hardhat-specific configurations

  6. Update unit tests to reflect the new deployment method

  7. Verify that all tests pass with the new bytecode deployment method

  8. Update documentation to reflect the changes in the testing setup

  9. Remove any remaining hardhat dependencies that are no longer needed

References

Any References?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct.
@joepegler joepegler added the enhancement New feature or request label Oct 22, 2024
@VGabriel45 VGabriel45 changed the title # ✨ Feature Request: Replace hardhatExec with Hardcoded Bytecode Deployment in testUtils ✨ Feature: Replace hardhatExec with Hardcoded Bytecode Deployment in testUtils Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants