Skip to content

fix(contracts): emit clamped initial score in Mint and AdmRemint events (#2000) - #2174

Merged
K1NGD4VID merged 2 commits into
LabsCrypt:mainfrom
bamiebot-maker:fix/2000-clamped-score-events
Oct 26, 2026
Merged

K1NGD4VID merged 2 commits into
LabsCrypt:mainfrom
bamiebot-maker:fix/2000-clamped-score-events

Conversation

@bamiebot-maker

Copy link
Copy Markdown
Contributor

Description

In \contracts/remittance_nft/src/lib.rs, \RemittanceNFT::mint\ and \RemittanceNFT::admin_remint\ clamp the stored credit score to [MIN_CREDIT_SCORE, MAX_SCORE]\ ([300, 850]), but previously emitted the raw unclamped \initial_score\ in the \Mint\ and \AdmRemint\ events.

Changes

  • Updated \Mint\ event publishing in \RemittanceNFT::mint\ to publish (metadata.score, recipient_commitment)\ instead of (initial_score, recipient_commitment).
  • Updated \AdmRemint\ event publishing in \RemittanceNFT::admin_remint\ to publish (metadata.score, recipient_commitment)\ instead of (initial_score, recipient_commitment).
  • Added unit test \ est_mint_and_admin_remint_emit_clamped_score_event\ in \contracts/remittance_nft/src/test.rs\ asserting that out-of-bounds initial scores (< 300\ and > 850) emit clamped values (\300\ and \850) in both event payloads.

Closes #2000

@bamiebot-maker

Copy link
Copy Markdown
Contributor Author

mc resolved

@K1NGD4VID
K1NGD4VID merged commit 2dab015 into LabsCrypt:main Oct 26, 2026
17 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.

[Bug][Contract] RemittanceNFT Mint and AdmRemint events emit unclamped initial score

2 participants