lfglabs-dev / lfglabs-dev/verity
Ergonomics: Contracts namespace clashes, reserved identifiers (from/to/this), reserved ERC-20 helper names, callee-first ordering
Open
Nobody has claimed this yet.
- Dominant language
- Lean
- Stars
- 148
- Forks
- 20
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 29
Description
Small ergonomics found while translating ~2500 lines of Solidity into verity_contract on c907fef0:
- Namespace clashes.
emit, typed interface calls (externalStaticCallContractWordsTo,ExternalResult,ExecutableCallContext) are generated as unqualified names from theContractsnamespace, so a contract outsideContracts.*mustopen Contracts; that makesInt256,toInt256,toUint256,contractAddress,blockTimestamp,blockNumberambiguous withVerity.*("Ambiguous term Int256"). Every closure file needsopen Contracts hiding Int256 toInt256 toUint256 contractAddress blockTimestamp blockNumber. Generated code should use_root_.Contracts.…qualified names. - Reserved identifiers. Solidity parameter names
from,toand locals namedthis,partialfail with parser errors or (forthis) a puzzlingExternalResult Uint256type mismatch, because they are Lean keywords / the anonymoushavename. A clear diagnostic ("fromis reserved; rename the parameter") would help; ERC-20's_transfer(address from, address to, uint256 amount)is the canonical victim. - Reserved helper forms.
balanceOf,allowance,totalSupplyare ERC-20 helper forms; an ERC-20 contract cannot call its ownallowance(owner, spender)internally (the executable rewrite treats it as the helper and produces(fun owner spender => allowance owner_ owner spender) spendertype errors). - Forward references. Functions must be declared callee-first because the executable plane emits Lean
defs in source order; Solidity files are typically ordered the other way.
Closure-side tracking: audit/VERITY-GAPS.md G12/G13/G16.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the G12/G13/G16 entries in audit/VERITY-GAPS.md and reproduce the reported translations from commit c907fef0. Trace generated names, reserved identifiers, ERC-20 helper handling, and executable-plane definition ordering; done means these cases translate without namespace clashes, misleading parser/type errors, helper collisions, or callee-order requirements.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100