nu-node/CLAUDE.md
Mukan Erkin 5430c34d9e feat(nu-node): initial Faz 0 scaffold
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 00:00:26 +03:00

1.6 KiB
Raw Blame History

nu-node — CLAUDE.md

L1 node implementasyonu. Consensus, mempool, state, block üretimi, RPC.

Crate Yapısı

Crate Sorumluluk
nu-consensus PoN validator seçim, slot sistemi, PoN skoru, oylama scheduler
nu-mempool Bekleyen tx havuzu; öncelik: Critical > High > Normal
nu-state AccountState, StoryNodeState, NftState; RocksDB backend
nu-block BlockBuilder (Merkle root), BlockVerifier
nu-rpc JSON-RPC HTTP server + WebSocket subscription
nu-vm Tx executor, ödül dağıtımı, slashing

Kritik Kurallar

  • unwrap() / expect() sadece test kodunda. Production'da ? veya açık hata.
  • State'e dokunan her fonksiyon: önce tam doğrulama, sonra mutation.
  • Slashing ve ödül dağıtımı atomik — başarısız olursa state değişmez.
  • BURN_WALLET ve DEV_WALLET adresleri env variable; hardcode yasak.

Sabitler (nu-consensus/src/types.rs)

SLOT_DURATION_MS = 6_000
ROUND_SIZE       = 21
MIN_VALIDATOR_STAKE = 1_000 NUT
PoN: start=1.0, max=1.8, min=0.5
     win=+0.02, lose=-0.05, honest_block=+0.01
WHALE_CAP = 5% of total weight

Geliştirme

# Devnet (tek validator, consensus devre dışı)
cargo run --bin nu-node -- --dev --validator

# Testleri çalıştır
cargo test

# Lint
cargo fmt && cargo clippy

Faz Durumu

  • Faz 0 (şu an): Scaffold tamam. Modül sınırları tanımlı, tipler yazıldı.
  • Faz 1: Tx execution (TokenTransfer önce), tek validator devnet, JSON-RPC server.
  • Faz 2: PoN consensus tam implementasyon, slashing, 3+ validator.