Skip to content

Conversation

@sergerad
Copy link
Collaborator

@sergerad sergerad commented Jan 9, 2026

Context

The Validator's TransactionInputsDataStore does not handle foreign accounts for the purposes of the following functions of DataStore trait:

  • get_foreign_account_inputs()
  • get_foreign_account_inputs()
  • get_vault_asset_witnesses()

NOTE: This will remain in draft until miden-base has the TransactionIniputs::read_foreign_account_inputs() functionality merged into next.

A followup PR will be made to add similar functionality to the NtxDataStore.

Relates to #1387 and #1305.

Changes

  • Update TransactionInputsDataStore to handle foreign accounts through self.tx_inputs.

@Mirko-von-Leipzig Mirko-von-Leipzig changed the title Add foreign account data impls to TransactionInputsDataStore feat(validator): FPI support in data store Jan 9, 2026
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized recently that we should probably be using std::futures::ready instead of async move to create futures for sync code. Though the difference is really just when the bulk of the work gets done.

// This
return std::futures::ready(x);

// Instead of this
async move {
    // Only sync code
    return x;
}

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you! I left just one small nit inline.

Also, would be good to get a review from @igamigo. Maybe we can run client integration tests against this branch to confirm that transactions that do FPI calls can indeed be accepted by the node.

@sergerad sergerad requested a review from igamigo January 18, 2026 21:06
@sergerad
Copy link
Collaborator Author

Maybe we can run client integration tests against this branch to confirm that transactions that do FPI calls can indeed be accepted by the node.

I tried running the tests from miden-client next against this but they are not compatible. That is after I merged miden-node next into this branch.

if self.tx_inputs.account().id() == account_id {
// Get asset witnessess from native account.
Result::<Vec<_>, _>::from_iter(vault_keys.into_iter().map(|vault_key| {
match self.tx_inputs.account().vault().open(vault_key) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The native account's witnesses are handled just like the ones for foreign accounts, i.e. they are added to the advice inputs on lazy loading, but not to the PartialVault. Any asset witnesses that are present in the partial vault at the beginning are also added to the advice inputs.

So, the advice inputs contain both the pre-provided asset witnesses and those fetched during lazy loading, and so we should read from the advice inputs and not from the partial vault.

The need for this should go away with 0xMiden/miden-base#2298 completely, at which point this could be replaced with unimplemented!.

Because of these subtle differences, I still think it would be good to add a test for this, e.g. one that has an FPI call, reads a storage map item lazily and has input notes with some assets, so the pre-fetch is executed.

And then all of these annoying details should be abstracted away once we have a re-execution API exposed in base directly: 0xMiden/miden-base#2293.

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.

6 participants