Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to polkadot-v1.0.0 #15

Merged
merged 2 commits into from
Aug 30, 2023
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,404 changes: 697 additions & 707 deletions Cargo.lock

Large diffs are not rendered by default.

126 changes: 64 additions & 62 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,90 +7,92 @@ homepage = "https://substrate.io"
license = "Unlicense"
name = "frontier-parachain-node"
repository = "https://github.com/paritytech/cumulus/"
version = "0.9.430"
version = "1.0.0"

[dependencies]
async-trait = "0.1"
clap = {version = "4.3.2", features = ["derive", "deprecated"]}
codec = {package = "parity-scale-codec", version = "3.6.4"}
clap = { version = "4.3.24", features = ["derive"] }
futures = { version = "0.3.21", features = ["thread-pool"]}
async-trait = "0.1"
color-print = "0.3.4"
futures = "0.3.28"
jsonrpsee = {version = "0.16.2", features = ["server", "macros"]}
jsonrpsee = { version = "0.16.2", features = ["server"] }
log = "0.4.17"
serde = {version = "1.0.186", features = ["derive"]}

# Local
frontier-parachain-runtime = {path = "../runtime"}

# Substrate
frame-benchmarking = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
frame-benchmarking-cli = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
pallet-transaction-payment-rpc = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sc-basic-authorship = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sc-chain-spec = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sc-cli = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sc-client-api = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sc-consensus = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sc-executor = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sc-network = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sc-network-common = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sc-network-sync = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sc-rpc = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sc-service = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43", features = ["default"]}
sc-sysinfo = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sc-telemetry = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sc-tracing = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sc-transaction-pool = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sc-transaction-pool-api = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sp-api = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sp-block-builder = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sp-blockchain = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sp-consensus-aura = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sp-core = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sp-io = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sp-keystore = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sp-offchain = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sp-runtime = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sp-session = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sp-timestamp = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
sp-transaction-pool = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
substrate-frame-rpc-system = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
substrate-prometheus-endpoint = {git = "https://github.com/paritytech/substrate", "branch" = "polkadot-v0.9.43"}
try-runtime-cli = {git = "https://github.com/paritytech/substrate", optional = true, "branch" = "polkadot-v0.9.43"}
frame-benchmarking = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
frame-benchmarking-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
pallet-transaction-payment-rpc = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sc-basic-authorship = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sc-chain-spec = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sc-cli = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sc-client-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sc-consensus = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sc-executor = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sc-network = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sc-network-common = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sc-network-sync = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sc-offchain = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sc-rpc = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sc-service = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0", features = ["default"]}
sc-sysinfo = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sc-telemetry = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sc-tracing = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sc-transaction-pool = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sc-transaction-pool-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sp-api = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sp-block-builder = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sp-blockchain = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sp-consensus-aura = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sp-core = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sp-io = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sp-keystore = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sp-offchain = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sp-runtime = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sp-session = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sp-timestamp = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
sp-transaction-pool = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
substrate-frame-rpc-system = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
substrate-prometheus-endpoint = {git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0"}
try-runtime-cli = {git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v1.0.0"}

# Polkadot
polkadot-cli = {git = "https://github.com/paritytech/polkadot", features = ["rococo-native"], branch = "release-v0.9.43"}
polkadot-primitives = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43"}
polkadot-service = {git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43"}
xcm = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.43"}
polkadot-cli = {git = "https://github.com/paritytech/polkadot", features = ["rococo-native"], branch = "release-v1.0.0"}
polkadot-primitives = {git = "https://github.com/paritytech/polkadot", branch = "release-v1.0.0"}
polkadot-service = {git = "https://github.com/paritytech/polkadot", branch = "release-v1.0.0"}
xcm = {git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v1.0.0"}

# Cumulus
cumulus-client-cli = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.43"}
cumulus-client-consensus-aura = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.43"}
cumulus-client-consensus-common = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.43"}
cumulus-client-network = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.43"}
cumulus-client-service = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.43"}
cumulus-primitives-core = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.43"}
cumulus-primitives-parachain-inherent = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.43"}
cumulus-relay-chain-interface = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.43"}
cumulus-client-cli = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v1.0.0"}
cumulus-client-consensus-aura = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v1.0.0"}
cumulus-client-consensus-common = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v1.0.0"}
cumulus-client-network = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v1.0.0"}
cumulus-client-service = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v1.0.0"}
cumulus-primitives-core = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v1.0.0"}
cumulus-primitives-parachain-inherent = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v1.0.0"}
cumulus-relay-chain-interface = {git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v1.0.0"}

# Frontier
fc-cli = {git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43"}
fc-consensus = {git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43"}
fc-db = {git = "https://github.com/paritytech/frontier", features = ["default", "sql"], branch = "polkadot-v0.9.43"}
fc-mapping-sync = {git = "https://github.com/paritytech/frontier", features = ["sql"], branch = "polkadot-v0.9.43"}
fc-rpc = {git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43", features = ["rpc-binary-search-estimate"]}
fc-rpc-core = {git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43"}
fc-storage = {git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43"}
fp-dynamic-fee = {git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43"}
fp-evm = {git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43"}
fp-rpc = {git = "https://github.com/paritytech/frontier", branch = "polkadot-v0.9.43"}
fc-cli = {git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.0.0"}
fc-consensus = {git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.0.0"}
fc-db = {git = "https://github.com/paritytech/frontier", features = ["default", "sql"], branch = "polkadot-v1.0.0"}
fc-mapping-sync = {git = "https://github.com/paritytech/frontier", features = ["sql"], branch = "polkadot-v1.0.0"}
fc-rpc = {git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.0.0", features = ["rpc-binary-search-estimate", "txpool"]}
fc-rpc-core = {git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.0.0"}
fc-storage = {git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.0.0"}
fp-dynamic-fee = {git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.0.0"}
fp-evm = {git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.0.0"}
fp-rpc = {git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.0.0"}

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

[features]
default = []
txpool = []
runtime-benchmarks = [
"try-runtime-cli/try-runtime",
"frontier-parachain-runtime/runtime-benchmarks",
Expand Down
19 changes: 14 additions & 5 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{collections::BTreeMap, marker::PhantomData, str::FromStr};

/// Specialized `ChainSpec` for the normal parachain runtime.
pub type ChainSpec =
sc_service::GenericChainSpec<frontier_parachain_runtime::GenesisConfig, Extensions>;
sc_service::GenericChainSpec<frontier_parachain_runtime::RuntimeGenesisConfig, Extensions>;

/// The default XCM version to set in genesis config.
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;
Expand Down Expand Up @@ -187,15 +187,16 @@ fn testnet_genesis(
endowed_accounts: Vec<AccountId>,
root_key: Option<AccountId>,
id: ParaId,
) -> frontier_parachain_runtime::GenesisConfig {
) -> frontier_parachain_runtime::RuntimeGenesisConfig {
let alice = get_from_seed::<sr25519::Public>("Alice");
let bob = get_from_seed::<sr25519::Public>("Bob");

frontier_parachain_runtime::GenesisConfig {
frontier_parachain_runtime::RuntimeGenesisConfig {
system: frontier_parachain_runtime::SystemConfig {
code: frontier_parachain_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
},
// Configure additional assets here
// For example, this configures asset "ALT1" & "ALT2" with owners, alice and bob, respectively
Expand Down Expand Up @@ -223,7 +224,10 @@ fn testnet_genesis(
.filter_map(|(idx, acc)| if idx % 2 == 0 { Some(acc.clone()) } else { None })
.collect::<Vec<_>>(),
},
parachain_info: frontier_parachain_runtime::ParachainInfoConfig { parachain_id: id },
parachain_info: frontier_parachain_runtime::ParachainInfoConfig {
parachain_id: id,
..Default::default()
},
collator_selection: frontier_parachain_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: EXISTENTIAL_DEPOSIT * 16,
Expand All @@ -248,11 +252,15 @@ fn testnet_genesis(
parachain_system: Default::default(),
polkadot_xcm: frontier_parachain_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
sudo: frontier_parachain_runtime::SudoConfig { key: root_key },
transaction_payment: Default::default(),
// EVM compatibility
evm_chain_id: frontier_parachain_runtime::EVMChainIdConfig { chain_id: 1000 },
evm_chain_id: frontier_parachain_runtime::EVMChainIdConfig {
chain_id: 1000,
..Default::default()
},
evm: frontier_parachain_runtime::EVMConfig {
accounts: {
let mut map = BTreeMap::new();
Expand Down Expand Up @@ -310,6 +318,7 @@ fn testnet_genesis(
);
map
},
..Default::default()
},
ethereum: Default::default(),
dynamic_fee: Default::default(),
Expand Down
35 changes: 16 additions & 19 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use frontier_parachain_runtime::Block;
use log::{info, warn};
use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
NetworkParams, Result, RuntimeVersion, SharedParams, SubstrateCli,
NetworkParams, Result, SharedParams, SubstrateCli,
};
use sc_service::{
config::{BasePath, PrometheusConfig},
Expand All @@ -18,11 +18,13 @@ use sc_service::{
use sp_core::hexdisplay::HexDisplay;
use sp_runtime::traits::{AccountIdConversion, Block as BlockT};

#[cfg(feature = "try-runtime")]
use crate::service::ParachainNativeExecutor;
use crate::{
chain_spec,
cli::{Cli, RelayChainCli, Subcommand},
eth::db_config_dir,
service::{new_partial, ParachainNativeExecutor},
service::new_partial,
};

fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
Expand Down Expand Up @@ -68,10 +70,6 @@ impl SubstrateCli for Cli {
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
load_spec(id)
}

fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
&frontier_parachain_runtime::VERSION
}
}

impl SubstrateCli for RelayChainCli {
Expand Down Expand Up @@ -108,10 +106,6 @@ impl SubstrateCli for RelayChainCli {
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id)
}

fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
polkadot_cli::Cli::native_runtime_version(chain_spec)
}
}

macro_rules! construct_async_run {
Expand Down Expand Up @@ -221,11 +215,14 @@ pub fn run() -> Result<()> {
})
},
Some(Subcommand::ExportGenesisState(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|_config| {
construct_async_run!(|components, cli, cmd, config, eth_cfg| {
let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?;
let state_version = Cli::native_runtime_version(&spec).state_version();
cmd.run::<Block>(&*spec, state_version)
Ok(async move {
cmd.run::<frontier_parachain_runtime::opaque::Block>(
&*spec,
&*components.client,
)
})
})
},
Some(Subcommand::ExportGenesisWasm(cmd)) => {
Expand All @@ -241,7 +238,7 @@ pub fn run() -> Result<()> {
match cmd {
BenchmarkCmd::Pallet(cmd) => {
if cfg!(feature = "runtime-benchmarks") {
runner.sync_run(|config| cmd.run::<Block, ParachainNativeExecutor>(config))
runner.sync_run(|config| cmd.run::<Block, ()>(config))
} else {
Err("Benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
Expand Down Expand Up @@ -346,11 +343,11 @@ pub fn run() -> Result<()> {
let id = ParaId::from(para_id);

let parachain_account =
AccountIdConversion::<polkadot_primitives::v4::AccountId>::into_account_truncating(&id);
AccountIdConversion::<polkadot_primitives::AccountId>::into_account_truncating(&id);

let state_version = Cli::native_runtime_version(&config.chain_spec).state_version();
let block: Block = generate_genesis_block(&*config.chain_spec, state_version)
.map_err(|e| format!("{:?}", e))?;
let block: frontier_parachain_runtime::opaque::Block =
generate_genesis_block(&*config.chain_spec, sp_runtime::StateVersion::V1)
.map_err(|e| format!("{:?}", e))?;
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));

let tokio_handle = config.tokio_handle.clone();
Expand Down
Loading
Loading