Partner Pallet Integration
This guide describes adding an external FRAME pallet to the taler runtime and preparing it for network operation (genesis, weights, RPC/runtime-API if necessary).
Prerequisites:
The pallet must support
no_std and have a std feature for the host.
For production, weights are mandatory and, if necessary, benchmarking.
Adding dependency to
runtime/Cargo.toml
For Substrate pallets use git/branch SDK, for local ones — path.
[dependencies]
partner-pallet = { version = "4.0.0-dev", default-features = false, git = "https://github.com//.git", branch = "release-polkadot-v1.3.0" }
[features]
std = [
# ... existing
"partner-pallet/std",
]
Implementing
Config in runtime/src/lib.rs
Import the pallet and implement its
Config with types, constants and WeightInfo.
parameter_types! {
pub const PartnerParam: u32 = 42;
}
impl partner_pallet::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances; // if required
type SomeParam = PartnerParam;
type WeightInfo = partner_pallet::weights::SubstrateWeight;
}
Including in
construct_runtime!
construct_runtime!(
pub struct Runtime {
// ... existing pallets
PartnerPallet: partner_pallet = 210, // unique index
}
);
Genesis config (optional)
If the pallet has
GenesisConfig, add initialization to node/src/chain_spec.rs in the testnet_genesis function.
partner_pallet: partner_pallet::GenesisConfig {
// initial values
},
Weights and benchmarking
Enable the
runtime-benchmarks feature in runtime/Cargo.toml (if the pallet supports it).
Generate weights and update the partner pallet's
weights.rs or use provided weights.
cargo run --release -p taler-node --features runtime-benchmarks \
-- benchmark pallet \
--pallet "partner_pallet" \
--extrinsic "*" \
--wasm-execution compiled \
--heap-pages 4096 \
--output ./pallets/partner-pallet/src/weights.rs \
--template ./templates/weight-template.hbs
Runtime API / RPC (if necessary)
If off-chain calls are required, add runtime-API:
- crate
partner-pallet-runtime-api in runtime/Cargo.toml.
-
impl_runtime_apis! in runtime/src/lib.rs with pallet calls.
For custom RPC:
- server part in
node/src/rpc.rs (jsonrpsee) and providers.
Features and
std
Ensure the pallet dependency is specified with
default-features = false, and its std is included in the runtime's std feature list.
Updating spec_version
When changing runtime logic (pallet composition, types, constants) increment
spec_version in runtime/src/lib.rs.
Migrations
If the pallet contains storage migrations, add its
OnRuntimeUpgrade to the runtime's Migrations aggregate.
Verification
Build wasm and native runtime:
cargo build --release
Start the node and verify extrinsics, storage and pallet events through polkadot.js/apps.
Including in Governance/Origin (optional)
If the pallet requires access rights (Root/council/tech committee), configure
EnsureOrigin/EitherOfDiverse based on already used collectives (Council, TechnicalCommittee) as in existing pallets.
Notes:
Taler already uses many system pallets; avoid index conflicts in
construct_runtime! and type duplicates.
For working with tokens/assets, reuse
Balances, Assets, Nfts.