Skip to content

Commit 056c308

Browse files
committed
Minor cleanup
1 parent 1d958b9 commit 056c308

File tree

13 files changed

+89
-84
lines changed

13 files changed

+89
-84
lines changed

chainstate/src/interface/chainstate_interface_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ where
860860
.map_err(ChainstateError::from)
861861
}
862862

863-
#[tracing::instrument(skip_all, fields(ask_currency, give_currency))]
863+
#[tracing::instrument(skip(self))]
864864
fn get_orders_info_for_rpc_by_currencies(
865865
&self,
866866
ask_currency: Option<&Currency>,

chainstate/test-suite/src/tests/orders_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@
1515

1616
use std::{borrow::Cow, collections::BTreeMap};
1717

18-
use chainstate_storage::Transactional as _;
19-
use orders_accounting::OrdersAccountingStorageRead as _;
2018
use rstest::rstest;
2119

2220
use chainstate::{
2321
BlockError, ChainstateError, CheckBlockError, CheckBlockTransactionsError,
2422
ConnectTransactionError,
2523
};
24+
use chainstate_storage::Transactional as _;
2625
use chainstate_test_framework::{
2726
helpers::{
2827
calculate_fill_order, issue_and_mint_random_token_from_best_block,
@@ -49,6 +48,7 @@ use common::{
4948
};
5049
use crypto::key::{KeyKind, PrivateKey};
5150
use logging::log;
51+
use orders_accounting::OrdersAccountingStorageRead as _;
5252
use randomness::{CryptoRng, Rng, SliceRandom};
5353
use test_utils::random::{gen_random_bytes, make_seedable_rng, Seed};
5454
use tx_verifier::{

common/src/chain/currency.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::{
2727
// The reason for having RPC types in the first place is that in RPC we'd like for certain things to have a more
2828
// human-readable representation, namely:
2929
// 1) Destinations, VRF public keys and ids of pools/delegations/tokens/orders should be bech32-encoded instead
30-
// of hex-encoded or "hexified" via `HexifiedAddress`. For this purpose we have the `RpcAddress` wrapper
30+
// of being hex-encoded or "hexified" via `HexifiedAddress`. For this purpose we have the `RpcAddress` wrapper
3131
// (which holds a bech-32 encoded string), so e.g. `RpcAddress<PoolId>` should be used instead of the plain
3232
// PoolId in RPC types.
3333
// 2) Amounts are more readable when they are in the decimal form instead of the plain number of atoms. But we also
@@ -49,7 +49,7 @@ use crate::{
4949
// `RpcTokenTotalSupplyIn` and moved out of the wallet).
5050
//
5151
// What should we do:
52-
// 1) The "RPC" prefix should be replace with "Rpc" to honor Rust's naming conventions.
52+
// 1) The "RPC" prefix should be replaced with "Rpc" to honor Rust's naming conventions.
5353
// 2) `RpcOutputValue` should be renamed to `OutputValueV1` and it should *not* implement `HasValueHint`.
5454
// Also, all functions that take `RpcOutputValue` and are named as such (e.g. `from_rpc_output_value` below)
5555
// should be renamed as well.
@@ -60,7 +60,7 @@ use crate::{
6060
// "Rpc...In" or "...Out" type. Which in turn means that RPC types that contain an amount or an output value must
6161
// themselves be designated as "In" or "Out" and have the corresponding suffix.
6262
// 5) We also need to reconsider where the RPC types live. Currently many of them live in `common`, even though they're
63-
// only used in the chainstate rpc, but lots of others live in `chainstate`, see the contents of the `chainstate/src/rpc/types/`
63+
// only used in the chainstate RPC, but lots of others live in `chainstate`, see the contents of the `chainstate/src/rpc/types/`
6464
// folder. One approach would be to put an RPC type into the same crate as its non-RPC counterpart. Another approach
6565
// is to put them all to chainstate (note that blockprod and mempool depend on chainstate, so we'll be able to use
6666
// chainstate types in their RPC interfaces if needed).

common/src/chain/tokens/rpc.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ impl RPCFungibleTokenInfo {
151151

152152
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, HasValueHint)]
153153
pub struct RPCNonFungibleTokenInfo {
154-
// TODO: same as in RPCFungibleTokenInfo, use RpcAddress<TokenId> here.
155154
pub token_id: TokenId,
156155
pub creation_tx_id: Id<Transaction>,
157156
pub creation_block_id: Id<Block>,

common/src/chain/transaction/output/output_values_holder.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,6 @@ pub fn collect_token_v1_ids_from_rpc_output_values_holder_into(
7171
}
7272
}
7373

74-
pub fn collect_token_v1_ids_from_rpc_output_values_holder(
75-
holder: &impl RpcOutputValuesHolder,
76-
) -> BTreeSet<TokenId> {
77-
collect_token_v1_ids_from_rpc_output_values_holders(std::iter::once(holder))
78-
}
79-
8074
pub fn collect_token_v1_ids_from_rpc_output_values_holders<'a, H: RpcOutputValuesHolder + 'a>(
8175
holders: impl IntoIterator<Item = &'a H>,
8276
) -> BTreeSet<TokenId> {

common/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ pub use uint::{Uint128, Uint256, Uint512, UintConversionError};
3131
mod tests {
3232
use std::str::FromStr as _;
3333

34-
use crypto::vrf::VRFPublicKey;
3534
use hex::FromHex;
35+
36+
use crypto::vrf::VRFPublicKey;
3637
use rpc_description::HasValueHint;
3738
use serialization::DecodeAll as _;
3839

test/functional/wallet_order_list_all_active.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
17-
"""Wallet all actrive orders listing test, both RPC and CLI
17+
"""Test listing all actrive orders, both RPC and CLI
1818
"""
1919

2020
from test_framework.util import assert_in, assert_equal

test/functional/wallet_order_list_own_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
17-
"""Wallet own orders listing test, CLI
17+
"""Test listing own orders via CLI
1818
"""
1919

2020
from test_framework.util import assert_in, assert_equal

test/functional/wallet_order_list_own_rpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
17-
"""Wallet own orders listing test, RPC
17+
"""Test listing own orders via RPC
1818
"""
1919

2020
from test_framework.util import assert_in, assert_equal

utxo/src/cache.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,15 +521,18 @@ fn should_include_in_utxo_set(output: &TxOutput) -> bool {
521521

522522
#[cfg(test)]
523523
mod unit_test {
524-
use super::*;
525-
use crate::tests::test_helper::{empty_test_utxos_view, insert_single_entry, Presence};
526-
use common::primitives::H256;
527524
use rstest::rstest;
525+
526+
use common::primitives::H256;
528527
use test_utils::{
529528
random::{make_seedable_rng, Seed},
530529
UnwrapInfallible as _,
531530
};
532531

532+
use super::*;
533+
534+
use crate::tests::test_helper::{empty_test_utxos_view, insert_single_entry, Presence};
535+
533536
#[rstest]
534537
#[trace]
535538
#[case(Seed::from_entropy())]

0 commit comments

Comments
 (0)