Skip to content

fix: use checked creation fee math#519

Closed
dangelo352 wants to merge 1 commit into
Commitlabs-Org:masterfrom
dangelo352:security/dedupe-creation-fee-490
Closed

fix: use checked creation fee math#519
dangelo352 wants to merge 1 commit into
Commitlabs-Org:masterfrom
dangelo352:security/dedupe-creation-fee-490

Conversation

@dangelo352

Copy link
Copy Markdown

Summary

  • route commitment_core creation-fee calculation through fuzzing::checked_fee_from_bps
  • preserve valid net amount behavior while mapping fee multiplication overflow to ArithmeticOverflow with guard cleanup
  • extend the overflow regression so a later valid create succeeds after the failed overflow attempt
  • update fee docs/cross-check to name the checked creation-fee source of truth

Closes #490.

Validation

  • git diff --check
  • CARGO_TARGET_DIR=/tmp/commitlabs-fee-target cargo test -p commitment_core test_create_commitment_rejects_fee_math_overflow -- --nocapture

Additional note: CARGO_TARGET_DIR=/tmp/commitlabs-fee-target cargo test -p commitment_core still has 3 unrelated pre-existing failures in emergency_tests::test_emergency_mode_toggle_emits_events, tests::test_create_commitment_event, and tests::test_create_commitment_updates_storage_layout. The focused overflow regression 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.

Remove duplicated creation-fee computation in commitment_core::create_commitment

2 participants