Skip to content

fix: panic in asset callbacks against native account#2868

Merged
PhilippGackstatter merged 3 commits intomainfrom
pgackst-fix-asset-callbacks-against-native-account
May 7, 2026
Merged

fix: panic in asset callbacks against native account#2868
PhilippGackstatter merged 3 commits intomainfrom
pgackst-fix-asset-callbacks-against-native-account

Conversation

@PhilippGackstatter
Copy link
Copy Markdown
Contributor

@PhilippGackstatter PhilippGackstatter commented May 5, 2026

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

@PhilippGackstatter PhilippGackstatter force-pushed the pgackst-fix-asset-callbacks-against-native-account branch 2 times, most recently from 41edd4d to 8eb856c Compare May 5, 2026 08:30
@PhilippGackstatter PhilippGackstatter force-pushed the pgackst-fix-asset-callbacks-against-native-account branch from 8eb856c to db00555 Compare May 5, 2026 08:32
Comment thread crates/miden-protocol/asm/kernels/transaction/lib/callbacks.masm Outdated
Comment thread crates/miden-protocol/asm/kernels/transaction/lib/callbacks.masm
@PhilippGackstatter
Copy link
Copy Markdown
Contributor Author

Will merge this to unblock @onurinanc and for easy cherry-picking into next.

If possible, would be good to get a review from @bobbinth post-merge anyway.

@PhilippGackstatter PhilippGackstatter merged commit 2462881 into main May 7, 2026
17 checks passed
@PhilippGackstatter PhilippGackstatter deleted the pgackst-fix-asset-callbacks-against-native-account branch May 7, 2026 08:28
onurinanc pushed a commit to onurinanc/miden-base that referenced this pull request May 7, 2026
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.

2 participants