Skip to content

Add gas-bound test for atomic_close_period asserting linear-in-holders cost bound #480

Description

@thlpkee20-wq

Description

Once atomic_close_period lands, its gas should remain O(holders) without hidden quadratic paths. Add a gas-bound test parameterized by 1, 10, 100, 1_000 holders asserting the cpu_insn budget grows linearly within tolerance.

Requirements and context

  • Must be secure, tested, and documented
  • Should be efficient and easy to review
  • Relevant code: Revora-Contracts/src/test_close_period.rs
  • Linearity check uses env.cost_estimate().budget() snapshots

Suggested execution

  • Fork the repo and create a branch
  • git checkout -b test/atomic-close-period-gas-linearity
  • Implement changes
    • Parameterize over holder counts via a helper
    • Fit a line and assert R^2 > 0.98 for cpu_insn vs holders
    • Document tolerance and fail-mode in MULTISIG_GAS_TEST_SUMMARY.md style
  • Validate security and correctness assumptions

Test and commit

  • Run tests
    • cargo test --all
  • Cover edge cases
    • Zero-holder offering must close with bounded constant cost
  • Include test output and security notes

Example commit message

test: assert atomic_close_period gas grows linearly with holders

Guidelines

  • Minimum 95 percent test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions