You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(consensus): P2P consensus system with SDK trait refactor and WASM weight integration (#57)
* feat(consensus): P2P consensus system with SDK trait refactor, bootstrap period, and WASM weight integration
SDK trait refactor:
- Extended Challenge trait with routes(), handle_route(), get_weights(),
and validate_storage_write() methods with default implementations
- Updated register_challenge! macro to export all 4 new WASM functions
(get_routes, handle_route, get_weights, validate_storage_write)
- Added WeightEntry { uid: u16, weight: u16 } type for WASM weight serialization
Bootnode and stake verification:
- Added is_bootnode field to P2PConfig with with_bootnode() builder
- Added is_stake_sufficient() method to ValidatorSet
- Updated min validator stake to 10k TAO (10_000_000_000_000 RAO) across
core/constants.rs, p2p-consensus/config.rs, subnet-manager/config.rs,
and validator-node/main.rs
Bootstrap period for UID 0 dominance:
- Added BOOTSTRAP_PERIOD_EPOCHS (100) and BOOTSTRAP_UID0_WEIGHT (u16::MAX)
constants to platform-core
- Added bootstrap_active field to ChainState with is_in_bootstrap_period()
- Modified finalize_weights() to override UID 0 weight during bootstrap
Cross-challenge storage:
- Added storage_get_cross host function allowing WASM challenges to read
storage from other challenges
- Added StorageBackend::get_cross() with default delegation to get()
- Implemented get_cross() in ChallengeStorageBackend
Sudo challenge updates:
- Enhanced ChallengeUpdate handler with sudo key verification
- Invalidates WASM module cache on authorized challenge updates
Epoch weight calculation from WASM:
- Added execute_get_weights() and execute_validate_storage_write()
- Integrated WASM weight collection in CommitWindowOpen handler
- Added submit_weight_vote() to ChainState for local weight submission
- Added call_i32_i32_i32_i32_return_i32() for 4-arg WASM calls
- Added consensus_get_subnet_challenges host function and SDK wrapper
* ci: trigger CI checks
0 commit comments