nu-node/CHANGELOG.md
Mukan Erkin ec8af8d1c7 feat(node): wire nu-p2p via HTTP publish API
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 16:49:37 +03:00

99 lines
6.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Changelog — nu-node
All notable changes to this project will be documented in this file.
Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
---
## [Unreleased]
## [0.8.0] — 2026-04-24
### Added
- `--p2p-api <url>` CLI flag — nu-p2p publish API adresi; verildiğinde P2P forwarding loop aktif olur
- `reqwest` HTTP client ile nu-p2p `/publish` endpoint'ine `BlockAnnounce` ve `TxGossip` mesajları iletilir
- `nu-node``nu-p2p` entegrasyonu tamamlandı: block loop ürettiği her blok için announce, RPC üzerinden kabul edilen her tx için gossip gönderir
### Changed
- `--p2p-addr` / `--bootstrap` flag'leri kaldırıldı; yerini `--p2p-api` aldı (process sınırı korunuyor, nu-p2p ayrı process olarak çalışıyor)
## [0.7.0] — 2026-04-24
### Added
- `nu-vm/executor.rs``execute_nft_transfer`: sahiplik + koleksiyon kontrolü, owner güncelleme, hesap nft_ids sync
- `nu-vm/executor.rs``execute_collection_claim`: `validate_lineage()` ile geçerli prefix-extension yolu doğrulama; tüm NFT'lere `collection_id` atar
- `nu-vm/engine.rs``NftTransfer` ve `CollectionClaim` varyantları bağlandı; `NftMint` kullanıcı tx'i değil (hata döner)
## [0.6.0] — 2026-04-24
### Added
- `block_loop.rs``BlockLoopConfig.dev_mode`; rotation check: non-dev modda `slot_producer()` çağrılır, sıra başka validatörde ise slot atlanır
- `block_loop.rs``load_validator_set(db)`: her slot başında `"validator:"` prefix'i taranarak canlı `ValidatorSet` oluşturulur
- `block_loop.rs``update_validator_pon(db, address)`: dürüst blok sonrası PoN skoru ve `consecutive_blocks` güncellenir
- `nu-consensus/src/validator_set.rs``slot_producer()`, `update()`, `get()`, `active_count()`, `Default` impl; `schedule()` filtresine `is_banned()` eklendi
- `nu-rpc/src/handlers.rs``nu_getValidator`: verilen adres için `ValidatorState` döner, kayıt yoksa null
## [0.5.0] — 2026-04-24
### Added
- `nu-consensus/src/slashing.rs``slash_double_sign` (%10 stake, PoN→0.5, 30 slot ban), `slash_invalid_block` (%5 stake, PoN→0.7), `record_skip`/`record_block`, `try_unban`
- `nu-consensus/src/types.rs``ValidatorRecord`'a `skip_count`, `ban_until_slot` alanları; `MIN_VALIDATOR_STAKE` Shell cinsine güncellendi (1_000_000)
- `nu-state/src/validator.rs``ValidatorState` struct (on-chain validator kayıt)
- `nu-state/src/db.rs``scan_prefix<T>` — prefix ile tüm kayıtları iterate eder
- `nu-state/src/accessor.rs``get_nft/set_nft`, `get_validator/set_validator` trait metodları
- `nu-vm/executor.rs``execute_validator_register`, `execute_voting_open`, `execute_node_approve` (NFT mint + ödül dağıtımı), `execute_node_reject` (entry fee yakım + stake unlock)
- `block_loop.rs` — her slot'ta `generate_scheduler_txs` çalışır; Pending→VotingOpen ve VotingOpen→Approved/Rejected auto-tx'leri mempool'a eklenir
- `DEV_WALLET` env variable desteği — hardcode kaldırıldı
## [0.4.0] — 2026-04-24
### Added
- `src/p2p.rs``P2pSender` ve `NodeP2pEvent` (BlockAnnounce, TxGossip); block loop ve RPC handler'larının P2P event'i yayınlamasını sağlar
- `--p2p-addr` ve `--bootstrap` CLI flag'leri — P2P etkinleştirildiğinde event channel başlatılır
- `RpcServer::with_p2p` constructor — RPC katmanına P2P gossip sender enjekte eder
- `nu_sendRawTx`: tx kabul edildiğinde raw bytes P2P gossip channel'ına iletilir
## [0.3.0] — 2026-04-24
### Added
- `nu-vm/executor.rs``execute_node_submit`: validates entry fee (25 NUT), creates `StoryNodeState { Pending }` in RocksDB indexed by `temp_id`
- `nu-vm/executor.rs``execute_vote_register`: validates node is `VotingOpen`, locks 10 NUT stake until vote end
- `nu-vm/executor.rs``execute_vote_cast`: computes weight as `√(staked) × pon_score`, appends `WeightedVote` to node
- `nu-vm/executor.rs``execute_stake_op`: stake/unstake with balance and staked field updates
- `nu-state/accessor.rs``StateAccessor` extended with `get_account/set_account`, `get_node/get_node_by_temp/set_node`, `lock_stake/unlock_stake/add_nft/record_vote`
- `nu-rpc/handlers.rs``nu_getBlock`: reads `"block:{height}"` from RocksDB, returns serialized `Block` or null
- `nu-vm/rewards.rs``SHELL_PER_NUT = 1_000`, `NUT_PER_NU = 100`, `NODE_REWARD_NUT = 100` constants; currency hierarchy Shell → NUT → NU
## [0.2.0] — 2026-04-24
### Added
- `nu-vm/engine.rs``execute_block`: runs all txs in a block against `StateDb`;
`TokenTransfer` fully applied, other variants produce a "not implemented" receipt
- `src/block_loop.rs` — tokio task producing one block per slot (6 s) in dev mode;
drains mempool, executes txs, removes successful ones, persists block to RocksDB
- `--dev --validator` flags in `main.rs` trigger block production loop on startup
### Changed
- `StateAccessor` trait: `set_balance` / `inc_nonce` now take `&self` (RocksDB
provides interior mutability — no `&mut` required at the Rust level)
- `StateDb` wrapped in `Arc<Mutex<StateDb>>` — block loop holds write lock per block,
RPC holds read lock for `nu_getAccount`
- `nu-vm` now depends on `nu-block` (was implicit via engine)
## [0.1.0] — 2026-04-24
### Added
- `nu_sendRawTx` — decodes JSON `RawTransaction`, deduplicates by `tx_id`,
inserts into mempool; returns `{ tx_id }` on success
- `TxPayload` enum in `nu-block/types.rs` — all variants with `priority_hint()`
- `TxPriority` derived from `TxPayload` in `nu-mempool` (Critical > High > Normal)
- `nu-rpc` axum HTTP server on `POST /rpc` — dispatches JSON-RPC 2.0 requests
- `nu_chainInfo` — returns `chain_id` and `node_version`
- `nu_getAccount` — reads `AccountState` from RocksDB; returns empty account for
unknown addresses (zero balance, nonce 0)
- `StateAccessor` trait implemented on `StateDb` — canonical single source of truth
for balance and nonce access
- `--dev`, `--validator`, `--rpc-addr`, `--db-path`, `--chain-id` CLI flags via clap
- Rust workspace scaffold with six crates: `nu-consensus`, `nu-mempool`, `nu-state`,
`nu-block`, `nu-rpc`, `nu-vm`
- `Dockerfile.dev` — multi-stage Rust build (builder: rust:1.79-slim, runtime: debian:bookworm-slim)