Skip to content

Commit

Permalink
Squash and Rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
markopoloparadox authored and KarishmaBothara committed Jul 4, 2023
1 parent f991c52 commit 5cff571
Show file tree
Hide file tree
Showing 150 changed files with 4,152 additions and 2,869 deletions.
1,489 changes: 881 additions & 608 deletions Cargo.lock

Large diffs are not rendered by default.

104 changes: 52 additions & 52 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,60 +25,60 @@ hex-literal = "0.3.4"
hex = "0.4"
libsecp256k1 = { version = "0.6.0" }

sc-cli = { git = "https://github.com/futureversecom/substrate", features = ["wasmtime"] , branch = "polkadot-v0.9.27" }
sp-core = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sc-network = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sc-executor = { git = "https://github.com/futureversecom/substrate", features = ["wasmtime"] , branch = "polkadot-v0.9.27" }
sc-service = { git = "https://github.com/futureversecom/substrate", features = ["wasmtime"] , branch = "polkadot-v0.9.27" }
sc-telemetry = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sc-keystore = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sc-transaction-pool = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sc-transaction-pool-api = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sc-consensus-babe = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sc-consensus-babe-rpc = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sc-consensus-uncles = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sp-authorship = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sp-consensus-babe = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sp-consensus = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sc-consensus = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sc-consensus-epochs = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sc-finality-grandpa = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sc-finality-grandpa-rpc = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sp-finality-grandpa = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sc-client-api = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sp-runtime = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sp-timestamp = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sp-inherents = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sp-keyring = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sp-keystore = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sp-transaction-storage-proof = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
frame-system = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
pallet-transaction-payment = { git = "https://github.com/futureversecom/substrate" , branch = "polkadot-v0.9.27" }
sc-cli = { git = "https://github.com/paritytech/substrate", features = ["wasmtime"] , branch = "polkadot-v0.9.30" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sc-executor = { git = "https://github.com/paritytech/substrate", features = ["wasmtime"] , branch = "polkadot-v0.9.30" }
sc-service = { git = "https://github.com/paritytech/substrate", features = ["wasmtime"] , branch = "polkadot-v0.9.30" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sc-consensus-babe-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sc-consensus-uncles = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sc-consensus-epochs = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-transaction-storage-proof = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate" , branch = "polkadot-v0.9.30" }

# Frontier
fc-consensus = { default-features = false, git = "https://github.com/futureversecom/frontier", branch = "polkadot-v0.9.27-TRN" }
fc-db = { default-features = false, git = "https://github.com/futureversecom/frontier", branch = "polkadot-v0.9.27-TRN" }
fc-mapping-sync = { default-features = false, git = "https://github.com/futureversecom/frontier", branch = "polkadot-v0.9.27-TRN" }
fc-rpc = { default-features = false, git = "https://github.com/futureversecom/frontier", branch = "polkadot-v0.9.27-TRN", features = [ "rpc_binary_search_estimate" ] }
fc-rpc-core = { default-features = false, git = "https://github.com/futureversecom/frontier", branch = "polkadot-v0.9.27-TRN" }
fp-consensus = { default-features = false, git = "https://github.com/futureversecom/frontier", branch = "polkadot-v0.9.27-TRN" }
fp-rpc = { default-features = false, git = "https://github.com/futureversecom/frontier", branch = "polkadot-v0.9.27-TRN" }
fp-storage = { default-features = false, git = "https://github.com/futureversecom/frontier", branch = "polkadot-v0.9.27-TRN" }
fc-consensus = { default-features = false, git = "https://github.com/futureversecom/frontier", branch = "polkadot-v0.9.30-TRN" }
fc-db = { default-features = false, git = "https://github.com/futureversecom/frontier", branch = "polkadot-v0.9.30-TRN" }
fc-mapping-sync = { default-features = false, git = "https://github.com/futureversecom/frontier", branch = "polkadot-v0.9.30-TRN" }
fc-rpc = { default-features = false, git = "https://github.com/futureversecom/frontier", branch = "polkadot-v0.9.30-TRN", features = [ "rpc_binary_search_estimate" ] }
fc-rpc-core = { default-features = false, git = "https://github.com/futureversecom/frontier", branch = "polkadot-v0.9.30-TRN" }
fp-consensus = { default-features = false, git = "https://github.com/futureversecom/frontier", branch = "polkadot-v0.9.30-TRN" }
fp-rpc = { default-features = false, git = "https://github.com/futureversecom/frontier", branch = "polkadot-v0.9.30-TRN" }
fp-storage = { default-features = false, git = "https://github.com/futureversecom/frontier", branch = "polkadot-v0.9.30-TRN" }

# These dependencies are used for the node template's RPCs
jsonrpsee = { version = "0.14.0", features = ["server", "macros"] }
sc-rpc = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sp-api = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sc-rpc-api = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sp-blockchain = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sp-block-builder = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
sc-basic-authorship = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
substrate-frame-rpc-system = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
pallet-transaction-payment-rpc = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
jsonrpsee = { version = "0.15.1", features = ["server", "macros"] }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }

# These dependencies are used for runtime benchmarking
frame-benchmarking = { git = "https://github.com/futureversecom/substrate", optional = true, branch = "polkadot-v0.9.27" }
frame-benchmarking-cli = { git = "https://github.com/futureversecom/substrate", optional = true, branch = "polkadot-v0.9.27" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.30" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }

# Local Dependencies
ethy-gadget = { path = "../ethy-gadget" }
Expand All @@ -92,17 +92,17 @@ pallet-nft-rpc = { path = "../pallet/nft/rpc" }
log = "0.4.0"

# Try Runtime
frame-try-runtime = { git = "https://github.com/futureversecom/substrate", optional = true, branch = "polkadot-v0.9.27" }
try-runtime-cli = { git = "https://github.com/futureversecom/substrate", optional = true, branch = "polkadot-v0.9.27" }
frame-try-runtime = { git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.30" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v0.9.30" }

# CLI-specific dependencies

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/futureversecom/substrate", branch = "polkadot-v0.9.27" }
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.30" }

[features]
default = []
runtime-benchmarks = ["frame-benchmarking", "frame-benchmarking-cli", "seed-runtime/runtime-benchmarks"]
runtime-benchmarks = ["frame-benchmarking", "seed-runtime/runtime-benchmarks", "sc-service/runtime-benchmarks"]
# Enable features that allow the runtime to be tried and debugged. Name might be subject to change
# in the near future.
try-runtime = ["seed-runtime/try-runtime", "try-runtime-cli"]
2 changes: 1 addition & 1 deletion client/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for TransferKeepAliveBuilder {
pub fn create_benchmark_extrinsic(
client: &FullClient,
sender: sp_core::ecdsa::Pair,
call: runtime::Call,
call: runtime::RuntimeCall,
nonce: u32,
) -> runtime::UncheckedExtrinsic {
let genesis_hash = client.block_hash(0).ok().flatten().expect("Genesis block exists; qed");
Expand Down
1 change: 0 additions & 1 deletion client/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ pub enum Subcommand {

/// Sub-commands concerned with benchmarking.
#[clap(subcommand)]
#[cfg(feature = "runtime-benchmarks")]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),

/// Try some command against runtime state.
Expand Down
23 changes: 16 additions & 7 deletions client/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// You may obtain a copy of the License at the root of this project source code

use crate::{
chain_spec,
benchmarking, chain_spec,
cli::{Cli, Subcommand},
service,
};
Expand Down Expand Up @@ -117,11 +117,8 @@ pub fn run() -> sc_cli::Result<()> {
Ok((cmd.run(client, backend, Some(aux_revert)), task_manager))
})
},
#[cfg(feature = "runtime-benchmarks")]
Some(Subcommand::Benchmark(cmd)) => {
use crate::benchmarking::{
inherent_benchmark_data, RemarkBuilder, TransferKeepAliveBuilder,
};
use benchmarking::{inherent_benchmark_data, RemarkBuilder, TransferKeepAliveBuilder};
use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory};
use seed_primitives::EthereumSigner;
use seed_runtime::ExistentialDeposit;
Expand Down Expand Up @@ -149,6 +146,12 @@ pub fn run() -> sc_cli::Result<()> {
let PartialComponents { client, .. } = service::new_partial(&config, &cli)?;
cmd.run(client)
},
#[cfg(not(feature = "runtime-benchmarks"))]
BenchmarkCmd::Storage(_) => Err(
"Storage benchmarking can be enabled with `--features runtime-benchmarks`."
.into(),
),
#[cfg(feature = "runtime-benchmarks")]
BenchmarkCmd::Storage(cmd) => {
let PartialComponents { client, backend, .. } =
service::new_partial(&config, &cli)?;
Expand All @@ -161,7 +164,13 @@ pub fn run() -> sc_cli::Result<()> {
let PartialComponents { client, .. } = service::new_partial(&config, &cli)?;
let ext_builder = RemarkBuilder::new(client.clone());

cmd.run(config, client, inherent_benchmark_data()?, &ext_builder)
cmd.run(
config,
client,
inherent_benchmark_data()?,
Vec::new(),
&ext_builder,
)
},
BenchmarkCmd::Extrinsic(cmd) => {
let PartialComponents { client, .. } = service::new_partial(&config, &cli)?;
Expand All @@ -179,7 +188,7 @@ pub fn run() -> sc_cli::Result<()> {
)),
]);

cmd.run(client, inherent_benchmark_data()?, &ext_factory)
cmd.run(client, inherent_benchmark_data()?, Vec::new(), &ext_factory)
},
_ => panic!("Unsupported subcommand"),
}
Expand Down
4 changes: 1 addition & 3 deletions client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
mod chain_spec;
#[macro_use]
mod service;
mod benchmarking;
mod cli;
mod command;
mod custom_commands;
mod rpc;

