lfglabs-dev / lfglabs-dev/verity

Interface-typed storage fields are rejected (design note promises them); no address-to-interface cast for storage-held callees

Open
#2,418 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

docs/PARETO_MODEL_SUPPORT.md (Feature 2) says the linked_contracts name "may also match an interface-typed storage field or parameter". Interface-typed storage fields are rejected:

verity_contract IfaceField where
  storage
    strategy : IStrategy := slot 0
  interfaces
    interface IStrategy where
      function getApr() view returns (Uint256)
    end
  function read () : Uint256 := do
    let v ← strategy.getApr
    return v
-- error: unsupported type 'IStrategy'; expected a built-in type or a user-defined enum, struct, newtype, or inductive type

There is also no way to attach an interface to an address read from storage (interfaceNameOfTerm? only propagates from parameters/locals that already carry one), so every Solidity IdleCreditVault(strategy).f(...) on a storage-held address needs a thin internal helper with an interface-typed parameter:

function internal _strategyGetApr (_s : IIdleCreditVault) : Uint256 := do
  let apr ← _s.getApr
  return apr
function internal _getStrategyApr () : Uint256 := do
  let _strategy ← getStorageAddr strategy
  let apr ← _strategyGetApr _strategy
  return apr

Pareto needs ~35 such wrappers (vault→strategy, vault→tranche tokens, strategy→vault, both→underlying token), which is the single largest source of noise in the translation.

Ask: accept field : IFace := slot n as an address field tagged with the interface (and let linked_contracts bind it), or provide a cast form such as let s : IFace := addr / (IFace addr) for locals.

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

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

Read docs/PARETO_MODEL_SUPPORT.md Feature 2 and audit/VERITY-GAPS.md G5, then trace interfaceNameOfTerm? and the handling of storage fields. Compare the proposed interface-tagged field and address-cast approaches, and verify the chosen design lets linked_contracts bind storage-held interfaces without the listed wrapper helpers.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity
Domain
blockchain, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.