Tag: web3
All the articles with the tag "web3".
-
Fork testing smart contracts runs your tests on a copy of mainnet state. Learn when it helps, when it gives false confidence, and how to pin the block.
-
How to write a reentrancy test in Solidity with Foundry. Build the attacker contract, watch the test fail, then apply checks-effects-interactions and a guard.
-
Six Solidity unit test patterns with Foundry code: revert, event, access control, rounding, fuzz and state-transition tests, plus the bug each one catches.
-
The edge cases that break NFT contracts: stale approvals, mint limits, reentrancy, royalties, metadata and ownership, with Hardhat tests for each.
-
Build realistic DeFi test data: fee-on-transfer, rebasing and blacklistable token mocks, forked mainnet state and failure scenarios, with Hardhat code.
-
Use gas ceilings, gas reports and snapshot tests to find and lock in gas savings in smart contracts, with measured Hardhat examples.
-
How to test upgradeable contracts: storage layout checks, proxy upgrade simulation, initializer tests, gas checks and a pre-upgrade checklist.
-
Set up automated smart contract tests with Hardhat and ethers v6, run them in GitHub Actions on every push, and add gas, fuzz and fork tests.
-
Budget for web3 testing: audits, QA salaries, infrastructure and gas, with sourced ranges and a sample annual budget for a mid-sized project.
-
How to test the contract-to-frontend flow in a dapp: a local Hardhat chain, an injected wallet provider, Playwright tests and a CI run, with a DEX swap example.
-
Web3 testing differs from web2 in environment, state, async behavior, security, performance and auth. Practical fixes for each, with Hardhat examples.