Skip to content

Commit

Permalink
Merge pull request #100 from InvArch/gabriel-xcm_tokens
Browse files Browse the repository at this point in the history
Added XCM configuration and pallets for token transfers
  • Loading branch information
arrudagates authored Oct 4, 2022
2 parents edb3f11 + d050e65 commit a150f9e
Show file tree
Hide file tree
Showing 32 changed files with 1,725 additions and 1,089 deletions.
1,288 changes: 686 additions & 602 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
members = [
'node',
'runtime/tinkernet',
'runtime/brainstorm',
# 'runtime/brainstorm',
]
[profile.release]
panic = 'unwind'
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ start-parachain-full-node:
.PHONY: setup-testing purge-testing download-relay generate-relay-raw-chainspec build generate-both copy-collator-to-testing

generate-genesis-wasm:
./target/release/invarch-collator export-genesis-wasm > testing/genesis-wasm
./target/release/invarch-collator export-genesis-wasm --chain local > testing/genesis-wasm

generate-genesis-state:
./target/release/invarch-collator export-genesis-state > testing/genesis-state
./target/release/invarch-collator export-genesis-state --chain local > testing/genesis-state

generate-both: generate-genesis-state generate-genesis-wasm

Expand Down Expand Up @@ -104,6 +104,7 @@ purge-testing:

run-parachain-collator:
./testing/invarch-collator \
--chain local \
--collator \
--alice \
--force-authoring \
Expand All @@ -123,9 +124,9 @@ setup-testing: | purge-testing download-relay generate-relay-raw-chainspec build
$(info Terminal 3: make run-parachain-collator)

run-solo-alice:
./target/release/invarch-collator --chain solo-dev --alice --tmp
./target/release/invarch-collator --chain solo-dev --alice --tmp --rpc-cors=all

run-solo-bob:
./target/release/invarch-collator --chain solo-dev --bob --tmp --port 30334
./target/release/invarch-collator --chain solo-dev --bob --tmp --port 30334 --rpc-cors=all

run-solo: ; printf "run-solo-alice\nrun-solo-bob" | parallel -u make
128 changes: 64 additions & 64 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,100 +27,100 @@ hex-literal = "0.3.4"
async-trait = { version = "0.1.48" }

## RPC related Dependencies
jsonrpsee = { version = "0.14.0", features = ["server"] }
jsonrpc-core = "18.0.0"
jsonrpsee = { version = "0.15.1", features = ["server"] }
futures = "0.3.24"

## Local Dependencies
tinkernet-runtime = { path = "../runtime/tinkernet", optional = true }
brainstorm-runtime = { path = "../runtime/brainstorm", optional = true }
#brainstorm-runtime = { path = "../runtime/brainstorm", optional = true }


## Substrate Dependencies
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }

## Substrate Client Dependencies
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26", features = ["wasmtime"] }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sc-consensus-manual-seal = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26", features = ["wasmtime"] }
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26", features = ["wasmtime"] }
sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29", features = ["wasmtime"] }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sc-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sc-consensus-manual-seal = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29", features = ["wasmtime"] }
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29", features = ["wasmtime"] }
sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }

## Substrate Primitive
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }

substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26", optional = true }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }

substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29", optional = true }

## Polkadot dependencies Dependencies
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.26" }
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.26" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.26" }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.26" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.26" }
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" }
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" }
polkadot-service = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.29" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.29" }

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

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

## InvArch Dependencies
pallet-contracts-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.26"}
pallet-contracts-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.29"}


[features]
default = ["tinkernet"]

tinkernet = ["tinkernet-runtime"]
brainstorm = ["brainstorm-runtime"]
#brainstorm = ["brainstorm-runtime"]

runtime-benchmarks = [
"tinkernet-runtime?/runtime-benchmarks",
"brainstorm-runtime?/runtime-benchmarks",
# "brainstorm-runtime?/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks"
]
#contracts-unstable-interface = ["invarch-runtime/contracts-unstable-interface"]

try-runtime = [
"tinkernet-runtime?/try-runtime",
"brainstorm-runtime?/try-runtime",
# "brainstorm-runtime?/try-runtime",
"try-runtime-cli",
]
16 changes: 10 additions & 6 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ use tinkernet_runtime::{
EXISTENTIAL_DEPOSIT, WASM_BINARY,
};

#[cfg(feature = "brainstorm")]
use brainstorm_runtime::{
AccountId, AuraId, BalancesConfig, CollatorSelectionConfig, GenesisConfig, ParachainInfoConfig,
PolkadotXcmConfig, SessionConfig, SessionKeys, Signature, SudoConfig, SystemConfig,
EXISTENTIAL_DEPOSIT, WASM_BINARY,
};
//#[cfg(feature = "brainstorm")]
//use brainstorm_runtime::{
// AccountId, AuraId, BalancesConfig, CollatorSelectionConfig, GenesisConfig, ParachainInfoConfig,
// PolkadotXcmConfig, SessionConfig, SessionKeys, Signature, SudoConfig, SystemConfig,
// EXISTENTIAL_DEPOSIT, WASM_BINARY,
//};

