Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
6,158 changes: 3,069 additions & 3,089 deletions Cargo.lock

Large diffs are not rendered by default.

252 changes: 236 additions & 16 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion RUSTC_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2023-05-22
nightly-2024-04-15
49 changes: 24 additions & 25 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = 'integration-tests'
version = '0.3.0'
authors = ['DappForce <[email protected]>']
edition = '2021'
edition.workspace = true
license = 'GPL-3.0-only'
homepage = 'https://subsocial.network'
repository = 'https://github.com/dappforce/subsocial-parachain'
Expand All @@ -13,8 +13,7 @@ categories = ['cryptography::cryptocurrencies']
[features]
default = ['std']
std = [
'codec/std',
'scale-info/std',
'parity-scale-codec/std',
'sp-io/std',
'sp-runtime/std',
'sp-std/std',
Expand All @@ -35,29 +34,29 @@ std = [
]

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.2.0", default-features = false, features = ["derive"] }
serde = { features = ['derive'], optional = true, version = '1.0.152' }
parity-scale-codec = { workspace = true, features = ["derive"] }
scale-info = { workspace = true, features = ["derive"] }
serde = { workspace = true, optional = true, features = ['derive'] }

frame-support = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v1.0.0', default-features = false }
frame-system = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v1.0.0', default-features = false }
pallet-balances = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v1.0.0', default-features = false }
pallet-timestamp = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v1.0.0', default-features = false }
sp-io = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v1.0.0', default-features = false }
sp-runtime = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v1.0.0', default-features = false }
sp-std = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v1.0.0', default-features = false }
frame-support = { workspace = true }
frame-system = { workspace = true }
pallet-balances = { workspace = true }
pallet-timestamp = { workspace = true }
sp-io = { workspace = true }
sp-runtime = { workspace = true }
sp-std = { workspace = true }

[dev-dependencies]
pallet-domains = { path = '../pallets/domains', default-features = false }
pallet-permissions = { path = '../pallets/permissions', default-features = false }
pallet-posts = { path = '../pallets/posts', default-features = false }
pallet-profiles = { path = '../pallets/profiles', default-features = false }
pallet-reactions = { path = '../pallets/reactions', default-features = false }
pallet-roles = { path = '../pallets/roles', default-features = false }
pallet-space-follows = { path = '../pallets/space-follows', default-features = false }
pallet-ownership = { path = '../pallets/ownership', default-features = false }
pallet-spaces = { path = '../pallets/spaces', default-features = false }
subsocial-support = { path = '../pallets/support', default-features = false }
pallet-domains = { workspace = true }
pallet-permissions = { workspace = true }
pallet-posts = { workspace = true }
pallet-profiles = { workspace = true }
pallet-reactions = { workspace = true }
pallet-roles = { workspace = true }
pallet-space-follows = { workspace = true }
pallet-ownership = { workspace = true }
pallet-spaces = { workspace = true }
subsocial-support = { workspace = true }

sp-core = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v1.0.0', default-features = false }
pallet-balances = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v1.0.0', default-features = false }
sp-core = { workspace = true }
pallet-balances = { workspace = true }
22 changes: 10 additions & 12 deletions integration-tests/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ use sp_io::TestExternalities;

use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup},
testing::Header,
Storage,
Storage, BuildStorage,
};

