✨ Feature: Replace hardhatExec with Hardcoded Bytecode Deployment in testUtils
- Dominant language
- TypeScript
- Stars
- 14
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
### 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:
```typescript
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:
```typescript
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
- [Existing testUtils.ts file]
- [callData.ts file](src/test/callDatas.ts)
- [Base Sepolia Explorer](https://sepolia.basescan.org/)
- [viem documentation](https://viem.sh/)
### Any References?
_No response_
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.