feat(plugin): G2 ZeroPerceptron on-chain AI prediction marketplace + plugin key-prefix safety guard - #602
Closed
Zakil11 wants to merge 13 commits into
Closed
feat(plugin): G2 ZeroPerceptron on-chain AI prediction marketplace + plugin key-prefix safety guard#602Zakil11 wants to merge 13 commits into
Zakil11 wants to merge 13 commits into
Conversation
…temperature scaling (1.5)
…acy aggregation for retraining
…na Canopy - ai_model.py: N_FEATURES=42, fc00[256,42], G2Encoder extended42 (raw7 + G2 14 + inter7 + meta7 + cross7_self) - contract.py: walidacja 28/42, predict_raw dla 42D - data/perceptron_genlayer_weights.json: wagi 42D (trening na danych Kucoin Futures, acc_test=0.3232, 8865 zdarzeń) - test_contract.py: testy 42D
…Stake/CreateMarket/ResolveMarket/ClaimReward) - tx.proto: MessageStake, MessageCreateMarket, MessageResolveMarket, MessageClaimReward - contract.py: prefiksy 0x05 (market), 0x06 (stake), 0x08 (counter) - contract.py: check/deliver dla 4 nowych typów transakcji - Rynek: pytanie + resolution_height + pula nagród (outcome_pools) - Nagroda = (stake × total_pool) / winning_pool - test_contract.py: 15 nowych testów marketplace (28 passed)
…rketplace end-to-end) - Naprawa buga: klucze outcome_pools jako stringi po serializacji JSON - Dodanie MockPlugin (in-memory state_read/state_write) - Testy deliver_tx: create_market → stake → resolve → claim (pełny cykl) - Testy błędów: brak rynku, nie-kreator resolve, zły outcome, podwójny claim, brak funduszy - 34 testów (28 check + 6 deliver)
…isterModel) - Nowy typ transakcji MessageRegisterModel (0x09 registry + 0x0a counter) - Rejestr: wersja, hash wag, accuracy, in_dim (28/42), n_classes, opis - Active model pointer (0x09/active/) — wskazuje najnowszą wersję - Governance: aktualizacja wag bez hard-forku (rejestr on-chain) - Testy: 44 passed (34 + 10 nowych: 7 check + 3 deliver)
…e/market/reward/model) pod 0x0b
…e/accuracy/complexity)
…-15 collision) Canopy FSM assertPluginKeyWritable() panics if a plugin writes under a core-reserved single-byte prefix (1-15). Our custom records (predict logs, feedback, markets, stakes, counters, model registry, dashboard) used 0x03-0x0b which collide with validators/committees/unstaking/paused/non-signers/ last-proposers/supply/delegations/committees-data. The first predict tx would have panicked the node. - All app-owned prefixes moved outside the reserved range (100-107) - Prefixes declared in CONTRACT_CONFIG['custom_state_prefixes'] - E2E verified: signed MessagePredict tx included at height 328, fee deducted (1M -> 990k), G2 on-chain inference executed, 0 failed txs
…models, feedback)
Collaborator
|
Hello @Zakil11 thanks for your interest in building in Canopy! I see you're using our plugin system. The idea for it is to build the plugin on your own fork. Since that's the case I'll close the PR. But keep the good work on your fork! |
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
Full-featured Python plugin extending the Canopy FSM with an on-chain AI prediction marketplace, built on the G2 ZeroPerceptron model.
Features (11 commits)
MessagePredicttx running G2 ZeroPerceptron (28D + extended 42D) inside the plugin contractMessageFeedbacktx (namespace 0x04) with accuracy aggregation for retrainingMessageStake/CreateMarket/ResolveMarket/ClaimRewardwith QARD stakingMessageRegisterModelregistry under 0x06Critical fix
fsm/state.go: addedassertPluginKeyWritable()guard — plugins writing to core-reserved prefixes (1-15) now panic at write time. Plugin custom prefixes moved from 3-11 to 100-107 (custom_state_prefixesdeclared in CONTRACT_CONFIG, validated at handshake).Tests
go test ./... -p=1— 13/13 packages OK (bft, fsm, lib, p2p, store, controller, cmd/*)pytest tests/— 63/63 PASSDocs