Skip to content

[High] Enforce per-entrypoint resource ceilings as unit tests for every contract #423

Description

@james2177

Description:
bench.rs measures settlement's resource use, but nothing fails when a change blows up the CPU, memory, or read/write bytes of an entrypoint. Add ceiling assertions for every public entrypoint in all four contracts, measured at the worst case (maximum batch size, maximum list sizes, maximum bond tokens).

Problem Statement & Context:
Solvers price transactions using the published costs (docs/149). A silent 3× regression breaks solver economics, and near-limit entrypoints can start failing outright on mainnet.

Scope & Acceptance Criteria:

  • Worst-case fixtures per entrypoint.
  • Assertions on CPU instructions, memory bytes, ledger read/write entries and bytes, and event bytes, each with 10% headroom over the current values.
  • Budget numbers are generated into docs/149-*.md from the test output.
  • Out of scope: optimizing costs (separate issues).

Implementation Guidelines:

  1. Key Files/Modules: intent_settlement/src/bench.rs, new bench modules in each satellite, docs/149-*.md.
  2. Design/Architecture: Use env.cost_estimate() / env.budget() from the SDK testutils.
  3. Edge Cases/Constraints: Numbers differ across SDK versions, so pin them and regenerate on upgrade.
  4. Testing: The ceilings are themselves the tests.

Definition of "Done":

  • CI green, and docs/149 regenerated.
  • Reviewed and approved.

Resources:

Complexity: High (200 points)

Activity

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

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programhigh (200 pts)Drips Wave complexity: high, 200 pointssecuritySecurity hardening or audit finding

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions