Skip to content

Migrate local dev from Hardhat to Anvil#1810

Merged
YoshihitoAso merged 4 commits intodev-26.6from
change-to-anvil
Apr 14, 2026
Merged

Migrate local dev from Hardhat to Anvil#1810
YoshihitoAso merged 4 commits intodev-26.6from
change-to-anvil

Conversation

@YoshihitoAso
Copy link
Copy Markdown
Member

@YoshihitoAso YoshihitoAso commented Apr 14, 2026

📌 Description

Replace Hardhat-based local test/dev setup with Anvil (Foundry).

✅ Related Issues

None

🔄 Changes

Development Environment Migration:

  • Replaced Hardhat with Anvil as the local Ethereum development and testing network. This includes updating documentation (README.md, README_JA.md), Docker configuration (docker-compose.yml), and removing all Hardhat-related files (hardhat.config.js, package.json, tests/Dockerfile_hardhat) in favor of new Anvil equivalents (tests/Dockerfile_anvil).

Exception Handling Improvements:

  • Updated exception handling in event log collection to also catch Web3RPCError in addition to previous exceptions.

Configuration and Testing Adjustments:

  • Changed the default transaction polling latency to be shorter (0.02s) during unit tests, improving test speed, and added corresponding tests to ensure this behavior (app/config.py, tests/app/config_test.py).
  • Updated test expectations and logic to align with Anvil's behavior, such as changes in gas price and error codes, and improved test reliability by ensuring transaction receipts are awaited where necessary.

Code and Test Cleanup:

  • Refined test queries to ensure correct token selection and improved assertion accuracy in tests/app/admin_Tokens_POST_test.py.
  • Removed unnecessary npm install and npm update steps from the Makefile as Hardhat is no longer used.

📌 Checklist

  • I have added tests where necessary.
  • I have updated the documentation where necessary.

Replace Hardhat-based local test/dev setup with Anvil (Foundry).
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 14, 2026

Coverage

Coverage Report •
FileStmtsMissBranchBrPartCoverMissing
app
   config.py10348496%62–63, 67, 159
app/api/routers
   events.py16719761188%93, 111, 214–215, 220, 222, 224, 226, 278–279, 284, 351–352, 355, 365, 367, 369, 424–425
batch
   indexer_Token_Holders.py34441861788%105, 122, 172, 417–418, 450–451, 469–470, 477–478, 507–508, 539–540, 573–574, 609–610, 647–648, 673–675, 685–695, 697–698, 702–705
tests
   conftest.py18416281391%61–62, 231, 243–247, 250, 282, 292–297
tests/app
   admin_Tokens_POST_test.py243000100% 
   config_test.py27000100% 
   eth_EthereumJsonRpc_test.py59000100% 
   eth_GetTransactionCount_test.py59000100% 
   eth_SendRawTransactionNowait_test.py282000100% 
   eth_SendRawTransaction_test.py452000100% 
   events_IbetSecurityTokenDVPEvents_test.py2830120100% 
   events_IbetSecurityTokenEscrowEvents_test.py353000100% 
   events_IbetSecurityTokenInterfaceEvents_test.py26950098%136, 153–154, 157, 159
tests/helpers
   anvil_transaction_sync.py48116477%47, 57, 60, 65–66, 69, 83, 88–91
   contract.py54810385%120, 122–126, 128, 130
   ibet_share_token.py141118399%224
TOTAL380191681369675995% 

Tests Skipped Failures Errors Time
1270 0 💤 0 ❌ 0 🔥 11m 58s ⏱️

Add an anvil transaction sync patch and enable it for unit tests to route tx sending through Anvil's eth_sendTransactionSync and cache receipts.
@YoshihitoAso YoshihitoAso marked this pull request as ready for review April 14, 2026 09:55
@github-actions github-actions bot requested a review from purplesmoke05 April 14, 2026 09:55
@YoshihitoAso YoshihitoAso merged commit 8387d27 into dev-26.6 Apr 14, 2026
12 checks passed
@YoshihitoAso YoshihitoAso deleted the change-to-anvil branch April 14, 2026 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants