#pallet #math #building #hashing #deps #re-exports #domain-specific #system-config #preludes #frame-pallets

no-std topsoil

The single package to get you started with building frame pallets and runtimes

2 unstable releases

new 0.2.0 Mar 9, 2026
0.1.0 Dec 20, 2025

#12 in #system-config

GPL-3.0-or-later…

4.5MB
90K SLoC

Topsoil

Usage

This crate is organized into 3 stages:

  1. preludes: prelude, testing_prelude, runtime::prelude, benchmarking::prelude, and weights_prelude.
  2. domain-specific modules, like traits, hashing, arithmetic and derive.
  3. Accessing frame/substrate dependencies directly: deps.

The main intended use of this crate is through preludes, which re-export most of the components needed for pallet development. Domain-specific modules serve as a backup for organization, and deps provides direct access to all dependencies if needed.

Example Usage

use topsoil;

#[topsoil::pallet]
pub mod pallet {
	# use topsoil;
	use topsoil::prelude::*;
	// ^^ using the prelude!

	#[pallet::config]
	pub trait Config: topsoil_core::system::Config {}

	#[pallet::pallet]
	pub struct Pallet<T>(_);
}

#[cfg(test)]
pub mod tests {
	# use topsoil;
	use topsoil::testing_prelude::*;
}

#[cfg(feature = "runtime-benchmarks")]
pub mod benchmarking {
	# use topsoil;
	use topsoil::benchmarking::prelude::*;
}

pub mod runtime {
	# use topsoil;
	use topsoil::runtime::prelude::*;
}

Features

This crate uses a runtime feature to include all types and tools needed to build FRAME-based runtimes. For runtime development, import it as:

topsoil = { version = "foo", features = ["runtime"] }

If you just want to build a pallet instead, import it as

topsoil = { version = "foo" }

Prelude Relationships

The preludes have overlapping imports for convenience:

  • testing_prelude includes prelude and runtime::prelude
  • runtime::prelude includes prelude
  • benchmarking::prelude includes prelude

Naming

Please note that this crate can only be imported as topsoil. This is due to compatibility matters with topsoil-core.

A typical pallet's Cargo.toml using this crate looks like:

[dependencies]
codec = { features = ["max-encoded-len"], workspace = true }
scale-info = { features = ["derive"], workspace = true }
topsoil = { workspace = true, features = ["runtime"] }

[features]
default = ["std"]
std = [
	"codec/std",
	"scale-info/std",
	"topsoil/std",
]
runtime-benchmarks = [
	"topsoil/runtime-benchmarks",
]
try-runtime = [
	"topsoil/try-runtime",
]

Dependencies

~23–37MB
~636K SLoC