Skip to content

Commit

Permalink
fix: destroy frozen funds used wrong identity and proof verification (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldelucia authored Feb 20, 2025
1 parent 91a9766 commit 33507bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl TokenDestroyFrozenFundsTransitionActionV0 {

let maybe_token_amount = drive.fetch_identity_token_balance_operations(
base.token_id().to_buffer(),
owner_id.to_buffer(),
frozen_identity_id.to_buffer(),
!approximate_without_state_for_costs,
transaction,
&mut drive_operations,
Expand Down Expand Up @@ -228,7 +228,7 @@ impl TokenDestroyFrozenFundsTransitionActionV0 {

let maybe_token_amount = drive.fetch_identity_token_balance_operations(
base.token_id().to_buffer(),
owner_id.to_buffer(),
frozen_identity_id.to_buffer(),
!approximate_without_state_for_costs,
transaction,
&mut drive_operations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ impl Drive {
TokenTransition::DestroyFrozenFunds(
destroy_frozen_funds_transition,
) => {
let (root_hash, None) =
let (root_hash, maybe_token_amount) =
Drive::verify_token_balance_for_identity_id(
proof,
token_id.into_buffer(),
Expand All @@ -470,10 +470,10 @@ impl Drive {
.into_buffer(),
false,
platform_version,
)?
else {
)?;
if maybe_token_amount != Some(0) {
return Err(Error::Proof(ProofError::IncorrectProof(
format!("proof contained token balance for identity {} expected to not exist because of state transition (token destroy frozen funds)", owner_id))));
format!("proof contained non-zero token balance for identity {} expected to be zero because of state transition (token destroy frozen funds)", destroy_frozen_funds_transition.frozen_identity_id()))));
};
Ok((
root_hash,
Expand Down

0 comments on commit 33507bb

Please sign in to comment.