Skip to content

feat: fetch note asset and fee asset witnesses before transaction execution#2113

Merged
PhilippGackstatter merged 12 commits intonextfrom
pgackst-asset-witnesses-before-exec
Dec 1, 2025
Merged

feat: fetch note asset and fee asset witnesses before transaction execution#2113
PhilippGackstatter merged 12 commits intonextfrom
pgackst-asset-witnesses-before-exec

Conversation

@PhilippGackstatter
Copy link
Contributor

Removes the temporary code for lazy loading note asset witnesses during the prologue and instead pre-fetches them from the DataStore.

This means changing the DataStore::get_transaction_inputs to take a set of AssetVaultKeys and returning a set of AssetWitnesses. The data store is expected to also return an asset witness for the fee asset, since it will also be needed unconditionally, and it does not have to be loaded in TransactionExecutorHost::on_before_tx_fee_removed_from_account anymore.

The asset witnesses are stored in TransactionInputs, though other options exist, like returning (TransactionInputs, Vec<AssetWitness>) from TransactionExecutor::prepare_tx_inputs. This option is a bit nicer, but adds more duplicate data in TransactionInputs, since the asset witnesses will be contained in AdviceInputs at the end of the transaction.

TransactionContext::execute_code did not call into the DataStore so far, and so the asset witnesses were never fetched, causing test failures. This was changed to also call DataStore::get_transaction_inputs to load the witnesses. I'm hoping this could be done more nicely when splitting the TransactionContextBuilder into two APIs as mentioned under Internal API Changes in #1919.

closes #1852

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 a couple of small comments/questions inline.

Copy link
Collaborator

@igamigo igamigo left a comment

Choose a reason for hiding this comment

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

Left a couple comments/questions on the implementation (one involving a potential different design), but looks good to me!

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.

All looks good! Thank you!

@PhilippGackstatter PhilippGackstatter merged commit 271de2f into next Dec 1, 2025
17 checks passed
@PhilippGackstatter PhilippGackstatter deleted the pgackst-asset-witnesses-before-exec branch December 1, 2025 03:56
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.

Request note asset witnesses before transaction execution

3 participants