use frame_support::{
Expand All @@ -30,14 +29,10 @@ pub use subsocial_support::{ModerationError, ContentError};
use subsocial_support::User;
use crate::utils::*;

type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<TestRuntime>;
type Block = frame_system::mocking::MockBlock<TestRuntime>;

frame_support::construct_runtime!(
pub enum TestRuntime where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
pub enum TestRuntime
{
System: system,
Balances: pallet_balances,
Expand All @@ -64,13 +59,12 @@ impl system::Config for TestRuntime {
type BlockLength = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = BlockNumber;
type Nonce = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type DbWeight = ();
Expand Down Expand Up @@ -110,6 +104,10 @@ impl pallet_balances::Config for TestRuntime {
type MaxLocks = ();
type MaxReserves = ();
type ReserveIdentifier = ();
type RuntimeHoldReason = ();
type FreezeIdentifier = ();
type MaxHolds = ();
type MaxFreezes = ();
}

use pallet_permissions::default_permissions::DefaultSpacePermissions;
Expand Down Expand Up @@ -237,8 +235,8 @@ impl ExtBuilder {

/// Default ext configuration with BlockNumber 1
pub fn build() -> TestExternalities {
let mut storage = system::GenesisConfig::default()
.build_storage::<TestRuntime>()
let mut storage = system::GenesisConfig::<TestRuntime>::default()
.build_storage()
.unwrap();

Self::configure_storages(&mut storage);
Expand Down
123 changes: 67 additions & 56 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,87 +3,98 @@ name = "subsocial-collator"
version = "0.3.0"
build = "build.rs"
authors = ["DappForce <[email protected]>"]
edition = "2021"
edition.workspace = true
license = "GPL-3.0-only"
homepage = "https://subsocial.network"
repository = "https://github.com/dappforce/subsocial-parachain"
description = "Parachain implementation of Subsocial node"
keywords = ["blockchain", "cryptocurrency", "social-network", "news-feed", "marketplace"]
categories = ["cryptography::cryptocurrencies"]

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
clap = { version = "4.3.12", features = ["derive"] }
log = "0.4.19"
serde = { version = "1.0.171", features = ["derive"] }
hex-literal = "0.4.1"
jsonrpsee = { version = "0.16.2", features = ["server"] }
futures = "0.3.28"
clap = { workspace = true, features = ["derive"] }
log = { workspace = true }
serde = { workspace = true, features = ["derive"] }
hex-literal = { workspace = true }
jsonrpsee = { workspace = true, features = ["server"] }
futures = { workspace = true }
color-print = { workspace = true }

# Local
subsocial-parachain-runtime = { path = "../runtime" }
pallet-creator-staking-rpc = { path = "../pallets/creator-staking/rpc" }
pallet-domains-rpc = { path = "../pallets/domains/rpc" }
pallet-posts-rpc = { path = "../pallets/posts/rpc" }
subsocial-parachain-runtime = { workspace = true }
pallet-creator-staking-rpc = { workspace = true }
pallet-domains-rpc = { workspace = true }
pallet-posts-rpc = { workspace = true }

# Try-Runtime
try-runtime-cli = { workspace = true, optional = true }

# Benchmark
frame-benchmarking = { workspace = true, features = ["default"] } # TODO: requires optional?
frame-benchmarking-cli = { workspace = true }

# Substrate
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-network-sync = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
substrate-prometheus-endpoint = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate", optional = true, branch = "polkadot-v1.0.0" }
pallet-transaction-payment-rpc = { workspace = true }
sc-basic-authorship = { workspace = true }
sc-chain-spec = { workspace = true }
sc-cli = { workspace = true }
sc-client-api = { workspace = true }
sc-offchain = { workspace = true }
sc-consensus = { workspace = true }
sc-executor = { workspace = true }
sc-network = { workspace = true }
sc-network-sync = { workspace = true }
sc-rpc = { workspace = true }
sc-service = { workspace = true }
sc-sysinfo = { workspace = true }
sc-telemetry = { workspace = true }
sc-tracing = { workspace = true }
sc-transaction-pool = { workspace = true }
sc-transaction-pool-api = { workspace = true }
sp-api = { workspace = true, features = ["default"] }
sp-block-builder = { workspace = true, features = ["default"] }
sp-blockchain = { workspace = true }
sp-consensus-aura = { workspace = true, features = ["default"] }
sp-core = { workspace = true, features = ["default"] }
sp-keystore = { workspace = true }
sp-io = { workspace = true, features = ["default"] }
sp-runtime = { workspace = true, features = ["default"] }
sp-timestamp = { workspace = true }
substrate-frame-rpc-system = { workspace = true }
substrate-prometheus-endpoint = { workspace = true }

# Polkadot
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "release-v1.0.0", features = ["polkadot-native"] }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "release-v1.0.0" }
xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v1.0.0" }
polkadot-cli = { workspace = true } # TODO: requires optional?
polkadot-primitives = { workspace = true, features = ["default"] }
xcm = { workspace = true }

# Cumulus
cumulus-client-cli = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" }
cumulus-client-consensus-aura = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" }
cumulus-client-consensus-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" }
cumulus-client-service = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" }
cumulus-primitives-core = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" }
cumulus-primitives-parachain-inherent = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" }
cumulus-relay-chain-interface = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v1.0.0" }
color-print = "0.3.4"
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 = ["default"] }
cumulus-primitives-parachain-inherent = { workspace = true }
cumulus-relay-chain-interface = { workspace = true }

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v1.0.0" }
substrate-build-script-utils = { workspace = true }

[features]
default = []
runtime-benchmarks = [
"try-runtime-cli/try-runtime",
"subsocial-parachain-runtime/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-benchmarking-cli/runtime-benchmarks",
"polkadot-cli/runtime-benchmarks",
]
try-runtime = [
"try-runtime-cli/try-runtime",
"subsocial-parachain-runtime/try-runtime",
"polkadot-cli/try-runtime",
"try-runtime-cli/try-runtime",
]
9 changes: 3 additions & 6 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,9 @@ pub enum Subcommand {
#[command(subcommand)]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),

/// Try some testing command against a specified runtime state.
#[cfg(feature = "try-runtime")]
TryRuntime(try_runtime_cli::TryRuntimeCmd),

/// Errors since the binary was not build with `--features try-runtime`.
#[cfg(not(feature = "try-runtime"))]
/// Try-runtime has migrated to a standalone
/// [CLI](<https://github.com/paritytech/try-runtime-cli>). The subcommand exists as a stub and
/// deprecation notice.
TryRuntime,
}

Expand Down
38 changes: 2 additions & 36 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::net::SocketAddr;

use cumulus_primitives_core::ParaId;
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
use log::{info, warn};
use log::info;
use subsocial_parachain_runtime::Block;
use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,
Expand Down Expand Up @@ -214,31 +214,7 @@ pub fn run() -> Result<()> {
_ => Err("Benchmarking sub-command unsupported".into()),
}
},
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime(cmd)) => {
use subsocial_parachain_runtime::MILLISECS_PER_BLOCK;
use try_runtime_cli::block_building_info::timestamp_with_aura_info;
let runner = cli.create_runner(cmd)?;

type HostFunctions =
(sp_io::SubstrateHostFunctions, frame_benchmarking::benchmarking::HostFunctions);

// grab the task manager.
let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry);
let task_manager =
sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
.map_err(|e| format!("Error: {:?}", e))?;

let info_provider = timestamp_with_aura_info(MILLISECS_PER_BLOCK);

runner.async_run(|_| {
Ok((cmd.run::<Block, HostFunctions, _>(Some(info_provider)), task_manager))
})
},
#[cfg(not(feature = "try-runtime"))]
Some(Subcommand::TryRuntime) => Err("Try-runtime was not enabled when building the node. \
You can enable it with `--features try-runtime`."
.into()),
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 @@ -275,16 +251,6 @@ pub fn run() -> Result<()> {
info!("Parachain Account: {parachain_account}");
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });

if !collator_options.relay_chain_rpc_urls.is_empty() &&
!cli.relay_chain_args.is_empty()
{
warn!(
"Detected relay chain node arguments together with --relay-chain-rpc-url. \
This command starts a minimal Polkadot node that only uses a \
network-related subset of all relay chain CLI options."
);
}

crate::service::start_parachain_node(
config,
polkadot_config,
Expand Down
Loading
Loading