Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revisit how transaction inputs are provided to the executor #938

Open
bobbinth opened this issue Oct 25, 2024 · 0 comments
Open

Revisit how transaction inputs are provided to the executor #938

bobbinth opened this issue Oct 25, 2024 · 0 comments

Comments

@bobbinth
Copy link
Contributor

bobbinth commented Oct 25, 2024

After #934 how we load account code and other data into the executor as it has become somewhat inconsistent.

The current model is:

  • Code of foreign accounts is loaded via TransactionExecutor::load_account_code().
  • Code of native account, notes, and transaction script are loaded via the DataStore interface.

There are a couple of alternatives to this:

Alternative 1

Load everything through the DataStore interface. This would mean that we'd need to add a list of account IDs to TransactionArgs and the DataStore interface` will look roughly like this:

pub trait DataStore {
    fn get_transaction_inputs(
        &self,
        account_id: AccountId,
        foreign_account_ids: &[AccountId],
        block_ref: u32,
        notes: &[NoteId],
    ) -> Result<TransactionInputs, DataStoreError>;
}

Alternative 2

Load everything via TransactionArgs. This would basically get rid of the DataStore interface for now as TransactionArgs would basically become a superset of TransactionInputs returned from the DataStore. In this scenario, the client would first make the call to the store to build TransactionInputs manually and then pass them to the executor.

The reason I say "for now" is because eventually we'll need to implement lazy loading of account storage/vault and we'll need to have something like the DataStore interface.

Alternative 3

We merge DataStore and TransactionMastStore into a single interface. Basically, it would mean that the interface would look something like this:

pub trait DataStore: MastForestStore {
    fn get_transaction_inputs(
        &self,
        account_id: AccountId,
        foreign_account_ids: &[AccountId],
        block_ref: u32,
        notes: &[NoteId],
    ) -> Result<TransactionInputs, DataStoreError>;
}

That is, anything that implements DataStore would also need to implement MastForestStore interface (with its single get(&self, procedure_hash: &Digest) -> Option<Arc<MastForest>> method) .

Originally posted by @bobbinth in #936 (comment)

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

No branches or pull requests

1 participant