Skip to content

Commit

Permalink
fix: compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
polydez committed Apr 6, 2024
1 parent d5ae048 commit 7f09974
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 27 deletions.
144 changes: 144 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions store/src/db/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
use std::fs::{self, create_dir_all};

use deadpool_sqlite::{Config as SqliteConfig, Hook, HookError, Pool, Runtime};
use miden_node_proto::domain::accounts::{AccountHashUpdate, AccountInfo};
use miden_node_proto::domain::accounts::{AccountDetailsUpdate, AccountHashUpdate, AccountInfo};
use miden_objects::{
block::BlockNoteTree,
crypto::{hash::rpo::RpoDigest, merkle::MerklePath, utils::Deserializable},
notes::Nullifier,
transaction::AccountDetails,
utils::Serializable,
BlockHeader, GENESIS_BLOCK,
};
use rusqlite::vtab::array;
Expand Down
24 changes: 8 additions & 16 deletions store/src/db/tests.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
use miden_lib::transaction::TransactionKernel;
use miden_mock::mock::account::{
generate_account_seed, mock_account_code, AccountSeedType, ACCOUNT_ID_FUNGIBLE_FAUCET_ON_CHAIN,
ACCOUNT_ID_NON_FUNGIBLE_FAUCET_ON_CHAIN,
};
use miden_node_proto::domain::accounts::AccountDetailsUpdate;
use miden_mock::mock::account::{generate_account_seed, mock_account_code, AccountSeedType};
use miden_node_proto::domain::accounts::{AccountDetailsUpdate, AccountHashUpdate};
use miden_objects::{
accounts::{
Account, AccountDelta, AccountId, AccountStorage, AccountStorageDelta, AccountType,
AccountVaultDelta,
Account, AccountDelta, AccountId, AccountStorage, AccountStorageDelta, AccountVaultDelta,
ACCOUNT_ID_FUNGIBLE_FAUCET_ON_CHAIN, ACCOUNT_ID_NON_FUNGIBLE_FAUCET_ON_CHAIN,
ACCOUNT_ID_OFF_CHAIN_SENDER, ACCOUNT_ID_REGULAR_ACCOUNT_UPDATABLE_CODE_OFF_CHAIN,
},
assets::{Asset, AssetVault, FungibleAsset, NonFungibleAsset, NonFungibleAssetDetails},
block::BlockNoteTree,
Expand All @@ -17,7 +15,6 @@ use miden_objects::{
BlockHeader, Felt, FieldElement, Word, ONE, ZERO,
};
use rusqlite::{vtab::array, Connection};
use winter_rand_utils::rand_array;

use super::{sql, AccountInfo, Note, NoteCreated, NullifierInfo};
use crate::db::migrations;
Expand Down Expand Up @@ -188,17 +185,15 @@ fn test_sql_select_accounts() {
let res = sql::upsert_accounts(
&transaction,
&[AccountDetailsUpdate {
account_id,
account_id: account_id.try_into().unwrap(),
final_state_hash: account_hash,
details: None,
}],
block_num,
);
assert_eq!(res.unwrap(), 1, "One element must have been inserted");
transaction.commit().unwrap();
let mut accounts = sql::select_accounts(&mut conn).unwrap();
accounts.sort_by_key(|acc| acc.account_id);
state.sort_by_key(|acc| acc.account_id);
let accounts = sql::select_accounts(&mut conn).unwrap();
assert_eq!(accounts, state);
}
}
Expand Down Expand Up @@ -533,9 +528,6 @@ fn test_db_account() {
let block_num = 1;
create_block(&mut conn, block_num);

let (account_id, _seed) =
generate_account_seed(AccountSeedType::RegularAccountUpdatableCodeOnChain);

// test empty table
let account_ids = vec![ACCOUNT_ID_REGULAR_ACCOUNT_UPDATABLE_CODE_OFF_CHAIN, 1, 2, 3, 4, 5];
let res = sql::select_accounts_by_block_range(&mut conn, 0, u32::MAX, &account_ids).unwrap();
Expand All @@ -549,7 +541,7 @@ fn test_db_account() {
let row_count = sql::upsert_accounts(
&transaction,
&[AccountDetailsUpdate {
account_id,
account_id: account_id.try_into().unwrap(),
final_state_hash: account_hash,
details: None,
}],
Expand Down
8 changes: 0 additions & 8 deletions store/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ pub enum DatabaseError {
DeserializationError(DeserializationError),
#[error("Corrupted data: {0}")]
CorruptedData(String),
#[error("Account error: {0}")]
AccountError(AccountError),
#[error("Block applying was broken because of closed channel on state side: {0}")]
ApplyBlockFailedClosedChannel(RecvError),
#[error("Account {0} not found in the database")]
Expand All @@ -73,12 +71,6 @@ impl From<DeserializationError> for DatabaseError {
}
}

impl From<AccountError> for DatabaseError {
fn from(value: AccountError) -> Self {
Self::AccountError(value)
}
}

// INITIALIZATION ERRORS
// =================================================================================================

Expand Down

0 comments on commit 7f09974

Please sign in to comment.