Skip to content

feat(codegen): emit solc-shaped ABI, allocation, arithmetic, and library Yul helpers #2059

Description

@Th0rgal

Context

Downstream Morpho Midnight Yul identity is gated by python3 scripts/report_yul_identity_gap.py --midnight --enforce-configured-gate in morpho-verity.

Current function-level drift has no hash mismatches, but still has 75 onlyInSolidity functions. The largest Solidity-only families are solc generated helpers:

  • fun_*: 16 keys (fun_hasCredit, fun_isHealthy, fun_mulDivUp, fun_touchMarket, fun_updatePosition, etc.)
  • update_storage_value*: 9 keys for packed/offest storage writes
  • abi_decode_address*: 7 keys
  • finalize_allocation*: 4 keys
  • abi_decode_struct*: 3 keys
  • checked arithmetic helpers: 9 total across add/sub/mul/div/mod families

Feature request

Add a Solidity-parity Yul helper emission mode for common solc helper families, so Verity-generated Yul can intentionally emit solc-shaped helper functions when targeting Yul identity against Solidity irOptimized output.

High-value helper families from the Midnight report:

  • ABI encode/decode helpers for address, bool, bytes, dynamic arrays, and structs.
  • Memory allocation helpers such as finalize_allocation and array_allocation_size_*.
  • Checked arithmetic helpers matching solc 0.8 overflow semantics and helper names where feasible.
  • Library/internal fun_* helper emission for Solidity-shaped functions used by Midnight.

Why this matters

These helpers are the largest Solidity-only part of the Midnight Yul identity manifest after the Verity-only internal helper drift. Closing them would substantially reduce the fail-closed manifest and make the Verity artifact structurally closer to solc output.

Related issues: #1982 (broad roadmap), #1993 (checked arithmetic), #2055 (dynamic calldata decoder refinement).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions