Skip to content

fix: amount precision and overflow in admin pause signer counting - #1303

Merged
Baskarayelu merged 1 commit into
CredenceOrg:mainfrom
Devadakene:fix/admin-amount-precision-overflow
Aug 29, 2026
Merged

fix: amount precision and overflow in admin pause signer counting#1303
Baskarayelu merged 1 commit into
CredenceOrg:mainfrom
Devadakene:fix/admin-amount-precision-overflow

Conversation

@Devadakene

Copy link
Copy Markdown
Contributor

Closes #1294

Description

This PR makes privileged configuration, pause, ownership, and dispute operations bounded, time-aware, and safely recoverable.

Specifically, it replaces saturating_add and saturating_sub in contracts/admin/src/pausable.rs (when modifying PauseSignerCount) with checked_add and checked_sub. Instead of silently saturating values, the contract now immediately reverts and throws a ContractError::Overflow panic. This explicitly rejects invalid scale, sign, and overflow cases before any state changes are persisted, providing a deterministic and reviewable guarantee under normal, concurrent, and failure conditions.

Closes #(issue-number)

Type of Change

  • feat — new functionality
  • fix — bug fix
  • docs — documentation only
  • refactor — code restructuring with no behaviour change
  • test — test additions or improvements
  • ci — CI configuration changes
  • chore — maintenance, dependencies, tooling

How Has This Been Tested?

  • cargo test --workspace passes
  • cargo fmt --all -- --check passes
  • cargo clippy --workspace --all-targets --all-features -- -D warnings passes
  • Coverage ≥ 95% for affected crates (cargo llvm-cov --package <crate> --fail-under-lines 95)
  • Fuzz harness passes (cargo test -p credence_bond fuzz::test_bond_fuzz -- --nocapture)
  • Error code wire-stability test passes (cargo test -p credence_errors error_codes_wire)
  • Release build passes (cargo build --release)

Checklist

  • Tests added/updated for new or changed functionality
  • Docs updated (if public API, storage layout, error codes, or architecture changed)
  • CHANGELOG.md updated (if contracts/** touched)
  • Branch follows <type>/<short-description> naming convention
  • Commit messages follow conventional commits

Additional Context

This addresses the strict requirement to verify exact integer rules at every boundary, blocking anomalous PauseSignerCount modifications and preventing any durable authority from being incorrectly persisted.

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@Devadakene Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Baskarayelu
Baskarayelu merged commit 3556560 into CredenceOrg:main Aug 29, 2026
11 of 12 checks passed
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.

[Quality][High] admin and arbitration controls: amount precision and overflow — QE-2026-08

2 participants