Skip to content

Commit

Permalink
cargo fmt --
Browse files Browse the repository at this point in the history
  • Loading branch information
rustlang-dev committed Sep 19, 2024
1 parent 1d6ef0f commit 261e314
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 61 deletions.
6 changes: 3 additions & 3 deletions client/rpc/debug/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
// You should have received a copy of the GNU General Public License
// along with Moonbeam. If not, see <http://www.gnu.org/licenses/>.
pub use creditcoin3_rpc_core_debug::{DebugServer, TraceParams};
use fc_storage::StorageOverride;
use futures::StreamExt;
use jsonrpsee::core::{async_trait, RpcResult};
use fc_storage::StorageOverride;

use tokio::{
self,
Expand All @@ -31,13 +31,13 @@ use fc_rpc::{frontier_backend_client, internal_err};
use fp_rpc::EthereumRuntimeRPCApi;
use sc_client_api::backend::{Backend, StateBackend, StorageProvider};
use sc_utils::mpsc::TracingUnboundedSender;
use sp_runtime::generic::BlockId;
use sp_runtime::traits::Header as HeaderT;
use sp_api::{ApiExt, Core, ProvideRuntimeApi};
use sp_block_builder::BlockBuilder;
use sp_blockchain::{
Backend as BlockchainBackend, Error as BlockChainError, HeaderBackend, HeaderMetadata,
};
use sp_runtime::generic::BlockId;
use sp_runtime::traits::Header as HeaderT;
use sp_runtime::traits::{BlakeTwo256, Block as BlockT, UniqueSaturatedInto};
use std::{future::Future, marker::PhantomData, sync::Arc};

Expand Down
31 changes: 17 additions & 14 deletions client/rpc/trace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,26 @@
//! - For each traced block an async task responsible to wait for a permit, spawn a blocking
//! task and waiting for the result, then send it to the main `CacheTask`.
use fc_storage::StorageOverride;
use futures::{select, stream::FuturesUnordered, FutureExt, StreamExt};
use std::{collections::BTreeMap, future::Future, marker::PhantomData, sync::Arc, time::Duration};
use tokio::{
sync::{mpsc, oneshot, Semaphore},
time::sleep,
};
use fc_storage::StorageOverride;
use tracing::{instrument, Instrument};

use sc_client_api::{backend::{Backend, StateBackend, StorageProvider}, StorageKey};
use sc_client_api::{
backend::{Backend, StateBackend, StorageProvider},
StorageKey,

Check warning on line 38 in client/rpc/trace/src/lib.rs

View workflow job for this annotation

GitHub Actions / build-creditcoin-node-for-testnet

unused import: `StorageKey`

Check warning on line 38 in client/rpc/trace/src/lib.rs

View workflow job for this annotation

GitHub Actions / build-creditcoin-node-for-devnet

unused import: `StorageKey`

Check warning on line 38 in client/rpc/trace/src/lib.rs

View workflow job for this annotation

GitHub Actions / build-creditcoin-node-for-testing-devnet

unused import: `StorageKey`

Check warning on line 38 in client/rpc/trace/src/lib.rs

View workflow job for this annotation

GitHub Actions / build-creditcoin-node-for-testing-ci

unused import: `StorageKey`
};
use sc_utils::mpsc::TracingUnboundedSender;
use sp_runtime::traits::{Header as HeaderT};
use sp_api::{ApiExt, Core, ProvideRuntimeApi};
use sp_block_builder::BlockBuilder;
use sp_blockchain::{
Backend as BlockchainBackend, Error as BlockChainError, HeaderBackend, HeaderMetadata,
};
use sp_runtime::traits::Header as HeaderT;
use sp_runtime::traits::{BlakeTwo256, Block as BlockT};
use substrate_prometheus_endpoint::{
register, Counter, PrometheusError, Registry as PrometheusRegistry, U64,
Expand Down Expand Up @@ -812,17 +815,17 @@ where

// Get Ethereum block data.
let (eth_block, eth_transactions) = match (
overrides.current_block(substrate_hash),
overrides.current_transaction_statuses(substrate_hash),
) {
(Some(a), Some(b)) => (a, b),
_ => {
return Err(format!(
"Failed to get Ethereum block data for Substrate block {}",
substrate_hash
))
}
};
overrides.current_block(substrate_hash),
overrides.current_transaction_statuses(substrate_hash),
) {
(Some(a), Some(b)) => (a, b),
_ => {
return Err(format!(
"Failed to get Ethereum block data for Substrate block {}",
substrate_hash
))
}
};

let eth_block_hash = eth_block.header.hash();
let eth_tx_hashes = eth_transactions
Expand Down
1 change: 0 additions & 1 deletion node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ pub fn local_testnet_config() -> ChainSpec {
.with_genesis_config(config_json)
.with_properties(properties())
.build();

}

fn genesis_account(balance: U256) -> fp_evm::GenesisAccount {
Expand Down
4 changes: 1 addition & 3 deletions node/src/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ mod eth;

use crate::client::RuntimeApiCollection;

pub use self::eth::{
consensus_data_provider::BabeConsensusDataProvider, create_eth, EthDeps,
};
pub use self::eth::{consensus_data_provider::BabeConsensusDataProvider, create_eth, EthDeps};

type HasherFor<Block> = <<Block as BlockT>::Header as HeaderT>::Hashing;

Expand Down
2 changes: 1 addition & 1 deletion node/src/rpc/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ where
Arc::clone(&params.substrate_backend),
match *params.frontier_backend.clone() {
fc_db::Backend::KeyValue(ref b) => b.clone(),
fc_db::Backend::Sql(ref b) => b.clone(),
fc_db::Backend::Sql(ref b) => b.clone(),
},
Arc::clone(&permit_pool),
Arc::clone(&params.overrides),
Expand Down
42 changes: 23 additions & 19 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,13 @@ where

let overrides = Arc::new(StorageOverrideHandler::new(client.clone()));
let frontier_backend = match eth_config.frontier_backend_type.clone() {
BackendType::KeyValue => FrontierBackend::KeyValue(sc_service::Arc::new(fc_db::kv::Backend::open(
Arc::clone(&client),
&config.database,
&db_config_dir(config),
)?)),
BackendType::KeyValue => {
FrontierBackend::KeyValue(sc_service::Arc::new(fc_db::kv::Backend::open(
Arc::clone(&client),
&config.database,
&db_config_dir(config),
)?))
}
BackendType::Sql => {
let db_path = db_config_dir(config).join("sql");
std::fs::create_dir_all(&db_path).expect("failed creating sql db directory");
Expand Down Expand Up @@ -393,29 +395,29 @@ where
fee_history_cache_limit,
} = new_frontier_partial(&eth_config)?;

let mut net_config = sc_network::config::FullNetworkConfiguration::<_, _, Net>::new(&config.network);
let mut net_config =
sc_network::config::FullNetworkConfiguration::<_, _, Net>::new(&config.network);
let peer_store_handle = net_config.peer_store_handle();
let grandpa_protocol_name = sc_consensus_grandpa::protocol_standard_name(
&client.block_hash(0)?.expect("Genesis block exists; qed"),
&config.chain_spec,
);

let metrics = Net::register_notification_metrics(
config.prometheus_config.as_ref().map(|cfg| &cfg.registry),
);
config.prometheus_config.as_ref().map(|cfg| &cfg.registry),
);

let (grandpa_protocol_config, grandpa_notification_service) =
sc_consensus_grandpa::grandpa_peers_set_config::<_, Net>(
grandpa_protocol_name.clone(),
metrics.clone(),
Arc::clone(&peer_store_handle),
);
sc_consensus_grandpa::grandpa_peers_set_config::<_, Net>(
grandpa_protocol_name.clone(),
metrics.clone(),
Arc::clone(&peer_store_handle),
);

use sc_network_sync::strategy::warp::WarpSyncProvider;
let warp_sync_params = if sealing.is_some() {
None
} else {

net_config.add_notification_protocol(grandpa_protocol_config);
let warp_sync: Arc<dyn WarpSyncProvider<Block>> =
Arc::new(sc_consensus_grandpa::warp_proof::NetworkProvider::new(
Expand All @@ -438,7 +440,7 @@ where
block_announce_validator_builder: None,
warp_sync_params,
block_relay: None,
metrics,
metrics,
})?;

if config.offchain_worker.enabled {
Expand Down Expand Up @@ -867,9 +869,11 @@ pub async fn build_full(
eth_config: EthConfiguration,
sealing: Option<Sealing>,
) -> Result<TaskManager, ServiceError> {
new_full::<creditcoin3_runtime::RuntimeApi, TemplateRuntimeExecutor, sc_network::NetworkWorker<_, _>,>(
config, eth_config, sealing,
)
new_full::<
creditcoin3_runtime::RuntimeApi,
TemplateRuntimeExecutor,
sc_network::NetworkWorker<_, _>,
>(config, eth_config, sealing)
.await
}

Expand All @@ -883,7 +887,7 @@ pub fn new_chain_ops(
BasicQueue<Block>,
TaskManager,
Arc<FrontierBackend<Client>>, //important to return Arc and use only one instance of frontier_backend
//https://substrate.stackexchange.com/questions/8761/other-io-error-lock-hold-by-current-process-acquire-time-1685847508-acquiring
//https://substrate.stackexchange.com/questions/8761/other-io-error-lock-hold-by-current-process-acquire-time-1685847508-acquiring
),
ServiceError,
> {
Expand Down
37 changes: 17 additions & 20 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

mod output;

use frame_support::genesis_builder_helper::{build_state, get_preset};
pub use frame_support::traits::EqualPrivilegeOnly;
use parity_scale_codec::{Decode, Encode};
use sp_api::impl_runtime_apis;
use sp_core::{
crypto::{ByteArray, KeyTypeId},
OpaqueMetadata, H160, H256, U256,
};
use frame_support::{
genesis_builder_helper::{build_state, get_preset},
};
use sp_runtime::{
generic, impl_opaque_keys,
traits::{
Expand Down Expand Up @@ -68,6 +66,7 @@ use pallet_evm::{
use pallet_session::historical as session_historical;

// A few exports that help ease life for downstream crates.
use ethereum::TransactionV2;

Check warning on line 69 in runtime/src/lib.rs

View workflow job for this annotation

GitHub Actions / build-creditcoin-node-for-testnet

unused import: `ethereum::TransactionV2`

Check warning on line 69 in runtime/src/lib.rs

View workflow job for this annotation

GitHub Actions / build-creditcoin-node-for-devnet

unused import: `ethereum::TransactionV2`
pub use frame_system::Call as SystemCall;
pub use pallet_babe::AuthorityId as BabeId;
pub use pallet_balances::Call as BalancesCall;
Expand All @@ -76,7 +75,6 @@ pub use pallet_im_online::sr25519::AuthorityId as ImOnlineId;
pub use pallet_staking::StakerStatus;
pub use pallet_timestamp::Call as TimestampCall;
use pallet_transaction_payment::Multiplier;
use ethereum::TransactionV2;

mod precompiles;
use precompiles::FrontierPrecompiles;
Expand Down Expand Up @@ -339,8 +337,8 @@ impl pallet_balances::Config for Runtime {
type MaxLocks = MaxLocks;
type MaxReserves = ();
type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = RuntimeFreezeReason;
type MaxFreezes = frame_support::traits::VariantCountOf<RuntimeFreezeReason>;
type FreezeIdentifier = RuntimeFreezeReason;
type MaxFreezes = frame_support::traits::VariantCountOf<RuntimeFreezeReason>;
}

pub const TARGET_FEE_CREDO: Balance = 10_000_000_000_000_000;
Expand Down Expand Up @@ -813,9 +811,8 @@ impl pallet_identity::Config for Runtime {
type SigningPublicKey = <sp_runtime::MultiSignature as Verify>::Signer;
type UsernameAuthorityOrigin = frame_system::EnsureRoot<Self::AccountId>;
type PendingUsernameExpiration = ConstU32<{ 7 * DAYS }>;
type MaxSuffixLength = ConstU32<7>;
type MaxSuffixLength = ConstU32<7>;
type MaxUsernameLength = ConstU32<32>;

}

parameter_types! {
Expand Down Expand Up @@ -1582,18 +1579,18 @@ impl_runtime_apis! {
}

impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
build_state::<RuntimeGenesisConfig>(config)
}

fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
get_preset::<RuntimeGenesisConfig>(id, |_| None)
}

fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![]
}
}
fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
build_state::<RuntimeGenesisConfig>(config)
}

fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
get_preset::<RuntimeGenesisConfig>(id, |_| None)
}

fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![]
}
}

}

Expand Down

0 comments on commit 261e314

Please sign in to comment.