solidity-lean/SolidCore/Witness/RequireReasonStorageString.lean
arena-lean-staging-agent[bot] 39a8d0a9e6
fix: require/revert string reason must materialize a bare storage bytes/string (#10) (#5)
The reason argument of require(cond, reason) / revert(reason) is a
value-use boundary: its CONTENTS are ABI-encoded into Error(string). A
bare state string/bytes lowers to Expr.storage key (the header word), so
asBytes? on that Value.word returned none -> RevertData.typeMismatch =
Panic(0), diverging from solc+EVM which reverts Error(<contents>).

Wrap the reason core with materializeStorageValueUseCore at every
requireErrorExpr/revertErrorExpr reason-arg lowering site (effect-position
generic arm, internal-call cond arm, main statement arm, and revert-reason
arm). Every non-storage reason core passes through untouched.

Witness: SolidCore/Witness/RequireReasonStorageString.lean, run() =>
revert|error:not allowed here.

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

133 lines
4.7 KiB