Solidity error handling, by gas cost:
• `require(cond, "msg")` — ~50 gas per byte in the message string
• `revert SomeError(arg)` — ~22 gas per call + a 4-byte selector
Etherscan decodes named errors with their args. require strings are just opaque bytes in the revert data.
显示更多