Skip to content

fix(v2): enforce MAX_ANTI_SNIPE_HARD_MAX_SECS upper bound on initialize - #116

Open
Santia2004 wants to merge 3 commits into
drydocs:mainfrom
Santia2004:fix/anti-snipe-upper-bound
Open

fix(v2): enforce MAX_ANTI_SNIPE_HARD_MAX_SECS upper bound on initialize#116
Santia2004 wants to merge 3 commits into
drydocs:mainfrom
Santia2004:fix/anti-snipe-upper-bound

Conversation

@Santia2004

Copy link
Copy Markdown

Closes #114

Summary

  • Added MAX_ANTI_SNIPE_HARD_MAX_SECS constant (30 * 24 * 60 * 60, 30 days) to prevent setting an unbounded or excessively large anti_snipe_hard_max_secs at initialization that could lead to arithmetic overflow during dispute resolution.
  • Added upper bound validation check in initialize() for tholos-v2, returning Error::InvalidAntiSnipeParams if anti_snipe_hard_max_secs > MAX_ANTI_SNIPE_HARD_MAX_SECS.
  • Added unit tests in test.rs to verify rejection of values above MAX_ANTI_SNIPE_HARD_MAX_SECS as well as acceptance at the exact bound.

Test plan

  • Added test_initialize_rejects_anti_snipe_hard_max_over_max covering rejection of out-of-bound values.
  • Added test_initialize_accepts_anti_snipe_hard_max_at_max ensuring valid boundary values initialize cleanly.
  • Preserved all existing relative checks (anti_snipe_hard_max_secs >= registration_duration_secs and anti_snipe_extension_secs <= anti_snipe_hard_max_secs).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] anti_snipe_hard_max_secs has no upper bound at initialize

1 participant