Skip to content

Commit

Permalink
fix warnings (#2832)
Browse files Browse the repository at this point in the history
* fix: explicitly drop returned value

* fix: log DispatchError

* update cargo.lock

* fix warnings
  • Loading branch information
RomarQ authored Jun 3, 2024
1 parent 6fcc5ad commit bef2485
Show file tree
Hide file tree
Showing 17 changed files with 53 additions and 45 deletions.
3 changes: 2 additions & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 deletions pallets/erc20-xcm-bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ version = "1.0.0"
environmental = { workspace = true }
ethereum-types = { workspace = true }
serde = { workspace = true, optional = true, features = ["derive"] }
log = { workspace = true }

# Substrate
frame-support = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion pallets/erc20-xcm-bridge/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ impl From<Erc20TransferError> for XcmError {
Erc20TransferError::ContractReturnInvalidValue => {
XcmError::FailedToTransactAsset("Erc20 contract return invalid value")
}
Erc20TransferError::DispatchError(_) => {
Erc20TransferError::DispatchError(err) => {
log::debug!("dispatch error: {:?}", err);
Self::FailedToTransactAsset("storage layer error")
}
Erc20TransferError::EvmCallFail => {
Expand Down
4 changes: 2 additions & 2 deletions pallets/moonbeam-orbiters/src/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ fn init<T: Config>() {
fn create_funded_user<T: Config>(string: &'static str, n: u32, balance: u32) -> T::AccountId {
const SEED: u32 = 0;
let user = account(string, n, SEED);
T::Currency::make_free_balance_be(&user, balance.into());
T::Currency::issue(balance.into());
let _ = T::Currency::make_free_balance_be(&user, balance.into());
let _ = T::Currency::issue(balance.into());
user
}

Expand Down
8 changes: 4 additions & 4 deletions pallets/parachain-staking/src/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ fn create_funded_user<T: Config>(
let user = account(string, n, SEED);
let min_candidate_stk = min_candidate_stk::<T>();
let total = min_candidate_stk + extra;
T::Currency::make_free_balance_be(&user, total);
T::Currency::issue(total);
let _ = T::Currency::make_free_balance_be(&user, total);
let _ = T::Currency::issue(total);
(user, total)
}

Expand Down Expand Up @@ -123,8 +123,8 @@ fn create_account<T: Config>(
AccountBalance::Value(v) => v,
};

T::Currency::make_free_balance_be(&acc, initial_balance);
T::Currency::issue(initial_balance);
let _ = T::Currency::make_free_balance_be(&acc, initial_balance);
let _ = T::Currency::issue(initial_balance);

match action {
AccountAction::None => (),
Expand Down
8 changes: 3 additions & 5 deletions runtime/moonbase/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ use frame_support::{
};
use moonbase_runtime::{asset_config::AssetRegistrarMetadata, xcm_config::AssetType};
pub use moonbase_runtime::{
currency::{GIGAWEI, SUPPLY_FACTOR, UNIT, WEI},
AccountId, AssetId, AssetManager, Assets, AsyncBacking, AuthorInherent, Balance, Balances,
CrowdloanRewards, Ethereum, Executive, Header, InflationInfo, ParachainStaking,
ParachainSystem, Range, Runtime, RuntimeCall, RuntimeEvent, System, TransactionConverter,
TransactionPaymentAsGasPrice, UncheckedExtrinsic, HOURS, WEEKS,
currency::UNIT, AccountId, AssetId, AssetManager, Assets, AsyncBacking, AuthorInherent,
Balance, Ethereum, InflationInfo, ParachainStaking, Range, Runtime, RuntimeCall, RuntimeEvent,
System, TransactionConverter, UncheckedExtrinsic, HOURS,
};
use nimbus_primitives::{NimbusId, NIMBUS_ENGINE_ID};
use polkadot_parachain::primitives::HeadData;
Expand Down
1 change: 1 addition & 0 deletions runtime/moonbase/tests/evm_tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ mod tests {
use pallet_evm::AddressMapping;
use sp_core::{H160, U256};

use moonbeam_core_primitives::Header;
use moonbeam_rpc_primitives_debug::runtime_decl_for_debug_runtime_api::DebugRuntimeApi;
use std::str::FromStr;

Expand Down
8 changes: 5 additions & 3 deletions runtime/moonbase/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@ use frame_support::{
use moonbase_runtime::{
asset_config::{AssetRegistrarMetadata, ForeignAssetInstance},
xcm_config::{AssetType, SelfReserve},
AccountId, AssetId, AssetManager, Assets, Balances, CrowdloanRewards,
AccountId, AssetId, AssetManager, Assets, Balances, CrowdloanRewards, Executive,
OpenTechCommitteeCollective, ParachainStaking, PolkadotXcm, Precompiles, Runtime,
RuntimeBlockWeights, RuntimeCall, RuntimeEvent, System, TransactionPayment,
TreasuryCouncilCollective, XTokens, XcmTransactor, FOREIGN_ASSET_PRECOMPILE_ADDRESS_PREFIX,
TransactionPaymentAsGasPrice, TreasuryCouncilCollective, XTokens, XcmTransactor,
FOREIGN_ASSET_PRECOMPILE_ADDRESS_PREFIX, WEEKS,
};
use polkadot_parachain::primitives::Sibling;
use precompile_utils::testing::MockHandle;
Expand All @@ -54,6 +55,7 @@ use std::str::from_utf8;
use xcm_builder::{ParentIsPreset, SiblingParachainConvertsVia};
use xcm_executor::traits::ConvertLocation;

use moonbase_runtime::currency::{GIGAWEI, WEI};
use moonbeam_xcm_benchmarks::weights::XcmWeight;
use moonkit_xcm_primitives::AccountIdAssetIdConversion;
use nimbus_primitives::NimbusId;
Expand Down Expand Up @@ -2804,7 +2806,7 @@ mod fee_tests {
};
use moonbase_runtime::{
currency, BlockWeights, FastAdjustingFeeUpdate, LengthToFee, MinimumMultiplier,
TargetBlockFullness, NORMAL_WEIGHT, WEIGHT_PER_GAS,
TargetBlockFullness, TransactionPaymentAsGasPrice, NORMAL_WEIGHT, WEIGHT_PER_GAS,
};
use sp_runtime::{BuildStorage, FixedPointNumber, Perbill};

Expand Down
2 changes: 2 additions & 0 deletions runtime/moonbase/tests/runtime_apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ use pallet_evm::{Account as EVMAccount, AddressMapping, FeeCalculator};
use sp_core::{ByteArray, H160, H256, U256};

use fp_rpc::runtime_decl_for_ethereum_runtime_rpc_api::EthereumRuntimeRPCApi;
use moonbase_runtime::{Executive, TransactionPaymentAsGasPrice};
use moonbeam_core_primitives::Header;
use moonbeam_rpc_primitives_txpool::runtime_decl_for_tx_pool_runtime_api::TxPoolRuntimeApi;
use nimbus_primitives::runtime_decl_for_nimbus_api::NimbusApi;
use std::{collections::BTreeMap, str::FromStr};
Expand Down
11 changes: 4 additions & 7 deletions runtime/moonbeam/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ use frame_support::{
traits::{OnFinalize, OnInitialize},
};
pub use moonbeam_runtime::{
asset_config::AssetRegistrarMetadata,
currency::{GIGAWEI, GLMR, SUPPLY_FACTOR, WEI},
xcm_config::AssetType,
AccountId, AssetId, AssetManager, AsyncBacking, AuthorInherent, Balance, Balances,
CrowdloanRewards, Ethereum, Executive, Header, InflationInfo, ParachainStaking, Range, Runtime,
RuntimeCall, RuntimeEvent, System, TransactionConverter, TransactionPaymentAsGasPrice,
UncheckedExtrinsic, HOURS, WEEKS,
asset_config::AssetRegistrarMetadata, currency::GLMR, xcm_config::AssetType, AccountId,
AssetId, AssetManager, AsyncBacking, AuthorInherent, Balance, Ethereum, InflationInfo,
ParachainStaking, Range, Runtime, RuntimeCall, RuntimeEvent, System, TransactionConverter,
UncheckedExtrinsic, HOURS,
};
use nimbus_primitives::{NimbusId, NIMBUS_ENGINE_ID};
use polkadot_parachain::primitives::HeadData;
Expand Down
1 change: 1 addition & 0 deletions runtime/moonbeam/tests/evm_tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ mod tests {
use pallet_evm::AddressMapping;
use sp_core::{H160, U256};

use moonbeam_core_primitives::Header;
use moonbeam_rpc_primitives_debug::runtime_decl_for_debug_runtime_api::DebugRuntimeApi;
use std::str::FromStr;

Expand Down
12 changes: 7 additions & 5 deletions runtime/moonbeam/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,16 @@ use frame_support::{
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
StorageHasher, Twox128,
};
use moonbeam_runtime::currency::{GIGAWEI, WEI};
use moonbeam_runtime::{
asset_config::ForeignAssetInstance,
currency::GLMR,
xcm_config::{CurrencyId, SelfReserve},
AccountId, Balances, CrowdloanRewards, OpenTechCommitteeCollective, ParachainStaking,
PolkadotXcm, Precompiles, Runtime, RuntimeBlockWeights, RuntimeCall, RuntimeEvent, System,
TransactionPayment, TreasuryCouncilCollective, XTokens, XcmTransactor,
FOREIGN_ASSET_PRECOMPILE_ADDRESS_PREFIX,
AccountId, Balances, CrowdloanRewards, Executive, OpenTechCommitteeCollective,
ParachainStaking, PolkadotXcm, Precompiles, Runtime, RuntimeBlockWeights, RuntimeCall,
RuntimeEvent, System, TransactionPayment, TransactionPaymentAsGasPrice,
TreasuryCouncilCollective, XTokens, XcmTransactor, FOREIGN_ASSET_PRECOMPILE_ADDRESS_PREFIX,
WEEKS,
};
use moonbeam_xcm_benchmarks::weights::XcmWeight;
use moonkit_xcm_primitives::AccountIdAssetIdConversion;
Expand Down Expand Up @@ -2674,7 +2676,7 @@ mod fee_tests {
};
use moonbeam_runtime::{
currency, LengthToFee, MinimumMultiplier, RuntimeBlockWeights, SlowAdjustingFeeUpdate,
TargetBlockFullness, NORMAL_WEIGHT, WEIGHT_PER_GAS,
TargetBlockFullness, TransactionPaymentAsGasPrice, NORMAL_WEIGHT, WEIGHT_PER_GAS,
};
use sp_core::Get;
use sp_runtime::{BuildStorage, FixedPointNumber, Perbill};
Expand Down
2 changes: 2 additions & 0 deletions runtime/moonbeam/tests/runtime_apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ use pallet_evm::{Account as EVMAccount, AddressMapping, FeeCalculator};
use sp_core::{ByteArray, H160, H256, U256};

use fp_rpc::runtime_decl_for_ethereum_runtime_rpc_api::EthereumRuntimeRPCApi;
use moonbeam_core_primitives::Header;
use moonbeam_rpc_primitives_txpool::runtime_decl_for_tx_pool_runtime_api::TxPoolRuntimeApi;
use moonbeam_runtime::{Executive, TransactionPaymentAsGasPrice};
use nimbus_primitives::runtime_decl_for_nimbus_api::NimbusApi;
use std::{collections::BTreeMap, str::FromStr};

Expand Down
11 changes: 4 additions & 7 deletions runtime/moonriver/tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ use frame_support::{
traits::{OnFinalize, OnInitialize},
};
pub use moonriver_runtime::{
asset_config::AssetRegistrarMetadata,
currency::{GIGAWEI, MOVR, SUPPLY_FACTOR, WEI},
xcm_config::AssetType,
AccountId, AssetId, AssetManager, AsyncBacking, AuthorInherent, Balance, Balances,
CrowdloanRewards, Ethereum, Executive, Header, InflationInfo, ParachainStaking, Range, Runtime,
RuntimeCall, RuntimeEvent, System, TransactionConverter, TransactionPaymentAsGasPrice,
UncheckedExtrinsic, HOURS, WEEKS,
asset_config::AssetRegistrarMetadata, currency::MOVR, xcm_config::AssetType, AccountId,
AssetId, AssetManager, AsyncBacking, AuthorInherent, Balance, Ethereum, InflationInfo,
ParachainStaking, Range, Runtime, RuntimeCall, RuntimeEvent, System, TransactionConverter,
UncheckedExtrinsic, HOURS,
};
use nimbus_primitives::{NimbusId, NIMBUS_ENGINE_ID};
use polkadot_parachain::primitives::HeadData;
Expand Down
1 change: 1 addition & 0 deletions runtime/moonriver/tests/evm_tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ mod tests {
use pallet_evm::AddressMapping;
use sp_core::{H160, U256};

use moonbeam_core_primitives::Header;
use moonbeam_rpc_primitives_debug::runtime_decl_for_debug_runtime_api::DebugRuntimeApi;
use std::str::FromStr;

Expand Down
16 changes: 8 additions & 8 deletions runtime/moonriver/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@ mod common;
use common::*;

use fp_evm::{Context, IsPrecompileResult};
use frame_support::traits::fungible::Inspect;
use frame_support::{
assert_noop, assert_ok,
dispatch::DispatchClass,
traits::{
fungible::Inspect, Currency as CurrencyT, EnsureOrigin, PalletInfo, StorageInfo,
StorageInfoTrait,
},
traits::{Currency as CurrencyT, EnsureOrigin, PalletInfo, StorageInfo, StorageInfoTrait},
weights::{constants::WEIGHT_REF_TIME_PER_SECOND, Weight},
StorageHasher, Twox128,
};
use moonbeam_xcm_benchmarks::weights::XcmWeight;
use moonkit_xcm_primitives::AccountIdAssetIdConversion;
use moonriver_runtime::currency::{GIGAWEI, WEI};
use moonriver_runtime::{
asset_config::ForeignAssetInstance,
xcm_config::{CurrencyId, SelfReserve},
AssetId, OpenTechCommitteeCollective, PolkadotXcm, Precompiles, RuntimeBlockWeights,
TransactionPayment, TreasuryCouncilCollective, XTokens, XcmTransactor,
FOREIGN_ASSET_PRECOMPILE_ADDRESS_PREFIX,
AssetId, Balances, CrowdloanRewards, Executive, OpenTechCommitteeCollective, PolkadotXcm,
Precompiles, RuntimeBlockWeights, TransactionPayment, TransactionPaymentAsGasPrice,
TreasuryCouncilCollective, XTokens, XcmTransactor, FOREIGN_ASSET_PRECOMPILE_ADDRESS_PREFIX,
WEEKS,
};
use nimbus_primitives::NimbusId;
use pallet_evm::PrecompileSet;
Expand Down Expand Up @@ -2587,7 +2587,7 @@ mod fee_tests {
};
use moonriver_runtime::{
currency, LengthToFee, MinimumMultiplier, RuntimeBlockWeights, SlowAdjustingFeeUpdate,
TargetBlockFullness, NORMAL_WEIGHT, WEIGHT_PER_GAS,
TargetBlockFullness, TransactionPaymentAsGasPrice, NORMAL_WEIGHT, WEIGHT_PER_GAS,
};
use sp_core::Get;
use sp_runtime::{BuildStorage, FixedPointNumber, Perbill};
Expand Down
6 changes: 4 additions & 2 deletions runtime/moonriver/tests/runtime_apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@
mod common;
use common::*;

use fp_evm::GenesisAccount;
use fp_evm::{FeeCalculator, GenesisAccount};
use frame_support::assert_ok;
use nimbus_primitives::NimbusId;
use pallet_evm::{Account as EVMAccount, AddressMapping, FeeCalculator};
use pallet_evm::{Account as EVMAccount, AddressMapping};
use sp_core::{ByteArray, H160, H256, U256};

use fp_rpc::runtime_decl_for_ethereum_runtime_rpc_api::EthereumRuntimeRPCApi;
use moonbeam_core_primitives::Header;
use moonbeam_rpc_primitives_txpool::runtime_decl_for_tx_pool_runtime_api::TxPoolRuntimeApi;
use moonriver_runtime::{Executive, TransactionPaymentAsGasPrice};
use nimbus_primitives::runtime_decl_for_nimbus_api::NimbusApi;
use std::{collections::BTreeMap, str::FromStr};

Expand Down

0 comments on commit bef2485

Please sign in to comment.