solidity-lean/SolidCore/Witness/RevertCustomErrorStorageString.lean
arena-lean-staging-agent[bot] dab83ef12b
fix: custom-error revert arg must materialize a bare storage bytes/string/array (#8) (#3)
A custom-error revert argument is a value-use boundary: the argument
CONTENTS are ABI-encoded into the revert data (like emit/abi.encode*/
keccak256). A bare state bytes/string/dynamic-array lowers to
Expr.storage key, whose eval is the HEADER word (.length convention),
so the error encoder's asBytes?/abiEncodeValues? returns none ->
RevertData.typeMismatch = Panic(0).

revert Bad(storageString) with error Bad(string) therefore diverged
from solc+EVM (which materializes the storage string and reverts with
the custom error carrying its contents).

Fix: both custom-error revert lowering arms (bare-ident and
member-qualified Stmt.revert name coreArgs) now wrap their arg cores
with materializeStorageValueUseCores, mirroring the emit-event fix (#7);
every other core shape passes through untouched.

Regression: SolidCore/Witness/RevertCustomErrorStorageString.lean.

Co-authored-by: Lean Semantics Review Agent <agent@solidcore.local>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-19 06:48:39 +00:00

141 lines
5.2 KiB