Skip to content

foundry: update packages/foundry JS deps, fix prettier config and dead RPC endpoints - #449

Open
rin-st wants to merge 5 commits into
mainfrom
foundry-deps-update
Open

rin-st wants to merge 5 commits into
mainfrom
foundry-deps-update

Conversation

@rin-st

@rin-st rin-st commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Since we're updated deps in se-2, here is the PR updating old foundry deps. Also, during the testing and sre challenges checks AI found some other smaller bugs and I decided to fix them all here in this PR.

  • ethers -> viem
  • fix prettier config
  • fix outdated rpc endpoints
  • removed outdated sre challenges from the list

forge fmt --check doesn't seem so easy test so I think it's better to fix it later in separate PR


Foundry counterpart of the hardhat deps refresh from scaffold-eth-2#1326, plus fixes for what surfaced while testing. No Solidity changes.

Deps (packages/foundry/package.json)

package before after
dotenv ~16.3.1 ~18.0.5
prettier ~2.8.8 ~3.9.9
qrcode ~1.5.3 ~1.5.4
toml ~3.0.0 ~5.0.0
shx ^0.3.4 ^0.4.0
ethers ~5.7.1 removed, replaced by viem ~2.57.3
envfile ~6.18.0 removed (never imported)

Versions are picked to pass the template's npmMinimalAgeGate: 7d.

Code

  • checkAccountBalance.js: viem public client (getBalance, getTransactionCount, formatEther) instead of ethers v5. ethers was used only here; viem is already the stack's client lib, has no background network detection (ethers v6 kept the process alive retrying unreachable RPCs), and retryCount: 0 keeps dead endpoints failing in ~15 ms. Error line shows HTTP <status> or the first line of the RPC error.
  • generateTsAbis.js: prettier.format is async in v3.

Prettier config: .prettier.json was never read by prettier (wrong filename), so make lint / make format ran with defaults. Renamed to .prettierrc.json and formatted scripts-js with it (printWidth 120, arrowParens avoid, trailingComma all): formatting only, verified token-equivalent apart from the two files above.

foundry.toml rpc_endpoints: mainnet moved off the dead eth-mainnet.alchemyapi.io (same fix as scaffold-eth-2#1326 for hardhat), polygonMumbai → polygonAmoy (also in [etherscan]), polygonZkEvmTestnet → polygonZkEvmCardona (public RPC, the demo Alchemy key has Cardona disabled), pgn / pgnTestnet removed (network shut down). scrollSepolia currently answers 526 on sepolia-rpc.scroll.io; hardhat uses the same URL, left as is.

Checked on a generated foundry instance: yarn install, prettier --check scripts-js (the JS half of make lint) green, forge config resolves the etherscan keys, yarn deploy on anvil (dotenv + toml 5 + async prettier produce a valid deployedContracts.ts), balance/nonce loop over every rpc_endpoints entry via viem: all live networks answer, dead ones fail fast, process exits.

Extensions list (src/extensions/challenges.ts): dropped challenge-state-channels, challenge-multisig, challenge-svg-nft. Their branches no longer exist in scaffold-eth/se-2-challenges (404), so -e <name> failed. Found while checking that no challenge foundry part depends on ethers (none does; oracles / lending / stablecoins already ship viem).

Not touched: forge fmt --check still fails on the 2-space-indented example contracts vs tab_width = 4 (separate decision).

🤖 Generated with Claude Code

rin-st and others added 5 commits October 14, 2026 17:08
@rin-st
rin-st requested a review from technophile-04 October 15, 2026 11:06
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.

1 participant