Skip to content

feat(storage): Solidity-compatible packed storage lowering for Midnight Yul identity #2060

Description

@Th0rgal

Context

Morpho Midnight downstream identity and mapping docs still carry storage-layout drift even after direct Verity emission of the CREATE2/SSTORE2 surface.

Current Midnight Yul identity report shape:

  • onlyInSolidity: 75
  • onlyInVerity: 226
  • hashMismatch: 0

Storage-related Solidity-only helper families include:

  • update_storage_value_offset_12_uint16_to_uint16#0
  • update_storage_value_offset_2_uint16_to_uint16#0
  • update_storage_value_offset_4_uint16_to_uint16#0
  • update_storage_value_offset_8_uint16_to_uint16#0
  • update_storage_value_offset_t_uint16_to_t_uint16#0
  • update_storage_value_offset_uint128_to_uint128#0
  • update_storage_value_offset_uint16_to_uint16#0
  • update_storage_value_offset_uint32_to_uint32#0
  • update_storage_value_uint128_to_uint128#0
  • storage_array_index_access_uint#0
  • storage_array_index_access_uint128_#0

The downstream MORPHO_MIDNIGHT_MAPPING.md also notes that collateral storage uses wider word slots rather than exact uint128 packing until Verity supports packed fixed-array elements.

Feature request

Add first-class Solidity-compatible packed storage lowering for fixed-size narrow integer fields and packed fixed-array elements, with solc-shaped Yul helper emission where possible.

The feature should cover:

  • Slot/offset writes for uint16, uint32, and uint128 packed fields.
  • Fixed-array element packing for uint128 collateral/accounting style arrays.
  • Storage array index access helper emission that can converge with solc irOptimized Yul.
  • Proof obligations or metadata that make the packed layout auditable in downstream parity/proof artifacts.

Why this matters

This closes a concrete Midnight source-faithfulness gap and removes a recognizable Solidity-only helper family from the fail-closed Yul identity manifest. It is also a prerequisite for reducing the mapping doc's storage-layout caveat from medium to high source faithfulness for collateral paths.

Related broad roadmap issue: #1982.

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocks:erc4337Blocks ERC-4337 EntryPoint parity/verificationblocks:lidoBlocks Lido StakingRouter parity/verificationblocks:morphoBlocks Morpho Blue parity/verification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions