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

feat: update to polkadot v1.1.0 release #1182

Merged
merged 30 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0dfb858
feat: update all deps to polkadot v1.1.0
ashutoshvarma Jan 22, 2024
323187c
feat(assets-erc20): update imports for `frame_support`
ashutoshvarma Jan 22, 2024
bfe1ded
feat(xc-asset-config): update imports for `frame_support`
ashutoshvarma Jan 22, 2024
72e0462
feat(primitives): replace xcm `Convert` with `sp_runtime`'s `MaybeEqu…
ashutoshvarma Jan 22, 2024
2b2da4a
feat: update all pallets for polkadot v1.1.0
ashutoshvarma Jan 26, 2024
df09963
feat: update chain extensions
ashutoshvarma Jan 31, 2024
a7485e2
feat: update all precompiles
ashutoshvarma Jan 31, 2024
849581a
wip: local runtime
ashutoshvarma Feb 5, 2024
8694d1a
feat: update shibuya runtmie
ashutoshvarma Feb 5, 2024
5aa0433
feat: fix local runtime
ashutoshvarma Feb 7, 2024
035feda
feat: fix holds
ashutoshvarma Feb 7, 2024
709390f
feat: update astar and shiden runtime
ashutoshvarma Feb 7, 2024
0452862
feat: fix all tests
ashutoshvarma Feb 7, 2024
96c1404
feat: build works execpt tracing
ashutoshvarma Feb 15, 2024
75a09be
feat: evm tracing build works
ashutoshvarma Feb 16, 2024
a6a3fcd
feat: bump spec versions
ashutoshvarma Feb 16, 2024
c43995d
feat: streamline genesis state export
ashutoshvarma Feb 20, 2024
673824c
fix: max hold in local runtime
ashutoshvarma Feb 20, 2024
ce9bb84
fix: aura issue in eth pending api
ashutoshvarma Feb 20, 2024
fa491da
feat: review comments
ashutoshvarma Feb 24, 2024
e74105e
Merge branch 'master' into feat/polkadot-1.0.0-fix
ashutoshvarma Feb 27, 2024
0e4b49a
feat: copy `AllowTopLevelPaidExecutionFrom` barrier into primititves
ashutoshvarma Feb 27, 2024
0062a9b
fix: build error
ashutoshvarma Feb 27, 2024
f3240f0
fix: make taplo happy
ashutoshvarma Feb 27, 2024
f40c1f8
fix: review comments
ashutoshvarma Feb 29, 2024
79104e1
fix: add contract migration back into shiden
ashutoshvarma Feb 29, 2024
3c2c7a2
feat: remove `BlockNumberFor` clauses
ashutoshvarma Feb 29, 2024
01c22a2
fix: format
ashutoshvarma Mar 1, 2024
8c44754
fix: make clippy happy
ashutoshvarma Mar 1, 2024
7439a41
feat: update `CodeHashLockupDepositPercent` value
ashutoshvarma Mar 1, 2024
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
3,536 changes: 2,277 additions & 1,259 deletions Cargo.lock

Large diffs are not rendered by default.

293 changes: 145 additions & 148 deletions Cargo.toml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions bin/collator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ fp-rpc = { workspace = true, features = ["std"] }
pallet-ethereum = { workspace = true, features = ["std"] }
pallet-evm = { workspace = true, features = ["std"] }

fc-api = { workspace = true }
fc-consensus = { workspace = true }
fc-db = { workspace = true }
fc-mapping-sync = { workspace = true }
Expand Down Expand Up @@ -105,20 +106,19 @@ substrate-frame-rpc-system = { workspace = true }
sc-cli = { workspace = true, optional = true }

# cumulus dependencies
cumulus-primitives-core = { workspace = true, features = ["std"] }

cumulus-client-cli = { workspace = true }
cumulus-client-consensus-aura = { workspace = true }
cumulus-client-consensus-common = { workspace = true }
cumulus-client-consensus-relay-chain = { workspace = true }
cumulus-client-network = { workspace = true }
cumulus-client-service = { workspace = true }
cumulus-primitives-core = { workspace = true, features = ["std"] }
cumulus-primitives-parachain-inherent = { workspace = true }
cumulus-relay-chain-inprocess-interface = { workspace = true }
cumulus-relay-chain-interface = { workspace = true }
cumulus-relay-chain-minimal-node = { workspace = true }
cumulus-relay-chain-rpc-interface = { workspace = true }
cumulus-test-relay-sproof-builder = { workspace = true, optional = true }
cumulus-test-relay-sproof-builder = { workspace = true }

# polkadot dependencies
polkadot-cli = { workspace = true, optional = true }
Expand Down Expand Up @@ -157,10 +157,10 @@ runtime-benchmarks = [
"local-runtime/runtime-benchmarks",
"shibuya-runtime/runtime-benchmarks",
"shiden-runtime/runtime-benchmarks",
"astar-runtime/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks",
"polkadot-runtime-common/std",
"sp-keyring",
"cumulus-test-relay-sproof-builder",
"polkadot-runtime-common",
"astar-primitives/runtime-benchmarks",
]
Expand Down
4 changes: 2 additions & 2 deletions bin/collator/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ pub enum Subcommand {
Benchmark(frame_benchmarking_cli::BenchmarkCmd),

/// Try some command against runtime state.
#[cfg(feature = "try-runtime")]
TryRuntime(try_runtime_cli::TryRuntimeCmd),
/// No moved to separte cli and just a placeholder command here
TryRuntime,
Dinonard marked this conversation as resolved.
Show resolved Hide resolved
}

#[derive(Debug)]
Expand Down
129 changes: 31 additions & 98 deletions bin/collator/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ use sc_service::{
use sp_core::hexdisplay::HexDisplay;
use sp_runtime::traits::AccountIdConversion;
use sp_runtime::traits::Block as BlockT;
use std::net::SocketAddr;
use std::{io::Write, net::SocketAddr};

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

trait IdentifyChain {
Expand Down Expand Up @@ -147,8 +147,10 @@ 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(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
impl Cli {
fn runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
if chain_spec.is_dev() {
&local_runtime::VERSION
} else if chain_spec.is_astar() {
Expand Down Expand Up @@ -202,10 +204,6 @@ impl SubstrateCli for RelayChainCli {
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)
}
}

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

runner.sync_run(|_config| {
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)
})
let block: Block = generate_genesis_block(&*spec, state_version)?;
let raw_header = block.header().encode();
let output_buf = if cmd.raw {
raw_header
} else {
format!("0x{:?}", HexDisplay::from(&block.header().encode())).into_bytes()
};
if let Some(output) = &cmd.output {
std::fs::write(output, output_buf)?;
} else {
std::io::stdout().write_all(&output_buf)?;
}
Ok(())
}
Some(Subcommand::ExportGenesisWasm(cmd)) => {
let runner = cli.create_runner(cmd)?;
Expand All @@ -478,7 +485,7 @@ pub fn run() -> Result<()> {
Some(Subcommand::Sign(cmd)) => cmd.run(),
Some(Subcommand::Verify(cmd)) => cmd.run(),
Some(Subcommand::Vanity(cmd)) => cmd.run(),
#[cfg(feature = "frame-benchmarking-cli")]
#[cfg(feature = "runtime-benchmarks")]
Some(Subcommand::Benchmark(cmd)) => {
use crate::benchmarking::*;
use sp_keyring::Sr25519Keyring;
Expand All @@ -490,18 +497,18 @@ pub fn run() -> Result<()> {
BenchmarkCmd::Pallet(cmd) => {
if chain_spec.is_astar() {
runner.sync_run(|config| {
cmd.run::<astar_runtime::Block, astar::Executor>(config)
cmd.run::<astar_runtime::Block, parachain::HostFunctions>(config)
})
} else if chain_spec.is_shiden() {
runner.sync_run(|config| {
cmd.run::<shiden_runtime::Block, shiden::Executor>(config)
cmd.run::<shiden_runtime::Block, parachain::HostFunctions>(config)
})
} else if chain_spec.is_shibuya() {
runner.sync_run(|config| {
cmd.run::<shibuya_runtime::Block, shibuya::Executor>(config)
cmd.run::<shibuya_runtime::Block, parachain::HostFunctions>(config)
})
} else {
runner.sync_run(|config| cmd.run::<Block, local::Executor>(config))
runner.sync_run(|config| cmd.run::<Block, local::HostFunctions>(config))
}
}
BenchmarkCmd::Block(cmd) => {
Expand Down Expand Up @@ -763,85 +770,11 @@ pub fn run() -> Result<()> {
}
}
}
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime(cmd)) => {
let runner = cli.create_runner(cmd)?;
let chain_spec = &runner.config().chain_spec;

use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
type HostFunctionsOf<E> = ExtendedHostFunctions<
sp_io::SubstrateHostFunctions,
<E as NativeExecutionDispatch>::ExtendHostFunctions,
>;

if chain_spec.is_shiden() {
runner.async_run(|config| {
let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
let info_provider =
try_runtime_cli::block_building_info::timestamp_with_aura_info(6000);
let task_manager =
sc_service::TaskManager::new(config.tokio_handle.clone(), registry)
.map_err(|e| {
sc_cli::Error::Service(sc_service::Error::Prometheus(e))
})?;
Ok((
cmd.run::<shiden_runtime::Block, HostFunctionsOf<shiden::Executor>, _>(
Some(info_provider),
),
task_manager,
))
})
} else if chain_spec.is_shibuya() {
runner.async_run(|config| {
let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
let info_provider =
try_runtime_cli::block_building_info::timestamp_with_aura_info(6000);
let task_manager =
sc_service::TaskManager::new(config.tokio_handle.clone(), registry)
.map_err(|e| {
sc_cli::Error::Service(sc_service::Error::Prometheus(e))
})?;
Ok((
cmd.run::<shibuya_runtime::Block, HostFunctionsOf<shibuya::Executor>, _>(
Some(info_provider),
),
task_manager,
))
})
} else if chain_spec.is_astar() {
runner.async_run(|config| {
let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
let info_provider =
try_runtime_cli::block_building_info::timestamp_with_aura_info(6000);
let task_manager =
sc_service::TaskManager::new(config.tokio_handle.clone(), registry)
.map_err(|e| {
sc_cli::Error::Service(sc_service::Error::Prometheus(e))
})?;
Ok((
cmd.run::<astar_runtime::Block, HostFunctionsOf<astar::Executor>, _>(Some(
info_provider,
)),
task_manager,
))
})
} else {
runner.async_run(|config| {
let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
let info_provider =
try_runtime_cli::block_building_info::timestamp_with_aura_info(6000);
let task_manager =
sc_service::TaskManager::new(config.tokio_handle.clone(), registry)
.map_err(|e| {
sc_cli::Error::Service(sc_service::Error::Prometheus(e))
})?;
Ok((
cmd.run::<Block, HostFunctionsOf<local::Executor>, _>(Some(info_provider)),
task_manager,
))
})
}
}
Some(Subcommand::TryRuntime) => Err("The `try-runtime` subcommand has been migrated to a \
standalone CLI (https://github.com/paritytech/try-runtime-cli). It is no longer \
being maintained here and will be removed entirely some time after January 2024. \
Please remove this subcommand from your runtime and use the standalone CLI."
.into()),
None => {
let runner = cli.create_runner(&cli.run.normalize())?;
let collator_options = cli.run.collator_options();
Expand Down Expand Up @@ -885,7 +818,7 @@ pub fn run() -> Result<()> {
let parachain_account =
AccountIdConversion::<polkadot_primitives::AccountId>::into_account_truncating(&para_id);

let state_version = Cli::native_runtime_version(&config.chain_spec).state_version();
let state_version = Cli::runtime_version(&config.chain_spec).state_version();
let block: Block = generate_genesis_block(&*config.chain_spec, state_version)
.map_err(|e| format!("{:?}", e))?;
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
Expand Down
20 changes: 13 additions & 7 deletions bin/collator/src/local/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

use local_runtime::{
wasm_binary_unwrap, AccountId, AuraConfig, AuraId, BalancesConfig, BlockRewardConfig,
CouncilConfig, DappStakingConfig, DemocracyConfig, EVMConfig, GenesisConfig, GrandpaConfig,
GrandpaId, InflationConfig, InflationParameters, Precompiles, RewardDistributionConfig,
Signature, SudoConfig, SystemConfig, TechnicalCommitteeConfig, TierThreshold, TreasuryConfig,
VestingConfig, AST,
CouncilConfig, DappStakingConfig, DemocracyConfig, EVMConfig, GrandpaConfig, GrandpaId,
InflationConfig, InflationParameters, Precompiles, RewardDistributionConfig,
RuntimeGenesisConfig, Signature, SudoConfig, SystemConfig, TechnicalCommitteeConfig,
TierThreshold, TreasuryConfig, VestingConfig, AST,
};
use sc_service::ChainType;
use sp_core::{crypto::Ss58Codec, sr25519, Pair, Public};
Expand All @@ -35,7 +35,7 @@ use sp_runtime::{
type AccountPublic = <Signature as Verify>::Signer;

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

/// Helper function to generate a crypto pair from seed
fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
Expand Down Expand Up @@ -99,15 +99,16 @@ fn testnet_genesis(
initial_authorities: Vec<(AuraId, GrandpaId)>,
root_key: AccountId,
endowed_accounts: Vec<AccountId>,
) -> GenesisConfig {
) -> RuntimeGenesisConfig {
// This is supposed the be the simplest bytecode to revert without returning any data.
// We will pre-deploy it under all of our precompiles to ensure they can be called from
// within contracts.
// (PUSH1 0x00 PUSH1 0x00 REVERT)
let revert_bytecode = vec![0x60, 0x00, 0x60, 0x00, 0xFD];
GenesisConfig {
RuntimeGenesisConfig {
system: SystemConfig {
code: wasm_binary_unwrap().to_vec(),
..Default::default()
},
balances: BalancesConfig {
balances: endowed_accounts
Expand All @@ -126,6 +127,7 @@ fn testnet_genesis(
adjustable_percent: Perbill::from_percent(25),
ideal_dapps_staking_tvl: Perbill::from_percent(40),
},
..Default::default()
},
vesting: VestingConfig { vesting: vec![] },
aura: AuraConfig {
Expand All @@ -136,6 +138,7 @@ fn testnet_genesis(
.iter()
.map(|x| (x.1.clone(), 1))
.collect(),
..Default::default()
},
evm: EVMConfig {
// We need _some_ code inserted at the precompile address so that
Expand All @@ -153,6 +156,7 @@ fn testnet_genesis(
)
})
.collect(),
..Default::default()
},
ethereum: Default::default(),
sudo: SudoConfig {
Expand Down Expand Up @@ -207,9 +211,11 @@ fn testnet_genesis(
TierThreshold::FixedTvlAmount { amount: 10 * AST },
],
slots_per_tier: vec![10, 20, 30, 40],
..Default::default()
},
inflation: InflationConfig {
params: InflationParameters::default(),
..Default::default()
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion bin/collator/src/local/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ mod service;
mod chain_spec;

pub use chain_spec::*;
pub use service::{new_partial, start_node, Executor, RuntimeApi};
pub use service::{new_partial, start_node, Executor, HostFunctions, RuntimeApi};
Loading
Loading