DevelopersSeptember 14, 2026by
EmpoorioChain Core
EmpoorioChain Core

From Rust to a Pallet: Adding Functionality to the EmpoorioChain Runtime

EmpoorioChain's primary way to add functionality is not a contract; it is a pallet — a Rust module compiled into the runtime. This is the path the repository defines.

Before the first build

./scripts/restaurar_sdk_vendorizado.sh   # restores 380 MB of vendored Frontier + polkadot-sdk patches
cargo check -p empoorio-runtime

Skip the script and the build dies on a missing Cargo.toml under patches/. Budget disk: target/ reaches ~50 GB; use CARGO_INCREMENTAL=0.

Where things live

AreaPath
Runtimeruntime/
Nodenode/
Pallet suitescrates/emp-core-suite/, emp-defi-suite/, emp-gaming-suite/, emp-ai-engine/, emp-commerce-suite/, emp-governance-suite/, emp-compliance-suite/
Rust SDK / CLIsdk/rust/empoorio-sdk/, sdk/rust/emp-cli/

The ten steps

  1. Create the crate in the right suite.
  2. Add it to the workspace Cargo.toml.
  3. Implement lib.rs: Config, storage (bounded — every item), events, errors, calls (with explicit call_index), weights, genesis config if needed.
  4. mock.rs and tests.rs.
  5. benchmarking.rs for every call that writes storage, loops over collections or scales with input.
  6. Wire into runtime/Cargo.toml.
  7. impl pallet_x::Config for Runtime.
  8. Add to every applicable construct_runtime! block (EVM and non-EVM variants) with a new, stable index.
  9. SDK/CLI support if developer-facing.
  10. Update PALLET_REFERENCE.md, EIP_COVERAGE.md if it maps to an Ethereum standard, ARCHITECTURE.md if it changes the architecture, and the tokenomics rationale if it touches fees, deposits or staking.

Rules that are not optional

  • Indexes never move. Pallet indexes and call indexes are addresses in every encoded transaction and event. Reordering breaks decoding of history and storage. Explicit call_index exists so you can reorder source freely.
  • Bounded storage. Enforced since runtime 215; check for #[pallet::unbounded] as well as without_storage_info.
  • Wire it or retire it. A dispatchable ships with a real, exercised circuit and a mutation test, or it does not ship.
  • post_upgrade verifies your migration, not the world.
  • Every account your pallet pays into must exist — the DEX treasury did not, and no swap settled for months.

Testing standard

Success path; permission failure; invalid parameter; storage mutation; emitted event; fee/deposit accounting; bounded limits; replay/nonce protection where signatures are involved.

cargo test -p pallet-example
cargo test -p pallet-example --features runtime-benchmarks
cargo check -p empoorio-runtime

Then try-runtime against a testnet snapshot before any migration reaches a proposal.

Shipping

A runtime upgrade under the policy: class, timelock, manifest with hashes and metadata diff, rollback plan. Runtimes 208–220 are the worked examples.

From Rust to here

If you know Rust, the unfamiliar parts are FRAME's macros and the discipline above. The familiar part is that the compiler is your friend — which is why the ecosystem prefers generated types over dynamic lookups wherever a name can be wrong.

Based on DEVELOPER_GUIDE.md, GETTING_STARTED.md, the runtime 215/217 rules and RUNTIME_UPGRADE_POLICY.md.

Share this article