Solidity Reentrancy: CEI Ordering and nonReentrant Guards for Payouts
Use CEI ordering and nonReentrant guards to prevent reentrancy in Solidity payout functions that send ETH to untrusted recipients.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Use CEI ordering and nonReentrant guards to prevent reentrancy in Solidity payout functions that send ETH to untrusted recipients.
Prevent reentrancy attacks in Solidity by implementing the Checks-Effects-Interactions pattern. Learn how to order state changes to secure funds and optimize gas.
Custom errors in Solidity 0.8.4+ save deployment gas and carry typed revert data. Learn when to use them and how to decode them off-chain.
Solidity custom errors replace costly revert strings with 4-byte selectors, cutting bytecode size and making reverts easier to decode off-chain.
A diagnostic guide for Solidity reentrancy caused by state-change-after-external-call. Map calls, check ordering, apply Checks-Effects-Interactions and reentrancy guards, with checks and escalation criteria.
Replace require strings with Solidity custom errors to cut revert gas costs and get structured, decodable failure data. Works from 0.8.4 onward; requires ABI publishing for explorer support.
Learn how to declare Solidity immutable variables to store constructor‑only values in bytecode, reduce gas costs, and avoid accidental modification after deployment.
Learn how Hardhat’s console.log lets you print debug messages directly from Solidity contracts during testing, with zero gas cost in production builds when the optimizer is enabled.
Implement the Checks‑Effects‑Interactions pattern in Solidity to stop reentrancy attacks. A step‑by‑step example, verification steps with Hardhat and Slither, and a discussion of trade‑offs and limitations.