Skip to content

Commit

Permalink
To polkadot-v1.0.0 (#1304)
Browse files Browse the repository at this point in the history
* To polkadot-v1.0.0 parts.1

* Bump dependencies

* Companion of paritytech/cumulus#2601

* Parts.2

* Companion of paritytech/substrate#14435

* Companion of paritytech/substrate#14474

* Companion of paritytech/substrate#14511

* Parts.3

* Format

* Fix Frontier RPC Compile (#1305)

* Fix compile

* Run local ethereum tests

* Clean

* Fix features

---------

Co-authored-by: Bear Wang <boundless.forest@outlook.com>
  • Loading branch information
aurexav and boundless-forest authored Oct 30, 2023
1 parent ddc11b8 commit b12a6fc
Show file tree
Hide file tree
Showing 65 changed files with 1,581 additions and 1,730 deletions.
1,951 changes: 974 additions & 977 deletions Cargo.lock

Large diffs are not rendered by default.

304 changes: 142 additions & 162 deletions Cargo.toml

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions core/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ pub type Signature = fp_account::EthereumSignature;
pub type AccountId = <<Signature as sp_runtime::traits::Verify>::Signer as sp_runtime::traits::IdentifyAccount>::AccountId;

/// Index of a transaction in the chain.
pub type Index = u32;

/// Nonce of an account in the chain.
/// or
/// nonce of an account in the chain.
pub type Nonce = u32;

/// A hash of some data used by the chain.
Expand Down
6 changes: 3 additions & 3 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ substrate-build-script-utils = { workspace = true }
# crates.io
array-bytes = { workspace = true }
async-trait = { version = "0.1" }
clap = { version = "4.1", features = ["derive"] }
codec = { workspace = true, package = "parity-scale-codec" }
clap = { version = "4.4", features = ["derive"] }
futures = { version = "0.3" }
jsonrpsee = { version = "0.16", features = ["server"] }
log = { version = "0.4" }
serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1.25" }
tokio = { version = "1.33" }
trauma = { version = "2.2" }

# cumulus
Expand Down Expand Up @@ -82,6 +81,7 @@ sc-transaction-pool-api = { workspace = true }
sp-api = { workspace = true, features = ["std"] }
sp-block-builder = { workspace = true, features = ["std"] }
sp-blockchain = { workspace = true }
sp-inherents = { workspace = true, features = ["std"] }
sp-consensus-aura = { workspace = true, features = ["std"] }
sp-core = { workspace = true, features = ["std"] }
sp-io = { workspace = true, optional = true, features = ["std"] }
Expand Down
25 changes: 15 additions & 10 deletions node/src/chain_spec/crab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use sc_telemetry::TelemetryEndpoints;
use sp_core::{crypto::UncheckedInto, H160};

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

fn properties() -> Properties {
super::properties("CRAB")
Expand Down Expand Up @@ -170,11 +170,11 @@ pub fn genesis_config() -> ChainSpec {
"crab2",
ChainType::Live,
move || {
GenesisConfig {
RuntimeGenesisConfig {
// System stuff.
system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() },
system: SystemConfig { code: WASM_BINARY.unwrap().to_vec(), ..Default::default() },
parachain_system: Default::default(),
parachain_info: ParachainInfoConfig { parachain_id: 2105.into() },
parachain_info: ParachainInfoConfig { parachain_id: 2105.into(), ..Default::default() },

// Monetary stuff.
balances: BalancesConfig {
Expand Down Expand Up @@ -232,7 +232,7 @@ pub fn genesis_config() -> ChainSpec {
treasury: Default::default(),

// XCM stuff.
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), ..Default::default() },

// EVM stuff.
ethereum: Default::default(),
Expand All @@ -252,6 +252,7 @@ pub fn genesis_config() -> ChainSpec {
}),
)
},
..Default::default()
},

// S2S stuff.
Expand Down Expand Up @@ -283,12 +284,12 @@ fn testnet_genesis(
collators: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> GenesisConfig {
GenesisConfig {
) -> RuntimeGenesisConfig {
RuntimeGenesisConfig {
// System stuff.
system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() },
system: SystemConfig { code: WASM_BINARY.unwrap().to_vec(), ..Default::default() },
parachain_system: Default::default(),
parachain_info: ParachainInfoConfig { parachain_id: id },
parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() },

// Monetary stuff.
balances: BalancesConfig {
Expand Down Expand Up @@ -340,7 +341,10 @@ fn testnet_genesis(
treasury: Default::default(),

// XCM stuff.
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
polkadot_xcm: PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},

// EVM stuff.
ethereum: Default::default(),
Expand Down Expand Up @@ -374,6 +378,7 @@ fn testnet_genesis(
]),
)
},
..Default::default()
},

// S2S stuff.
Expand Down
25 changes: 15 additions & 10 deletions node/src/chain_spec/darwinia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use sc_telemetry::TelemetryEndpoints;
use sp_core::{crypto::UncheckedInto, H160};

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

fn properties() -> Properties {
super::properties("RING")
Expand Down Expand Up @@ -166,11 +166,11 @@ pub fn genesis_config() -> ChainSpec {
"darwinia2",
ChainType::Live,
move || {
GenesisConfig {
RuntimeGenesisConfig {
// System stuff.
system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() },
system: SystemConfig { code: WASM_BINARY.unwrap().to_vec(), ..Default::default() },
parachain_system: Default::default(),
parachain_info: ParachainInfoConfig { parachain_id: 2046.into() },
parachain_info: ParachainInfoConfig { parachain_id: 2046.into(), ..Default::default() },

// Monetary stuff.
balances: BalancesConfig {
Expand Down Expand Up @@ -228,7 +228,7 @@ pub fn genesis_config() -> ChainSpec {
treasury: Default::default(),

// XCM stuff.
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), ..Default::default() },

// EVM stuff.
ethereum: Default::default(),
Expand All @@ -248,6 +248,7 @@ pub fn genesis_config() -> ChainSpec {
}),
)
},
..Default::default()
},

// S2S stuff.
Expand Down Expand Up @@ -279,12 +280,12 @@ fn testnet_genesis(
collators: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> GenesisConfig {
GenesisConfig {
) -> RuntimeGenesisConfig {
RuntimeGenesisConfig {
// System stuff.
system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() },
system: SystemConfig { code: WASM_BINARY.unwrap().to_vec(), ..Default::default() },
parachain_system: Default::default(),
parachain_info: ParachainInfoConfig { parachain_id: id },
parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() },

// Monetary stuff.
balances: BalancesConfig {
Expand Down Expand Up @@ -336,7 +337,10 @@ fn testnet_genesis(
treasury: Default::default(),

// XCM stuff.
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
polkadot_xcm: PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},

// EVM stuff.
ethereum: Default::default(),
Expand Down Expand Up @@ -370,6 +374,7 @@ fn testnet_genesis(
]),
)
},
..Default::default()
},

