Skip to content

Commit d742022

Browse files
feat: update to polkadot v1.1.0 release (#1182)
* feat: update all deps to polkadot v1.1.0 * feat(assets-erc20): update imports for `frame_support` * feat(xc-asset-config): update imports for `frame_support` * feat(primitives): replace xcm `Convert` with `sp_runtime`'s `MaybeEquivalence` * feat: update all pallets for polkadot v1.1.0 * feat: update chain extensions * feat: update all precompiles * wip: local runtime * feat: update shibuya runtmie * feat: fix local runtime * feat: fix holds * feat: update astar and shiden runtime * feat: fix all tests * feat: build works execpt tracing * feat: evm tracing build works * feat: bump spec versions * feat: streamline genesis state export * fix: max hold in local runtime * fix: aura issue in eth pending api * feat: review comments * feat: copy `AllowTopLevelPaidExecutionFrom` barrier into primititves * fix: build error * fix: make taplo happy * fix: review comments * fix: add contract migration back into shiden * feat: remove `BlockNumberFor` clauses * fix: format * fix: make clippy happy * feat: update `CodeHashLockupDepositPercent` value
1 parent 27b45e9 commit d742022

File tree

115 files changed

+3597
-2607
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+3597
-2607
lines changed

Cargo.lock

Lines changed: 2277 additions & 1259 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 145 additions & 148 deletions
Large diffs are not rendered by default.

bin/collator/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ fp-rpc = { workspace = true, features = ["std"] }
7676
pallet-ethereum = { workspace = true, features = ["std"] }
7777
pallet-evm = { workspace = true, features = ["std"] }
7878

79+
fc-api = { workspace = true }
7980
fc-consensus = { workspace = true }
8081
fc-db = { workspace = true }
8182
fc-mapping-sync = { workspace = true }
@@ -105,20 +106,19 @@ substrate-frame-rpc-system = { workspace = true }
105106
sc-cli = { workspace = true, optional = true }
106107

107108
# cumulus dependencies
108-
cumulus-primitives-core = { workspace = true, features = ["std"] }
109-
110109
cumulus-client-cli = { workspace = true }
111110
cumulus-client-consensus-aura = { workspace = true }
112111
cumulus-client-consensus-common = { workspace = true }
113112
cumulus-client-consensus-relay-chain = { workspace = true }
114113
cumulus-client-network = { workspace = true }
115114
cumulus-client-service = { workspace = true }
115+
cumulus-primitives-core = { workspace = true, features = ["std"] }
116116
cumulus-primitives-parachain-inherent = { workspace = true }
117117
cumulus-relay-chain-inprocess-interface = { workspace = true }
118118
cumulus-relay-chain-interface = { workspace = true }
119119
cumulus-relay-chain-minimal-node = { workspace = true }
120120
cumulus-relay-chain-rpc-interface = { workspace = true }
121-
cumulus-test-relay-sproof-builder = { workspace = true, optional = true }
121+
cumulus-test-relay-sproof-builder = { workspace = true }
122122

123123
# polkadot dependencies
124124
polkadot-cli = { workspace = true, optional = true }
@@ -157,10 +157,10 @@ runtime-benchmarks = [
157157
"local-runtime/runtime-benchmarks",
158158
"shibuya-runtime/runtime-benchmarks",
159159
"shiden-runtime/runtime-benchmarks",
160+
"astar-runtime/runtime-benchmarks",
160161
"polkadot-cli/runtime-benchmarks",
161162
"polkadot-runtime-common/std",
162163
"sp-keyring",
163-
"cumulus-test-relay-sproof-builder",
164164
"polkadot-runtime-common",
165165
"astar-primitives/runtime-benchmarks",
166166
]

bin/collator/src/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ pub enum Subcommand {
105105
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
106106

107107
/// Try some command against runtime state.
108-
#[cfg(feature = "try-runtime")]
109-
TryRuntime(try_runtime_cli::TryRuntimeCmd),
108+
/// No moved to separte cli and just a placeholder command here
109+
TryRuntime,
110110
}
111111

112112
#[derive(Debug)]

bin/collator/src/command.rs

Lines changed: 31 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ use sc_service::{
4141
use sp_core::hexdisplay::HexDisplay;
4242
use sp_runtime::traits::AccountIdConversion;
4343
use sp_runtime::traits::Block as BlockT;
44-
use std::net::SocketAddr;
44+
use std::{io::Write, net::SocketAddr};
4545

46-
#[cfg(feature = "frame-benchmarking-cli")]
46+
#[cfg(feature = "runtime-benchmarks")]
4747
use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE};
4848

4949
trait IdentifyChain {
@@ -147,8 +147,10 @@ impl SubstrateCli for Cli {
147147
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
148148
load_spec(id)
149149
}
150+
}
150151

151-
fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
152+
impl Cli {
153+
fn runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
152154
if chain_spec.is_dev() {
153155
&local_runtime::VERSION
154156
} else if chain_spec.is_astar() {
@@ -202,10 +204,6 @@ impl SubstrateCli for RelayChainCli {
202204
polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id)
203205
}
204206
}
205-
206-
fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
207-
polkadot_cli::Cli::native_runtime_version(chain_spec)
208-
}
209207
}
210208

