Coin Brief ENDE

SIMD-0529 amended: the modexp syscall now charges a flat fee first

The Solana improvement documents repository merged an amendment to SIMD-0529 on 20 November. The proposal defines a syscall for big-integer modular exponentiation, and the change, titled "charge a flat cu first before execution", rewrites the order in which an implementation charges compute units and validates inputs. The amended text calls that order consensus-critical: the compute units consumed on every abort path must be identical across implementations.

Under the previous text, validation came first and the syscall's cost was charged only after all inputs were read and checked; aborts before that point did not charge the syscall cost. Now step one is a flat base charge, BIG_MOD_EXP_BASE_CU, taken before any VM memory is translated, so it is consumed on every abort that follows. The length fields are then checked against BIG_MOD_EXP_MAX_BYTES and the exponent bytes are read, after which the implementation computes an operation_cost from the lengths and the decoded exponent and charges it. Only then are the base and modulus read and the modulus checked to be odd and greater than one.

The amendment adds two abort conditions: an operation cost that cannot be represented as a u64, and not enough remaining compute units to cover either the base cost or the operation cost. In both cases all remaining compute units are consumed before the virtual machine aborts.

SIMD-0529 amended: the modexp syscall now charges a flat fee first
SIMD-0529 amended: the modexp syscall now charges a flat fee first — Coin Brief

Why it matters

When aborts are free, a program can call an expensive syscall with bad inputs and pay nothing for the work the validator did before rejecting them. A flat charge up front, plus a fixed order that every client must follow, closes that gap and keeps independent implementations from disagreeing about fees.

Written by Victoria Shinder.