lfglabs-dev / lfglabs-dev/verity

override bodies are elaborated at the parent's position (cannot use child helpers); no super.f(args)

Open
#2,419 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lean
Stars
148
Forks
20
Avg merge
1d 14h
Merged PRs (30d)
29

Description

With multi-parent is (#2413), an override body is elaborated at the position of the parent's virtual slot, i.e. before the child's own functions. It therefore cannot reference helpers declared by the child, and there is no super:

verity_contract P1 where
  storage
    x : Uint256 := slot 0
  function internal virtual f () : Unit := do
    setStorage x 1
  function go () : Unit := do
    f

verity_contract C1 is P1 where
  storage
    y : Uint256 := slot 1
  function internal h () : Unit := do
    setStorage y 7
  function internal override f () : Unit := do
    h            -- error: Unknown identifier `h`
    setStorage x 2

In Pareto, IdleCDOEpochVariant._deposit overrides IdleCDOCreditVault._deposit as "wallet check + skim donations + super._deposit(...)"; updateAccounting and getContractValue follow the same pattern. The closure translation has to inline the child helpers and the parent body into the override (and hoist one helper into the parent), which hides the source structure.

Ask: elaborate override bodies after the child's helpers (or forward-declare child helpers), and add a super.f(args) form that calls the overridden parent body.

Closure-side tracking: audit/VERITY-GAPS.md G6.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the closure-side tracking entry G6 in audit/VERITY-GAPS.md, then trace how override bodies are elaborated and how parent bodies are represented. Done means child helpers are usable from overrides and a super.f(args) form can call the overridden parent body without the described inlining and hoisting workaround.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.