211209
/// Parse command line arguments into service configuration.
@@ -458,13 +456,22 @@ pub fn run() -> Result<()> {
458456
}
459457
}
460458
Some(Subcommand::ExportGenesisState(cmd)) => {
461-
let runner = cli.create_runner(cmd)?;
459+
let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?;
460+
let state_version = Cli::runtime_version(&spec).state_version();
462461

463-
runner.sync_run(|_config| {
464-
let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?;
465-
let state_version = Cli::native_runtime_version(&spec).state_version();
466-
cmd.run::<Block>(&*spec, state_version)
467-
})
462+
let block: Block = generate_genesis_block(&*spec, state_version)?;
463+
let raw_header = block.header().encode();
464+
let output_buf = if cmd.raw {
465+
raw_header
466+
} else {
467+
format!("0x{:?}", HexDisplay::from(&block.header().encode())).into_bytes()
468+
};
469+
if let Some(output) = &cmd.output {
470+
std::fs::write(output, output_buf)?;
471+
} else {
472+
std::io::stdout().write_all(&output_buf)?;
473+
}
474+
Ok(())
468475
}
469476
Some(Subcommand::ExportGenesisWasm(cmd)) => {
470477
let runner = cli.create_runner(cmd)?;
@@ -478,7 +485,7 @@ pub fn run() -> Result<()> {
478485
Some(Subcommand::Sign(cmd)) => cmd.run(),
479486
Some(Subcommand::Verify(cmd)) => cmd.run(),
480487
Some(Subcommand::Vanity(cmd)) => cmd.run(),
481-
#[cfg(feature = "frame-benchmarking-cli")]
488+
#[cfg(feature = "runtime-benchmarks")]
482489
Some(Subcommand::Benchmark(cmd)) => {
483490
use crate::benchmarking::*;
484491
use sp_keyring::Sr25519Keyring;
@@ -490,18 +497,18 @@ pub fn run() -> Result<()> {
490497
BenchmarkCmd::Pallet(cmd) => {
491498
if chain_spec.is_astar() {
492499
runner.sync_run(|config| {
493-
cmd.run::<astar_runtime::Block, astar::Executor>(config)
500+
cmd.run::<astar_runtime::Block, parachain::HostFunctions>(config)
494501
})
495502
} else if chain_spec.is_shiden() {
496503
runner.sync_run(|config| {
497-
cmd.run::<shiden_runtime::Block, shiden::Executor>(config)
504+
cmd.run::<shiden_runtime::Block, parachain::HostFunctions>(config)
498505
})
499506
} else if chain_spec.is_shibuya() {
500507
runner.sync_run(|config| {
501-
cmd.run::<shibuya_runtime::Block, shibuya::Executor>(config)
508+
cmd.run::<shibuya_runtime::Block, parachain::HostFunctions>(config)
502509
})
503510
} else {
504-
runner.sync_run(|config| cmd.run::<Block, local::Executor>(config))
511+
runner.sync_run(|config| cmd.run::<Block, local::HostFunctions>(config))
505512
}
506513
}
507514
BenchmarkCmd::Block(cmd) => {
@@ -763,85 +770,11 @@ pub fn run() -> Result<()> {
763770
}
764771
}
765772
}
766-
#[cfg(feature = "try-runtime")]
767-
Some(Subcommand::TryRuntime(cmd)) => {
768-
let runner = cli.create_runner(cmd)?;
769-
let chain_spec = &runner.config().chain_spec;
770-
771-
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
772-
type HostFunctionsOf<E> = ExtendedHostFunctions<
773-
sp_io::SubstrateHostFunctions,
774-
<E as NativeExecutionDispatch>::ExtendHostFunctions,
775-
>;
776-
777-
if chain_spec.is_shiden() {
778-
runner.async_run(|config| {
779-
let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
780-
let info_provider =
781-
try_runtime_cli::block_building_info::timestamp_with_aura_info(6000);
782-
let task_manager =
783-
sc_service::TaskManager::new(config.tokio_handle.clone(), registry)
784-
.map_err(|e| {
785-
sc_cli::Error::Service(sc_service::Error::Prometheus(e))
786-
})?;
787-
Ok((
788-
cmd.run::<shiden_runtime::Block, HostFunctionsOf<shiden::Executor>, _>(
789-
Some(info_provider),
790-
),
791-
task_manager,
792-
))
793-
})
794-
} else if chain_spec.is_shibuya() {
795-
runner.async_run(|config| {
796-
let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
797-
let info_provider =
798-
try_runtime_cli::block_building_info::timestamp_with_aura_info(6000);
799-
let task_manager =
800-
sc_service::TaskManager::new(config.tokio_handle.clone(), registry)
801-
.map_err(|e| {
802-
sc_cli::Error::Service(sc_service::Error::Prometheus(e))
803-
})?;
804-
Ok((
805-
cmd.run::<shibuya_runtime::Block, HostFunctionsOf<shibuya::Executor>, _>(
806-
Some(info_provider),
807-
),
808-
task_manager,
809-
))
810-
})
811-
} else if chain_spec.is_astar() {
812-
runner.async_run(|config| {
813-
let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
814-
let info_provider =
815-
try_runtime_cli::block_building_info::timestamp_with_aura_info(6000);
816-
let task_manager =
817-
sc_service::TaskManager::new(config.tokio_handle.clone(), registry)
818-
.map_err(|e| {
819-
sc_cli::Error::Service(sc_service::Error::Prometheus(e))
820-
})?;
821-
Ok((
822-
cmd.run::<astar_runtime::Block, HostFunctionsOf<astar::Executor>, _>(Some(
823-
info_provider,
824-
)),
825-
task_manager,
826-
))
827-
})
828-
} else {
829-
runner.async_run(|config| {
830-
let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
831-
let info_provider =
832-
try_runtime_cli::block_building_info::timestamp_with_aura_info(6000);
833-
let task_manager =
834-
sc_service::TaskManager::new(config.tokio_handle.clone(), registry)
835-
.map_err(|e| {
836-
sc_cli::Error::Service(sc_service::Error::Prometheus(e))
837-
})?;
838-
Ok((
839-
cmd.run::<Block, HostFunctionsOf<local::Executor>, _>(Some(info_provider)),
840-
task_manager,
841-
))
842-
})
843-
}
844-
}
773+
Some(Subcommand::TryRuntime) => Err("The `try-runtime` subcommand has been migrated to a \
774+
standalone CLI (https://github.com/paritytech/try-runtime-cli). It is no longer \
775+
being maintained here and will be removed entirely some time after January 2024. \
776+
Please remove this subcommand from your runtime and use the standalone CLI."
777+
.into()),
845778
None => {
846779
let runner = cli.create_runner(&cli.run.normalize())?;
847780
let collator_options = cli.run.collator_options();
@@ -885,7 +818,7 @@ pub fn run() -> Result<()> {
885818
let parachain_account =
886819
AccountIdConversion::<polkadot_primitives::AccountId>::into_account_truncating(&para_id);
887820

888-
let state_version = Cli::native_runtime_version(&config.chain_spec).state_version();
821+
let state_version = Cli::runtime_version(&config.chain_spec).state_version();
889822
let block: Block = generate_genesis_block(&*config.chain_spec, state_version)
890823
.map_err(|e| format!("{:?}", e))?;
891824
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));

bin/collator/src/local/chain_spec.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
2121
use local_runtime::{
2222
wasm_binary_unwrap, AccountId, AuraConfig, AuraId, BalancesConfig, BlockRewardConfig,
23-
CouncilConfig, DappStakingConfig, DemocracyConfig, EVMConfig, GenesisConfig, GrandpaConfig,
24-
GrandpaId, InflationConfig, InflationParameters, Precompiles, RewardDistributionConfig,
25-
Signature, SudoConfig, SystemConfig, TechnicalCommitteeConfig, TierThreshold, TreasuryConfig,
26-
VestingConfig, AST,
23+
CouncilConfig, DappStakingConfig, DemocracyConfig, EVMConfig, GrandpaConfig, GrandpaId,
24+
InflationConfig, InflationParameters, Precompiles, RewardDistributionConfig,
25+
RuntimeGenesisConfig, Signature, SudoConfig, SystemConfig, TechnicalCommitteeConfig,
26+
TierThreshold, TreasuryConfig, VestingConfig, AST,
2727
};
2828
use sc_service::ChainType;
2929
use sp_core::{crypto::Ss58Codec, sr25519, Pair, Public};
@@ -35,7 +35,7 @@ use sp_runtime::{
3535
type AccountPublic = <Signature as Verify>::Signer;
3636

3737
/// Specialized `ChainSpec` for Shiden Network.
38-
pub type ChainSpec = sc_service::GenericChainSpec<local_runtime::GenesisConfig>;
38+
pub type ChainSpec = sc_service::GenericChainSpec<local_runtime::RuntimeGenesisConfig>;
3939

4040
/// Helper function to generate a crypto pair from seed
4141
fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
@@ -99,15 +99,16 @@ fn testnet_genesis(
9999
initial_authorities: Vec<(AuraId, GrandpaId)>,
100100
root_key: AccountId,
101101
endowed_accounts: Vec<AccountId>,
102-
) -> GenesisConfig {
102+
) -> RuntimeGenesisConfig {
103103
// This is supposed the be the simplest bytecode to revert without returning any data.
104104
// We will pre-deploy it under all of our precompiles to ensure they can be called from
105105
// within contracts.
106106
// (PUSH1 0x00 PUSH1 0x00 REVERT)
107107
let revert_bytecode = vec![0x60, 0x00, 0x60, 0x00, 0xFD];
108-
GenesisConfig {
108+
RuntimeGenesisConfig {
109109
system: SystemConfig {
110110
code: wasm_binary_unwrap().to_vec(),
111+
..Default::default()
111112
},
112113
balances: BalancesConfig {
113114
balances: endowed_accounts
@@ -126,6 +127,7 @@ fn testnet_genesis(
126127
adjustable_percent: Perbill::from_percent(25),
127128
ideal_dapps_staking_tvl: Perbill::from_percent(40),
128129
},
130+
..Default::default()
129131
},
130132
vesting: VestingConfig { vesting: vec![] },
131133
aura: AuraConfig {
@@ -136,6 +138,7 @@ fn testnet_genesis(
136138
.iter()
137139
.map(|x| (x.1.clone(), 1))
138140
.collect(),
141+
..Default::default()
139142
},
140143
evm: EVMConfig {
141144
// We need _some_ code inserted at the precompile address so that
@@ -153,6 +156,7 @@ fn testnet_genesis(
153156
)
154157
})
155158
.collect(),
159+
..Default::default()
156160
},
157161
ethereum: Default::default(),
158162
sudo: SudoConfig {
@@ -207,9 +211,11 @@ fn testnet_genesis(
207211
TierThreshold::FixedTvlAmount { amount: 10 * AST },
208212
],
209213
slots_per_tier: vec![10, 20, 30, 40],
214+
..Default::default()
210215
},
211216
inflation: InflationConfig {
212217
params: InflationParameters::default(),
218+
..Default::default()
213219
},
214220
}
215221
}

bin/collator/src/local/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ mod service;
2525
mod chain_spec;
2626

2727
pub use chain_spec::*;
28-
pub use service::{new_partial, start_node, Executor, RuntimeApi};
28+
pub use service::{new_partial, start_node, Executor, HostFunctions, RuntimeApi};

0 commit comments

Comments
 (0)