Skip to content

perf(low): transient-storage reentrancy lock, double packed-slot write in capture, redundant configHash SLOAD #45

Description

@pviti

Severity: Low (gas). From the 2026-07-29 cross-repo audit.

Three small items in the fund-moving paths:

  • contracts/src/RAIL0.sol:78_reentrancyStatus is regular storage; with solc 0.8.27 + via-ir and all target chains post-Cancun, EIP-1153 transient storage (tstore/tload) saves ~2k gas on each of the six guarded entrypoints.
  • :392-393capture writes the same packed slot twice (capturableAmount, then refundableAmount); writing the whole PaymentState once (as authorize/charge do) removes reliance on the IR optimizer coalescing the writes.
  • :480refund re-reads _configHash[paymentId] although _loadAndVerify (:593) just loaded and verified it; returning the hash from _loadAndVerify drops the extra SLOAD.

Bundle with the next version bump — not worth a deployment on their own.

Metadata

Metadata

Assignees

No one assigned

    Labels

    perf-improvesFixing this IMPROVES performanceperformanceAffects performance, positively or negatively (latency, load, gas, queries, bundle size)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions