Feature/821 continuous poc complete#856
Open
Mayveskii wants to merge 6 commits intogonka-ai:upgrade-v0.2.11from
Open
Feature/821 continuous poc complete#856Mayveskii wants to merge 6 commits intogonka-ai:upgrade-v0.2.11from
Mayveskii wants to merge 6 commits intogonka-ai:upgrade-v0.2.11from
Conversation
added 5 commits
March 3, 2026 16:42
…, 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
Made-with: Cursor
Made-with: Cursor
…ing state Made-with: Cursor
- Rename proto field 5 from continuous_poc_summaries_pruned_epoch to continuous_poc_challenges_pruned_epoch (naming matched its use) - Add proto field 6 continuous_poc_summaries_pruned_epoch for the ContinuousPoCEpochSummaries collection - Add GetContinuousPoCEpochSummariesPruner keyed on Pair[uint64, AccAddress] and wire it into Keeper.Prune() to prevent summaries accumulating forever - Update PruningState round-trip and backward-compat tests for field 6 Made-with: Cursor
Collaborator
|
@Mayveskii can I kindly ask you to contact me via tania.charchian at productscience.ai |
Mayveskii
pushed a commit
to Mayveskii/gonka
that referenced
this pull request
Mar 4, 2026
Nodes that produce high-quality inference results and serve them from cache earn CacheQualityWeight — an additive bonus on top of standard PoC weight. This creates an economic feedback loop: better GPU → better results → more reuse → higher weight → more rewards. Two lookup levels: L1 — PromptHash exact-match (sha256 of canonical JSON), O(1), 100% certain. L2 — cosine similarity via all-MiniLM-L6-v2, governance-controlled threshold. MsgFinishInference is sent on every HIT so the node closes the on-chain cycle. Feature disabled by default; activated via CacheQualityParams governance. inference-chain: - cache_quality.proto: proto source for CacheQualityEpochSummary (new) - params.proto: CacheQualityParams added (field 14) - tx.proto: MsgSubmitCacheQualitySummary RPC added - types/cache_quality.go: params and summary types with serialisation - keeper/msg_server_cache_quality.go: submission handler with bounds checks - keeper/pruning.go: CacheQualityEpochSummaries pruner - module/chainvalidation.go: CacheQualityWeight integration at epoch settlement - app/upgrades/v0_2_11: seeds CacheQualityParams defaults on upgrade decentralized-api: - semanticcache/cache.go: SemanticCache with LookupByPromptHash (L1) + Lookup (L2) - semanticcache/memory_store.go: InMemoryCacheStore, zero external dependencies - semanticcache/embedder.go: MLNodeEmbedder + StubEmbedder - semanticcache/quality_reporter.go: QualityReporter submits per-epoch summary - semanticcache/cache_test.go + cache_http_test.go: 20 tests, full matrix - post_chat_handler.go: L1/L2 integration in executor path - main.go: cache initialisation wired to governance params and epoch events - mlnodeclient: Embed() method added to interface and client mlnode: - packages/api/src/api/embed_routes.py: /api/v1/embed endpoint (CPU, fastembed) docs: - docs/specs/semantic-cache.md: two-level architecture, developer simulation Depends on continuous PoC (gonka-ai#856). Closes gonka-ai#821.
…Performance) Merge origin/upgrade-v0.2.11 into feature/821-continuous-poc-complete. Resolved collisions: - keys.go: upstream took prefixes 44-46 (ActiveParticipantsCache, ModelLoad/InferenceCount rolling windows); moved ContinuousPoC collections to 48-50 to avoid collision - errors.go: upstream took error codes 1166-1169 (Unified Permissions gonka-ai#760); renumbered ContinuousPoC errors to 1170-1176 - keeper.go: added both ActiveParticipantsSet and ContinuousPoC collection fields/init Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Builds on PR #845 (AlexeySamosadov) to deliver a production-ready continuous PoC system.
PR #845 introduced the data structures; this PR makes them work end-to-end and fixes a
critical serialisation bug in #845.
What this PR adds
1. Fix:
ContinuousPocParamsserialisation bug in PR #845params.pb.goaddedContinuousPocParamsto theParamsstruct but never updatedMarshalToSizedBuffer,Size, orUnmarshal. The field silently vanished on everyround-trip — making continuous PoC impossible to enable via governance.
2. Pruning for continuous PoC collections
Extends
PruningState(proto fields 4–6) with epoch counters for commits, challenges,and summaries. Adds three
Prunerimplementations wired intoKeeper.Prune():GetContinuousPoCCommitsPruner—Triple[uint64, AccAddress, int64]GetContinuousPoCChallengesPruner— same key shapeGetContinuousPoCEpochSummariesPruner—Pair[uint64, AccAddress]All three reuse existing
PocDataPruningEpochThreshold/PocPruningMaxparameters.3. Epoch settlement integration
WeightCalculatorgains aContinuousPoCEpochSummariesmap. DuringComputeNewWeights,EffectivePocWeightfrom each participant'sContinuousPoCEpochSummaryis added to theirstandard PoC weight — unless
PenaltyAppliedis set (failed/expired challenge).4. Merkle-proof nonce validation
SubmitContinuousPoCCommit— validates params, enforcesMaxCommitsPerEpochandMinNoncesPerCommit, upsertsContinuousPoCEpochSummary.IssueContinuousPoCChallenges(EndBlock) — deterministically samples commits usingsha256(app_hash || block_height)as entropy.RespondContinuousPoCChallenge— verifies the Merkle proof and resolves the challenge.ExpireContinuousPoCChallenges(EndBlock) — appliesPenaltyAppliedto summaries whose deadline passed.Testing
x/inference/types— all passNote on PR #845
This PR intentionally overlaps with #845 — it is a superset. If #845 merges first, I will
rebase and remove the duplicate definitions. Happy to coordinate with the author.
Closes #821