Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions accounting/src/delta/combine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use common::primitives::{amount::SignedAmount, Amount};
use common::primitives::{Amount, amount::SignedAmount};

use crate::{error::Error, DataDelta};
use crate::{DataDelta, error::Error};

/// Combine data with an element of `DeltaDataCollection`.
/// An element can be either a Delta or a result of delta undo.
Expand Down Expand Up @@ -66,7 +66,7 @@ pub mod test {
use crate::DataDelta;

use super::*;
use common::primitives::amount::{signed::SignedIntType, UnsignedIntType};
use common::primitives::amount::{UnsignedIntType, signed::SignedIntType};

use rstest::rstest;

Expand Down
2 changes: 1 addition & 1 deletion accounting/src/delta/delta_amount_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use std::{collections::BTreeMap, ops::Neg};

use common::primitives::{amount::SignedAmount, Amount};
use common::primitives::{Amount, amount::SignedAmount};

use serialization::{Decode, Encode};

Expand Down
2 changes: 1 addition & 1 deletion accounting/src/delta/delta_data_collection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
pub mod undo;
use self::undo::*;

use std::collections::{btree_map::Entry, BTreeMap};
use std::collections::{BTreeMap, btree_map::Entry};

use serialization::{Decode, Encode};

Expand Down
2 changes: 1 addition & 1 deletion accounting/src/delta/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::{combine_data_with_delta, DataDelta, DeltaDataCollection};
use crate::{DataDelta, DeltaDataCollection, combine_data_with_delta};

use rstest::rstest;

Expand Down
2 changes: 1 addition & 1 deletion accounting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ pub use crate::{
combine::{combine_amount_delta, combine_data_with_delta},
delta_amount_collection::DeltaAmountCollection,
delta_data_collection::{
undo::{DataDeltaUndo, DeltaDataUndoCollection},
DataDelta, DeltaDataCollection, GetDataResult,
undo::{DataDeltaUndo, DeltaDataUndoCollection},
},
},
error::Error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ use itertools::Itertools as _;
use common::{
address::Address,
chain::{
block::timestamp::BlockTimestamp,
tokens::{NftIssuance, TokenId},
Block, ChainConfig, DelegationId, Destination, Genesis, OrderId, PoolId, Transaction,
UtxoOutPoint,
block::timestamp::BlockTimestamp,
tokens::{NftIssuance, TokenId},
},
primitives::{id::WithId, Amount, BlockHeight, CoinOrTokenId, Id, Idable},
primitives::{Amount, BlockHeight, CoinOrTokenId, Id, Idable, id::WithId},
};

use crate::storage::storage_api::{
block_aux_data::{BlockAuxData, BlockWithExtraData},
AmountWithDecimals, ApiServerStorageError, BlockInfo, CoinOrTokenStatistic, Delegation,
FungibleTokenData, LockedUtxo, NftWithOwner, Order, PoolBlockStats, PoolDataWithExtraInfo,
TokenTransaction, TransactionInfo, TransactionWithBlockInfo, Utxo, UtxoLock, UtxoWithExtraInfo,
block_aux_data::{BlockAuxData, BlockWithExtraData},
};

use super::CURRENT_STORAGE_VERSION;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ use std::collections::BTreeMap;

use common::{
chain::{
block::timestamp::BlockTimestamp, tokens::TokenId, Block, DelegationId, Destination,
OrderId, PoolId, Transaction, UtxoOutPoint,
Block, DelegationId, Destination, OrderId, PoolId, Transaction, UtxoOutPoint,
block::timestamp::BlockTimestamp, tokens::TokenId,
},
primitives::{Amount, BlockHeight, CoinOrTokenId, Id},
};

use crate::storage::storage_api::{
block_aux_data::BlockAuxData, AmountWithDecimals, ApiServerStorageError, ApiServerStorageRead,
BlockInfo, CoinOrTokenStatistic, Delegation, FungibleTokenData, NftWithOwner, Order,
PoolBlockStats, PoolDataWithExtraInfo, TokenTransaction, TransactionInfo,
TransactionWithBlockInfo, Utxo, UtxoWithExtraInfo,
AmountWithDecimals, ApiServerStorageError, ApiServerStorageRead, BlockInfo,
CoinOrTokenStatistic, Delegation, FungibleTokenData, NftWithOwner, Order, PoolBlockStats,
PoolDataWithExtraInfo, TokenTransaction, TransactionInfo, TransactionWithBlockInfo, Utxo,
UtxoWithExtraInfo, block_aux_data::BlockAuxData,
};

use super::ApiServerInMemoryStorageTransactionalRo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
use std::collections::{BTreeMap, BTreeSet};

use crate::storage::storage_api::{
block_aux_data::{BlockAuxData, BlockWithExtraData},
AmountWithDecimals, ApiServerStorageError, ApiServerStorageRead, ApiServerStorageWrite,
BlockInfo, CoinOrTokenStatistic, Delegation, FungibleTokenData, LockedUtxo, NftWithOwner,
Order, PoolBlockStats, PoolDataWithExtraInfo, TokenTransaction, TransactionInfo,
TransactionWithBlockInfo, Utxo, UtxoWithExtraInfo,
block_aux_data::{BlockAuxData, BlockWithExtraData},
};
use common::{
address::Address,
chain::{
Block, ChainConfig, DelegationId, Destination, OrderId, PoolId, Transaction, UtxoOutPoint,
block::timestamp::BlockTimestamp,
tokens::{NftIssuance, TokenId},
Block, ChainConfig, DelegationId, Destination, OrderId, PoolId, Transaction, UtxoOutPoint,
},
primitives::{Amount, BlockHeight, CoinOrTokenId, Id},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ mod queries;
use std::str::FromStr;
use std::sync::Arc;

use bb8_postgres::PostgresConnectionManager;
use bb8_postgres::bb8::Pool;
use bb8_postgres::bb8::PooledConnection;
use bb8_postgres::PostgresConnectionManager;
use common::chain::ChainConfig;
use tokio_postgres::NoTls;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ use std::{
str::FromStr,
};

use bb8_postgres::{bb8::PooledConnection, PostgresConnectionManager};
use bb8_postgres::{PostgresConnectionManager, bb8::PooledConnection};
use serialization::{DecodeAll, Encode};

use common::{
address::Address,
chain::{
block::timestamp::BlockTimestamp,
tokens::{NftIssuance, TokenId},
AccountNonce, Block, ChainConfig, DelegationId, Destination, GenBlock, OrderId, PoolId,
Transaction, UtxoOutPoint,
block::timestamp::BlockTimestamp,
tokens::{NftIssuance, TokenId},
},
primitives::{Amount, BlockHeight, CoinOrTokenId, Id},
};
Expand All @@ -36,10 +36,10 @@ use tokio_postgres::NoTls;
use crate::storage::{
impls::CURRENT_STORAGE_VERSION,
storage_api::{
block_aux_data::{BlockAuxData, BlockWithExtraData},
AmountWithDecimals, ApiServerStorageError, BlockInfo, CoinOrTokenStatistic, Delegation,
FungibleTokenData, LockedUtxo, NftWithOwner, Order, PoolBlockStats, PoolDataWithExtraInfo,
TokenTransaction, TransactionInfo, TransactionWithBlockInfo, Utxo, UtxoWithExtraInfo,
block_aux_data::{BlockAuxData, BlockWithExtraData},
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ pub mod write;

use std::sync::Arc;

use bb8_postgres::{bb8::PooledConnection, PostgresConnectionManager};
use bb8_postgres::{PostgresConnectionManager, bb8::PooledConnection};
use common::{
chain::{Block, ChainConfig, PoolId, Transaction},
primitives::{BlockHeight, Id},
};
use tokio_postgres::NoTls;

use crate::storage::storage_api::{
block_aux_data::BlockAuxData, ApiServerStorage, ApiServerStorageError, ApiServerTransactionRo,
ApiServerTransactionRw, BlockInfo, PoolDataWithExtraInfo, TransactionInfo, Transactional,
ApiServerStorage, ApiServerStorageError, ApiServerTransactionRo, ApiServerTransactionRw,
BlockInfo, PoolDataWithExtraInfo, TransactionInfo, Transactional, block_aux_data::BlockAuxData,
};

use super::{queries::QueryFromConnection, TransactionalApiServerPostgresStorage};
use super::{TransactionalApiServerPostgresStorage, queries::QueryFromConnection};

const CONN_ERR: &str = "CRITICAL: failed to get postgres tx connection. Invariant broken.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@

use common::{
chain::{
block::timestamp::BlockTimestamp, tokens::TokenId, DelegationId, Destination, OrderId,
PoolId,
DelegationId, Destination, OrderId, PoolId, block::timestamp::BlockTimestamp,
tokens::TokenId,
},
primitives::{Amount, BlockHeight, CoinOrTokenId, Id},
};

use crate::storage::{
impls::postgres::queries::QueryFromConnection,
storage_api::{
block_aux_data::BlockAuxData, AmountWithDecimals, ApiServerStorageError,
ApiServerStorageRead, BlockInfo, CoinOrTokenStatistic, Delegation, FungibleTokenData,
NftWithOwner, Order, PoolBlockStats, PoolDataWithExtraInfo, TokenTransaction,
TransactionInfo, TransactionWithBlockInfo, Utxo, UtxoWithExtraInfo,
AmountWithDecimals, ApiServerStorageError, ApiServerStorageRead, BlockInfo,
CoinOrTokenStatistic, Delegation, FungibleTokenData, NftWithOwner, Order, PoolBlockStats,
PoolDataWithExtraInfo, TokenTransaction, TransactionInfo, TransactionWithBlockInfo, Utxo,
UtxoWithExtraInfo, block_aux_data::BlockAuxData,
},
};
use std::collections::BTreeMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ use std::collections::{BTreeMap, BTreeSet};
use common::{
address::Address,
chain::{
Block, ChainConfig, DelegationId, Destination, OrderId, PoolId, Transaction, UtxoOutPoint,
block::timestamp::BlockTimestamp,
tokens::{NftIssuance, TokenId},
Block, ChainConfig, DelegationId, Destination, OrderId, PoolId, Transaction, UtxoOutPoint,
},
primitives::{Amount, BlockHeight, CoinOrTokenId, Id},
};

use crate::storage::{
impls::postgres::queries::QueryFromConnection,
storage_api::{
block_aux_data::{BlockAuxData, BlockWithExtraData},
AmountWithDecimals, ApiServerStorageError, ApiServerStorageRead, ApiServerStorageWrite,
BlockInfo, CoinOrTokenStatistic, Delegation, FungibleTokenData, LockedUtxo, NftWithOwner,
Order, PoolBlockStats, PoolDataWithExtraInfo, TokenTransaction, TransactionInfo,
TransactionWithBlockInfo, Utxo, UtxoWithExtraInfo,
block_aux_data::{BlockAuxData, BlockWithExtraData},
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// limitations under the License.

use common::{
chain::{block::timestamp::BlockTimestamp, Block, GenBlock},
chain::{Block, GenBlock, block::timestamp::BlockTimestamp},
primitives::{BlockHeight, Id},
};
use serialization::{Decode, Encode};
Expand Down
12 changes: 6 additions & 6 deletions api-server/api-server-common/src/storage/storage_api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ use std::{
use common::{
address::Address,
chain::{
AccountNonce, Block, ChainConfig, DelegationId, Destination, IdCreationError, OrderId,
PoolId, SignedTransaction, Transaction, TxOutput, UtxoOutPoint,
block::timestamp::BlockTimestamp,
timelock::OutputTimeLock,
tokens::{
IsTokenFreezable, IsTokenFrozen, IsTokenUnfreezable, NftIssuance, RPCFungibleTokenInfo,
TokenId, TokenTotalSupply,
},
AccountNonce, Block, ChainConfig, DelegationId, Destination, IdCreationError, OrderId,
PoolId, SignedTransaction, Transaction, TxOutput, UtxoOutPoint,
},
primitives::{per_thousand::PerThousand, Amount, BlockHeight, CoinOrTokenId, Id},
primitives::{Amount, BlockHeight, CoinOrTokenId, Id, per_thousand::PerThousand},
};
use crypto::vrf::VRFPublicKey;
use pos_accounting::{Error as PosError, PoolData};
Expand Down Expand Up @@ -94,7 +94,7 @@ impl FromStr for CoinOrTokenStatistic {
_ => {
return Err(ApiServerStorageError::DeserializationError(format!(
"invalid coin or token statistic type: {s}"
)))
)));
}
};

Expand Down Expand Up @@ -716,10 +716,10 @@ pub trait ApiServerStorageRead: Sync {
) -> Result<Vec<TransactionWithBlockInfo>, ApiServerStorageError>;

async fn get_last_transaction_global_index(&self)
-> Result<Option<u64>, ApiServerStorageError>;
-> Result<Option<u64>, ApiServerStorageError>;

async fn get_utxo(&self, outpoint: UtxoOutPoint)
-> Result<Option<Utxo>, ApiServerStorageError>;
-> Result<Option<Utxo>, ApiServerStorageError>;

async fn get_address_available_utxos(
&self,
Expand Down
6 changes: 3 additions & 3 deletions api-server/scanner-daemon/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ use std::sync::Arc;

use api_blockchain_scanner_lib::blockchain_state::BlockchainState;
use api_server_common::storage::{
impls::{postgres::TransactionalApiServerPostgresStorage, CURRENT_STORAGE_VERSION},
impls::{CURRENT_STORAGE_VERSION, postgres::TransactionalApiServerPostgresStorage},
storage_api::{
ApiServerStorage, ApiServerStorageError, ApiServerStorageRead, ApiServerStorageWrite,
ApiServerTransactionRw,
},
};
use clap::Parser;
use common::chain::{config::ChainType, ChainConfig};
use common::chain::{ChainConfig, config::ChainType};
use config::ApiServerScannerArgs;
use node_comm::{make_rpc_client, rpc_client::NodeRpcClient};
use rpc::RpcAuthData;
Expand Down Expand Up @@ -174,7 +174,7 @@ async fn main() -> Result<(), ApiServerScannerError> {
_ => {
return Err(ApiServerScannerError::InvalidConfig(
"Invalid RPC cookie/username/password combination".to_owned(),
))
));
}
};

Expand Down
18 changes: 9 additions & 9 deletions api-server/scanner-lib/src/blockchain_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ use std::{
sync::Arc,
};

use futures::{stream::FuturesOrdered, TryStreamExt};
use futures::{TryStreamExt, stream::FuturesOrdered};

use api_server_common::storage::storage_api::{
block_aux_data::{BlockAuxData, BlockWithExtraData},
ApiServerStorage, ApiServerStorageError, ApiServerStorageRead, ApiServerStorageWrite,
ApiServerTransactionRw, CoinOrTokenStatistic, Delegation, FungibleTokenData, LockedUtxo, Order,
PoolDataWithExtraInfo, TransactionInfo, TxAdditionalInfo, Utxo, UtxoLock,
block_aux_data::{BlockAuxData, BlockWithExtraData},
};
use chainstate::{
calculate_median_time_past_from_blocktimestamps,
Expand All @@ -34,21 +34,21 @@ use chainstate::{
use common::{
address::Address,
chain::{
block::{timestamp::BlockTimestamp, ConsensusData},
AccountCommand, AccountNonce, AccountSpending, Block, DelegationId, Destination, GenBlock,
Genesis, OrderAccountCommand, OrderId, PoolId, SignedTransaction, Transaction, TxInput,
TxOutput, UtxoOutPoint,
block::{ConsensusData, timestamp::BlockTimestamp},
config::ChainConfig,
make_delegation_id, make_order_id, make_token_id,
output_value::OutputValue,
signature::inputsig::{
authorize_hashed_timelock_contract_spend::AuthorizedHashedTimelockContractSpend,
InputWitness,
authorize_hashed_timelock_contract_spend::AuthorizedHashedTimelockContractSpend,
},
tokens::{get_referenced_token_ids_ignore_issuance, IsTokenFrozen, TokenId, TokenIssuance},
tokens::{IsTokenFrozen, TokenId, TokenIssuance, get_referenced_token_ids_ignore_issuance},
transaction::OutPointSourceId,
AccountCommand, AccountNonce, AccountSpending, Block, DelegationId, Destination, GenBlock,
Genesis, OrderAccountCommand, OrderId, PoolId, SignedTransaction, Transaction, TxInput,
TxOutput, UtxoOutPoint,
},
primitives::{id::WithId, Amount, BlockHeight, CoinOrTokenId, Fee, Id, Idable, H256},
primitives::{Amount, BlockHeight, CoinOrTokenId, Fee, H256, Id, Idable, id::WithId},
};
use orders_accounting::OrderData;
use pos_accounting::{PoSAccountingView, PoolData};
Expand Down
Loading
Loading