#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;

fn main() -> sc_cli::Result<()> {
command::run()
}
2 changes: 1 addition & 1 deletion client/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub struct EthyDeps {
/// Extra dependencies for BABE.
pub struct BabeDeps {
/// BABE protocol config.
pub babe_config: sc_consensus_babe::Config,
pub babe_config: sc_consensus_babe::BabeConfiguration,
/// BABE pending epoch changes.
pub shared_epoch_changes: SharedEpochChanges<Block, sc_consensus_babe::Epoch>,
/// The keystore that manages the keys of the node.
Expand Down
33 changes: 12 additions & 21 deletions client/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ use fc_mapping_sync::{MappingSyncWorker, SyncStrategy};
use fc_rpc::{EthTask, OverrideHandle};
use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool};
use sc_cli::SubstrateCli;
use sc_client_api::{Backend, BlockBackend, BlockchainEvents, ExecutorProvider};
use sc_client_api::{Backend, BlockBackend, BlockchainEvents};
use sc_consensus_babe::{self, SlotProportion};
pub use sc_executor::NativeElseWasmExecutor;
use sc_finality_grandpa::SharedVoterState;
use sc_keystore::LocalKeystore;
use sc_service::{error::Error as ServiceError, BasePath, Configuration, TaskManager};
use sc_telemetry::{Telemetry, TelemetryWorker};
use sp_runtime::{offchain::OffchainStorage, traits::Block as BlockT};
use sp_runtime::offchain::OffchainStorage;

use std::{
collections::BTreeMap,
Expand Down Expand Up @@ -153,8 +153,11 @@ pub fn new_partial(
client.clone(),
);

let frontier_backend =
Arc::new(FrontierBackend::open(&config.database, &db_config_dir(config))?);
let frontier_backend = Arc::new(FrontierBackend::open(
Arc::clone(&client),
&config.database,
&db_config_dir(config),
)?);

let filter_pool: Option<FilterPool> = Some(Arc::new(Mutex::new(BTreeMap::new())));
let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));
Expand All @@ -168,7 +171,7 @@ pub fn new_partial(
)?;

