Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
code cleanup (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalaninja committed May 9, 2023
1 parent aed3058 commit 173f2d4
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 50 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,14 @@ cargo b -r --no-default-features --features with-stout-runtime --target-dir targ
```

Alternatively, run
`bash build_runtimes.sh` .
`bash ./scripts/build_runtimes.sh` .


### XCM Playground via Zombienet

Create a `bin` directory into the root of this repository and place the following binaries inside of it:
- `polkadot` (which you can download from [the releases](https://github.com/paritytech/polkadot/releases))
- `polkadot-parachain` (which you will build from [cumulus](https://github.com/paritytech/cumulus))
- `trappist-collator` (which you will build from this repository)
- `stout-collator` (which you will build from this repository)

Download the [latest release of zombienet](https://github.com/paritytech/zombienet/releases/) into the root of this repository and make it executable:
```
Expand Down
3 changes: 2 additions & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ license = "Unlicense"
homepage = "https://trappist.io"
repository = "https://github.com/TrappistNetwork/trappist"
edition = "2021"
default-run = "trappist-collator"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
Expand Down Expand Up @@ -41,7 +42,7 @@ tempfile = "3.2.0"
[features]
default = ["with-trappist-runtime"]
runtime-benchmarks = [
"trappist-cli/runtime-benchmarks"
"trappist-cli/runtime-benchmarks"
]
with-trappist-runtime = [
"trappist-service/with-trappist-runtime",
Expand Down
1 change: 0 additions & 1 deletion node/cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>.

use service::chain_spec;
#[cfg(feature = "with-stout-runtime")]
use service::chain_spec::stout::Extensions;
#[cfg(feature = "with-trappist-runtime")]
Expand Down
3 changes: 2 additions & 1 deletion node/cli/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![warn(missing_docs)]
// TODO: Write missing docs.
//#![warn(missing_docs)]
#![warn(unused_extern_crates)]

#[cfg(feature = "cli")]
Expand Down
3 changes: 1 addition & 2 deletions node/service/src/chain_spec/stout.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use cumulus_primitives_core::ParaId;
use hex_literal::hex;
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_service::ChainType;
use serde::{Deserialize, Serialize};
use sp_core::{crypto::UncheckedInto, sr25519, Pair, Public};
use sp_core::{sr25519, Pair, Public};
use sp_runtime::traits::{IdentifyAccount, Verify};
use stout_runtime::{
constants::currency::EXISTENTIAL_DEPOSIT, AccountId, AssetsConfig, AuraId, BalancesConfig,
Expand Down
1 change: 0 additions & 1 deletion node/service/src/chain_spec/trappist.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use cumulus_primitives_core::ParaId;
use hex_literal::hex;
use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup};
use sc_cli::DefaultConfigurationValues;
use sc_service::ChainType;
use serde::{Deserialize, Serialize};
use sp_core::{crypto::UncheckedInto, sr25519, Pair, Public};
Expand Down
3 changes: 3 additions & 0 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ use substrate_prometheus_endpoint::Registry;

pub mod chain_spec;

#[cfg(all(feature = "with-trappist-runtime", feature = "with-stout-runtime"))]
compile_error!("features `with-trappist-runtime` and `with-stout-runtime` are mutually exclusive");

#[cfg(feature = "with-stout-runtime")]
pub mod stout_executor {
pub use stout_runtime;
Expand Down
74 changes: 37 additions & 37 deletions runtime/trappist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ substrate-wasm-builder = { git = "https://github.com/paritytech/substrate", bran

[dependencies]
hex-literal = { version = "0.3.4", optional = true }
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"]}
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
log = { version = "0.4.17", default-features = false }
scale-info = { version = "2.3.1", default-features = false, features = ["derive"] }
serde = { version = "1.0.140", optional = true, features = ["derive"] }
Expand Down Expand Up @@ -85,7 +85,7 @@ cumulus-primitives-utility = { git = "https://github.com/paritytech/cumulus", br
pallet-collator-selection = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37", default-features = false }
parachains-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37", default-features = false }
parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37", default-features = false }
cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37", default-features = false, version = "3.0.0"}
cumulus-pallet-session-benchmarking = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.37", default-features = false, version = "3.0.0" }

# Polkadot Dependencies
kusama-runtime-constants = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "release-v0.9.37" }
Expand All @@ -109,10 +109,10 @@ pallet-asset-registry = { version = "0.0.1", default-features = false, path = ".
[features]
default = ["std"]
std = [
"codec/std",
"serde",
"scale-info/std",
"log/std",
"codec/std",
"serde",
"scale-info/std",
"log/std",
"sp-api/std",
"sp-block-builder/std",
"sp-consensus-aura/std",
Expand All @@ -129,32 +129,32 @@ std = [
"frame-support/std",
"frame-system/std",
"frame-system-rpc-runtime-api/std",
"pallet-assets/std",
"pallet-assets/std",
"pallet-asset-tx-payment/std",
"pallet-aura/std",
"pallet-authorship/std",
"pallet-balances/std",
"pallet-aura/std",
"pallet-authorship/std",
"pallet-balances/std",
"pallet-chess/std",
"pallet-collator-selection/std",
"pallet-collective/std",
"pallet-contracts/std",
"pallet-contracts-primitives/std",
"pallet-collator-selection/std",
"pallet-collective/std",
"pallet-contracts/std",
"pallet-contracts-primitives/std",
"pallet-democracy/std",
"pallet-dex/std",
"pallet-dex/std",
"pallet-dex-rpc-runtime-api/std",
"pallet-identity/std",
"pallet-multisig/std",
"pallet-randomness-collective-flip/std",
"pallet-scheduler/std",
"pallet-session/std",
"pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
"pallet-randomness-collective-flip/std",
"pallet-scheduler/std",
"pallet-session/std",
"pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
"pallet-treasury/std",
"pallet-uniques/std",
"pallet-utility/std",
"pallet-xcm/std",
"pallet-uniques/std",
"pallet-utility/std",
"pallet-xcm/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-parachain-system/std",
"cumulus-pallet-xcm/std",
Expand All @@ -173,29 +173,29 @@ std = [
"xcm/std"
]
runtime-benchmarks = [
"hex-literal",
"hex-literal",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-asset-registry/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
"pallet-contracts/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
"pallet-contracts/runtime-benchmarks",
"pallet-democracy/runtime-benchmarks",
"pallet-dex/runtime-benchmarks",
"pallet-dex/runtime-benchmarks",
"pallet-identity/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"pallet-uniques/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"pallet-uniques/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks"
]
Expand Down
7 changes: 3 additions & 4 deletions runtime/trappist/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ mod tests {
use sp_runtime::{
testing::Header,
traits::{BlakeTwo256, ConstU32, ConstU64, IdentityLookup},
Perbill,
Perbill, Permill,
};
use xcm::prelude::*;

type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;
Expand Down Expand Up @@ -252,9 +251,9 @@ mod tests {

DealWithFees::on_unbalanceds(vec![fee, tip].into_iter());

/// Author should get 20% of the fee + the 100% of the tip. (50)
// Author should get 20% of the fee + the 100% of the tip. (50)
assert_eq!(Balances::free_balance(CollatorSelection::account_id()), 50);
/// Treasury should get 80% of the fee. (80)
// Treasury should get 80% of the fee. (80)
assert_eq!(Treasury::pot(), 80);
});
}
Expand Down

0 comments on commit 173f2d4

Please sign in to comment.