diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c8fdd662..2f623843a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - Added `GetLimits` endpoint to the RPC server ([#1410](https://github.com/0xMiden/miden-node/pull/1410)). - Added gRPC-Web probe support to the `miden-network-monitor` binary ([#1484](https://github.com/0xMiden/miden-node/pull/1484)). - Add DB schema change check ([#1268](https://github.com/0xMiden/miden-node/pull/1485)). +- Add foreign account support to validator ([#1493](https://github.com/0xMiden/miden-node/pull/1493)). - Improve DB query performance for account queries ([#1496](https://github.com/0xMiden/miden-node/pull/1496). - Limit number of storage map keys in `GetAccount` requests ([#1517](https://github.com/0xMiden/miden-node/pull/1517)). - The network monitor now marks the chain as unhealthy if it fails to create new blocks ([#1512](https://github.com/0xMiden/miden-node/pull/1512)). diff --git a/crates/validator/src/tx_validation/data_store.rs b/crates/validator/src/tx_validation/data_store.rs index 749ddaac1..b2c9093d4 100644 --- a/crates/validator/src/tx_validation/data_store.rs +++ b/crates/validator/src/tx_validation/data_store.rs @@ -53,34 +53,39 @@ impl DataStore for TransactionInputsDataStore { foreign_account_id: AccountId, _ref_block: BlockNumber, ) -> impl FutureMaybeSend> { - async move { Err(DataStoreError::AccountNotFound(foreign_account_id)) } + async move { + self.tx_inputs.read_foreign_account_inputs(foreign_account_id).map_err(|err| { + DataStoreError::other_with_source("failed to read foreign account inputs", err) + }) + } } fn get_vault_asset_witnesses( &self, _account_id: AccountId, - _vault_root: Word, - _vault_keys: BTreeSet, + vault_root: Word, + vault_keys: BTreeSet, ) -> impl FutureMaybeSend, DataStoreError>> { - std::future::ready(Ok(vec![])) + async move { + // Retrieve native and foreign account asset witnesses from the advice inputs. + self.tx_inputs + .read_vault_asset_witnesses(vault_root, vault_keys) + .map_err(|err| { + DataStoreError::other_with_source("failed to read vault asset witnesses", err) + }) + } } fn get_storage_map_witness( &self, - account_id: AccountId, + _account_id: AccountId, _map_root: Word, _map_key: Word, ) -> impl FutureMaybeSend> { async move { - if self.tx_inputs.account().id() != account_id { - return Err(DataStoreError::AccountNotFound(account_id)); - } - - // For partial accounts, storage map witness is not available. - Err(DataStoreError::Other { - error_msg: "storage map witness not available with partial account state".into(), - source: None, - }) + unimplemented!( + "get_storage_map_witness is not used during re-execution of transactions" + ) } } @@ -88,7 +93,7 @@ impl DataStore for TransactionInputsDataStore { &self, _script_root: Word, ) -> impl FutureMaybeSend, DataStoreError>> { - async move { Ok(None) } + async move { unimplemented!("get_note_script is not used during re-execution of transactions") } } }