solidity-lean/SolidCore/Witness/DeployAbstract.lean
Dan Robinson f23e5bbd29 fix #154 DEPLOY-ABSTRACT: guard top-level deploy against non-instantiable kinds
The top-level deploy/acceptance entry (CheckedProgram.constructContractFrom
and constructContractWithContext, plus their Option variants) fetched the
contract and constructed it with no creatability check, so deploying an
`abstract` contract, an `interface`, or a `library` was wrongly ACCEPTED. solc
0.8.35 emits an empty binary for all three and rejects `new A()` with "Cannot
instantiate an abstract contract" / "Invalid use of a library name".

Apply the same guard the `new`-expression site already uses
(TypeCheck.requireCreatableContractDecl: kind == contract && !abstract) at the
deploy entry, keeping the deploy site and the new-site consistent. Concrete
contracts (including one implementing an abstract base) still deploy unchanged.

Witness: SolidCore/Witness/DeployAbstract.lean (imported from SolidCore.lean)
pins that abstract/interface/library programs typecheck but their deploy is
rejected, while concrete contracts still deploy. Over-accept -> witness-only, no
Forge lane (solc emits no AST/bytecode for a rejected deploy).

(cherry picked from commit e9f5a8258ed7feae732b84047ffc4e99d80d55e1)
2026-07-10 12:07:28 -07:00

181 lines
6.6 KiB