Skip to content

Commit

Permalink
Substrate upgrade polkadot-v1.0.0 and polkadot-v1.1.0 (#1306)
Browse files Browse the repository at this point in the history
* To `polkadot-v1.0.0` (#1304)

* 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>

* To `polkadot-v1.1.0` (#1308)

* Anchor polkadot-v1.1.0

* Part.1

* Fix the precompile component errors

* Format

* Companion of paritytech/cumulus#2951

* Companion of paritytech/substrate#14612

* Companion of paritytech/cumulus#2270

* Companion of paritytech/cumulus#3046

* Companion of paritytech/cumulus#2300

* Ethereum upgrade part (#1311)

* Fix `message-transact` compile issue

* Fix compile 1

* Fix compile 2

* Fix compile 3

* Fix compile

* Try fix compile

* Fix compile

* Code clean

* Fix `try-runtime` compile

* Fix `runtime-benchmarks` compile

* Update ethereum runtime rpc impl

* Remove useless dep

* Replace to the official dep path

---------

Co-authored-by: Xavier Lau <xavier@inv.cafe>

---------

Co-authored-by: bear <boundless.forest@outlook.com>

* Fix tests

* Try fix unit tests 1

* Pass all unit tests

* Add missing features

Signed-off-by: Xavier Lau <xavier@inv.cafe>

---------

Signed-off-by: Xavier Lau <xavier@inv.cafe>
Co-authored-by: Bear Wang <boundless.forest@outlook.com>
  • Loading branch information
aurexav and boundless-forest authored Nov 9, 2023
1 parent 989beb8 commit 9f24a02
Show file tree
Hide file tree
Showing 101 changed files with 3,621 additions and 3,394 deletions.
3,840 changes: 2,302 additions & 1,538 deletions Cargo.lock

Large diffs are not rendered by default.

305 changes: 143 additions & 162 deletions Cargo.toml

Large diffs are not rendered by default.

13 changes: 10 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 Expand Up @@ -68,6 +67,14 @@ pub type Block = sp_runtime::generic::Block<Header, sp_runtime::OpaqueExtrinsic>
///
/// Change this to adjust the block time.
pub const MILLISECS_PER_BLOCK: u64 = 12_000;
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included
/// into the relay chain.
pub const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
/// How many parachain blocks are processed by the relay chain per parent. Limits the
/// number of blocks authored per slot.
pub const BLOCK_PROCESSING_VELOCITY: u32 = 1;
/// Relay chain slot duration, in milliseconds.
pub const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;

// NOTE: Currently it is not possible to change the slot duration after the chain has started.
// Attempting to do so will brick block production.
Expand Down
13 changes: 6 additions & 7 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,20 @@ 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
cumulus-client-cli = { workspace = true }
cumulus-client-collator = { workspace = true }
cumulus-client-consensus-aura = { workspace = true }
cumulus-client-consensus-common = { workspace = true }
cumulus-client-consensus-proposer = { workspace = true }
cumulus-client-service = { workspace = true }
cumulus-primitives-core = { workspace = true, features = ["std"] }
cumulus-primitives-parachain-inherent = { workspace = true, features = ["std"] }
Expand All @@ -39,6 +40,7 @@ pangolin-runtime = { workspace = true, optional = true }
pangoro-runtime = { workspace = true, optional = true }

# frontier
fc-api = { workspace = true }
fc-db = { workspace = true }
fc-mapping-sync = { workspace = true }
fc-rpc = { workspace = true }
Expand Down Expand Up @@ -84,7 +86,7 @@ sp-block-builder = { workspace = true, features = ["std"] }
sp-blockchain = { workspace = true }
sp-consensus-aura = { workspace = true, features = ["std"] }
sp-core = { workspace = true, features = ["std"] }
sp-io = { workspace = true, optional = true, features = ["std"] }
sp-inherents = { workspace = true, features = ["std"] }
sp-keystore = { workspace = true }
sp-offchain = { workspace = true, features = ["std"] }
sp-runtime = { workspace = true, features = ["std"] }
Expand All @@ -93,7 +95,6 @@ sp-timestamp = { workspace = true, features = ["std"] }
sp-transaction-pool = { workspace = true, features = ["std"] }
substrate-frame-rpc-system = { workspace = true }
substrate-prometheus-endpoint = { workspace = true }
try-runtime-cli = { workspace = true, optional = true }

[features]
default = [
Expand Down Expand Up @@ -148,9 +149,7 @@ try-runtime = [
"polkadot-cli/try-runtime",

# substrate
"sp-io",
"sp-runtime/try-runtime",
"try-runtime-cli/try-runtime",
]

all-natives = [
Expand Down
65 changes: 35 additions & 30 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 All @@ -62,17 +62,17 @@ pub fn development_config() -> ChainSpec {
vec![
// Bind the `Alice` to `Alith` to make `--alice` available for testnet.
(
array_bytes::hex_n_into_unchecked(ALITH),
array_bytes::hex_n_into_unchecked::<_, _, 20>(ALITH),
get_collator_keys_from_seed("Alice"),
),
],
vec![
array_bytes::hex_n_into_unchecked(ALITH),
array_bytes::hex_n_into_unchecked(BALTATHAR),
array_bytes::hex_n_into_unchecked(CHARLETH),
array_bytes::hex_n_into_unchecked(DOROTHY),
array_bytes::hex_n_into_unchecked(ETHAN),
array_bytes::hex_n_into_unchecked(FAITH),
array_bytes::hex_n_into_unchecked::<_, _, 20>(ALITH),
array_bytes::hex_n_into_unchecked::<_, _, 20>(BALTATHAR),
array_bytes::hex_n_into_unchecked::<_, _, 20>(CHARLETH),
array_bytes::hex_n_into_unchecked::<_, _, 20>(DOROTHY),
array_bytes::hex_n_into_unchecked::<_, _, 20>(ETHAN),
array_bytes::hex_n_into_unchecked::<_, _, 20>(FAITH),
],
2105.into(),
)
Expand Down Expand Up @@ -100,27 +100,27 @@ pub fn local_config() -> ChainSpec {
vec![
// Bind the `Alice` to `Alith` to make `--alice` available for testnet.
(
array_bytes::hex_n_into_unchecked(ALITH),
array_bytes::hex_n_into_unchecked::<_, _, 20>(ALITH),
get_collator_keys_from_seed("Alice"),
),
// Bind the `Bob` to `Balthar` to make `--bob` available for testnet.
(
array_bytes::hex_n_into_unchecked(BALTATHAR),
array_bytes::hex_n_into_unchecked::<_, _, 20>(BALTATHAR),
get_collator_keys_from_seed("Bob"),
),
// Bind the `Charlie` to `CHARLETH` to make `--charlie` available for testnet.
(
array_bytes::hex_n_into_unchecked(CHARLETH),
array_bytes::hex_n_into_unchecked::<_, _, 20>(CHARLETH),
get_collator_keys_from_seed("Charlie"),
),
],
vec![
array_bytes::hex_n_into_unchecked(ALITH),
array_bytes::hex_n_into_unchecked(BALTATHAR),
array_bytes::hex_n_into_unchecked(CHARLETH),
array_bytes::hex_n_into_unchecked(DOROTHY),
array_bytes::hex_n_into_unchecked(ETHAN),
array_bytes::hex_n_into_unchecked(FAITH),
array_bytes::hex_n_into_unchecked::<_, _, 20>(ALITH),
array_bytes::hex_n_into_unchecked::<_, _, 20>(BALTATHAR),
array_bytes::hex_n_into_unchecked::<_, _, 20>(CHARLETH),
array_bytes::hex_n_into_unchecked::<_, _, 20>(DOROTHY),
array_bytes::hex_n_into_unchecked::<_, _, 20>(ETHAN),
array_bytes::hex_n_into_unchecked::<_, _, 20>(FAITH),
],
2105.into(),
)
Expand Down Expand Up @@ -170,17 +170,17 @@ 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 {
balances: collators
.iter()
.map(|(k, _)| (array_bytes::hex_n_into_unchecked(k), 10_000 * UNIT))
.map(|(k, _)| (array_bytes::hex_n_into_unchecked::<_, _, 20>(k), 10_000 * UNIT))
.collect(),
},
transaction_payment: Default::default(),
Expand All @@ -203,16 +203,16 @@ pub fn genesis_config() -> ChainSpec {
collator_count: 6,
collators: collators
.iter()
.map(|(k, _)| (array_bytes::hex_n_into_unchecked(k), 1_000 * UNIT))
.map(|(k, _)| (array_bytes::hex_n_into_unchecked::<_, _, 20>(k), 1_000 * UNIT))
.collect(),
},
session: SessionConfig {
keys: collators
.iter()
.map(|(k, a)| {
(
array_bytes::hex_n_into_unchecked(k),
array_bytes::hex_n_into_unchecked(k),
array_bytes::hex_n_into_unchecked::<_, _, 20>(k),
array_bytes::hex_n_into_unchecked::<_, _, 20>(k),
session_keys(array_bytes::hex2array_unchecked(a).unchecked_into()),
)
})
Expand All @@ -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
Loading

0 comments on commit 9f24a02

Please sign in to comment.