use cumulus_primitives_core::ParaId;
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
Expand Down Expand Up @@ -339,5 +339,9 @@ fn testnet_genesis(
treasury: Default::default(),
vesting: Default::default(),
maintenance_mode: Default::default(),
#[cfg(feature = "tinkernet")]
asset_registry: Default::default(),
#[cfg(feature = "tinkernet")]
tokens: Default::default(),
}
}
21 changes: 10 additions & 11 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#[cfg(feature = "tinkernet")]
use tinkernet_runtime::{Block, RuntimeApi, VERSION};

#[cfg(feature = "brainstorm")]
use brainstorm_runtime::{Block, RuntimeApi, VERSION};
//#[cfg(feature = "brainstorm")]
//use brainstorm_runtime::{Block, RuntimeApi, VERSION};

use crate::{
chain_spec,
Expand Down Expand Up @@ -287,10 +287,13 @@ pub fn run() -> Result<()> {

cmd.run(config, partials.client.clone(), db, storage)
}),
BenchmarkCmd::Overhead(_) => Err("Unsupported benchmarking command".into()),
BenchmarkCmd::Machine(cmd) => {
runner.sync_run(|config| cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone()))
}
// NOTE: this allows the Client to leniently implement
// new benchmark commands without requiring a companion MR.
#[allow(unreachable_patterns)]
_ => Err("Benchmarking sub-command unsupported".into()),
}
}
#[cfg(feature = "try-runtime")]
Expand Down Expand Up @@ -338,7 +341,7 @@ pub fn run() -> Result<()> {

let para_id = chain_spec::Extensions::try_get(&*config.chain_spec)
.map(|e| e.para_id)
.ok_or_else(|| "Could not find parachain ID in chain-spec.")?;
.ok_or("Could not find parachain ID in chain-spec.")?;

if is_solo_dev {
return crate::service::start_solo_dev::<RuntimeApi, TemplateRuntimeExecutor>(
Expand Down Expand Up @@ -435,7 +438,7 @@ impl CliConfiguration<Self> for RelayChainCli {
fn base_path(&self) -> Result<Option<BasePath>> {
Ok(self
.shared_params()
.base_path()
.base_path()?
.or_else(|| self.base_path.clone().map(Into::into)))
}

Expand Down Expand Up @@ -488,12 +491,8 @@ impl CliConfiguration<Self> for RelayChainCli {
self.base.base.role(is_dev)
}

fn transaction_pool(&self) -> Result<sc_service::config::TransactionPoolOptions> {
self.base.base.transaction_pool()
}

fn state_cache_child_ratio(&self) -> Result<Option<usize>> {
self.base.base.state_cache_child_ratio()
fn transaction_pool(&self, is_dev: bool) -> Result<sc_service::config::TransactionPoolOptions> {
self.base.base.transaction_pool(is_dev)
}

fn rpc_methods(&self) -> Result<sc_service::config::RpcMethods> {
Expand Down
10 changes: 5 additions & 5 deletions node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#[cfg(feature = "tinkernet")]
use tinkernet_runtime::{opaque::Block, AccountId, Balance, Hash, Index as Nonce};

#[cfg(feature = "brainstorm")]
use brainstorm_runtime::{opaque::Block, AccountId, Balance, Hash, Index as Nonce};
//#[cfg(feature = "brainstorm")]
//use brainstorm_runtime::{opaque::Block, AccountId, Balance, Hash, Index as Nonce};

use sc_client_api::AuxStore;
pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor};
Expand All @@ -33,7 +33,7 @@ pub struct FullDeps<C, P> {
/// Whether to deny unsafe calls
pub deny_unsafe: DenyUnsafe,
/// Command sink used for solo-dev mode
pub command_sink: Option<jsonrpc_core::futures::channel::mpsc::Sender<EngineCommand<Hash>>>,
pub command_sink: Option<futures::channel::mpsc::Sender<EngineCommand<Hash>>>,
}

/// Instantiate all RPC extensions.
Expand Down Expand Up @@ -64,7 +64,7 @@ where
command_sink: _,
} = deps;

module.merge(System::new(client.clone(), pool.clone(), deny_unsafe).into_rpc())?;
module.merge(TransactionPayment::new(client.clone()).into_rpc())?;
module.merge(System::new(client.clone(), pool, deny_unsafe).into_rpc())?;
module.merge(TransactionPayment::new(client).into_rpc())?;
Ok(module)
}
Loading

0 comments on commit a150f9e

Please sign in to comment.