Skip to content

pq-precompile: reserve base gas before decoding input #487

Open

Description

@romac

Charge the base gas and the message gas before the PQ precompile copies its three bytes arguments out of the input. The work that a call does is then limited by the gas that it pays.

Activity

  1. self-assigned this
    on Oct 7, 2026
  2. added a commit that references this issue on Oct 7, 2026
    ab09dbf
  3. osr21 commented on Oct 7, 2026

    @osr21

    PR #486 addresses the reported behavior on release/0.8, but the default main branch still calls abi_decode_raw_validate before charging base gas (main source).

    There’s also a remaining accounting gap in the backport: gas is charged from the message length before detokenize, but detokenize copies all three dynamic byte arguments. vk and sig are length-checked only afterward (release/0.8 implementation). An oversized vk or sig with an empty message can therefore cause large copies without variable gas scaling with those lengths.

    The allocation regression uses zero gas, so it exits before detokenize; the property-test generator also bounds vk and sig to small sizes (tests, generated input bounds). Could the borrowed token lengths be checked before detokenizing, with a regression for oversized vk/sig and a short message? The corresponding fix also needs to reach main.

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

Metadata

Metadata

Assignees

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