Skip to content
LogoLogo

Contributing

Development setup, test workflow, and contribution guidelines.

Prerequisites

ToolVersionPurpose
RustStable 1.95+Workspace toolchain
protoc3.x+tonic-build codegen
Bun1.x+Docs site (Vocs)

Install the pinned Rust toolchain:

rustup toolchain install 1.95.0

Install protoc:

# macOS
brew install protobuf
 
# Ubuntu / Debian
sudo apt install protobuf-compiler

Repository structure

PathDescription
crates/Rust workspace crates (proto, crypto, state, consensus, api, sync, client)
src/bin/node.rsFull validator node binary
src/bin/cli.rsCLI client for interacting with a node
src/bin/tui/Interactive terminal UI (dashboard, submit, wallet)
src/bin/indexer.rsgRPC chain indexer writing to Postgres (feature: indexer)
src/bin/event_processor.rsEvent-driven query table builder consuming Redis streams (feature: event-processor)
proto/makechain.protoProtobuf service and message definitions
tests/Integration and unit test suites
apps/docs/Vocs documentation site
contracts/Foundry project for the StorageRelay settlement contract and deployment artifacts
protocol/Protocol specification git submodule (officialunofficial/protocol)

Build and test

Build

cargo build          # Build library + node binary (runs tonic codegen via build.rs)
cargo run --bin node # Start node: gRPC :50051, p2p :50052, Simplex consensus
cargo run --bin cli  # CLI client
cargo run --bin tui  # Interactive terminal UI (--dev for embedded devnet)
 
# Feature-gated binaries (require Postgres / Redis)
cargo build --bin indexer --features indexer           # Chain indexer
cargo build --bin event-processor --features event-processor # Query table event processor

Run tests

cargo test           # Run all tests
cargo test <name>    # Run a single test by name

Test distribution

FileTestsCoverage
crates/makechain-state/tests/state_test.rs226State transitions, authorization, 2P semantics, CAS, LWW, archive, fork, storage limits
tests/integration_test.rs219End-to-end gRPC submit, mempool, propose, commit, query, streaming, multi-account
tests/consensus_e2e_test.rs19In-process multi-validator proposer/verifier harness
tests/conformance_test.rs20Commonware-conformance encoding stability tests
crates/makechain-state/tests/validation_test.rs181Structural validation for every message type
crates/makechain-api/tests/api_test.rs86API query layer: get/list for all resources, pagination, verifications, links, reactions
crates/makechain-crypto/tests/message_test.rs47Signing and verification round-trips, envelope validation
tests/event_processor_test.rs17Event processor logic, event routing, idempotent semantics (feature: event-processor)
Unit tests (inline)~1000State, consensus, sync, API, client, and node binary internals

Conventions

TDD workflow

Write tests first, then implement.

Error assertions

Use matches!() for asserting error variants in tests:

let result = apply_message(&mut store, &msg);
assert!(matches!(result, Err(StateError::ProjectNotFound(_))));

Proto changes

When adding new message types or RPCs:

  1. Modify proto/makechain.proto
  2. Run cargo build — Rust types appear automatically via tonic-build
  3. Add structural validation in crates/makechain-state/src/validation.rs
  4. Add state handlers in crates/makechain-state/src/handlers/
  5. Add API query functions in crates/makechain-api/src/query.rs if needed
  6. Write tests covering the new type

Code style

  • Rust edition 2024, stable toolchain 1.95+
  • All hash fields are 32 bytes, all signatures are 64 bytes
  • Proto enum variants use SCREAMING_SNAKE_CASE with a type prefix
  • State keys use prefix-byte namespacing (see crates/makechain-state/src/keys.rs)

Pull requests

  1. Create a feature branch from main
  2. Write tests for your changes
  3. Run cargo test and ensure all tests pass
  4. Run cargo build to verify compilation
  5. Open a pull request with a clear description of the change

Docs contribution

The documentation site uses Vocs with Bun:

cd apps/docs
bun install          # Install dependencies (first time)
bun run dev          # Dev server at http://localhost:5173
bun run build        # Build static site to apps/docs/dist/

Pages are MDX files in apps/docs/src/pages/. Follow the writing guide for conventions. Deployed to Cloudflare Pages.