feat(inference): add continuous PoC foundation#845
feat(inference): add continuous PoC foundation#845AlexeySamosadov wants to merge 1 commit intogonka-ai:upgrade-v0.2.11from
Conversation
Add the foundation for continuous Proof of Computation that runs in parallel with inference. This allows GPU nodes to prove their spare computational capacity by generating PoC nonces alongside real inference work, rather than requiring separate PoC-only phases. Changes: - New proto definitions: ContinuousPoCCommit, ContinuousPoCEpochSummary, ContinuousPoCParams, MsgSubmitContinuousPoCCommit - New params: EnableContinuousPoC, PocUtilizationTargetBps, NonceWeight, MaxCommitsPerEpoch, MinNoncesPerCommit, ValidationSampleRateBps - Keeper collections for commits and epoch summaries - Message handler with validation (participant check, rate limiting, nonce minimum, commit count cap, GPU utilization bounds) - Query proto definitions for epoch summaries - Codec registration for new message type - Disabled by default via EnableContinuousPoC=false Note: proto-gen needs to be run to regenerate pb.go files from the updated .proto definitions. Hand-written Go types bridge the gap until then.
…, nonce validation Builds on the continuous PoC foundation (GiP gonka-ai#821) with three critical missing components: ## 1. Pruning (application.db growth prevention) - Extend PruningState with ContinuousPoCCommitsPrunedEpoch and ContinuousPoCChallengePrunedEpoch fields (pruning_state.proto + .pb.go) - Add GetContinuousPoCCommitsPruner and GetContinuousPoCChallengesPruner to pruning.go using the same Pruner[K,V] pattern as existing collections - Wire into Keeper.Prune(), called from EndBlock every block ## 2. Epoch settlement (EffectivePocWeight → validator weight) - Add ContinuousPoCEpochSummaries map to WeightCalculator - GetAllContinuousPoCEpochSummariesForEpoch loads all summaries at settlement - calculateParticipantWeight adds effective_poc_weight to baseCount before applying combinedFactor — disabled if PenaltyApplied is true ## 3. Nonce validation (challenge / response) - ContinuousPoCChallenge type with full Marshal/Unmarshal/Size - IssueContinuousPoCChallenges: called each block, samples commits by ValidationSampleRateBps using app_hash as deterministic entropy - RespondContinuousPoCChallenge: verifies sha256-based Merkle proof; invalid proof or expired challenge zeros the epoch EffectivePocWeight - ExpireContinuousPoCChallenges: zeroes weight for unanswered challenges ## Bug fix vs PR gonka-ai#845 PR gonka-ai#845 adds ContinuousPocParams to Params but omits MarshalToSizedBuffer, Size, and Unmarshal changes in params.pb.go, so the field would never be persisted. This PR adds the full hand-written codec for ContinuousPoCParams, ContinuousPoCCommit, ContinuousPoCEpochSummary, and ContinuousPoCChallenge in types/continuous_poc.go, and wires field 14 into params.pb.go. Closes gonka-ai#821 Made-with: Cursor
…, nonce validation Builds on the continuous PoC foundation (GiP gonka-ai#821) with three critical missing components: - Extend PruningState with ContinuousPoCCommitsPrunedEpoch and ContinuousPoCChallengePrunedEpoch fields (pruning_state.proto + .pb.go) - Add GetContinuousPoCCommitsPruner and GetContinuousPoCChallengesPruner to pruning.go using the same Pruner[K,V] pattern as existing collections - Wire into Keeper.Prune(), called from EndBlock every block - Add ContinuousPoCEpochSummaries map to WeightCalculator - GetAllContinuousPoCEpochSummariesForEpoch loads all summaries at settlement - calculateParticipantWeight adds effective_poc_weight to baseCount before applying combinedFactor — disabled if PenaltyApplied is true - ContinuousPoCChallenge type with full Marshal/Unmarshal/Size - IssueContinuousPoCChallenges: called each block, samples commits by ValidationSampleRateBps using app_hash as deterministic entropy - RespondContinuousPoCChallenge: verifies sha256-based Merkle proof; invalid proof or expired challenge zeros the epoch EffectivePocWeight - ExpireContinuousPoCChallenges: zeroes weight for unanswered challenges PR gonka-ai#845 adds ContinuousPocParams to Params but omits MarshalToSizedBuffer, Size, and Unmarshal changes in params.pb.go, so the field would never be persisted. This PR adds the full hand-written codec for ContinuousPoCParams, ContinuousPoCCommit, ContinuousPoCEpochSummary, and ContinuousPoCChallenge in types/continuous_poc.go, and wires field 14 into params.pb.go. Closes gonka-ai#821 Made-with: Cursor
|
At this long-running task we first should have tested and reliable way to precisely enough estimate mlnodes load and should accurately test how it load. Such task should first have detailed whitepaper proposal and after all utility classes. Design still not discussed and proposed, but code is already proposed, but it is useless as it will change when design is discussed and choosen. This PR is running ahead of steps that should be done first (actually it introduces the last step being first). @AlexeySamosadov please first write your proposal with design in discussion #802 And please move this PR to draft or close it. |
Summary
Adds the foundational types, params, keeper infrastructure, and message handler for continuous Proof of Computation -- allowing GPU nodes to prove spare computational capacity by generating PoC nonces in parallel with inference work, rather than requiring separate PoC-only phases.
Closes #821
What's included
ContinuousPoCCommit,ContinuousPoCEpochSummary,ContinuousPoCParams,MsgSubmitContinuousPoCCommitmessage and query typesEnableContinuousPoC-- feature togglePocUtilizationTargetBps-- idle GPU capacity fraction for PoC (default: 99.5%)NonceWeight-- how many nonces equal one inference unit (default: 10)MaxCommitsPerEpoch-- anti-spam limit (default: 100)MinNoncesPerCommit-- minimum work per commit (default: 10)ValidationSampleRateBps-- random validation probability (default: 5%)ContinuousPoCCommits(triple key: epoch+address+height) andContinuousPoCEpochSummaries(pair key: epoch+address)SubmitContinuousPoCCommit) with full validation:Design decisions
EffectivePocWeightfor settlementEnableContinuousPoC=falseensures zero impact on existing behavior until governance activates itNote
Proto-gen needs to be run to regenerate
.pb.gofiles from the updated.protodefinitions. Hand-written Go types bridge the gap until then.Test plan
go build ./...passesSubmitContinuousPoCCommithappy path and validation edge cases