Skip to content

[P0] Dispatcher does not mask narrow ABI integer inputs before internal calls #19

@ngmachado

Description

@ngmachado

Problem

Dispatcher decodes calldata words via sir.calldataload and forwards them directly to internal calls. For ABI types like uint8/int8, high bits are not truncated/sign-normalized before use.

Expected

ABI narrow integers should be normalized to declared width before reaching function logic.

Actual

Raw 256-bit calldata words are forwarded for narrow typed parameters.

Evidence

  • Direct calldata load and forwarding path: src/mlir/ora/lowering/OraToSIR/SIRDispatcher.cpp:805
  • Arg forwarded as-is: src/mlir/ora/lowering/OraToSIR/SIRDispatcher.cpp:876
  • No width-specific mask/signextend in dispatcher arg path.

Impact

Incorrect runtime semantics for narrow ints; external callers can pass out-of-range words and bypass intended width behavior.

Acceptance Criteria

  • Dispatcher masks/sign-extends args according to ora.abi_params width/sign before sir.icall.
  • Add regression tests for u8/i8/u16/i16 argument boundaries.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions