Skip to content

Commit

Permalink
Update to 0.9.42 (#382)
Browse files Browse the repository at this point in the history
* first changes

* wip updating modified pallet configs

* wip updating modified pallet configs 2

* updgrade to v0.9.42 completed

* avoid using VeMinting pallet in farming

* re-run benchmarks pallet-xcm

* modify default deposit limit for amplitude

* fix for try-runtime features

* reorg imports

* fixes after merge with try-runtime fix

* wip add custom update code, workaround for TakeFirstAsset trader

* wip patching scheduler and xcm

* patching 2

* add storage versions

* fix for storage version definition

* Use proper return values for vesting migration

* remove vesting migration since it is not needed

* add transaction payment and vesting custom migrations to set version

* rollback on version change, fix some spacewalk revision

* fix incorrect spacewalk revision, add variable writes for custom upgrade function

* add foucoco storage version updates

* use right number of reads for amplitude custom on runtime upgrade

* WIP

* Fmt

* Add comment

* Still wip

* Fmt

* Add doc comments

* Fix warning

* Address change requests

* Fmt

* Add comment

* Add fee for basic asset

* Fmt

* Return NoPrice error when price fetching fails

* Add signed extension

* Add first iteration of mock

* Allow only XCM assets for buyout

* Update mock to only allow specific XCM assets

* Add tests and  benchmarks - still wip

* Fmt

* Handle currency id in benchmarks

* Update comments

* Remove benchmark comment

* Fix benchmarks and tests, add pallet to Foucoco, switch from UnixTime to blocks, generate weights

* Fmt

* Refactor dot currency id in tests

* Small refactor for test attempt_buyout_after_buyout_limit_exceeded_fails

* Update comments

* Small refactor

* Add comment in Foucoco runtime

* Add comment in Foucoco runtime

* Update comment

* Update comment

* Add signed extension to runtime

* Add comment

* Fix indentation in tests

* Fix indentation in tests

* Fix indentation in tests

* Fix indentation in tests

* Update comment

Co-authored-by: Marcel Ebert <[email protected]>

* Fix building project with runtime benchmarks flag

* Address change requests

* Small refactor for asset registry benchmarks

* Fix compiler warning

* Address change requests

* Update comment

Co-authored-by: Marcel Ebert <[email protected]>

* Optimise fetching oracle price for benchmarks and regenerate weights

* Fmt

* using fee per second value for relative fee adjusting

* WIP

* fixing xcm integration tests

* fix pendulum integration tests, reuse v3 location

* cleanup imports, reuse type for fee distribution

* cleanup and format

* more cleanup

* more import cleaning and fixes after merging with future CustomMetadata implementation branch

* moving implementation

* modify expected fees in tests

* added current xcm config to foucoco

* removing unused constants

* fully remove alice test account

* use multipliers for fee expected constants in tests

* Update runtime/pendulum/src/lib.rs

Co-authored-by: Marcel Ebert <[email protected]>

* removal of comments, package-lock.json

* replace spacewalk dependencies

* fix to compile with try runtime

* Revert "merged with fee per second"

This reverts commit ed05812, reversing
changes made to 04583a8.

* remove todos with mock implementations to be safe

---------

Co-authored-by: Marcel Ebert <[email protected]>
Co-authored-by: bogdanS98 <[email protected]>
  • Loading branch information
3 people authored Mar 20, 2024
1 parent b13f463 commit 27950be
Show file tree
Hide file tree
Showing 35 changed files with 2,168 additions and 1,289 deletions.
1,572 changes: 971 additions & 601 deletions Cargo.lock

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,21 @@ members = [
# need this because of bifrost farming dependency in runtime
# bifrost farming uses different orml-traits for orml-currencies
[patch."https://github.com/open-web3-stack/open-runtime-module-library"]
orml-traits = { git = "https://github.com/open-web3-stack//open-runtime-module-library", branch = "polkadot-v0.9.40" }
orml-traits = { git = "https://github.com/open-web3-stack//open-runtime-module-library", branch = "polkadot-v0.9.42" }

# need this because of bifrost farming dependency in runtime
# bifrost uses :
# orml packages { version = "0.4.1-dev" }
# zenlink packages { version = "*" }
[patch.crates-io]
orml-traits = { git = "https://github.com/open-web3-stack//open-runtime-module-library", branch = "polkadot-v0.9.40" }
orml-currencies = { git = "https://github.com/open-web3-stack//open-runtime-module-library", branch = "polkadot-v0.9.40" }
orml-tokens = { git = "https://github.com/open-web3-stack//open-runtime-module-library", branch = "polkadot-v0.9.40" }
zenlink-protocol = { git = "https://github.com/pendulum-chain/Zenlink-DEX-Module", branch = "polkadot-v0.9.40-protocol" }
zenlink-protocol-runtime-api = { git = "https://github.com/pendulum-chain/Zenlink-DEX-Module", branch = "polkadot-v0.9.40-protocol" }
orml-traits = { git = "https://github.com/open-web3-stack//open-runtime-module-library", branch = "polkadot-v0.9.42" }
orml-currencies = { git = "https://github.com/open-web3-stack//open-runtime-module-library", branch = "polkadot-v0.9.42" }
orml-tokens = { git = "https://github.com/open-web3-stack//open-runtime-module-library", branch = "polkadot-v0.9.42" }
zenlink-protocol = { git = "https://github.com/zenlinkpro/Zenlink-DEX-Module", branch = "polkadot-v0.9.42" }
zenlink-protocol-runtime-api = { git = "https://github.com/zenlinkpro/Zenlink-DEX-Module", branch = "polkadot-v0.9.42" }


[patch.'https://github.com/paritytech/substrate']
pallet-vesting = { git = "https://github.com/pendulum-chain/patch-pallet-vesting-transaction-storage", branch = "polkadot-v0.9.42" }
pallet-transaction-payment = { git = "https://github.com/pendulum-chain/patch-pallet-vesting-transaction-storage", branch = "polkadot-v0.9.42" }

125 changes: 63 additions & 62 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ codec = { package = "parity-scale-codec", version = "3.0.0" }
serde = { version = "1.0.145", features = ["derive"] }
jsonrpsee = { version = "0.16.2", features = ["server"] }

module-issue-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "bda384bcc6db3da88198c714851a261dcdea1063" }
module-oracle-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "bda384bcc6db3da88198c714851a261dcdea1063" }
module-redeem-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "bda384bcc6db3da88198c714851a261dcdea1063" }
module-replace-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "bda384bcc6db3da88198c714851a261dcdea1063" }
module-vault-registry-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "bda384bcc6db3da88198c714851a261dcdea1063" }
module-issue-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "3c03e759a6f600ea72d636d4f9cc4b05d633201c"}
module-oracle-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "3c03e759a6f600ea72d636d4f9cc4b05d633201c"}
module-redeem-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "3c03e759a6f600ea72d636d4f9cc4b05d633201c"}
module-replace-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "3c03e759a6f600ea72d636d4f9cc4b05d633201c"}
module-vault-registry-rpc = { git = "https://github.com/pendulum-chain/spacewalk", rev = "3c03e759a6f600ea72d636d4f9cc4b05d633201c"}
module-pallet-staking-rpc = { path = "../pallets/parachain-staking/rpc" }
spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", rev = "bda384bcc6db3da88198c714851a261dcdea1063" }
spacewalk-primitives = { git = "https://github.com/pendulum-chain/spacewalk", rev = "3c03e759a6f600ea72d636d4f9cc4b05d633201c"}

# Local
amplitude-runtime = { path = "../runtime/amplitude" }
Expand All @@ -30,71 +30,72 @@ pendulum-runtime = { path = "../runtime/pendulum" }
runtime-common = { path = "../runtime/common" }

# Substrate
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
pallet-multisig = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.40" }
pallet-treasury = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.40" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-network-sync = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
pallet-multisig = {git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42"}
pallet-treasury = {git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.42"}
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sc-network-sync = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42" }

# Polkadot
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40" }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.40" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.40" }
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.42" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.42" }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.42" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.42" }

# Cumulus
cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-relay-chain-rpc-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-relay-chain-minimal-node = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.40" }
cumulus-client-cli = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.42" }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.42" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.42" }
cumulus-client-network = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.42" }
cumulus-client-service = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.42" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.42" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.42" }
cumulus-relay-chain-inprocess-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.42" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.42" }
cumulus-relay-chain-rpc-interface = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.42" }
cumulus-relay-chain-minimal-node = { git = "https://github.com/paritytech/cumulus.git", branch = "polkadot-v0.9.42" }

#bifrost
bifrost-farming-rpc-api = { git = "https://github.com/pendulum-chain/bifrost", branch = "polkadot-v0.9.40-farming-add-currencyid-generic" }
bifrost-farming-rpc-runtime-api = { git = "https://github.com/pendulum-chain/bifrost", branch = "polkadot-v0.9.40-farming-add-currencyid-generic" }
bifrost-farming-rpc-api = { git = "https://github.com/pendulum-chain/bifrost", branch = "upgrade-v0.9.42" }
bifrost-farming-rpc-runtime-api = { git = "https://github.com/pendulum-chain/bifrost", branch = "upgrade-v0.9.42" }

zenlink-protocol = { git = "https://github.com/pendulum-chain/Zenlink-DEX-Module", branch = "polkadot-v0.9.40-protocol" }
zenlink-protocol-rpc = { git = "https://github.com/pendulum-chain/Zenlink-DEX-Module", branch = "polkadot-v0.9.40-protocol" }
zenlink-protocol-runtime-api = { git = "https://github.com/pendulum-chain/Zenlink-DEX-Module", branch = "polkadot-v0.9.40-protocol" }
zenlink-protocol = { git = "https://github.com/zenlinkpro/Zenlink-DEX-Module", branch = "polkadot-v0.9.42" }
zenlink-protocol-rpc = { git = "https://github.com/zenlinkpro/Zenlink-DEX-Module", branch = "polkadot-v0.9.42" }
zenlink-protocol-runtime-api = { git = "https://github.com/zenlinkpro/Zenlink-DEX-Module", branch = "polkadot-v0.9.42" }

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

[features]
default = []
Expand Down
32 changes: 27 additions & 5 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ use sc_service::config::{BasePath, PrometheusConfig};
use sp_core::hexdisplay::HexDisplay;
use sp_runtime::traits::{AccountIdConversion, Block as BlockT};

#[cfg(feature = "try-runtime")]
use try_runtime_cli::block_building_info::substrate_info;

#[cfg(feature = "try-runtime")]
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};

use crate::{
chain_spec::{self, ParachainExtensions},
cli::{Cli, RelayChainCli, Subcommand},
Expand All @@ -23,6 +29,11 @@ use crate::{
},
};

#[cfg(feature = "try-runtime")]
/// The time internavel for block production on our chain in milliseconds (12
/// seconds to millis)
const BLOCK_TIME_MILLIS: u64 = 12 * 1_000;

#[derive(PartialEq, Eq)]
enum ChainIdentity {
Amplitude,
Expand Down Expand Up @@ -240,6 +251,8 @@ macro_rules! construct_async_run {
}}
}



/// Parse command line arguments into service configuration.
pub fn run() -> Result<()> {
let cli = Cli::from_args();
Expand Down Expand Up @@ -361,18 +374,27 @@ pub fn run() -> Result<()> {
// grab the task manager.
let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry);
let task_manager =
TaskManager::new(runner.config().tokio_handle.clone(), *registry)
sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
.map_err(|e| format!("Error: {:?}", e))?;

match runner.config().chain_spec.identify() {
ChainIdentity::Amplitude => runner.async_run(|config| {
Ok((cmd.run::<Block, AmplitudeRuntimeExecutor>(config), task_manager))
Ok((cmd.run::<Block, ExtendedHostFunctions<
sp_io::SubstrateHostFunctions,
<AmplitudeRuntimeExecutor as NativeExecutionDispatch>::ExtendHostFunctions,
>, _>(Some(substrate_info(BLOCK_TIME_MILLIS))), task_manager))
}),
ChainIdentity::Foucoco => runner.async_run(|config| {
Ok((cmd.run::<Block, FoucocoRuntimeExecutor>(config), task_manager))
Ok((cmd.run::<Block, ExtendedHostFunctions<
sp_io::SubstrateHostFunctions,
<FoucocoRuntimeExecutor as NativeExecutionDispatch>::ExtendHostFunctions,
>, _>(Some(substrate_info(BLOCK_TIME_MILLIS))), task_manager))
}),
ChainIdentity::Pendulum => runner.async_run(|config| {
Ok((cmd.run::<Block, PendulumRuntimeExecutor>(config), task_manager))
Ok((cmd.run::<Block, ExtendedHostFunctions<
sp_io::SubstrateHostFunctions,
<PendulumRuntimeExecutor as NativeExecutionDispatch>::ExtendHostFunctions,
>, _>(Some(substrate_info(BLOCK_TIME_MILLIS))), task_manager))
}),
}
} else {
Expand Down Expand Up @@ -405,7 +427,7 @@ pub fn run() -> Result<()> {
let id = ParaId::from(para_id);

let parachain_account =
AccountIdConversion::<polkadot_primitives::v2::AccountId>::into_account_truncating(&id);
AccountIdConversion::<polkadot_primitives::v4::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)
Expand Down
Loading

0 comments on commit 27950be

Please sign in to comment.