fix: panic in asset callbacks against native account#2868
Merged
PhilippGackstatter merged 3 commits intomainfrom May 7, 2026
Merged
fix: panic in asset callbacks against native account#2868PhilippGackstatter merged 3 commits intomainfrom
PhilippGackstatter merged 3 commits intomainfrom
Conversation
41edd4d to
8eb856c
Compare
8eb856c to
db00555
Compare
mmagician
approved these changes
May 5, 2026
Contributor
Author
|
Will merge this to unblock @onurinanc and for easy cherry-picking into If possible, would be good to get a review from @bobbinth post-merge anyway. |
onurinanc
pushed a commit
to onurinanc/miden-base
that referenced
this pull request
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes asset callback against the native account panicking due to attempting to start a foreign context against the native account.
This is fixed by checking if the active account is already the target of the callback invocation, and if so, skips starting (and ending) a foreign context against it.
The PR implements the check against the active account rather than the native account, which seems equivalent but also a bit more future-proof. For instance, if we allow mutating a transaction during FPI in the future, then during an FPI call against faucet A, the faucet itself might add an asset that it has issued to a note, which would trigger a callback against itself. In this case, the faucet is the active account, but not the native account.
For now, during callback checks, if faucet_id == active_account_id, then active_account_id == native_account_id, due to the native account assertions in the output_note_add_asset and account_add_asset kernel procedures.
PR targets main since this seems to be the branch from which we still release.
closes #2864