Skip to content

Commit

Permalink
fix: Selfdestruct send to burn address (#235)
Browse files Browse the repository at this point in the history
Close #157 

Note to reviewer: this is a fix imported from C4 mitigation, ensure the
fix was correctly ported by looking at the corresponding issue and PR.
  • Loading branch information
obatirou authored Dec 9, 2024
1 parent c9360a9 commit bff12c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cairo/src/instructions/system_operations.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -813,9 +813,9 @@ namespace SystemOperations {

// If the account was created in the same transaction and recipient is self, the native token is burnt
tempvar is_recipient_not_self = is_not_zero(recipient - evm.message.address);

if (self_account.created != FALSE) {
tempvar recipient = is_recipient_not_self * recipient;
tempvar recipient = (1 - is_recipient_not_self) * Constants.BURN_ADDRESS +
is_recipient_not_self * recipient;
} else {
tempvar recipient = recipient;
}
Expand Down

0 comments on commit bff12c0

Please sign in to comment.