let (babe_block_import, babe_link) = sc_consensus_babe::block_import(
sc_consensus_babe::Config::get(&*client)?,
sc_consensus_babe::configuration(&*client)?,
grandpa_block_import.clone(),
client.clone(),
)?;
Expand Down Expand Up @@ -196,14 +199,10 @@ pub fn new_partial(
slot_duration,
);

let uncles =
sp_authorship::InherentDataProvider::<<Block as BlockT>::Header>::check_inherents();

Ok((timestamp, slot, uncles))
Ok((slot, timestamp))
},
&task_manager.spawn_essential_handle(),
config.prometheus_registry(),
sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()),
telemetry.as_ref().map(|x| x.handle()),
)?;

Expand Down Expand Up @@ -307,7 +306,7 @@ pub fn new_full(mut config: Configuration, cli: &Cli) -> Result<TaskManager, Ser
.extra_sets
.push(ethy_gadget::ethy_peers_set_config(ethy_protocol_name.clone()));

let (network, system_rpc_tx, network_starter) =
let (network, system_rpc_tx, tx_handler_controller, network_starter) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
client: client.clone(),
Expand Down Expand Up @@ -418,6 +417,7 @@ pub fn new_full(mut config: Configuration, cli: &Cli) -> Result<TaskManager, Ser
system_rpc_tx,
config,
telemetry: telemetry.as_mut(),
tx_handler_controller,
})?;

spawn_frontier_tasks(
Expand All @@ -440,9 +440,6 @@ pub fn new_full(mut config: Configuration, cli: &Cli) -> Result<TaskManager, Ser
telemetry.as_ref().map(|x| x.handle()),
);

let can_author_with =
sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone());

let client_clone = client.clone();
let slot_duration = babe_link.config().slot_duration();
let babe_config = sc_consensus_babe::BabeParams {
Expand All @@ -456,11 +453,6 @@ pub fn new_full(mut config: Configuration, cli: &Cli) -> Result<TaskManager, Ser
create_inherent_data_providers: move |parent, ()| {
let client_clone = client_clone.clone();
async move {
let uncles = sc_consensus_uncles::create_uncles_inherent_data_provider(
&*client_clone,
parent,
)?;

let timestamp = sp_timestamp::InherentDataProvider::from_system_time();

let slot =
Expand All @@ -475,13 +467,12 @@ pub fn new_full(mut config: Configuration, cli: &Cli) -> Result<TaskManager, Ser
&parent,
)?;

Ok((timestamp, slot, uncles, storage_proof))
Ok((slot, timestamp, storage_proof))
}
},
force_authoring,
backoff_authoring_blocks,
babe_link,
can_author_with,
block_proposal_slot_portion: SlotProportion::new(0.5),
max_block_proposal_slot_portion: None,
telemetry: telemetry.as_ref().map(|x| x.handle()),
Expand Down
Loading

0 comments on commit 5cff571

Please sign in to comment.