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

feat: adding hardhat #626

Merged
merged 19 commits into from
Dec 4, 2024
Merged

feat: adding hardhat #626

merged 19 commits into from
Dec 4, 2024

Conversation

kstroobants
Copy link
Contributor

@kstroobants kstroobants commented Nov 21, 2024

Fixes #625

What

  • Add Hardhat node service with Docker configuration
  • Add necessary dependencies for contract compilation setup
  • Add access to compiled hardhat contract in jsonrpc service
  • Configure hardhat.config.js with local network settings and hardhat specifics
  • Add 1 test account with 10,000 ETH and have free transactions so no funding is needed
  • Add web3 Python package to backend requirements file
  • Update .gitignore for Hardhat artifacts and cache
  • Add solidity contract to write transactions to that emits events
  • Added database migration file so that a transaction has the ghost contract address of the hardhat network
  • When a genlayer contract is deployed, then a hardhat contract is deployed, both are linked in the CurrentState table
  • When a genlayer write method is executed, then the new transaction gets the hardhat contract from the CurrentState table
  • When a genlayer transaction status changes, then a rollup transaction is created on the hardhat network
  • Add hardhat port in .env
  • Remove rollup transactions database table

Why

  • To add more value to the user
  • See the rollup transactions on a test Ethereum network

Testing done

  • Tested by running the simulator
  • Add hardhat test with code from the transaction_processor

Decisions made

At the moment one hardhat account is used.

Checks

  • I have tested this code
  • I have reviewed my own PR
  • I have created an issue for this PR
  • I have set a descriptive PR title compliant with conventional commits

Reviewing tips

  • Run the simulator
  • Run the unit test

User facing release notes

The simulator contains the hardhat network development environment

mpaya5 and others added 8 commits November 19, 2024 12:42
- Add Hardhat node service with Docker configuration
- Configure hardhat.config.js with local network settings
- Add 20 test accounts with 10,000 ETH each
- Add web3 Python package to backend requirements
- Update .gitignore for Hardhat artifacts and cache
- Add contract compilation setup with hardhat
- Configure project structure for smart contracts
- Fix file path for GhostContract.json artifact
- Add necessary dependencies for contract compilation
- Setup directory structure for contracts and artifacts
- Moved web3 python package into backend requirements file
- Added access to compiled hardhat contract in jsonrpc service
- Added database migration file so that a transaction has the ghost contract address of hardhat network
- When a genlayer contract is deployed then a hardhat contract is deployed, both are linked in the CurrentState table
- When a genlayer write method is executed then the new transaction gets the hardhat contract from the CurrentState table
- When a genlayer transaction changes from status then a rollup transaction is created on the hardhat network
- todo: remove rollup transaction table, put hardhat port in env, link genlayer account to hardhat account, check for out of gas, remove prints
@kstroobants kstroobants linked an issue Nov 21, 2024 that may be closed by this pull request
6 tasks
Copy link

codecov bot commented Nov 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 18.61%. Comparing base (af6baf7) to head (577f716).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #626   +/-   ##
=======================================
  Coverage   18.61%   18.61%           
=======================================
  Files         123      123           
  Lines        9618     9618           
  Branches      299      299           
=======================================
  Hits         1790     1790           
  Misses       7744     7744           
  Partials       84       84           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@kstroobants kstroobants changed the title Feat: adding hardhat feat: adding hardhat Nov 21, 2024
Copy link
Collaborator

@cristiam86 cristiam86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job. Let's try to see if we can have the same addresses for both contracts (genlayer contract and ghost contract)

- Add genlayer-consensus smart contracts to hardhat/contracts directory
- Update hardhat.config.js to enable new code generator (viaIR: true)
- Add @openzeppelin/contracts and @openzeppelin/contracts-upgradeable dependencies
- Configure hardhat Docker container for contract compilation
- Verify hardhat node functionality in genlayer-studio

This commit sets up the smart contract development environment with the
necessary dependencies and configurations to compile and deploy
genlayer-consensus contracts.
Copy link
Collaborator

@cristiam86 cristiam86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment about amm intelligent contract example

examples/contracts/amm_adaptive.py Outdated Show resolved Hide resolved
docker/Dockerfile.hardhat Fixed Show resolved Hide resolved
- Added migration for ghost_contract_address column in transactions table
- Fixed security issues in hardhat docker configuration
- Ensured proper migration sequence (0d9538be0318 -> cb34b6b353ed)

Migration changes:
- Added new column ghost_contract_address (String, nullable) to transactions table
- Provided proper upgrade and downgrade paths
- Verified migration execution and current head state

TODO: Frontend issues to fix:
- Methods panel not opening after transaction acceptance
- Need to investigate UI response after successful transactions
@mpaya5 mpaya5 force-pushed the feat/adding-hardhat branch from 091c28f to 02df53c Compare November 28, 2024 12:31
- Deleted amm_adaptive.py because is not using the new syntax

I will upload the new amm_adaptive.py whenevir will be ready
- Fixed contract deployment state updates for frontend synchronization
- Improved contract method interactions and state management
- Ensured proper state updates after contract value changes
@mpaya5 mpaya5 requested a review from cristiam86 November 29, 2024 07:57
Copy link

sonarqubecloud bot commented Dec 4, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@mpaya5 mpaya5 requested a review from denishacquin December 4, 2024 08:57
@mpaya5 mpaya5 merged commit 78ff5cf into main Dec 4, 2024
16 of 19 checks passed
mpaya5 added a commit that referenced this pull request Dec 4, 2024
mpaya5 added a commit that referenced this pull request Dec 4, 2024
Copy link
Contributor

github-actions bot commented Dec 5, 2024

🎉 This PR is included in version 0.27.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants