solidity-lean/SolidCore/Witness/RequireLibraryQualifiedError.lean
Daniel Robinson b2f8d7b11f
fix(typecheck): require(cond, L.Bad(a)) with library-qualified custom error over-rejected -> unknownFunction (solc succeeds) (#43)
The require-with-custom-error checker's member arm resolved the error
callee's unqualified name only against the contract's flattened errors
(checkCustomErrorArgs), then fell back to re-checking the whole require(...)
as an ordinary expression -- where EL.Bad(a) resolves as a member function
call and is rejected as unknownFunction "Bad". A library-declared error
(revert L.Bad(a) already handled by checkRevertCall) was thus over-rejected
in the require form, failing closed on an in-scope solc-accepted program.

Mirror checkRevertCall's library arm: when the member callee's base is a
typeName (Ty.user path), resolve the error against that named type's error
table (contractErrorSig?) before the flattened-scope fallback. The executable
lowering already lowers the member require-custom to requireCustom by the bare
name, and the library qualifier is not part of the error selector, so the
selector is soundly encoded.

Witness: SolidCore.Witness.RequireLibraryQualifiedError (accepted + run()=>5).

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-25 01:27:12 -04:00

137 lines
5 KiB