// S2S stuff.
Expand Down
26 changes: 16 additions & 10 deletions node/src/chain_spec/pangolin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use sc_telemetry::TelemetryEndpoints;
use sp_core::{crypto::UncheckedInto, H160};

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

fn properties() -> Properties {
super::properties("PRING")
Expand Down Expand Up @@ -144,11 +144,11 @@ pub fn genesis_config() -> ChainSpec {
"pangolin2",
ChainType::Live,
move || {
GenesisConfig {
RuntimeGenesisConfig {
// System stuff.
system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() },
system: SystemConfig { code: WASM_BINARY.unwrap().to_vec(), ..Default::default() },
parachain_system: Default::default(),
parachain_info: ParachainInfoConfig { parachain_id: 2105.into() },
parachain_info: ParachainInfoConfig { parachain_id: 2105.into(), ..Default::default() },

// Monetary stuff.
balances: BalancesConfig {
Expand All @@ -157,6 +157,7 @@ pub fn genesis_config() -> ChainSpec {
(array_bytes::hex_n_into_unchecked(C2), 10_000 * UNIT),
(array_bytes::hex_n_into_unchecked(C3), 10_000 * UNIT),
],
..Default::default()
},
transaction_payment: Default::default(),
assets: AssetsConfig {
Expand Down Expand Up @@ -221,7 +222,7 @@ pub fn genesis_config() -> ChainSpec {
sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(SUDO)) },

// XCM stuff.
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION), ..Default::default() },

// EVM stuff.
ethereum: Default::default(),
Expand All @@ -241,6 +242,7 @@ pub fn genesis_config() -> ChainSpec {
}),
)
},
..Default::default()
},

// S2S stuff.
Expand Down Expand Up @@ -272,12 +274,12 @@ fn testnet_genesis(
collators: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> GenesisConfig {
GenesisConfig {
) -> RuntimeGenesisConfig {
RuntimeGenesisConfig {
// System stuff.
system: SystemConfig { code: WASM_BINARY.unwrap().to_vec() },
system: SystemConfig { code: WASM_BINARY.unwrap().to_vec(), ..Default::default() },
parachain_system: Default::default(),
parachain_info: ParachainInfoConfig { parachain_id: id },
parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() },

// Monetary stuff.
balances: BalancesConfig {
Expand Down Expand Up @@ -341,7 +343,10 @@ fn testnet_genesis(
sudo: SudoConfig { key: Some(array_bytes::hex_n_into_unchecked(ALITH)) },

// XCM stuff.
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
polkadot_xcm: PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},

// EVM stuff.
ethereum: Default::default(),
Expand Down Expand Up @@ -375,6 +380,7 @@ fn testnet_genesis(
]),
)
},
..Default::default()
},

// S2S stuff.
Expand Down
11 changes: 4 additions & 7 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
// You should have received a copy of the GNU General Public License
// along with Darwinia. If not, see <https://www.gnu.org/licenses/>.

// std
use std::{path::PathBuf, str::FromStr};

/// Sub-commands supported by the collator.
#[derive(Debug, clap::Subcommand)]
pub enum Subcommand {
Expand Down Expand Up @@ -108,7 +105,7 @@ pub struct RelayChainCli {
pub chain_id: Option<String>,

/// The base path that should be used by the relay chain.
pub base_path: Option<PathBuf>,
pub base_path: Option<std::path::PathBuf>,
}
impl RelayChainCli {
/// Parse the relay chain CLI parameters using the para chain `Configuration`.
Expand All @@ -129,7 +126,7 @@ impl RelayChainCli {
}

/// Available frontier backend types.
#[derive(Debug, Copy, Clone, Default, clap::ValueEnum)]
#[derive(Copy, Clone, Debug, Default, clap::ValueEnum)]
pub enum FrontierBackendType {
/// Either RocksDb or ParityDb as per inherited from the global backend settings.
#[default]
Expand Down Expand Up @@ -227,7 +224,7 @@ pub enum TracingApi {
Debug,
Trace,
}
impl FromStr for TracingApi {
impl std::str::FromStr for TracingApi {
type Err = String;

fn from_str(s: &str) -> Result<Self, Self::Err> {
Expand All @@ -239,7 +236,7 @@ impl FromStr for TracingApi {
}
}

#[derive(Clone, Debug)]
#[derive(Clone, Debug, Default)]
pub struct EthRpcConfig {
pub tracing_api: Vec<TracingApi>,
pub tracing_max_permits: u32,
Expand Down
Loading

0 comments on commit b12a6fc

Please sign in to comment.