diff --git a/CHANGELOG.md b/CHANGELOG.md index 92470d5..08d820d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ - + # CHANGELOG — khadhroony-bot3 @@ -20,7 +20,7 @@ Ce changelog décrit les évolutions fonctionnelles globales du projet. Il ne re - confirmation du split futur entre configuration généraliste et configuration logging, avec documents, schémas et profils indépendants ; - cadrage d'une séparation entre configuration source, runtime résolue et surfaces publiques/diagnostiques afin qu'aucun secret résolu ne puisse être exposé involontairement ; - caractérisation du format wallet `0.4.8` comme contrat de migration à préserver ou importer explicitement en `0.5.2` ; -- audit de `kb-store` confirmant les frontières existantes tout en identifiant `block_time`, provenance et index trading/routing comme axes de `0.5.3` ; +- audit de `ks-store` confirmant les frontières existantes tout en identifiant `block_time`, provenance et index trading/routing comme axes de `0.5.3` ; - décision de migrer en `0.5.3` les tables Solana `kb_sol_*` vers `k_sol_*`, `kb_*` restant réservé aux éventuelles données réellement spécifiques au Bot. ### Scénarios et exécution @@ -58,7 +58,7 @@ Ce changelog décrit les évolutions fonctionnelles globales du projet. Il ne re ### Desktop et cohérence transversale - finalisation de `demo_execution_metadata` avec trois domaines séparés, campagnes réutilisables, JsonViewer, accordéons de preuves et journal pleine largeur ; -- centralisation des scénarios réseau réutilisables dans `kb-pipeline-demo-scenarios` plutôt que dans l’adaptateur Tauri ; +- centralisation des scénarios réseau réutilisables dans `ks-pipeline-demo-scenarios` plutôt que dans l’adaptateur Tauri ; - réconciliation des matrices, registres runtime, exports publics, IDL, TODO et stockage ; - confirmation qu’aucune migration PostgreSQL spécialisée Metadata n’est nécessaire. @@ -77,7 +77,7 @@ Ce changelog décrit les évolutions fonctionnelles globales du projet. Il ne re - décodeurs d’instructions et de comptes, PDA, owners, modèles et variantes historiques ; - matérialisation metadata, administration, lifecycle et risques applicables ; - intents typés, builders, exécuteur, préflight stateful, simulation-first et postconditions ; -- intégration dans `kb-pipeline`, scénarios synthétiques et runner Devnet réutilisable ; +- intégration dans `ks-pipeline`, scénarios synthétiques et runner Devnet réutilisable ; - intégration desktop sans fetch HTTP/IPFS/Arweave. ### Validation @@ -92,8 +92,8 @@ Ce changelog décrit les évolutions fonctionnelles globales du projet. Il ne re - clôture de la migration principale de bot2 vers l’architecture consolidée bot3 ; - onze crates documentées et versionnées `0.4.6` ; -- décodeurs, exécuteurs et matérialisateurs regroupés dans `kb-lib` ; -- stockage consolidé dans `kb-store` et transports RPC dans `kb-onchain-transport`. +- décodeurs, exécuteurs et matérialisateurs regroupés dans `ks-lib` ; +- stockage consolidé dans `ks-store` et transports RPC dans `ks-onchain-transport`. ### Capacités @@ -114,7 +114,7 @@ Ce changelog décrit les évolutions fonctionnelles globales du projet. Il ne re - registre ElGamal non déclaré validé réellement sur Devnet ou Mainnet faute de déploiement et de preuves disponibles ; - achèvement de Metaplex Token Metadata reporté à `0.4.7` ; - SPL Token Metadata et décision sur `kb-offchain-transport` reportés à `0.4.8` ; -- améliorations structurelles de `kb-config`, `kb-logging` et `kb-store` reportées à `0.5.x`. +- améliorations structurelles de `ks-config`, `ks-logging` et `ks-store` reportées à `0.5.x`. ## 0.1.0-mig-from-kbot2 — transition architecturale vers khadhroony-bot3 @@ -123,13 +123,13 @@ Cette entrée de transition regroupe la migration structurelle et fonctionnelle ### Architecture - consolidation de plus de 250 crates historiques en 11 crates de workspace ; -- regroupement des modèles, décodeurs, exécuteurs et matérialisateurs dans `kb-lib` ; -- consolidation du stockage dans `kb-store` ; -- renommage de `kb-rpc` en `kb-onchain-transport` ; -- migration du pipeline dans `kb-pipeline` ; -- extraction des scénarios de démonstration dans `kb-pipeline-demo-scenarios` ; +- regroupement des modèles, décodeurs, exécuteurs et matérialisateurs dans `ks-lib` ; +- consolidation du stockage dans `ks-store` ; +- renommage de `kb-rpc` en `ks-onchain-transport` ; +- migration du pipeline dans `ks-pipeline` ; +- extraction des scénarios de démonstration dans `ks-pipeline-demo-scenarios` ; - maintien de `kb-app-demo-desktop` comme crate mixte bibliothèque et binaire ; -- migration et renommage du portefeuille en `kb-wallet`. +- migration et renommage du portefeuille en `ks-wallet`. ### Normes diff --git a/Cargo.toml b/Cargo.toml index 2f6b469..38b08fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,24 +1,24 @@ # file: Cargo.toml -# version: 45 +# version: 46 [workspace] resolver = "3" members = [ - "kb-core", - "kb-config", - "kb-lib", - "kb-logging", - "kb-program-ids", - "kb-pipeline", - "kb-pipeline-demo-scenarios", - "kb-onchain-transport", - "kb-store", - "kb-wallet", + "ks-core", + "ks-config", + "ks-lib", + "ks-logging", + "ks-program-ids", + "ks-pipeline", + "ks-pipeline-demo-scenarios", + "ks-onchain-transport", + "ks-store", + "ks-wallet", "kb-app-demo-desktop", ] [workspace.package] -version = "0.5.1-pre.1" +version = "0.5.1-pre.2" edition = "2024" license = "MIT" repository = "https://git.sasedev.com/Sasedev/khadhroony-bot3" diff --git a/README.md b/README.md index 6cb9ebd..30817c6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ - + # Khadhroony Bot3 @@ -9,16 +9,16 @@ Le workspace contient onze crates : -- `kb-core` : erreurs et primitives transversales ; -- `kb-config` : chargement et validation de la configuration ; -- `kb-lib` : modèles, décodeurs, exécuteurs et matérialisateurs ; -- `kb-logging` : logging et tracing ; -- `kb-program-ids` : registre canonique des programmes et comptes Solana ; -- `kb-pipeline` : pipeline généraliste de backfill, extraction, replay et orchestration ; -- `kb-pipeline-demo-scenarios` : scénarios synthétiques et campagnes Devnet/Testnet automatisables ; -- `kb-onchain-transport` : transports RPC HTTP et WebSocket ; -- `kb-store` : contrats de stockage et adaptateur PostgreSQL ; -- `kb-wallet` : frontière de wallet et signataires ; +- `ks-core` : erreurs et primitives transversales ; +- `ks-config` : chargement et validation de la configuration ; +- `ks-lib` : modèles, décodeurs, exécuteurs et matérialisateurs ; +- `ks-logging` : logging et tracing ; +- `ks-program-ids` : registre canonique des programmes et comptes Solana ; +- `ks-pipeline` : pipeline généraliste de backfill, extraction, replay et orchestration ; +- `ks-pipeline-demo-scenarios` : scénarios synthétiques et campagnes Devnet/Testnet automatisables ; +- `ks-onchain-transport` : transports RPC HTTP et WebSocket ; +- `ks-store` : contrats de stockage et adaptateur PostgreSQL ; +- `ks-wallet` : frontière de wallet et signataires ; - `kb-app-demo-desktop` : application Tauri de démonstration et validation opérateur. La série `0.5.x` prépare la séparation explicite entre le domaine applicatif `khadhroony-bot` et les bibliothèques généralistes `khadhroony-solana`. En `0.5.1`, les dix crates généralistes doivent migrer vers les noms `ks-*` / `ks_*`, tandis que `kb-app-demo-desktop` conserve son nom et reste une application du workspace Bot. Le workspace, le dépôt et le répertoire racine restent nommés `khadhroony-bot3` pendant cette migration et ne doivent pas être renommés avant `1.0` ou une version ultérieure explicitement dédiée. La politique de migration est définie dans [`docs/decisions/KHADHROONY_SOLANA_NAMESPACE_POLICY.md`](docs/decisions/KHADHROONY_SOLANA_NAMESPACE_POLICY.md). diff --git a/ROADMAP.md b/ROADMAP.md index 08cb5e3..02dab6a 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,5 +1,5 @@ - + # ROADMAP — khadhroony-bot3 @@ -18,7 +18,7 @@ Version clôturée : surface Metaplex Token Metadata indépendante, bornée et i - décodeur d’instructions et de comptes, PDA, owners et variantes historiques ; - matérialisation metadata, administration, lifecycle et risques applicables ; - intents typés, builders, exécuteur, préflights, simulation exacte et postconditions ; -- intégration généraliste dans `kb-pipeline` ; +- intégration généraliste dans `ks-pipeline` ; - scénarios synthétiques NFT, SFT, fungible, collection et pNFT ; - runner Devnet réutilisable et panneau `kb-app-demo-desktop` ; - fixtures Rust natives sans dépendance à une CLI externe ; @@ -68,7 +68,7 @@ La politique de namespace et d'ownership adoptée pendant `0.5.0` est documenté Cadrage clôturé avant toute restructuration majeure : -- audit des responsabilités et couplages de `kb-config`, `kb-logging`, `kb-wallet`, `kb-store`, `kb-pipeline-demo-scenarios` et `kb-app-demo-desktop` ; +- audit des responsabilités et couplages de `ks-config`, `ks-logging`, `ks-wallet`, `ks-store`, `ks-pipeline-demo-scenarios` et `kb-app-demo-desktop` ; - inventaire des contrats publics, formats persistés, migrations, dépendances, scénarios et preuves de validation ; - confirmation du split futur entre configuration généraliste et configuration logging ; - définition de la politique de secrets et du namespace d'environnement `KS_*` ; @@ -84,7 +84,7 @@ Cadrage clôturé avant toute restructuration majeure : Cette version effectue la migration de namespace des bibliothèques Solana et restructure la configuration sur la nouvelle fondation. -- renommer les dix crates généralistes : `kb-core`, `kb-config`, `kb-lib`, `kb-logging`, `kb-program-ids`, `kb-pipeline`, `kb-pipeline-demo-scenarios`, `kb-onchain-transport`, `kb-store` et `kb-wallet` vers leurs équivalents `ks-*` ; +- renommer les dix crates généralistes : `ks-core`, `ks-config`, `ks-lib`, `ks-logging`, `ks-program-ids`, `ks-pipeline`, `ks-pipeline-demo-scenarios`, `ks-onchain-transport`, `ks-store` et `ks-wallet` vers leurs équivalents `ks-*` ; - migrer les identifiants Rust correspondants vers `ks_*`, les manifests, chemins, imports, exports, tests externes, scripts et documentation ; - conserver `kb-app-demo-desktop` comme application du domaine Bot, consommatrice des composants `ks-*` ; - migrer les identités runtime/persistées généralistes vers la nomenclature `ks-*`, notamment `ks-lib-decoder.*`, `ks-lib-materializer.*` et `ks-lib-executor.*`, après inventaire exhaustif des chaînes concernées ; diff --git a/config/README.md b/config/README.md index ec3f615..fe53ddc 100644 --- a/config/README.md +++ b/config/README.md @@ -1,5 +1,5 @@ - + # Configuration locale @@ -13,7 +13,7 @@ Ce dossier contient les exemples et le schéma de configuration JSON. - Un profil actif doit être présent et unique. - Les profils non actifs peuvent rester dans le fichier pour les tests devnet, mainnet lecture seule, backfill ou future production. - Le contrat courant couvre HTTP JSON-RPC Solana et WebSocket JSON-RPC générique. -- Helius `transactionSubscribe` et Yellowstone gRPC seront ajoutés plus tard dans `kb_onchain_transport`, avec évolution explicite du schéma quand les transports seront réellement utilisés. +- Helius `transactionSubscribe` et Yellowstone gRPC seront ajoutés plus tard dans `ks_onchain_transport`, avec évolution explicite du schéma quand les transports seront réellement utilisés. - Les IDLs restent des artefacts de développement et ne font pas partie de la configuration runtime. ## Fichiers @@ -67,13 +67,13 @@ L’exemple configure, pour chacun des trois profils, quatre fichiers globaux pu Les matérialisateurs natifs consolidés rejoignent la console et disposent de leurs routes propres sous : ```text -logs//kb-lib/materializer/admin/ -logs//kb-lib/materializer/compliance/audit/ -logs//kb-lib/materializer/lifecycle/ -logs//kb-lib/materializer/risk/ -logs//kb-lib/materializer/staking/ -logs//kb-lib/materializer/token/accounts/ -logs//kb-lib/materializer/transaction/annotations/ +logs//ks-lib/materializer/admin/ +logs//ks-lib/materializer/compliance/audit/ +logs//ks-lib/materializer/lifecycle/ +logs//ks-lib/materializer/risk/ +logs//ks-lib/materializer/staking/ +logs//ks-lib/materializer/token/accounts/ +logs//ks-lib/materializer/transaction/annotations/ ``` Le test de configuration découvre dynamiquement toutes les crates déclarant `tracing.workspace = true` et vérifie leurs trois routes dans chaque profil. Les logs ne doivent contenir ni secret, ni DSN non masqué, ni payload Config ou bytecode complet. diff --git a/config/example.config.json b/config/example.config.json index e530029..01291e4 100644 --- a/config/example.config.json +++ b/config/example.config.json @@ -77,42 +77,42 @@ ] }, { - "name": "file_kb_lib_local_devnet_debug", + "name": "file_ks_lib_local_devnet_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/debug.log", + "path": "logs/devnet/ks-lib/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-lib" + "ks-lib" ] }, { - "name": "file_kb_lib_local_devnet_info", + "name": "file_ks_lib_local_devnet_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/info.log", + "path": "logs/devnet/ks-lib/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-lib" + "ks-lib" ] }, { - "name": "file_kb_lib_local_devnet_error", + "name": "file_ks_lib_local_devnet_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/error.jsonl", + "path": "logs/devnet/ks-lib/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-lib" + "ks-lib" ] }, { @@ -155,11 +155,11 @@ ] }, { - "name": "file_kb-lib_decoder_solana_core_debug", + "name": "file_ks-lib_decoder_solana_core_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/decoder/solana/core/debug.log", + "path": "logs/devnet/ks-lib/decoder/solana/core/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -168,11 +168,11 @@ ] }, { - "name": "file_kb-lib_decoder_solana_core_info", + "name": "file_ks-lib_decoder_solana_core_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/decoder/solana/core/info.log", + "path": "logs/devnet/ks-lib/decoder/solana/core/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -181,11 +181,11 @@ ] }, { - "name": "file_kb-lib_decoder_solana_core_error", + "name": "file_ks-lib_decoder_solana_core_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/decoder/solana/core/error.jsonl", + "path": "logs/devnet/ks-lib/decoder/solana/core/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -194,11 +194,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_memo_debug", + "name": "file_ks-lib_decoder_spl_memo_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/decoder/spl/memo/debug.log", + "path": "logs/devnet/ks-lib/decoder/spl/memo/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -207,11 +207,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_memo_info", + "name": "file_ks-lib_decoder_spl_memo_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/decoder/spl/memo/info.log", + "path": "logs/devnet/ks-lib/decoder/spl/memo/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -220,11 +220,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_memo_error", + "name": "file_ks-lib_decoder_spl_memo_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/decoder/spl/memo/error.jsonl", + "path": "logs/devnet/ks-lib/decoder/spl/memo/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -233,11 +233,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_associated_token_account_debug", + "name": "file_ks-lib_decoder_spl_associated_token_account_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/decoder/spl/associated_token_account/debug.log", + "path": "logs/devnet/ks-lib/decoder/spl/associated_token_account/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -246,11 +246,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_associated_token_account_info", + "name": "file_ks-lib_decoder_spl_associated_token_account_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/decoder/spl/associated_token_account/info.log", + "path": "logs/devnet/ks-lib/decoder/spl/associated_token_account/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -259,11 +259,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_associated_token_account_error", + "name": "file_ks-lib_decoder_spl_associated_token_account_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/decoder/spl/associated_token_account/error.jsonl", + "path": "logs/devnet/ks-lib/decoder/spl/associated_token_account/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -272,11 +272,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_debug", + "name": "file_ks-lib_decoder_spl_token_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/decoder/spl/token/debug.log", + "path": "logs/devnet/ks-lib/decoder/spl/token/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -285,11 +285,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_info", + "name": "file_ks-lib_decoder_spl_token_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/decoder/spl/token/info.log", + "path": "logs/devnet/ks-lib/decoder/spl/token/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -298,11 +298,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_error", + "name": "file_ks-lib_decoder_spl_token_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/decoder/spl/token/error.jsonl", + "path": "logs/devnet/ks-lib/decoder/spl/token/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -311,11 +311,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_core_debug", + "name": "file_ks-lib_executor_solana_core_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/executor/solana/core/debug.log", + "path": "logs/devnet/ks-lib/executor/solana/core/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -324,11 +324,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_core_info", + "name": "file_ks-lib_executor_solana_core_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/executor/solana/core/info.log", + "path": "logs/devnet/ks-lib/executor/solana/core/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -337,11 +337,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_core_error", + "name": "file_ks-lib_executor_solana_core_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/executor/solana/core/error.jsonl", + "path": "logs/devnet/ks-lib/executor/solana/core/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -350,11 +350,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_transaction_debug", + "name": "file_ks-lib_executor_solana_transaction_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/executor/solana/transaction/debug.log", + "path": "logs/devnet/ks-lib/executor/solana/transaction/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -363,11 +363,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_transaction_info", + "name": "file_ks-lib_executor_solana_transaction_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/executor/solana/transaction/info.log", + "path": "logs/devnet/ks-lib/executor/solana/transaction/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -376,11 +376,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_transaction_error", + "name": "file_ks-lib_executor_solana_transaction_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/executor/solana/transaction/error.jsonl", + "path": "logs/devnet/ks-lib/executor/solana/transaction/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -389,11 +389,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_memo_debug", + "name": "file_ks-lib_executor_spl_memo_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/executor/spl/memo/debug.log", + "path": "logs/devnet/ks-lib/executor/spl/memo/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -402,11 +402,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_memo_info", + "name": "file_ks-lib_executor_spl_memo_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/executor/spl/memo/info.log", + "path": "logs/devnet/ks-lib/executor/spl/memo/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -415,11 +415,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_memo_error", + "name": "file_ks-lib_executor_spl_memo_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/executor/spl/memo/error.jsonl", + "path": "logs/devnet/ks-lib/executor/spl/memo/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -428,11 +428,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_associated_token_account_debug", + "name": "file_ks-lib_executor_spl_associated_token_account_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/executor/spl/associated_token_account/debug.log", + "path": "logs/devnet/ks-lib/executor/spl/associated_token_account/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -441,11 +441,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_associated_token_account_info", + "name": "file_ks-lib_executor_spl_associated_token_account_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/executor/spl/associated_token_account/info.log", + "path": "logs/devnet/ks-lib/executor/spl/associated_token_account/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -454,11 +454,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_associated_token_account_error", + "name": "file_ks-lib_executor_spl_associated_token_account_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/executor/spl/associated_token_account/error.jsonl", + "path": "logs/devnet/ks-lib/executor/spl/associated_token_account/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -467,11 +467,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_debug", + "name": "file_ks-lib_executor_spl_token_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/executor/spl/token/debug.log", + "path": "logs/devnet/ks-lib/executor/spl/token/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -480,11 +480,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_info", + "name": "file_ks-lib_executor_spl_token_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/executor/spl/token/info.log", + "path": "logs/devnet/ks-lib/executor/spl/token/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -493,11 +493,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_error", + "name": "file_ks-lib_executor_spl_token_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/executor/spl/token/error.jsonl", + "path": "logs/devnet/ks-lib/executor/spl/token/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -506,50 +506,50 @@ ] }, { - "name": "file_kb_logging_debug", + "name": "file_ks_logging_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-logging/debug.log", + "path": "logs/devnet/ks-logging/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-logging" + "ks-logging" ] }, { - "name": "file_kb_logging_info", + "name": "file_ks_logging_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-logging/info.log", + "path": "logs/devnet/ks-logging/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-logging" + "ks-logging" ] }, { - "name": "file_kb_logging_error", + "name": "file_ks_logging_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-logging/error.jsonl", + "path": "logs/devnet/ks-logging/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-logging" + "ks-logging" ] }, { - "name": "file_kb-lib_materializer_admin_debug", + "name": "file_ks-lib_materializer_admin_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/materializer/admin/debug.log", + "path": "logs/devnet/ks-lib/materializer/admin/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -558,11 +558,11 @@ ] }, { - "name": "file_kb-lib_materializer_admin_info", + "name": "file_ks-lib_materializer_admin_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/materializer/admin/info.log", + "path": "logs/devnet/ks-lib/materializer/admin/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -571,11 +571,11 @@ ] }, { - "name": "file_kb-lib_materializer_admin_error", + "name": "file_ks-lib_materializer_admin_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/materializer/admin/error.jsonl", + "path": "logs/devnet/ks-lib/materializer/admin/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -584,11 +584,11 @@ ] }, { - "name": "file_kb-lib_materializer_compliance_audit_debug", + "name": "file_ks-lib_materializer_compliance_audit_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/materializer/compliance/audit/debug.log", + "path": "logs/devnet/ks-lib/materializer/compliance/audit/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -597,11 +597,11 @@ ] }, { - "name": "file_kb-lib_materializer_compliance_audit_info", + "name": "file_ks-lib_materializer_compliance_audit_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/materializer/compliance/audit/info.log", + "path": "logs/devnet/ks-lib/materializer/compliance/audit/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -610,11 +610,11 @@ ] }, { - "name": "file_kb-lib_materializer_compliance_audit_error", + "name": "file_ks-lib_materializer_compliance_audit_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/materializer/compliance/audit/error.jsonl", + "path": "logs/devnet/ks-lib/materializer/compliance/audit/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -623,11 +623,11 @@ ] }, { - "name": "file_kb-lib_materializer_lifecycle_debug", + "name": "file_ks-lib_materializer_lifecycle_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/materializer/lifecycle/debug.log", + "path": "logs/devnet/ks-lib/materializer/lifecycle/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -636,11 +636,11 @@ ] }, { - "name": "file_kb-lib_materializer_lifecycle_info", + "name": "file_ks-lib_materializer_lifecycle_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/materializer/lifecycle/info.log", + "path": "logs/devnet/ks-lib/materializer/lifecycle/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -649,11 +649,11 @@ ] }, { - "name": "file_kb-lib_materializer_lifecycle_error", + "name": "file_ks-lib_materializer_lifecycle_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/materializer/lifecycle/error.jsonl", + "path": "logs/devnet/ks-lib/materializer/lifecycle/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -662,11 +662,11 @@ ] }, { - "name": "file_kb-lib_materializer_transaction_annotations_debug", + "name": "file_ks-lib_materializer_transaction_annotations_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/materializer/transaction/annotations/debug.log", + "path": "logs/devnet/ks-lib/materializer/transaction/annotations/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -675,11 +675,11 @@ ] }, { - "name": "file_kb-lib_materializer_transaction_annotations_info", + "name": "file_ks-lib_materializer_transaction_annotations_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/materializer/transaction/annotations/info.log", + "path": "logs/devnet/ks-lib/materializer/transaction/annotations/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -688,11 +688,11 @@ ] }, { - "name": "file_kb-lib_materializer_transaction_annotations_error", + "name": "file_ks-lib_materializer_transaction_annotations_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/materializer/transaction/annotations/error.jsonl", + "path": "logs/devnet/ks-lib/materializer/transaction/annotations/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -701,11 +701,11 @@ ] }, { - "name": "file_kb-lib_materializer_staking_debug", + "name": "file_ks-lib_materializer_staking_debug", "enabled": true, "level": "debug", "format": "human", - "path": "logs/devnet/kb-lib/materializer/staking/debug.log", + "path": "logs/devnet/ks-lib/materializer/staking/debug.log", "targets": [ "kb-lib.materializer.staking" ], @@ -714,11 +714,11 @@ "ansi": false }, { - "name": "file_kb-lib_materializer_staking_info", + "name": "file_ks-lib_materializer_staking_info", "enabled": true, "level": "info", "format": "human", - "path": "logs/devnet/kb-lib/materializer/staking/info.log", + "path": "logs/devnet/ks-lib/materializer/staking/info.log", "targets": [ "kb-lib.materializer.staking" ], @@ -727,11 +727,11 @@ "ansi": false }, { - "name": "file_kb-lib_materializer_staking_error", + "name": "file_ks-lib_materializer_staking_error", "enabled": true, "level": "error", "format": "json", - "path": "logs/devnet/kb-lib/materializer/staking/error.jsonl", + "path": "logs/devnet/ks-lib/materializer/staking/error.jsonl", "targets": [ "kb-lib.materializer.staking" ], @@ -740,170 +740,170 @@ "ansi": false }, { - "name": "file_kb-pipeline_debug", + "name": "file_ks-pipeline_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-pipeline/debug.log", + "path": "logs/devnet/ks-pipeline/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-pipeline", - "kb-pipeline-demo-scenarios" + "ks-pipeline", + "ks-pipeline-demo-scenarios" ] }, { - "name": "file_kb-pipeline_info", + "name": "file_ks-pipeline_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-pipeline/info.log", + "path": "logs/devnet/ks-pipeline/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-pipeline", - "kb-pipeline-demo-scenarios" + "ks-pipeline", + "ks-pipeline-demo-scenarios" ] }, { - "name": "file_kb-pipeline_error", + "name": "file_ks-pipeline_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-pipeline/error.jsonl", + "path": "logs/devnet/ks-pipeline/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-pipeline", - "kb-pipeline-demo-scenarios" + "ks-pipeline", + "ks-pipeline-demo-scenarios" ] }, { - "name": "file_kb-onchain-transport_debug", + "name": "file_ks-onchain-transport_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-onchain-transport/debug.log", + "path": "logs/devnet/ks-onchain-transport/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-onchain-transport" + "ks-onchain-transport" ] }, { - "name": "file_kb-onchain-transport_info", + "name": "file_ks-onchain-transport_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-onchain-transport/info.log", + "path": "logs/devnet/ks-onchain-transport/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-onchain-transport" + "ks-onchain-transport" ] }, { - "name": "file_kb-onchain-transport_error", + "name": "file_ks-onchain-transport_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-onchain-transport/error.jsonl", + "path": "logs/devnet/ks-onchain-transport/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-onchain-transport" + "ks-onchain-transport" ] }, { - "name": "file_kb-store_debug", + "name": "file_ks-store_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-store/debug.log", + "path": "logs/devnet/ks-store/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-store" + "ks-store" ] }, { - "name": "file_kb-store_info", + "name": "file_ks-store_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-store/info.log", + "path": "logs/devnet/ks-store/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-store" + "ks-store" ] }, { - "name": "file_kb-store_error", + "name": "file_ks-store_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-store/error.jsonl", + "path": "logs/devnet/ks-store/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-store" + "ks-store" ] }, { - "name": "file_kb_wallet_debug", + "name": "file_ks_wallet_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-wallet/debug.log", + "path": "logs/devnet/ks-wallet/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-wallet" + "ks-wallet" ] }, { - "name": "file_kb_wallet_info", + "name": "file_ks_wallet_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-wallet/info.log", + "path": "logs/devnet/ks-wallet/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-wallet" + "ks-wallet" ] }, { - "name": "file_kb_wallet_error", + "name": "file_ks_wallet_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-wallet/error.jsonl", + "path": "logs/devnet/ks-wallet/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-wallet" + "ks-wallet" ] }, { - "name": "file_kb-lib_materializer_token_accounts_debug", + "name": "file_ks-lib_materializer_token_accounts_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/materializer/token/accounts/debug.log", + "path": "logs/devnet/ks-lib/materializer/token/accounts/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -912,11 +912,11 @@ ] }, { - "name": "file_kb-lib_materializer_token_accounts_info", + "name": "file_ks-lib_materializer_token_accounts_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/materializer/token/accounts/info.log", + "path": "logs/devnet/ks-lib/materializer/token/accounts/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -925,11 +925,11 @@ ] }, { - "name": "file_kb-lib_materializer_token_accounts_error", + "name": "file_ks-lib_materializer_token_accounts_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/materializer/token/accounts/error.jsonl", + "path": "logs/devnet/ks-lib/materializer/token/accounts/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -938,11 +938,11 @@ ] }, { - "name": "file_kb-lib_materializer_risk_debug", + "name": "file_ks-lib_materializer_risk_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/materializer/risk/debug.log", + "path": "logs/devnet/ks-lib/materializer/risk/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -951,11 +951,11 @@ ] }, { - "name": "file_kb-lib_materializer_risk_info", + "name": "file_ks-lib_materializer_risk_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/materializer/risk/info.log", + "path": "logs/devnet/ks-lib/materializer/risk/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -964,11 +964,11 @@ ] }, { - "name": "file_kb-lib_materializer_risk_error", + "name": "file_ks-lib_materializer_risk_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/materializer/risk/error.jsonl", + "path": "logs/devnet/ks-lib/materializer/risk/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -977,11 +977,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_2022_debug", + "name": "file_ks-lib_decoder_spl_token_2022_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/decoder/spl/token_2022/debug.log", + "path": "logs/devnet/ks-lib/decoder/spl/token_2022/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -990,11 +990,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_2022_info", + "name": "file_ks-lib_decoder_spl_token_2022_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/decoder/spl/token_2022/info.log", + "path": "logs/devnet/ks-lib/decoder/spl/token_2022/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1003,11 +1003,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_2022_error", + "name": "file_ks-lib_decoder_spl_token_2022_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/decoder/spl/token_2022/error.jsonl", + "path": "logs/devnet/ks-lib/decoder/spl/token_2022/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -1016,11 +1016,11 @@ ] }, { - "name": "file_kb-lib_decoder_metadata_metaplex_token_metadata_debug", + "name": "file_ks-lib_decoder_metadata_metaplex_token_metadata_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/decoder/metadata/metaplex_token_metadata/debug.log", + "path": "logs/devnet/ks-lib/decoder/metadata/metaplex_token_metadata/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1029,11 +1029,11 @@ ] }, { - "name": "file_kb-lib_decoder_metadata_metaplex_token_metadata_info", + "name": "file_ks-lib_decoder_metadata_metaplex_token_metadata_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/decoder/metadata/metaplex_token_metadata/info.log", + "path": "logs/devnet/ks-lib/decoder/metadata/metaplex_token_metadata/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1042,11 +1042,11 @@ ] }, { - "name": "file_kb-lib_decoder_metadata_metaplex_token_metadata_error", + "name": "file_ks-lib_decoder_metadata_metaplex_token_metadata_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/decoder/metadata/metaplex_token_metadata/error.jsonl", + "path": "logs/devnet/ks-lib/decoder/metadata/metaplex_token_metadata/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -1055,11 +1055,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_elgamal_registry_debug", + "name": "file_ks-lib_decoder_spl_elgamal_registry_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/decoder/spl/elgamal_registry/debug.log", + "path": "logs/devnet/ks-lib/decoder/spl/elgamal_registry/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1068,11 +1068,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_elgamal_registry_info", + "name": "file_ks-lib_decoder_spl_elgamal_registry_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/decoder/spl/elgamal_registry/info.log", + "path": "logs/devnet/ks-lib/decoder/spl/elgamal_registry/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1081,11 +1081,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_elgamal_registry_error", + "name": "file_ks-lib_decoder_spl_elgamal_registry_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/decoder/spl/elgamal_registry/error.jsonl", + "path": "logs/devnet/ks-lib/decoder/spl/elgamal_registry/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -1094,11 +1094,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_elgamal_registry_debug", + "name": "file_ks-lib_executor_spl_elgamal_registry_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/executor/spl/elgamal_registry/debug.log", + "path": "logs/devnet/ks-lib/executor/spl/elgamal_registry/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1107,11 +1107,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_elgamal_registry_info", + "name": "file_ks-lib_executor_spl_elgamal_registry_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/executor/spl/elgamal_registry/info.log", + "path": "logs/devnet/ks-lib/executor/spl/elgamal_registry/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1120,11 +1120,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_elgamal_registry_error", + "name": "file_ks-lib_executor_spl_elgamal_registry_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/executor/spl/elgamal_registry/error.jsonl", + "path": "logs/devnet/ks-lib/executor/spl/elgamal_registry/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -1133,11 +1133,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_2022_debug", + "name": "file_ks-lib_executor_spl_token_2022_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/devnet/kb-lib/executor/spl/token_2022/debug.log", + "path": "logs/devnet/ks-lib/executor/spl/token_2022/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1146,11 +1146,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_2022_info", + "name": "file_ks-lib_executor_spl_token_2022_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/devnet/kb-lib/executor/spl/token_2022/info.log", + "path": "logs/devnet/ks-lib/executor/spl/token_2022/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1159,11 +1159,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_2022_error", + "name": "file_ks-lib_executor_spl_token_2022_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/devnet/kb-lib/executor/spl/token_2022/error.jsonl", + "path": "logs/devnet/ks-lib/executor/spl/token_2022/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -1495,42 +1495,42 @@ ] }, { - "name": "file_kb_lib_mainnet_research_debug", + "name": "file_ks_lib_mainnet_research_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/debug.log", + "path": "logs/mainnet_research/ks-lib/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-lib" + "ks-lib" ] }, { - "name": "file_kb_lib_mainnet_research_info", + "name": "file_ks_lib_mainnet_research_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/info.log", + "path": "logs/mainnet_research/ks-lib/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-lib" + "ks-lib" ] }, { - "name": "file_kb_lib_mainnet_research_error", + "name": "file_ks_lib_mainnet_research_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/error.jsonl", + "path": "logs/mainnet_research/ks-lib/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-lib" + "ks-lib" ] }, { @@ -1573,11 +1573,11 @@ ] }, { - "name": "file_kb-lib_decoder_solana_core_debug", + "name": "file_ks-lib_decoder_solana_core_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/decoder/solana/core/debug.log", + "path": "logs/mainnet_research/ks-lib/decoder/solana/core/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1586,11 +1586,11 @@ ] }, { - "name": "file_kb-lib_decoder_solana_core_info", + "name": "file_ks-lib_decoder_solana_core_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/decoder/solana/core/info.log", + "path": "logs/mainnet_research/ks-lib/decoder/solana/core/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1599,11 +1599,11 @@ ] }, { - "name": "file_kb-lib_decoder_solana_core_error", + "name": "file_ks-lib_decoder_solana_core_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/decoder/solana/core/error.jsonl", + "path": "logs/mainnet_research/ks-lib/decoder/solana/core/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -1612,11 +1612,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_memo_debug", + "name": "file_ks-lib_decoder_spl_memo_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/decoder/spl/memo/debug.log", + "path": "logs/mainnet_research/ks-lib/decoder/spl/memo/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1625,11 +1625,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_memo_info", + "name": "file_ks-lib_decoder_spl_memo_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/decoder/spl/memo/info.log", + "path": "logs/mainnet_research/ks-lib/decoder/spl/memo/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1638,11 +1638,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_memo_error", + "name": "file_ks-lib_decoder_spl_memo_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/decoder/spl/memo/error.jsonl", + "path": "logs/mainnet_research/ks-lib/decoder/spl/memo/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -1651,11 +1651,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_associated_token_account_debug", + "name": "file_ks-lib_decoder_spl_associated_token_account_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/decoder/spl/associated_token_account/debug.log", + "path": "logs/mainnet_research/ks-lib/decoder/spl/associated_token_account/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1664,11 +1664,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_associated_token_account_info", + "name": "file_ks-lib_decoder_spl_associated_token_account_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/decoder/spl/associated_token_account/info.log", + "path": "logs/mainnet_research/ks-lib/decoder/spl/associated_token_account/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1677,11 +1677,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_associated_token_account_error", + "name": "file_ks-lib_decoder_spl_associated_token_account_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/decoder/spl/associated_token_account/error.jsonl", + "path": "logs/mainnet_research/ks-lib/decoder/spl/associated_token_account/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -1690,11 +1690,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_debug", + "name": "file_ks-lib_decoder_spl_token_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/decoder/spl/token/debug.log", + "path": "logs/mainnet_research/ks-lib/decoder/spl/token/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1703,11 +1703,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_info", + "name": "file_ks-lib_decoder_spl_token_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/decoder/spl/token/info.log", + "path": "logs/mainnet_research/ks-lib/decoder/spl/token/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1716,11 +1716,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_error", + "name": "file_ks-lib_decoder_spl_token_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/decoder/spl/token/error.jsonl", + "path": "logs/mainnet_research/ks-lib/decoder/spl/token/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -1729,11 +1729,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_core_debug", + "name": "file_ks-lib_executor_solana_core_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/executor/solana/core/debug.log", + "path": "logs/mainnet_research/ks-lib/executor/solana/core/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1742,11 +1742,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_core_info", + "name": "file_ks-lib_executor_solana_core_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/executor/solana/core/info.log", + "path": "logs/mainnet_research/ks-lib/executor/solana/core/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1755,11 +1755,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_core_error", + "name": "file_ks-lib_executor_solana_core_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/executor/solana/core/error.jsonl", + "path": "logs/mainnet_research/ks-lib/executor/solana/core/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -1768,11 +1768,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_transaction_debug", + "name": "file_ks-lib_executor_solana_transaction_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/executor/solana/transaction/debug.log", + "path": "logs/mainnet_research/ks-lib/executor/solana/transaction/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1781,11 +1781,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_transaction_info", + "name": "file_ks-lib_executor_solana_transaction_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/executor/solana/transaction/info.log", + "path": "logs/mainnet_research/ks-lib/executor/solana/transaction/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1794,11 +1794,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_transaction_error", + "name": "file_ks-lib_executor_solana_transaction_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/executor/solana/transaction/error.jsonl", + "path": "logs/mainnet_research/ks-lib/executor/solana/transaction/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -1807,11 +1807,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_memo_debug", + "name": "file_ks-lib_executor_spl_memo_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/executor/spl/memo/debug.log", + "path": "logs/mainnet_research/ks-lib/executor/spl/memo/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1820,11 +1820,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_memo_info", + "name": "file_ks-lib_executor_spl_memo_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/executor/spl/memo/info.log", + "path": "logs/mainnet_research/ks-lib/executor/spl/memo/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1833,11 +1833,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_memo_error", + "name": "file_ks-lib_executor_spl_memo_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/executor/spl/memo/error.jsonl", + "path": "logs/mainnet_research/ks-lib/executor/spl/memo/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -1846,11 +1846,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_associated_token_account_debug", + "name": "file_ks-lib_executor_spl_associated_token_account_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/executor/spl/associated_token_account/debug.log", + "path": "logs/mainnet_research/ks-lib/executor/spl/associated_token_account/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1859,11 +1859,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_associated_token_account_info", + "name": "file_ks-lib_executor_spl_associated_token_account_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/executor/spl/associated_token_account/info.log", + "path": "logs/mainnet_research/ks-lib/executor/spl/associated_token_account/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1872,11 +1872,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_associated_token_account_error", + "name": "file_ks-lib_executor_spl_associated_token_account_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/executor/spl/associated_token_account/error.jsonl", + "path": "logs/mainnet_research/ks-lib/executor/spl/associated_token_account/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -1885,11 +1885,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_debug", + "name": "file_ks-lib_executor_spl_token_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/executor/spl/token/debug.log", + "path": "logs/mainnet_research/ks-lib/executor/spl/token/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1898,11 +1898,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_info", + "name": "file_ks-lib_executor_spl_token_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/executor/spl/token/info.log", + "path": "logs/mainnet_research/ks-lib/executor/spl/token/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1911,11 +1911,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_error", + "name": "file_ks-lib_executor_spl_token_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/executor/spl/token/error.jsonl", + "path": "logs/mainnet_research/ks-lib/executor/spl/token/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -1924,50 +1924,50 @@ ] }, { - "name": "file_kb_logging_debug", + "name": "file_ks_logging_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-logging/debug.log", + "path": "logs/mainnet_research/ks-logging/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-logging" + "ks-logging" ] }, { - "name": "file_kb_logging_info", + "name": "file_ks_logging_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-logging/info.log", + "path": "logs/mainnet_research/ks-logging/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-logging" + "ks-logging" ] }, { - "name": "file_kb_logging_error", + "name": "file_ks_logging_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-logging/error.jsonl", + "path": "logs/mainnet_research/ks-logging/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-logging" + "ks-logging" ] }, { - "name": "file_kb-lib_materializer_admin_debug", + "name": "file_ks-lib_materializer_admin_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/materializer/admin/debug.log", + "path": "logs/mainnet_research/ks-lib/materializer/admin/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1976,11 +1976,11 @@ ] }, { - "name": "file_kb-lib_materializer_admin_info", + "name": "file_ks-lib_materializer_admin_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/materializer/admin/info.log", + "path": "logs/mainnet_research/ks-lib/materializer/admin/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -1989,11 +1989,11 @@ ] }, { - "name": "file_kb-lib_materializer_admin_error", + "name": "file_ks-lib_materializer_admin_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/materializer/admin/error.jsonl", + "path": "logs/mainnet_research/ks-lib/materializer/admin/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -2002,11 +2002,11 @@ ] }, { - "name": "file_kb-lib_materializer_compliance_audit_debug", + "name": "file_ks-lib_materializer_compliance_audit_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/materializer/compliance/audit/debug.log", + "path": "logs/mainnet_research/ks-lib/materializer/compliance/audit/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2015,11 +2015,11 @@ ] }, { - "name": "file_kb-lib_materializer_compliance_audit_info", + "name": "file_ks-lib_materializer_compliance_audit_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/materializer/compliance/audit/info.log", + "path": "logs/mainnet_research/ks-lib/materializer/compliance/audit/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2028,11 +2028,11 @@ ] }, { - "name": "file_kb-lib_materializer_compliance_audit_error", + "name": "file_ks-lib_materializer_compliance_audit_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/materializer/compliance/audit/error.jsonl", + "path": "logs/mainnet_research/ks-lib/materializer/compliance/audit/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -2041,11 +2041,11 @@ ] }, { - "name": "file_kb-lib_materializer_lifecycle_debug", + "name": "file_ks-lib_materializer_lifecycle_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/materializer/lifecycle/debug.log", + "path": "logs/mainnet_research/ks-lib/materializer/lifecycle/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2054,11 +2054,11 @@ ] }, { - "name": "file_kb-lib_materializer_lifecycle_info", + "name": "file_ks-lib_materializer_lifecycle_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/materializer/lifecycle/info.log", + "path": "logs/mainnet_research/ks-lib/materializer/lifecycle/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2067,11 +2067,11 @@ ] }, { - "name": "file_kb-lib_materializer_lifecycle_error", + "name": "file_ks-lib_materializer_lifecycle_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/materializer/lifecycle/error.jsonl", + "path": "logs/mainnet_research/ks-lib/materializer/lifecycle/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -2080,11 +2080,11 @@ ] }, { - "name": "file_kb-lib_materializer_transaction_annotations_debug", + "name": "file_ks-lib_materializer_transaction_annotations_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/materializer/transaction/annotations/debug.log", + "path": "logs/mainnet_research/ks-lib/materializer/transaction/annotations/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2093,11 +2093,11 @@ ] }, { - "name": "file_kb-lib_materializer_transaction_annotations_info", + "name": "file_ks-lib_materializer_transaction_annotations_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/materializer/transaction/annotations/info.log", + "path": "logs/mainnet_research/ks-lib/materializer/transaction/annotations/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2106,11 +2106,11 @@ ] }, { - "name": "file_kb-lib_materializer_transaction_annotations_error", + "name": "file_ks-lib_materializer_transaction_annotations_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/materializer/transaction/annotations/error.jsonl", + "path": "logs/mainnet_research/ks-lib/materializer/transaction/annotations/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -2119,11 +2119,11 @@ ] }, { - "name": "file_kb-lib_materializer_staking_debug", + "name": "file_ks-lib_materializer_staking_debug", "enabled": true, "level": "debug", "format": "human", - "path": "logs/mainnet_research/kb-lib/materializer/staking/debug.log", + "path": "logs/mainnet_research/ks-lib/materializer/staking/debug.log", "targets": [ "kb-lib.materializer.staking" ], @@ -2132,11 +2132,11 @@ "ansi": false }, { - "name": "file_kb-lib_materializer_staking_info", + "name": "file_ks-lib_materializer_staking_info", "enabled": true, "level": "info", "format": "human", - "path": "logs/mainnet_research/kb-lib/materializer/staking/info.log", + "path": "logs/mainnet_research/ks-lib/materializer/staking/info.log", "targets": [ "kb-lib.materializer.staking" ], @@ -2145,11 +2145,11 @@ "ansi": false }, { - "name": "file_kb-lib_materializer_staking_error", + "name": "file_ks-lib_materializer_staking_error", "enabled": true, "level": "error", "format": "json", - "path": "logs/mainnet_research/kb-lib/materializer/staking/error.jsonl", + "path": "logs/mainnet_research/ks-lib/materializer/staking/error.jsonl", "targets": [ "kb-lib.materializer.staking" ], @@ -2158,170 +2158,170 @@ "ansi": false }, { - "name": "file_kb-pipeline_debug", + "name": "file_ks-pipeline_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-pipeline/debug.log", + "path": "logs/mainnet_research/ks-pipeline/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-pipeline", - "kb-pipeline-demo-scenarios" + "ks-pipeline", + "ks-pipeline-demo-scenarios" ] }, { - "name": "file_kb-pipeline_info", + "name": "file_ks-pipeline_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-pipeline/info.log", + "path": "logs/mainnet_research/ks-pipeline/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-pipeline", - "kb-pipeline-demo-scenarios" + "ks-pipeline", + "ks-pipeline-demo-scenarios" ] }, { - "name": "file_kb-pipeline_error", + "name": "file_ks-pipeline_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-pipeline/error.jsonl", + "path": "logs/mainnet_research/ks-pipeline/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-pipeline", - "kb-pipeline-demo-scenarios" + "ks-pipeline", + "ks-pipeline-demo-scenarios" ] }, { - "name": "file_kb-onchain-transport_debug", + "name": "file_ks-onchain-transport_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-onchain-transport/debug.log", + "path": "logs/mainnet_research/ks-onchain-transport/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-onchain-transport" + "ks-onchain-transport" ] }, { - "name": "file_kb-onchain-transport_info", + "name": "file_ks-onchain-transport_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-onchain-transport/info.log", + "path": "logs/mainnet_research/ks-onchain-transport/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-onchain-transport" + "ks-onchain-transport" ] }, { - "name": "file_kb-onchain-transport_error", + "name": "file_ks-onchain-transport_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-onchain-transport/error.jsonl", + "path": "logs/mainnet_research/ks-onchain-transport/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-onchain-transport" + "ks-onchain-transport" ] }, { - "name": "file_kb-store_debug", + "name": "file_ks-store_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-store/debug.log", + "path": "logs/mainnet_research/ks-store/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-store" + "ks-store" ] }, { - "name": "file_kb-store_info", + "name": "file_ks-store_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-store/info.log", + "path": "logs/mainnet_research/ks-store/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-store" + "ks-store" ] }, { - "name": "file_kb-store_error", + "name": "file_ks-store_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-store/error.jsonl", + "path": "logs/mainnet_research/ks-store/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-store" + "ks-store" ] }, { - "name": "file_kb_wallet_debug", + "name": "file_ks_wallet_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-wallet/debug.log", + "path": "logs/mainnet_research/ks-wallet/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-wallet" + "ks-wallet" ] }, { - "name": "file_kb_wallet_info", + "name": "file_ks_wallet_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-wallet/info.log", + "path": "logs/mainnet_research/ks-wallet/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-wallet" + "ks-wallet" ] }, { - "name": "file_kb_wallet_error", + "name": "file_ks_wallet_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-wallet/error.jsonl", + "path": "logs/mainnet_research/ks-wallet/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-wallet" + "ks-wallet" ] }, { - "name": "file_kb-lib_materializer_token_accounts_debug", + "name": "file_ks-lib_materializer_token_accounts_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/materializer/token/accounts/debug.log", + "path": "logs/mainnet_research/ks-lib/materializer/token/accounts/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2330,11 +2330,11 @@ ] }, { - "name": "file_kb-lib_materializer_token_accounts_info", + "name": "file_ks-lib_materializer_token_accounts_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/materializer/token/accounts/info.log", + "path": "logs/mainnet_research/ks-lib/materializer/token/accounts/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2343,11 +2343,11 @@ ] }, { - "name": "file_kb-lib_materializer_token_accounts_error", + "name": "file_ks-lib_materializer_token_accounts_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/materializer/token/accounts/error.jsonl", + "path": "logs/mainnet_research/ks-lib/materializer/token/accounts/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -2356,11 +2356,11 @@ ] }, { - "name": "file_kb-lib_materializer_risk_debug", + "name": "file_ks-lib_materializer_risk_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/materializer/risk/debug.log", + "path": "logs/mainnet_research/ks-lib/materializer/risk/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2369,11 +2369,11 @@ ] }, { - "name": "file_kb-lib_materializer_risk_info", + "name": "file_ks-lib_materializer_risk_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/materializer/risk/info.log", + "path": "logs/mainnet_research/ks-lib/materializer/risk/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2382,11 +2382,11 @@ ] }, { - "name": "file_kb-lib_materializer_risk_error", + "name": "file_ks-lib_materializer_risk_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/materializer/risk/error.jsonl", + "path": "logs/mainnet_research/ks-lib/materializer/risk/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -2395,11 +2395,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_2022_debug", + "name": "file_ks-lib_decoder_spl_token_2022_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/decoder/spl/token_2022/debug.log", + "path": "logs/mainnet_research/ks-lib/decoder/spl/token_2022/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2408,11 +2408,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_2022_info", + "name": "file_ks-lib_decoder_spl_token_2022_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/decoder/spl/token_2022/info.log", + "path": "logs/mainnet_research/ks-lib/decoder/spl/token_2022/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2421,11 +2421,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_2022_error", + "name": "file_ks-lib_decoder_spl_token_2022_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/decoder/spl/token_2022/error.jsonl", + "path": "logs/mainnet_research/ks-lib/decoder/spl/token_2022/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -2434,11 +2434,11 @@ ] }, { - "name": "file_kb-lib_decoder_metadata_metaplex_token_metadata_debug", + "name": "file_ks-lib_decoder_metadata_metaplex_token_metadata_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/decoder/metadata/metaplex_token_metadata/debug.log", + "path": "logs/mainnet_research/ks-lib/decoder/metadata/metaplex_token_metadata/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2447,11 +2447,11 @@ ] }, { - "name": "file_kb-lib_decoder_metadata_metaplex_token_metadata_info", + "name": "file_ks-lib_decoder_metadata_metaplex_token_metadata_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/decoder/metadata/metaplex_token_metadata/info.log", + "path": "logs/mainnet_research/ks-lib/decoder/metadata/metaplex_token_metadata/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2460,11 +2460,11 @@ ] }, { - "name": "file_kb-lib_decoder_metadata_metaplex_token_metadata_error", + "name": "file_ks-lib_decoder_metadata_metaplex_token_metadata_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/decoder/metadata/metaplex_token_metadata/error.jsonl", + "path": "logs/mainnet_research/ks-lib/decoder/metadata/metaplex_token_metadata/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -2473,11 +2473,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_elgamal_registry_debug", + "name": "file_ks-lib_decoder_spl_elgamal_registry_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/decoder/spl/elgamal_registry/debug.log", + "path": "logs/mainnet_research/ks-lib/decoder/spl/elgamal_registry/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2486,11 +2486,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_elgamal_registry_info", + "name": "file_ks-lib_decoder_spl_elgamal_registry_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/decoder/spl/elgamal_registry/info.log", + "path": "logs/mainnet_research/ks-lib/decoder/spl/elgamal_registry/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2499,11 +2499,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_elgamal_registry_error", + "name": "file_ks-lib_decoder_spl_elgamal_registry_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/decoder/spl/elgamal_registry/error.jsonl", + "path": "logs/mainnet_research/ks-lib/decoder/spl/elgamal_registry/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -2512,11 +2512,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_elgamal_registry_debug", + "name": "file_ks-lib_executor_spl_elgamal_registry_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/executor/spl/elgamal_registry/debug.log", + "path": "logs/mainnet_research/ks-lib/executor/spl/elgamal_registry/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2525,11 +2525,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_elgamal_registry_info", + "name": "file_ks-lib_executor_spl_elgamal_registry_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/executor/spl/elgamal_registry/info.log", + "path": "logs/mainnet_research/ks-lib/executor/spl/elgamal_registry/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2538,11 +2538,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_elgamal_registry_error", + "name": "file_ks-lib_executor_spl_elgamal_registry_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/executor/spl/elgamal_registry/error.jsonl", + "path": "logs/mainnet_research/ks-lib/executor/spl/elgamal_registry/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -2551,11 +2551,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_2022_debug", + "name": "file_ks-lib_executor_spl_token_2022_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet_research/kb-lib/executor/spl/token_2022/debug.log", + "path": "logs/mainnet_research/ks-lib/executor/spl/token_2022/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2564,11 +2564,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_2022_info", + "name": "file_ks-lib_executor_spl_token_2022_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet_research/kb-lib/executor/spl/token_2022/info.log", + "path": "logs/mainnet_research/ks-lib/executor/spl/token_2022/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -2577,11 +2577,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_2022_error", + "name": "file_ks-lib_executor_spl_token_2022_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet_research/kb-lib/executor/spl/token_2022/error.jsonl", + "path": "logs/mainnet_research/ks-lib/executor/spl/token_2022/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -3113,42 +3113,42 @@ ] }, { - "name": "file_kb_lib_mainnet_debug", + "name": "file_ks_lib_mainnet_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/debug.log", + "path": "logs/mainnet/ks-lib/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-lib" + "ks-lib" ] }, { - "name": "file_kb_lib_mainnet_info", + "name": "file_ks_lib_mainnet_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/info.log", + "path": "logs/mainnet/ks-lib/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-lib" + "ks-lib" ] }, { - "name": "file_kb_lib_mainnet_error", + "name": "file_ks_lib_mainnet_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/error.jsonl", + "path": "logs/mainnet/ks-lib/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-lib" + "ks-lib" ] }, { @@ -3191,11 +3191,11 @@ ] }, { - "name": "file_kb-lib_decoder_solana_core_debug", + "name": "file_ks-lib_decoder_solana_core_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/decoder/solana/core/debug.log", + "path": "logs/mainnet/ks-lib/decoder/solana/core/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3204,11 +3204,11 @@ ] }, { - "name": "file_kb-lib_decoder_solana_core_info", + "name": "file_ks-lib_decoder_solana_core_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/decoder/solana/core/info.log", + "path": "logs/mainnet/ks-lib/decoder/solana/core/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3217,11 +3217,11 @@ ] }, { - "name": "file_kb-lib_decoder_solana_core_error", + "name": "file_ks-lib_decoder_solana_core_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/decoder/solana/core/error.jsonl", + "path": "logs/mainnet/ks-lib/decoder/solana/core/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -3230,11 +3230,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_memo_debug", + "name": "file_ks-lib_decoder_spl_memo_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/decoder/spl/memo/debug.log", + "path": "logs/mainnet/ks-lib/decoder/spl/memo/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3243,11 +3243,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_memo_info", + "name": "file_ks-lib_decoder_spl_memo_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/decoder/spl/memo/info.log", + "path": "logs/mainnet/ks-lib/decoder/spl/memo/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3256,11 +3256,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_memo_error", + "name": "file_ks-lib_decoder_spl_memo_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/decoder/spl/memo/error.jsonl", + "path": "logs/mainnet/ks-lib/decoder/spl/memo/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -3269,11 +3269,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_associated_token_account_debug", + "name": "file_ks-lib_decoder_spl_associated_token_account_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/decoder/spl/associated_token_account/debug.log", + "path": "logs/mainnet/ks-lib/decoder/spl/associated_token_account/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3282,11 +3282,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_associated_token_account_info", + "name": "file_ks-lib_decoder_spl_associated_token_account_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/decoder/spl/associated_token_account/info.log", + "path": "logs/mainnet/ks-lib/decoder/spl/associated_token_account/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3295,11 +3295,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_associated_token_account_error", + "name": "file_ks-lib_decoder_spl_associated_token_account_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/decoder/spl/associated_token_account/error.jsonl", + "path": "logs/mainnet/ks-lib/decoder/spl/associated_token_account/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -3308,11 +3308,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_debug", + "name": "file_ks-lib_decoder_spl_token_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/decoder/spl/token/debug.log", + "path": "logs/mainnet/ks-lib/decoder/spl/token/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3321,11 +3321,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_info", + "name": "file_ks-lib_decoder_spl_token_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/decoder/spl/token/info.log", + "path": "logs/mainnet/ks-lib/decoder/spl/token/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3334,11 +3334,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_error", + "name": "file_ks-lib_decoder_spl_token_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/decoder/spl/token/error.jsonl", + "path": "logs/mainnet/ks-lib/decoder/spl/token/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -3347,11 +3347,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_core_debug", + "name": "file_ks-lib_executor_solana_core_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/executor/solana/core/debug.log", + "path": "logs/mainnet/ks-lib/executor/solana/core/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3360,11 +3360,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_core_info", + "name": "file_ks-lib_executor_solana_core_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/executor/solana/core/info.log", + "path": "logs/mainnet/ks-lib/executor/solana/core/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3373,11 +3373,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_core_error", + "name": "file_ks-lib_executor_solana_core_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/executor/solana/core/error.jsonl", + "path": "logs/mainnet/ks-lib/executor/solana/core/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -3386,11 +3386,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_transaction_debug", + "name": "file_ks-lib_executor_solana_transaction_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/executor/solana/transaction/debug.log", + "path": "logs/mainnet/ks-lib/executor/solana/transaction/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3399,11 +3399,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_transaction_info", + "name": "file_ks-lib_executor_solana_transaction_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/executor/solana/transaction/info.log", + "path": "logs/mainnet/ks-lib/executor/solana/transaction/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3412,11 +3412,11 @@ ] }, { - "name": "file_kb-lib_executor_solana_transaction_error", + "name": "file_ks-lib_executor_solana_transaction_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/executor/solana/transaction/error.jsonl", + "path": "logs/mainnet/ks-lib/executor/solana/transaction/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -3425,11 +3425,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_memo_debug", + "name": "file_ks-lib_executor_spl_memo_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/executor/spl/memo/debug.log", + "path": "logs/mainnet/ks-lib/executor/spl/memo/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3438,11 +3438,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_memo_info", + "name": "file_ks-lib_executor_spl_memo_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/executor/spl/memo/info.log", + "path": "logs/mainnet/ks-lib/executor/spl/memo/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3451,11 +3451,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_memo_error", + "name": "file_ks-lib_executor_spl_memo_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/executor/spl/memo/error.jsonl", + "path": "logs/mainnet/ks-lib/executor/spl/memo/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -3464,11 +3464,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_associated_token_account_debug", + "name": "file_ks-lib_executor_spl_associated_token_account_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/executor/spl/associated_token_account/debug.log", + "path": "logs/mainnet/ks-lib/executor/spl/associated_token_account/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3477,11 +3477,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_associated_token_account_info", + "name": "file_ks-lib_executor_spl_associated_token_account_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/executor/spl/associated_token_account/info.log", + "path": "logs/mainnet/ks-lib/executor/spl/associated_token_account/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3490,11 +3490,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_associated_token_account_error", + "name": "file_ks-lib_executor_spl_associated_token_account_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/executor/spl/associated_token_account/error.jsonl", + "path": "logs/mainnet/ks-lib/executor/spl/associated_token_account/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -3503,11 +3503,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_debug", + "name": "file_ks-lib_executor_spl_token_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/executor/spl/token/debug.log", + "path": "logs/mainnet/ks-lib/executor/spl/token/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3516,11 +3516,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_info", + "name": "file_ks-lib_executor_spl_token_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/executor/spl/token/info.log", + "path": "logs/mainnet/ks-lib/executor/spl/token/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3529,11 +3529,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_error", + "name": "file_ks-lib_executor_spl_token_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/executor/spl/token/error.jsonl", + "path": "logs/mainnet/ks-lib/executor/spl/token/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -3542,50 +3542,50 @@ ] }, { - "name": "file_kb_logging_debug", + "name": "file_ks_logging_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-logging/debug.log", + "path": "logs/mainnet/ks-logging/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-logging" + "ks-logging" ] }, { - "name": "file_kb_logging_info", + "name": "file_ks_logging_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-logging/info.log", + "path": "logs/mainnet/ks-logging/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-logging" + "ks-logging" ] }, { - "name": "file_kb_logging_error", + "name": "file_ks_logging_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-logging/error.jsonl", + "path": "logs/mainnet/ks-logging/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-logging" + "ks-logging" ] }, { - "name": "file_kb-lib_materializer_admin_debug", + "name": "file_ks-lib_materializer_admin_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/materializer/admin/debug.log", + "path": "logs/mainnet/ks-lib/materializer/admin/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3594,11 +3594,11 @@ ] }, { - "name": "file_kb-lib_materializer_admin_info", + "name": "file_ks-lib_materializer_admin_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/materializer/admin/info.log", + "path": "logs/mainnet/ks-lib/materializer/admin/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3607,11 +3607,11 @@ ] }, { - "name": "file_kb-lib_materializer_admin_error", + "name": "file_ks-lib_materializer_admin_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/materializer/admin/error.jsonl", + "path": "logs/mainnet/ks-lib/materializer/admin/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -3620,11 +3620,11 @@ ] }, { - "name": "file_kb-lib_materializer_compliance_audit_debug", + "name": "file_ks-lib_materializer_compliance_audit_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/materializer/compliance/audit/debug.log", + "path": "logs/mainnet/ks-lib/materializer/compliance/audit/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3633,11 +3633,11 @@ ] }, { - "name": "file_kb-lib_materializer_compliance_audit_info", + "name": "file_ks-lib_materializer_compliance_audit_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/materializer/compliance/audit/info.log", + "path": "logs/mainnet/ks-lib/materializer/compliance/audit/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3646,11 +3646,11 @@ ] }, { - "name": "file_kb-lib_materializer_compliance_audit_error", + "name": "file_ks-lib_materializer_compliance_audit_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/materializer/compliance/audit/error.jsonl", + "path": "logs/mainnet/ks-lib/materializer/compliance/audit/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -3659,11 +3659,11 @@ ] }, { - "name": "file_kb-lib_materializer_lifecycle_debug", + "name": "file_ks-lib_materializer_lifecycle_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/materializer/lifecycle/debug.log", + "path": "logs/mainnet/ks-lib/materializer/lifecycle/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3672,11 +3672,11 @@ ] }, { - "name": "file_kb-lib_materializer_lifecycle_info", + "name": "file_ks-lib_materializer_lifecycle_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/materializer/lifecycle/info.log", + "path": "logs/mainnet/ks-lib/materializer/lifecycle/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3685,11 +3685,11 @@ ] }, { - "name": "file_kb-lib_materializer_lifecycle_error", + "name": "file_ks-lib_materializer_lifecycle_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/materializer/lifecycle/error.jsonl", + "path": "logs/mainnet/ks-lib/materializer/lifecycle/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -3698,11 +3698,11 @@ ] }, { - "name": "file_kb-lib_materializer_transaction_annotations_debug", + "name": "file_ks-lib_materializer_transaction_annotations_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/materializer/transaction/annotations/debug.log", + "path": "logs/mainnet/ks-lib/materializer/transaction/annotations/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3711,11 +3711,11 @@ ] }, { - "name": "file_kb-lib_materializer_transaction_annotations_info", + "name": "file_ks-lib_materializer_transaction_annotations_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/materializer/transaction/annotations/info.log", + "path": "logs/mainnet/ks-lib/materializer/transaction/annotations/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3724,11 +3724,11 @@ ] }, { - "name": "file_kb-lib_materializer_transaction_annotations_error", + "name": "file_ks-lib_materializer_transaction_annotations_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/materializer/transaction/annotations/error.jsonl", + "path": "logs/mainnet/ks-lib/materializer/transaction/annotations/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -3737,11 +3737,11 @@ ] }, { - "name": "file_kb-lib_materializer_staking_debug", + "name": "file_ks-lib_materializer_staking_debug", "enabled": true, "level": "debug", "format": "human", - "path": "logs/mainnet/kb-lib/materializer/staking/debug.log", + "path": "logs/mainnet/ks-lib/materializer/staking/debug.log", "targets": [ "kb-lib.materializer.staking" ], @@ -3750,11 +3750,11 @@ "ansi": false }, { - "name": "file_kb-lib_materializer_staking_info", + "name": "file_ks-lib_materializer_staking_info", "enabled": true, "level": "info", "format": "human", - "path": "logs/mainnet/kb-lib/materializer/staking/info.log", + "path": "logs/mainnet/ks-lib/materializer/staking/info.log", "targets": [ "kb-lib.materializer.staking" ], @@ -3763,11 +3763,11 @@ "ansi": false }, { - "name": "file_kb-lib_materializer_staking_error", + "name": "file_ks-lib_materializer_staking_error", "enabled": true, "level": "error", "format": "json", - "path": "logs/mainnet/kb-lib/materializer/staking/error.jsonl", + "path": "logs/mainnet/ks-lib/materializer/staking/error.jsonl", "targets": [ "kb-lib.materializer.staking" ], @@ -3776,170 +3776,170 @@ "ansi": false }, { - "name": "file_kb-pipeline_debug", + "name": "file_ks-pipeline_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-pipeline/debug.log", + "path": "logs/mainnet/ks-pipeline/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-pipeline", - "kb-pipeline-demo-scenarios" + "ks-pipeline", + "ks-pipeline-demo-scenarios" ] }, { - "name": "file_kb-pipeline_info", + "name": "file_ks-pipeline_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-pipeline/info.log", + "path": "logs/mainnet/ks-pipeline/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-pipeline", - "kb-pipeline-demo-scenarios" + "ks-pipeline", + "ks-pipeline-demo-scenarios" ] }, { - "name": "file_kb-pipeline_error", + "name": "file_ks-pipeline_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-pipeline/error.jsonl", + "path": "logs/mainnet/ks-pipeline/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-pipeline", - "kb-pipeline-demo-scenarios" + "ks-pipeline", + "ks-pipeline-demo-scenarios" ] }, { - "name": "file_kb-onchain-transport_debug", + "name": "file_ks-onchain-transport_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-onchain-transport/debug.log", + "path": "logs/mainnet/ks-onchain-transport/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-onchain-transport" + "ks-onchain-transport" ] }, { - "name": "file_kb-onchain-transport_info", + "name": "file_ks-onchain-transport_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-onchain-transport/info.log", + "path": "logs/mainnet/ks-onchain-transport/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-onchain-transport" + "ks-onchain-transport" ] }, { - "name": "file_kb-onchain-transport_error", + "name": "file_ks-onchain-transport_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-onchain-transport/error.jsonl", + "path": "logs/mainnet/ks-onchain-transport/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-onchain-transport" + "ks-onchain-transport" ] }, { - "name": "file_kb-store_debug", + "name": "file_ks-store_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-store/debug.log", + "path": "logs/mainnet/ks-store/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-store" + "ks-store" ] }, { - "name": "file_kb-store_info", + "name": "file_ks-store_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-store/info.log", + "path": "logs/mainnet/ks-store/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-store" + "ks-store" ] }, { - "name": "file_kb-store_error", + "name": "file_ks-store_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-store/error.jsonl", + "path": "logs/mainnet/ks-store/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-store" + "ks-store" ] }, { - "name": "file_kb_wallet_debug", + "name": "file_ks_wallet_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-wallet/debug.log", + "path": "logs/mainnet/ks-wallet/debug.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-wallet" + "ks-wallet" ] }, { - "name": "file_kb_wallet_info", + "name": "file_ks_wallet_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-wallet/info.log", + "path": "logs/mainnet/ks-wallet/info.log", "rotation": "daily", "format": "human", "ansi": false, "targets": [ - "kb-wallet" + "ks-wallet" ] }, { - "name": "file_kb_wallet_error", + "name": "file_ks_wallet_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-wallet/error.jsonl", + "path": "logs/mainnet/ks-wallet/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, "targets": [ - "kb-wallet" + "ks-wallet" ] }, { - "name": "file_kb-lib_materializer_token_accounts_debug", + "name": "file_ks-lib_materializer_token_accounts_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/materializer/token/accounts/debug.log", + "path": "logs/mainnet/ks-lib/materializer/token/accounts/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3948,11 +3948,11 @@ ] }, { - "name": "file_kb-lib_materializer_token_accounts_info", + "name": "file_ks-lib_materializer_token_accounts_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/materializer/token/accounts/info.log", + "path": "logs/mainnet/ks-lib/materializer/token/accounts/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3961,11 +3961,11 @@ ] }, { - "name": "file_kb-lib_materializer_token_accounts_error", + "name": "file_ks-lib_materializer_token_accounts_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/materializer/token/accounts/error.jsonl", + "path": "logs/mainnet/ks-lib/materializer/token/accounts/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -3974,11 +3974,11 @@ ] }, { - "name": "file_kb-lib_materializer_risk_debug", + "name": "file_ks-lib_materializer_risk_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/materializer/risk/debug.log", + "path": "logs/mainnet/ks-lib/materializer/risk/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -3987,11 +3987,11 @@ ] }, { - "name": "file_kb-lib_materializer_risk_info", + "name": "file_ks-lib_materializer_risk_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/materializer/risk/info.log", + "path": "logs/mainnet/ks-lib/materializer/risk/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -4000,11 +4000,11 @@ ] }, { - "name": "file_kb-lib_materializer_risk_error", + "name": "file_ks-lib_materializer_risk_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/materializer/risk/error.jsonl", + "path": "logs/mainnet/ks-lib/materializer/risk/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -4013,11 +4013,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_2022_debug", + "name": "file_ks-lib_decoder_spl_token_2022_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/decoder/spl/token_2022/debug.log", + "path": "logs/mainnet/ks-lib/decoder/spl/token_2022/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -4026,11 +4026,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_2022_info", + "name": "file_ks-lib_decoder_spl_token_2022_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/decoder/spl/token_2022/info.log", + "path": "logs/mainnet/ks-lib/decoder/spl/token_2022/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -4039,11 +4039,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_token_2022_error", + "name": "file_ks-lib_decoder_spl_token_2022_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/decoder/spl/token_2022/error.jsonl", + "path": "logs/mainnet/ks-lib/decoder/spl/token_2022/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -4052,11 +4052,11 @@ ] }, { - "name": "file_kb-lib_decoder_metadata_metaplex_token_metadata_debug", + "name": "file_ks-lib_decoder_metadata_metaplex_token_metadata_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/decoder/metadata/metaplex_token_metadata/debug.log", + "path": "logs/mainnet/ks-lib/decoder/metadata/metaplex_token_metadata/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -4065,11 +4065,11 @@ ] }, { - "name": "file_kb-lib_decoder_metadata_metaplex_token_metadata_info", + "name": "file_ks-lib_decoder_metadata_metaplex_token_metadata_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/decoder/metadata/metaplex_token_metadata/info.log", + "path": "logs/mainnet/ks-lib/decoder/metadata/metaplex_token_metadata/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -4078,11 +4078,11 @@ ] }, { - "name": "file_kb-lib_decoder_metadata_metaplex_token_metadata_error", + "name": "file_ks-lib_decoder_metadata_metaplex_token_metadata_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/decoder/metadata/metaplex_token_metadata/error.jsonl", + "path": "logs/mainnet/ks-lib/decoder/metadata/metaplex_token_metadata/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -4091,11 +4091,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_elgamal_registry_debug", + "name": "file_ks-lib_decoder_spl_elgamal_registry_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/decoder/spl/elgamal_registry/debug.log", + "path": "logs/mainnet/ks-lib/decoder/spl/elgamal_registry/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -4104,11 +4104,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_elgamal_registry_info", + "name": "file_ks-lib_decoder_spl_elgamal_registry_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/decoder/spl/elgamal_registry/info.log", + "path": "logs/mainnet/ks-lib/decoder/spl/elgamal_registry/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -4117,11 +4117,11 @@ ] }, { - "name": "file_kb-lib_decoder_spl_elgamal_registry_error", + "name": "file_ks-lib_decoder_spl_elgamal_registry_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/decoder/spl/elgamal_registry/error.jsonl", + "path": "logs/mainnet/ks-lib/decoder/spl/elgamal_registry/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -4130,11 +4130,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_elgamal_registry_debug", + "name": "file_ks-lib_executor_spl_elgamal_registry_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/executor/spl/elgamal_registry/debug.log", + "path": "logs/mainnet/ks-lib/executor/spl/elgamal_registry/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -4143,11 +4143,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_elgamal_registry_info", + "name": "file_ks-lib_executor_spl_elgamal_registry_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/executor/spl/elgamal_registry/info.log", + "path": "logs/mainnet/ks-lib/executor/spl/elgamal_registry/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -4156,11 +4156,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_elgamal_registry_error", + "name": "file_ks-lib_executor_spl_elgamal_registry_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/executor/spl/elgamal_registry/error.jsonl", + "path": "logs/mainnet/ks-lib/executor/spl/elgamal_registry/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, @@ -4169,11 +4169,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_2022_debug", + "name": "file_ks-lib_executor_spl_token_2022_debug", "enabled": true, "sink": "file", "level": "debug", - "path": "logs/mainnet/kb-lib/executor/spl/token_2022/debug.log", + "path": "logs/mainnet/ks-lib/executor/spl/token_2022/debug.log", "rotation": "daily", "format": "human", "ansi": false, @@ -4182,11 +4182,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_2022_info", + "name": "file_ks-lib_executor_spl_token_2022_info", "enabled": true, "sink": "file", "level": "info", - "path": "logs/mainnet/kb-lib/executor/spl/token_2022/info.log", + "path": "logs/mainnet/ks-lib/executor/spl/token_2022/info.log", "rotation": "daily", "format": "human", "ansi": false, @@ -4195,11 +4195,11 @@ ] }, { - "name": "file_kb-lib_executor_spl_token_2022_error", + "name": "file_ks-lib_executor_spl_token_2022_error", "enabled": true, "sink": "file", "level": "error", - "path": "logs/mainnet/kb-lib/executor/spl/token_2022/error.jsonl", + "path": "logs/mainnet/ks-lib/executor/spl/token_2022/error.jsonl", "rotation": "daily", "format": "json", "ansi": false, diff --git a/docs/DEVNET_EXECUTION_GUIDE.md b/docs/DEVNET_EXECUTION_GUIDE.md index c74651d..08c7f8d 100644 --- a/docs/DEVNET_EXECUTION_GUIDE.md +++ b/docs/DEVNET_EXECUTION_GUIDE.md @@ -1,11 +1,11 @@ - + # Guide d’exécution Devnet ## 1. Objet et ordre de validation -Ce guide décrit la campagne Devnet de `kb-app-demo-desktop` et `kb-pipeline-demo-scenarios`. Après une modification de nomenclature persistée ou une recréation de la base Devnet, reprendre les scénarios depuis le début dans l’ordre suivant : +Ce guide décrit la campagne Devnet de `kb-app-demo-desktop` et `ks-pipeline-demo-scenarios`. Après une modification de nomenclature persistée ou une recréation de la base Devnet, reprendre les scénarios depuis le début dans l’ordre suivant : 1. préparation commune et base PostgreSQL propre ; 2. Solana Core — System Transfer ; @@ -241,7 +241,7 @@ La création du compte destination par CLI est acceptable ici : `S03A` et `S03B` Le workspace fournit une commande idempotente qui prépare les comptes publics requis par les huit scénarios Token-2022 : ```bash -cargo run -p kb-pipeline-demo-scenarios --bin kb-pipeline-demo-scenarios-cli -- prepare-token-2022-fixture --rpc-url "$KB_DEVNET_RPC_URL" --wallet "$KB_DEVNET_WALLET" --wallet-dir "$PWD/wallets/temporary/local_devnet" --decimals 9 | tee "$KB_DEVNET_VALIDATION_DIR/50-spl-token-2022-fixture-preparation.json" +cargo run -p ks-pipeline-demo-scenarios --bin ks-pipeline-demo-scenarios-cli -- prepare-token-2022-fixture --rpc-url "$KB_DEVNET_RPC_URL" --wallet "$KB_DEVNET_WALLET" --wallet-dir "$PWD/wallets/temporary/local_devnet" --decimals 9 | tee "$KB_DEVNET_VALIDATION_DIR/50-spl-token-2022-fixture-preparation.json" ``` Lorsque `--rpc-url` et `--wallet` sont omis, la commande utilise respectivement `KB_DEVNET_RPC_URL` et `KB_DEVNET_WALLET`. Lorsque `--wallet-dir` est omis, elle utilise le répertoire parent du wallet. @@ -623,7 +623,7 @@ export KB_DEVNET_SCENARIO="50-spl-token-2022" 5. Cliquer **Charger la fixture Token-2022**. 6. Vérifier que le message indique le chemin de `fixture.env` et le Program ID Token-2022. -Le bouton lit le `fixture.env` produit par `kb-pipeline-demo-scenarios` et remplit automatiquement : +Le bouton lit le `fixture.env` produit par `ks-pipeline-demo-scenarios` et remplit automatiquement : - compte source ou cible ; - mint ; diff --git a/docs/IDEA_REMINDERS.md b/docs/IDEA_REMINDERS.md index e2fbb13..5dd6c57 100644 --- a/docs/IDEA_REMINDERS.md +++ b/docs/IDEA_REMINDERS.md @@ -1,5 +1,5 @@ - + # Rappels d’idées @@ -24,7 +24,7 @@ La décision normative et son calendrier sont dans [`decisions/KHADHROONY_SOLANA - autocomplétion Token et Pool lorsque des tables de référence fiables existeront ; - pagination SQL/IPC côté serveur avant l’exploitation de volumes massifs ; -- résolution configurable du chemin de base de `kb-store` ; +- résolution configurable du chemin de base de `ks-store` ; - sélection indépendante du profil de logging ; ## Pipeline et PostgreSQL diff --git a/docs/IDL_TO_KB_LIB_NOMENCLATURE.md b/docs/IDL_TO_KB_LIB_NOMENCLATURE.md index 7afa7cf..b1e38ec 100644 --- a/docs/IDL_TO_KB_LIB_NOMENCLATURE.md +++ b/docs/IDL_TO_KB_LIB_NOMENCLATURE.md @@ -1,7 +1,7 @@ - + -# Correspondance IDL ↔ `kb-lib` +# Correspondance IDL ↔ `ks-lib` Ce tableau constitue la cible de classification pour les futurs décodeurs et exécuteurs. Il ne signifie pas que tous les modules proposés sont déjà implémentés. diff --git a/docs/MISSING_PROGRAM_IDLS.md b/docs/MISSING_PROGRAM_IDLS.md index 31be90a..65e0a1f 100644 --- a/docs/MISSING_PROGRAM_IDLS.md +++ b/docs/MISSING_PROGRAM_IDLS.md @@ -1,5 +1,5 @@ - + # Programmes ou IDL manquants @@ -7,7 +7,7 @@ Cette liste distingue l'absence d'un fichier dans `idls_v3` de l'absence d'une I ## Surfaces Bot3 déjà implémentées sans IDL correspondante dans l'archive -| Classification `kb-lib` | Program ID | Situation | +| Classification `ks-lib` | Program ID | Situation | |--------------------------------|------------------------------------------------|-------------------------------------------------| | `spl/memo/v1` | `Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo` | aucune IDL correspondante dans `idls_v2` | | `spl/memo/v4` | `Memo4c2pN8afCj432Lb7RMVKi9PbQnnW7ewFFaV3oAH` | aucune IDL correspondante dans `idls_v2` | @@ -19,4 +19,4 @@ Cette liste distingue l'absence d'un fichier dans `idls_v3` de l'absence d'une I - Le fichier Memo présent correspond à `MemoSq4...`, donc à la génération v3 dans la nomenclature Bot3. - L'absence d'IDL ne signifie pas l'absence de source normative : les crates d'interface officielles, le code runtime et les matrices wire restent utilisables. -- La liste devra être recalculée après chaque ajout de programme à `kb-program-ids`. +- La liste devra être recalculée après chaque ajout de programme à `ks-program-ids`. diff --git a/docs/OPERATION_NAMING_CONVENTION.md b/docs/OPERATION_NAMING_CONVENTION.md index 019f5e9..01d812b 100644 --- a/docs/OPERATION_NAMING_CONVENTION.md +++ b/docs/OPERATION_NAMING_CONVENTION.md @@ -1,5 +1,5 @@ - + # Convention canonique des identités runtime et des codes d’opération @@ -41,7 +41,7 @@ metadata_metaplex_token_metadata.create_metadata_account_v3 ## 2.1 Frontière avec les codes de registre -La notation par points s’applique aux identités runtime, processeurs, surfaces, opérations et événements persistés. Elle ne s’applique pas aux codes techniques du registre `kb-program-ids`, qui restent des identifiants Rust/registre en `lower_snake_case` afin de préserver leur ordre lexical, leur compatibilité et leur rôle de clé interne. +La notation par points s’applique aux identités runtime, processeurs, surfaces, opérations et événements persistés. Elle ne s’applique pas aux codes techniques du registre `ks-program-ids`, qui restent des identifiants Rust/registre en `lower_snake_case` afin de préserver leur ordre lexical, leur compatibilité et leur rôle de clé interne. Exemples de codes de registre : @@ -267,7 +267,7 @@ Une surface `decode_only` peut avoir `operationCode` et `executorName` à `null` Avant de fusionner une nouvelle opération : 1. choisir son domaine et sa famille ; -2. identifier le Program ID canonique dans `kb-program-ids` ; +2. identifier le Program ID canonique dans `ks-program-ids` ; 3. définir `processor_name` et `surface_code` ; 4. définir séparément `operation_code` et `event_code` ; 5. ajouter les constantes Rust ; diff --git a/docs/README.md b/docs/README.md index be2fbb0..c8965de 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,5 @@ - + # Documentation active de Khadhroony Bot3 @@ -70,16 +70,16 @@ Elles peuvent être chargées directement par les tests unitaires ou d’intégr Les onze crates possèdent `README.md`, `TODO.md`, `USAGE.md` et `CHANGELOG.md` : -- [`kb-core`](../kb-core/README.md) ; -- [`kb-config`](../kb-config/README.md) ; -- [`kb-lib`](../kb-lib/README.md) ; -- [`kb-logging`](../kb-logging/README.md) ; -- [`kb-program-ids`](../kb-program-ids/README.md) ; -- [`kb-pipeline`](../kb-pipeline/README.md) ; -- [`kb-pipeline-demo-scenarios`](../kb-pipeline-demo-scenarios/README.md) ; -- [`kb-onchain-transport`](../kb-onchain-transport/README.md) ; -- [`kb-store`](../kb-store/README.md) ; -- [`kb-wallet`](../kb-wallet/README.md) ; +- [`ks-core`](../ks-core/README.md) ; +- [`ks-config`](../ks-config/README.md) ; +- [`ks-lib`](../ks-lib/README.md) ; +- [`ks-logging`](../ks-logging/README.md) ; +- [`ks-program-ids`](../ks-program-ids/README.md) ; +- [`ks-pipeline`](../ks-pipeline/README.md) ; +- [`ks-pipeline-demo-scenarios`](../ks-pipeline-demo-scenarios/README.md) ; +- [`ks-onchain-transport`](../ks-onchain-transport/README.md) ; +- [`ks-store`](../ks-store/README.md) ; +- [`ks-wallet`](../ks-wallet/README.md) ; - [`kb-app-demo-desktop`](../kb-app-demo-desktop/README.md). ## 8. Guides diff --git a/docs/architecture/ARCHITECTURE.md b/docs/architecture/ARCHITECTURE.md index 3542a35..2b58bf1 100644 --- a/docs/architecture/ARCHITECTURE.md +++ b/docs/architecture/ARCHITECTURE.md @@ -1,5 +1,5 @@ - + # Architecture générale @@ -12,7 +12,7 @@ configuration ─────┐ logging ───────────┼──────────────┐ program IDs ───────┘ │ v -transport -> store -> pipeline -> kb-lib +transport -> store -> pipeline -> ks-lib │ │ v v demo scenarios wallet/signers @@ -28,32 +28,32 @@ Cette représentation indique les relations dominantes. Elle ne remplace pas le ### 2.1 Fondations -- `kb-core` fournit les erreurs et identités transversales minimales. -- `kb-config` charge, résout et valide la configuration. -- `kb-logging` initialise le logging et le tracing. -- `kb-program-ids` centralise les identifiants de programmes et comptes connus. +- `ks-core` fournit les erreurs et identités transversales minimales. +- `ks-config` charge, résout et valide la configuration. +- `ks-logging` initialise le logging et le tracing. +- `ks-program-ids` centralise les identifiants de programmes et comptes connus. ### 2.2 Noyau métier -`kb-lib` contient quatre familles principales : +`ks-lib` contient quatre familles principales : - modèles et contrats partagés ; - décodeurs ; - exécuteurs ; - matérialisateurs. -La façade publique est constituée par les réexports de `kb-lib/src/lib.rs`. Les modules internes conservent leurs frontières et leurs conventions de nommage. +La façade publique est constituée par les réexports de `ks-lib/src/lib.rs`. Les modules internes conservent leurs frontières et leurs conventions de nommage. ### 2.3 Acquisition et stockage -- `kb-onchain-transport` fournit les clients HTTP/WebSocket, pools, rôles d’endpoints, méthodes RPC standard et contrats liés à l’exécution RPC. -- `kb-store` regroupe les contrats store-neutral et l’implémentation PostgreSQL. +- `ks-onchain-transport` fournit les clients HTTP/WebSocket, pools, rôles d’endpoints, méthodes RPC standard et contrats liés à l’exécution RPC. +- `ks-store` regroupe les contrats store-neutral et l’implémentation PostgreSQL. Les transports n’effectuent pas la matérialisation métier. Le stockage ne décide pas quelle surface protocolaire doit être décodée. ### 2.4 Orchestration -`kb-pipeline` orchestre : +`ks-pipeline` orchestre : - backfill ; - extraction Core ; @@ -62,14 +62,14 @@ Les transports n’effectuent pas la matérialisation métier. Le stockage ne d - corrélation stateful ; - préflight et orchestration d’exécution pour les surfaces prises en charge. -Il dépend des contrats de `kb-lib`, des données de `kb-store` et des capacités de `kb-onchain-transport` sans absorber leurs responsabilités. +Il dépend des contrats de `ks-lib`, des données de `ks-store` et des capacités de `ks-onchain-transport` sans absorber leurs responsabilités. ### 2.5 Démonstrations et applications -- `kb-pipeline-demo-scenarios` fournit les fixtures et campagnes réseau réutilisables spécifiques aux validations Devnet/Testnet. Les scénarios réutilisables doivent être appelables sans dépendre du desktop. -- Le binaire `kb-pipeline-demo-scenarios-cli` reste un outil ciblé ; son existence n’impose pas d’exposer chaque scénario par un CLI. -- `kb-app-demo-desktop` est une crate mixte : bibliothèque Tauri et binaire desktop. Les commandes et projections UI y restent, tandis que la logique de scénario réutilisable doit être déléguée à `kb-pipeline-demo-scenarios`. Le reliquat éventuel de scénarios encore déclarés directement dans le desktop sera audité en `0.5.4`. -- `kb-wallet` fournit actuellement une frontière limitée de wallet temporaire et de signataire. Elle devient `ks-wallet` en `0.5.1`, puis sa restructuration fonctionnelle est planifiée en `0.5.2`. +- `ks-pipeline-demo-scenarios` fournit les fixtures et campagnes réseau réutilisables spécifiques aux validations Devnet/Testnet. Les scénarios réutilisables doivent être appelables sans dépendre du desktop. +- Le binaire `ks-pipeline-demo-scenarios-cli` reste un outil ciblé ; son existence n’impose pas d’exposer chaque scénario par un CLI. +- `kb-app-demo-desktop` est une crate mixte : bibliothèque Tauri et binaire desktop. Les commandes et projections UI y restent, tandis que la logique de scénario réutilisable doit être déléguée à `ks-pipeline-demo-scenarios`. Le reliquat éventuel de scénarios encore déclarés directement dans le desktop sera audité en `0.5.4`. +- `ks-wallet` fournit actuellement une frontière limitée de wallet temporaire et de signataire. Elle devient `ks-wallet` en `0.5.1`, puis sa restructuration fonctionnelle est planifiée en `0.5.2`. ## 3. Flux principal de données @@ -77,18 +77,18 @@ Il dépend des contrats de `kb-lib`, des données de `kb-store` et des capacité Solana RPC / WebSocket │ v -kb-onchain-transport +ks-onchain-transport │ v -kb-store (données brutes/canoniques) +ks-store (données brutes/canoniques) │ v -kb-pipeline +ks-pipeline │ ├── extraction Core ├── sélection des décodeurs - ├── décodage via kb-lib - ├── matérialisation via kb-lib + ├── décodage via ks-lib + ├── matérialisation via ks-lib └── stockage des résultats ``` @@ -96,11 +96,11 @@ L’exécution suit un flux séparé : intention typée, construction, préfligh ## 4. Frontières obligatoires -- Les IDs canoniques ne doivent pas être dispersés lorsqu’ils appartiennent au registre de `kb-program-ids`. -- Les APIs publiques de modèles, décodeurs, exécuteurs et matérialisateurs sont exposées par `kb-lib`. +- Les IDs canoniques ne doivent pas être dispersés lorsqu’ils appartiennent au registre de `ks-program-ids`. +- Les APIs publiques de modèles, décodeurs, exécuteurs et matérialisateurs sont exposées par `ks-lib`. - Les commandes Tauri et payloads frontend spécifiques restent dans `kb-app-demo-desktop`. -- Les scénarios réseau réutilisables spécifiques à Devnet/Testnet appartiennent à `kb-pipeline-demo-scenarios`, future `ks-pipeline-demo-scenarios`. `kb-app-demo-desktop` doit se limiter à l’adaptation Tauri, aux payloads UI, à la présentation et à l’appel de ces scénarios ; les doublons résiduels seront réconciliés en `0.5.4`. -- Toute primitive ou orchestration réellement généraliste, indépendante de l’UI et d’une campagne de démonstration précise, appartient à `kb-pipeline` ou à la crate métier propriétaire. +- Les scénarios réseau réutilisables spécifiques à Devnet/Testnet appartiennent à `ks-pipeline-demo-scenarios`, future `ks-pipeline-demo-scenarios`. `kb-app-demo-desktop` doit se limiter à l’adaptation Tauri, aux payloads UI, à la présentation et à l’appel de ces scénarios ; les doublons résiduels seront réconciliés en `0.5.4`. +- Toute primitive ou orchestration réellement généraliste, indépendante de l’UI et d’une campagne de démonstration précise, appartient à `ks-pipeline` ou à la crate métier propriétaire. - Les fixtures contractuelles communes restent sous `test-fixtures/contract-matrices/` lorsqu’elles sont consommées par plusieurs tests. - Les archives documentaires ne participent ni au build ni aux décisions normatives. diff --git a/docs/architecture/CRATE_MAP.md b/docs/architecture/CRATE_MAP.md index 2a93a78..31900a1 100644 --- a/docs/architecture/CRATE_MAP.md +++ b/docs/architecture/CRATE_MAP.md @@ -1,5 +1,5 @@ - + # Carte des crates @@ -7,16 +7,16 @@ | Crate | Type | Responsabilité principale | État documentaire | |------------------------------|------------------------|--------------------------------------------------------------------|------------------------------------------| -| `kb-core` | bibliothèque | erreurs, résultat et identité de module partagés | README/TODO/USAGE/CHANGELOG présents | -| `kb-config` | bibliothèque | configuration JSON, environnement, validation et profils | migration/restructuration en `0.5.1` | -| `kb-lib` | bibliothèque | modèles, décodeurs, exécuteurs et matérialisateurs consolidés | README/TODO/USAGE/CHANGELOG présents | -| `kb-logging` | bibliothèque | initialisation du logging et du tracing | README/TODO/USAGE/CHANGELOG présents | -| `kb-program-ids` | bibliothèque | registre des programmes et comptes Solana connus | README/TODO/USAGE/CHANGELOG présents | -| `kb-pipeline` | bibliothèque | backfill, extraction, replay, stateful, préflight et orchestration | README/TODO/USAGE/CHANGELOG présents | -| `kb-pipeline-demo-scenarios` | bibliothèque + binaire | scénarios Devnet réutilisables et CLI | renommage `0.5.1`, audit `0.5.4` | -| `kb-onchain-transport` | bibliothèque | transports RPC HTTP/WebSocket et pools d’endpoints | README/TODO/USAGE/CHANGELOG présents | -| `kb-store` | bibliothèque | contrats de stockage et adaptateur PostgreSQL | renommage `0.5.1`, normalisation `0.5.3` | -| `kb-wallet` | bibliothèque | wallet temporaire et frontière de signataire | renommage `0.5.1`, refonte `0.5.2` | +| `ks-core` | bibliothèque | erreurs, résultat et identité de module partagés | README/TODO/USAGE/CHANGELOG présents | +| `ks-config` | bibliothèque | configuration JSON, environnement, validation et profils | migration/restructuration en `0.5.1` | +| `ks-lib` | bibliothèque | modèles, décodeurs, exécuteurs et matérialisateurs consolidés | README/TODO/USAGE/CHANGELOG présents | +| `ks-logging` | bibliothèque | initialisation du logging et du tracing | README/TODO/USAGE/CHANGELOG présents | +| `ks-program-ids` | bibliothèque | registre des programmes et comptes Solana connus | README/TODO/USAGE/CHANGELOG présents | +| `ks-pipeline` | bibliothèque | backfill, extraction, replay, stateful, préflight et orchestration | README/TODO/USAGE/CHANGELOG présents | +| `ks-pipeline-demo-scenarios` | bibliothèque + binaire | scénarios Devnet réutilisables et CLI | renommage `0.5.1`, audit `0.5.4` | +| `ks-onchain-transport` | bibliothèque | transports RPC HTTP/WebSocket et pools d’endpoints | README/TODO/USAGE/CHANGELOG présents | +| `ks-store` | bibliothèque | contrats de stockage et adaptateur PostgreSQL | renommage `0.5.1`, normalisation `0.5.3` | +| `ks-wallet` | bibliothèque | wallet temporaire et frontière de signataire | renommage `0.5.1`, refonte `0.5.2` | | `kb-app-demo-desktop` | bibliothèque + binaire | application de démonstration Tauri | documentée ; réconciliation en `0.5.4` | La table décrit les noms physiques du workspace `0.5.0`. La migration `0.5.1` renomme les dix crates généralistes en `ks-core`, `ks-config`, `ks-lib`, `ks-logging`, `ks-program-ids`, `ks-pipeline`, `ks-pipeline-demo-scenarios`, `ks-onchain-transport`, `ks-store` et `ks-wallet`. `kb-app-demo-desktop` conserve son nom parce qu’il appartient au domaine applicatif Bot. Voir [`../decisions/KHADHROONY_SOLANA_NAMESPACE_POLICY.md`](../decisions/KHADHROONY_SOLANA_NAMESPACE_POLICY.md). @@ -25,21 +25,21 @@ La table décrit les noms physiques du workspace `0.5.0`. La migration `0.5.1` r La migration a regroupé de nombreuses anciennes crates dans des frontières plus larges : -- les modèles et APIs de décodage, matérialisation et exécution ont rejoint `kb-lib` ; -- les implémentations de stockage core et PostgreSQL ont rejoint `kb-store` ; -- les responsabilités de pipeline ont été réunies dans `kb-pipeline` ; -- les transports Solana sont réunis dans `kb-onchain-transport` ; +- les modèles et APIs de décodage, matérialisation et exécution ont rejoint `ks-lib` ; +- les implémentations de stockage core et PostgreSQL ont rejoint `ks-store` ; +- les responsabilités de pipeline ont été réunies dans `ks-pipeline` ; +- les transports Solana sont réunis dans `ks-onchain-transport` ; - l’application et sa bibliothèque sont réunies dans `kb-app-demo-desktop` ; -- les scénarios réutilisables ont été extraits dans `kb-pipeline-demo-scenarios`. +- les scénarios réutilisables ont été extraits dans `ks-pipeline-demo-scenarios`. Cette carte n’est pas une table de compatibilité exhaustive des anciennes crates. Les correspondances historiques détaillées seront synthétisées dans la documentation de migration et l’audit d’alignement. ## 3. Crates mixtes -### 3.1 `kb-pipeline-demo-scenarios` +### 3.1 `ks-pipeline-demo-scenarios` -- bibliothèque Rust : `kb_pipeline_demo_scenarios` ; -- binaire : `kb-pipeline-demo-scenarios-cli` ; +- bibliothèque Rust : `ks_pipeline_demo_scenarios` ; +- binaire : `ks-pipeline-demo-scenarios-cli` ; - `autobins = false` évite une cible implicite concurrente. ### 3.2 `kb-app-demo-desktop` diff --git a/docs/architecture/PIPELINE_ARCHITECTURE.md b/docs/architecture/PIPELINE_ARCHITECTURE.md index c6a48dc..96bbe60 100644 --- a/docs/architecture/PIPELINE_ARCHITECTURE.md +++ b/docs/architecture/PIPELINE_ARCHITECTURE.md @@ -1,11 +1,11 @@ - + # Architecture du pipeline ## 1. Responsabilité -`kb-pipeline` coordonne des opérations généralistes qui traversent plusieurs crates sans devenir propriétaire de leurs implémentations : transport, stockage, contrats de décodage, matérialisation et exécution. Il ne dépend d’aucun scénario, wallet ou actif propre à un réseau de démonstration. +`ks-pipeline` coordonne des opérations généralistes qui traversent plusieurs crates sans devenir propriétaire de leurs implémentations : transport, stockage, contrats de décodage, matérialisation et exécution. Il ne dépend d’aucun scénario, wallet ou actif propre à un réseau de démonstration. ## 2. Familles de traitements @@ -19,7 +19,7 @@ L’extraction Core transforme les transactions stockées en représentations d ### 2.3 Replay de décodage -Le replay sélectionne des candidats, applique les décodeurs compatibles de `kb-lib`, conserve diagnostics et preuves, puis déclenche les matérialisateurs demandés. La reprise doit préserver l’idempotence et les frontières de campagne. +Le replay sélectionne des candidats, applique les décodeurs compatibles de `ks-lib`, conserve diagnostics et preuves, puis déclenche les matérialisateurs demandés. La reprise doit préserver l’idempotence et les frontières de campagne. ### 2.4 Traitements stateful @@ -27,28 +27,28 @@ Les modules stateful corrèlent instructions, comptes, états précédents et r ### 2.5 Préflight et exécution -Le pipeline assemble les contrôles préalables, plans préparés, signataires, preuves, simulation et validation postérieure. Les exécuteurs restent définis dans `kb-lib` ; le pipeline orchestre leur utilisation. +Le pipeline assemble les contrôles préalables, plans préparés, signataires, preuves, simulation et validation postérieure. Les exécuteurs restent définis dans `ks-lib` ; le pipeline orchestre leur utilisation. ## 3. Dépendances fonctionnelles ```text -kb-onchain-transport -> acquisition et appels RPC -kb-store -> lecture/écriture canonique et replay -kb-lib -> contrats et implémentations métier -kb-config -> profils et paramètres opérationnels -kb-logging -> observabilité -kb-wallet -> signataires lorsque requis +ks-onchain-transport -> acquisition et appels RPC +ks-store -> lecture/écriture canonique et replay +ks-lib -> contrats et implémentations métier +ks-config -> profils et paramètres opérationnels +ks-logging -> observabilité +ks-wallet -> signataires lorsque requis ``` ## 4. Scénarios de démonstration -`kb-pipeline-demo-scenarios` contient les fixtures, aides de campagne et scénarios réutilisables spécifiques à Devnet ou Testnet. Le desktop doit appeler ces scénarios lorsqu’ils existent plutôt que maintenir une seconde implémentation métier du même parcours. +`ks-pipeline-demo-scenarios` contient les fixtures, aides de campagne et scénarios réutilisables spécifiques à Devnet ou Testnet. Le desktop doit appeler ces scénarios lorsqu’ils existent plutôt que maintenir une seconde implémentation métier du même parcours. -Cette crate peut préparer des wallets temporaires, demander des airdrops, créer des mints ou comptes de test, enchaîner plusieurs opérations et réunir les preuves d’une campagne réseau. Ces responsabilités spécifiques aux validations réseau ne doivent pas remonter dans `kb-pipeline`. +Cette crate peut préparer des wallets temporaires, demander des airdrops, créer des mints ou comptes de test, enchaîner plusieurs opérations et réunir les preuves d’une campagne réseau. Ces responsabilités spécifiques aux validations réseau ne doivent pas remonter dans `ks-pipeline`. -Le binaire `kb-pipeline-demo-scenarios-cli` est actuellement un outil ciblé de préparation des fixtures SPL Token-2022 réutilisées par les démonstrations Devnet. Son existence ne signifie pas que chaque scénario doit être exposé par un CLI ni que le desktop doit consommer ses scénarios. +Le binaire `ks-pipeline-demo-scenarios-cli` est actuellement un outil ciblé de préparation des fixtures SPL Token-2022 réutilisées par les démonstrations Devnet. Son existence ne signifie pas que chaque scénario doit être exposé par un CLI ni que le desktop doit consommer ses scénarios. -`kb-app-demo-desktop` conserve ses commandes Tauri, états, payloads et parcours de présentation Devnet/Testnet. La logique réutilisable de préparation et d’exécution de campagne appartient à `kb-pipeline-demo-scenarios`, renommée `ks-pipeline-demo-scenarios` en `0.5.1`. `0.5.4` auditera les scénarios encore déclarés directement dans le desktop et déplacera ceux qui sont réutilisables. La dépendance inverse de `kb-pipeline` vers les scénarios reste interdite et cette règle se conserve après migration vers `ks-pipeline`. +`kb-app-demo-desktop` conserve ses commandes Tauri, états, payloads et parcours de présentation Devnet/Testnet. La logique réutilisable de préparation et d’exécution de campagne appartient à `ks-pipeline-demo-scenarios`, renommée `ks-pipeline-demo-scenarios` en `0.5.1`. `0.5.4` auditera les scénarios encore déclarés directement dans le desktop et déplacera ceux qui sont réutilisables. La dépendance inverse de `ks-pipeline` vers les scénarios reste interdite et cette règle se conserve après migration vers `ks-pipeline`. ## 5. Contrats de preuve diff --git a/docs/architecture/PROJECT_OBJECTIVES.md b/docs/architecture/PROJECT_OBJECTIVES.md index 87728fa..88d13ce 100644 --- a/docs/architecture/PROJECT_OBJECTIVES.md +++ b/docs/architecture/PROJECT_OBJECTIVES.md @@ -1,5 +1,5 @@ - + # Objectifs du projet Khadhroony Bot3 @@ -29,7 +29,7 @@ Le projet vise à : ### 3.1 Consolidation contrôlée -La consolidation ne signifie pas l’effacement des frontières métier. `kb-lib` regroupe les modèles, décodeurs, exécuteurs et matérialisateurs dans des modules dédiés. `kb-store`, `kb-pipeline` et `kb-onchain-transport` restent des crates séparées parce qu’ils représentent des responsabilités opérationnelles différentes. +La consolidation ne signifie pas l’effacement des frontières métier. `ks-lib` regroupe les modèles, décodeurs, exécuteurs et matérialisateurs dans des modules dédiés. `ks-store`, `ks-pipeline` et `ks-onchain-transport` restent des crates séparées parce qu’ils représentent des responsabilités opérationnelles différentes. ### 3.2 Contrats explicites diff --git a/docs/architecture/STORAGE_ARCHITECTURE.md b/docs/architecture/STORAGE_ARCHITECTURE.md index 2a086fe..804bfd8 100644 --- a/docs/architecture/STORAGE_ARCHITECTURE.md +++ b/docs/architecture/STORAGE_ARCHITECTURE.md @@ -1,11 +1,11 @@ - + # Architecture du stockage -## 1. Responsabilité de `kb-store` +## 1. Responsabilité de `ks-store` -`kb-store` réunit : +`ks-store` réunit : - les contrats store-neutral ; - les DTO et entités persistées ; @@ -34,7 +34,7 @@ Le module PostgreSQL possède : ### 2.3 Modèles partagés -Les modèles métier communs restent dans `kb-lib` lorsqu’ils dépassent la seule persistance. `kb-store` ne doit pas créer une seconde définition concurrente d’un contrat partagé. +Les modèles métier communs restent dans `ks-lib` lorsqu’ils dépassent la seule persistance. `ks-store` ne doit pas créer une seconde définition concurrente d’un contrat partagé. ## 3. Catégories de données @@ -47,7 +47,7 @@ Le stockage couvre plusieurs niveaux : - états de campagne et candidats de replay ; - informations opérationnelles et de santé. -Les noms de tables, contrats de replay et APIs publiques sont documentés dans `kb-store/USAGE.md` à partir des exports et migrations actuels. +Les noms de tables, contrats de replay et APIs publiques sont documentés dans `ks-store/USAGE.md` à partir des exports et migrations actuels. ## 4. Propriétés attendues diff --git a/docs/architecture/SURFACE_CRATE_MATRIX.md b/docs/architecture/SURFACE_CRATE_MATRIX.md index c9a39bf..3a92b9c 100644 --- a/docs/architecture/SURFACE_CRATE_MATRIX.md +++ b/docs/architecture/SURFACE_CRATE_MATRIX.md @@ -1,5 +1,5 @@ - + # Matrice des responsabilités par surface @@ -13,7 +13,7 @@ ## 2. Matrice -| Surface | `kb-lib` | `kb-pipeline` | `kb-store` | `kb-onchain-transport` | `kb-pipeline-demo-scenarios` | `kb-app-demo-desktop` | +| Surface | `ks-lib` | `ks-pipeline` | `ks-store` | `ks-onchain-transport` | `ks-pipeline-demo-scenarios` | `kb-app-demo-desktop` | |---------------------------|--------------------------------------------------------------------------------|------------------------------------------------------|-----------------------|-------------------------------|--------------------------------------------------------|-----------------------------------------------------| | Solana Core | décodeurs, exécuteurs et matérialisateurs | extraction, replay, stateful et exécution | persistance générique | RPC HTTP/WS | validations Devnet | panneaux fonctionnels | | SPL Memo | décodage v1/v3/v4 ; exécution v4 | replay et exécution v4 | persistance générique | RPC | scénario Memo v4 | panneau Memo v4 | @@ -29,7 +29,7 @@ Cette matrice décrit les responsabilités observées au niveau architectural. Elle ne déclare pas une couverture exhaustive de chaque instruction ou compte. La couverture détaillée reste démontrée par le code, les tests, les matrices sous `test-fixtures/contract-matrices/` et les rapports de validation actifs ou archivés. -La persistance des surfaces Metadata repose sur les contrats génériques de decode/materialization de `kb-store`. Leur séparation métier est portée notamment par les identités de processeur, les familles matérialisées, les clés de sortie et les payloads versionnés ; `0.4.8` n’introduit donc pas de schéma PostgreSQL spécialisé par protocole Metadata. +La persistance des surfaces Metadata repose sur les contrats génériques de decode/materialization de `ks-store`. Leur séparation métier est portée notamment par les identités de processeur, les familles matérialisées, les clés de sortie et les payloads versionnés ; `0.4.8` n’introduit donc pas de schéma PostgreSQL spécialisé par protocole Metadata. ## 4. Statuts sensibles @@ -38,4 +38,4 @@ La persistance des surfaces Metadata repose sur les contrats génériques de dec - Solana Program Metadata est couvert par neuf opérations stables, toutes validées sur Devnet. - Token-2022 Token Metadata est couvert par cinq opérations d’interface, toutes validées sur Devnet. - Metaplex Token Metadata est clos pour la matrice courante de `0.4.8` avec 15 opérations `confirmed`, 5 `unavailable` et 0 `not_run` ; les opérations indisponibles ne doivent pas être promues sans nouvelle preuve réseau. -- La priorité trading des versions suivantes n’altère pas la vocation généraliste de `kb-lib` : les autres Program IDs restent dans le périmètre de couverture et peuvent être différés selon leur priorité de développement. +- La priorité trading des versions suivantes n’altère pas la vocation généraliste de `ks-lib` : les autres Program IDs restent dans le périmètre de couverture et peuvent être différés selon leur priorité de développement. diff --git a/docs/decisions/DOCUMENT_ARCHIVE_SELECTION_POLICY.md b/docs/decisions/DOCUMENT_ARCHIVE_SELECTION_POLICY.md index 9fb64f3..46ce6b1 100644 --- a/docs/decisions/DOCUMENT_ARCHIVE_SELECTION_POLICY.md +++ b/docs/decisions/DOCUMENT_ARCHIVE_SELECTION_POLICY.md @@ -1,5 +1,5 @@ - + # Politique de sélection des archives documentaires @@ -61,8 +61,8 @@ kb_app_demo/package.json kb_app_demo/tauri.conf.json kb_app_demo/tsconfig.json kb_rpc/tests/fixtures/*.json -kb_store_core/src/** -kb_store_pg/src/** +ks_store_core/src/** +ks_store_pg/src/** ``` ## 7. Évolution de l’archive diff --git a/docs/decisions/KHADHROONY_SOLANA_NAMESPACE_POLICY.md b/docs/decisions/KHADHROONY_SOLANA_NAMESPACE_POLICY.md index e1164af..755c481 100644 --- a/docs/decisions/KHADHROONY_SOLANA_NAMESPACE_POLICY.md +++ b/docs/decisions/KHADHROONY_SOLANA_NAMESPACE_POLICY.md @@ -1,5 +1,5 @@ - + # Politique de namespace Khadhroony Solana @@ -7,7 +7,7 @@ Cette décision est adoptée pendant la clôture de `0.5.0` et devient la cible normative des migrations de fondation `0.5.1` à `0.5.3`. -Le workspace `0.5.0` conserve encore physiquement les noms `kb-*`, `kb_*`, `KB_*`, `kb-lib.*` et `kb_sol_*` là où ils existent. Leur présence avant migration ne remet pas en cause la cible ci-dessous. +À partir de `0.5.1-pre.002`, les dix crates Solana généralistes sont physiquement nommées `ks-*` et leurs identifiants Rust `ks_*`. Les namespaces historiques `KB_*`, `kb-lib.*` et `kb_sol_*` restent temporairement présents jusqu'aux prereleases dédiées ; leur présence pendant cette migration bornée ne remet pas en cause la cible ci-dessous. Le renommage des bibliothèques internes ne renomme pas le workspace, le dépôt ni le répertoire racine : ils restent `khadhroony-bot3` pendant toute la série pré-`1.0`. Un éventuel renommage du workspace racine est explicitement hors périmètre de `0.5.x` et ne doit intervenir qu'en `1.0` ou ultérieurement sur décision dédiée. @@ -23,22 +23,22 @@ Le renommage des bibliothèques internes ne renomme pas le workspace, le dépôt ## 3. Crates Solana généralistes -La migration `0.5.1` doit renommer les dix crates généralistes suivantes : +La migration `0.5.1-pre.002` renomme les dix crates généralistes suivantes : -| Nom `0.5.0` | Nom cible | -|------------------------------|------------------------------| -| `kb-core` | `ks-core` | -| `kb-config` | `ks-config` | -| `kb-lib` | `ks-lib` | -| `kb-logging` | `ks-logging` | -| `kb-program-ids` | `ks-program-ids` | -| `kb-pipeline` | `ks-pipeline` | +| Nom `0.5.0` | Nom cible | +|---|---| +| `kb-core` | `ks-core` | +| `kb-config` | `ks-config` | +| `kb-lib` | `ks-lib` | +| `kb-logging` | `ks-logging` | +| `kb-program-ids` | `ks-program-ids` | +| `kb-pipeline` | `ks-pipeline` | | `kb-pipeline-demo-scenarios` | `ks-pipeline-demo-scenarios` | -| `kb-onchain-transport` | `ks-onchain-transport` | -| `kb-store` | `ks-store` | -| `kb-wallet` | `ks-wallet` | +| `kb-onchain-transport` | `ks-onchain-transport` | +| `kb-store` | `ks-store` | +| `kb-wallet` | `ks-wallet` | -Les identifiants Rust correspondants migrent vers `ks_*` : par exemple `kb_config` devient `ks_config` et `kb_pipeline_demo_scenarios` devient `ks_pipeline_demo_scenarios`. +Les identifiants Rust correspondants migrent dans le même delta vers `ks_*` : par exemple `kb_config` devient `ks_config` et `kb_pipeline_demo_scenarios` devient `ks_pipeline_demo_scenarios`. La migration doit couvrir les manifests, chemins de workspace, imports, exports, tests d'API externe, scripts, documentation, targets de build et bindings générés à la source. Les artefacts générés restent régénérés localement selon les règles du workspace et ne sont pas livrés sans nécessité explicite. diff --git a/docs/guides/CONFIGURATION.md b/docs/guides/CONFIGURATION.md index aea8577..13c3e03 100644 --- a/docs/guides/CONFIGURATION.md +++ b/docs/guides/CONFIGURATION.md @@ -1,11 +1,11 @@ - + # Guide de configuration ## Objectif -Ce guide décrit le chargement et l’utilisation de la configuration bot3. La référence d’API détaillée reste `kb-config/USAGE.md`. +Ce guide décrit le chargement et l’utilisation de la configuration bot3. La référence d’API détaillée reste `ks-config/USAGE.md`. ## Fichiers actifs @@ -28,21 +28,21 @@ Le format actif est JSON. Le futur split de configuration prévu en `0.5.x` ne m ## Exemple opérateur ```rust -let environment = match kb_config::load_workspace_environment( +let environment = match ks_config::load_workspace_environment( std::path::Path::new("."), ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; -let config = match kb_config::load_config_from_path( +let config = match ks_config::load_config_from_path( std::path::Path::new("config/example.config.json"), ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; -let profile = match kb_config::active_profile(&config) { +let profile = match ks_config::active_profile(&config) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -83,8 +83,8 @@ Pour isoler une erreur : ## Références -- `kb-config/README.md` ; -- `kb-config/USAGE.md` ; -- `kb-config/TODO.md` ; +- `ks-config/README.md` ; +- `ks-config/USAGE.md` ; +- `ks-config/TODO.md` ; - `config/README.md` ; - `docs/decisions/WINCODE_COMPATIBILITY_POLICY.md`. diff --git a/docs/guides/DEVNET_VALIDATION.md b/docs/guides/DEVNET_VALIDATION.md index 0af0ea6..cf2a087 100644 --- a/docs/guides/DEVNET_VALIDATION.md +++ b/docs/guides/DEVNET_VALIDATION.md @@ -1,5 +1,5 @@ - + # Guide de validation Devnet @@ -33,7 +33,7 @@ Le rapport doit indiquer précisément les niveaux réellement exécutés. ## Commandes -Les scénarios peuvent être déclenchés depuis `kb-pipeline-demo-scenarios` ou le desktop. La validation frontend se fait uniquement avec : +Les scénarios peuvent être déclenchés depuis `ks-pipeline-demo-scenarios` ou le desktop. La validation frontend se fait uniquement avec : ```bash cargo tauri dev -c kb-app-demo-desktop/tauri.conf.json @@ -61,12 +61,12 @@ Le registre ElGamal ne doit pas être déclaré validé sur Devnet ou Mainnet sa - `docs/validation/V0_4_7_METAPLEX_TOKEN_METADATA_VALIDATION_REPORT.md` ; - `docs/DEVNET_EXECUTION_GUIDE.md` ; -- `kb-pipeline-demo-scenarios/USAGE.md` ; +- `ks-pipeline-demo-scenarios/USAGE.md` ; - `kb-app-demo-desktop/USAGE.md`. ## Metaplex Token Metadata -Les scénarios Metadata utilisent un profil Devnet existant, le runner de `kb-pipeline-demo-scenarios` et le panneau `demo_execution_metadata`. Les PDA dérivables ne doivent pas être saisis manuellement. Chaque parcours prépare sa fixture et dérive automatiquement les PDA et comptes de postcondition nécessaires à l’étape courante. +Les scénarios Metadata utilisent un profil Devnet existant, le runner de `ks-pipeline-demo-scenarios` et le panneau `demo_execution_metadata`. Les PDA dérivables ne doivent pas être saisis manuellement. Chaque parcours prépare sa fixture et dérive automatiquement les PDA et comptes de postcondition nécessaires à l’étape courante. Une liste de profils vide est une erreur de configuration ou de raccordement et doit être signalée explicitement. Une validation réseau exige une simulation RPC réelle ; une soumission exige en plus confirmation opérateur, signature, confirmation et postconditions observées. diff --git a/docs/guides/LOGGING.md b/docs/guides/LOGGING.md index 0896c1c..a0c267b 100644 --- a/docs/guides/LOGGING.md +++ b/docs/guides/LOGGING.md @@ -1,28 +1,28 @@ - + # Guide de logging et tracing ## Objectif -`kb-logging` initialise les routes de tracing définies par la configuration et conserve les guards nécessaires à leur durée de vie. +`ks-logging` initialise les routes de tracing définies par la configuration et conserve les guards nécessaires à leur durée de vie. ## Flux de démarrage -1. charger et valider la configuration avec `kb-config` ; +1. charger et valider la configuration avec `ks-config` ; 2. construire `LoggingConfig` ; -3. appeler `kb_logging::init_logging` une seule fois ; +3. appeler `ks_logging::init_logging` une seule fois ; 4. conserver `LoggingGuard` jusqu’à la fermeture du processus ; 5. émettre les événements avec des targets canoniques. ```rust -let guard = match kb_logging::init_logging(&config.logging) { +let guard = match ks_logging::init_logging(&config.logging) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; tracing::info!( - target: kb_logging::tracing_target(), + target: ks_logging::tracing_target(), routes = guard.route_count(), "logging initialized" ); @@ -46,9 +46,9 @@ Les routes fichier ne doivent jamais écrire de secrets ou de keypairs. Les targets suivent les conventions du workspace, par exemple : ```text -kb-pipeline.backfill -kb-pipeline.decode-replay -kb-onchain-transport.http +ks-pipeline.backfill +ks-pipeline.decode-replay +ks-onchain-transport.http kb-lib.executor.spl.token-2022 kb-lib.materializer.compliance.audit kb-lib.materializer.token.accounts @@ -73,7 +73,7 @@ Les fenêtres Tauri utilisent la permission tracing prévue par leurs capabiliti ## Références -- `kb-logging/README.md` ; -- `kb-logging/USAGE.md` ; -- `kb-config/USAGE.md` ; +- `ks-logging/README.md` ; +- `ks-logging/USAGE.md` ; +- `ks-config/USAGE.md` ; - `docs/architecture/ARCHITECTURE.md`. diff --git a/docs/guides/POSTGRES_STORAGE.md b/docs/guides/POSTGRES_STORAGE.md index 54b7dfb..0c74924 100644 --- a/docs/guides/POSTGRES_STORAGE.md +++ b/docs/guides/POSTGRES_STORAGE.md @@ -1,16 +1,16 @@ - + # Guide PostgreSQL et contrats de stockage ## Objectif -`kb-store` consolide les contrats de stockage Core, raw, decode et PostgreSQL de bot2 dans une crate unique. +`ks-store` consolide les contrats de stockage Core, raw, decode et PostgreSQL de bot2 dans une crate unique. ## Connexion ```rust -let options = match kb_store::PostgresStoreOptions::new( +let options = match ks_store::PostgresStoreOptions::new( database_url, 10, 10_000, @@ -20,7 +20,7 @@ let options = match kb_store::PostgresStoreOptions::new( std::result::Result::Err(error) => return std::result::Result::Err(error), }; -let store = match kb_store::PostgresStore::connect(options).await { +let store = match ks_store::PostgresStore::connect(options).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -62,5 +62,5 @@ Les traits publics séparent le contrat de l’implémentation PostgreSQL. Les o ## Références - `docs/architecture/STORAGE_ARCHITECTURE.md` ; -- `kb-store/USAGE.md` ; -- `kb-store/README.md`. +- `ks-store/USAGE.md` ; +- `ks-store/README.md`. diff --git a/docs/guides/REPLAY_CORE_EXTRACTION_AND_MATERIALIZATION.md b/docs/guides/REPLAY_CORE_EXTRACTION_AND_MATERIALIZATION.md index e6a6799..564038a 100644 --- a/docs/guides/REPLAY_CORE_EXTRACTION_AND_MATERIALIZATION.md +++ b/docs/guides/REPLAY_CORE_EXTRACTION_AND_MATERIALIZATION.md @@ -1,5 +1,5 @@ - + # Guide extraction Core, replay et matérialisation @@ -24,7 +24,7 @@ matérialisation optionnelle L’extraction transforme une transaction canonique persistée en entités Core normalisées. Elle doit conserver les index, comptes, Program IDs, succès ou échec de transaction et contexte nécessaire aux instructions internes. ```rust -let summary = match kb_pipeline::execute_core_extraction( +let summary = match ks_pipeline::execute_core_extraction( request, observer, ).await { @@ -72,6 +72,6 @@ La progression persistée ne doit avancer qu’après clôture cohérente du can - `docs/architecture/PIPELINE_ARCHITECTURE.md` ; - `docs/architecture/STORAGE_ARCHITECTURE.md` ; -- `kb-pipeline/USAGE.md` ; -- `kb-lib/USAGE.md` ; -- `kb-store/USAGE.md`. +- `ks-pipeline/USAGE.md` ; +- `ks-lib/USAGE.md` ; +- `ks-store/USAGE.md`. diff --git a/docs/guides/RPC_BACKFILL_AND_WEBSOCKET.md b/docs/guides/RPC_BACKFILL_AND_WEBSOCKET.md index e2dcf5e..e2d1aab 100644 --- a/docs/guides/RPC_BACKFILL_AND_WEBSOCKET.md +++ b/docs/guides/RPC_BACKFILL_AND_WEBSOCKET.md @@ -1,26 +1,26 @@ - + # Guide RPC, backfill et WebSocket ## Séparation des responsabilités -- `kb-onchain-transport` communique avec les endpoints ; -- `kb-pipeline` orchestre les campagnes ; -- `kb-store` persiste les acquisitions canoniques et la progression ; +- `ks-onchain-transport` communique avec les endpoints ; +- `ks-pipeline` orchestre les campagnes ; +- `ks-store` persiste les acquisitions canoniques et la progression ; - `kb-app-demo-desktop` fournit une interface opérateur ; -- `kb-pipeline-demo-scenarios` construit et exécute les scénarios réutilisables de démonstration et de validation, notamment sur Devnet. +- `ks-pipeline-demo-scenarios` construit et exécute les scénarios réutilisables de démonstration et de validation, notamment sur Devnet. ## Passage d’un scénario validé vers le pipeline -`kb-pipeline-demo-scenarios` n’est pas la destination finale d’une logique réutilisable en production. Son rôle est de composer des APIs publiques existantes, préparer les fixtures, imposer les garde-fous opérateur et démontrer un parcours complet sur un réseau de validation. +`ks-pipeline-demo-scenarios` n’est pas la destination finale d’une logique réutilisable en production. Son rôle est de composer des APIs publiques existantes, préparer les fixtures, imposer les garde-fous opérateur et démontrer un parcours complet sur un réseau de validation. Lorsqu’un composant d’un scénario est validé et qu’il est générique, déterministe et utilisable indépendamment de la démonstration, il doit résider dans la couche appropriée : -- `kb-lib` pour le décodage, la matérialisation, la construction d’instructions, les préflights et les politiques de sécurité ; -- `kb-onchain-transport` pour les opérations réseau génériques ; -- `kb-store` pour les contrats de persistance ; -- `kb-pipeline` pour l’orchestration réutilisable, y compris sur Mainnet lorsque le profil, la politique et l’appelant l’autorisent. +- `ks-lib` pour le décodage, la matérialisation, la construction d’instructions, les préflights et les politiques de sécurité ; +- `ks-onchain-transport` pour les opérations réseau génériques ; +- `ks-store` pour les contrats de persistance ; +- `ks-pipeline` pour l’orchestration réutilisable, y compris sur Mainnet lorsque le profil, la politique et l’appelant l’autorisent. La crate de scénarios conserve : @@ -49,7 +49,7 @@ Avant une campagne : Le backfill parcourt les signatures, charge les transactions et les adapte vers le contrat canonique avant stockage. ```rust -let summary = match kb_pipeline::execute_http_backfill( +let summary = match ks_pipeline::execute_http_backfill( request, observer, ).await { @@ -96,6 +96,6 @@ Distinguer : ## Références -- `kb-onchain-transport/USAGE.md` ; -- `kb-pipeline/USAGE.md` ; +- `ks-onchain-transport/USAGE.md` ; +- `ks-pipeline/USAGE.md` ; - `kb-app-demo-desktop/USAGE.md`. diff --git a/docs/plans/V0_5_1_KHADHROONY_SOLANA_NAMESPACE_AND_CONFIG_PLAN.md b/docs/plans/V0_5_1_KHADHROONY_SOLANA_NAMESPACE_AND_CONFIG_PLAN.md index 8942321..2230581 100644 --- a/docs/plans/V0_5_1_KHADHROONY_SOLANA_NAMESPACE_AND_CONFIG_PLAN.md +++ b/docs/plans/V0_5_1_KHADHROONY_SOLANA_NAMESPACE_AND_CONFIG_PLAN.md @@ -1,13 +1,13 @@ - + # Plan temporaire `0.5.1` — namespace Khadhroony Solana et configuration sûre ## 1. Statut et règle de cette prerelease -Ce document est le plan temporaire de `0.5.1`. `0.5.1-pre.001` reste exclusivement consacrée à l'inventaire, aux contrats de migration et au découpage des prereleases. Aucun répertoire de crate n'est renommé dans `pre.001` et aucun comportement runtime n'est restructuré. +Ce document est le plan temporaire de `0.5.1`. `0.5.1-pre.001` a fermé l'inventaire et les contrats de migration. `0.5.1-pre.002` réalise le premier changement structurel : les dix crates Solana généralistes, leurs packages, identifiants Rust, chemins de workspace, tests externes, scripts et CLI migrent vers `ks-*` / `ks_*`. `kb-app-demo-desktop` et le workspace racine restent nommés comme avant. -La base `0.5.0-pre.004` a été validée par `cargo fmt --all`, `cargo check --workspace`, `cargo clippy --all-targets`, `python3 scripts/audit_rust_workspace_rules.py` et `cargo test --workspace`. Les tests d'API externe passent également. +La base `0.5.0-pre.004` puis `0.5.1-pre.001` ont été validées par `cargo fmt --all`, `cargo check --workspace`, `cargo clippy --all-targets`, `python3 scripts/audit_rust_workspace_rules.py` et `cargo test --workspace`. Les tests d'API externe passent également. Les validations de `pre.002` doivent être rejouées après application du delta, car les noms de packages et de crates constituent une frontière de compilation réelle. ## 2. Invariant du workspace racine @@ -32,18 +32,18 @@ Les bibliothèques internes Solana migrent vers `ks-*` / `ks_*` et leurs variabl ## 4. Inventaire des crates et ordre de migration -| Package actuel | Identifiant Rust actuel | Package cible | Identifiant Rust cible | Dépendances workspace directes actuelles | Ordre | -|------------------------------|------------------------------|------------------------------|------------------------------|----------------------------------------------------------------------------------------------------|------:| -| `kb-core` | `kb_core` | `ks-core` | `ks_core` | — | 1 | -| `kb-program-ids` | `kb_program_ids` | `ks-program-ids` | `ks_program_ids` | — | 2 | -| `kb-config` | `kb_config` | `ks-config` | `ks_config` | kb-core | 3 | -| `kb-logging` | `kb_logging` | `ks-logging` | `ks_logging` | kb-core | 4 | -| `kb-wallet` | `kb_wallet` | `ks-wallet` | `ks_wallet` | kb-core | 5 | -| `kb-lib` | `kb_lib` | `ks-lib` | `ks_lib` | kb-core, kb-program-ids | 6 | -| `kb-onchain-transport` | `kb_onchain_transport` | `ks-onchain-transport` | `ks_onchain_transport` | kb-config, kb-core, kb-lib | 7 | -| `kb-store` | `kb_store` | `ks-store` | `ks_store` | kb-core, kb-lib | 8 | -| `kb-pipeline` | `kb_pipeline` | `ks-pipeline` | `ks_pipeline` | kb-core, kb-config, kb-lib, kb-onchain-transport, kb-program-ids, kb-store | 9 | -| `kb-pipeline-demo-scenarios` | `kb_pipeline_demo_scenarios` | `ks-pipeline-demo-scenarios` | `ks_pipeline_demo_scenarios` | kb-core, kb-config, kb-lib, kb-onchain-transport, kb-pipeline, kb-program-ids, kb-store, kb-wallet | 10 | +| Package actuel | Identifiant Rust actuel | Package cible | Identifiant Rust cible | Dépendances workspace directes actuelles | Ordre | +|---|---|---|---|---|---:| +| `kb-core` | `kb_core` | `ks-core` | `ks_core` | — | 1 | +| `kb-program-ids` | `kb_program_ids` | `ks-program-ids` | `ks_program_ids` | — | 2 | +| `kb-config` | `kb_config` | `ks-config` | `ks_config` | kb-core | 3 | +| `kb-logging` | `kb_logging` | `ks-logging` | `ks_logging` | kb-core | 4 | +| `kb-wallet` | `kb_wallet` | `ks-wallet` | `ks_wallet` | kb-core | 5 | +| `kb-lib` | `kb_lib` | `ks-lib` | `ks_lib` | kb-core, kb-program-ids | 6 | +| `kb-onchain-transport` | `kb_onchain_transport` | `ks-onchain-transport` | `ks_onchain_transport` | kb-config, kb-core, kb-lib | 7 | +| `kb-store` | `kb_store` | `ks-store` | `ks_store` | kb-core, kb-lib | 8 | +| `kb-pipeline` | `kb_pipeline` | `ks-pipeline` | `ks_pipeline` | kb-core, kb-config, kb-lib, kb-onchain-transport, kb-program-ids, kb-store | 9 | +| `kb-pipeline-demo-scenarios` | `kb_pipeline_demo_scenarios` | `ks-pipeline-demo-scenarios` | `ks_pipeline_demo_scenarios` | kb-core, kb-config, kb-lib, kb-onchain-transport, kb-pipeline, kb-program-ids, kb-store, kb-wallet | 10 | `kb-app-demo-desktop` est adapté en dernier, mais garde son package, son répertoire et ses identifiants applicatifs. @@ -58,18 +58,18 @@ bin : kb-pipeline-demo-scenarios-cli -> ks-pipeline-demo-scenarios-cli Les valeurs suivantes sont des métriques d'orientation sur les fichiers actifs, hors archives et artefacts générés. Elles montrent qu'un renommage massif en une seule opération serait difficile à diagnostiquer. -| Crate | Références package / fichiers | Références identifiant Rust / fichiers | -|------------------------------|------------------------------:|---------------------------------------:| -| `kb-core` | 51 / 32 | 3165 / 407 | -| `kb-config` | 56 / 33 | 201 / 44 | -| `kb-lib` | 3145 / 550 | 2785 / 97 | -| `kb-logging` | 72 / 27 | 22 / 3 | -| `kb-program-ids` | 42 / 28 | 1413 / 334 | -| `kb-pipeline` | 287 / 112 | 436 / 38 | -| `kb-pipeline-demo-scenarios` | 145 / 75 | 173 / 18 | -| `kb-onchain-transport` | 125 / 56 | 530 / 50 | -| `kb-store` | 157 / 81 | 344 / 30 | -| `kb-wallet` | 75 / 30 | 53 / 17 | +| Crate | Références package / fichiers | Références identifiant Rust / fichiers | +|---|---:|---:| +| `kb-core` | 51 / 32 | 3165 / 407 | +| `kb-config` | 56 / 33 | 201 / 44 | +| `kb-lib` | 3145 / 550 | 2785 / 97 | +| `kb-logging` | 72 / 27 | 22 / 3 | +| `kb-program-ids` | 42 / 28 | 1413 / 334 | +| `kb-pipeline` | 287 / 112 | 436 / 38 | +| `kb-pipeline-demo-scenarios` | 145 / 75 | 173 / 18 | +| `kb-onchain-transport` | 125 / 56 | 530 / 50 | +| `kb-store` | 157 / 81 | 344 / 30 | +| `kb-wallet` | 75 / 30 | 53 / 17 | Le volume `kb-lib` inclut notamment les identités techniques `kb-lib.*`; il ne doit pas être interprété comme autant d'importations Cargo. @@ -143,264 +143,264 @@ Les targets de tracing de crates génériques doivent également migrer vers `ks ### 6.1 Inventaire exhaustif des identités `kb-lib.*` -| Identité actuelle | Identité cible | -|----------------------------------------------------------------|----------------------------------------------------------------| -| `kb-lib.decoder.adapter.saber_decimal_wrapper` | `ks-lib-decoder.adapter.saber_decimal_wrapper` | -| `kb-lib.decoder.adapter.spl_token_wrap` | `ks-lib-decoder.adapter.spl_token_wrap` | -| `kb-lib.decoder.admin.jupiter_lock` | `ks-lib-decoder.admin.jupiter_lock` | -| `kb-lib.decoder.admin.pump_fees` | `ks-lib-decoder.admin.pump_fees` | -| `kb-lib.decoder.amm.aldrin_v1` | `ks-lib-decoder.amm.aldrin_v1` | -| `kb-lib.decoder.amm.aldrin_v2` | `ks-lib-decoder.amm.aldrin_v2` | -| `kb-lib.decoder.amm.alphaq` | `ks-lib-decoder.amm.alphaq` | -| `kb-lib.decoder.amm.believe` | `ks-lib-decoder.amm.believe` | -| `kb-lib.decoder.amm.bonk_swap` | `ks-lib-decoder.amm.bonk_swap` | -| `kb-lib.decoder.amm.fluxbeam` | `ks-lib-decoder.amm.fluxbeam` | -| `kb-lib.decoder.amm.goon_fi` | `ks-lib-decoder.amm.goon_fi` | -| `kb-lib.decoder.amm.goosefx_gamma` | `ks-lib-decoder.amm.goosefx_gamma` | -| `kb-lib.decoder.amm.goosefx_v2` | `ks-lib-decoder.amm.goosefx_v2` | -| `kb-lib.decoder.amm.guac_swap` | `ks-lib-decoder.amm.guac_swap` | -| `kb-lib.decoder.amm.lifinity_swap_v2` | `ks-lib-decoder.amm.lifinity_swap_v2` | -| `kb-lib.decoder.amm.metadao_futarchy_amm` | `ks-lib-decoder.amm.metadao_futarchy_amm` | -| `kb-lib.decoder.amm.metadao_v0_5` | `ks-lib-decoder.amm.metadao_v0_5` | -| `kb-lib.decoder.amm.meteora_damm_v1` | `ks-lib-decoder.amm.meteora_damm_v1` | -| `kb-lib.decoder.amm.meteora_damm_v2` | `ks-lib-decoder.amm.meteora_damm_v2` | -| `kb-lib.decoder.amm.obric_v2` | `ks-lib-decoder.amm.obric_v2` | -| `kb-lib.decoder.amm.one_dex` | `ks-lib-decoder.amm.one_dex` | -| `kb-lib.decoder.amm.pump_swap` | `ks-lib-decoder.amm.pump_swap` | -| `kb-lib.decoder.amm.raydium_lp_v4` | `ks-lib-decoder.amm.raydium_lp_v4` | -| `kb-lib.decoder.amm.solfi` | `ks-lib-decoder.amm.solfi` | -| `kb-lib.decoder.amm.solfi_v2` | `ks-lib-decoder.amm.solfi_v2` | -| `kb-lib.decoder.amm.vertigo` | `ks-lib-decoder.amm.vertigo` | -| `kb-lib.decoder.amm.virtuals` | `ks-lib-decoder.amm.virtuals` | -| `kb-lib.decoder.amm.woofi` | `ks-lib-decoder.amm.woofi` | -| `kb-lib.decoder.amm.zero_fi` | `ks-lib-decoder.amm.zero_fi` | -| `kb-lib.decoder.amm.zora` | `ks-lib-decoder.amm.zora` | -| `kb-lib.decoder.anchor` | `ks-lib-decoder.anchor` | -| `kb-lib.decoder.api` | `ks-lib-decoder.api` | -| `kb-lib.decoder.bridge.circle_cctp_token_messenger_minter` | `ks-lib-decoder.bridge.circle_cctp_token_messenger_minter` | -| `kb-lib.decoder.bridge.circle_cctp_token_messenger_minter_v2` | `ks-lib-decoder.bridge.circle_cctp_token_messenger_minter_v2` | -| `kb-lib.decoder.bridge.layer_zero_endpoint` | `ks-lib-decoder.bridge.layer_zero_endpoint` | -| `kb-lib.decoder.bridge.layer_zero_executor` | `ks-lib-decoder.bridge.layer_zero_executor` | -| `kb-lib.decoder.clmm.byreal` | `ks-lib-decoder.clmm.byreal` | -| `kb-lib.decoder.clmm.fusion` | `ks-lib-decoder.clmm.fusion` | -| `kb-lib.decoder.clmm.orca_whirlpool` | `ks-lib-decoder.clmm.orca_whirlpool` | -| `kb-lib.decoder.clmm.pancake_swap` | `ks-lib-decoder.clmm.pancake_swap` | -| `kb-lib.decoder.clmm.raydium` | `ks-lib-decoder.clmm.raydium` | -| `kb-lib.decoder.clmm.stabble` | `ks-lib-decoder.clmm.stabble` | -| `kb-lib.decoder.cpmm.raydium` | `ks-lib-decoder.cpmm.raydium` | -| `kb-lib.decoder.dlmm.meteora` | `ks-lib-decoder.dlmm.meteora` | -| `kb-lib.decoder.fees.bags_fee_share_v1` | `ks-lib-decoder.fees.bags_fee_share_v1` | -| `kb-lib.decoder.fees.bags_fee_share_v2` | `ks-lib-decoder.fees.bags_fee_share_v2` | -| `kb-lib.decoder.fees.pump_fees` | `ks-lib-decoder.fees.pump_fees` | -| `kb-lib.decoder.governance.metadao_bid_wall` | `ks-lib-decoder.governance.metadao_bid_wall` | -| `kb-lib.decoder.governance.metadao_futarchy` | `ks-lib-decoder.governance.metadao_futarchy` | -| `kb-lib.decoder.governance.squads_multisig` | `ks-lib-decoder.governance.squads_multisig` | -| `kb-lib.decoder.launchpad.boop_fun` | `ks-lib-decoder.launchpad.boop_fun` | -| `kb-lib.decoder.launchpad.metadao_ico` | `ks-lib-decoder.launchpad.metadao_ico` | -| `kb-lib.decoder.launchpad.meteora_dbc` | `ks-lib-decoder.launchpad.meteora_dbc` | -| `kb-lib.decoder.launchpad.moonit` | `ks-lib-decoder.launchpad.moonit` | -| `kb-lib.decoder.launchpad.orca_wavebreak` | `ks-lib-decoder.launchpad.orca_wavebreak` | -| `kb-lib.decoder.launchpad.printr` | `ks-lib-decoder.launchpad.printr` | -| `kb-lib.decoder.launchpad.pump_fun` | `ks-lib-decoder.launchpad.pump_fun` | -| `kb-lib.decoder.launchpad.pump_pumpup_ai` | `ks-lib-decoder.launchpad.pump_pumpup_ai` | -| `kb-lib.decoder.launchpad.raydium_launchlab` | `ks-lib-decoder.launchpad.raydium_launchlab` | -| `kb-lib.decoder.launchpad.virtuals` | `ks-lib-decoder.launchpad.virtuals` | -| `kb-lib.decoder.lending.clone` | `ks-lib-decoder.lending.clone` | -| `kb-lib.decoder.lending.jupiter_lend_borrow` | `ks-lib-decoder.lending.jupiter_lend_borrow` | -| `kb-lib.decoder.lending.jupiter_lend_earn` | `ks-lib-decoder.lending.jupiter_lend_earn` | -| `kb-lib.decoder.lending.jupiter_lend_flash_loan` | `ks-lib-decoder.lending.jupiter_lend_flash_loan` | -| `kb-lib.decoder.lending.jupiter_lend_liquidity` | `ks-lib-decoder.lending.jupiter_lend_liquidity` | -| `kb-lib.decoder.lending.kamino` | `ks-lib-decoder.lending.kamino` | -| `kb-lib.decoder.lending.marginfi_v2` | `ks-lib-decoder.lending.marginfi_v2` | -| `kb-lib.decoder.lock.raydium_lp` | `ks-lib-decoder.lock.raydium_lp` | -| `kb-lib.decoder.metadata.metaplex_token_metadata` | `ks-lib-decoder.metadata.metaplex_token_metadata` | -| `kb-lib.decoder.metadata.solana_program_metadata` | `ks-lib-decoder.metadata.solana_program_metadata` | -| `kb-lib.decoder.metadata.spl_name_service` | `ks-lib-decoder.metadata.spl_name_service` | -| `kb-lib.decoder.nft.metaplex_bubblegum` | `ks-lib-decoder.nft.metaplex_bubblegum` | -| `kb-lib.decoder.nft.tensor_cnft` | `ks-lib-decoder.nft.tensor_cnft` | -| `kb-lib.decoder.orderbook.jupiter_limit_order` | `ks-lib-decoder.orderbook.jupiter_limit_order` | -| `kb-lib.decoder.orderbook.jupiter_limit_order_v2` | `ks-lib-decoder.orderbook.jupiter_limit_order_v2` | -| `kb-lib.decoder.orderbook.openbook_v2` | `ks-lib-decoder.orderbook.openbook_v2` | -| `kb-lib.decoder.perpetuals.drift_v2` | `ks-lib-decoder.perpetuals.drift_v2` | -| `kb-lib.decoder.perpetuals.jupiter` | `ks-lib-decoder.perpetuals.jupiter` | -| `kb-lib.decoder.perpetuals.phoenix_eternal` | `ks-lib-decoder.perpetuals.phoenix_eternal` | -| `kb-lib.decoder.perpetuals.zeta` | `ks-lib-decoder.perpetuals.zeta` | -| `kb-lib.decoder.router.dflow_aggregator_v4` | `ks-lib-decoder.router.dflow_aggregator_v4` | -| `kb-lib.decoder.router.jupiter_aggregator_v4` | `ks-lib-decoder.router.jupiter_aggregator_v4` | -| `kb-lib.decoder.router.jupiter_aggregator_v6` | `ks-lib-decoder.router.jupiter_aggregator_v6` | -| `kb-lib.decoder.router.jupiter_dca` | `ks-lib-decoder.router.jupiter_dca` | -| `kb-lib.decoder.router.okx_labs_v1` | `ks-lib-decoder.router.okx_labs_v1` | -| `kb-lib.decoder.router.okx_labs_v2` | `ks-lib-decoder.router.okx_labs_v2` | -| `kb-lib.decoder.rwa.ondo_global_markets` | `ks-lib-decoder.rwa.ondo_global_markets` | -| `kb-lib.decoder.solana.core` | `ks-lib-decoder.solana.core` | -| `kb-lib.decoder.spl.account_compression` | `ks-lib-decoder.spl.account_compression` | -| `kb-lib.decoder.spl.associated_token_account` | `ks-lib-decoder.spl.associated_token_account` | -| `kb-lib.decoder.spl.elgamal_registry` | `ks-lib-decoder.spl.elgamal_registry` | -| `kb-lib.decoder.spl.memo` | `ks-lib-decoder.spl.memo` | -| `kb-lib.decoder.spl.noop` | `ks-lib-decoder.spl.noop` | -| `kb-lib.decoder.spl.single_pool` | `ks-lib-decoder.spl.single_pool` | -| `kb-lib.decoder.spl.stake_pool` | `ks-lib-decoder.spl.stake_pool` | -| `kb-lib.decoder.spl.token` | `ks-lib-decoder.spl.token` | -| `kb-lib.decoder.spl.token_2022` | `ks-lib-decoder.spl.token_2022` | -| `kb-lib.decoder.stable.swap_hylo_exchange` | `ks-lib-decoder.stable.swap_hylo_exchange` | -| `kb-lib.decoder.stable.swap_jupiter_stable` | `ks-lib-decoder.stable.swap_jupiter_stable` | -| `kb-lib.decoder.stable.swap_numeraire` | `ks-lib-decoder.stable.swap_numeraire` | -| `kb-lib.decoder.stable.swap_stabble` | `ks-lib-decoder.stable.swap_stabble` | -| `kb-lib.decoder.staking.jito_tip_distribution` | `ks-lib-decoder.staking.jito_tip_distribution` | -| `kb-lib.decoder.staking.kamino_farm` | `ks-lib-decoder.staking.kamino_farm` | -| `kb-lib.decoder.staking.marinade_finance` | `ks-lib-decoder.staking.marinade_finance` | -| `kb-lib.decoder.staking.solayer` | `ks-lib-decoder.staking.solayer` | -| `kb-lib.decoder.storage.solana_record` | `ks-lib-decoder.storage.solana_record` | -| `kb-lib.decoder.strategy.jupiter_dca` | `ks-lib-decoder.strategy.jupiter_dca` | -| `kb-lib.decoder.treasury.helium_treasury_management` | `ks-lib-decoder.treasury.helium_treasury_management` | -| `kb-lib.decoder.vault.carrot_defi` | `ks-lib-decoder.vault.carrot_defi` | -| `kb-lib.decoder.vault.hylo_stability_pool` | `ks-lib-decoder.vault.hylo_stability_pool` | -| `kb-lib.decoder.vault.kamino` | `ks-lib-decoder.vault.kamino` | -| `kb-lib.decoder.vault.kamino_v2` | `ks-lib-decoder.vault.kamino_v2` | -| `kb-lib.decoder.vault.kamino_yvaults` | `ks-lib-decoder.vault.kamino_yvaults` | -| `kb-lib.decoder.vault.meteora` | `ks-lib-decoder.vault.meteora` | -| `kb-lib.decoder.vesting.jupiter_lock` | `ks-lib-decoder.vesting.jupiter_lock` | -| `kb-lib.decoder.vesting.streamflow` | `ks-lib-decoder.vesting.streamflow` | -| `kb-lib.decoder.wallet.jupiter_apepro_smart_wallet` | `ks-lib-decoder.wallet.jupiter_apepro_smart_wallet` | -| `kb-lib.decoder.weighted.swap_stabble` | `ks-lib-decoder.weighted.swap_stabble` | -| `kb-lib.executor.adapter.saber_decimal_wrapper` | `ks-lib-executor.adapter.saber_decimal_wrapper` | -| `kb-lib.executor.adapter.spl_token_wrap` | `ks-lib-executor.adapter.spl_token_wrap` | -| `kb-lib.executor.amm.aldrin_v1` | `ks-lib-executor.amm.aldrin_v1` | -| `kb-lib.executor.amm.aldrin_v2` | `ks-lib-executor.amm.aldrin_v2` | -| `kb-lib.executor.amm.alphaq` | `ks-lib-executor.amm.alphaq` | -| `kb-lib.executor.amm.believe` | `ks-lib-executor.amm.believe` | -| `kb-lib.executor.amm.bonk_swap` | `ks-lib-executor.amm.bonk_swap` | -| `kb-lib.executor.amm.fluxbeam` | `ks-lib-executor.amm.fluxbeam` | -| `kb-lib.executor.amm.goon_fi` | `ks-lib-executor.amm.goon_fi` | -| `kb-lib.executor.amm.goosefx_gamma` | `ks-lib-executor.amm.goosefx_gamma` | -| `kb-lib.executor.amm.goosefx_v2` | `ks-lib-executor.amm.goosefx_v2` | -| `kb-lib.executor.amm.guac_swap` | `ks-lib-executor.amm.guac_swap` | -| `kb-lib.executor.amm.lifinity_swap_v2` | `ks-lib-executor.amm.lifinity_swap_v2` | -| `kb-lib.executor.amm.metadao_v0_5` | `ks-lib-executor.amm.metadao_v0_5` | -| `kb-lib.executor.amm.meteora_damm_v1` | `ks-lib-executor.amm.meteora_damm_v1` | -| `kb-lib.executor.amm.meteora_damm_v2` | `ks-lib-executor.amm.meteora_damm_v2` | -| `kb-lib.executor.amm.obric_v2` | `ks-lib-executor.amm.obric_v2` | -| `kb-lib.executor.amm.one_dex` | `ks-lib-executor.amm.one_dex` | -| `kb-lib.executor.amm.pump_swap` | `ks-lib-executor.amm.pump_swap` | -| `kb-lib.executor.amm.raydium_lp_v4` | `ks-lib-executor.amm.raydium_lp_v4` | -| `kb-lib.executor.amm.solfi` | `ks-lib-executor.amm.solfi` | -| `kb-lib.executor.amm.solfi_v2` | `ks-lib-executor.amm.solfi_v2` | -| `kb-lib.executor.amm.vertigo` | `ks-lib-executor.amm.vertigo` | -| `kb-lib.executor.amm.woofi` | `ks-lib-executor.amm.woofi` | -| `kb-lib.executor.amm.zero_fi` | `ks-lib-executor.amm.zero_fi` | -| `kb-lib.executor.amm.zora` | `ks-lib-executor.amm.zora` | -| `kb-lib.executor.bridge.circle_cctp_token_messenger_minter` | `ks-lib-executor.bridge.circle_cctp_token_messenger_minter` | +| Identité actuelle | Identité cible | +|---|---| +| `kb-lib.decoder.adapter.saber_decimal_wrapper` | `ks-lib-decoder.adapter.saber_decimal_wrapper` | +| `kb-lib.decoder.adapter.spl_token_wrap` | `ks-lib-decoder.adapter.spl_token_wrap` | +| `kb-lib.decoder.admin.jupiter_lock` | `ks-lib-decoder.admin.jupiter_lock` | +| `kb-lib.decoder.admin.pump_fees` | `ks-lib-decoder.admin.pump_fees` | +| `kb-lib.decoder.amm.aldrin_v1` | `ks-lib-decoder.amm.aldrin_v1` | +| `kb-lib.decoder.amm.aldrin_v2` | `ks-lib-decoder.amm.aldrin_v2` | +| `kb-lib.decoder.amm.alphaq` | `ks-lib-decoder.amm.alphaq` | +| `kb-lib.decoder.amm.believe` | `ks-lib-decoder.amm.believe` | +| `kb-lib.decoder.amm.bonk_swap` | `ks-lib-decoder.amm.bonk_swap` | +| `kb-lib.decoder.amm.fluxbeam` | `ks-lib-decoder.amm.fluxbeam` | +| `kb-lib.decoder.amm.goon_fi` | `ks-lib-decoder.amm.goon_fi` | +| `kb-lib.decoder.amm.goosefx_gamma` | `ks-lib-decoder.amm.goosefx_gamma` | +| `kb-lib.decoder.amm.goosefx_v2` | `ks-lib-decoder.amm.goosefx_v2` | +| `kb-lib.decoder.amm.guac_swap` | `ks-lib-decoder.amm.guac_swap` | +| `kb-lib.decoder.amm.lifinity_swap_v2` | `ks-lib-decoder.amm.lifinity_swap_v2` | +| `kb-lib.decoder.amm.metadao_futarchy_amm` | `ks-lib-decoder.amm.metadao_futarchy_amm` | +| `kb-lib.decoder.amm.metadao_v0_5` | `ks-lib-decoder.amm.metadao_v0_5` | +| `kb-lib.decoder.amm.meteora_damm_v1` | `ks-lib-decoder.amm.meteora_damm_v1` | +| `kb-lib.decoder.amm.meteora_damm_v2` | `ks-lib-decoder.amm.meteora_damm_v2` | +| `kb-lib.decoder.amm.obric_v2` | `ks-lib-decoder.amm.obric_v2` | +| `kb-lib.decoder.amm.one_dex` | `ks-lib-decoder.amm.one_dex` | +| `kb-lib.decoder.amm.pump_swap` | `ks-lib-decoder.amm.pump_swap` | +| `kb-lib.decoder.amm.raydium_lp_v4` | `ks-lib-decoder.amm.raydium_lp_v4` | +| `kb-lib.decoder.amm.solfi` | `ks-lib-decoder.amm.solfi` | +| `kb-lib.decoder.amm.solfi_v2` | `ks-lib-decoder.amm.solfi_v2` | +| `kb-lib.decoder.amm.vertigo` | `ks-lib-decoder.amm.vertigo` | +| `kb-lib.decoder.amm.virtuals` | `ks-lib-decoder.amm.virtuals` | +| `kb-lib.decoder.amm.woofi` | `ks-lib-decoder.amm.woofi` | +| `kb-lib.decoder.amm.zero_fi` | `ks-lib-decoder.amm.zero_fi` | +| `kb-lib.decoder.amm.zora` | `ks-lib-decoder.amm.zora` | +| `kb-lib.decoder.anchor` | `ks-lib-decoder.anchor` | +| `kb-lib.decoder.api` | `ks-lib-decoder.api` | +| `kb-lib.decoder.bridge.circle_cctp_token_messenger_minter` | `ks-lib-decoder.bridge.circle_cctp_token_messenger_minter` | +| `kb-lib.decoder.bridge.circle_cctp_token_messenger_minter_v2` | `ks-lib-decoder.bridge.circle_cctp_token_messenger_minter_v2` | +| `kb-lib.decoder.bridge.layer_zero_endpoint` | `ks-lib-decoder.bridge.layer_zero_endpoint` | +| `kb-lib.decoder.bridge.layer_zero_executor` | `ks-lib-decoder.bridge.layer_zero_executor` | +| `kb-lib.decoder.clmm.byreal` | `ks-lib-decoder.clmm.byreal` | +| `kb-lib.decoder.clmm.fusion` | `ks-lib-decoder.clmm.fusion` | +| `kb-lib.decoder.clmm.orca_whirlpool` | `ks-lib-decoder.clmm.orca_whirlpool` | +| `kb-lib.decoder.clmm.pancake_swap` | `ks-lib-decoder.clmm.pancake_swap` | +| `kb-lib.decoder.clmm.raydium` | `ks-lib-decoder.clmm.raydium` | +| `kb-lib.decoder.clmm.stabble` | `ks-lib-decoder.clmm.stabble` | +| `kb-lib.decoder.cpmm.raydium` | `ks-lib-decoder.cpmm.raydium` | +| `kb-lib.decoder.dlmm.meteora` | `ks-lib-decoder.dlmm.meteora` | +| `kb-lib.decoder.fees.bags_fee_share_v1` | `ks-lib-decoder.fees.bags_fee_share_v1` | +| `kb-lib.decoder.fees.bags_fee_share_v2` | `ks-lib-decoder.fees.bags_fee_share_v2` | +| `kb-lib.decoder.fees.pump_fees` | `ks-lib-decoder.fees.pump_fees` | +| `kb-lib.decoder.governance.metadao_bid_wall` | `ks-lib-decoder.governance.metadao_bid_wall` | +| `kb-lib.decoder.governance.metadao_futarchy` | `ks-lib-decoder.governance.metadao_futarchy` | +| `kb-lib.decoder.governance.squads_multisig` | `ks-lib-decoder.governance.squads_multisig` | +| `kb-lib.decoder.launchpad.boop_fun` | `ks-lib-decoder.launchpad.boop_fun` | +| `kb-lib.decoder.launchpad.metadao_ico` | `ks-lib-decoder.launchpad.metadao_ico` | +| `kb-lib.decoder.launchpad.meteora_dbc` | `ks-lib-decoder.launchpad.meteora_dbc` | +| `kb-lib.decoder.launchpad.moonit` | `ks-lib-decoder.launchpad.moonit` | +| `kb-lib.decoder.launchpad.orca_wavebreak` | `ks-lib-decoder.launchpad.orca_wavebreak` | +| `kb-lib.decoder.launchpad.printr` | `ks-lib-decoder.launchpad.printr` | +| `kb-lib.decoder.launchpad.pump_fun` | `ks-lib-decoder.launchpad.pump_fun` | +| `kb-lib.decoder.launchpad.pump_pumpup_ai` | `ks-lib-decoder.launchpad.pump_pumpup_ai` | +| `kb-lib.decoder.launchpad.raydium_launchlab` | `ks-lib-decoder.launchpad.raydium_launchlab` | +| `kb-lib.decoder.launchpad.virtuals` | `ks-lib-decoder.launchpad.virtuals` | +| `kb-lib.decoder.lending.clone` | `ks-lib-decoder.lending.clone` | +| `kb-lib.decoder.lending.jupiter_lend_borrow` | `ks-lib-decoder.lending.jupiter_lend_borrow` | +| `kb-lib.decoder.lending.jupiter_lend_earn` | `ks-lib-decoder.lending.jupiter_lend_earn` | +| `kb-lib.decoder.lending.jupiter_lend_flash_loan` | `ks-lib-decoder.lending.jupiter_lend_flash_loan` | +| `kb-lib.decoder.lending.jupiter_lend_liquidity` | `ks-lib-decoder.lending.jupiter_lend_liquidity` | +| `kb-lib.decoder.lending.kamino` | `ks-lib-decoder.lending.kamino` | +| `kb-lib.decoder.lending.marginfi_v2` | `ks-lib-decoder.lending.marginfi_v2` | +| `kb-lib.decoder.lock.raydium_lp` | `ks-lib-decoder.lock.raydium_lp` | +| `kb-lib.decoder.metadata.metaplex_token_metadata` | `ks-lib-decoder.metadata.metaplex_token_metadata` | +| `kb-lib.decoder.metadata.solana_program_metadata` | `ks-lib-decoder.metadata.solana_program_metadata` | +| `kb-lib.decoder.metadata.spl_name_service` | `ks-lib-decoder.metadata.spl_name_service` | +| `kb-lib.decoder.nft.metaplex_bubblegum` | `ks-lib-decoder.nft.metaplex_bubblegum` | +| `kb-lib.decoder.nft.tensor_cnft` | `ks-lib-decoder.nft.tensor_cnft` | +| `kb-lib.decoder.orderbook.jupiter_limit_order` | `ks-lib-decoder.orderbook.jupiter_limit_order` | +| `kb-lib.decoder.orderbook.jupiter_limit_order_v2` | `ks-lib-decoder.orderbook.jupiter_limit_order_v2` | +| `kb-lib.decoder.orderbook.openbook_v2` | `ks-lib-decoder.orderbook.openbook_v2` | +| `kb-lib.decoder.perpetuals.drift_v2` | `ks-lib-decoder.perpetuals.drift_v2` | +| `kb-lib.decoder.perpetuals.jupiter` | `ks-lib-decoder.perpetuals.jupiter` | +| `kb-lib.decoder.perpetuals.phoenix_eternal` | `ks-lib-decoder.perpetuals.phoenix_eternal` | +| `kb-lib.decoder.perpetuals.zeta` | `ks-lib-decoder.perpetuals.zeta` | +| `kb-lib.decoder.router.dflow_aggregator_v4` | `ks-lib-decoder.router.dflow_aggregator_v4` | +| `kb-lib.decoder.router.jupiter_aggregator_v4` | `ks-lib-decoder.router.jupiter_aggregator_v4` | +| `kb-lib.decoder.router.jupiter_aggregator_v6` | `ks-lib-decoder.router.jupiter_aggregator_v6` | +| `kb-lib.decoder.router.jupiter_dca` | `ks-lib-decoder.router.jupiter_dca` | +| `kb-lib.decoder.router.okx_labs_v1` | `ks-lib-decoder.router.okx_labs_v1` | +| `kb-lib.decoder.router.okx_labs_v2` | `ks-lib-decoder.router.okx_labs_v2` | +| `kb-lib.decoder.rwa.ondo_global_markets` | `ks-lib-decoder.rwa.ondo_global_markets` | +| `kb-lib.decoder.solana.core` | `ks-lib-decoder.solana.core` | +| `kb-lib.decoder.spl.account_compression` | `ks-lib-decoder.spl.account_compression` | +| `kb-lib.decoder.spl.associated_token_account` | `ks-lib-decoder.spl.associated_token_account` | +| `kb-lib.decoder.spl.elgamal_registry` | `ks-lib-decoder.spl.elgamal_registry` | +| `kb-lib.decoder.spl.memo` | `ks-lib-decoder.spl.memo` | +| `kb-lib.decoder.spl.noop` | `ks-lib-decoder.spl.noop` | +| `kb-lib.decoder.spl.single_pool` | `ks-lib-decoder.spl.single_pool` | +| `kb-lib.decoder.spl.stake_pool` | `ks-lib-decoder.spl.stake_pool` | +| `kb-lib.decoder.spl.token` | `ks-lib-decoder.spl.token` | +| `kb-lib.decoder.spl.token_2022` | `ks-lib-decoder.spl.token_2022` | +| `kb-lib.decoder.stable.swap_hylo_exchange` | `ks-lib-decoder.stable.swap_hylo_exchange` | +| `kb-lib.decoder.stable.swap_jupiter_stable` | `ks-lib-decoder.stable.swap_jupiter_stable` | +| `kb-lib.decoder.stable.swap_numeraire` | `ks-lib-decoder.stable.swap_numeraire` | +| `kb-lib.decoder.stable.swap_stabble` | `ks-lib-decoder.stable.swap_stabble` | +| `kb-lib.decoder.staking.jito_tip_distribution` | `ks-lib-decoder.staking.jito_tip_distribution` | +| `kb-lib.decoder.staking.kamino_farm` | `ks-lib-decoder.staking.kamino_farm` | +| `kb-lib.decoder.staking.marinade_finance` | `ks-lib-decoder.staking.marinade_finance` | +| `kb-lib.decoder.staking.solayer` | `ks-lib-decoder.staking.solayer` | +| `kb-lib.decoder.storage.solana_record` | `ks-lib-decoder.storage.solana_record` | +| `kb-lib.decoder.strategy.jupiter_dca` | `ks-lib-decoder.strategy.jupiter_dca` | +| `kb-lib.decoder.treasury.helium_treasury_management` | `ks-lib-decoder.treasury.helium_treasury_management` | +| `kb-lib.decoder.vault.carrot_defi` | `ks-lib-decoder.vault.carrot_defi` | +| `kb-lib.decoder.vault.hylo_stability_pool` | `ks-lib-decoder.vault.hylo_stability_pool` | +| `kb-lib.decoder.vault.kamino` | `ks-lib-decoder.vault.kamino` | +| `kb-lib.decoder.vault.kamino_v2` | `ks-lib-decoder.vault.kamino_v2` | +| `kb-lib.decoder.vault.kamino_yvaults` | `ks-lib-decoder.vault.kamino_yvaults` | +| `kb-lib.decoder.vault.meteora` | `ks-lib-decoder.vault.meteora` | +| `kb-lib.decoder.vesting.jupiter_lock` | `ks-lib-decoder.vesting.jupiter_lock` | +| `kb-lib.decoder.vesting.streamflow` | `ks-lib-decoder.vesting.streamflow` | +| `kb-lib.decoder.wallet.jupiter_apepro_smart_wallet` | `ks-lib-decoder.wallet.jupiter_apepro_smart_wallet` | +| `kb-lib.decoder.weighted.swap_stabble` | `ks-lib-decoder.weighted.swap_stabble` | +| `kb-lib.executor.adapter.saber_decimal_wrapper` | `ks-lib-executor.adapter.saber_decimal_wrapper` | +| `kb-lib.executor.adapter.spl_token_wrap` | `ks-lib-executor.adapter.spl_token_wrap` | +| `kb-lib.executor.amm.aldrin_v1` | `ks-lib-executor.amm.aldrin_v1` | +| `kb-lib.executor.amm.aldrin_v2` | `ks-lib-executor.amm.aldrin_v2` | +| `kb-lib.executor.amm.alphaq` | `ks-lib-executor.amm.alphaq` | +| `kb-lib.executor.amm.believe` | `ks-lib-executor.amm.believe` | +| `kb-lib.executor.amm.bonk_swap` | `ks-lib-executor.amm.bonk_swap` | +| `kb-lib.executor.amm.fluxbeam` | `ks-lib-executor.amm.fluxbeam` | +| `kb-lib.executor.amm.goon_fi` | `ks-lib-executor.amm.goon_fi` | +| `kb-lib.executor.amm.goosefx_gamma` | `ks-lib-executor.amm.goosefx_gamma` | +| `kb-lib.executor.amm.goosefx_v2` | `ks-lib-executor.amm.goosefx_v2` | +| `kb-lib.executor.amm.guac_swap` | `ks-lib-executor.amm.guac_swap` | +| `kb-lib.executor.amm.lifinity_swap_v2` | `ks-lib-executor.amm.lifinity_swap_v2` | +| `kb-lib.executor.amm.metadao_v0_5` | `ks-lib-executor.amm.metadao_v0_5` | +| `kb-lib.executor.amm.meteora_damm_v1` | `ks-lib-executor.amm.meteora_damm_v1` | +| `kb-lib.executor.amm.meteora_damm_v2` | `ks-lib-executor.amm.meteora_damm_v2` | +| `kb-lib.executor.amm.obric_v2` | `ks-lib-executor.amm.obric_v2` | +| `kb-lib.executor.amm.one_dex` | `ks-lib-executor.amm.one_dex` | +| `kb-lib.executor.amm.pump_swap` | `ks-lib-executor.amm.pump_swap` | +| `kb-lib.executor.amm.raydium_lp_v4` | `ks-lib-executor.amm.raydium_lp_v4` | +| `kb-lib.executor.amm.solfi` | `ks-lib-executor.amm.solfi` | +| `kb-lib.executor.amm.solfi_v2` | `ks-lib-executor.amm.solfi_v2` | +| `kb-lib.executor.amm.vertigo` | `ks-lib-executor.amm.vertigo` | +| `kb-lib.executor.amm.woofi` | `ks-lib-executor.amm.woofi` | +| `kb-lib.executor.amm.zero_fi` | `ks-lib-executor.amm.zero_fi` | +| `kb-lib.executor.amm.zora` | `ks-lib-executor.amm.zora` | +| `kb-lib.executor.bridge.circle_cctp_token_messenger_minter` | `ks-lib-executor.bridge.circle_cctp_token_messenger_minter` | | `kb-lib.executor.bridge.circle_cctp_token_messenger_minter_v2` | `ks-lib-executor.bridge.circle_cctp_token_messenger_minter_v2` | -| `kb-lib.executor.bridge.layer_zero_endpoint` | `ks-lib-executor.bridge.layer_zero_endpoint` | -| `kb-lib.executor.bridge.layer_zero_executor` | `ks-lib-executor.bridge.layer_zero_executor` | -| `kb-lib.executor.clmm.byreal` | `ks-lib-executor.clmm.byreal` | -| `kb-lib.executor.clmm.fusion` | `ks-lib-executor.clmm.fusion` | -| `kb-lib.executor.clmm.orca_whirlpool` | `ks-lib-executor.clmm.orca_whirlpool` | -| `kb-lib.executor.clmm.pancake_swap` | `ks-lib-executor.clmm.pancake_swap` | -| `kb-lib.executor.clmm.raydium` | `ks-lib-executor.clmm.raydium` | -| `kb-lib.executor.clmm.stabble` | `ks-lib-executor.clmm.stabble` | -| `kb-lib.executor.cpmm.raydium` | `ks-lib-executor.cpmm.raydium` | -| `kb-lib.executor.dlmm.meteora` | `ks-lib-executor.dlmm.meteora` | -| `kb-lib.executor.fees.bags_fee_share_v1` | `ks-lib-executor.fees.bags_fee_share_v1` | -| `kb-lib.executor.fees.bags_fee_share_v2` | `ks-lib-executor.fees.bags_fee_share_v2` | -| `kb-lib.executor.fees.pump_fees` | `ks-lib-executor.fees.pump_fees` | -| `kb-lib.executor.governance.metadao_bid_wall` | `ks-lib-executor.governance.metadao_bid_wall` | -| `kb-lib.executor.governance.metadao_futarchy` | `ks-lib-executor.governance.metadao_futarchy` | -| `kb-lib.executor.governance.squads_multisig` | `ks-lib-executor.governance.squads_multisig` | -| `kb-lib.executor.launchpad.boop_fun` | `ks-lib-executor.launchpad.boop_fun` | -| `kb-lib.executor.launchpad.metadao_ico` | `ks-lib-executor.launchpad.metadao_ico` | -| `kb-lib.executor.launchpad.meteora_dbc` | `ks-lib-executor.launchpad.meteora_dbc` | -| `kb-lib.executor.launchpad.moonit` | `ks-lib-executor.launchpad.moonit` | -| `kb-lib.executor.launchpad.orca_wavebreak` | `ks-lib-executor.launchpad.orca_wavebreak` | -| `kb-lib.executor.launchpad.printr` | `ks-lib-executor.launchpad.printr` | -| `kb-lib.executor.launchpad.pump_fun` | `ks-lib-executor.launchpad.pump_fun` | -| `kb-lib.executor.launchpad.pump_pumpup_ai` | `ks-lib-executor.launchpad.pump_pumpup_ai` | -| `kb-lib.executor.launchpad.raydium_launchlab` | `ks-lib-executor.launchpad.raydium_launchlab` | -| `kb-lib.executor.launchpad.virtuals` | `ks-lib-executor.launchpad.virtuals` | -| `kb-lib.executor.lending.clone` | `ks-lib-executor.lending.clone` | -| `kb-lib.executor.lending.jupiter_lend_borrow` | `ks-lib-executor.lending.jupiter_lend_borrow` | -| `kb-lib.executor.lending.jupiter_lend_earn` | `ks-lib-executor.lending.jupiter_lend_earn` | -| `kb-lib.executor.lending.jupiter_lend_flash_loan` | `ks-lib-executor.lending.jupiter_lend_flash_loan` | -| `kb-lib.executor.lending.jupiter_lend_liquidity` | `ks-lib-executor.lending.jupiter_lend_liquidity` | -| `kb-lib.executor.lending.kamino` | `ks-lib-executor.lending.kamino` | -| `kb-lib.executor.lending.marginfi_v2` | `ks-lib-executor.lending.marginfi_v2` | -| `kb-lib.executor.lock.raydium_lp` | `ks-lib-executor.lock.raydium_lp` | -| `kb-lib.executor.metadata.metaplex_token_metadata` | `ks-lib-executor.metadata.metaplex_token_metadata` | -| `kb-lib.executor.metadata.solana_program_metadata` | `ks-lib-executor.metadata.solana_program_metadata` | -| `kb-lib.executor.metadata.spl_name_service` | `ks-lib-executor.metadata.spl_name_service` | -| `kb-lib.executor.nft.metaplex_bubblegum` | `ks-lib-executor.nft.metaplex_bubblegum` | -| `kb-lib.executor.nft.tensor_cnft` | `ks-lib-executor.nft.tensor_cnft` | -| `kb-lib.executor.orderbook.jupiter_limit_order` | `ks-lib-executor.orderbook.jupiter_limit_order` | -| `kb-lib.executor.orderbook.jupiter_limit_order_v2` | `ks-lib-executor.orderbook.jupiter_limit_order_v2` | -| `kb-lib.executor.orderbook.openbook_v2` | `ks-lib-executor.orderbook.openbook_v2` | -| `kb-lib.executor.perpetuals.drift_v2` | `ks-lib-executor.perpetuals.drift_v2` | -| `kb-lib.executor.perpetuals.jupiter` | `ks-lib-executor.perpetuals.jupiter` | -| `kb-lib.executor.perpetuals.phoenix_eternal` | `ks-lib-executor.perpetuals.phoenix_eternal` | -| `kb-lib.executor.perpetuals.zeta` | `ks-lib-executor.perpetuals.zeta` | -| `kb-lib.executor.router.dflow_aggregator_v4` | `ks-lib-executor.router.dflow_aggregator_v4` | -| `kb-lib.executor.router.jupiter_aggregator_v4` | `ks-lib-executor.router.jupiter_aggregator_v4` | -| `kb-lib.executor.router.jupiter_aggregator_v6` | `ks-lib-executor.router.jupiter_aggregator_v6` | -| `kb-lib.executor.router.okx_labs_v1` | `ks-lib-executor.router.okx_labs_v1` | -| `kb-lib.executor.router.okx_labs_v2` | `ks-lib-executor.router.okx_labs_v2` | -| `kb-lib.executor.rwa.ondo_global_markets` | `ks-lib-executor.rwa.ondo_global_markets` | -| `kb-lib.executor.solana.core` | `ks-lib-executor.solana.core` | -| `kb-lib.executor.solana.transaction` | `ks-lib-executor.solana.transaction` | -| `kb-lib.executor.spl.account_compression` | `ks-lib-executor.spl.account_compression` | -| `kb-lib.executor.spl.associated_token_account` | `ks-lib-executor.spl.associated_token_account` | -| `kb-lib.executor.spl.elgamal_registry` | `ks-lib-executor.spl.elgamal_registry` | -| `kb-lib.executor.spl.memo` | `ks-lib-executor.spl.memo` | -| `kb-lib.executor.spl.noop` | `ks-lib-executor.spl.noop` | -| `kb-lib.executor.spl.single_pool` | `ks-lib-executor.spl.single_pool` | -| `kb-lib.executor.spl.stake_pool` | `ks-lib-executor.spl.stake_pool` | -| `kb-lib.executor.spl.token` | `ks-lib-executor.spl.token` | -| `kb-lib.executor.spl.token-2022` | `ks-lib-executor.spl.token-2022` | -| `kb-lib.executor.spl.token_2022` | `ks-lib-executor.spl.token_2022` | -| `kb-lib.executor.stable.swap_hylo_exchange` | `ks-lib-executor.stable.swap_hylo_exchange` | -| `kb-lib.executor.stable.swap_jupiter_stable` | `ks-lib-executor.stable.swap_jupiter_stable` | -| `kb-lib.executor.stable.swap_numeraire` | `ks-lib-executor.stable.swap_numeraire` | -| `kb-lib.executor.stable.swap_stabble` | `ks-lib-executor.stable.swap_stabble` | -| `kb-lib.executor.staking.jito_tip_distribution` | `ks-lib-executor.staking.jito_tip_distribution` | -| `kb-lib.executor.staking.kamino_farm` | `ks-lib-executor.staking.kamino_farm` | -| `kb-lib.executor.staking.marinade_finance` | `ks-lib-executor.staking.marinade_finance` | -| `kb-lib.executor.staking.solayer` | `ks-lib-executor.staking.solayer` | -| `kb-lib.executor.storage.solana_record` | `ks-lib-executor.storage.solana_record` | -| `kb-lib.executor.strategy.jupiter_dca` | `ks-lib-executor.strategy.jupiter_dca` | -| `kb-lib.executor.treasury.helium_treasury_management` | `ks-lib-executor.treasury.helium_treasury_management` | -| `kb-lib.executor.vault.carrot_defi` | `ks-lib-executor.vault.carrot_defi` | -| `kb-lib.executor.vault.hylo_stability_pool` | `ks-lib-executor.vault.hylo_stability_pool` | -| `kb-lib.executor.vault.kamino` | `ks-lib-executor.vault.kamino` | -| `kb-lib.executor.vault.kamino_v2` | `ks-lib-executor.vault.kamino_v2` | -| `kb-lib.executor.vault.kamino_yvaults` | `ks-lib-executor.vault.kamino_yvaults` | -| `kb-lib.executor.vault.meteora` | `ks-lib-executor.vault.meteora` | -| `kb-lib.executor.vesting.jupiter_lock` | `ks-lib-executor.vesting.jupiter_lock` | -| `kb-lib.executor.vesting.streamflow` | `ks-lib-executor.vesting.streamflow` | -| `kb-lib.executor.wallet.jupiter_apepro_smart_wallet` | `ks-lib-executor.wallet.jupiter_apepro_smart_wallet` | -| `kb-lib.executor.weighted.swap_stabble` | `ks-lib-executor.weighted.swap_stabble` | -| `kb-lib.materializer.admin` | `ks-lib-materializer.admin` | -| `kb-lib.materializer.bridge` | `ks-lib-materializer.bridge` | -| `kb-lib.materializer.compliance.audit` | `ks-lib-materializer.compliance.audit` | -| `kb-lib.materializer.fees` | `ks-lib-materializer.fees` | -| `kb-lib.materializer.governance` | `ks-lib-materializer.governance` | -| `kb-lib.materializer.lending` | `ks-lib-materializer.lending` | -| `kb-lib.materializer.lifecycle` | `ks-lib-materializer.lifecycle` | -| `kb-lib.materializer.liquidity` | `ks-lib-materializer.liquidity` | -| `kb-lib.materializer.metadata.metaplex_token_metadata` | `ks-lib-materializer.metadata.metaplex_token_metadata` | -| `kb-lib.materializer.metadata.solana_program_metadata` | `ks-lib-materializer.metadata.solana_program_metadata` | -| `kb-lib.materializer.metadata.token_2022` | `ks-lib-materializer.metadata.token_2022` | -| `kb-lib.materializer.nft` | `ks-lib-materializer.nft` | -| `kb-lib.materializer.oracle` | `ks-lib-materializer.oracle` | -| `kb-lib.materializer.orderbook` | `ks-lib-materializer.orderbook` | -| `kb-lib.materializer.perpetuals` | `ks-lib-materializer.perpetuals` | -| `kb-lib.materializer.pool.state` | `ks-lib-materializer.pool.state` | -| `kb-lib.materializer.rewards` | `ks-lib-materializer.rewards` | -| `kb-lib.materializer.risk` | `ks-lib-materializer.risk` | -| `kb-lib.materializer.routing` | `ks-lib-materializer.routing` | -| `kb-lib.materializer.staking` | `ks-lib-materializer.staking` | -| `kb-lib.materializer.token.accounts` | `ks-lib-materializer.token.accounts` | -| `kb-lib.materializer.token.metadata_risk` | `ks-lib-materializer.token.metadata_risk` | -| `kb-lib.materializer.trades` | `ks-lib-materializer.trades` | -| `kb-lib.materializer.transaction.annotations` | `ks-lib-materializer.transaction.annotations` | -| `kb-lib.materializer.vault` | `ks-lib-materializer.vault` | +| `kb-lib.executor.bridge.layer_zero_endpoint` | `ks-lib-executor.bridge.layer_zero_endpoint` | +| `kb-lib.executor.bridge.layer_zero_executor` | `ks-lib-executor.bridge.layer_zero_executor` | +| `kb-lib.executor.clmm.byreal` | `ks-lib-executor.clmm.byreal` | +| `kb-lib.executor.clmm.fusion` | `ks-lib-executor.clmm.fusion` | +| `kb-lib.executor.clmm.orca_whirlpool` | `ks-lib-executor.clmm.orca_whirlpool` | +| `kb-lib.executor.clmm.pancake_swap` | `ks-lib-executor.clmm.pancake_swap` | +| `kb-lib.executor.clmm.raydium` | `ks-lib-executor.clmm.raydium` | +| `kb-lib.executor.clmm.stabble` | `ks-lib-executor.clmm.stabble` | +| `kb-lib.executor.cpmm.raydium` | `ks-lib-executor.cpmm.raydium` | +| `kb-lib.executor.dlmm.meteora` | `ks-lib-executor.dlmm.meteora` | +| `kb-lib.executor.fees.bags_fee_share_v1` | `ks-lib-executor.fees.bags_fee_share_v1` | +| `kb-lib.executor.fees.bags_fee_share_v2` | `ks-lib-executor.fees.bags_fee_share_v2` | +| `kb-lib.executor.fees.pump_fees` | `ks-lib-executor.fees.pump_fees` | +| `kb-lib.executor.governance.metadao_bid_wall` | `ks-lib-executor.governance.metadao_bid_wall` | +| `kb-lib.executor.governance.metadao_futarchy` | `ks-lib-executor.governance.metadao_futarchy` | +| `kb-lib.executor.governance.squads_multisig` | `ks-lib-executor.governance.squads_multisig` | +| `kb-lib.executor.launchpad.boop_fun` | `ks-lib-executor.launchpad.boop_fun` | +| `kb-lib.executor.launchpad.metadao_ico` | `ks-lib-executor.launchpad.metadao_ico` | +| `kb-lib.executor.launchpad.meteora_dbc` | `ks-lib-executor.launchpad.meteora_dbc` | +| `kb-lib.executor.launchpad.moonit` | `ks-lib-executor.launchpad.moonit` | +| `kb-lib.executor.launchpad.orca_wavebreak` | `ks-lib-executor.launchpad.orca_wavebreak` | +| `kb-lib.executor.launchpad.printr` | `ks-lib-executor.launchpad.printr` | +| `kb-lib.executor.launchpad.pump_fun` | `ks-lib-executor.launchpad.pump_fun` | +| `kb-lib.executor.launchpad.pump_pumpup_ai` | `ks-lib-executor.launchpad.pump_pumpup_ai` | +| `kb-lib.executor.launchpad.raydium_launchlab` | `ks-lib-executor.launchpad.raydium_launchlab` | +| `kb-lib.executor.launchpad.virtuals` | `ks-lib-executor.launchpad.virtuals` | +| `kb-lib.executor.lending.clone` | `ks-lib-executor.lending.clone` | +| `kb-lib.executor.lending.jupiter_lend_borrow` | `ks-lib-executor.lending.jupiter_lend_borrow` | +| `kb-lib.executor.lending.jupiter_lend_earn` | `ks-lib-executor.lending.jupiter_lend_earn` | +| `kb-lib.executor.lending.jupiter_lend_flash_loan` | `ks-lib-executor.lending.jupiter_lend_flash_loan` | +| `kb-lib.executor.lending.jupiter_lend_liquidity` | `ks-lib-executor.lending.jupiter_lend_liquidity` | +| `kb-lib.executor.lending.kamino` | `ks-lib-executor.lending.kamino` | +| `kb-lib.executor.lending.marginfi_v2` | `ks-lib-executor.lending.marginfi_v2` | +| `kb-lib.executor.lock.raydium_lp` | `ks-lib-executor.lock.raydium_lp` | +| `kb-lib.executor.metadata.metaplex_token_metadata` | `ks-lib-executor.metadata.metaplex_token_metadata` | +| `kb-lib.executor.metadata.solana_program_metadata` | `ks-lib-executor.metadata.solana_program_metadata` | +| `kb-lib.executor.metadata.spl_name_service` | `ks-lib-executor.metadata.spl_name_service` | +| `kb-lib.executor.nft.metaplex_bubblegum` | `ks-lib-executor.nft.metaplex_bubblegum` | +| `kb-lib.executor.nft.tensor_cnft` | `ks-lib-executor.nft.tensor_cnft` | +| `kb-lib.executor.orderbook.jupiter_limit_order` | `ks-lib-executor.orderbook.jupiter_limit_order` | +| `kb-lib.executor.orderbook.jupiter_limit_order_v2` | `ks-lib-executor.orderbook.jupiter_limit_order_v2` | +| `kb-lib.executor.orderbook.openbook_v2` | `ks-lib-executor.orderbook.openbook_v2` | +| `kb-lib.executor.perpetuals.drift_v2` | `ks-lib-executor.perpetuals.drift_v2` | +| `kb-lib.executor.perpetuals.jupiter` | `ks-lib-executor.perpetuals.jupiter` | +| `kb-lib.executor.perpetuals.phoenix_eternal` | `ks-lib-executor.perpetuals.phoenix_eternal` | +| `kb-lib.executor.perpetuals.zeta` | `ks-lib-executor.perpetuals.zeta` | +| `kb-lib.executor.router.dflow_aggregator_v4` | `ks-lib-executor.router.dflow_aggregator_v4` | +| `kb-lib.executor.router.jupiter_aggregator_v4` | `ks-lib-executor.router.jupiter_aggregator_v4` | +| `kb-lib.executor.router.jupiter_aggregator_v6` | `ks-lib-executor.router.jupiter_aggregator_v6` | +| `kb-lib.executor.router.okx_labs_v1` | `ks-lib-executor.router.okx_labs_v1` | +| `kb-lib.executor.router.okx_labs_v2` | `ks-lib-executor.router.okx_labs_v2` | +| `kb-lib.executor.rwa.ondo_global_markets` | `ks-lib-executor.rwa.ondo_global_markets` | +| `kb-lib.executor.solana.core` | `ks-lib-executor.solana.core` | +| `kb-lib.executor.solana.transaction` | `ks-lib-executor.solana.transaction` | +| `kb-lib.executor.spl.account_compression` | `ks-lib-executor.spl.account_compression` | +| `kb-lib.executor.spl.associated_token_account` | `ks-lib-executor.spl.associated_token_account` | +| `kb-lib.executor.spl.elgamal_registry` | `ks-lib-executor.spl.elgamal_registry` | +| `kb-lib.executor.spl.memo` | `ks-lib-executor.spl.memo` | +| `kb-lib.executor.spl.noop` | `ks-lib-executor.spl.noop` | +| `kb-lib.executor.spl.single_pool` | `ks-lib-executor.spl.single_pool` | +| `kb-lib.executor.spl.stake_pool` | `ks-lib-executor.spl.stake_pool` | +| `kb-lib.executor.spl.token` | `ks-lib-executor.spl.token` | +| `kb-lib.executor.spl.token-2022` | `ks-lib-executor.spl.token-2022` | +| `kb-lib.executor.spl.token_2022` | `ks-lib-executor.spl.token_2022` | +| `kb-lib.executor.stable.swap_hylo_exchange` | `ks-lib-executor.stable.swap_hylo_exchange` | +| `kb-lib.executor.stable.swap_jupiter_stable` | `ks-lib-executor.stable.swap_jupiter_stable` | +| `kb-lib.executor.stable.swap_numeraire` | `ks-lib-executor.stable.swap_numeraire` | +| `kb-lib.executor.stable.swap_stabble` | `ks-lib-executor.stable.swap_stabble` | +| `kb-lib.executor.staking.jito_tip_distribution` | `ks-lib-executor.staking.jito_tip_distribution` | +| `kb-lib.executor.staking.kamino_farm` | `ks-lib-executor.staking.kamino_farm` | +| `kb-lib.executor.staking.marinade_finance` | `ks-lib-executor.staking.marinade_finance` | +| `kb-lib.executor.staking.solayer` | `ks-lib-executor.staking.solayer` | +| `kb-lib.executor.storage.solana_record` | `ks-lib-executor.storage.solana_record` | +| `kb-lib.executor.strategy.jupiter_dca` | `ks-lib-executor.strategy.jupiter_dca` | +| `kb-lib.executor.treasury.helium_treasury_management` | `ks-lib-executor.treasury.helium_treasury_management` | +| `kb-lib.executor.vault.carrot_defi` | `ks-lib-executor.vault.carrot_defi` | +| `kb-lib.executor.vault.hylo_stability_pool` | `ks-lib-executor.vault.hylo_stability_pool` | +| `kb-lib.executor.vault.kamino` | `ks-lib-executor.vault.kamino` | +| `kb-lib.executor.vault.kamino_v2` | `ks-lib-executor.vault.kamino_v2` | +| `kb-lib.executor.vault.kamino_yvaults` | `ks-lib-executor.vault.kamino_yvaults` | +| `kb-lib.executor.vault.meteora` | `ks-lib-executor.vault.meteora` | +| `kb-lib.executor.vesting.jupiter_lock` | `ks-lib-executor.vesting.jupiter_lock` | +| `kb-lib.executor.vesting.streamflow` | `ks-lib-executor.vesting.streamflow` | +| `kb-lib.executor.wallet.jupiter_apepro_smart_wallet` | `ks-lib-executor.wallet.jupiter_apepro_smart_wallet` | +| `kb-lib.executor.weighted.swap_stabble` | `ks-lib-executor.weighted.swap_stabble` | +| `kb-lib.materializer.admin` | `ks-lib-materializer.admin` | +| `kb-lib.materializer.bridge` | `ks-lib-materializer.bridge` | +| `kb-lib.materializer.compliance.audit` | `ks-lib-materializer.compliance.audit` | +| `kb-lib.materializer.fees` | `ks-lib-materializer.fees` | +| `kb-lib.materializer.governance` | `ks-lib-materializer.governance` | +| `kb-lib.materializer.lending` | `ks-lib-materializer.lending` | +| `kb-lib.materializer.lifecycle` | `ks-lib-materializer.lifecycle` | +| `kb-lib.materializer.liquidity` | `ks-lib-materializer.liquidity` | +| `kb-lib.materializer.metadata.metaplex_token_metadata` | `ks-lib-materializer.metadata.metaplex_token_metadata` | +| `kb-lib.materializer.metadata.solana_program_metadata` | `ks-lib-materializer.metadata.solana_program_metadata` | +| `kb-lib.materializer.metadata.token_2022` | `ks-lib-materializer.metadata.token_2022` | +| `kb-lib.materializer.nft` | `ks-lib-materializer.nft` | +| `kb-lib.materializer.oracle` | `ks-lib-materializer.oracle` | +| `kb-lib.materializer.orderbook` | `ks-lib-materializer.orderbook` | +| `kb-lib.materializer.perpetuals` | `ks-lib-materializer.perpetuals` | +| `kb-lib.materializer.pool.state` | `ks-lib-materializer.pool.state` | +| `kb-lib.materializer.rewards` | `ks-lib-materializer.rewards` | +| `kb-lib.materializer.risk` | `ks-lib-materializer.risk` | +| `kb-lib.materializer.routing` | `ks-lib-materializer.routing` | +| `kb-lib.materializer.staking` | `ks-lib-materializer.staking` | +| `kb-lib.materializer.token.accounts` | `ks-lib-materializer.token.accounts` | +| `kb-lib.materializer.token.metadata_risk` | `ks-lib-materializer.token.metadata_risk` | +| `kb-lib.materializer.trades` | `ks-lib-materializer.trades` | +| `kb-lib.materializer.transaction.annotations` | `ks-lib-materializer.transaction.annotations` | +| `kb-lib.materializer.vault` | `ks-lib-materializer.vault` | ## 7. Inventaire des variables d'environnement @@ -440,112 +440,112 @@ Les treize variables historiques `TOKEN_2022_*` sont des fixtures Devnet et conv ### 7.2 Mapping code/config/tests — 82 noms -| Nom actuel | Nom cible | Classe | -|--------------------------------------------------------------|--------------------------------------------------------------|------------| -| `HELIUS_API_KEY` | `KS_SECRET_HELIUS_API_KEY` | `secret` | -| `KB_CONFIG_PATH` | `KS_CONFIG_PATH` | `internal` | -| `KB_CONFIG_TEST_MISSING` | `KS_CONFIG_TEST_MISSING` | `internal` | -| `KB_DEVNET_AIRDROP_LAMPORTS` | `KS_DEVNET_AIRDROP_LAMPORTS` | `internal` | -| `KB_DEVNET_CONFIG_PATH` | `KS_DEVNET_CONFIG_PATH` | `internal` | -| `KB_DEVNET_EXECUTION_TEST` | `KS_DEVNET_EXECUTION_TEST` | `internal` | -| `KB_DEVNET_MEMO_EXECUTION_TEST` | `KS_DEVNET_MEMO_EXECUTION_TEST` | `internal` | -| `KB_DEVNET_MEMO_SUBMIT` | `KS_DEVNET_MEMO_SUBMIT` | `internal` | -| `KB_DEVNET_METAPLEX_COLLECTION_VERIFY_CAMPAIGN_TEST` | `KS_DEVNET_METAPLEX_COLLECTION_VERIFY_CAMPAIGN_TEST` | `internal` | -| `KB_DEVNET_METAPLEX_CREATE_MINT_CAMPAIGN_TEST` | `KS_DEVNET_METAPLEX_CREATE_MINT_CAMPAIGN_TEST` | `internal` | -| `KB_DEVNET_METAPLEX_CREATE_MINT_FAMILY` | `KS_DEVNET_METAPLEX_CREATE_MINT_FAMILY` | `internal` | -| `KB_DEVNET_METAPLEX_ESCROW_CAMPAIGN_TEST` | `KS_DEVNET_METAPLEX_ESCROW_CAMPAIGN_TEST` | `internal` | -| `KB_DEVNET_METAPLEX_EXECUTION_TEST` | `KS_DEVNET_METAPLEX_EXECUTION_TEST` | `internal` | -| `KB_DEVNET_METAPLEX_MAINTENANCE_CAMPAIGN_TEST` | `KS_DEVNET_METAPLEX_MAINTENANCE_CAMPAIGN_TEST` | `internal` | -| `KB_DEVNET_METAPLEX_MATERIALIZE_AFTER_CONFIRMATION` | `KS_DEVNET_METAPLEX_MATERIALIZE_AFTER_CONFIRMATION` | `internal` | -| `KB_DEVNET_METAPLEX_OPERATION_JSON` | `KS_DEVNET_METAPLEX_OPERATION_JSON` | `internal` | -| `KB_DEVNET_METAPLEX_OPERATOR_CONFIRMED` | `KS_DEVNET_METAPLEX_OPERATOR_CONFIRMED` | `internal` | -| `KB_DEVNET_METAPLEX_PNFT_LIFECYCLE_CAMPAIGN_TEST` | `KS_DEVNET_METAPLEX_PNFT_LIFECYCLE_CAMPAIGN_TEST` | `internal` | -| `KB_DEVNET_METAPLEX_POSTCONDITION_READS_JSON` | `KS_DEVNET_METAPLEX_POSTCONDITION_READS_JSON` | `internal` | -| `KB_DEVNET_METAPLEX_PREFLIGHT_READS_JSON` | `KS_DEVNET_METAPLEX_PREFLIGHT_READS_JSON` | `internal` | -| `KB_DEVNET_METAPLEX_PRINT_BURN_CAMPAIGN_TEST` | `KS_DEVNET_METAPLEX_PRINT_BURN_CAMPAIGN_TEST` | `internal` | -| `KB_DEVNET_METAPLEX_SUBMIT` | `KS_DEVNET_METAPLEX_SUBMIT` | `internal` | -| `KB_DEVNET_METAPLEX_USE_PROBE_TEST` | `KS_DEVNET_METAPLEX_USE_PROBE_TEST` | `internal` | -| `KB_DEVNET_PROFILE` | `KS_DEVNET_PROFILE` | `internal` | -| `KB_DEVNET_RPC_URL` | `KS_DEVNET_RPC_URL` | `internal` | -| `KB_DEVNET_SPL_ATA_EXECUTION_TEST` | `KS_DEVNET_SPL_ATA_EXECUTION_TEST` | `internal` | -| `KB_DEVNET_SPL_ATA_MINT` | `KS_DEVNET_SPL_ATA_MINT` | `internal` | -| `KB_DEVNET_SPL_ATA_NESTED_MINT` | `KS_DEVNET_SPL_ATA_NESTED_MINT` | `internal` | -| `KB_DEVNET_SPL_ATA_OPERATION` | `KS_DEVNET_SPL_ATA_OPERATION` | `internal` | -| `KB_DEVNET_SPL_ATA_OWNER_MINT` | `KS_DEVNET_SPL_ATA_OWNER_MINT` | `internal` | -| `KB_DEVNET_SPL_ATA_SUBMIT` | `KS_DEVNET_SPL_ATA_SUBMIT` | `internal` | -| `KB_DEVNET_SPL_ATA_TOKEN_PROGRAM` | `KS_DEVNET_SPL_ATA_TOKEN_PROGRAM` | `internal` | -| `KB_DEVNET_SPL_TOKEN_AMOUNT` | `KS_DEVNET_SPL_TOKEN_AMOUNT` | `internal` | -| `KB_DEVNET_SPL_TOKEN_AUTHORITY` | `KS_DEVNET_SPL_TOKEN_AUTHORITY` | `internal` | -| `KB_DEVNET_SPL_TOKEN_DECIMALS` | `KS_DEVNET_SPL_TOKEN_DECIMALS` | `internal` | -| `KB_DEVNET_SPL_TOKEN_DESTINATION` | `KS_DEVNET_SPL_TOKEN_DESTINATION` | `internal` | -| `KB_DEVNET_SPL_TOKEN_EXECUTION_TEST` | `KS_DEVNET_SPL_TOKEN_EXECUTION_TEST` | `internal` | -| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_APPROVE_AMOUNT` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_APPROVE_AMOUNT` | `internal` | -| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_AUTHORITY` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_AUTHORITY` | `internal` | -| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_DECIMALS` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_DECIMALS` | `internal` | -| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_DELEGATE` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_DELEGATE` | `internal` | -| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_DESTINATION` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_DESTINATION` | `internal` | -| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_FIRST_STEP_INDEX` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_FIRST_STEP_INDEX` | `internal` | -| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_INTER_STEP_DELAY_MS` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_INTER_STEP_DELAY_MS` | `internal` | -| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_MINT` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_MINT` | `internal` | -| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_MINT_AMOUNT` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_MINT_AMOUNT` | `internal` | -| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_PREPARATION_SETTLE_DELAY_MS` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_PREPARATION_SETTLE_DELAY_MS` | `internal` | -| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_PREPARE` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_PREPARE` | `internal` | +| Nom actuel | Nom cible | Classe | +|---|---|---| +| `HELIUS_API_KEY` | `KS_SECRET_HELIUS_API_KEY` | `secret` | +| `KB_CONFIG_PATH` | `KS_CONFIG_PATH` | `internal` | +| `KB_CONFIG_TEST_MISSING` | `KS_CONFIG_TEST_MISSING` | `internal` | +| `KB_DEVNET_AIRDROP_LAMPORTS` | `KS_DEVNET_AIRDROP_LAMPORTS` | `internal` | +| `KB_DEVNET_CONFIG_PATH` | `KS_DEVNET_CONFIG_PATH` | `internal` | +| `KB_DEVNET_EXECUTION_TEST` | `KS_DEVNET_EXECUTION_TEST` | `internal` | +| `KB_DEVNET_MEMO_EXECUTION_TEST` | `KS_DEVNET_MEMO_EXECUTION_TEST` | `internal` | +| `KB_DEVNET_MEMO_SUBMIT` | `KS_DEVNET_MEMO_SUBMIT` | `internal` | +| `KB_DEVNET_METAPLEX_COLLECTION_VERIFY_CAMPAIGN_TEST` | `KS_DEVNET_METAPLEX_COLLECTION_VERIFY_CAMPAIGN_TEST` | `internal` | +| `KB_DEVNET_METAPLEX_CREATE_MINT_CAMPAIGN_TEST` | `KS_DEVNET_METAPLEX_CREATE_MINT_CAMPAIGN_TEST` | `internal` | +| `KB_DEVNET_METAPLEX_CREATE_MINT_FAMILY` | `KS_DEVNET_METAPLEX_CREATE_MINT_FAMILY` | `internal` | +| `KB_DEVNET_METAPLEX_ESCROW_CAMPAIGN_TEST` | `KS_DEVNET_METAPLEX_ESCROW_CAMPAIGN_TEST` | `internal` | +| `KB_DEVNET_METAPLEX_EXECUTION_TEST` | `KS_DEVNET_METAPLEX_EXECUTION_TEST` | `internal` | +| `KB_DEVNET_METAPLEX_MAINTENANCE_CAMPAIGN_TEST` | `KS_DEVNET_METAPLEX_MAINTENANCE_CAMPAIGN_TEST` | `internal` | +| `KB_DEVNET_METAPLEX_MATERIALIZE_AFTER_CONFIRMATION` | `KS_DEVNET_METAPLEX_MATERIALIZE_AFTER_CONFIRMATION` | `internal` | +| `KB_DEVNET_METAPLEX_OPERATION_JSON` | `KS_DEVNET_METAPLEX_OPERATION_JSON` | `internal` | +| `KB_DEVNET_METAPLEX_OPERATOR_CONFIRMED` | `KS_DEVNET_METAPLEX_OPERATOR_CONFIRMED` | `internal` | +| `KB_DEVNET_METAPLEX_PNFT_LIFECYCLE_CAMPAIGN_TEST` | `KS_DEVNET_METAPLEX_PNFT_LIFECYCLE_CAMPAIGN_TEST` | `internal` | +| `KB_DEVNET_METAPLEX_POSTCONDITION_READS_JSON` | `KS_DEVNET_METAPLEX_POSTCONDITION_READS_JSON` | `internal` | +| `KB_DEVNET_METAPLEX_PREFLIGHT_READS_JSON` | `KS_DEVNET_METAPLEX_PREFLIGHT_READS_JSON` | `internal` | +| `KB_DEVNET_METAPLEX_PRINT_BURN_CAMPAIGN_TEST` | `KS_DEVNET_METAPLEX_PRINT_BURN_CAMPAIGN_TEST` | `internal` | +| `KB_DEVNET_METAPLEX_SUBMIT` | `KS_DEVNET_METAPLEX_SUBMIT` | `internal` | +| `KB_DEVNET_METAPLEX_USE_PROBE_TEST` | `KS_DEVNET_METAPLEX_USE_PROBE_TEST` | `internal` | +| `KB_DEVNET_PROFILE` | `KS_DEVNET_PROFILE` | `internal` | +| `KB_DEVNET_RPC_URL` | `KS_DEVNET_RPC_URL` | `internal` | +| `KB_DEVNET_SPL_ATA_EXECUTION_TEST` | `KS_DEVNET_SPL_ATA_EXECUTION_TEST` | `internal` | +| `KB_DEVNET_SPL_ATA_MINT` | `KS_DEVNET_SPL_ATA_MINT` | `internal` | +| `KB_DEVNET_SPL_ATA_NESTED_MINT` | `KS_DEVNET_SPL_ATA_NESTED_MINT` | `internal` | +| `KB_DEVNET_SPL_ATA_OPERATION` | `KS_DEVNET_SPL_ATA_OPERATION` | `internal` | +| `KB_DEVNET_SPL_ATA_OWNER_MINT` | `KS_DEVNET_SPL_ATA_OWNER_MINT` | `internal` | +| `KB_DEVNET_SPL_ATA_SUBMIT` | `KS_DEVNET_SPL_ATA_SUBMIT` | `internal` | +| `KB_DEVNET_SPL_ATA_TOKEN_PROGRAM` | `KS_DEVNET_SPL_ATA_TOKEN_PROGRAM` | `internal` | +| `KB_DEVNET_SPL_TOKEN_AMOUNT` | `KS_DEVNET_SPL_TOKEN_AMOUNT` | `internal` | +| `KB_DEVNET_SPL_TOKEN_AUTHORITY` | `KS_DEVNET_SPL_TOKEN_AUTHORITY` | `internal` | +| `KB_DEVNET_SPL_TOKEN_DECIMALS` | `KS_DEVNET_SPL_TOKEN_DECIMALS` | `internal` | +| `KB_DEVNET_SPL_TOKEN_DESTINATION` | `KS_DEVNET_SPL_TOKEN_DESTINATION` | `internal` | +| `KB_DEVNET_SPL_TOKEN_EXECUTION_TEST` | `KS_DEVNET_SPL_TOKEN_EXECUTION_TEST` | `internal` | +| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_APPROVE_AMOUNT` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_APPROVE_AMOUNT` | `internal` | +| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_AUTHORITY` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_AUTHORITY` | `internal` | +| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_DECIMALS` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_DECIMALS` | `internal` | +| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_DELEGATE` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_DELEGATE` | `internal` | +| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_DESTINATION` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_DESTINATION` | `internal` | +| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_FIRST_STEP_INDEX` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_FIRST_STEP_INDEX` | `internal` | +| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_INTER_STEP_DELAY_MS` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_INTER_STEP_DELAY_MS` | `internal` | +| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_MINT` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_MINT` | `internal` | +| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_MINT_AMOUNT` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_MINT_AMOUNT` | `internal` | +| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_PREPARATION_SETTLE_DELAY_MS` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_PREPARATION_SETTLE_DELAY_MS` | `internal` | +| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_PREPARE` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_PREPARE` | `internal` | | `KB_DEVNET_SPL_TOKEN_LIFECYCLE_RESUME_PREDECESSOR_SIGNATURE` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_RESUME_PREDECESSOR_SIGNATURE` | `internal` | -| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_SOURCE` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_SOURCE` | `internal` | -| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_SUBMIT` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_SUBMIT` | `internal` | -| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_TEST` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_TEST` | `internal` | -| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_TRANSFER_AMOUNT` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_TRANSFER_AMOUNT` | `internal` | -| `KB_DEVNET_SPL_TOKEN_MINT` | `KS_DEVNET_SPL_TOKEN_MINT` | `internal` | -| `KB_DEVNET_SPL_TOKEN_NATIVE_ACCOUNT` | `KS_DEVNET_SPL_TOKEN_NATIVE_ACCOUNT` | `internal` | -| `KB_DEVNET_SPL_TOKEN_PREFLIGHT_TEST` | `KS_DEVNET_SPL_TOKEN_PREFLIGHT_TEST` | `internal` | -| `KB_DEVNET_SPL_TOKEN_RECENT_PROBE_TEST` | `KS_DEVNET_SPL_TOKEN_RECENT_PROBE_TEST` | `internal` | -| `KB_DEVNET_SPL_TOKEN_SOURCE` | `KS_DEVNET_SPL_TOKEN_SOURCE` | `internal` | -| `KB_DEVNET_SPL_TOKEN_SUBMIT` | `KS_DEVNET_SPL_TOKEN_SUBMIT` | `internal` | -| `KB_DEVNET_TOKEN_2022_METADATA_CAMPAIGN_TEST` | `KS_DEVNET_TOKEN_2022_METADATA_CAMPAIGN_TEST` | `internal` | -| `KB_DEVNET_TOKEN_2022_METADATA_OPERATOR_CONFIRMED` | `KS_DEVNET_TOKEN_2022_METADATA_OPERATOR_CONFIRMED` | `internal` | -| `KB_DEVNET_TRANSFER_LAMPORTS` | `KS_DEVNET_TRANSFER_LAMPORTS` | `internal` | -| `KB_DEVNET_WALLET` | `KS_DEVNET_WALLET` | `internal` | -| `KB_DEVNET_WALLET_ADDRESS` | `KS_DEVNET_WALLET_ADDRESS` | `internal` | -| `KB_DEVNET_WALLET_DIR` | `KS_DEVNET_WALLET_DIR` | `internal` | -| `KB_ENV_FILE` | `KS_ENV_FILE` | `internal` | -| `KB_POSTGRES_DEVNET_URL` | `KS_SECRET_POSTGRES_DEVNET_URL` | `secret` | -| `KB_POSTGRES_MAINNET_URL` | `KS_SECRET_POSTGRES_MAINNET_URL` | `secret` | -| `KB_POSTGRES_TEST_URL` | `KS_SECRET_POSTGRES_TEST_URL` | `secret` | -| `TOKEN_2022_APPROVE_AMOUNT_RAW` | `KS_DEVNET_TOKEN_2022_APPROVE_AMOUNT_RAW` | `internal` | -| `TOKEN_2022_AUTHORITY` | `KS_DEVNET_TOKEN_2022_AUTHORITY` | `internal` | -| `TOKEN_2022_BURN_AMOUNT_RAW` | `KS_DEVNET_TOKEN_2022_BURN_AMOUNT_RAW` | `internal` | -| `TOKEN_2022_CLOSE_ACCOUNT` | `KS_DEVNET_TOKEN_2022_CLOSE_ACCOUNT` | `internal` | -| `TOKEN_2022_DECIMALS` | `KS_DEVNET_TOKEN_2022_DECIMALS` | `internal` | -| `TOKEN_2022_DELEGATE` | `KS_DEVNET_TOKEN_2022_DELEGATE` | `internal` | -| `TOKEN_2022_DESTINATION` | `KS_DEVNET_TOKEN_2022_DESTINATION` | `internal` | -| `TOKEN_2022_FREEZE_AUTHORITY` | `KS_DEVNET_TOKEN_2022_FREEZE_AUTHORITY` | `internal` | -| `TOKEN_2022_MINT` | `KS_DEVNET_TOKEN_2022_MINT` | `internal` | -| `TOKEN_2022_MINT_AMOUNT_RAW` | `KS_DEVNET_TOKEN_2022_MINT_AMOUNT_RAW` | `internal` | -| `TOKEN_2022_PROGRAM` | `KS_DEVNET_TOKEN_2022_PROGRAM` | `internal` | -| `TOKEN_2022_SOURCE` | `KS_DEVNET_TOKEN_2022_SOURCE` | `internal` | -| `TOKEN_2022_TRANSFER_AMOUNT_RAW` | `KS_DEVNET_TOKEN_2022_TRANSFER_AMOUNT_RAW` | `internal` | +| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_SOURCE` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_SOURCE` | `internal` | +| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_SUBMIT` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_SUBMIT` | `internal` | +| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_TEST` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_TEST` | `internal` | +| `KB_DEVNET_SPL_TOKEN_LIFECYCLE_TRANSFER_AMOUNT` | `KS_DEVNET_SPL_TOKEN_LIFECYCLE_TRANSFER_AMOUNT` | `internal` | +| `KB_DEVNET_SPL_TOKEN_MINT` | `KS_DEVNET_SPL_TOKEN_MINT` | `internal` | +| `KB_DEVNET_SPL_TOKEN_NATIVE_ACCOUNT` | `KS_DEVNET_SPL_TOKEN_NATIVE_ACCOUNT` | `internal` | +| `KB_DEVNET_SPL_TOKEN_PREFLIGHT_TEST` | `KS_DEVNET_SPL_TOKEN_PREFLIGHT_TEST` | `internal` | +| `KB_DEVNET_SPL_TOKEN_RECENT_PROBE_TEST` | `KS_DEVNET_SPL_TOKEN_RECENT_PROBE_TEST` | `internal` | +| `KB_DEVNET_SPL_TOKEN_SOURCE` | `KS_DEVNET_SPL_TOKEN_SOURCE` | `internal` | +| `KB_DEVNET_SPL_TOKEN_SUBMIT` | `KS_DEVNET_SPL_TOKEN_SUBMIT` | `internal` | +| `KB_DEVNET_TOKEN_2022_METADATA_CAMPAIGN_TEST` | `KS_DEVNET_TOKEN_2022_METADATA_CAMPAIGN_TEST` | `internal` | +| `KB_DEVNET_TOKEN_2022_METADATA_OPERATOR_CONFIRMED` | `KS_DEVNET_TOKEN_2022_METADATA_OPERATOR_CONFIRMED` | `internal` | +| `KB_DEVNET_TRANSFER_LAMPORTS` | `KS_DEVNET_TRANSFER_LAMPORTS` | `internal` | +| `KB_DEVNET_WALLET` | `KS_DEVNET_WALLET` | `internal` | +| `KB_DEVNET_WALLET_ADDRESS` | `KS_DEVNET_WALLET_ADDRESS` | `internal` | +| `KB_DEVNET_WALLET_DIR` | `KS_DEVNET_WALLET_DIR` | `internal` | +| `KB_ENV_FILE` | `KS_ENV_FILE` | `internal` | +| `KB_POSTGRES_DEVNET_URL` | `KS_SECRET_POSTGRES_DEVNET_URL` | `secret` | +| `KB_POSTGRES_MAINNET_URL` | `KS_SECRET_POSTGRES_MAINNET_URL` | `secret` | +| `KB_POSTGRES_TEST_URL` | `KS_SECRET_POSTGRES_TEST_URL` | `secret` | +| `TOKEN_2022_APPROVE_AMOUNT_RAW` | `KS_DEVNET_TOKEN_2022_APPROVE_AMOUNT_RAW` | `internal` | +| `TOKEN_2022_AUTHORITY` | `KS_DEVNET_TOKEN_2022_AUTHORITY` | `internal` | +| `TOKEN_2022_BURN_AMOUNT_RAW` | `KS_DEVNET_TOKEN_2022_BURN_AMOUNT_RAW` | `internal` | +| `TOKEN_2022_CLOSE_ACCOUNT` | `KS_DEVNET_TOKEN_2022_CLOSE_ACCOUNT` | `internal` | +| `TOKEN_2022_DECIMALS` | `KS_DEVNET_TOKEN_2022_DECIMALS` | `internal` | +| `TOKEN_2022_DELEGATE` | `KS_DEVNET_TOKEN_2022_DELEGATE` | `internal` | +| `TOKEN_2022_DESTINATION` | `KS_DEVNET_TOKEN_2022_DESTINATION` | `internal` | +| `TOKEN_2022_FREEZE_AUTHORITY` | `KS_DEVNET_TOKEN_2022_FREEZE_AUTHORITY` | `internal` | +| `TOKEN_2022_MINT` | `KS_DEVNET_TOKEN_2022_MINT` | `internal` | +| `TOKEN_2022_MINT_AMOUNT_RAW` | `KS_DEVNET_TOKEN_2022_MINT_AMOUNT_RAW` | `internal` | +| `TOKEN_2022_PROGRAM` | `KS_DEVNET_TOKEN_2022_PROGRAM` | `internal` | +| `TOKEN_2022_SOURCE` | `KS_DEVNET_TOKEN_2022_SOURCE` | `internal` | +| `TOKEN_2022_TRANSFER_AMOUNT_RAW` | `KS_DEVNET_TOKEN_2022_TRANSFER_AMOUNT_RAW` | `internal` | ### 7.3 Mapping guide opérateur Devnet — 17 noms -| Nom actuel | Nom cible | Classe | -|---------------------------------------|---------------------------------------|------------| -| `KB_CONFIRM_DEVNET_DATABASE_RESET` | `KS_CONFIRM_DEVNET_DATABASE_RESET` | `internal` | -| `KB_DEVNET_CLASSIC_DESTINATION_ATA` | `KS_DEVNET_CLASSIC_DESTINATION_ATA` | `internal` | -| `KB_DEVNET_CLASSIC_MINT` | `KS_DEVNET_CLASSIC_MINT` | `internal` | -| `KB_DEVNET_CLASSIC_MINT_KEYPAIR` | `KS_DEVNET_CLASSIC_MINT_KEYPAIR` | `internal` | -| `KB_DEVNET_CLASSIC_RECIPIENT` | `KS_DEVNET_CLASSIC_RECIPIENT` | `internal` | +| Nom actuel | Nom cible | Classe | +|---|---|---| +| `KB_CONFIRM_DEVNET_DATABASE_RESET` | `KS_CONFIRM_DEVNET_DATABASE_RESET` | `internal` | +| `KB_DEVNET_CLASSIC_DESTINATION_ATA` | `KS_DEVNET_CLASSIC_DESTINATION_ATA` | `internal` | +| `KB_DEVNET_CLASSIC_MINT` | `KS_DEVNET_CLASSIC_MINT` | `internal` | +| `KB_DEVNET_CLASSIC_MINT_KEYPAIR` | `KS_DEVNET_CLASSIC_MINT_KEYPAIR` | `internal` | +| `KB_DEVNET_CLASSIC_RECIPIENT` | `KS_DEVNET_CLASSIC_RECIPIENT` | `internal` | | `KB_DEVNET_CLASSIC_RECIPIENT_KEYPAIR` | `KS_DEVNET_CLASSIC_RECIPIENT_KEYPAIR` | `internal` | -| `KB_DEVNET_CLASSIC_SOURCE_ATA` | `KS_DEVNET_CLASSIC_SOURCE_ATA` | `internal` | -| `KB_DEVNET_RECIPIENT` | `KS_DEVNET_RECIPIENT` | `internal` | -| `KB_DEVNET_SCENARIO` | `KS_DEVNET_SCENARIO` | `internal` | -| `KB_DEVNET_SIGNATURE` | `KS_DEVNET_SIGNATURE` | `internal` | -| `KB_DEVNET_TOKEN_2022_FIXTURE` | `KS_DEVNET_TOKEN_2022_FIXTURE` | `internal` | -| `KB_DEVNET_TOKEN_2022_MINT` | `KS_DEVNET_TOKEN_2022_MINT` | `internal` | -| `KB_DEVNET_TOKEN_2022_MINT_KEYPAIR` | `KS_DEVNET_TOKEN_2022_MINT_KEYPAIR` | `internal` | -| `KB_DEVNET_VALIDATION_DIR` | `KS_DEVNET_VALIDATION_DIR` | `internal` | -| `KB_DEVNET_WALLET_PUBKEY` | `KS_DEVNET_WALLET_PUBKEY` | `internal` | -| `KB_SPL_TOKEN_2022_PROGRAM_ID` | `KS_SPL_TOKEN_2022_PROGRAM_ID` | `internal` | -| `KB_SPL_TOKEN_PROGRAM_ID` | `KS_SPL_TOKEN_PROGRAM_ID` | `internal` | +| `KB_DEVNET_CLASSIC_SOURCE_ATA` | `KS_DEVNET_CLASSIC_SOURCE_ATA` | `internal` | +| `KB_DEVNET_RECIPIENT` | `KS_DEVNET_RECIPIENT` | `internal` | +| `KB_DEVNET_SCENARIO` | `KS_DEVNET_SCENARIO` | `internal` | +| `KB_DEVNET_SIGNATURE` | `KS_DEVNET_SIGNATURE` | `internal` | +| `KB_DEVNET_TOKEN_2022_FIXTURE` | `KS_DEVNET_TOKEN_2022_FIXTURE` | `internal` | +| `KB_DEVNET_TOKEN_2022_MINT` | `KS_DEVNET_TOKEN_2022_MINT` | `internal` | +| `KB_DEVNET_TOKEN_2022_MINT_KEYPAIR` | `KS_DEVNET_TOKEN_2022_MINT_KEYPAIR` | `internal` | +| `KB_DEVNET_VALIDATION_DIR` | `KS_DEVNET_VALIDATION_DIR` | `internal` | +| `KB_DEVNET_WALLET_PUBKEY` | `KS_DEVNET_WALLET_PUBKEY` | `internal` | +| `KB_SPL_TOKEN_2022_PROGRAM_ID` | `KS_SPL_TOKEN_2022_PROGRAM_ID` | `internal` | +| `KB_SPL_TOKEN_PROGRAM_ID` | `KS_SPL_TOKEN_PROGRAM_ID` | `internal` | ## 8. Split configuration / logging @@ -566,7 +566,7 @@ Le code duplique actuellement dans `kb-config` et `kb-logging` les concepts : - `LogTargetConfig` ; - `LogTargetFilterConfig`. -`kb-app-demo-desktop` contient en plus une conversion manuelle de `kb_config::LoggingConfig` vers `kb_logging::LoggingConfig`. `0.5.1` doit supprimer cette duplication en donnant au logging un contrat possédé par `ks-logging`, tout en laissant `ks-config` charger/valider/composer les documents sans réinventer les types runtime du logging. +`kb-app-demo-desktop` contient en plus une conversion manuelle de `ks_config::LoggingConfig` vers `ks_logging::LoggingConfig`. `0.5.1` doit supprimer cette duplication en donnant au logging un contrat possédé par `ks-logging`, tout en laissant `ks-config` charger/valider/composer les documents sans réinventer les types runtime du logging. Aucun troisième document spécialisé n'est créé dans `0.5.1` sans bénéfice de découplage démontré. @@ -640,12 +640,14 @@ Les tests ne doivent pas figer comme comportement légitime la fuite actuelle de - renommer physiquement les dix crates selon l'ordre de dépendance ; - migrer packages, paths, imports, exports, tests externes, scripts et CLI ; - adapter `kb-app-demo-desktop` sans le renommer ; -- conserver encore les changements sémantiques de config hors de ce delta. +- migrer les targets de tracing **racine** dont le contrat est couplé au nom Cargo (`ks-logging`, `ks-pipeline`, `ks-pipeline-demo-scenarios`, `ks-onchain-transport`, `ks-store`, `ks-wallet`) et réaligner les routes de logging qui utilisent les noms de crates ; +- régénérer localement les bindings TS-RS de `ks-config` plutôt que livrer des bindings générés à la main ; +- conserver encore les variables d'environnement, les identités `kb-lib.*` et les tables `kb_sol_*` hors de ce delta. -### `0.5.1-pre.003` — identités techniques et tracing +### `0.5.1-pre.003` — identités techniques et tracing hiérarchique `ks-lib-*` - migrer les 256 identités `kb-lib.*` vers `ks-lib-*` ; -- migrer targets de tracing génériques vers `ks-*` ; +- migrer les subtargets et identités de composants hiérarchiques qui ne pouvaient pas être changés par le simple renommage Cargo ; - synchroniser routes de logging, matrices, diagnostics, tests et provenance/replay ; - ne pas renommer encore les tables SQL `kb_sol_*`. diff --git a/docs/rules/RULES_SPECIFIC_KHADHROONY.md b/docs/rules/RULES_SPECIFIC_KHADHROONY.md index 19b6112..64aad76 100644 --- a/docs/rules/RULES_SPECIFIC_KHADHROONY.md +++ b/docs/rules/RULES_SPECIFIC_KHADHROONY.md @@ -1,5 +1,5 @@ - + # Règles spécifiques à `khadhroony-bot3` @@ -13,10 +13,10 @@ Toute divergence avec une règle générale doit être explicitement documentée - Les noms de fichiers et de répertoires ne doivent contenir aucun accent, espace ou caractère spécial inutile. - Les noms internes doivent utiliser le format `snake_case` lorsque c'est applicable. - Les packages Rust utilisent le préfixe `kb-` ; leur identifiant Rust correspondant utilise automatiquement `kb_`. -- Les décodeurs, matérialisateurs et exécuteurs sont des modules de `kb-lib`, pas des crates séparées. -- Le crate de journalisation s'appelle `kb-logging`. +- Les décodeurs, matérialisateurs et exécuteurs sont des modules de `ks-lib`, pas des crates séparées. +- Le crate de journalisation s'appelle `ks-logging`. - Les réexports sont regroupés par visibilité : le bloc `pub use` précède le bloc séparé `pub(crate) use`, sans ligne vide interne à un bloc ; leur ordre naturel doit rester compatible avec `cargo fmt`. -- Les familles de symboles consolidées dans `kb-lib` utilisent les préfixes `DC_`/`Dc`/`decoder_` pour les décodeurs, `MT_`/`Mt`/`materializer_` pour les matérialisateurs, `EX_`/`Ex`/`executor_` pour les exécuteurs et `MD_`/`Md`/`model_` pour les modèles. +- Les familles de symboles consolidées dans `ks-lib` utilisent les préfixes `DC_`/`Dc`/`decoder_` pour les décodeurs, `MT_`/`Mt`/`materializer_` pour les matérialisateurs, `EX_`/`Ex`/`executor_` pour les exécuteurs et `MD_`/`Md`/`model_` pour les modèles. - Les méthodes inhérentes et helpers strictement privés peuvent conserver un nom local court ; les préfixes s’appliquent aux constantes, types, traits et fonctions libres exposés à la crate ou hors de la crate. - Les constantes temporaires `*_LEGACY_CRATE`, `*_MIGRATION_STATUS` et `*_MIGRATION_BOUNDARIES` doivent disparaître d’une famille dès que ses squelettes typés sont restaurés ; elles ne constituent jamais une API durable. @@ -55,7 +55,7 @@ Toute divergence avec une règle générale doit être explicitement documentée - Toute absence volontaire de projection doit être documentée avec une justification technique précise. Un matérialisateur ne doit inventer ni état final, ni montant, ni autorité, ni frais, ni agrégation que l'observation ne prouve pas. - Chaque matérialisateur concret possède un composant structuré avec une façade limitée aux déclarations de sous-modules et réexports, un `constants.rs` et un `materializer.rs`. Les fichiers spécialisés `state.rs`, `account.rs` ou équivalents sont ajoutés seulement lorsque leur responsabilité est distincte. - L’identité runtime suit `kb-lib.materializer.[.]`. Le `processorName` persisté suit `materializer.[.]` et doit être exactement l’identité runtime sans le préfixe `kb-lib.`. Le tracing target d’un composant actif est identique à son identité runtime. -- Les constantes d’un composant utilisent le préfixe `MT__`, résident dans son `constants.rs`, sont réexportées par chaque façade jusqu’à `kb-lib/src/lib.rs` et sont consommées par `crate::`, y compris dans les tests lorsqu’elles sont `pub` ou `pub(crate)`. +- Les constantes d’un composant utilisent le préfixe `MT__`, résident dans son `constants.rs`, sont réexportées par chaque façade jusqu’à `ks-lib/src/lib.rs` et sont consommées par `crate::`, y compris dans les tests lorsqu’elles sont `pub` ou `pub(crate)`. - Toute sortie persistée contient un `processorName` issu de la constante du composant et une `projectionVersion` explicite. Une correction de provenance persistée impose une nouvelle version de projection. - Une coquille réservée implémente `MtMaterializer` et `MtApiEventMaterializer`, expose une constante `MT_*_ACCEPTED_FAMILIES` vide, refuse tous les événements, retourne une liste legacy vide et un résultat contextuel `Ignored`. Elle ne doit jamais créer un faux événement de transition. - Un composant state-only peut exposer uniquement des APIs de snapshots sans implémenter `MtApiEventMaterializer`; ce statut doit être explicite et ne crée pas artificiellement un matérialisateur instructionnel. @@ -77,24 +77,24 @@ Toute divergence avec une règle générale doit être explicitement documentée ### Frontière des pipelines -- `kb-pipeline` est le pipeline généraliste, réutilisable et indépendant d'un environnement de démonstration. Ses contrats doivent pouvoir être appelés depuis une application, un service, un worker, un CLI, des tests ou une autre orchestration, sur tout cluster compatible autorisé par la configuration. -- `kb-pipeline` possède l'orchestration générique du backfill, de l'extraction Core, du replay, des corrélations stateful, du préflight, de la préparation, de la simulation, de la soumission autorisée, de la confirmation, de la postvalidation et de la matérialisation idempotente. -- `kb-pipeline` ne doit contenir ni wallet, mint, compte, airdrop, autorité, adresse, séquence ou hypothèse codée en dur pour une démonstration Devnet ou Testnet. -- `kb-pipeline-demo-scenarios` contient les fixtures, aides de campagne et tests automatisés spécifiques aux réseaux de test, actuellement Devnet ou Testnet. -- Les fixtures, séquences, simulations/soumissions, postconditions et qualifications Devnet/Testnet réutilisables appartiennent à `kb-pipeline-demo-scenarios`, y compris lorsqu'elles sont déclenchées depuis le desktop. +- `ks-pipeline` est le pipeline généraliste, réutilisable et indépendant d'un environnement de démonstration. Ses contrats doivent pouvoir être appelés depuis une application, un service, un worker, un CLI, des tests ou une autre orchestration, sur tout cluster compatible autorisé par la configuration. +- `ks-pipeline` possède l'orchestration générique du backfill, de l'extraction Core, du replay, des corrélations stateful, du préflight, de la préparation, de la simulation, de la soumission autorisée, de la confirmation, de la postvalidation et de la matérialisation idempotente. +- `ks-pipeline` ne doit contenir ni wallet, mint, compte, airdrop, autorité, adresse, séquence ou hypothèse codée en dur pour une démonstration Devnet ou Testnet. +- `ks-pipeline-demo-scenarios` contient les fixtures, aides de campagne et tests automatisés spécifiques aux réseaux de test, actuellement Devnet ou Testnet. +- Les fixtures, séquences, simulations/soumissions, postconditions et qualifications Devnet/Testnet réutilisables appartiennent à `ks-pipeline-demo-scenarios`, y compris lorsqu'elles sont déclenchées depuis le desktop. - `kb-app-demo-desktop` conserve l'adaptation UI/Tauri, l'état applicatif, la sélection opérateur, la progression/annulation et la présentation. Il ne doit pas maintenir une seconde implémentation d'une campagne réutilisable. -- `kb-pipeline-demo-scenarios` peut préparer des wallets temporaires, demander des airdrops, créer des actifs de test, enchaîner plusieurs appels du pipeline généraliste et produire des preuves de validation réseau. -- Le binaire `kb-pipeline-demo-scenarios-cli` reste un outil ciblé tant que son contrat public ne prévoit pas explicitement d'autres commandes. Son usage historique de préparation des fixtures SPL Token-2022 ne doit pas être généralisé implicitement à tous les scénarios. -- `kb-pipeline-demo-scenarios` dépend de `kb-pipeline` ; la dépendance inverse est interdite. -- Une primitive ou orchestration réellement réutilisable hors d'une campagne de validation précise doit être placée dans `kb-pipeline`, `kb-pipeline-demo-scenarios` ou la crate métier propriétaire selon sa responsabilité. Seuls les adaptateurs, états et séquences strictement propres à l'interaction UI restent dans le desktop. +- `ks-pipeline-demo-scenarios` peut préparer des wallets temporaires, demander des airdrops, créer des actifs de test, enchaîner plusieurs appels du pipeline généraliste et produire des preuves de validation réseau. +- Le binaire `ks-pipeline-demo-scenarios-cli` reste un outil ciblé tant que son contrat public ne prévoit pas explicitement d'autres commandes. Son usage historique de préparation des fixtures SPL Token-2022 ne doit pas être généralisé implicitement à tous les scénarios. +- `ks-pipeline-demo-scenarios` dépend de `ks-pipeline` ; la dépendance inverse est interdite. +- Une primitive ou orchestration réellement réutilisable hors d'une campagne de validation précise doit être placée dans `ks-pipeline`, `ks-pipeline-demo-scenarios` ou la crate métier propriétaire selon sa responsabilité. Seuls les adaptateurs, états et séquences strictement propres à l'interaction UI restent dans le desktop. - Les scénarios Mainnet sans écriture, par exemple les validations de backfill ou de replay, relèvent du pipeline généraliste et de documents de validation dédiés ; ils ne justifient pas l'introduction d'une logique Mainnet spécifique dans la crate de scénarios Devnet/Testnet. ### Autres frontières -- `kb-store` possède les contrats de persistance neutres et les adaptateurs de base de données. -- PostgreSQL est l'adaptateur de production de `kb-store`. -- Un futur adaptateur SQLite doit rester interne à `kb-store` et limité aux tests, imports et corpus locaux. -- `kb-wallet` reste isolé du reste du système. +- `ks-store` possède les contrats de persistance neutres et les adaptateurs de base de données. +- PostgreSQL est l'adaptateur de production de `ks-store`. +- Un futur adaptateur SQLite doit rester interne à `ks-store` et limité aux tests, imports et corpus locaux. +- `ks-wallet` reste isolé du reste du système. - Les transactions raw sont immuables et restent la source d'audit. - Les replays doivent être ciblés par module, version, programme, surface, discriminator, slot ou signatures. - La documentation active du projet ne doit pas présenter l'ancien workspace comme architecture courante. Les documents de migration et copies de référence peuvent le nommer explicitement. @@ -124,20 +124,20 @@ Les nouvelles surfaces de programmes doivent utiliser un nom canonique basé sur Les modules internes de décodage doivent utiliser la hiérarchie de fichiers : ```text -kb-lib/src/decoder//_[_vN].rs +ks-lib/src/decoder//_[_vN].rs ``` Exemples : -- `kb-lib/src/decoder/amm/raydium_cpmm.rs` ; -- `kb-lib/src/decoder/clmm/raydium.rs` ; -- `kb-lib/src/decoder/dlmm/meteora.rs` ; -- `kb-lib/src/decoder/router/jupiter_aggregator_v6.rs` ; -- `kb-lib/src/decoder/orderbook/openbook_v2.rs` ; -- `kb-lib/src/decoder/metadata/metaplex_token_metadata.rs` ; -- `kb-lib/src/decoder/nft/metaplex_bubblegum.rs`. +- `ks-lib/src/decoder/amm/raydium_cpmm.rs` ; +- `ks-lib/src/decoder/clmm/raydium.rs` ; +- `ks-lib/src/decoder/dlmm/meteora.rs` ; +- `ks-lib/src/decoder/router/jupiter_aggregator_v6.rs` ; +- `ks-lib/src/decoder/orderbook/openbook_v2.rs` ; +- `ks-lib/src/decoder/metadata/metaplex_token_metadata.rs` ; +- `ks-lib/src/decoder/nft/metaplex_bubblegum.rs`. -Ces modules restent privés. Les consommateurs externes utilisent exclusivement les types et fonctions réexportés directement par `kb_lib`. +Ces modules restent privés. Les consommateurs externes utilisent exclusivement les types et fonctions réexportés directement par `ks_lib`. Les noms historiques ou issus d'IDL doivent être conservés dans le registre, mais ne doivent pas créer de nouveau module si un module canonique existe déjà. @@ -178,13 +178,13 @@ Aucun renommage massif de modules n'est autorisé sans étape de contrôle dédi ## Règles de tracing -- Une crate ou un composant de `kb-lib` est opérationnel lorsqu’il effectue des I/O, orchestre un pipeline, décode, matérialise, exécute, applique une politique runtime ou prend une décision mutable observable. +- Une crate ou un composant de `ks-lib` est opérationnel lorsqu’il effectue des I/O, orchestre un pipeline, décode, matérialise, exécute, applique une politique runtime ou prend une décision mutable observable. - Toute crate opérationnelle ajoutée ou modifiée doit dépendre de `tracing` depuis le workspace et déclarer exactement un `pub(crate) const TRACING_TARGET` dans `src/constants.rs`. -- Hors `kb-lib`, la valeur canonique de `TRACING_TARGET_DECODER_METADATA_METAPLEX_TOKEN_METADATA` est le nom exact du package Cargo. -- Dans `kb-lib`, chaque composant opérationnel possède son propre `constants.rs` et un target hiérarchique stable fondé sur son identifiant de décodeur, matérialiseur ou exécuteur ; un target unique `kb-lib` ne doit pas effacer l'identité du composant. +- Hors `ks-lib`, la valeur canonique de `TRACING_TARGET_DECODER_METADATA_METAPLEX_TOKEN_METADATA` est le nom exact du package Cargo. +- Dans `ks-lib`, chaque composant opérationnel possède son propre `constants.rs` et un target hiérarchique stable fondé sur son identifiant de décodeur, matérialiseur ou exécuteur ; un target unique `ks-lib` ne doit pas effacer l'identité du composant. - Les targets historiques `khbot.*` et les targets de fenêtre sont interdits dans les nouvelles modifications. - Les macros `tracing` doivent utiliser `target: crate::TRACING_TARGET` et des champs structurés stables. La granularité interne passe par `action`, `stage`, `window`, `campaign_id`, `signature`, `instruction_path`, `program_id`, `processor_name`, `processor_version`, `status` et `error_code`. -- Les crates passives de types, contrats, DTO, API sans exécution, registres ou constantes restent sans dépendance `tracing`. `kb-config` reste une exception de bootstrap tant que sa validation précède l’installation du subscriber. +- Les crates passives de types, contrats, DTO, API sans exécution, registres ou constantes restent sans dépendance `tracing`. `ks-config` reste une exception de bootstrap tant que sa validation précède l’installation du subscriber. - Il est interdit d’ajouter `tracing` sans événement réel, de conserver un tracing target déclaré mais inutilisé ou de consommer artificiellement un target avec `let _target`. - Une décision interne doit être journalisée par la crate responsable ; `kb-app-demo-desktop` ne journalise que les frontières Tauri/UI, les actions utilisateur et les résumés d’orchestration. - Tout input sélectionné sans décodeur compatible, tout résultat de décodage `failed` ou `unsupported`, tout résultat de matérialisation `failed`, toute validation de résultat invalide et toute erreur de persistance doivent émettre un événement `error` avant le retour ou la persistance terminale. @@ -201,14 +201,14 @@ Aucun renommage massif de modules n'est autorisé sans étape de contrôle dédi - Les dépendances déclarées dans `[workspace.dependencies]` forment un catalogue de versions et de features autorisées ; elles ne doivent être ajoutées à une crate consommatrice que lorsqu’un type, un encodeur, un décodeur ou un identifiant officiel est réellement utilisé. - Dans un `Cargo.toml`, placer dans `[dependencies]` toute crate référencée par le code de bibliothèque compilé en production. Réserver `[dev-dependencies]` aux références contenues exclusivement dans `#[cfg(test)]`, les tests d’intégration, benches ou exemples. Une dépendance de test vers un décodeur ou matérialiseur concret est légitime lorsqu’elle sert uniquement à éprouver une orchestration générique fondée sur les traits API ; elle ne prouve pas qu’une capacité de production manque. Toute promotion de `dev-dependencies` vers `dependencies` doit être motivée par un appel runtime réel, et toute dépendance runtime inutilisée doit être supprimée. -- Les registres de composition runtime des applications doivent énumérer explicitement chaque décodeur et matérialiseur concret activé. Toute nouvelle surface instructionnelle dotée d’un `MtApiEventMaterializer` doit être ajoutée au registre applicatif et couverte par un test d’inventaire ordonné ; une crate présente dans le workspace ou dans `kb_pipeline` n’est pas activée automatiquement. Les matérialiseurs exclusivement stateful qui n’implémentent pas `MtApiEventMaterializer` restent routés par leurs APIs de snapshots dédiées. +- Les registres de composition runtime des applications doivent énumérer explicitement chaque décodeur et matérialiseur concret activé. Toute nouvelle surface instructionnelle dotée d’un `MtApiEventMaterializer` doit être ajoutée au registre applicatif et couverte par un test d’inventaire ordonné ; une crate présente dans le workspace ou dans `ks_pipeline` n’est pas activée automatiquement. Les matérialiseurs exclusivement stateful qui n’implémentent pas `MtApiEventMaterializer` restent routés par leurs APIs de snapshots dédiées. - Les corrélations instruction/état doivent produire une issue explicite (`confirmed`, `contradicted` ou `not_applicable`) et ne doivent jamais transformer automatiquement une configuration observée en violation, score ou conclusion métier. - Une interface officielle Solana ou SPL étroite doit être préférée à `solana-sdk` lorsque son contrat suffit. - L’ordre de préférence des formats est : schéma officiel `wincode`, schéma officiel Borsh, puis parseur local borné reproduisant exactement le runtime lorsque l’interface officielle n’expose que `bincode`. - Aucun nouveau code ne doit dépendre directement de `bincode`. Une interface officielle uniquement disponible derrière une feature `bincode` ne justifie pas l’activation de cette feature ; le layout doit alors être prouvé depuis les sources officielles et implémenté localement avec des bornes et des tests. - Les exécuteurs doivent utiliser les builders officiels disponibles, préserver l’ordre exact des metas, borner toute liste de comptes variable avant l’appel au builder et refuser les doublons lorsque leur répétition n’a pas de sémantique publiée. - Les features des interfaces doivent rester minimales et explicites. Une feature `serde`, `wincode`, `borsh`, `std`, `alloc` ou équivalente n’est activée que si la crate consommatrice l’utilise réellement. -- Les crates applicatives ne doivent pas dépendre d’interfaces RPC ou transactionnelles uniquement pour relayer des types ; ces dépendances appartiennent à `kb_onchain_transport`, aux modèles communs justifiés ou à la crate opérationnelle propriétaire. +- Les crates applicatives ne doivent pas dépendre d’interfaces RPC ou transactionnelles uniquement pour relayer des types ; ces dépendances appartiennent à `ks_onchain_transport`, aux modèles communs justifiés ou à la crate opérationnelle propriétaire. - Toute exception et toute implémentation locale doivent être documentées dans `docs/SOLANA_INTERFACE_DEPENDENCIES.md` avec la raison, la source officielle et la stratégie de test. - Tant que les types Solana consommés implémentent les traits de `wincode 0.5.x`, le catalogue workspace conserve `wincode = "^0.5"`. Le `Cargo.lock` local du workspace doit résoudre exactement @@ -221,13 +221,13 @@ Aucun renommage massif de modules n'est autorisé sans étape de contrôle dédi ## Règles des exécuteurs -- Les exécuteurs résident dans `kb_lib::executor`. -- Une surface classifiée peut avoir un module décodeur et un module exécuteur distincts dans `kb-lib`. +- Les exécuteurs résident dans `ks_lib::executor`. +- Une surface classifiée peut avoir un module décodeur et un module exécuteur distincts dans `ks-lib`. - Les exécuteurs ne doivent pas dépendre des décodeurs. -- Les exécuteurs utilisent les contrats `ExApi*` réexportés directement par la façade `kb_lib`. -- Un squelette d’exécuteur doit exposer un type `Ex*Executor`, référencer uniquement des Program IDs de `kb-program-ids`, annoncer `Maybe` pour sa surface et construire exclusivement un plan réservé à zéro instruction. +- Les exécuteurs utilisent les contrats `ExApi*` réexportés directement par la façade `ks_lib`. +- Un squelette d’exécuteur doit exposer un type `Ex*Executor`, référencer uniquement des Program IDs de `ks-program-ids`, annoncer `Maybe` pour sa surface et construire exclusivement un plan réservé à zéro instruction. - La migration fonctionnelle d’un exécuteur doit remplacer ce comportement réservé par des capacités exactes `Supported` ou `Unsupported(reason)` ; aucun statut temporaire `LEGACY_CRATE` ou `MIGRATION_STATUS` ne doit subsister. -- Les garde-fous communs doivent être placés dans les modules de sécurité partagés de `kb-lib`. +- Les garde-fous communs doivent être placés dans les modules de sécurité partagés de `ks-lib`. - Aucun exécuteur ne doit envoyer de transaction sans simulation et validation explicite. - Les surfaces non classifiées ne doivent pas avoir de crate exécuteur. - La section « Couverture des exécuteurs » ci-dessus est normative pour chaque surface : la migration fonctionnelle doit fermer l’inventaire complet et ne peut pas sélectionner arbitrairement un sous-ensemble d’opérations officiellement constructibles. @@ -237,7 +237,7 @@ Aucun renommage massif de modules n'est autorisé sans étape de contrôle dédi ## Règles de configuration -- La configuration applicative commune doit passer par `kb-config`. +- La configuration applicative commune doit passer par `ks-config`. - Les fichiers JSON de configuration ne doivent pas contenir de commentaires. - Les secrets ne doivent pas être écrits en clair dans le dépôt. - Les valeurs sensibles doivent utiliser des variables d'environnement ou un stockage chiffré dédié. @@ -245,23 +245,23 @@ Aucun renommage massif de modules n'est autorisé sans étape de contrôle dédi ## Ordre de développement cible -- `kb-logging` doit être stabilisé avant les logs avancés des autres crates. -- `kb-config` doit être stabilisé avant les stores, RPC, wallet et applications. +- `ks-logging` doit être stabilisé avant les logs avancés des autres crates. +- `ks-config` doit être stabilisé avant les stores, RPC, wallet et applications. - Les contrats SQL et de matérialisation doivent être définis avant les gros décodeurs DEX. - Les implémentations détaillées des matérialisateurs doivent suivre les sorties réelles des décodeurs correspondants. - `kb-app-demo-desktop` doit fournir des validations live après chaque capacité majeure, sans créer une application Tauri séparée par crate. -## Constantes des composants de `kb-lib` +## Constantes des composants de `ks-lib` - Chaque composant classifié avec un `program_id` doit avoir son propre fichier `constants.rs`. - `constants.rs` contient les discriminators, sélecteurs, opcodes, constantes Borsh et constantes de décodage quand elles sont connues. -- Le module parent puis `kb-lib/src/lib.rs` réexportent les constantes publiques nécessaires. -- Les fichiers d'implémentation utilisent le chemin public le plus court réexporté par `kb-lib`. +- Le module parent puis `ks-lib/src/lib.rs` réexportent les constantes publiques nécessaires. +- Les fichiers d'implémentation utilisent le chemin public le plus court réexporté par `ks-lib`. - Les literals de `program_id` ne doivent pas rester dans `program_ids()`, sauf dans un fichier `constants.rs`. ## Identifiants de programmes -Les `program_id` connus doivent être définis une seule fois dans `kb-program-ids`. Les composants de décodeur, d’exécuteur, de store, d’application ou d’outil doivent référencer directement `kb_program_ids::XXX_PROGRAM_ID`. Les fichiers `constants.rs` locaux ne doivent pas redéfinir ces chaînes ; ils restent réservés aux constantes internes du module, par exemple discriminators, opcodes, seeds, index de comptes ou layouts. +Les `program_id` connus doivent être définis une seule fois dans `ks-program-ids`. Les composants de décodeur, d’exécuteur, de store, d’application ou d’outil doivent référencer directement `ks_program_ids::XXX_PROGRAM_ID`. Les fichiers `constants.rs` locaux ne doivent pas redéfinir ces chaînes ; ils restent réservés aux constantes internes du module, par exemple discriminators, opcodes, seeds, index de comptes ou layouts. ## Validation frontend Tauri @@ -274,14 +274,14 @@ Les `program_id` connus doivent être définis une seule fois dans `kb-program-i ## Architecture `khadhroony-bot3` -- Les décodeurs, exécuteurs et matérialisateurs résident exclusivement dans `kb-lib`. +- Les décodeurs, exécuteurs et matérialisateurs résident exclusivement dans `ks-lib`. - Les modules peuvent posséder leur propre fichier de constantes. -- Toute API publique portée depuis une ancienne crate doit être réexportée au crate root de `kb-lib`. -- `kb-store` regroupe les contrats store-neutral et les adaptateurs de persistance, avec PostgreSQL comme adaptateur de production initial. -- `kb-store/src/lib.rs` reste une façade : les DTO, entités, traits, requêtes et implémentations résident dans des modules privés dédiés et toute API publique est réexportée au crate root. -- Les modèles source-neutral partagés avec les décodeurs, notamment `MdCoreInstructionReplayInput`, appartiennent à `kb-lib`; `kb-store` les consomme et les réexporte sans les dupliquer. -- `kb-lib` ne dépend jamais de `kb-store`. Cette direction de dépendance évite tout cycle entre modèles, décodage et persistance. -- `kb-store` ne dépend pas de `kb-config`. La frontière applicative transforme une configuration résolue en options de store explicitement validées. +- Toute API publique portée depuis une ancienne crate doit être réexportée au crate root de `ks-lib`. +- `ks-store` regroupe les contrats store-neutral et les adaptateurs de persistance, avec PostgreSQL comme adaptateur de production initial. +- `ks-store/src/lib.rs` reste une façade : les DTO, entités, traits, requêtes et implémentations résident dans des modules privés dédiés et toute API publique est réexportée au crate root. +- Les modèles source-neutral partagés avec les décodeurs, notamment `MdCoreInstructionReplayInput`, appartiennent à `ks-lib`; `ks-store` les consomme et les réexporte sans les dupliquer. +- `ks-lib` ne dépend jamais de `ks-store`. Cette direction de dépendance évite tout cycle entre modèles, décodage et persistance. +- `ks-store` ne dépend pas de `ks-config`. La frontière applicative transforme une configuration résolue en options de store explicitement validées. - Les adaptateurs concrets implémentent les mêmes traits neutres et ne font pas fuiter leurs types de connexion dans les contrats. - Seul `kb-app-demo-desktop` est conservé comme binaire pendant la migration initiale. diff --git a/docs/validation/V0_4_8_METADATA_VALIDATION_REPORT.md b/docs/validation/V0_4_8_METADATA_VALIDATION_REPORT.md index a86c606..d0b26d4 100644 --- a/docs/validation/V0_4_8_METADATA_VALIDATION_REPORT.md +++ b/docs/validation/V0_4_8_METADATA_VALIDATION_REPORT.md @@ -1,5 +1,5 @@ - + # Validation fonctionnelle — Metadata on-chain et clôture 0.4.8 @@ -41,7 +41,7 @@ Les cinq opérations indisponibles restent explicitement bornées par les observ ## Desktop Metadata -`kb-app-demo-desktop` sépare les trois domaines Metadata et appelle les scénarios réutilisables de `kb-pipeline-demo-scenarios`. +`kb-app-demo-desktop` sépare les trois domaines Metadata et appelle les scénarios réutilisables de `ks-pipeline-demo-scenarios`. La validation finale couvre notamment : @@ -67,16 +67,16 @@ La campagne finale du 9 août 2026 est conforme : Les principales cibles unitaires observées comprennent : - `kb-app-demo-desktop` : 144 tests ; -- `kb-config` : 46 tests ; -- `kb-core` : 2 tests ; -- `kb-lib` : 706 tests, plus 9 tests d’intégration ; -- `kb-logging` : 17 tests ; -- `kb-onchain-transport` : 118 tests ; -- `kb-pipeline` : 109 tests, plus 3 tests d’intégration Metadata ; -- `kb-pipeline-demo-scenarios` : 105 tests bibliothèque, 1 test CLI et 1 test API externe ; -- `kb-program-ids` : 6 tests ; -- `kb-store` : 84 tests ; -- `kb-wallet` : 6 tests. +- `ks-config` : 46 tests ; +- `ks-core` : 2 tests ; +- `ks-lib` : 706 tests, plus 9 tests d’intégration ; +- `ks-logging` : 17 tests ; +- `ks-onchain-transport` : 118 tests ; +- `ks-pipeline` : 109 tests, plus 3 tests d’intégration Metadata ; +- `ks-pipeline-demo-scenarios` : 105 tests bibliothèque, 1 test CLI et 1 test API externe ; +- `ks-program-ids` : 6 tests ; +- `ks-store` : 84 tests ; +- `ks-wallet` : 6 tests. ## Build desktop de release diff --git a/idls/001.README.md b/idls/001.README.md index dd2f018..0f33488 100644 --- a/idls/001.README.md +++ b/idls/001.README.md @@ -1,5 +1,5 @@ - + # Répertoire IDL v3 @@ -9,10 +9,10 @@ Le contenu brut des JSON n'a pas été modifié ; seuls les noms de fichiers ont ## Convention ```text -..[.].V.from_.json +..[.].V.from_.json ``` -- `famille-kb-lib` correspond au premier niveau fonctionnel de `kb-lib` : `solana`, `spl`, +- `famille-ks-lib` correspond au premier niveau fonctionnel de `ks-lib` : `solana`, `spl`, `metadata`, `launchpad`, `fees`, `strategy`, etc. - `program-id` est l'identifiant canonique du programme. - `chemin-module` correspond au module fonctionnel cible sans les rôles `decoder` ou `executor`. @@ -24,7 +24,7 @@ Le contenu brut des JSON n'a pas été modifié ; seuls les noms de fichiers ont - `../docs/IDL_AUDIT.md` : inventaire, validation JSON, versions et empreintes. - `../docs/MISSING_PROGRAM_IDLS.md` : programmes connus sans IDL présente ou sans IDL officielle identifiée. -- `../docs/IDL_TO_KB_LIB_NOMENCLATURE.md` : correspondance entre chaque IDL et le module `kb-lib`. +- `../docs/IDL_TO_KB_LIB_NOMENCLATURE.md` : correspondance entre chaque IDL et le module `ks-lib`. ## Décisions architecturales intégrées @@ -36,4 +36,4 @@ Le contenu brut des JSON n'a pas été modifié ; seuls les noms de fichiers ont - une famille `storage` est proposée pour `storage/solana_record`. Ces changements de modules ne sont pas appliqués au code Rust dans cette archive ; ils servent de cible -pour la prochaine refactorisation de `kb-lib`. +pour la prochaine refactorisation de `ks-lib`. diff --git a/kb-app-demo-desktop/CHANGELOG.md b/kb-app-demo-desktop/CHANGELOG.md index afff6d3..c591fd4 100644 --- a/kb-app-demo-desktop/CHANGELOG.md +++ b/kb-app-demo-desktop/CHANGELOG.md @@ -1,8 +1,14 @@ - + # CHANGELOG — kb-app-demo-desktop +## `0.5.1-pre.002` + +- adapte les dépendances Rust et tous les appels de crates Solana vers `ks_*` sans renommer l'application ; +- conserve `kb-app-demo-desktop` comme banc de validation et future surface de démonstrations propres au bot ; +- laisse les bindings TS-RS générés être régénérés par les tests après migration de `kb_config` vers `ks_config`. + ## `0.5.1-pre.001` ### Documentation @@ -14,7 +20,7 @@ ### Documentation -- réaligne la frontière desktop/scénarios : les campagnes réutilisables appartiennent à `kb-pipeline-demo-scenarios`, tandis que le desktop conserve l’adaptation UI/Tauri, l’état applicatif et la présentation ; +- réaligne la frontière desktop/scénarios : les campagnes réutilisables appartiennent à `ks-pipeline-demo-scenarios`, tandis que le desktop conserve l’adaptation UI/Tauri, l’état applicatif et la présentation ; - identifie pour `0.5.4` les dispatchs, critères de complétion et projections de preuves encore réutilisables à sortir du desktop ; aucun parcours runtime n’est modifié dans cette prerelease. ## 0.5.0-pre.001 @@ -39,11 +45,11 @@ - `pre.014-delta-fix-002` réaligne le test de contrôles Metaplex sur la nouvelle UI qualifiée (`metadataMetaplexCampaignSelect` + confirmation + exécution) et retire les assertions sur les anciens contrôles Devnet supprimés par `fix-001` ; - après deux crashs reproductibles du desktop pendant `Create -> Mint — NFT`, les logs montrent `Create` simulé, soumis et confirmé, puis un arrêt brutal pendant le `getTransaction` de l'hydratation canonique, sans panic Rust ni erreur JSONL ; - boxe explicitement le futur volumineux du dispatch des 11 campagnes Metaplex avant son exécution dans le runtime Tauri afin de réduire l'état async conservé par la commande desktop et ajoute des marqueurs backend `campaign_start`, `campaign_completed` et `campaign_failed` ; cette correction reste volontairement limitée à l'adaptateur desktop et ne modifie aucune campagne Devnet déjà qualifiée ; -- `pre.014-delta-fix-001` remplace le chemin Devnet Metaplex générique du panneau par 11 campagnes qualifiées réutilisant directement les runners spécialisés de `kb-pipeline-demo-scenarios` : cinq `Create -> Mint`, collection, Print/Burn, lifecycle pNFT, escrow, maintenance et probe Use ; +- `pre.014-delta-fix-001` remplace le chemin Devnet Metaplex générique du panneau par 11 campagnes qualifiées réutilisant directement les runners spécialisés de `ks-pipeline-demo-scenarios` : cinq `Create -> Mint`, collection, Print/Burn, lifecycle pNFT, escrow, maintenance et probe Use ; - conserve les scénarios Metaplex synthétiques pour l’inspection de contrats, mais ne présente plus `scenario + step + intent JSON` comme parcours Devnet principal ; - confine `Use`, `Resize`, `Migrate`, `Collect` et `CloseAccounts` aux probes simulation-only de leurs campagnes qualifiées et ne les expose jamais comme soumissions isolées ; - déplace la carte **Exigences** en bas de la colonne droite, après les postconditions, tout en conservant le journal d’exécution en pleine largeur sous la grille ; -- enregistre la première validation Tauri de `pre.014` : `cargo check --workspace`, Clippy et l’audit workspace sont propres, `kb-pipeline-demo-scenarios` réussit 105 tests unitaires + 1 CLI + 1 API externe, et `kb-app-demo-desktop` réussit 139 tests unitaires ; +- enregistre la première validation Tauri de `pre.014` : `cargo check --workspace`, Clippy et l’audit workspace sont propres, `ks-pipeline-demo-scenarios` réussit 105 tests unitaires + 1 CLI + 1 API externe, et `kb-app-demo-desktop` réussit 139 tests unitaires ; - les logs fournis confirment l’exécution desktop complète de Token-2022 Token Metadata et Solana Program Metadata sur Devnet, tandis que l’ancien parcours Metaplex s’arrêtait après la seule préparation de fixture, défaut de câblage corrigé par ce delta ; - ajoute le troisième sous-panneau **Token-2022 Token Metadata** dans `demo_execution_metadata` ; - appelle directement la campagne réutilisable de cinq opérations `Initialize -> UpdateField -> Emit -> RemoveKey -> UpdateAuthority` sur un mint Token-2022 frais ; @@ -57,7 +63,7 @@ - `pre.013-delta-fix-022` restaure la compatibilité `Future + Send` de la commande Tauri Metaplex en corrigeant le runner partagé : l'effacement temporaire `Signer + Sync -> &dyn Signer` est limité à un helper synchrone de signature et n'est plus conservé au travers des `await` ; aucun assouplissement de la commande desktop n'est nécessaire ; - `pre.013-delta-fix-002` retire la réécriture locale du JSON `Create` par famille et consomme désormais directement la fixture Metaplex réutilisable, afin d’éviter qu’un parcours `Fungible` annonce un token standard incompatible avec le mint réellement préparé ; - conserve l’action Create autonome sur une fixture NFT par défaut, tandis que les parcours de scénario sélectionnent explicitement leur famille lors de la préparation. -- `pre.013-delta-fix-001` sérialise explicitement les summaries de backfill, extraction Core et replay dans l'evidence JSON au lieu d'exiger `serde::Serialize` sur les contrats internes de `kb-pipeline` ; +- `pre.013-delta-fix-001` sérialise explicitement les summaries de backfill, extraction Core et replay dans l'evidence JSON au lieu d'exiger `serde::Serialize` sur les contrats internes de `ks-pipeline` ; - adapte l’appel Metaplex au runner Devnet renforcé sans ajouter encore de nouveau parcours UI ; - initialise le store PostgreSQL avant une exécution Metaplex réelle et fournit le décodeur ainsi que les matérialiseurs runtime ; - conserve dans l’evidence JSON le backfill canonique, l’extraction Core, le replay, la seconde passe d’idempotence, les matérialisations instructionnelles et le diagnostic post-exécution. @@ -68,11 +74,11 @@ - renomme les contrats et commandes Tauri Metaplex afin de rendre leur domaine explicite ; - remplace la réutilisation erronée de l’observer Solana Core par un observer Metadata ciblant exclusivement `demo_execution_metadata` ; - déplace le garde de l’exécution Devnet partagée dans `demo_devnet_common` sous le nom générique `DemoExecutionRunGuard` ; -- consomme la borne RPC complète de `65536` octets exposée par `kb-onchain-transport` pour les lectures Solana Program Metadata ; +- consomme la borne RPC complète de `65536` octets exposée par `ks-onchain-transport` pour les lectures Solana Program Metadata ; - ajoute un adaptateur desktop séparé pour les deux parcours Solana Program Metadata ; - expose l’inventaire exact des neuf opérations et leurs états attendus ; - synchronise le profil Devnet entre les sections Metaplex et Solana Program Metadata ; -- appelle directement la campagne réutilisable de `kb-pipeline-demo-scenarios` sans dupliquer la logique réseau ; +- appelle directement la campagne réutilisable de `ks-pipeline-demo-scenarios` sans dupliquer la logique réseau ; - affiche la fixture, les deux signatures de préfinancement, les neuf simulations, confirmations, postconditions et snapshots matérialisés ; - exige une confirmation explicite unique couvrant les deux préfinancements et les neuf mutations ; - conserve les parcours Metaplex existants inchangés. @@ -125,7 +131,7 @@ - remplace la préparation Metaplex fondée sur `solana-keygen`, `solana` et `spl-token` par une transaction Rust native ; - crée le mint par `SystemCreateAccount` puis `SPL Token InitializeMint2` dans un même message simulé, signé et confirmé ; - utilise explicitement le wallet du profil comme mint authority et freeze authority ; -- conserve le keypair du mint dans `kb-wallet` sans exposer ni déléguer ses secrets à une CLI externe. +- conserve le keypair du mint dans `ks-wallet` sans exposer ni déléguer ses secrets à une CLI externe. ## 0.4.7-pre.013-fix-009 diff --git a/kb-app-demo-desktop/Cargo.toml b/kb-app-demo-desktop/Cargo.toml index 60756e5..176dac6 100644 --- a/kb-app-demo-desktop/Cargo.toml +++ b/kb-app-demo-desktop/Cargo.toml @@ -1,5 +1,5 @@ # file: kb-app-demo-desktop/Cargo.toml -# version: 6 +# version: 7 [package] name = "kb-app-demo-desktop" @@ -23,16 +23,16 @@ tauri-build.workspace = true [dependencies] chrono.workspace = true fs2.workspace = true -kb-config = { path = "../kb-config" } -kb-core = { path = "../kb-core" } -kb-logging = { path = "../kb-logging" } -kb-lib = { path = "../kb-lib" } -kb-program-ids = { path = "../kb-program-ids" } -kb-store = { path = "../kb-store" } -kb-wallet = { path = "../kb-wallet" } -kb-pipeline = { path = "../kb-pipeline" } -kb-pipeline-demo-scenarios = { path = "../kb-pipeline-demo-scenarios" } -kb-onchain-transport = { path = "../kb-onchain-transport" } +ks-config = { path = "../ks-config" } +ks-core = { path = "../ks-core" } +ks-logging = { path = "../ks-logging" } +ks-lib = { path = "../ks-lib" } +ks-program-ids = { path = "../ks-program-ids" } +ks-store = { path = "../ks-store" } +ks-wallet = { path = "../ks-wallet" } +ks-pipeline = { path = "../ks-pipeline" } +ks-pipeline-demo-scenarios = { path = "../ks-pipeline-demo-scenarios" } +ks-onchain-transport = { path = "../ks-onchain-transport" } serde.workspace = true serde_json.workspace = true spl-associated-token-account-interface.workspace = true diff --git a/kb-app-demo-desktop/README.md b/kb-app-demo-desktop/README.md index c353304..7e27e41 100644 --- a/kb-app-demo-desktop/README.md +++ b/kb-app-demo-desktop/README.md @@ -1,5 +1,5 @@ - + # kb-app-demo-desktop @@ -17,21 +17,21 @@ ## Frontière architecturale -Les commandes Tauri sont des adaptateurs minces. La logique réutilisable appartient à `kb-pipeline`, `kb-pipeline-demo-scenarios`, `kb-lib`, `kb-store` et `kb-onchain-transport`. +Les commandes Tauri sont des adaptateurs minces. La logique réutilisable appartient à `ks-pipeline`, `ks-pipeline-demo-scenarios`, `ks-lib`, `ks-store` et `ks-onchain-transport`. -Les campagnes Devnet/Testnet réutilisables appartiennent à `kb-pipeline-demo-scenarios`. Le desktop conserve leurs adaptateurs UI/Tauri, la sélection opérateur, la progression, les payloads TS-RS et la présentation ; `0.5.4` doit retirer les orchestrations réutilisables qui subsistent encore localement. +Les campagnes Devnet/Testnet réutilisables appartiennent à `ks-pipeline-demo-scenarios`. Le desktop conserve leurs adaptateurs UI/Tauri, la sélection opérateur, la progression, les payloads TS-RS et la présentation ; `0.5.4` doit retirer les orchestrations réutilisables qui subsistent encore localement. ## Exécution Metaplex Token Metadata -Le panneau conserve les scénarios synthétiques pour inspecter les contrats, mais son parcours Devnet principal expose désormais 11 campagnes qualifiées de `pre.013` et appelle directement leurs runners spécialisés de `kb-pipeline-demo-scenarios`. Les cinq variantes `Create -> Mint`, collection, Print/Burn, lifecycle pNFT et escrow soumettent uniquement les opérations autorisées ; Maintenance et Use conservent les opérations `unavailable` dans des probes simulation-only. Le desktop ne reconstruit pas les builders ; il conserve encore une partie du dispatch, des critères de complétion et de la projection de preuves, à centraliser en `0.5.4` lorsque cette logique est réutilisable. +Le panneau conserve les scénarios synthétiques pour inspecter les contrats, mais son parcours Devnet principal expose désormais 11 campagnes qualifiées de `pre.013` et appelle directement leurs runners spécialisés de `ks-pipeline-demo-scenarios`. Les cinq variantes `Create -> Mint`, collection, Print/Burn, lifecycle pNFT et escrow soumettent uniquement les opérations autorisées ; Maintenance et Use conservent les opérations `unavailable` dans des probes simulation-only. Le desktop ne reconstruit pas les builders ; il conserve encore une partie du dispatch, des critères de complétion et de la projection de preuves, à centraliser en `0.5.4` lorsque cette logique est réutilisable. ## Exécution Token-2022 Token Metadata -Le sous-panneau dédié appelle directement la campagne réutilisable de `kb-pipeline-demo-scenarios`; son parcours desktop complet a été confirmé sur Devnet pendant `pre.014`. Il crée un mint Token-2022 frais avec Metadata Pointer auto-référencé puis exécute, dans l’ordre, `Initialize`, `UpdateField`, `Emit`, `RemoveKey` et `UpdateAuthority`. Chaque étape passe par simulation, confirmation, replay canonique, matérialisation lorsque requise, lecture stateful et postcondition ; `Emit` conserve en plus sa return data validée. +Le sous-panneau dédié appelle directement la campagne réutilisable de `ks-pipeline-demo-scenarios`; son parcours desktop complet a été confirmé sur Devnet pendant `pre.014`. Il crée un mint Token-2022 frais avec Metadata Pointer auto-référencé puis exécute, dans l’ordre, `Initialize`, `UpdateField`, `Emit`, `RemoveKey` et `UpdateAuthority`. Chaque étape passe par simulation, confirmation, replay canonique, matérialisation lorsque requise, lecture stateful et postcondition ; `Emit` conserve en plus sa return data validée. ## Exécution Solana Program Metadata -Le même panneau expose séparément les deux parcours `Buffer` et `Metadata` de `ProgM6…`; sa campagne desktop complète a été confirmée sur Devnet pendant `pre.014`. La campagne complète crée deux PDA frais, confirme leurs préfinancements, exécute les neuf opérations stables, vérifie les lectures avant/après et affiche les snapshots matérialisés. La logique réseau reste entièrement dans `kb-pipeline-demo-scenarios` ; le desktop ne fait que sélectionner le profil, demander la confirmation et présenter les preuves. +Le même panneau expose séparément les deux parcours `Buffer` et `Metadata` de `ProgM6…`; sa campagne desktop complète a été confirmée sur Devnet pendant `pre.014`. La campagne complète crée deux PDA frais, confirme leurs préfinancements, exécute les neuf opérations stables, vérifie les lectures avant/après et affiche les snapshots matérialisés. La logique réseau reste entièrement dans `ks-pipeline-demo-scenarios` ; le desktop ne fait que sélectionner le profil, demander la confirmation et présenter les preuves. ## Documentation diff --git a/kb-app-demo-desktop/TODO.md b/kb-app-demo-desktop/TODO.md index 040cfe0..5abd277 100644 --- a/kb-app-demo-desktop/TODO.md +++ b/kb-app-demo-desktop/TODO.md @@ -1,11 +1,11 @@ - + # TODO — kb-app-demo-desktop ## Évolutions générales -- [ ] `0.5.4` — réduire les panneaux d'exécution à l'adaptation UI/Tauri en déplaçant toute orchestration de campagne encore réutilisable vers `kb-pipeline-demo-scenarios`. +- [ ] `0.5.4` — réduire les panneaux d'exécution à l'adaptation UI/Tauri en déplaçant toute orchestration de campagne encore réutilisable vers `ks-pipeline-demo-scenarios`. - [ ] UX — empêcher les doubles déclenchements pendant une préparation, simulation ou soumission active. - [ ] Observabilité — afficher explicitement les comptes relus et les projections matérialisées. diff --git a/kb-app-demo-desktop/USAGE.md b/kb-app-demo-desktop/USAGE.md index 07e9fc9..224893e 100644 --- a/kb-app-demo-desktop/USAGE.md +++ b/kb-app-demo-desktop/USAGE.md @@ -1,5 +1,5 @@ - + # Utilisation de kb-app-demo-desktop @@ -32,7 +32,7 @@ Ne pas lancer `npm run build` directement. Tauri exécute le `beforeBuildCommand La bibliothèque expose uniquement `run()` : ```rust -fn launch_desktop() -> kb_core::Result<()> { +fn launch_desktop() -> ks_core::Result<()> { return kb_app_demo_desktop_lib::run(); } ``` @@ -170,7 +170,7 @@ Avant les scénarios Devnet, utiliser les fenêtres généralistes dans cet ordr 3. decode replay avec le Program ID `ProgM6…`, le décodeur `metadata.solana_program_metadata` et la matérialisation activée ; 4. lecture des événements du processor `materializer.metadata.solana_program_metadata`. -Ce parcours ne dépend pas de `kb-pipeline-demo-scenarios`. La fenêtre `demo_execution_metadata` et les scénarios Devnet `ProgM6…` seront ajoutés séparément dans `0.4.8-pre.009`. +Ce parcours ne dépend pas de `ks-pipeline-demo-scenarios`. La fenêtre `demo_execution_metadata` et les scénarios Devnet `ProgM6…` seront ajoutés séparément dans `0.4.8-pre.009`. ### Decode replay diff --git a/kb-app-demo-desktop/frontend/demo_sql_replay_candidates.html b/kb-app-demo-desktop/frontend/demo_sql_replay_candidates.html index 5a31d51..ba27886 100644 --- a/kb-app-demo-desktop/frontend/demo_sql_replay_candidates.html +++ b/kb-app-demo-desktop/frontend/demo_sql_replay_candidates.html @@ -1,5 +1,5 @@ - + @@ -194,7 +194,7 @@
- + diff --git a/kb-app-demo-desktop/src/app_state.rs b/kb-app-demo-desktop/src/app_state.rs index 16454e5..fe8d502 100644 --- a/kb-app-demo-desktop/src/app_state.rs +++ b/kb-app-demo-desktop/src/app_state.rs @@ -1,19 +1,19 @@ // file: kb-app-demo-desktop/src/app_state.rs -// version: 10 +// version: 11 //! Shared Tauri application state and startup initialization. /// Shared state managed by Tauri for the desktop demo application. pub(crate) struct AppState { config_path: std::string::String, - app_config: kb_config::AppConfig, - active_profile: kb_config::ProfileConfig, - logging_guard: std::sync::Mutex, - http_pool: kb_onchain_transport::HttpEndpointPool, + app_config: ks_config::AppConfig, + active_profile: ks_config::ProfileConfig, + logging_guard: std::sync::Mutex, + http_pool: ks_onchain_transport::HttpEndpointPool, ws_pool: - std::sync::Mutex>>, + std::sync::Mutex>>, demo_ws_session: - tokio::sync::Mutex>>, + tokio::sync::Mutex>>, demo_backfill_running: std::sync::atomic::AtomicBool, demo_backfill_cancel_requested: std::sync::atomic::AtomicBool, demo_core_extraction_running: std::sync::atomic::AtomicBool, @@ -28,26 +28,26 @@ pub(crate) struct AppState { impl crate::AppState { /// Initializes configuration, logging and shared runtime state. - pub(crate) fn initialize() -> kb_core::Result { + pub(crate) fn initialize() -> ks_core::Result { let config_path = resolve_config_path(); let workspace_root = crate::workspace_root_dir(); - let app_config = match kb_config::read_config_json_file_with_environment( + let app_config = match ks_config::read_config_json_file_with_environment( &config_path, &workspace_root, ) { std::result::Result::Ok(config) => config, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let active_profile = match kb_config::active_profile(&app_config) { + let active_profile = match ks_config::active_profile(&app_config) { std::result::Result::Ok(profile) => profile.clone(), std::result::Result::Err(error) => return std::result::Result::Err(error), }; let logging_config = convert_logging_config(&active_profile.logging); - let logging_guard = match kb_logging::init_logging(&logging_config) { + let logging_guard = match ks_logging::init_logging(&logging_config) { std::result::Result::Ok(guard) => guard, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&active_profile) + let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&active_profile) { std::result::Result::Ok(pool) => pool, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -79,29 +79,29 @@ impl crate::AppState { } /// Returns the complete parsed application configuration. - pub(crate) fn app_config(&self) -> &kb_config::AppConfig { + pub(crate) fn app_config(&self) -> &ks_config::AppConfig { return &self.app_config; } /// Returns the active profile selected from the configuration. - pub(crate) fn active_profile(&self) -> &kb_config::ProfileConfig { + pub(crate) fn active_profile(&self) -> &ks_config::ProfileConfig { return &self.active_profile; } /// Returns the configured HTTP endpoint pool. - pub(crate) fn http_pool(&self) -> &kb_onchain_transport::HttpEndpointPool { + pub(crate) fn http_pool(&self) -> &ks_onchain_transport::HttpEndpointPool { return &self.http_pool; } /// Returns the lazily initialized WebSocket endpoint pool. pub(crate) fn demo_ws_pool( &self, - ) -> kb_core::Result> { + ) -> ks_core::Result> { let lock_result = self.ws_pool.lock(); let mut guard = match lock_result { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "demo WebSocket pool lock is poisoned", )); }, @@ -109,7 +109,7 @@ impl crate::AppState { if let std::option::Option::Some(pool) = guard.as_ref() { return std::result::Result::Ok(std::sync::Arc::clone(pool)); } - let pool = match kb_onchain_transport::WsEndpointPool::from_profile(&self.active_profile) { + let pool = match ks_onchain_transport::WsEndpointPool::from_profile(&self.active_profile) { std::result::Result::Ok(value) => std::sync::Arc::new(value), std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -120,7 +120,7 @@ impl crate::AppState { /// Returns the persistent WebSocket demo session slot. pub(crate) fn demo_ws_session( &self, - ) -> &tokio::sync::Mutex>> + ) -> &tokio::sync::Mutex>> { return &self.demo_ws_session; } @@ -198,10 +198,10 @@ impl crate::AppState { } } -fn convert_logging_config(config: &kb_config::LoggingConfig) -> kb_logging::LoggingConfig { - let mut targets = std::vec::Vec::::new(); +fn convert_logging_config(config: &ks_config::LoggingConfig) -> ks_logging::LoggingConfig { + let mut targets = std::vec::Vec::::new(); for target in &config.targets { - targets.push(kb_logging::LogTargetConfig { + targets.push(ks_logging::LogTargetConfig { name: target.name.clone(), enabled: target.enabled, sink: target.sink.clone(), @@ -213,14 +213,14 @@ fn convert_logging_config(config: &kb_config::LoggingConfig) -> kb_logging::Logg targets: target.targets.clone(), }); } - let mut target_filters = std::vec::Vec::::new(); + let mut target_filters = std::vec::Vec::::new(); for filter in &config.target_filters { - target_filters.push(kb_logging::LogTargetFilterConfig { + target_filters.push(ks_logging::LogTargetFilterConfig { target: filter.target.clone(), level: filter.level.clone(), }); } - return kb_logging::LoggingConfig { + return ks_logging::LoggingConfig { default_level: config.default_level.clone(), targets, target_filters, diff --git a/kb-app-demo-desktop/src/demo_backfill.rs b/kb-app-demo-desktop/src/demo_backfill.rs index 39abe8c..cb9910d 100644 --- a/kb-app-demo-desktop/src/demo_backfill.rs +++ b/kb-app-demo-desktop/src/demo_backfill.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/demo_backfill.rs -// version: 15 +// version: 16 //! Tauri commands and UI payloads for bounded HTTP transaction backfills. @@ -193,8 +193,8 @@ pub(crate) struct DemoBackfillObserver<'a> { pub(crate) cancel_requested: &'a std::sync::atomic::AtomicBool, } -impl kb_pipeline::BackfillObserver for crate::DemoBackfillObserver<'_> { - fn on_progress(&self, event: &kb_pipeline::BackfillProgressEvent) { +impl ks_pipeline::BackfillObserver for crate::DemoBackfillObserver<'_> { + fn on_progress(&self, event: &ks_pipeline::BackfillProgressEvent) { let payload = crate::DemoBackfillProgressPayload { timestamp: event.timestamp.clone(), level: event.level.code().to_string(), @@ -244,7 +244,7 @@ pub(crate) fn demo_backfill_options( } else { roles.first().map(|item| return item.role.clone()) }; - let programs = kb_program_ids::registered_program_ids() + let programs = ks_program_ids::registered_program_ids() .iter() .map(|entry| { return crate::DemoBackfillProgramOption { @@ -289,7 +289,7 @@ pub(crate) async fn demo_backfill_execute( std::result::Result::Err(error) => return std::result::Result::Err(error), }; let profile = state.active_profile(); - let store_options = match kb_store::PostgresStoreOptions::new( + let store_options = match ks_store::PostgresStoreOptions::new( profile.database.postgres.url.clone(), profile.database.postgres.max_connections, profile.database.postgres.connect_timeout_ms, @@ -298,7 +298,7 @@ pub(crate) async fn demo_backfill_execute( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; - let store = match kb_store::PostgresStore::connect(store_options).await { + let store = match ks_store::PostgresStore::connect(store_options).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; @@ -309,7 +309,7 @@ pub(crate) async fn demo_backfill_execute( app_handle, cancel_requested: state.demo_backfill_cancel_requested(), }; - let summary = match kb_pipeline::execute_http_backfill( + let summary = match ks_pipeline::execute_http_backfill( state.http_pool(), &store, &pipeline_request, @@ -324,7 +324,7 @@ pub(crate) async fn demo_backfill_execute( } fn build_role_options( - snapshots: std::vec::Vec, + snapshots: std::vec::Vec, ) -> std::vec::Vec { let mut role_methods = std::collections::BTreeMap::< std::string::String, @@ -364,25 +364,25 @@ fn build_role_options( fn build_pipeline_request( request: DemoBackfillRequest, -) -> std::result::Result { +) -> std::result::Result { let source_result = match request.mode.trim() { "explicit_signatures" => explicit_source(request.signatures_text.as_deref()), "program" => address_source( - kb_pipeline::BackfillAddressKind::Program, + ks_pipeline::BackfillAddressKind::Program, request.address.as_deref(), request.anchor_signature.as_deref(), request.direction.as_deref(), request.limit, ), "token" => address_source( - kb_pipeline::BackfillAddressKind::Token, + ks_pipeline::BackfillAddressKind::Token, request.address.as_deref(), request.anchor_signature.as_deref(), request.direction.as_deref(), request.limit, ), "pool" => address_source( - kb_pipeline::BackfillAddressKind::Pool, + ks_pipeline::BackfillAddressKind::Pool, request.address.as_deref(), request.anchor_signature.as_deref(), request.direction.as_deref(), @@ -394,7 +394,7 @@ fn build_pipeline_request( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let pipeline_request = kb_pipeline::BackfillRequest { + let pipeline_request = ks_pipeline::BackfillRequest { role: request.role, commitment: request.commitment, source, @@ -412,7 +412,7 @@ fn build_pipeline_request( fn explicit_source( signatures_text: std::option::Option<&str>, -) -> std::result::Result { +) -> std::result::Result { let text = match signatures_text { std::option::Option::Some(value) => value, std::option::Option::None => "", @@ -428,16 +428,16 @@ fn explicit_source( "the signatures textarea must contain at least one signature".to_string(), ); } - return std::result::Result::Ok(kb_pipeline::BackfillSource::ExplicitSignatures(signatures)); + return std::result::Result::Ok(ks_pipeline::BackfillSource::ExplicitSignatures(signatures)); } fn address_source( - kind: kb_pipeline::BackfillAddressKind, + kind: ks_pipeline::BackfillAddressKind, address: std::option::Option<&str>, anchor_signature: std::option::Option<&str>, direction: std::option::Option<&str>, limit: u32, -) -> std::result::Result { +) -> std::result::Result { let address_text = match address { std::option::Option::Some(value) => value, std::option::Option::None => "", @@ -451,8 +451,8 @@ fn address_source( std::option::Option::None => "", }; let direction_value = match direction_text.trim() { - "before" => kb_pipeline::BackfillDirection::Before, - "after" => kb_pipeline::BackfillDirection::After, + "before" => ks_pipeline::BackfillDirection::Before, + "after" => ks_pipeline::BackfillDirection::After, _ => { return std::result::Result::Err("direction must be before or after".to_string()); }, @@ -461,7 +461,7 @@ fn address_source( .map(str::trim) .filter(|value| return !value.is_empty()) .map(str::to_string); - if direction_value == kb_pipeline::BackfillDirection::After && anchor_value.is_none() { + if direction_value == ks_pipeline::BackfillDirection::After && anchor_value.is_none() { return std::result::Result::Err( "anchor signature is required for newer-history backfill".to_string(), ); @@ -472,7 +472,7 @@ fn address_source( return std::result::Result::Err(format!("signature limit conversion failed: {error}")); }, }; - return std::result::Result::Ok(kb_pipeline::BackfillSource::AddressHistory { + return std::result::Result::Ok(ks_pipeline::BackfillSource::AddressHistory { kind, address: address_value.to_string(), anchor_signature: anchor_value, @@ -481,7 +481,7 @@ fn address_source( }); } -fn summary_payload(summary: kb_pipeline::BackfillSummary) -> DemoBackfillSummaryPayload { +fn summary_payload(summary: ks_pipeline::BackfillSummary) -> DemoBackfillSummaryPayload { return crate::DemoBackfillSummaryPayload { capture_session_id: summary.capture_session_id, filter_code: summary.filter_code, @@ -520,7 +520,7 @@ mod tests { }; assert_eq!( source, - kb_pipeline::BackfillSource::ExplicitSignatures(std::vec![ + ks_pipeline::BackfillSource::ExplicitSignatures(std::vec![ "first".to_string(), "second".to_string(), ]) @@ -530,7 +530,7 @@ mod tests { #[test] fn older_history_accepts_missing_anchor_and_uses_latest_filter() { let source_result = super::address_source( - kb_pipeline::BackfillAddressKind::Program, + ks_pipeline::BackfillAddressKind::Program, std::option::Option::Some("11111111111111111111111111111111"), std::option::Option::Some(" "), std::option::Option::Some("before"), @@ -540,7 +540,7 @@ mod tests { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("source failed: {error}"), }; - let request = kb_pipeline::BackfillRequest { + let request = ks_pipeline::BackfillRequest { role: "history_backfill".to_string(), commitment: "confirmed".to_string(), source, @@ -556,7 +556,7 @@ mod tests { #[test] fn newer_history_rejects_missing_anchor() { let source_result = super::address_source( - kb_pipeline::BackfillAddressKind::Program, + ks_pipeline::BackfillAddressKind::Program, std::option::Option::Some("11111111111111111111111111111111"), std::option::Option::None, std::option::Option::Some("after"), diff --git a/kb-app-demo-desktop/src/demo_config.rs b/kb-app-demo-desktop/src/demo_config.rs index d3c2265..e28b6ee 100644 --- a/kb-app-demo-desktop/src/demo_config.rs +++ b/kb-app-demo-desktop/src/demo_config.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/demo_config.rs -// version: 2 +// version: 3 //! Configuration demo payload and state projection. @@ -19,9 +19,9 @@ pub(crate) struct DemoConfigPayload { /// Active profile environment. pub(crate) environment: std::string::String, /// Entire parsed configuration. - pub(crate) app_config: kb_config::AppConfig, + pub(crate) app_config: ks_config::AppConfig, /// Active profile configuration. - pub(crate) active_profile: kb_config::ProfileConfig, + pub(crate) active_profile: ks_config::ProfileConfig, /// Embedded JSON Schema text used during loading. pub(crate) schema_json: std::string::String, } @@ -34,7 +34,7 @@ pub(crate) fn demo_config_payload(state: &crate::AppState) -> crate::DemoConfigP environment: state.active_profile().app.environment.clone(), app_config: state.app_config().clone(), active_profile: state.active_profile().clone(), - schema_json: kb_config::config_json_schema_text().to_owned(), + schema_json: ks_config::config_json_schema_text().to_owned(), }; } diff --git a/kb-app-demo-desktop/src/demo_core_extraction.rs b/kb-app-demo-desktop/src/demo_core_extraction.rs index 991abd9..6933d12 100644 --- a/kb-app-demo-desktop/src/demo_core_extraction.rs +++ b/kb-app-demo-desktop/src/demo_core_extraction.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/demo_core_extraction.rs -// version: 13 +// version: 14 //! Tauri commands and UI payloads for canonical transaction to core extraction. @@ -137,8 +137,8 @@ pub(crate) struct DemoCoreExtractionObserver<'a> { pub(crate) cancel_requested: &'a std::sync::atomic::AtomicBool, } -impl kb_pipeline::CoreExtractionObserver for crate::DemoCoreExtractionObserver<'_> { - fn on_progress(&self, event: &kb_pipeline::CoreExtractionProgressEvent) { +impl ks_pipeline::CoreExtractionObserver for crate::DemoCoreExtractionObserver<'_> { + fn on_progress(&self, event: &ks_pipeline::CoreExtractionProgressEvent) { let payload = crate::DemoCoreExtractionProgressPayload { timestamp: event.timestamp.clone(), level: event.level.code().to_string(), @@ -178,11 +178,11 @@ pub(crate) fn demo_core_extraction_options_payload( state: &crate::AppState, ) -> crate::DemoCoreExtractionOptionsPayload { return crate::DemoCoreExtractionOptionsPayload { - processor_version: kb_pipeline::CORE_EXTRACTION_PROCESSOR_VERSION.to_string(), + processor_version: ks_pipeline::CORE_EXTRACTION_PROCESSOR_VERSION.to_string(), default_limit: 100, default_max_concurrent_extractions: 4, running: state.demo_core_extraction_running().load(std::sync::atomic::Ordering::Acquire), - programs: kb_program_ids::registered_program_ids() + programs: ks_program_ids::registered_program_ids() .iter() .map(|entry| { return crate::DemoCoreExtractionProgramOption { @@ -231,7 +231,7 @@ pub(crate) async fn demo_core_extraction_execute( cancel_requested: state.demo_core_extraction_cancel_requested(), }; let summary_result = - kb_pipeline::execute_core_extraction(&store, &pipeline_request, &observer).await; + ks_pipeline::execute_core_extraction(&store, &pipeline_request, &observer).await; let summary = match summary_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), @@ -249,13 +249,13 @@ pub(crate) fn demo_core_extraction_cancel(state: &crate::AppState) -> bool { fn build_pipeline_request( request: crate::DemoCoreExtractionRequest, -) -> std::result::Result { +) -> std::result::Result { let source_result = match request.mode.trim() { "signatures" => { let signatures = split_signatures(request.signatures_text.as_deref()); - std::result::Result::Ok(kb_pipeline::CoreExtractionSource::Signatures(signatures)) + std::result::Result::Ok(ks_pipeline::CoreExtractionSource::Signatures(signatures)) }, - "pending" => std::result::Result::Ok(kb_pipeline::CoreExtractionSource::Pending), + "pending" => std::result::Result::Ok(ks_pipeline::CoreExtractionSource::Pending), "program_id" => { let program_id = match request.program_id { std::option::Option::Some(value) if !value.trim().is_empty() => value, @@ -265,7 +265,7 @@ fn build_pipeline_request( ); }, }; - std::result::Result::Ok(kb_pipeline::CoreExtractionSource::ProgramId { program_id }) + std::result::Result::Ok(ks_pipeline::CoreExtractionSource::ProgramId { program_id }) }, "slot_range" => { let min_slot = match request.min_slot { @@ -284,7 +284,7 @@ fn build_pipeline_request( ); }, }; - std::result::Result::Ok(kb_pipeline::CoreExtractionSource::SlotRange { + std::result::Result::Ok(ks_pipeline::CoreExtractionSource::SlotRange { min_slot, max_slot, }) @@ -295,7 +295,7 @@ fn build_pipeline_request( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let pipeline_request = kb_pipeline::CoreExtractionRequest { + let pipeline_request = ks_pipeline::CoreExtractionRequest { source, limit: request.limit, max_concurrent_extractions: request.max_concurrent_extractions, @@ -309,7 +309,7 @@ fn build_pipeline_request( } fn summary_payload( - summary: kb_pipeline::CoreExtractionSummary, + summary: ks_pipeline::CoreExtractionSummary, ) -> crate::DemoCoreExtractionSummaryPayload { return crate::DemoCoreExtractionSummaryPayload { processor_version: summary.processor_version, diff --git a/kb-app-demo-desktop/src/demo_decode_replay.rs b/kb-app-demo-desktop/src/demo_decode_replay.rs index 29a0728..8708ff2 100644 --- a/kb-app-demo-desktop/src/demo_decode_replay.rs +++ b/kb-app-demo-desktop/src/demo_decode_replay.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/demo_decode_replay.rs -// version: 39 +// version: 40 //! Tauri commands and UI payloads for contextual instruction decode replay. @@ -319,8 +319,8 @@ pub(crate) struct DemoDecodeReplayObserver<'a> { pub(crate) cancel_requested: &'a std::sync::atomic::AtomicBool, } -impl kb_pipeline::DecodeReplayObserver for crate::DemoDecodeReplayObserver<'_> { - fn on_progress(&self, event: &kb_pipeline::DecodeReplayProgressEvent) { +impl ks_pipeline::DecodeReplayObserver for crate::DemoDecodeReplayObserver<'_> { + fn on_progress(&self, event: &ks_pipeline::DecodeReplayProgressEvent) { let payload = crate::DemoDecodeReplayProgressPayload { campaign_id: self.campaign_id.clone(), timestamp: event.timestamp.clone(), @@ -385,7 +385,7 @@ pub(crate) fn demo_decode_replay_options( return format!("{}@{}", identity.name, identity.version); }) .collect::>(); - let programs = kb_program_ids::registered_program_ids() + let programs = ks_program_ids::registered_program_ids() .iter() .map(|entry| { return crate::DemoDecodeReplayProgramOption { @@ -398,7 +398,7 @@ pub(crate) fn demo_decode_replay_options( tracing::debug!( target: crate::TRACING_TARGET, action = "load_options", - pipeline_version = kb_pipeline::DECODE_PIPELINE_VERSION, + pipeline_version = ks_pipeline::DECODE_PIPELINE_VERSION, decoder_count = decoder_options.len(), materializer_names = ?materializer_names, default_limit = 100_u32, @@ -407,7 +407,7 @@ pub(crate) fn demo_decode_replay_options( "return contextual decode replay options" ); return crate::DemoDecodeReplayOptionsPayload { - pipeline_version: kb_pipeline::DECODE_PIPELINE_VERSION.to_string(), + pipeline_version: ks_pipeline::DECODE_PIPELINE_VERSION.to_string(), decoders: decoder_options, materializer_names, programs, @@ -423,7 +423,7 @@ pub(crate) async fn demo_decode_replay_execute( state: tauri::State<'_, crate::AppState>, request: crate::DemoDecodeReplayRequest, ) -> std::result::Result { - let campaign_id = kb_pipeline::new_decode_campaign_id(); + let campaign_id = ks_pipeline::new_decode_campaign_id(); tracing::debug!( target: crate::TRACING_TARGET, action = "execute", @@ -510,7 +510,7 @@ pub(crate) async fn demo_decode_replay_execute( campaign_id: pipeline_request.campaign_id.clone(), cancel_requested: state.demo_decode_replay_cancel_requested(), }; - let summary_result = kb_pipeline::execute_decode_replay( + let summary_result = ks_pipeline::execute_decode_replay( &store, &pipeline_request, decoders.as_slice(), @@ -582,7 +582,7 @@ pub(crate) async fn demo_decode_replay_diagnostics( }) .map(crate::table_snapshot_from_pg) .collect(); - let coverage_result = kb_store::DecodePipelineStore::list_decode_coverage_summary( + let coverage_result = ks_store::DecodePipelineStore::list_decode_coverage_summary( &store, std::option::Option::None, std::option::Option::None, @@ -605,7 +605,7 @@ pub(crate) async fn demo_decode_replay_annotations( state: tauri::State<'_, crate::AppState>, request: crate::DemoTransactionAnnotationRequest, ) -> std::result::Result, std::string::String> { - let filter_result = kb_store::MaterializedEventFilter::new( + let filter_result = ks_store::MaterializedEventFilter::new( std::option::Option::Some("materializer.transaction.annotations".to_string()), std::option::Option::Some("transaction_annotation".to_string()), request.signature_contains, @@ -622,7 +622,7 @@ pub(crate) async fn demo_decode_replay_annotations( std::result::Result::Err(error) => return std::result::Result::Err(error), }; let rows_result = - kb_store::DecodePipelineStore::list_materialized_events(&store, &filter).await; + ks_store::DecodePipelineStore::list_materialized_events(&store, &filter).await; let rows = match rows_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), @@ -656,39 +656,39 @@ fn register_active_campaign( return std::result::Result::Ok(()); } -fn available_materializers() -> std::vec::Vec> { +fn available_materializers() -> std::vec::Vec> { return std::vec![ - std::sync::Arc::new(kb_lib::MtAdminMaterializer), - std::sync::Arc::new(kb_lib::MtComplianceAuditMaterializer), - std::sync::Arc::new(kb_lib::MtFeesMaterializer), - std::sync::Arc::new(kb_lib::MtLifecycleMaterializer), - std::sync::Arc::new(kb_lib::MtMetadataMetaplexTokenMetadataMaterializer), - std::sync::Arc::new(kb_lib::MtMetadataSolanaProgramMaterializer), - std::sync::Arc::new(kb_lib::MtMetadataToken2022Materializer), - std::sync::Arc::new(kb_lib::MtStakingMaterializer), - std::sync::Arc::new(kb_lib::MtTokenAccountsMaterializer), - std::sync::Arc::new(kb_lib::MtRiskMaterializer), - std::sync::Arc::new(kb_lib::MtTransactionAnnotationMaterializer), + std::sync::Arc::new(ks_lib::MtAdminMaterializer), + std::sync::Arc::new(ks_lib::MtComplianceAuditMaterializer), + std::sync::Arc::new(ks_lib::MtFeesMaterializer), + std::sync::Arc::new(ks_lib::MtLifecycleMaterializer), + std::sync::Arc::new(ks_lib::MtMetadataMetaplexTokenMetadataMaterializer), + std::sync::Arc::new(ks_lib::MtMetadataSolanaProgramMaterializer), + std::sync::Arc::new(ks_lib::MtMetadataToken2022Materializer), + std::sync::Arc::new(ks_lib::MtStakingMaterializer), + std::sync::Arc::new(ks_lib::MtTokenAccountsMaterializer), + std::sync::Arc::new(ks_lib::MtRiskMaterializer), + std::sync::Arc::new(ks_lib::MtTransactionAnnotationMaterializer), ]; } -fn available_decoders() -> std::vec::Vec> { +fn available_decoders() -> std::vec::Vec> { return std::vec![ - std::sync::Arc::new(kb_lib::DcSolanaCoreDecoder), - std::sync::Arc::new(kb_lib::DcMetadataMetaplexTokenMetadataDecoder), - std::sync::Arc::new(kb_lib::DcMetadataSolanaProgramMetadataDecoder), - std::sync::Arc::new(kb_lib::DcSplAssociatedTokenAccountDecoder), - std::sync::Arc::new(kb_lib::DcSplElgamalRegistryDecoder), - std::sync::Arc::new(kb_lib::DcSplMemoDecoder), - std::sync::Arc::new(kb_lib::DcSplTokenDecoder), - std::sync::Arc::new(kb_lib::DcSplToken2022Decoder), + std::sync::Arc::new(ks_lib::DcSolanaCoreDecoder), + std::sync::Arc::new(ks_lib::DcMetadataMetaplexTokenMetadataDecoder), + std::sync::Arc::new(ks_lib::DcMetadataSolanaProgramMetadataDecoder), + std::sync::Arc::new(ks_lib::DcSplAssociatedTokenAccountDecoder), + std::sync::Arc::new(ks_lib::DcSplElgamalRegistryDecoder), + std::sync::Arc::new(ks_lib::DcSplMemoDecoder), + std::sync::Arc::new(ks_lib::DcSplTokenDecoder), + std::sync::Arc::new(ks_lib::DcSplToken2022Decoder), ]; } fn build_pipeline_request( request: crate::DemoDecodeReplayRequest, campaign_id: std::string::String, -) -> std::result::Result { +) -> std::result::Result { let states_result = processing_states(request.instruction_state.as_str()); let states = match states_result { std::result::Result::Ok(value) => value, @@ -703,7 +703,7 @@ fn build_pipeline_request( }, _ => std::vec::Vec::new(), }; - let selection_result = kb_store::DecodeSelectionFilter::new( + let selection_result = ks_store::DecodeSelectionFilter::new( signatures, states, std::option::Option::None, @@ -718,11 +718,11 @@ fn build_pipeline_request( std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; let dispatch_policy = if request.all_compatible { - kb_pipeline::DecodeDispatchPolicy::AllCompatible + ks_pipeline::DecodeDispatchPolicy::AllCompatible } else { - kb_pipeline::DecodeDispatchPolicy::HighestPriority + ks_pipeline::DecodeDispatchPolicy::HighestPriority }; - let pipeline_request = kb_pipeline::DecodeReplayRequest { + let pipeline_request = ks_pipeline::DecodeReplayRequest { campaign_id, selection, decoder_names: request.decoder_names, @@ -773,31 +773,31 @@ fn text_sample(values: &[std::string::String], limit: usize) -> std::vec::Vec<&s fn processing_states( value: &str, -) -> std::result::Result, std::string::String> +) -> std::result::Result, std::string::String> { return match value.trim() { "incomplete_signatures" | "actionable" => std::result::Result::Ok(std::vec![ - kb_store::CoreInstructionProcessingState::Pending, - kb_store::CoreInstructionProcessingState::Failed, - kb_store::CoreInstructionProcessingState::ReplayRequested, + ks_store::CoreInstructionProcessingState::Pending, + ks_store::CoreInstructionProcessingState::Failed, + ks_store::CoreInstructionProcessingState::ReplayRequested, ]), "pending" => { - std::result::Result::Ok(std::vec![kb_store::CoreInstructionProcessingState::Pending]) + std::result::Result::Ok(std::vec![ks_store::CoreInstructionProcessingState::Pending]) }, "failed" => { - std::result::Result::Ok(std::vec![kb_store::CoreInstructionProcessingState::Failed]) + std::result::Result::Ok(std::vec![ks_store::CoreInstructionProcessingState::Failed]) }, "replay_requested" => std::result::Result::Ok(std::vec![ - kb_store::CoreInstructionProcessingState::ReplayRequested + ks_store::CoreInstructionProcessingState::ReplayRequested ]), "decoded" => { - std::result::Result::Ok(std::vec![kb_store::CoreInstructionProcessingState::Decoded]) + std::result::Result::Ok(std::vec![ks_store::CoreInstructionProcessingState::Decoded]) }, "ignored" => { - std::result::Result::Ok(std::vec![kb_store::CoreInstructionProcessingState::Ignored]) + std::result::Result::Ok(std::vec![ks_store::CoreInstructionProcessingState::Ignored]) }, "materialized" => std::result::Result::Ok(std::vec![ - kb_store::CoreInstructionProcessingState::Materialized + ks_store::CoreInstructionProcessingState::Materialized ]), _ => std::result::Result::Err("unsupported instruction processing state".to_string()), }; @@ -823,7 +823,7 @@ fn split_lines(text: std::option::Option<&str>) -> std::vec::Vec crate::DemoDecodeReplaySummaryPayload { return crate::DemoDecodeReplaySummaryPayload { campaign_id: summary.campaign_id, @@ -861,7 +861,7 @@ fn summary_payload( } fn coverage_payload( - value: kb_store::DecodeCoverageSummaryRow, + value: ks_store::DecodeCoverageSummaryRow, ) -> crate::DemoDecodeCoverageSummaryPayload { return crate::DemoDecodeCoverageSummaryPayload { processor_name: value.processor_name, @@ -882,7 +882,7 @@ fn coverage_payload( } fn annotation_payload( - row: kb_store::MaterializedEventQueryRow, + row: ks_store::MaterializedEventQueryRow, ) -> std::result::Result { if row.processor_name != "materializer.transaction.annotations" || row.materialized_family != "transaction_annotation" @@ -994,31 +994,31 @@ fn required_annotation_text( #[cfg(test)] mod tests { - fn ata_observation(entry: &str) -> kb_lib::DcApiDecodedObservation { - return kb_lib::DcApiDecodedObservation { + fn ata_observation(entry: &str) -> ks_lib::DcApiDecodedObservation { + return ks_lib::DcApiDecodedObservation { event_key: format!("ata:{entry}:0"), - event: kb_lib::MdDecodedProtocolEvent { - signature: kb_lib::MdSignature("signature".to_string()), - slot: kb_lib::MdSlot(1), - instruction_path: kb_lib::MdInstructionPath("0".to_string()), - program_id: kb_lib::MdProgramId( - kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string(), + event: ks_lib::MdDecodedProtocolEvent { + signature: ks_lib::MdSignature("signature".to_string()), + slot: ks_lib::MdSlot(1), + instruction_path: ks_lib::MdInstructionPath("0".to_string()), + program_id: ks_lib::MdProgramId( + ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string(), ), - protocol_code: kb_lib::MdProtocolCode("spl.associated_token_account".to_string()), - surface_code: kb_lib::MdSurfaceCode("spl.associated_token_account".to_string()), - event_code: kb_lib::MdEventCode(format!("spl.associated_token_account.{entry}")), - event_name: kb_lib::MdEventName(entry.to_string()), - event_family: kb_lib::MdEventFamily::Lifecycle, - source_kind: kb_lib::MdEventSourceKind::Instruction, - confidence: kb_lib::MdDecoderConfidence::ManualExact, + protocol_code: ks_lib::MdProtocolCode("spl.associated_token_account".to_string()), + surface_code: ks_lib::MdSurfaceCode("spl.associated_token_account".to_string()), + event_code: ks_lib::MdEventCode(format!("spl.associated_token_account.{entry}")), + event_name: ks_lib::MdEventName(entry.to_string()), + event_family: ks_lib::MdEventFamily::Lifecycle, + source_kind: ks_lib::MdEventSourceKind::Instruction, + confidence: ks_lib::MdDecoderConfidence::ManualExact, }, payload_json: serde_json::json!({}), transaction_failed: false, transaction_error: std::option::Option::None, observation_committed: true, - proof: kb_lib::DcApiDecoderProof { - kind: kb_lib::DcApiDecoderProofKind::Manual, - confidence: kb_lib::MdDecoderConfidence::ManualExact, + proof: ks_lib::DcApiDecoderProof { + kind: ks_lib::DcApiDecoderProofKind::Manual, + confidence: ks_lib::MdDecoderConfidence::ManualExact, evidence: std::vec!["fixture".to_string()], }, }; @@ -1028,21 +1028,21 @@ mod tests { program_id: &str, surface: &str, entry: &str, - ) -> kb_lib::DcApiDecodedObservation { - return kb_lib::DcApiDecodedObservation { + ) -> ks_lib::DcApiDecodedObservation { + return ks_lib::DcApiDecodedObservation { event_key: format!("{surface}:{entry}:0"), - event: kb_lib::MdDecodedProtocolEvent { - signature: kb_lib::MdSignature("signature".to_string()), - slot: kb_lib::MdSlot(1), - instruction_path: kb_lib::MdInstructionPath("0".to_string()), - program_id: kb_lib::MdProgramId(program_id.to_string()), - protocol_code: kb_lib::MdProtocolCode(surface.to_string()), - surface_code: kb_lib::MdSurfaceCode(surface.to_string()), - event_code: kb_lib::MdEventCode(format!("{surface}.{entry}")), - event_name: kb_lib::MdEventName(entry.to_string()), - event_family: kb_lib::MdEventFamily::Metadata, - source_kind: kb_lib::MdEventSourceKind::Instruction, - confidence: kb_lib::MdDecoderConfidence::ManualExact, + event: ks_lib::MdDecodedProtocolEvent { + signature: ks_lib::MdSignature("signature".to_string()), + slot: ks_lib::MdSlot(1), + instruction_path: ks_lib::MdInstructionPath("0".to_string()), + program_id: ks_lib::MdProgramId(program_id.to_string()), + protocol_code: ks_lib::MdProtocolCode(surface.to_string()), + surface_code: ks_lib::MdSurfaceCode(surface.to_string()), + event_code: ks_lib::MdEventCode(format!("{surface}.{entry}")), + event_name: ks_lib::MdEventName(entry.to_string()), + event_family: ks_lib::MdEventFamily::Metadata, + source_kind: ks_lib::MdEventSourceKind::Instruction, + confidence: ks_lib::MdDecoderConfidence::ManualExact, }, payload_json: serde_json::json!({ "programId": program_id, @@ -1053,9 +1053,9 @@ mod tests { transaction_failed: false, transaction_error: std::option::Option::None, observation_committed: true, - proof: kb_lib::DcApiDecoderProof { - kind: kb_lib::DcApiDecoderProofKind::Manual, - confidence: kb_lib::MdDecoderConfidence::ManualExact, + proof: ks_lib::DcApiDecoderProof { + kind: ks_lib::DcApiDecoderProofKind::Manual, + confidence: ks_lib::MdDecoderConfidence::ManualExact, evidence: std::vec!["fixture".to_string()], }, }; @@ -1114,19 +1114,19 @@ mod tests { fn metadata_materializer_ownership_is_exact_in_the_runtime_registry() { for (program_id, surface, entry, expected) in [ ( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, "metadata.metaplex_token_metadata", "create_metadata_account_v3", "materializer.metadata.metaplex_token_metadata", ), ( - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, "metadata.solana_program_metadata", "initialize", "materializer.metadata.solana_program_metadata", ), ( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, "spl.token_2022", "initialize_token_metadata", "materializer.metadata.token_2022", @@ -1274,7 +1274,7 @@ mod tests { #[test] fn committed_annotation_row_is_mapped_to_ui_safe_contract() { - let row = kb_store::MaterializedEventQueryRow { + let row = ks_store::MaterializedEventQueryRow { processor_name: "materializer.transaction.annotations".to_string(), processor_version: "0.4.3".to_string(), input_key: "input".to_string(), @@ -1288,7 +1288,7 @@ mod tests { payload_json: serde_json::json!({ "instructionPath": "1/0", "generation": "v4", - "programId": kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + "programId": ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, "text": "annotation", "payloadLengthBytes": 10, "payloadSha256": "11", @@ -1310,7 +1310,7 @@ mod tests { #[test] fn malformed_annotation_payload_fails_closed() { - let row = kb_store::MaterializedEventQueryRow { + let row = ks_store::MaterializedEventQueryRow { processor_name: "materializer.transaction.annotations".to_string(), processor_version: "0.4.3".to_string(), input_key: "input".to_string(), diff --git a/kb-app-demo-desktop/src/demo_devnet_common.rs b/kb-app-demo-desktop/src/demo_devnet_common.rs index 49c07f0..34ba866 100644 --- a/kb-app-demo-desktop/src/demo_devnet_common.rs +++ b/kb-app-demo-desktop/src/demo_devnet_common.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/demo_devnet_common.rs -// version: 3 +// version: 4 //! Shared Devnet demo UI contracts. @@ -29,7 +29,7 @@ pub(crate) struct DemoExecutionDevnetStoreReadinessPayload { /// Converts the reusable scenario readiness report to the desktop TS-RS payload. pub(crate) fn devnet_store_readiness_payload( - readiness: kb_pipeline_demo_scenarios::DevnetProfileStoreReadiness, + readiness: ks_pipeline_demo_scenarios::DevnetProfileStoreReadiness, ) -> DemoExecutionDevnetStoreReadinessPayload { return DemoExecutionDevnetStoreReadinessPayload { profile_name: readiness.profile_name, diff --git a/kb-app-demo-desktop/src/demo_execution_metadata.rs b/kb-app-demo-desktop/src/demo_execution_metadata.rs index 94e25f7..eb8834a 100644 --- a/kb-app-demo-desktop/src/demo_execution_metadata.rs +++ b/kb-app-demo-desktop/src/demo_execution_metadata.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/demo_execution_metadata.rs -// version: 15 +// version: 16 //! Shared desktop contracts for metadata execution demos. @@ -69,8 +69,8 @@ impl crate::DemoExecutionMetadataObserver<'_> { } } -impl kb_pipeline::BackfillObserver for crate::DemoExecutionMetadataObserver<'_> { - fn on_progress(&self, event: &kb_pipeline::BackfillProgressEvent) { +impl ks_pipeline::BackfillObserver for crate::DemoExecutionMetadataObserver<'_> { + fn on_progress(&self, event: &ks_pipeline::BackfillProgressEvent) { self.emit( event.timestamp.clone(), event.level.code(), @@ -85,8 +85,8 @@ impl kb_pipeline::BackfillObserver for crate::DemoExecutionMetadataObserver<'_> } } -impl kb_pipeline::CoreExtractionObserver for crate::DemoExecutionMetadataObserver<'_> { - fn on_progress(&self, event: &kb_pipeline::CoreExtractionProgressEvent) { +impl ks_pipeline::CoreExtractionObserver for crate::DemoExecutionMetadataObserver<'_> { + fn on_progress(&self, event: &ks_pipeline::CoreExtractionProgressEvent) { self.emit( event.timestamp.clone(), event.level.code(), @@ -101,8 +101,8 @@ impl kb_pipeline::CoreExtractionObserver for crate::DemoExecutionMetadataObserve } } -impl kb_pipeline::DecodeReplayObserver for crate::DemoExecutionMetadataObserver<'_> { - fn on_progress(&self, event: &kb_pipeline::DecodeReplayProgressEvent) { +impl ks_pipeline::DecodeReplayObserver for crate::DemoExecutionMetadataObserver<'_> { + fn on_progress(&self, event: &ks_pipeline::DecodeReplayProgressEvent) { self.emit( event.timestamp.clone(), event.level.code(), @@ -117,12 +117,12 @@ impl kb_pipeline::DecodeReplayObserver for crate::DemoExecutionMetadataObserver< } } -impl kb_pipeline_demo_scenarios::SolanaExecutionObserver +impl ks_pipeline_demo_scenarios::SolanaExecutionObserver for crate::DemoExecutionMetadataObserver<'_> { fn on_execution_progress( &self, - event: &kb_pipeline_demo_scenarios::SolanaExecutionProgressEvent, + event: &ks_pipeline_demo_scenarios::SolanaExecutionProgressEvent, ) { self.emit( event.timestamp.clone(), diff --git a/kb-app-demo-desktop/src/demo_execution_metadata_metaplex_token_metadata.rs b/kb-app-demo-desktop/src/demo_execution_metadata_metaplex_token_metadata.rs index 48f4d00..3a0092e 100644 --- a/kb-app-demo-desktop/src/demo_execution_metadata_metaplex_token_metadata.rs +++ b/kb-app-demo-desktop/src/demo_execution_metadata_metaplex_token_metadata.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/demo_execution_metadata_metaplex_token_metadata.rs -// version: 6 +// version: 7 //! Desktop adapters for generic and qualified Metaplex Token Metadata execution workflows. @@ -186,7 +186,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_execute( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; @@ -197,7 +197,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_execute( if let std::result::Result::Err(error) = store.initialize_store_schema().await { return std::result::Result::Err(error.to_string()); } - let mut execution_request = match kb_pipeline_demo_scenarios::DevnetMetaplexTokenMetadataExecutionRequest::from_operation_json( + let mut execution_request = match ks_pipeline_demo_scenarios::DevnetMetaplexTokenMetadataExecutionRequest::from_operation_json( request.intent_id, request.operation_json.as_str(), ) { @@ -222,21 +222,21 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_execute( if let std::result::Result::Err(error) = execution_request.validate() { return std::result::Result::Err(error.to_string()); } - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcMetadataMetaplexTokenMetadataDecoder)]; - let materializers: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::MtAdminMaterializer), - std::sync::Arc::new(kb_lib::MtComplianceAuditMaterializer), - std::sync::Arc::new(kb_lib::MtLifecycleMaterializer), - std::sync::Arc::new(kb_lib::MtMetadataMetaplexTokenMetadataMaterializer), - std::sync::Arc::new(kb_lib::MtRiskMaterializer), + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcMetadataMetaplexTokenMetadataDecoder)]; + let materializers: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::MtAdminMaterializer), + std::sync::Arc::new(ks_lib::MtComplianceAuditMaterializer), + std::sync::Arc::new(ks_lib::MtLifecycleMaterializer), + std::sync::Arc::new(ks_lib::MtMetadataMetaplexTokenMetadataMaterializer), + std::sync::Arc::new(ks_lib::MtRiskMaterializer), ]; let observer = crate::DemoExecutionMetadataObserver { app_handle, cancel_requested: state.demo_execution_solana_core_cancel_requested(), }; let workspace_root = crate::workspace_root_dir(); - let summary = match kb_pipeline_demo_scenarios::execute_devnet_metaplex_token_metadata( + let summary = match ks_pipeline_demo_scenarios::execute_devnet_metaplex_token_metadata( &http_pool, &store, &profile, @@ -290,7 +290,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_execute( ); } -fn backfill_summary_json(summary: &kb_pipeline::BackfillSummary) -> serde_json::Value { +fn backfill_summary_json(summary: &ks_pipeline::BackfillSummary) -> serde_json::Value { return serde_json::json!({ "captureSessionId": summary.capture_session_id, "filterCode": summary.filter_code, @@ -318,7 +318,7 @@ fn backfill_summary_json(summary: &kb_pipeline::BackfillSummary) -> serde_json:: }); } -fn core_extraction_summary_json(summary: &kb_pipeline::CoreExtractionSummary) -> serde_json::Value { +fn core_extraction_summary_json(summary: &ks_pipeline::CoreExtractionSummary) -> serde_json::Value { return serde_json::json!({ "processorVersion": summary.processor_version, "selected": summary.selected, @@ -335,7 +335,7 @@ fn core_extraction_summary_json(summary: &kb_pipeline::CoreExtractionSummary) -> }); } -fn decode_replay_summary_json(summary: &kb_pipeline::DecodeReplaySummary) -> serde_json::Value { +fn decode_replay_summary_json(summary: &ks_pipeline::DecodeReplaySummary) -> serde_json::Value { let processors = summary .processors .iter() @@ -375,7 +375,7 @@ fn decode_replay_summary_json(summary: &kb_pipeline::DecodeReplaySummary) -> ser fn parse_stateful_reads( value: &str, ) -> std::result::Result< - std::vec::Vec, + std::vec::Vec, std::string::String, > { if value.trim().is_empty() { @@ -400,7 +400,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_prepare_crea return prepare_create_fixture_for_family( state, profile_name, - kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft, + ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft, ) .await; } @@ -408,7 +408,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_prepare_crea async fn prepare_create_fixture_for_family( state: tauri::State<'_, crate::AppState>, profile_name: std::string::String, - asset_family: kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily, + asset_family: ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily, ) -> std::result::Result< crate::DemoExecutionMetadataMetaplexTokenMetadataCreateFixturePayload, std::string::String, @@ -423,15 +423,15 @@ async fn prepare_create_fixture_for_family( } else { crate::workspace_root_dir().join(configured) }; - let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; let workspace_root = crate::workspace_root_dir(); let options = - kb_pipeline_demo_scenarios::MetaplexCreateFixturePreparationOptions::new(wallet_dir) + ks_pipeline_demo_scenarios::MetaplexCreateFixturePreparationOptions::new(wallet_dir) .with_asset_family(asset_family); - let summary = match kb_pipeline_demo_scenarios::prepare_metaplex_create_fixture( + let summary = match ks_pipeline_demo_scenarios::prepare_metaplex_create_fixture( &http_pool, &profile, workspace_root.as_path(), @@ -465,7 +465,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_prepare_step crate::DemoExecutionMetadataMetaplexTokenMetadataPreparedStepPayload, std::string::String, > { - let scenario = kb_pipeline_demo_scenarios::metaplex_token_metadata_devnet_scenarios() + let scenario = ks_pipeline_demo_scenarios::metaplex_token_metadata_devnet_scenarios() .into_iter() .find(|candidate| return candidate.id == scenario_id); let scenario = match scenario { @@ -566,7 +566,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_prepare_step std::option::Option::None => std::string::String::new(), }; let immutable_transition = scenario.asset_family - == kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft + == ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft && step_index == 2; let value = serde_json::json!({ "operation": "update_as_update_authority_v2", @@ -633,9 +633,9 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_prepare_step }; let create_reads_edition = matches!( scenario.asset_family, - kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft - | kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Collection - | kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::ProgrammableNft + ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft + | ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Collection + | ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::ProgrammableNft ); let postcondition_reads = if operation == "create" && create_reads_edition { serde_json::json!([metadata_read, edition_read]) @@ -648,7 +648,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_prepare_step step_index, operation: operation.clone(), label: if scenario.asset_family - == kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft + == ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft && step_index == 2 { "Étape 3 — rendre les metadata immutables".to_string() @@ -668,7 +668,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_token_metadata_prepare_step /// Returns current operation names accepted by automatic Devnet campaigns. pub(crate) fn demo_execution_metadata_metaplex_token_metadata_current_operations() -> std::vec::Vec { - return kb_pipeline_demo_scenarios::metaplex_token_metadata_current_operation_names() + return ks_pipeline_demo_scenarios::metaplex_token_metadata_current_operation_names() .iter() .map(|value| return (*value).to_string()) .collect(); @@ -678,7 +678,7 @@ pub(crate) fn demo_execution_metadata_metaplex_token_metadata_current_operations pub(crate) fn demo_execution_metadata_metaplex_token_metadata_operation_template( operation: std::string::String, ) -> std::result::Result { - return match kb_pipeline_demo_scenarios::metaplex_token_metadata_current_operation_json_template( + return match ks_pipeline_demo_scenarios::metaplex_token_metadata_current_operation_json_template( operation.as_str(), ) { std::result::Result::Ok(value) => std::result::Result::Ok(value), @@ -691,7 +691,7 @@ pub(crate) fn demo_execution_metadata_metaplex_token_metadata_scenarios() -> std std::vec::Vec, std::string::String, > { - let matrix = match kb_pipeline_demo_scenarios::load_metaplex_token_metadata_validation_matrix() + let matrix = match ks_pipeline_demo_scenarios::load_metaplex_token_metadata_validation_matrix() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), @@ -703,14 +703,14 @@ pub(crate) fn demo_execution_metadata_metaplex_token_metadata_scenarios() -> std .collect::, ), >>(); let mut payloads = std::vec::Vec::new(); - for scenario in kb_pipeline_demo_scenarios::metaplex_token_metadata_synthetic_scenarios() + for scenario in ks_pipeline_demo_scenarios::metaplex_token_metadata_synthetic_scenarios() .into_iter() - .chain(kb_pipeline_demo_scenarios::metaplex_token_metadata_devnet_scenarios()) + .chain(ks_pipeline_demo_scenarios::metaplex_token_metadata_devnet_scenarios()) { let status = statuses.get(scenario.id.as_str()); let validation_status = match status { @@ -742,74 +742,74 @@ pub(crate) fn demo_execution_metadata_metaplex_token_metadata_scenarios() -> std } fn asset_family_code( - value: kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily, + value: ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily, ) -> std::string::String { return match value { - kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft => "nft".to_string(), - kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Sft => "sft".to_string(), - kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Fungible => { + ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft => "nft".to_string(), + ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Sft => "sft".to_string(), + ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Fungible => { "fungible".to_string() }, - kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Collection => { + ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Collection => { "collection".to_string() }, - kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::ProgrammableNft => { + ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::ProgrammableNft => { "programmable_nft".to_string() }, }; } fn fixture_kind_code( - value: kb_pipeline_demo_scenarios::MetaplexTokenMetadataFixtureKind, + value: ks_pipeline_demo_scenarios::MetaplexTokenMetadataFixtureKind, ) -> std::string::String { return format!("{value:?}").to_lowercase(); } fn fixture_state_code( - value: kb_pipeline_demo_scenarios::MetaplexTokenMetadataFixtureState, + value: ks_pipeline_demo_scenarios::MetaplexTokenMetadataFixtureState, ) -> std::string::String { return format!("{value:?}").to_lowercase(); } fn scenario_mode_code( - value: kb_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode, + value: ks_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode, ) -> std::string::String { return match value { - kb_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode::Synthetic => { + ks_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode::Synthetic => { "synthetic".to_string() }, - kb_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode::NetworkSimulation => { + ks_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode::NetworkSimulation => { "network_simulation".to_string() }, - kb_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode::NetworkSubmission => { + ks_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode::NetworkSubmission => { "network_submission".to_string() }, }; } fn validation_status_code( - value: kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus, + value: ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus, ) -> std::string::String { return match value { - kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::NotRun => { + ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::NotRun => { "not_run".to_string() }, - kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::SyntheticValidated => { + ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::SyntheticValidated => { "synthetic_validated".to_string() }, - kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Simulated => { + ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Simulated => { "simulated".to_string() }, - kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Submitted => { + ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Submitted => { "submitted".to_string() }, - kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Confirmed => { + ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Confirmed => { "confirmed".to_string() }, - kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Unavailable => { + ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Unavailable => { "unavailable".to_string() }, - kb_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Failed => { + ks_pipeline_demo_scenarios::MetaplexTokenMetadataValidationStatus::Failed => { "failed".to_string() }, }; @@ -895,7 +895,7 @@ struct CampaignProjection { type CampaignProjectionFuture<'a> = std::pin::Pin< std::boxed::Box< - dyn std::future::Future> + dyn std::future::Future> + std::marker::Send + 'a, >, @@ -917,7 +917,7 @@ pub(crate) fn demo_execution_metadata_metaplex_campaigns() label: label.to_string(), asset_family: family.to_string(), operation_names: - kb_pipeline_demo_scenarios::metaplex_create_mint_campaign_operation_names() + ks_pipeline_demo_scenarios::metaplex_create_mint_campaign_operation_names() .iter() .map(|value| return (*value).to_string()) .collect(), @@ -930,7 +930,7 @@ pub(crate) fn demo_execution_metadata_metaplex_campaigns() "collection_verify", "Collection — Verify → Unverify", "collection", - kb_pipeline_demo_scenarios::metaplex_collection_verify_campaign_operation_names(), + ks_pipeline_demo_scenarios::metaplex_collection_verify_campaign_operation_names(), "confirmed", "fresh collection parent + fresh unverified member", ), @@ -938,7 +938,7 @@ pub(crate) fn demo_execution_metadata_metaplex_campaigns() "print_burn", "NFT imprimable — Print → Burn", "nft", - kb_pipeline_demo_scenarios::metaplex_print_burn_campaign_operation_names(), + ks_pipeline_demo_scenarios::metaplex_print_burn_campaign_operation_names(), "confirmed", "fresh limited-supply master NFT + fresh printed edition", ), @@ -946,7 +946,7 @@ pub(crate) fn demo_execution_metadata_metaplex_campaigns() "pnft_lifecycle", "pNFT — Delegate → Lock → Unlock → Revoke → Delegate → Transfer", "programmable_nft", - kb_pipeline_demo_scenarios::metaplex_pnft_lifecycle_campaign_operation_names(), + ks_pipeline_demo_scenarios::metaplex_pnft_lifecycle_campaign_operation_names(), "confirmed", "fresh pNFT + delegate wallet + destination owner", ), @@ -954,7 +954,7 @@ pub(crate) fn demo_execution_metadata_metaplex_campaigns() "escrow", "Token Owned Escrow — Create → TransferOut → Close", "nft", - kb_pipeline_demo_scenarios::metaplex_escrow_campaign_operation_names(), + ks_pipeline_demo_scenarios::metaplex_escrow_campaign_operation_names(), "confirmed", "fresh NFT parent + fresh fungible attribute + escrow ATA deposit", ), @@ -962,7 +962,7 @@ pub(crate) fn demo_execution_metadata_metaplex_campaigns() "maintenance", "Maintenance — Update + probes réservés/legacy", "nft", - kb_pipeline_demo_scenarios::metaplex_maintenance_campaign_operation_names(), + ks_pipeline_demo_scenarios::metaplex_maintenance_campaign_operation_names(), "mixed_confirmed_unavailable", "fresh NFT; Update submitted; Resize/Migrate/Collect/CloseAccounts simulation-only probes", ), @@ -970,7 +970,7 @@ pub(crate) fn demo_execution_metadata_metaplex_campaigns() "use_probe", "Use — probe runtime", "nft", - kb_pipeline_demo_scenarios::metaplex_use_probe_operation_names(), + ks_pipeline_demo_scenarios::metaplex_use_probe_operation_names(), "runtime_unavailable_probe", "fresh NFT with two bounded Multiple uses; Use is simulation-only when rejected", ), @@ -1036,7 +1036,7 @@ pub(crate) async fn demo_execution_metadata_metaplex_execute_campaign( .to_string(), ); } - let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; @@ -1131,19 +1131,19 @@ pub(crate) async fn demo_execution_metadata_metaplex_execute_campaign( fn execute_campaign_projection<'a, S, O>( campaign_id: &'a str, wallet_dir: std::path::PathBuf, - http_pool: &'a kb_onchain_transport::HttpEndpointPool, + http_pool: &'a ks_onchain_transport::HttpEndpointPool, store: &'a S, - profile: &'a kb_config::ProfileConfig, + profile: &'a ks_config::ProfileConfig, workspace_root: &'a std::path::Path, observer: &'a O, ) -> CampaignProjectionFuture<'a> where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync + 'a, - O: kb_pipeline_demo_scenarios::SolanaExecutionObserver + 'a, + O: ks_pipeline_demo_scenarios::SolanaExecutionObserver + 'a, { return std::boxed::Box::pin(execute_campaign_projection_unboxed( campaign_id, @@ -1159,27 +1159,27 @@ where async fn execute_campaign_projection_unboxed( campaign_id: &str, wallet_dir: std::path::PathBuf, - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, - O: kb_pipeline_demo_scenarios::SolanaExecutionObserver, + O: ks_pipeline_demo_scenarios::SolanaExecutionObserver, { let base_options = - kb_pipeline_demo_scenarios::MetaplexCreateFixturePreparationOptions::new(wallet_dir); + ks_pipeline_demo_scenarios::MetaplexCreateFixturePreparationOptions::new(wallet_dir); return match campaign_id { "create_mint_nft" => { execute_create_mint_projection( "Create → Mint — NFT", base_options.clone().with_asset_family( - kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft, + ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft, ), http_pool, store, @@ -1193,7 +1193,7 @@ where execute_create_mint_projection( "Create → Mint — SFT", base_options.clone().with_asset_family( - kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Sft, + ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Sft, ), http_pool, store, @@ -1207,7 +1207,7 @@ where execute_create_mint_projection( "Create → Mint — Fungible", base_options.clone().with_asset_family( - kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Fungible, + ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Fungible, ), http_pool, store, @@ -1221,7 +1221,7 @@ where execute_create_mint_projection( "Create → Mint — Collection", base_options.clone().with_asset_family( - kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Collection, + ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Collection, ), http_pool, store, @@ -1235,7 +1235,7 @@ where execute_create_mint_projection( "Create → Mint — pNFT", base_options.clone().with_asset_family( - kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::ProgrammableNft, + ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::ProgrammableNft, ), http_pool, store, @@ -1246,7 +1246,7 @@ where .await }, "collection_verify" => { - let summary = match kb_pipeline_demo_scenarios::execute_devnet_metaplex_collection_verify_campaign( + let summary = match ks_pipeline_demo_scenarios::execute_devnet_metaplex_collection_verify_campaign( http_pool, store, profile, @@ -1285,7 +1285,7 @@ where }, "print_burn" => { let summary = - match kb_pipeline_demo_scenarios::execute_devnet_metaplex_print_burn_campaign( + match ks_pipeline_demo_scenarios::execute_devnet_metaplex_print_burn_campaign( http_pool, store, profile, @@ -1324,10 +1324,10 @@ where }, "pnft_lifecycle" => { let options = base_options.clone().with_asset_family( - kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::ProgrammableNft, + ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::ProgrammableNft, ); let summary = - match kb_pipeline_demo_scenarios::execute_devnet_metaplex_pnft_lifecycle_campaign( + match ks_pipeline_demo_scenarios::execute_devnet_metaplex_pnft_lifecycle_campaign( http_pool, store, profile, @@ -1361,7 +1361,7 @@ where }) }, "escrow" => { - let summary = match kb_pipeline_demo_scenarios::execute_devnet_metaplex_escrow_campaign( + let summary = match ks_pipeline_demo_scenarios::execute_devnet_metaplex_escrow_campaign( http_pool, store, profile, @@ -1407,10 +1407,10 @@ where }, "maintenance" => { let options = base_options.clone().with_asset_family( - kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft, + ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft, ); let summary = - match kb_pipeline_demo_scenarios::execute_devnet_metaplex_maintenance_campaign( + match ks_pipeline_demo_scenarios::execute_devnet_metaplex_maintenance_campaign( http_pool, store, profile, @@ -1463,9 +1463,9 @@ where }, "use_probe" => { let options = base_options.clone().with_asset_family( - kb_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft, + ks_pipeline_demo_scenarios::MetaplexTokenMetadataAssetFamily::Nft, ); - let summary = match kb_pipeline_demo_scenarios::execute_devnet_metaplex_use_probe( + let summary = match ks_pipeline_demo_scenarios::execute_devnet_metaplex_use_probe( http_pool, store, profile, @@ -1501,7 +1501,7 @@ where }), }) }, - _ => std::result::Result::Err(kb_core::Error::config(format!( + _ => std::result::Result::Err(ks_core::Error::config(format!( "unknown qualified Metaplex desktop campaign `{campaign_id}`" ))), }; @@ -1509,21 +1509,21 @@ where async fn execute_create_mint_projection( label: &str, - options: kb_pipeline_demo_scenarios::MetaplexCreateFixturePreparationOptions, - http_pool: &kb_onchain_transport::HttpEndpointPool, + options: ks_pipeline_demo_scenarios::MetaplexCreateFixturePreparationOptions, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, - O: kb_pipeline_demo_scenarios::SolanaExecutionObserver, + O: ks_pipeline_demo_scenarios::SolanaExecutionObserver, { - let summary = match kb_pipeline_demo_scenarios::execute_devnet_metaplex_create_mint_campaign( + let summary = match ks_pipeline_demo_scenarios::execute_devnet_metaplex_create_mint_campaign( http_pool, store, profile, @@ -1554,7 +1554,7 @@ where fn metaplex_execution_json( label: &str, - summary: &kb_pipeline_demo_scenarios::DevnetMetaplexTokenMetadataExecutionSummary, + summary: &ks_pipeline_demo_scenarios::DevnetMetaplexTokenMetadataExecutionSummary, ) -> serde_json::Value { let classification = if execution_confirmation_is_confirmed(&summary.confirmation) { "confirmed" @@ -1594,13 +1594,13 @@ fn metaplex_execution_json( } fn execution_confirmation_is_confirmed( - confirmation: &std::option::Option, + confirmation: &std::option::Option, ) -> bool { return confirmation.as_ref().is_some_and(|value| { return matches!( value.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ); }); } @@ -1611,7 +1611,7 @@ fn execution_is_confirmed_json(value: &serde_json::Value) -> bool { } fn create_mint_state_json( - state: &kb_pipeline_demo_scenarios::DevnetMetaplexCreateMintTokenState, + state: &ks_pipeline_demo_scenarios::DevnetMetaplexCreateMintTokenState, ) -> serde_json::Value { return serde_json::json!({ "expectedAmountRaw": state.expected_amount_raw, @@ -1625,7 +1625,7 @@ fn create_mint_state_json( } fn print_burn_state_json( - state: &kb_pipeline_demo_scenarios::DevnetMetaplexPrintBurnState, + state: &ks_pipeline_demo_scenarios::DevnetMetaplexPrintBurnState, ) -> serde_json::Value { return serde_json::json!({ "editionNumber": state.edition_number, @@ -1648,7 +1648,7 @@ fn print_burn_state_json( } fn pnft_state_json( - state: &kb_pipeline_demo_scenarios::DevnetMetaplexPnftLifecycleState, + state: &ks_pipeline_demo_scenarios::DevnetMetaplexPnftLifecycleState, ) -> serde_json::Value { return serde_json::json!({ "delegate": &state.delegate, @@ -1671,7 +1671,7 @@ fn pnft_state_json( } fn escrow_state_json( - state: &kb_pipeline_demo_scenarios::DevnetMetaplexEscrowCampaignState, + state: &ks_pipeline_demo_scenarios::DevnetMetaplexEscrowCampaignState, ) -> serde_json::Value { return serde_json::json!({ "depositAmountRaw": state.deposit_amount_raw, @@ -1697,8 +1697,8 @@ mod tests { }, }; let expected_count = - kb_pipeline_demo_scenarios::metaplex_token_metadata_synthetic_scenarios().len() - + kb_pipeline_demo_scenarios::metaplex_token_metadata_devnet_scenarios().len(); + ks_pipeline_demo_scenarios::metaplex_token_metadata_synthetic_scenarios().len() + + ks_pipeline_demo_scenarios::metaplex_token_metadata_devnet_scenarios().len(); assert_eq!(payloads.len(), expected_count); assert!(payloads.iter().all(|payload| return !payload.operation_codes.is_empty())); assert!(payloads.iter().all(|payload| return payload.requires_postcondition)); diff --git a/kb-app-demo-desktop/src/demo_execution_metadata_solana_program.rs b/kb-app-demo-desktop/src/demo_execution_metadata_solana_program.rs index 198c355..da6ffcd 100644 --- a/kb-app-demo-desktop/src/demo_execution_metadata_solana_program.rs +++ b/kb-app-demo-desktop/src/demo_execution_metadata_solana_program.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/demo_execution_metadata_solana_program.rs -// version: 2 +// version: 3 //! Thin desktop adapter for complete Solana Program Metadata Devnet campaigns. @@ -98,7 +98,7 @@ pub(crate) struct DemoExecutionMetadataSolanaProgramCampaignSummaryPayload { /// Returns the two canonical Solana Program Metadata Devnet journeys. pub(crate) fn demo_execution_metadata_solana_program_scenarios() -> std::vec::Vec { - return kb_pipeline_demo_scenarios::solana_program_metadata_devnet_scenarios() + return ks_pipeline_demo_scenarios::solana_program_metadata_devnet_scenarios() .into_iter() .map(|scenario| { return crate::DemoExecutionMetadataSolanaProgramScenarioPayload { @@ -159,19 +159,19 @@ pub(crate) async fn demo_execution_metadata_solana_program_execute_campaign( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; let mut options = - kb_pipeline_demo_scenarios::SolanaProgramMetadataFixturePreparationOptions::new(); + ks_pipeline_demo_scenarios::SolanaProgramMetadataFixturePreparationOptions::new(); options.operator_confirmed = true; let observer = crate::DemoExecutionMetadataObserver { app_handle, cancel_requested: state.demo_execution_solana_core_cancel_requested(), }; let workspace_root = crate::workspace_root_dir(); - let summary = match kb_pipeline_demo_scenarios::execute_devnet_solana_program_metadata_campaign( + let summary = match ks_pipeline_demo_scenarios::execute_devnet_solana_program_metadata_campaign( &http_pool, &profile, workspace_root.as_path(), @@ -187,7 +187,7 @@ pub(crate) async fn demo_execution_metadata_solana_program_execute_campaign( } fn campaign_summary_payload( - summary: kb_pipeline_demo_scenarios::DevnetSolanaProgramMetadataCampaignSummary, + summary: ks_pipeline_demo_scenarios::DevnetSolanaProgramMetadataCampaignSummary, ) -> crate::DemoExecutionMetadataSolanaProgramCampaignSummaryPayload { let mut confirmed_step_count = 0_usize; let mut materialized_snapshot_count = 0_usize; @@ -201,8 +201,8 @@ fn campaign_summary_payload( let confirmed = match step.execution.confirmation.as_ref() { std::option::Option::Some(value) => matches!( value.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ), std::option::Option::None => false, }; @@ -235,7 +235,7 @@ fn campaign_summary_payload( "materializedSnapshots": &step.execution.materialized_snapshots })); } - let expected_step_count = kb_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.len(); + let expected_step_count = ks_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.len(); let completed = summary.steps.len() == expected_step_count && confirmed_step_count == expected_step_count && summary.steps.iter().all(|step| { @@ -246,7 +246,7 @@ fn campaign_summary_payload( .find(|prepared| return prepared.step_id == step.step_id) { std::option::Option::Some(prepared) => { - prepared.operation.operation_code() == kb_lib::EX_METADATA_SPM_CLOSE_OPERATION + prepared.operation.operation_code() == ks_lib::EX_METADATA_SPM_CLOSE_OPERATION }, std::option::Option::None => false, }; @@ -285,22 +285,22 @@ fn campaign_summary_payload( } fn fixture_state_code( - value: kb_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState, + value: ks_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState, ) -> std::string::String { return match value { - kb_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::Prefunded => { + ks_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::Prefunded => { "prefunded".to_string() }, - kb_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::Buffer => { + ks_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::Buffer => { "buffer".to_string() }, - kb_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::MutableMetadata => { + ks_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::MutableMetadata => { "mutable_metadata".to_string() }, - kb_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::ImmutableMetadata => { + ks_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::ImmutableMetadata => { "immutable_metadata".to_string() }, - kb_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::Closed => { + ks_pipeline_demo_scenarios::SolanaProgramMetadataFixtureState::Closed => { "closed".to_string() }, }; @@ -314,11 +314,11 @@ mod tests { assert_eq!(payloads.len(), 2); assert_eq!( payloads.iter().map(|scenario| return scenario.steps.len()).sum::(), - kb_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.len() + ks_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.len() ); assert!(payloads.iter().flat_map(|scenario| return scenario.steps.iter()).all(|step| { return !step.required_evidence.is_empty() - && kb_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES + && ks_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES .contains(&step.operation_code.as_str()); })); } diff --git a/kb-app-demo-desktop/src/demo_execution_metadata_token_2022.rs b/kb-app-demo-desktop/src/demo_execution_metadata_token_2022.rs index 88fc379..63b56a4 100644 --- a/kb-app-demo-desktop/src/demo_execution_metadata_token_2022.rs +++ b/kb-app-demo-desktop/src/demo_execution_metadata_token_2022.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/demo_execution_metadata_token_2022.rs -// version: 1 +// version: 2 //! Thin desktop adapter for the complete Token-2022 Token Metadata Devnet campaign. @@ -84,7 +84,7 @@ pub(crate) async fn demo_execution_metadata_token_2022_execute_campaign( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; @@ -103,13 +103,13 @@ pub(crate) async fn demo_execution_metadata_token_2022_execute_campaign( workspace_root.join(configured_wallet_dir) }; let mut options = - kb_pipeline_demo_scenarios::Token2022MetadataFixturePreparationOptions::new(wallet_dir); + ks_pipeline_demo_scenarios::Token2022MetadataFixturePreparationOptions::new(wallet_dir); options.operator_confirmed = true; let observer = crate::DemoExecutionMetadataObserver { app_handle, cancel_requested: state.demo_execution_solana_core_cancel_requested(), }; - let summary = match kb_pipeline_demo_scenarios::execute_devnet_token_2022_metadata_campaign( + let summary = match ks_pipeline_demo_scenarios::execute_devnet_token_2022_metadata_campaign( &http_pool, &store, &profile, @@ -127,7 +127,7 @@ pub(crate) async fn demo_execution_metadata_token_2022_execute_campaign( fn campaign_summary_payload( profile_name: std::string::String, - summary: kb_pipeline_demo_scenarios::DevnetToken2022MetadataCampaignSummary, + summary: ks_pipeline_demo_scenarios::DevnetToken2022MetadataCampaignSummary, ) -> crate::DemoExecutionMetadataToken2022CampaignSummaryPayload { let mut confirmed_step_count = 0_usize; let mut materialization_count = 0_usize; @@ -136,8 +136,8 @@ fn campaign_summary_payload( let confirmed = match step.execution.confirmation.as_ref() { std::option::Option::Some(value) => matches!( value.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ), std::option::Option::None => false, }; @@ -161,12 +161,12 @@ fn campaign_summary_payload( })); } let expected_step_count = - kb_pipeline_demo_scenarios::token_2022_metadata_campaign_operation_names().len(); + ks_pipeline_demo_scenarios::token_2022_metadata_campaign_operation_names().len(); let completed = summary.steps.len() == expected_step_count && confirmed_step_count == expected_step_count && summary.steps.iter().all(|step| { return step.postcondition.status - == kb_pipeline::Token2022ExecutionPostconditionStatus::Confirmed; + == ks_pipeline::Token2022ExecutionPostconditionStatus::Confirmed; }); let fixture_json = crate::pretty_json(&serde_json::json!({ "mint": &summary.fixture.mint, @@ -198,7 +198,7 @@ mod tests { #[test] fn desktop_campaign_exposes_the_exact_five_token_metadata_operations() { assert_eq!( - kb_pipeline_demo_scenarios::token_2022_metadata_campaign_operation_names(), + ks_pipeline_demo_scenarios::token_2022_metadata_campaign_operation_names(), &[ "initialize_token_metadata", "update_token_metadata_field", diff --git a/kb-app-demo-desktop/src/demo_execution_solana_core.rs b/kb-app-demo-desktop/src/demo_execution_solana_core.rs index 8dbec88..8354cea 100644 --- a/kb-app-demo-desktop/src/demo_execution_solana_core.rs +++ b/kb-app-demo-desktop/src/demo_execution_solana_core.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/demo_execution_solana_core.rs -// version: 13 +// version: 14 //! Tauri adapter for bounded Solana Core execution on Devnet. @@ -290,8 +290,8 @@ impl crate::DemoExecutionSolanaCoreObserver<'_> { } } -impl kb_pipeline::BackfillObserver for crate::DemoExecutionSolanaCoreObserver<'_> { - fn on_progress(&self, event: &kb_pipeline::BackfillProgressEvent) { +impl ks_pipeline::BackfillObserver for crate::DemoExecutionSolanaCoreObserver<'_> { + fn on_progress(&self, event: &ks_pipeline::BackfillProgressEvent) { self.emit( event.timestamp.clone(), event.level.code(), @@ -306,8 +306,8 @@ impl kb_pipeline::BackfillObserver for crate::DemoExecutionSolanaCoreObserver<'_ } } -impl kb_pipeline::CoreExtractionObserver for crate::DemoExecutionSolanaCoreObserver<'_> { - fn on_progress(&self, event: &kb_pipeline::CoreExtractionProgressEvent) { +impl ks_pipeline::CoreExtractionObserver for crate::DemoExecutionSolanaCoreObserver<'_> { + fn on_progress(&self, event: &ks_pipeline::CoreExtractionProgressEvent) { self.emit( event.timestamp.clone(), event.level.code(), @@ -322,8 +322,8 @@ impl kb_pipeline::CoreExtractionObserver for crate::DemoExecutionSolanaCoreObser } } -impl kb_pipeline::DecodeReplayObserver for crate::DemoExecutionSolanaCoreObserver<'_> { - fn on_progress(&self, event: &kb_pipeline::DecodeReplayProgressEvent) { +impl ks_pipeline::DecodeReplayObserver for crate::DemoExecutionSolanaCoreObserver<'_> { + fn on_progress(&self, event: &ks_pipeline::DecodeReplayProgressEvent) { self.emit( event.timestamp.clone(), event.level.code(), @@ -338,12 +338,12 @@ impl kb_pipeline::DecodeReplayObserver for crate::DemoExecutionSolanaCoreObserve } } -impl kb_pipeline_demo_scenarios::SolanaExecutionObserver +impl ks_pipeline_demo_scenarios::SolanaExecutionObserver for crate::DemoExecutionSolanaCoreObserver<'_> { fn on_execution_progress( &self, - event: &kb_pipeline_demo_scenarios::SolanaExecutionProgressEvent, + event: &ks_pipeline_demo_scenarios::SolanaExecutionProgressEvent, ) { self.emit( event.timestamp.clone(), @@ -360,10 +360,10 @@ impl kb_pipeline_demo_scenarios::SolanaExecutionObserver } pub(crate) fn select_devnet_profile( - config: &kb_config::AppConfig, + config: &ks_config::AppConfig, profile_name: &str, -) -> std::result::Result { - return kb_pipeline_demo_scenarios::resolve_demo_devnet_profile( +) -> std::result::Result { + return ks_pipeline_demo_scenarios::resolve_demo_devnet_profile( config, std::option::Option::Some(profile_name), ) @@ -371,26 +371,26 @@ pub(crate) fn select_devnet_profile( } pub(crate) fn execution_cluster_code( - cluster: kb_lib::ExApiExecutionCluster, + cluster: ks_lib::ExApiExecutionCluster, ) -> std::string::String { return match cluster { - kb_lib::ExApiExecutionCluster::Localnet => "localnet".to_string(), - kb_lib::ExApiExecutionCluster::Devnet => "devnet".to_string(), - kb_lib::ExApiExecutionCluster::Testnet => "testnet".to_string(), - kb_lib::ExApiExecutionCluster::Mainnet => "mainnet".to_string(), + ks_lib::ExApiExecutionCluster::Localnet => "localnet".to_string(), + ks_lib::ExApiExecutionCluster::Devnet => "devnet".to_string(), + ks_lib::ExApiExecutionCluster::Testnet => "testnet".to_string(), + ks_lib::ExApiExecutionCluster::Mainnet => "mainnet".to_string(), }; } pub(crate) fn confirmation_status_code( - status: kb_lib::ExApiExecutionConfirmationStatus, + status: ks_lib::ExApiExecutionConfirmationStatus, ) -> std::string::String { return match status { - kb_lib::ExApiExecutionConfirmationStatus::Processed => "processed".to_string(), - kb_lib::ExApiExecutionConfirmationStatus::Confirmed => "confirmed".to_string(), - kb_lib::ExApiExecutionConfirmationStatus::Finalized => "finalized".to_string(), - kb_lib::ExApiExecutionConfirmationStatus::Failed => "failed".to_string(), - kb_lib::ExApiExecutionConfirmationStatus::Expired => "expired".to_string(), - kb_lib::ExApiExecutionConfirmationStatus::TimedOut => "timed_out".to_string(), + ks_lib::ExApiExecutionConfirmationStatus::Processed => "processed".to_string(), + ks_lib::ExApiExecutionConfirmationStatus::Confirmed => "confirmed".to_string(), + ks_lib::ExApiExecutionConfirmationStatus::Finalized => "finalized".to_string(), + ks_lib::ExApiExecutionConfirmationStatus::Failed => "failed".to_string(), + ks_lib::ExApiExecutionConfirmationStatus::Expired => "expired".to_string(), + ks_lib::ExApiExecutionConfirmationStatus::TimedOut => "timed_out".to_string(), }; } @@ -404,7 +404,7 @@ pub(crate) async fn demo_execution_devnet_prepare_profile( std::result::Result::Err(error) => return std::result::Result::Err(error), }; let readiness = - match kb_pipeline_demo_scenarios::prepare_demo_devnet_profile_store(&profile).await { + match ks_pipeline_demo_scenarios::prepare_demo_devnet_profile_store(&profile).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { return std::result::Result::Err(error.to_string()); @@ -433,11 +433,11 @@ pub(crate) fn demo_execution_solana_core_options( pub(crate) fn demo_execution_solana_core_generate_recipient() -> std::result::Result { - let alias = match kb_wallet::WalletAlias::parse("demo-devnet-recipient") { + let alias = match ks_wallet::WalletAlias::parse("demo-devnet-recipient") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; - let wallet = kb_wallet::TemporaryWallet::generate(alias); + let wallet = ks_wallet::TemporaryWallet::generate(alias); return std::result::Result::Ok(crate::DemoExecutionSolanaCoreGeneratedRecipientPayload { public_key: wallet.public_key(), }); @@ -469,7 +469,7 @@ pub(crate) async fn demo_execution_solana_core_execute( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; @@ -481,9 +481,9 @@ pub(crate) async fn demo_execution_solana_core_execute( if let std::result::Result::Err(error) = initialize_result { return std::result::Result::Err(error.to_string()); } - let mut pipeline_request = kb_pipeline_demo_scenarios::DevnetSystemTransferRequest::new( + let mut pipeline_request = ks_pipeline_demo_scenarios::DevnetSystemTransferRequest::new( format!("demo-execution-{}", chrono::Utc::now().timestamp_micros()), - kb_lib::MdPubkey(request.recipient.trim().to_string()), + ks_lib::MdPubkey(request.recipient.trim().to_string()), request.lamports, ); pipeline_request.airdrop_lamports = request.airdrop_lamports; @@ -492,15 +492,15 @@ pub(crate) async fn demo_execution_solana_core_execute( pipeline_request.post_validation_max_retries = 20; pipeline_request.force_post_validation_replay = request.force_post_validation_replay; pipeline_request.materialize_after_decode = request.materialize_after_decode; - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcSolanaCoreDecoder)]; - let materializers: std::vec::Vec> = + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcSolanaCoreDecoder)]; + let materializers: std::vec::Vec> = if request.materialize_after_decode { std::vec![ - std::sync::Arc::new(kb_lib::MtAdminMaterializer), - std::sync::Arc::new(kb_lib::MtComplianceAuditMaterializer,), - std::sync::Arc::new(kb_lib::MtLifecycleMaterializer), - std::sync::Arc::new(kb_lib::MtStakingMaterializer), + std::sync::Arc::new(ks_lib::MtAdminMaterializer), + std::sync::Arc::new(ks_lib::MtComplianceAuditMaterializer,), + std::sync::Arc::new(ks_lib::MtLifecycleMaterializer), + std::sync::Arc::new(ks_lib::MtStakingMaterializer), ] } else { std::vec::Vec::new() @@ -510,7 +510,7 @@ pub(crate) async fn demo_execution_solana_core_execute( cancel_requested: state.demo_execution_solana_core_cancel_requested(), }; let workspace_root = crate::workspace_root_dir(); - let summary = match kb_pipeline_demo_scenarios::execute_devnet_system_transfer( + let summary = match ks_pipeline_demo_scenarios::execute_devnet_system_transfer( &http_pool, &store, &profile, @@ -554,7 +554,7 @@ pub(crate) async fn demo_execution_spl_memo_execute( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; @@ -565,7 +565,7 @@ pub(crate) async fn demo_execution_spl_memo_execute( if let std::result::Result::Err(error) = store.initialize_store_schema().await { return std::result::Result::Err(error.to_string()); } - let mut pipeline_request = kb_pipeline_demo_scenarios::DevnetMemoExecutionRequest::new( + let mut pipeline_request = ks_pipeline_demo_scenarios::DevnetMemoExecutionRequest::new( format!("demo-memo-execution-{}", chrono::Utc::now().timestamp_micros()), request.message, ); @@ -574,16 +574,16 @@ pub(crate) async fn demo_execution_spl_memo_execute( pipeline_request.operator_confirmed = request.operator_confirmed; pipeline_request.post_validation_max_retries = 20; pipeline_request.force_post_validation_replay = request.force_post_validation_replay; - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcSplMemoDecoder)]; - let materializers: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::MtTransactionAnnotationMaterializer,)]; + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcSplMemoDecoder)]; + let materializers: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::MtTransactionAnnotationMaterializer,)]; let observer = crate::DemoExecutionSolanaCoreObserver { app_handle, cancel_requested: state.demo_execution_solana_core_cancel_requested(), }; let workspace_root = crate::workspace_root_dir(); - let summary = match kb_pipeline_demo_scenarios::execute_devnet_memo( + let summary = match ks_pipeline_demo_scenarios::execute_devnet_memo( &http_pool, &store, &profile, @@ -616,7 +616,7 @@ pub(crate) fn demo_execution_solana_core_cancel(state: tauri::State<'_, crate::A } fn devnet_profile_options( - config: &kb_config::AppConfig, + config: &ks_config::AppConfig, ) -> std::vec::Vec { let mut output = std::vec::Vec::new(); for profile in &config.profiles { @@ -639,7 +639,7 @@ fn devnet_profile_options( } fn summary_payload( - summary: kb_pipeline_demo_scenarios::DevnetSystemTransferSummary, + summary: ks_pipeline_demo_scenarios::DevnetSystemTransferSummary, ) -> crate::DemoExecutionSolanaCoreSummaryPayload { let plan_json = crate::pretty_json(&summary.plan); let simulation_json = crate::pretty_json(&summary.simulation); @@ -720,7 +720,7 @@ fn summary_payload( } fn memo_summary_payload( - summary: kb_pipeline_demo_scenarios::DevnetMemoExecutionSummary, + summary: ks_pipeline_demo_scenarios::DevnetMemoExecutionSummary, ) -> crate::DemoExecutionMemoSummaryPayload { let plan_json = crate::pretty_json(&summary.plan); let simulation_json = crate::pretty_json(&summary.simulation); @@ -851,7 +851,7 @@ mod tests { #[test] fn example_config_exposes_one_devnet_execution_profile() { let config = - match kb_config::parse_config_json(include_str!("../../config/example.config.json")) { + match ks_config::parse_config_json(include_str!("../../config/example.config.json")) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("example config parse failed: {error}"), }; @@ -865,7 +865,7 @@ mod tests { #[test] fn profile_selection_rejects_mainnet_profiles() { let config = - match kb_config::parse_config_json(include_str!("../../config/example.config.json")) { + match ks_config::parse_config_json(include_str!("../../config/example.config.json")) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("example config parse failed: {error}"), }; diff --git a/kb-app-demo-desktop/src/demo_execution_spl.rs b/kb-app-demo-desktop/src/demo_execution_spl.rs index 667539c..1b76512 100644 --- a/kb-app-demo-desktop/src/demo_execution_spl.rs +++ b/kb-app-demo-desktop/src/demo_execution_spl.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/demo_execution_spl.rs -// version: 5 +// version: 6 //! Dedicated Tauri window for bounded SPL execution on Devnet. @@ -30,32 +30,32 @@ pub(crate) struct DevnetSplValidationScenarioPayload { /// Returns the complete ordered Devnet SPL validation inventory for milestone 0.4.6. pub(crate) fn demo_execution_spl_validation_scenarios() -> std::vec::Vec { - return kb_pipeline_demo_scenarios::devnet_spl_validation_scenarios() + return ks_pipeline_demo_scenarios::devnet_spl_validation_scenarios() .into_iter() .map(|scenario| { return crate::DevnetSplValidationScenarioPayload { id: scenario.id, label: scenario.label, family: match scenario.family { - kb_pipeline_demo_scenarios::DevnetSplValidationFamily::Token2022Public => { + ks_pipeline_demo_scenarios::DevnetSplValidationFamily::Token2022Public => { "token_2022_public".to_string() }, - kb_pipeline_demo_scenarios::DevnetSplValidationFamily::ElGamalRegistry => { + ks_pipeline_demo_scenarios::DevnetSplValidationFamily::ElGamalRegistry => { "elgamal_registry".to_string() }, - kb_pipeline_demo_scenarios::DevnetSplValidationFamily::Token2022Confidential => { + ks_pipeline_demo_scenarios::DevnetSplValidationFamily::Token2022Confidential => { "token_2022_confidential".to_string() }, }, operation_code: scenario.operation_code, implementation_status: match scenario.implementation_status { - kb_pipeline_demo_scenarios::DevnetSplValidationImplementationStatus::Executable => { + ks_pipeline_demo_scenarios::DevnetSplValidationImplementationStatus::Executable => { "executable".to_string() }, - kb_pipeline_demo_scenarios::DevnetSplValidationImplementationStatus::BackendReady => { + ks_pipeline_demo_scenarios::DevnetSplValidationImplementationStatus::BackendReady => { "backend_ready".to_string() }, - kb_pipeline_demo_scenarios::DevnetSplValidationImplementationStatus::ProofFixtureRequired => { + ks_pipeline_demo_scenarios::DevnetSplValidationImplementationStatus::ProofFixtureRequired => { "proof_fixture_required".to_string() }, }, @@ -75,7 +75,7 @@ mod tests { profile_name: "local_devnet".to_string(), cluster: "devnet".to_string(), genesis_hash: "EtWTRABZaYq6iMfeYKouRu166VU2xqa1".to_string(), - wallet_public_key: kb_program_ids::SYSTEM_PROGRAM_ID.to_string(), + wallet_public_key: ks_program_ids::SYSTEM_PROGRAM_ID.to_string(), balance_lamports: u64::MAX.to_string(), fee_lamports: std::option::Option::Some(u64::MAX.to_string()), simulation_success: true, diff --git a/kb-app-demo-desktop/src/demo_http.rs b/kb-app-demo-desktop/src/demo_http.rs index bdeae02..38620aa 100644 --- a/kb-app-demo-desktop/src/demo_http.rs +++ b/kb-app-demo-desktop/src/demo_http.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/demo_http.rs -// version: 13 +// version: 14 //! HTTP JSON-RPC demo commands. @@ -142,13 +142,13 @@ pub(crate) async fn demo_http_execute_request( std::result::Result::Ok(text) => text, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; - let method_class = kb_onchain_transport::HttpClient::classify_method(&method); + let method_class = ks_onchain_transport::HttpClient::classify_method(&method); return std::result::Result::Ok(crate::DemoHttpExecutionPayload { endpoint_name: selected_client.endpoint_name().to_string(), provider: selected_client.provider().to_string(), endpoint_url: selected_client.endpoint_url().to_string(), role, - request_kind: kb_onchain_transport::request_kind_from_method(&method), + request_kind: ks_onchain_transport::request_kind_from_method(&method), method, method_class: method_class_to_string(method_class).to_string(), response_json, @@ -157,7 +157,7 @@ pub(crate) async fn demo_http_execute_request( pub(crate) fn demo_http_list_pool_clients( state: tauri::State<'_, crate::AppState>, -) -> std::vec::Vec { +) -> std::vec::Vec { return state.http_pool().snapshot(); } @@ -171,7 +171,7 @@ pub(crate) fn demo_http_options( } fn build_http_role_options( - snapshots: std::vec::Vec, + snapshots: std::vec::Vec, ) -> std::vec::Vec { let mut roles = std::collections::BTreeMap::< std::string::String, @@ -256,7 +256,7 @@ fn build_http_method_options() -> std::vec::Vec { for (method, label, requires_first_arg, supports_config_json) in methods { options.push(crate::DemoHttpMethodOption { method: method.to_string(), - request_kind: kb_onchain_transport::request_kind_from_method(method), + request_kind: ks_onchain_transport::request_kind_from_method(method), label: label.to_string(), requires_first_arg, supports_config_json, @@ -367,11 +367,11 @@ fn parse_optional_params_json( return std::result::Result::Ok(std::option::Option::Some(array)); } -fn method_class_to_string(method_class: kb_onchain_transport::HttpMethodClass) -> &'static str { +fn method_class_to_string(method_class: ks_onchain_transport::HttpMethodClass) -> &'static str { return match method_class { - kb_onchain_transport::HttpMethodClass::GeneralRpc => "GeneralRpc", - kb_onchain_transport::HttpMethodClass::SendTransaction => "SendTransaction", - kb_onchain_transport::HttpMethodClass::HeavyRead => "HeavyRead", + ks_onchain_transport::HttpMethodClass::GeneralRpc => "GeneralRpc", + ks_onchain_transport::HttpMethodClass::SendTransaction => "SendTransaction", + ks_onchain_transport::HttpMethodClass::HeavyRead => "HeavyRead", }; } @@ -407,7 +407,7 @@ mod tests { assert!(names.insert(option.method.as_str())); assert_eq!( option.request_kind, - kb_onchain_transport::request_kind_from_method(option.method.as_str()) + ks_onchain_transport::request_kind_from_method(option.method.as_str()) ); } assert!(!options.is_empty()); diff --git a/kb-app-demo-desktop/src/demo_spl_ata.rs b/kb-app-demo-desktop/src/demo_spl_ata.rs index 20cb122..d62bbb7 100644 --- a/kb-app-demo-desktop/src/demo_spl_ata.rs +++ b/kb-app-demo-desktop/src/demo_spl_ata.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/demo_spl_ata.rs -// version: 12 +// version: 13 //! Thin Tauri adapter for ATA execution, derivation and lifecycle journal reads. @@ -228,15 +228,15 @@ pub(crate) async fn demo_execution_spl_ata_execute( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let wallet_owner = kb_lib::MdPubkey(request.wallet_owner.trim().to_string()); - let mint = kb_lib::MdPubkey(request.mint.trim().to_string()); + let wallet_owner = ks_lib::MdPubkey(request.wallet_owner.trim().to_string()); + let mint = ks_lib::MdPubkey(request.mint.trim().to_string()); let operation = match request.mode.as_str() { - "create" => kb_lib::ExSplAssociatedTokenAccountOperation::Create { + "create" => ks_lib::ExSplAssociatedTokenAccountOperation::Create { wallet_owner, mint, token_program, }, - "create_idempotent" => kb_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { + "create_idempotent" => ks_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { wallet_owner, mint, token_program, @@ -248,7 +248,7 @@ pub(crate) async fn demo_execution_spl_ata_execute( }, }; let mut pipeline_request = - kb_pipeline_demo_scenarios::DevnetSplAssociatedTokenAccountExecutionRequest::new( + ks_pipeline_demo_scenarios::DevnetSplAssociatedTokenAccountExecutionRequest::new( format!("demo-spl-ata-execution-{}", chrono::Utc::now().timestamp_micros()), operation, ); @@ -256,7 +256,7 @@ pub(crate) async fn demo_execution_spl_ata_execute( pipeline_request.operator_confirmed = request.operator_confirmed; pipeline_request.post_validation_max_retries = 20; pipeline_request.force_post_validation_replay = request.force_post_validation_replay; - let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; @@ -267,19 +267,19 @@ pub(crate) async fn demo_execution_spl_ata_execute( if let std::result::Result::Err(error) = store.initialize_store_schema().await { return std::result::Result::Err(error.to_string()); } - let decoders: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::DcSplAssociatedTokenAccountDecoder), - std::sync::Arc::new(kb_lib::DcSplTokenDecoder), + let decoders: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::DcSplAssociatedTokenAccountDecoder), + std::sync::Arc::new(ks_lib::DcSplTokenDecoder), ]; - let materializers: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::MtTokenAccountsMaterializer), - std::sync::Arc::new(kb_lib::MtRiskMaterializer), + let materializers: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::MtTokenAccountsMaterializer), + std::sync::Arc::new(ks_lib::MtRiskMaterializer), ]; let observer = crate::DemoExecutionSolanaCoreObserver { app_handle, cancel_requested: state.demo_execution_solana_core_cancel_requested(), }; - let summary = match kb_pipeline_demo_scenarios::execute_devnet_spl_associated_token_account( + let summary = match ks_pipeline_demo_scenarios::execute_devnet_spl_associated_token_account( &http_pool, &store, &profile, @@ -314,7 +314,7 @@ pub(crate) async fn demo_spl_ata_journal( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; - let filter = match kb_store::MaterializedEventFilter::new( + let filter = match ks_store::MaterializedEventFilter::new( std::option::Option::Some("materializer.token.accounts".to_string()), std::option::Option::None, request.signature_contains.clone(), @@ -323,7 +323,7 @@ pub(crate) async fn demo_spl_ata_journal( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; - let rows = match kb_store::DecodePipelineStore::list_materialized_events(&store, &filter).await + let rows = match ks_store::DecodePipelineStore::list_materialized_events(&store, &filter).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), @@ -344,19 +344,19 @@ pub(crate) async fn demo_spl_ata_journal( } async fn load_profile_wallet( - profile: &kb_config::ProfileConfig, -) -> std::result::Result { + profile: &ks_config::ProfileConfig, +) -> std::result::Result { let configured = std::path::PathBuf::from(profile.wallet.wallet_dir.as_str()); let directory = if configured.is_absolute() { configured } else { crate::workspace_root_dir().join(configured) }; - let store = match kb_wallet::TemporaryWalletStore::new(directory) { + let store = match ks_wallet::TemporaryWalletStore::new(directory) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; - let alias = match kb_wallet::WalletAlias::parse(profile.wallet.temporary_wallet_alias.clone()) { + let alias = match ks_wallet::WalletAlias::parse(profile.wallet.temporary_wallet_alias.clone()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; @@ -368,10 +368,10 @@ async fn load_profile_wallet( fn parse_token_program( value: &str, -) -> std::result::Result { +) -> std::result::Result { return match value.trim() { - "classic" => std::result::Result::Ok(kb_lib::ExSplAssociatedTokenProgram::Classic), - "token_2022" => std::result::Result::Ok(kb_lib::ExSplAssociatedTokenProgram::Token2022), + "classic" => std::result::Result::Ok(ks_lib::ExSplAssociatedTokenProgram::Classic), + "token_2022" => std::result::Result::Ok(ks_lib::ExSplAssociatedTokenProgram::Token2022), _ => std::result::Result::Err("Token Program must be classic or token_2022".to_string()), }; } @@ -410,7 +410,7 @@ fn derive_ata( } fn summary_payload( - summary: kb_pipeline_demo_scenarios::DevnetSplAssociatedTokenAccountExecutionSummary, + summary: ks_pipeline_demo_scenarios::DevnetSplAssociatedTokenAccountExecutionSummary, ) -> crate::DemoExecutionSplAtaSummaryPayload { let (associated_token_account, token_program_id) = match summary.plan.instructions.first() { std::option::Option::Some(instruction) => { @@ -522,10 +522,10 @@ fn summary_payload( balance_lamports: summary.balance_lamports.to_string(), fee_lamports: summary.fee.fee_lamports.map(|value| return value.to_string()), readiness_status: match summary.stateful_readiness.status { - kb_pipeline::SplAssociatedTokenAccountStatefulReadinessStatus::Ready => { + ks_pipeline::SplAssociatedTokenAccountStatefulReadinessStatus::Ready => { "ready".to_string() }, - kb_pipeline::SplAssociatedTokenAccountStatefulReadinessStatus::Blocked => { + ks_pipeline::SplAssociatedTokenAccountStatefulReadinessStatus::Blocked => { "blocked".to_string() }, }, @@ -558,7 +558,7 @@ fn journal_matches(payload: &serde_json::Value, request: &crate::DemoSplAtaJourn return true; } -fn journal_row(row: kb_store::MaterializedEventQueryRow) -> crate::DemoSplAtaJournalRow { +fn journal_row(row: ks_store::MaterializedEventQueryRow) -> crate::DemoSplAtaJournalRow { let text = |key: &str| { return row .payload_json @@ -585,11 +585,11 @@ fn journal_row(row: kb_store::MaterializedEventQueryRow) -> crate::DemoSplAtaJou mod tests { #[test] fn classic_and_token_2022_derivations_are_distinct_and_canonical() { - let wallet = kb_program_ids::SYSTEM_PROGRAM_ID; + let wallet = ks_program_ids::SYSTEM_PROGRAM_ID; let mint = "So11111111111111111111111111111111111111112"; - let classic = super::derive_ata(wallet, mint, kb_program_ids::SPL_TOKEN_PROGRAM_ID) + let classic = super::derive_ata(wallet, mint, ks_program_ids::SPL_TOKEN_PROGRAM_ID) .unwrap_or_else(|error| panic!("classic derivation failed: {error}")); - let token_2022 = super::derive_ata(wallet, mint, kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID) + let token_2022 = super::derive_ata(wallet, mint, ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID) .unwrap_or_else(|error| panic!("Token-2022 derivation failed: {error}")); assert_eq!(classic, "aqxoAhCwpy3oB1BpNw9hL1HdLYLgPpbPjzxDrrQj3Fs"); assert_eq!(token_2022, "2sZUUBGq1i6aE47ZoxCaCW89jmYm2EXLPPmNMgMDXHMS"); diff --git a/kb-app-demo-desktop/src/demo_spl_token.rs b/kb-app-demo-desktop/src/demo_spl_token.rs index c0b1500..adfa455 100644 --- a/kb-app-demo-desktop/src/demo_spl_token.rs +++ b/kb-app-demo-desktop/src/demo_spl_token.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/demo_spl_token.rs -// version: 9 +// version: 10 //! Thin Tauri adapter for classic SPL Token execution and materialized journals. @@ -179,7 +179,7 @@ pub(crate) async fn demo_execution_spl_token_execute( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; @@ -191,20 +191,20 @@ pub(crate) async fn demo_execution_spl_token_execute( return std::result::Result::Err(error.to_string()); } let amount_raw = request.amount_raw.trim().to_string(); - let operation = kb_lib::ExSplClassicTokenOperation::Instruction { - value: kb_lib::ExSplClassicTokenSingleOperation::TransferChecked { - source: kb_lib::MdPubkey(request.source.trim().to_string()), - mint: kb_lib::MdPubkey(request.mint.trim().to_string()), - destination: kb_lib::MdPubkey(request.destination.trim().to_string()), - authority: kb_lib::ExSplClassicTokenAuthority { - authority: kb_lib::MdPubkey(request.authority.trim().to_string()), + let operation = ks_lib::ExSplClassicTokenOperation::Instruction { + value: ks_lib::ExSplClassicTokenSingleOperation::TransferChecked { + source: ks_lib::MdPubkey(request.source.trim().to_string()), + mint: ks_lib::MdPubkey(request.mint.trim().to_string()), + destination: ks_lib::MdPubkey(request.destination.trim().to_string()), + authority: ks_lib::ExSplClassicTokenAuthority { + authority: ks_lib::MdPubkey(request.authority.trim().to_string()), multisig_signers: std::vec::Vec::new(), }, - amount: kb_lib::ExSplClassicTokenAmount(amount_raw.clone()), + amount: ks_lib::ExSplClassicTokenAmount(amount_raw.clone()), decimals: request.decimals, }, }; - let mut pipeline_request = kb_pipeline_demo_scenarios::DevnetSplTokenExecutionRequest::new( + let mut pipeline_request = ks_pipeline_demo_scenarios::DevnetSplTokenExecutionRequest::new( format!("demo-spl-token-execution-{}", chrono::Utc::now().timestamp_micros()), operation, ); @@ -212,19 +212,19 @@ pub(crate) async fn demo_execution_spl_token_execute( pipeline_request.operator_confirmed = request.operator_confirmed; pipeline_request.post_validation_max_retries = 20; pipeline_request.force_post_validation_replay = request.force_post_validation_replay; - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcSplTokenDecoder)]; - let materializers: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::MtTokenAccountsMaterializer), - std::sync::Arc::new(kb_lib::MtAdminMaterializer), - std::sync::Arc::new(kb_lib::MtRiskMaterializer), + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcSplTokenDecoder)]; + let materializers: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::MtTokenAccountsMaterializer), + std::sync::Arc::new(ks_lib::MtAdminMaterializer), + std::sync::Arc::new(ks_lib::MtRiskMaterializer), ]; let observer = crate::DemoExecutionSolanaCoreObserver { app_handle, cancel_requested: state.demo_execution_solana_core_cancel_requested(), }; let workspace_root = crate::workspace_root_dir(); - let summary = match kb_pipeline_demo_scenarios::execute_devnet_spl_token( + let summary = match ks_pipeline_demo_scenarios::execute_devnet_spl_token( &http_pool, &store, &profile, @@ -266,11 +266,11 @@ pub(crate) async fn demo_spl_token_journal( let needs_payload_filter = validated.mint.is_some() || validated.account.is_some() || validated.operation.is_some(); let query_limit = if needs_payload_filter { - kb_store::MAX_MATERIALIZED_EVENT_QUERY_ROWS + ks_store::MAX_MATERIALIZED_EVENT_QUERY_ROWS } else { validated.limit }; - let filter = match kb_store::MaterializedEventFilter::new( + let filter = match ks_store::MaterializedEventFilter::new( std::option::Option::None, validated.family.clone(), validated.signature_contains.clone(), @@ -279,7 +279,7 @@ pub(crate) async fn demo_spl_token_journal( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; - let rows = match kb_store::DecodePipelineStore::list_materialized_events(&store, &filter).await + let rows = match ks_store::DecodePipelineStore::list_materialized_events(&store, &filter).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), @@ -299,7 +299,7 @@ pub(crate) async fn demo_spl_token_journal( } fn summary_payload( - summary: kb_pipeline_demo_scenarios::DevnetSplTokenExecutionSummary, + summary: ks_pipeline_demo_scenarios::DevnetSplTokenExecutionSummary, amount_raw: std::string::String, decimals: u8, ) -> crate::DemoExecutionSplTokenSummaryPayload { @@ -370,8 +370,8 @@ fn summary_payload( amount_raw, decimals, readiness_status: match summary.stateful_readiness.status { - kb_pipeline::SplTokenStatefulReadinessStatus::Ready => "ready".to_string(), - kb_pipeline::SplTokenStatefulReadinessStatus::Blocked => "blocked".to_string(), + ks_pipeline::SplTokenStatefulReadinessStatus::Ready => "ready".to_string(), + ks_pipeline::SplTokenStatefulReadinessStatus::Blocked => "blocked".to_string(), }, simulation_success: summary.simulation.success, simulation_error: summary.simulation.error, @@ -389,7 +389,7 @@ fn summary_payload( }; } -fn replay_diagnostics(summary: &kb_pipeline::DecodeReplaySummary) -> serde_json::Value { +fn replay_diagnostics(summary: &ks_pipeline::DecodeReplaySummary) -> serde_json::Value { return serde_json::json!({ "campaignId": summary.campaign_id, "selected": summary.selected, @@ -415,10 +415,10 @@ fn replay_diagnostics(summary: &kb_pipeline::DecodeReplaySummary) -> serde_json: fn validate_journal_request( request: crate::DemoSplTokenJournalRequest, ) -> std::result::Result { - if request.limit == 0 || request.limit > kb_store::MAX_MATERIALIZED_EVENT_QUERY_ROWS { + if request.limit == 0 || request.limit > ks_store::MAX_MATERIALIZED_EVENT_QUERY_ROWS { return std::result::Result::Err(format!( "journal limit must be between 1 and {}", - kb_store::MAX_MATERIALIZED_EVENT_QUERY_ROWS + ks_store::MAX_MATERIALIZED_EVENT_QUERY_ROWS )); } if request.profile_name.trim().is_empty() { @@ -499,7 +499,7 @@ fn payload_matches( return true; } -fn journal_row(row: kb_store::MaterializedEventQueryRow) -> DemoSplTokenJournalRow { +fn journal_row(row: ks_store::MaterializedEventQueryRow) -> DemoSplTokenJournalRow { let operation = row .payload_json .get("operation") @@ -605,7 +605,7 @@ mod tests { payload.get("amountRaw").and_then(serde_json::Value::as_str), std::option::Option::Some("18446744073709551615") ); - let row = super::journal_row(kb_store::MaterializedEventQueryRow { + let row = super::journal_row(ks_store::MaterializedEventQueryRow { processor_name: "materializer.token.accounts".to_string(), processor_version: "0.4.4".to_string(), input_key: "input".to_string(), diff --git a/kb-app-demo-desktop/src/demo_spl_token_2022.rs b/kb-app-demo-desktop/src/demo_spl_token_2022.rs index e707f64..d3d4736 100644 --- a/kb-app-demo-desktop/src/demo_spl_token_2022.rs +++ b/kb-app-demo-desktop/src/demo_spl_token_2022.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/demo_spl_token_2022.rs -// version: 12 +// version: 13 //! Thin Tauri adapter for independent public Token-2022 Devnet validation scenarios. @@ -157,7 +157,7 @@ pub(crate) async fn demo_execution_spl_token_2022_execute( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let http_pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let http_pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; @@ -173,7 +173,7 @@ pub(crate) async fn demo_execution_spl_token_2022_execute( std::result::Result::Err(error) => return std::result::Result::Err(error), }; let operation_code = operation.operation_code().to_string(); - let mut pipeline_request = kb_pipeline_demo_scenarios::DevnetSplToken2022ExecutionRequest::new( + let mut pipeline_request = ks_pipeline_demo_scenarios::DevnetSplToken2022ExecutionRequest::new( format!("demo-spl-token-2022-execution-{}", chrono::Utc::now().timestamp_micros()), operation, ); @@ -181,21 +181,21 @@ pub(crate) async fn demo_execution_spl_token_2022_execute( pipeline_request.operator_confirmed = request.operator_confirmed; pipeline_request.post_validation_max_retries = 20; pipeline_request.force_post_validation_replay = request.force_post_validation_replay; - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcSplToken2022Decoder)]; - let materializers: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::MtTokenAccountsMaterializer), - std::sync::Arc::new(kb_lib::MtAdminMaterializer), - std::sync::Arc::new(kb_lib::MtRiskMaterializer), - std::sync::Arc::new(kb_lib::MtFeesMaterializer), - std::sync::Arc::new(kb_lib::MtComplianceAuditMaterializer), + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcSplToken2022Decoder)]; + let materializers: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::MtTokenAccountsMaterializer), + std::sync::Arc::new(ks_lib::MtAdminMaterializer), + std::sync::Arc::new(ks_lib::MtRiskMaterializer), + std::sync::Arc::new(ks_lib::MtFeesMaterializer), + std::sync::Arc::new(ks_lib::MtComplianceAuditMaterializer), ]; let observer = crate::DemoExecutionSolanaCoreObserver { app_handle, cancel_requested: state.demo_execution_solana_core_cancel_requested(), }; let workspace_root = crate::workspace_root_dir(); - let summary = match kb_pipeline_demo_scenarios::execute_devnet_spl_token_2022( + let summary = match ks_pipeline_demo_scenarios::execute_devnet_spl_token_2022( &http_pool, &store, &profile, @@ -321,63 +321,63 @@ pub(crate) fn demo_spl_token_2022_fixture( fn operation_from_request( request: &crate::DemoExecutionSplToken2022Request, -) -> std::result::Result { - let authority = kb_lib::ExSplTokenAuthority { - authority: kb_lib::MdPubkey(request.authority.trim().to_string()), +) -> std::result::Result { + let authority = ks_lib::ExSplTokenAuthority { + authority: ks_lib::MdPubkey(request.authority.trim().to_string()), multisig_signers: std::vec::Vec::new(), }; - let freeze_authority = kb_lib::ExSplTokenAuthority { - authority: kb_lib::MdPubkey(request.freeze_authority.trim().to_string()), + let freeze_authority = ks_lib::ExSplTokenAuthority { + authority: ks_lib::MdPubkey(request.freeze_authority.trim().to_string()), multisig_signers: std::vec::Vec::new(), }; let value = match request.scenario_id.trim() { - "token_2022_mint_to_checked" => kb_lib::ExSplTokenSingleOperation::MintToChecked { - mint: kb_lib::MdPubkey(request.mint.trim().to_string()), - destination: kb_lib::MdPubkey(request.source.trim().to_string()), + "token_2022_mint_to_checked" => ks_lib::ExSplTokenSingleOperation::MintToChecked { + mint: ks_lib::MdPubkey(request.mint.trim().to_string()), + destination: ks_lib::MdPubkey(request.source.trim().to_string()), authority, - amount: kb_lib::ExSplTokenAmount(request.amount_raw.trim().to_string()), + amount: ks_lib::ExSplTokenAmount(request.amount_raw.trim().to_string()), decimals: request.decimals, }, - "token_2022_transfer_checked" => kb_lib::ExSplTokenSingleOperation::TransferChecked { - source: kb_lib::MdPubkey(request.source.trim().to_string()), - mint: kb_lib::MdPubkey(request.mint.trim().to_string()), - destination: kb_lib::MdPubkey(request.destination.trim().to_string()), + "token_2022_transfer_checked" => ks_lib::ExSplTokenSingleOperation::TransferChecked { + source: ks_lib::MdPubkey(request.source.trim().to_string()), + mint: ks_lib::MdPubkey(request.mint.trim().to_string()), + destination: ks_lib::MdPubkey(request.destination.trim().to_string()), authority, - amount: kb_lib::ExSplTokenAmount(request.amount_raw.trim().to_string()), + amount: ks_lib::ExSplTokenAmount(request.amount_raw.trim().to_string()), decimals: request.decimals, }, - "token_2022_approve_checked" => kb_lib::ExSplTokenSingleOperation::ApproveChecked { - source: kb_lib::MdPubkey(request.source.trim().to_string()), - mint: kb_lib::MdPubkey(request.mint.trim().to_string()), - delegate: kb_lib::MdPubkey(request.delegate.trim().to_string()), + "token_2022_approve_checked" => ks_lib::ExSplTokenSingleOperation::ApproveChecked { + source: ks_lib::MdPubkey(request.source.trim().to_string()), + mint: ks_lib::MdPubkey(request.mint.trim().to_string()), + delegate: ks_lib::MdPubkey(request.delegate.trim().to_string()), authority, - amount: kb_lib::ExSplTokenAmount(request.amount_raw.trim().to_string()), + amount: ks_lib::ExSplTokenAmount(request.amount_raw.trim().to_string()), decimals: request.decimals, }, - "token_2022_revoke" => kb_lib::ExSplTokenSingleOperation::Revoke { - source: kb_lib::MdPubkey(request.source.trim().to_string()), + "token_2022_revoke" => ks_lib::ExSplTokenSingleOperation::Revoke { + source: ks_lib::MdPubkey(request.source.trim().to_string()), authority, }, - "token_2022_burn_checked" => kb_lib::ExSplTokenSingleOperation::BurnChecked { - source: kb_lib::MdPubkey(request.source.trim().to_string()), - mint: kb_lib::MdPubkey(request.mint.trim().to_string()), + "token_2022_burn_checked" => ks_lib::ExSplTokenSingleOperation::BurnChecked { + source: ks_lib::MdPubkey(request.source.trim().to_string()), + mint: ks_lib::MdPubkey(request.mint.trim().to_string()), authority, - amount: kb_lib::ExSplTokenAmount(request.amount_raw.trim().to_string()), + amount: ks_lib::ExSplTokenAmount(request.amount_raw.trim().to_string()), decimals: request.decimals, }, - "token_2022_freeze_account" => kb_lib::ExSplTokenSingleOperation::FreezeAccount { - account: kb_lib::MdPubkey(request.source.trim().to_string()), - mint: kb_lib::MdPubkey(request.mint.trim().to_string()), + "token_2022_freeze_account" => ks_lib::ExSplTokenSingleOperation::FreezeAccount { + account: ks_lib::MdPubkey(request.source.trim().to_string()), + mint: ks_lib::MdPubkey(request.mint.trim().to_string()), authority: freeze_authority, }, - "token_2022_thaw_account" => kb_lib::ExSplTokenSingleOperation::ThawAccount { - account: kb_lib::MdPubkey(request.source.trim().to_string()), - mint: kb_lib::MdPubkey(request.mint.trim().to_string()), + "token_2022_thaw_account" => ks_lib::ExSplTokenSingleOperation::ThawAccount { + account: ks_lib::MdPubkey(request.source.trim().to_string()), + mint: ks_lib::MdPubkey(request.mint.trim().to_string()), authority: freeze_authority, }, - "token_2022_close_destination" => kb_lib::ExSplTokenSingleOperation::CloseAccount { - account: kb_lib::MdPubkey(request.source.trim().to_string()), - destination: kb_lib::MdPubkey(request.destination.trim().to_string()), + "token_2022_close_destination" => ks_lib::ExSplTokenSingleOperation::CloseAccount { + account: ks_lib::MdPubkey(request.source.trim().to_string()), + destination: ks_lib::MdPubkey(request.destination.trim().to_string()), authority, }, other => { @@ -386,7 +386,7 @@ fn operation_from_request( )); }, }; - return std::result::Result::Ok(kb_lib::ExSplToken2022Operation::Instruction { + return std::result::Result::Ok(ks_lib::ExSplToken2022Operation::Instruction { value: std::boxed::Box::new(value), }); } @@ -394,7 +394,7 @@ fn operation_from_request( fn summary_payload( scenario_id: std::string::String, operation: std::string::String, - summary: kb_pipeline_demo_scenarios::DevnetSplToken2022ExecutionSummary, + summary: ks_pipeline_demo_scenarios::DevnetSplToken2022ExecutionSummary, ) -> crate::DemoExecutionSplToken2022SummaryPayload { let plan_json = crate::pretty_json(&summary.plan); let preflight_json = crate::pretty_json(&summary.stateful_preflight); @@ -477,7 +477,7 @@ fn parse_fixture( return values; } -fn backfill_summary_json(summary: &kb_pipeline::BackfillSummary) -> serde_json::Value { +fn backfill_summary_json(summary: &ks_pipeline::BackfillSummary) -> serde_json::Value { return serde_json::json!({ "captureSessionId": summary.capture_session_id, "filterCode": summary.filter_code, @@ -505,7 +505,7 @@ fn backfill_summary_json(summary: &kb_pipeline::BackfillSummary) -> serde_json:: }); } -fn core_extraction_summary_json(summary: &kb_pipeline::CoreExtractionSummary) -> serde_json::Value { +fn core_extraction_summary_json(summary: &ks_pipeline::CoreExtractionSummary) -> serde_json::Value { return serde_json::json!({ "processorVersion": summary.processor_version, "selected": summary.selected, @@ -522,7 +522,7 @@ fn core_extraction_summary_json(summary: &kb_pipeline::CoreExtractionSummary) -> }); } -fn decode_replay_summary_json(summary: &kb_pipeline::DecodeReplaySummary) -> serde_json::Value { +fn decode_replay_summary_json(summary: &ks_pipeline::DecodeReplaySummary) -> serde_json::Value { let processors = summary .processors .iter() diff --git a/kb-app-demo-desktop/src/demo_sql_common.rs b/kb-app-demo-desktop/src/demo_sql_common.rs index 7bc73cb..cda9a48 100644 --- a/kb-app-demo-desktop/src/demo_sql_common.rs +++ b/kb-app-demo-desktop/src/demo_sql_common.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/demo_sql_common.rs -// version: 12 +// version: 13 //! Shared SQL demo helpers and serializable payloads. @@ -34,12 +34,12 @@ pub(crate) struct DemoSqlTableSnapshot { pub(crate) latest_created_at: std::option::Option, } -/// Builds PostgreSQL options from the active profile without coupling kb-store to kb-config. +/// Builds PostgreSQL options from the active profile without coupling ks-store to ks-config. pub(crate) fn postgres_store_options_from_profile( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, auto_initialize_schema: bool, -) -> kb_core::Result { - return kb_store::PostgresStoreOptions::new( +) -> ks_core::Result { + return ks_store::PostgresStoreOptions::new( profile.database.postgres.url.clone(), profile.database.postgres.max_connections, profile.database.postgres.connect_timeout_ms, @@ -49,8 +49,8 @@ pub(crate) fn postgres_store_options_from_profile( /// Connects to PostgreSQL without reapplying schemas initialized at application startup. pub(crate) async fn connect_postgres_store( - profile: &kb_config::ProfileConfig, -) -> std::result::Result { + profile: &ks_config::ProfileConfig, +) -> std::result::Result { if !profile.database.enabled { return std::result::Result::Err(std::string::String::from( "database configuration is disabled in the active profile", @@ -62,7 +62,7 @@ pub(crate) async fn connect_postgres_store( std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; options.auto_initialize_schema = false; - let store_result = kb_store::PostgresStore::connect(options).await; + let store_result = ks_store::PostgresStore::connect(options).await; return match store_result { std::result::Result::Ok(store) => std::result::Result::Ok(store), std::result::Result::Err(error) => std::result::Result::Err(error.to_string()), @@ -71,7 +71,7 @@ pub(crate) async fn connect_postgres_store( /// Converts store table diagnostics to the UI payload shape. pub(crate) fn table_snapshot_from_pg( - value: &kb_store::PostgresTableDiagnostics, + value: &ks_store::PostgresTableDiagnostics, ) -> crate::DemoSqlTableSnapshot { let row_count = match &value.statistics { std::option::Option::Some(statistics) => std::option::Option::Some(statistics.row_count), @@ -103,7 +103,7 @@ pub(crate) fn table_snapshot_from_pg( /// Converts many table diagnostics to UI payloads. pub(crate) fn table_snapshots_from_pg( - values: &[kb_store::PostgresTableDiagnostics], + values: &[ks_store::PostgresTableDiagnostics], ) -> std::vec::Vec { let mut output = std::vec::Vec::new(); for value in values { @@ -169,7 +169,7 @@ pub(crate) async fn initialize_postgres_schema_for_startup( ); } tracing::debug!(target: crate::TRACING_TARGET, dsn = masked_dsn.as_str(), "start PostgreSQL schema initialization"); - let store_result = kb_store::PostgresStore::connect(options).await; + let store_result = ks_store::PostgresStore::connect(options).await; let store = match store_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { @@ -218,8 +218,8 @@ pub(crate) fn debug_status(value: T) -> std::string::String fn emit_sql_startup_table_report( splash_window: &tauri::WebviewWindow, - before_tables: &[kb_store::PostgresTableDiagnostics], - after_tables: &[kb_store::PostgresTableDiagnostics], + before_tables: &[ks_store::PostgresTableDiagnostics], + after_tables: &[ks_store::PostgresTableDiagnostics], ) { let mut created_count = 0_u32; let mut existing_count = 0_u32; @@ -268,7 +268,7 @@ fn emit_sql_startup_table_report( } fn table_exists_in( - tables: &[kb_store::PostgresTableDiagnostics], + tables: &[ks_store::PostgresTableDiagnostics], table_name: &str, ) -> std::option::Option { for table in tables { diff --git a/kb-app-demo-desktop/src/demo_sql_replay_candidates.rs b/kb-app-demo-desktop/src/demo_sql_replay_candidates.rs index 71dc8b6..c5b63e8 100644 --- a/kb-app-demo-desktop/src/demo_sql_replay_candidates.rs +++ b/kb-app-demo-desktop/src/demo_sql_replay_candidates.rs @@ -1,11 +1,11 @@ // file: kb-app-demo-desktop/src/demo_sql_replay_candidates.rs -// version: 12 +// version: 13 //! Read-only SQL replay candidate browser commands. use ts_rs::TS; // rust-rules: derive-import -/// One program identifier exposed by the runtime `kb_program_ids` registry. +/// One program identifier exposed by the runtime `ks_program_ids` registry. #[derive(Clone, Debug, serde::Serialize, TS)] #[serde(rename_all = "camelCase")] #[ts( @@ -33,7 +33,7 @@ pub(crate) struct DemoSqlReplayOptionsPayload { pub(crate) masked_dsn: std::string::String, /// Maximum rows accepted by one query. pub(crate) maximum_limit: u32, - /// Program identifiers enumerable from `kb_program_ids`. + /// Program identifiers enumerable from `ks_program_ids`. pub(crate) known_programs: std::vec::Vec, } @@ -136,7 +136,7 @@ pub(crate) struct DemoSqlReplayProgramRequest { export_to = "../frontend/ts/bindings/kb_app_demo_desktop/demo_sql_replay_candidates/DemoSqlReplayProgramRow.ts" )] pub(crate) struct DemoSqlReplayProgramRow { - /// Optional stable code from `kb_program_ids`. + /// Optional stable code from `ks_program_ids`. pub(crate) program_code: std::option::Option, /// Program id. pub(crate) program_id: std::string::String, @@ -251,8 +251,8 @@ pub(crate) async fn demo_sql_replay_options( std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; let mut known_programs = - std::vec::Vec::with_capacity(kb_program_ids::registered_program_ids().len()); - for entry in kb_program_ids::registered_program_ids() { + std::vec::Vec::with_capacity(ks_program_ids::registered_program_ids().len()); + for entry in ks_program_ids::registered_program_ids() { known_programs.push(crate::DemoSqlReplayKnownProgramOption { code: entry.code().to_owned(), program_id: entry.program_id().to_owned(), @@ -261,7 +261,7 @@ pub(crate) async fn demo_sql_replay_options( return std::result::Result::Ok(crate::DemoSqlReplayOptionsPayload { active_profile_name: profile.name, masked_dsn: options.masked_dsn(), - maximum_limit: kb_store::MAX_REPLAY_CANDIDATE_ROWS, + maximum_limit: ks_store::MAX_REPLAY_CANDIDATE_ROWS, known_programs, }); } @@ -281,7 +281,7 @@ pub(crate) async fn load_demo_sql_replay_transactions( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let filter_result = kb_store::PostgresReplayTransactionFilter::new( + let filter_result = ks_store::PostgresReplayTransactionFilter::new( request.signature_contains, request.min_slot, request.max_slot, @@ -322,7 +322,7 @@ pub(crate) async fn load_demo_sql_replay_programs( request: crate::DemoSqlReplayProgramRequest, ) -> std::result::Result, std::string::String> { let filter_result = - kb_store::PostgresReplayProgramFilter::new(request.program_id_contains, request.limit); + ks_store::PostgresReplayProgramFilter::new(request.program_id_contains, request.limit); let filter = match filter_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), @@ -355,7 +355,7 @@ pub(crate) async fn load_demo_sql_replay_entities( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let filter_result = kb_store::PostgresReplayEntityFilter::new( + let filter_result = ks_store::PostgresReplayEntityFilter::new( entity_kind, request.entity_value_contains, request.limit, @@ -383,7 +383,7 @@ pub(crate) async fn load_demo_sql_replay_entities( } fn transaction_row_from_pg( - row: kb_store::PostgresReplayTransactionCandidate, + row: ks_store::PostgresReplayTransactionCandidate, ) -> crate::DemoSqlReplayTransactionRow { return crate::DemoSqlReplayTransactionRow { signature: row.signature, @@ -404,9 +404,9 @@ fn transaction_row_from_pg( } fn program_row_from_pg( - row: kb_store::PostgresReplayProgramSummary, + row: ks_store::PostgresReplayProgramSummary, ) -> crate::DemoSqlReplayProgramRow { - let program_code = kb_program_ids::find_registered_program_id(&row.program_id) + let program_code = ks_program_ids::find_registered_program_id(&row.program_id) .map(|entry| return entry.code().to_owned()); return crate::DemoSqlReplayProgramRow { program_code, @@ -420,7 +420,7 @@ fn program_row_from_pg( }; } -fn entity_row_from_pg(row: kb_store::PostgresReplayEntitySummary) -> crate::DemoSqlReplayEntityRow { +fn entity_row_from_pg(row: ks_store::PostgresReplayEntitySummary) -> crate::DemoSqlReplayEntityRow { return crate::DemoSqlReplayEntityRow { entity_kind: row.entity_kind, entity_value: row.entity_value, @@ -480,19 +480,19 @@ async fn available_csv_export_path( fn program_scope_from_code( code: &str, -) -> std::result::Result { +) -> std::result::Result { return match code { - "any" => std::result::Result::Ok(kb_store::PostgresReplayProgramScope::Any), - "outer" => std::result::Result::Ok(kb_store::PostgresReplayProgramScope::Outer), - "inner" => std::result::Result::Ok(kb_store::PostgresReplayProgramScope::Inner), - "logs" => std::result::Result::Ok(kb_store::PostgresReplayProgramScope::Logs), + "any" => std::result::Result::Ok(ks_store::PostgresReplayProgramScope::Any), + "outer" => std::result::Result::Ok(ks_store::PostgresReplayProgramScope::Outer), + "inner" => std::result::Result::Ok(ks_store::PostgresReplayProgramScope::Inner), + "logs" => std::result::Result::Ok(ks_store::PostgresReplayProgramScope::Logs), _ => std::result::Result::Err(format!("unsupported replay program scope: {code}")), }; } fn optional_entity_kind_from_code( code: std::option::Option<&str>, -) -> std::result::Result, std::string::String> +) -> std::result::Result, std::string::String> { return match code { std::option::Option::Some(value) => { @@ -510,11 +510,11 @@ fn optional_entity_kind_from_code( fn entity_kind_from_code( code: &str, -) -> std::result::Result { +) -> std::result::Result { return match code { - "mint" => std::result::Result::Ok(kb_store::PostgresReplayEntityKind::Mint), - "owner" => std::result::Result::Ok(kb_store::PostgresReplayEntityKind::Owner), - "account_key" => std::result::Result::Ok(kb_store::PostgresReplayEntityKind::AccountKey), + "mint" => std::result::Result::Ok(ks_store::PostgresReplayEntityKind::Mint), + "owner" => std::result::Result::Ok(ks_store::PostgresReplayEntityKind::Owner), + "account_key" => std::result::Result::Ok(ks_store::PostgresReplayEntityKind::AccountKey), _ => std::result::Result::Err(format!("unsupported replay entity kind: {code}")), }; } @@ -524,7 +524,7 @@ mod tests { #[test] fn program_scope_parser_accepts_logs() { let result = super::program_scope_from_code("logs"); - assert_eq!(result, std::result::Result::Ok(kb_store::PostgresReplayProgramScope::Logs)); + assert_eq!(result, std::result::Result::Ok(ks_store::PostgresReplayProgramScope::Logs)); } #[test] @@ -551,8 +551,8 @@ mod tests { #[test] fn program_row_exposes_registered_code() { - let row = kb_store::PostgresReplayProgramSummary { - program_id: kb_program_ids::SYSTEM_PROGRAM_ID.to_owned(), + let row = ks_store::PostgresReplayProgramSummary { + program_id: ks_program_ids::SYSTEM_PROGRAM_ID.to_owned(), transaction_count: 1, outer_instruction_count: 1, inner_instruction_count: 0, diff --git a/kb-app-demo-desktop/src/demo_ws.rs b/kb-app-demo-desktop/src/demo_ws.rs index 42d3dbc..dfa95b4 100644 --- a/kb-app-demo-desktop/src/demo_ws.rs +++ b/kb-app-demo-desktop/src/demo_ws.rs @@ -1,7 +1,7 @@ // file: kb-app-demo-desktop/src/demo_ws.rs -// version: 19 +// version: 20 -//! Standard Solana WebSocket demo commands backed by `kb_onchain_transport::WsSession`. +//! Standard Solana WebSocket demo commands backed by `ks_onchain_transport::WsSession`. use tauri::Emitter; // rust-rules: trait-import use tauri::Manager; // rust-rules: trait-import @@ -179,7 +179,7 @@ pub(crate) struct DemoWsMessagePayload { pub(crate) payload_json: std::string::String, } -/// Connects if needed, then subscribes through `kb_onchain_transport::WsSession`. +/// Connects if needed, then subscribes through `ks_onchain_transport::WsSession`. pub(crate) async fn demo_ws_connect( app_handle: tauri::AppHandle, state: &crate::AppState, @@ -233,7 +233,7 @@ pub(crate) async fn demo_ws_connect( endpoint_url: selected_client.endpoint_url().to_string(), role, method: method.clone(), - request_kind: kb_onchain_transport::request_kind_from_method(&method), + request_kind: ks_onchain_transport::request_kind_from_method(&method), response_kind: acknowledgement.response.kind_name().to_string(), subscription_id: acknowledgement.subscription.remote_subscription_id, response_json, @@ -260,7 +260,7 @@ pub(crate) async fn demo_ws_status( pub(crate) fn demo_ws_list_pool_clients( state: tauri::State<'_, crate::AppState>, ) -> std::result::Result< - std::vec::Vec, + std::vec::Vec, std::string::String, > { let pool = match state.demo_ws_pool() { @@ -384,15 +384,15 @@ impl DemoWsUiRateLimiter { async fn ensure_session( app_handle: &tauri::AppHandle, state: &crate::AppState, - selected_client: kb_onchain_transport::WsClient, -) -> std::result::Result, std::string::String> { + selected_client: ks_onchain_transport::WsClient, +) -> std::result::Result, std::string::String> { let existing = { let guard = state.demo_ws_session().lock().await; guard.clone() }; if let std::option::Option::Some(session) = existing { let snapshot = session.snapshot().await; - if snapshot.state != kb_onchain_transport::WsSessionState::Disconnected { + if snapshot.state != ks_onchain_transport::WsSessionState::Disconnected { if snapshot.endpoint_url != selected_client.endpoint_url() { return std::result::Result::Err(format!( "demo WebSocket session already uses endpoint '{}'; disconnect before selecting '{}'", @@ -404,7 +404,7 @@ async fn ensure_session( } } let reconnect_policy = if selected_client.endpoint_config().auto_reconnect { - match kb_onchain_transport::WsReconnectPolicy::bounded( + match ks_onchain_transport::WsReconnectPolicy::bounded( DEMO_WS_RECONNECT_ATTEMPTS, DEMO_WS_RECONNECT_INITIAL_DELAY_MS, DEMO_WS_RECONNECT_MAX_DELAY_MS, @@ -413,12 +413,12 @@ async fn ensure_session( std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), } } else { - kb_onchain_transport::WsReconnectPolicy::disabled() + ks_onchain_transport::WsReconnectPolicy::disabled() }; - let capabilities = kb_onchain_transport::StandardWsCapabilities::from_endpoint( + let capabilities = ks_onchain_transport::StandardWsCapabilities::from_endpoint( selected_client.endpoint_config(), ); - let session = match kb_onchain_transport::WsSession::connect( + let session = match ks_onchain_transport::WsSession::connect( selected_client, capabilities, reconnect_policy, @@ -438,7 +438,7 @@ async fn ensure_session( fn spawn_event_bridge( app_handle: tauri::AppHandle, - session: std::sync::Arc, + session: std::sync::Arc, ) { let mut receiver = session.subscribe_events(); tauri::async_runtime::spawn(async move { @@ -460,7 +460,7 @@ fn spawn_event_bridge( std::result::Result::Err(tokio::sync::broadcast::error::RecvError::Closed) => break, }; match event { - kb_onchain_transport::WsSessionEvent::Notification { notification, .. } => { + ks_onchain_transport::WsSessionEvent::Notification { notification, .. } => { let compact_payload = match serde_json::to_string(¬ification) { std::result::Result::Ok(payload) => payload, std::result::Result::Err(error) => { @@ -480,10 +480,10 @@ fn spawn_event_bridge( emit_message(&app_handle, "notification", truncate_payload(ui_payload)); } }, - kb_onchain_transport::WsSessionEvent::Diagnostic { code, message } => { + ks_onchain_transport::WsSessionEvent::Diagnostic { code, message } => { emit_message(&app_handle, &code, truncate_payload(message)); }, - kb_onchain_transport::WsSessionEvent::Reconnecting { + ks_onchain_transport::WsSessionEvent::Reconnecting { attempt, maximum_attempts, } => { @@ -494,7 +494,7 @@ fn spawn_event_bridge( ); emit_status(&app_handle, session.snapshot().await); }, - kb_onchain_transport::WsSessionEvent::Reconnected { reconnect_count } => { + ks_onchain_transport::WsSessionEvent::Reconnected { reconnect_count } => { emit_message( &app_handle, "reconnected", @@ -502,13 +502,13 @@ fn spawn_event_bridge( ); emit_status(&app_handle, session.snapshot().await); }, - kb_onchain_transport::WsSessionEvent::Connected - | kb_onchain_transport::WsSessionEvent::SubscriptionAdded(_) - | kb_onchain_transport::WsSessionEvent::SubscriptionRemapped { .. } - | kb_onchain_transport::WsSessionEvent::SubscriptionRemoved(_) => { + ks_onchain_transport::WsSessionEvent::Connected + | ks_onchain_transport::WsSessionEvent::SubscriptionAdded(_) + | ks_onchain_transport::WsSessionEvent::SubscriptionRemapped { .. } + | ks_onchain_transport::WsSessionEvent::SubscriptionRemoved(_) => { emit_status(&app_handle, session.snapshot().await); }, - kb_onchain_transport::WsSessionEvent::Disconnected => { + ks_onchain_transport::WsSessionEvent::Disconnected => { emit_status(&app_handle, session.snapshot().await); break; }, @@ -517,7 +517,7 @@ fn spawn_event_bridge( }); } -fn emit_status(app_handle: &tauri::AppHandle, snapshot: kb_onchain_transport::WsSessionSnapshot) { +fn emit_status(app_handle: &tauri::AppHandle, snapshot: ks_onchain_transport::WsSessionSnapshot) { let window = match app_handle.get_webview_window("demo_ws") { std::option::Option::Some(window) => window, std::option::Option::None => return, @@ -542,7 +542,7 @@ fn emit_message(app_handle: &tauri::AppHandle, kind: &str, payload_json: std::st } fn status_from_snapshot( - snapshot: kb_onchain_transport::WsSessionSnapshot, + snapshot: ks_onchain_transport::WsSessionSnapshot, ) -> crate::DemoWsStatusPayload { let mut subscriptions = std::vec::Vec::new(); for subscription in &snapshot.subscriptions { @@ -567,7 +567,7 @@ fn status_from_snapshot( }, }; return crate::DemoWsStatusPayload { - connected: snapshot.state != kb_onchain_transport::WsSessionState::Disconnected, + connected: snapshot.state != ks_onchain_transport::WsSessionState::Disconnected, endpoint_name: std::option::Option::Some(snapshot.endpoint_name), endpoint_url: std::option::Option::Some(snapshot.endpoint_url), method, @@ -595,7 +595,7 @@ fn disconnected_status() -> crate::DemoWsStatusPayload { } fn build_ws_role_options( - snapshots: std::vec::Vec, + snapshots: std::vec::Vec, ) -> std::vec::Vec { let mut roles = std::collections::BTreeMap::< std::string::String, @@ -635,7 +635,7 @@ fn build_ws_method_options() -> std::vec::Vec { ("voteSubscribe", ("Votes", false, false, false)), ]); let mut options = std::vec::Vec::new(); - for specification in &kb_onchain_transport::STANDARD_WS_SUBSCRIPTIONS { + for specification in &ks_onchain_transport::STANDARD_WS_SUBSCRIPTIONS { let metadata = labels.get(specification.subscribe_method); let (label, requires_target, requires_filter_json, supports_config_json) = match metadata { std::option::Option::Some(metadata) => *metadata, @@ -644,7 +644,7 @@ fn build_ws_method_options() -> std::vec::Vec { options.push(crate::DemoWsMethodOption { method: specification.subscribe_method.to_string(), unsubscribe_method: specification.unsubscribe_method.to_string(), - request_kind: kb_onchain_transport::request_kind_from_method( + request_kind: ks_onchain_transport::request_kind_from_method( specification.subscribe_method, ), label: label.to_string(), @@ -661,7 +661,7 @@ fn build_standard_ws_request( target: std::option::Option, filter_json: std::option::Option, config_json: std::option::Option, -) -> std::result::Result { +) -> std::result::Result { return match method { "accountSubscribe" => { let target = match required_target(target, method) { @@ -669,7 +669,7 @@ fn build_standard_ws_request( std::result::Result::Err(error) => return std::result::Result::Err(error), }; let mut config = match parse_optional_json_as::< - kb_onchain_transport::WsAccountSubscribeConfig, + ks_onchain_transport::WsAccountSubscribeConfig, >(config_json, "configJson") { std::result::Result::Ok(config) => config.unwrap_or_default(), @@ -677,15 +677,15 @@ fn build_standard_ws_request( }; if config.encoding.is_none() { config.encoding = - std::option::Option::Some(kb_onchain_transport::RpcAccountEncoding::Base64); + std::option::Option::Some(ks_onchain_transport::RpcAccountEncoding::Base64); } if let std::result::Result::Err(error) = reject_present(filter_json, "filterJson", method) { return std::result::Result::Err(error); } - std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Account( - kb_onchain_transport::AccountSubscribeRequest { + std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Account( + ks_onchain_transport::AccountSubscribeRequest { pubkey: target, config: std::option::Option::Some(config), }, @@ -695,44 +695,44 @@ fn build_standard_ws_request( if let std::result::Result::Err(error) = reject_present(target, "target", method) { return std::result::Result::Err(error); } - let filter = match parse_required_json_as::( + let filter = match parse_required_json_as::( filter_json, "filterJson", ) { std::result::Result::Ok(filter) => filter, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let config = match parse_optional_json_as::( + let config = match parse_optional_json_as::( config_json, "configJson", ) { std::result::Result::Ok(config) => config, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Block( - kb_onchain_transport::BlockSubscribeRequest { filter, config }, + std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Block( + ks_onchain_transport::BlockSubscribeRequest { filter, config }, )) }, "logsSubscribe" => { if let std::result::Result::Err(error) = reject_present(target, "target", method) { return std::result::Result::Err(error); } - let filter = match parse_required_json_as::( + let filter = match parse_required_json_as::( filter_json, "filterJson", ) { std::result::Result::Ok(filter) => filter, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let config = match parse_optional_json_as::( + let config = match parse_optional_json_as::( config_json, "configJson", ) { std::result::Result::Ok(config) => config, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Logs( - kb_onchain_transport::LogsSubscribeRequest { filter, config }, + std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Logs( + ks_onchain_transport::LogsSubscribeRequest { filter, config }, )) }, "programSubscribe" => { @@ -746,7 +746,7 @@ fn build_standard_ws_request( return std::result::Result::Err(error); } let mut config = match parse_optional_json_as::< - kb_onchain_transport::WsProgramSubscribeConfig, + ks_onchain_transport::WsProgramSubscribeConfig, >(config_json, "configJson") { std::result::Result::Ok(config) => config.unwrap_or_default(), @@ -754,10 +754,10 @@ fn build_standard_ws_request( }; if config.encoding.is_none() { config.encoding = - std::option::Option::Some(kb_onchain_transport::RpcAccountEncoding::Base64); + std::option::Option::Some(ks_onchain_transport::RpcAccountEncoding::Base64); } - std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Program( - kb_onchain_transport::ProgramSubscribeRequest { + std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Program( + ks_onchain_transport::ProgramSubscribeRequest { program_id: target, config: std::option::Option::Some(config), }, @@ -774,14 +774,14 @@ fn build_standard_ws_request( return std::result::Result::Err(error); } let config = match parse_optional_json_as::< - kb_onchain_transport::WsSignatureSubscribeConfig, + ks_onchain_transport::WsSignatureSubscribeConfig, >(config_json, "configJson") { std::result::Result::Ok(config) => config, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Signature( - kb_onchain_transport::SignatureSubscribeRequest { signature: target, config }, + std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Signature( + ks_onchain_transport::SignatureSubscribeRequest { signature: target, config }, )) }, "rootSubscribe" => { @@ -790,8 +790,8 @@ fn build_standard_ws_request( { return std::result::Result::Err(error); } - std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Root( - kb_onchain_transport::RootSubscribeRequest, + std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Root( + ks_onchain_transport::RootSubscribeRequest, )) }, "slotSubscribe" => { @@ -800,8 +800,8 @@ fn build_standard_ws_request( { return std::result::Result::Err(error); } - std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Slot( - kb_onchain_transport::SlotSubscribeRequest, + std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Slot( + ks_onchain_transport::SlotSubscribeRequest, )) }, "slotsUpdatesSubscribe" => { @@ -810,8 +810,8 @@ fn build_standard_ws_request( { return std::result::Result::Err(error); } - std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::SlotsUpdates( - kb_onchain_transport::SlotsUpdatesSubscribeRequest, + std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::SlotsUpdates( + ks_onchain_transport::SlotsUpdatesSubscribeRequest, )) }, "voteSubscribe" => { @@ -820,8 +820,8 @@ fn build_standard_ws_request( { return std::result::Result::Err(error); } - std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Vote( - kb_onchain_transport::VoteSubscribeRequest, + std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Vote( + ks_onchain_transport::VoteSubscribeRequest, )) }, _ => std::result::Result::Err(format!("unsupported standard WebSocket method '{method}'")), @@ -930,30 +930,30 @@ mod tests { std::option::Option::None, ); let account = match account { - std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Account(value)) => { + std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Account(value)) => { value }, _ => panic!("accountSubscribe request was not built"), }; assert_eq!( account.config.and_then(|value| return value.encoding), - std::option::Option::Some(kb_onchain_transport::RpcAccountEncoding::Base64) + std::option::Option::Some(ks_onchain_transport::RpcAccountEncoding::Base64) ); let program = super::build_standard_ws_request( "programSubscribe", - std::option::Option::Some(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()), + std::option::Option::Some(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()), std::option::Option::None, std::option::Option::Some(r#"{"encoding":"jsonParsed"}"#.to_string()), ); let program = match program { - std::result::Result::Ok(kb_onchain_transport::StandardWsRequest::Program(value)) => { + std::result::Result::Ok(ks_onchain_transport::StandardWsRequest::Program(value)) => { value }, _ => panic!("programSubscribe request was not built"), }; assert_eq!( program.config.and_then(|value| return value.encoding), - std::option::Option::Some(kb_onchain_transport::RpcAccountEncoding::JsonParsed) + std::option::Option::Some(ks_onchain_transport::RpcAccountEncoding::JsonParsed) ); } diff --git a/kb-app-demo-desktop/src/main_window.rs b/kb-app-demo-desktop/src/main_window.rs index 731d579..a5eb626 100644 --- a/kb-app-demo-desktop/src/main_window.rs +++ b/kb-app-demo-desktop/src/main_window.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/main_window.rs -// version: 1 +// version: 2 //! Main-window helpers and workspace README loading. @@ -11,12 +11,12 @@ pub(crate) fn workspace_root_dir() -> std::path::PathBuf { }; } -pub(crate) fn load_project_readme() -> kb_core::Result { +pub(crate) fn load_project_readme() -> ks_core::Result { let path = crate::workspace_root_dir().join("README.md"); let content = match std::fs::read_to_string(&path) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::io(format!( + return std::result::Result::Err(ks_core::Error::io(format!( "cannot read project README '{}': {error}", path.display() ))); diff --git a/kb-app-demo-desktop/src/tauri.rs b/kb-app-demo-desktop/src/tauri.rs index 36183f2..ada91f3 100644 --- a/kb-app-demo-desktop/src/tauri.rs +++ b/kb-app-demo-desktop/src/tauri.rs @@ -1,5 +1,5 @@ // file: kb-app-demo-desktop/src/tauri.rs -// version: 34 +// version: 35 //! Tauri runtime assembly and private command wrappers. @@ -9,7 +9,7 @@ use tauri::Manager; // rust-rules: trait-import #[cfg_attr(mobile, tauri::mobile_entry_point)] #[allow(clippy::question_mark_used)] #[allow(clippy::question_mark)] -pub fn run() -> kb_core::Result<()> { +pub fn run() -> ks_core::Result<()> { let rustls_result = install_default_rustls_provider(); if let std::result::Result::Err(error) = rustls_result { return std::result::Result::Err(error); @@ -131,20 +131,20 @@ pub fn run() -> kb_core::Result<()> { let run_result = builder.run(tauri::generate_context!()); return match run_result { std::result::Result::Ok(()) => std::result::Result::Ok(()), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::tauri( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::tauri( format!("cannot run desktop demo application: {error:?}"), )), }; } -fn install_default_rustls_provider() -> kb_core::Result<()> { +fn install_default_rustls_provider() -> ks_core::Result<()> { if rustls::crypto::CryptoProvider::get_default().is_some() { return std::result::Result::Ok(()); } let provider_result = rustls::crypto::aws_lc_rs::default_provider().install_default(); return match provider_result { std::result::Result::Ok(()) => std::result::Result::Ok(()), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::invalid_state( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::invalid_state( format!("cannot install default rustls crypto provider: {error:?}"), )), }; @@ -160,12 +160,12 @@ fn open_or_focus_demo_window( if let std::option::Option::Some(window) = app_handle.get_webview_window(label) { if let std::result::Result::Err(error) = window.show() { return std::result::Result::Err( - kb_core::Error::tauri(format!("cannot show {label} window: {error}")).to_string(), + ks_core::Error::tauri(format!("cannot show {label} window: {error}")).to_string(), ); } if let std::result::Result::Err(error) = window.set_focus() { return std::result::Result::Err( - kb_core::Error::tauri(format!("cannot focus {label} window: {error}")).to_string(), + ks_core::Error::tauri(format!("cannot focus {label} window: {error}")).to_string(), ); } return std::result::Result::Ok(()); @@ -185,12 +185,12 @@ fn open_or_focus_demo_window( std::result::Result::Ok(window) => match window.set_focus() { std::result::Result::Ok(()) => std::result::Result::Ok(()), std::result::Result::Err(error) => std::result::Result::Err( - kb_core::Error::tauri(format!("cannot focus created {label} window: {error}")) + ks_core::Error::tauri(format!("cannot focus created {label} window: {error}")) .to_string(), ), }, std::result::Result::Err(error) => std::result::Result::Err( - kb_core::Error::tauri(format!("cannot create {label} window: {error}")).to_string(), + ks_core::Error::tauri(format!("cannot create {label} window: {error}")).to_string(), ), }; } @@ -256,7 +256,7 @@ fn open_demo_http_window( #[tauri::command] fn demo_http_list_pool_clients( state: tauri::State<'_, crate::AppState>, -) -> std::vec::Vec { +) -> std::vec::Vec { return crate::demo_http_list_pool_clients(state); } @@ -284,7 +284,7 @@ fn open_demo_ws_window( fn demo_ws_list_pool_clients( state: tauri::State<'_, crate::AppState>, ) -> std::result::Result< - std::vec::Vec, + std::vec::Vec, std::string::String, > { return crate::demo_ws_list_pool_clients(state); diff --git a/kb-lib/tests/external_materializer_api.rs b/kb-lib/tests/external_materializer_api.rs deleted file mode 100644 index 8f21498..0000000 --- a/kb-lib/tests/external_materializer_api.rs +++ /dev/null @@ -1,98 +0,0 @@ -// file: kb-lib/tests/external_materializer_api.rs -// version: 8 - -//! Downstream-style compilation contract for externally implemented materializers. - -const ACCEPTED_FAMILIES: &[kb_lib::MdEventFamily] = &[kb_lib::MdEventFamily::Audit]; - -struct ExternalAuditMaterializer; - -fn assert_event_materializer() {} - -fn assert_legacy_materializer() {} - -impl kb_lib::MtApiEventMaterializer for ExternalAuditMaterializer { - fn identity(&self) -> kb_lib::MtApiMaterializerIdentity { - return kb_lib::MtApiMaterializerIdentity { - name: "materializer.external.audit".to_string(), - version: "1".to_string(), - }; - } - - fn accepted_families(&self) -> &'static [kb_lib::MdEventFamily] { - return ACCEPTED_FAMILIES; - } - - fn transaction_policy( - &self, - _family: kb_lib::MdEventFamily, - ) -> kb_lib::MtApiMaterializationTransactionPolicy { - return kb_lib::MtApiMaterializationTransactionPolicy::SuccessfulOrFailedAudit; - } - - fn materialize( - &self, - _observation: &kb_lib::DcApiDecodedObservation, - ) -> kb_lib::MtApiMaterializerExecutionResult { - return kb_lib::MtApiMaterializerExecutionResult::ignored(); - } -} - -#[test] -fn external_materializer_uses_only_the_public_kb_lib_contract() { - let materializer: &dyn kb_lib::MtApiEventMaterializer = &ExternalAuditMaterializer; - assert_eq!(materializer.identity().name, "materializer.external.audit"); - assert_eq!(materializer.accepted_families(), ACCEPTED_FAMILIES); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_event_materializer::(); - assert_legacy_materializer::(); - assert_legacy_materializer::(); - assert_legacy_materializer::(); - assert_legacy_materializer::(); - assert_legacy_materializer::(); - assert_legacy_materializer::(); - assert_legacy_materializer::(); - assert_legacy_materializer::(); - assert_legacy_materializer::(); - assert_legacy_materializer::(); - assert_legacy_materializer::(); - assert_legacy_materializer::(); - assert_legacy_materializer::(); - assert_legacy_materializer::(); - assert_legacy_materializer::(); - assert_legacy_materializer::(); - assert_legacy_materializer::(); - let _ = kb_lib::materializer_admin_materialize_elgamal_registry_state_snapshot; - let _ = kb_lib::materializer_metadata_materialize_metaplex_account_snapshot; - let _ = kb_lib::materializer_metadata_materialize_metaplex_metadata_snapshot; - let _ = kb_lib::materializer_metadata_materialize_solana_program_metadata_account_snapshot; - let _ = kb_lib::materializer_metadata_materialize_solana_program_metadata_buffer_snapshot; - let _ = kb_lib::materializer_metadata_materialize_solana_program_metadata_metadata_snapshot; - let _ = kb_lib::materializer_admin_materialize_token_2022_state_snapshots; - let _ = kb_lib::materializer_fees_materialize_token_2022_state_snapshots; - let _ = kb_lib::materializer_metadata_materialize_token_2022_snapshot; - let _ = kb_lib::materializer_token_materialize_token_2022_state_snapshot; -} diff --git a/kb-lib/tests/external_metaplex_token_metadata_executor_api.rs b/kb-lib/tests/external_metaplex_token_metadata_executor_api.rs deleted file mode 100644 index 48175b9..0000000 --- a/kb-lib/tests/external_metaplex_token_metadata_executor_api.rs +++ /dev/null @@ -1,34 +0,0 @@ -// file: kb-lib/tests/external_metaplex_token_metadata_executor_api.rs -// version: 1 - -//! Downstream-style compilation contract for the Metaplex Token Metadata executor. - -#[test] -fn external_consumers_inspect_metaplex_executor_capabilities_only_through_crate_root_exports() { - let executor = kb_lib::ExMetadataMetaplexTokenMetadataExecutor; - let program_id = kb_lib::MdProgramId( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(), - ); - assert_eq!(kb_lib::EX_METAPLEX_TOKEN_METADATA_SUPPORTED_OPERATION_CODES.len(), 35); - assert_eq!(kb_lib::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_OPERATION_CODES.len(), 15); - for operation_code in kb_lib::EX_METAPLEX_TOKEN_METADATA_SUPPORTED_OPERATION_CODES { - let capability = kb_lib::ExApiTypedInstructionExecutor::capability( - &executor, - &program_id, - operation_code, - ); - assert!(capability.is_supported()); - } - for operation_code in kb_lib::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_OPERATION_CODES { - assert!( - kb_lib::EX_METAPLEX_TOKEN_METADATA_SUPPORTED_OPERATION_CODES.contains(operation_code) - ); - } - let foreign_program_id = kb_lib::MdProgramId(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()); - let foreign_capability = kb_lib::ExApiTypedInstructionExecutor::capability( - &executor, - &foreign_program_id, - kb_lib::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION, - ); - assert!(!foreign_capability.is_supported()); -} diff --git a/kb-lib/tests/external_solana_program_metadata_model_api.rs b/kb-lib/tests/external_solana_program_metadata_model_api.rs deleted file mode 100644 index d3f4b2b..0000000 --- a/kb-lib/tests/external_solana_program_metadata_model_api.rs +++ /dev/null @@ -1,30 +0,0 @@ -// file: kb-lib/tests/external_solana_program_metadata_model_api.rs -// version: 1 - -//! Downstream-style compilation contract for Solana Program Metadata models. - -#[test] -fn external_consumers_use_only_crate_root_model_exports() { - let seed_result = kb_lib::DcMetadataSpmSeed::from_utf8("idl"); - assert!(seed_result.is_ok()); - let seed; - if let std::result::Result::Ok(value) = seed_result { - seed = value; - } else { - return; - } - assert_eq!(seed.trimmed_utf8(), std::result::Result::Ok("idl")); - assert_eq!(seed.as_bytes().len(), kb_lib::DC_METADATA_SPM_SEED_BYTES); - let external = kb_lib::DcMetadataSpmExternalData::from_zeroable_length( - solana_pubkey::Pubkey::new_from_array([9_u8; 32]), - 4, - 8, - ); - let data = kb_lib::DcMetadataSpmData::External(external); - assert_eq!(data.source(), kb_lib::DcMetadataSpmDataSource::External); - assert_eq!(data.wire_length_u32(), std::result::Result::Ok(40),); - assert_eq!(kb_lib::DcMetadataSpmProgramError::InvalidDataLength.code(), 4); - assert_eq!(kb_lib::DC_METADATA_SPM_BUFFER_HEADER_BYTES, 96); - assert_eq!(kb_lib::DC_METADATA_SPM_METADATA_HEADER_BYTES, 96); - assert_eq!(kb_lib::DC_METADATA_SPM_EXTERNAL_DATA_BYTES, 40); -} diff --git a/kb-logging/src/constants.rs b/kb-logging/src/constants.rs deleted file mode 100644 index 057325a..0000000 --- a/kb-logging/src/constants.rs +++ /dev/null @@ -1,5 +0,0 @@ -// file: kb-logging/src/constants.rs -// version: 2 - -/// Canonical tracing target for this crate. -pub(crate) const TRACING_TARGET: &str = "kb-logging"; diff --git a/kb-pipeline/src/constants.rs b/kb-pipeline/src/constants.rs deleted file mode 100644 index b6a4434..0000000 --- a/kb-pipeline/src/constants.rs +++ /dev/null @@ -1,7 +0,0 @@ -// file: kb-pipeline/src/constants.rs -// version: 2 - -//! Pipeline constants. - -/// Canonical tracing target for pipeline orchestration. -pub(crate) const TRACING_TARGET: &str = "kb-pipeline"; diff --git a/kb-pipeline/tests/external_metadata_token_2022_pipeline_api.rs b/kb-pipeline/tests/external_metadata_token_2022_pipeline_api.rs deleted file mode 100644 index 0548611..0000000 --- a/kb-pipeline/tests/external_metadata_token_2022_pipeline_api.rs +++ /dev/null @@ -1,42 +0,0 @@ -// file: kb-pipeline/tests/external_metadata_token_2022_pipeline_api.rs -// version: 1 - -//! External-only coverage for the public Token-2022 Token Metadata pipeline contract. - -#[test] -fn external_consumers_use_only_public_token_2022_metadata_pipeline_exports() { - let account = kb_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([9_u8; 32]).to_string()); - let request = kb_pipeline::Token2022StatefulReadRequest { - query_role: "rpc".to_string(), - account: account.clone(), - kind: kb_lib::DcToken2022StateKind::Mint, - min_context_slot: std::option::Option::Some(42), - max_data_bytes: kb_pipeline::MAX_TOKEN_2022_STATEFUL_ACCOUNT_BYTES, - context: kb_pipeline::Token2022StatefulContext::default(), - }; - assert_eq!(request.account, account); - assert_eq!(request.kind, kb_lib::DcToken2022StateKind::Mint); - assert!( - kb_pipeline::validate_token_2022_metadata_emit_range( - std::option::Option::Some(0), - std::option::Option::Some(32), - ) - .is_ok() - ); - let _emit_inspector: fn( - &kb_lib::ExApiExecutionSimulationResult, - std::option::Option, - std::option::Option, - ) -> kb_core::Result = - kb_pipeline::inspect_token_2022_metadata_emit_simulation; - let _authority_inspector: fn( - &kb_lib::MdPubkey, - std::option::Option<&kb_lib::MdPubkey>, - &kb_pipeline::Token2022StatefulSnapshotBundle, - ) -> kb_pipeline::Token2022ExecutionPostcondition = - kb_pipeline::inspect_token_2022_metadata_authority_postcondition; - const { - assert!(kb_pipeline::MAX_TOKEN_2022_METADATA_EMIT_BYTES > 0); - assert!(kb_pipeline::MAX_TOKEN_2022_STATEFUL_ACCOUNT_BYTES > 0); - } -} diff --git a/kb-store/src/constants.rs b/kb-store/src/constants.rs deleted file mode 100644 index b8657b3..0000000 --- a/kb-store/src/constants.rs +++ /dev/null @@ -1,7 +0,0 @@ -// file: kb-store/src/constants.rs -// version: 1 - -//! Local constants for the `kb-store` crate. - -/// Canonical tracing target for this crate. -pub(crate) const TRACING_TARGET: &str = "kb-store"; diff --git a/kb-config/CHANGELOG.md b/ks-config/CHANGELOG.md similarity index 80% rename from kb-config/CHANGELOG.md rename to ks-config/CHANGELOG.md index 7e85d9c..824e4e7 100644 --- a/kb-config/CHANGELOG.md +++ b/ks-config/CHANGELOG.md @@ -1,7 +1,13 @@ - - + + -# CHANGELOG — kb-config +# CHANGELOG — ks-config + +## `0.5.1-pre.002` + +- renomme `kb-config` en `ks-config` et l'identifiant Rust `kb_config` en `ks_config` ; +- met à jour les chemins TS-RS source vers `frontend/ts/bindings/ks_config` sans livrer les bindings générés ; +- conserve le format de configuration et les variables d'environnement historiques jusqu'aux prereleases dédiées. ## `0.5.0-pre.002` @@ -17,7 +23,7 @@ ## 0.1.0-pre.075 -- validation statique que `kb-config` reste l’unique propriétaire direct de `dotenvy` ; +- validation statique que `ks-config` reste l’unique propriétaire direct de `dotenvy` ; ## 0.1.0-pre.073 @@ -47,14 +53,14 @@ ### Migré -- migration et consolidation de la configuration typée bot2 dans `kb-config` ; +- migration et consolidation de la configuration typée bot2 dans `ks-config` ; - conservation du schéma JSON, des profils, endpoints, listeners, paramètres de stockage, logging, wallet et exécution. ### Modifié - adoption des règles Rust 2024 et Khadhroony ; - export TypeScript contrôlé des types destinés au frontend ; -- validation structurée par `kb_core::Error`. +- validation structurée par `ks_core::Error`. ### Validation diff --git a/kb-config/Cargo.toml b/ks-config/Cargo.toml similarity index 74% rename from kb-config/Cargo.toml rename to ks-config/Cargo.toml index ef223f1..59b8e28 100644 --- a/kb-config/Cargo.toml +++ b/ks-config/Cargo.toml @@ -1,8 +1,8 @@ -# file: kb-config/Cargo.toml -# version: 3 +# file: ks-config/Cargo.toml +# version: 4 [package] -name = "kb-config" +name = "ks-config" version.workspace = true edition.workspace = true license.workspace = true @@ -10,7 +10,7 @@ publish.workspace = true [dependencies] dotenvy.workspace = true -kb-core = { path = "../kb-core" } +ks-core = { path = "../ks-core" } jsonschema.workspace = true serde.workspace = true serde_json.workspace = true diff --git a/kb-config/README.md b/ks-config/README.md similarity index 86% rename from kb-config/README.md rename to ks-config/README.md index 18827ba..07974b8 100644 --- a/kb-config/README.md +++ b/ks-config/README.md @@ -1,9 +1,9 @@ - - + + -# kb-config +# ks-config -`kb-config` définit le contrat de configuration typé du workspace, son schéma JSON embarqué et les fonctions de chargement, résolution d’environnement, validation et sérialisation. +`ks-config` définit le contrat de configuration typé du workspace, son schéma JSON embarqué et les fonctions de chargement, résolution d’environnement, validation et sérialisation. ## Responsabilités @@ -25,8 +25,8 @@ Les principales fonctions sont `read_config_json_file_with_environment`, `parse_ ## Relations -- dépend de `kb-core` pour les erreurs structurées ; -- alimente `kb-logging`, `kb-store`, `kb-onchain-transport`, `kb-pipeline`, `kb-wallet` et les applications ; +- dépend de `ks-core` pour les erreurs structurées ; +- alimente `ks-logging`, `ks-store`, `ks-onchain-transport`, `ks-pipeline`, `ks-wallet` et les applications ; - utilise [`../config/example.config.json`](../config/example.config.json) et [`../config/schema.config.json`](../config/schema.config.json) comme exemple utilisateur et contrat de schéma actifs. ## Statut diff --git a/kb-config/TODO.md b/ks-config/TODO.md similarity index 95% rename from kb-config/TODO.md rename to ks-config/TODO.md index 1e6f5c5..b9fbb7c 100644 --- a/kb-config/TODO.md +++ b/ks-config/TODO.md @@ -1,7 +1,7 @@ - - + + -# TODO — kb-config +# TODO — ks-config ## Série `0.5.x` diff --git a/kb-config/USAGE.md b/ks-config/USAGE.md similarity index 82% rename from kb-config/USAGE.md rename to ks-config/USAGE.md index 5f7939d..063cbfc 100644 --- a/kb-config/USAGE.md +++ b/ks-config/USAGE.md @@ -1,12 +1,12 @@ - - + + -# Utilisation de kb-config +# Utilisation de ks-config ## Chargement recommandé ```rust -let config_result = kb_config::read_config_json_file_with_environment( +let config_result = ks_config::read_config_json_file_with_environment( std::path::Path::new("config/example.config.json"), std::path::Path::new("."), ); @@ -14,7 +14,7 @@ let config = match config_result { Ok(value) => value, Err(error) => return Err(error), }; -let profile = match kb_config::active_profile(&config) { +let profile = match ks_config::active_profile(&config) { Ok(value) => value, Err(error) => return Err(error), }; @@ -25,7 +25,7 @@ Cette fonction charge l’environnement du workspace, résout les placeholders p ## Chargement de l’environnement ```rust -let report = match kb_config::load_workspace_environment(std::path::Path::new(".")) { +let report = match ks_config::load_workspace_environment(std::path::Path::new(".")) { Ok(value) => value, Err(error) => return Err(error), }; @@ -41,7 +41,7 @@ for path in report.loaded_files { ```rust let raw = r#"{"databaseUrl":"${KB_DATABASE_URL:-postgres://localhost/kb}"}"#; -let resolved = kb_config::resolve_environment_placeholders(raw); +let resolved = ks_config::resolve_environment_placeholders(raw); assert!(resolved.contains("databaseUrl")); ``` @@ -51,14 +51,14 @@ Cette API retourne actuellement une chaîne résolue ordinaire et peut donc cont ## Validation et parsing ```rust -if let Err(error) = kb_config::validate_config_json_schema(raw_json) { +if let Err(error) = ks_config::validate_config_json_schema(raw_json) { return Err(error); } -let config = match kb_config::parse_config_json(raw_json) { +let config = match ks_config::parse_config_json(raw_json) { Ok(value) => value, Err(error) => return Err(error), }; -if let Err(error) = kb_config::validate_config(&config) { +if let Err(error) = ks_config::validate_config(&config) { return Err(error); } ``` @@ -68,18 +68,18 @@ if let Err(error) = kb_config::validate_config(&config) { ## Sérialisation ```rust -let compact = match kb_config::serialize_config_json(&config) { +let compact = match ks_config::serialize_config_json(&config) { Ok(value) => value, Err(error) => return Err(error), }; -let pretty = match kb_config::serialize_config_json_pretty(&config) { +let pretty = match ks_config::serialize_config_json_pretty(&config) { Ok(value) => value, Err(error) => return Err(error), }; let write_result = std::fs::write("config/generated.config.json", pretty); if let Err(error) = write_result { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "config_write_failed", format!("cannot write generated configuration: {error}"), )); @@ -91,8 +91,8 @@ La configuration est validée avant sérialisation. ## Schéma embarqué ```rust -let schema_text = kb_config::config_json_schema_text(); -let schema_value = match kb_config::config_json_schema_value() { +let schema_text = ks_config::config_json_schema_text(); +let schema_value = match ks_config::config_json_schema_value() { Ok(value) => value, Err(error) => return Err(error), }; @@ -110,7 +110,7 @@ Le schéma actif est aussi disponible sous [`../config/schema.config.json`](../c ## Sélection du profil actif ```rust -let profile = match kb_config::active_profile(&config) { +let profile = match ks_config::active_profile(&config) { Ok(value) => value, Err(error) => return Err(error), }; @@ -131,7 +131,7 @@ println!("websocket endpoints: {}", profile.solana.ws_endpoints.len()); ## Erreurs et invariants -Les erreurs utilisent `kb_core::Error` avec un code stable. Les validations couvrent notamment l’unicité des profils, l’existence du profil actif, les URLs, les rôles d’endpoints, les limites d’exécution, les routes de logging et les contraintes wallet. +Les erreurs utilisent `ks_core::Error` avec un code stable. Les validations couvrent notamment l’unicité des profils, l’existence du profil actif, les URLs, les rôles d’endpoints, les limites d’exécution, les routes de logging et les contraintes wallet. ## Tests instructifs diff --git a/kb-config/src/environment.rs b/ks-config/src/environment.rs similarity index 96% rename from kb-config/src/environment.rs rename to ks-config/src/environment.rs index ac81709..bcc1b62 100644 --- a/kb-config/src/environment.rs +++ b/ks-config/src/environment.rs @@ -1,5 +1,5 @@ -// file: kb-config/src/environment.rs -// version: 3 +// file: ks-config/src/environment.rs +// version: 4 //! Environment-file loading and configuration placeholder resolution. @@ -16,7 +16,7 @@ pub struct EnvironmentLoadReport { /// fallback text declared with `${NAME:-fallback}` placeholders. pub fn load_workspace_environment( workspace_root: &std::path::Path, -) -> kb_core::Result { +) -> ks_core::Result { let explicit_path = std::env::var("KB_ENV_FILE").ok(); let selected_path = match explicit_path { std::option::Option::Some(path) if !path.trim().is_empty() => { @@ -32,7 +32,7 @@ pub fn load_workspace_environment( std::result::Result::Ok(()) => std::result::Result::Ok(EnvironmentLoadReport { loaded_path: std::option::Option::Some(selected_path), }), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "config_env_file_load_failed", format!("{}: {error}", selected_path.display()), )), diff --git a/kb-config/src/lib.rs b/ks-config/src/lib.rs similarity index 98% rename from kb-config/src/lib.rs rename to ks-config/src/lib.rs index 2f16cd7..7d8e766 100644 --- a/kb-config/src/lib.rs +++ b/ks-config/src/lib.rs @@ -1,5 +1,5 @@ -// file: kb-config/src/lib.rs -// version: 4 +// file: ks-config/src/lib.rs +// version: 5 //! Khadhroony Bot3 workspace configuration contract and loading helpers. #![warn(missing_docs)] diff --git a/kb-config/src/settings.rs b/ks-config/src/settings.rs similarity index 89% rename from kb-config/src/settings.rs rename to ks-config/src/settings.rs index af42dc8..36125d8 100644 --- a/kb-config/src/settings.rs +++ b/ks-config/src/settings.rs @@ -1,5 +1,5 @@ -// file: kb-config/src/settings.rs -// version: 17 +// file: ks-config/src/settings.rs +// version: 18 //! Typed configuration models shared by applications and workers. @@ -9,7 +9,7 @@ const CONFIG_JSON_SCHEMA: &str = include_str!("../../config/schema.config.json") /// Root configuration containing every named profile. #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] -#[ts(export, export_to = "../frontend/ts/bindings/kb_config/settings/AppConfig.ts")] +#[ts(export, export_to = "../frontend/ts/bindings/ks_config/settings/AppConfig.ts")] pub struct AppConfig { /// Active profile name. pub active_profile: std::string::String, @@ -21,7 +21,7 @@ pub struct AppConfig { #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_config/settings/ProfileConfig.ts" + export_to = "../frontend/ts/bindings/ks_config/settings/ProfileConfig.ts" )] pub struct ProfileConfig { /// Profile code. @@ -48,7 +48,7 @@ pub struct ProfileConfig { #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_config/settings/AppSectionConfig.ts" + export_to = "../frontend/ts/bindings/ks_config/settings/AppSectionConfig.ts" )] pub struct AppSectionConfig { /// Application name. @@ -63,7 +63,7 @@ pub struct AppSectionConfig { #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_config/settings/LoggingConfig.ts" + export_to = "../frontend/ts/bindings/ks_config/settings/LoggingConfig.ts" )] pub struct LoggingConfig { /// Default log level. @@ -78,7 +78,7 @@ pub struct LoggingConfig { #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_config/settings/LogTargetConfig.ts" + export_to = "../frontend/ts/bindings/ks_config/settings/LogTargetConfig.ts" )] pub struct LogTargetConfig { /// Output target name. @@ -105,7 +105,7 @@ pub struct LogTargetConfig { #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_config/settings/LogTargetFilterConfig.ts" + export_to = "../frontend/ts/bindings/ks_config/settings/LogTargetFilterConfig.ts" )] pub struct LogTargetFilterConfig { /// Tracing target or crate prefix. @@ -118,7 +118,7 @@ pub struct LogTargetFilterConfig { #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_config/settings/DatabaseConfig.ts" + export_to = "../frontend/ts/bindings/ks_config/settings/DatabaseConfig.ts" )] pub struct DatabaseConfig { /// Enables database storage. @@ -135,7 +135,7 @@ pub struct DatabaseConfig { #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_config/settings/PostgresConfig.ts" + export_to = "../frontend/ts/bindings/ks_config/settings/PostgresConfig.ts" )] pub struct PostgresConfig { /// PostgreSQL URL or local placeholder. @@ -151,7 +151,7 @@ pub struct PostgresConfig { /// SQLite backend configuration. #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] -#[ts(export, export_to = "../frontend/ts/bindings/kb_config/settings/SqliteConfig.ts")] +#[ts(export, export_to = "../frontend/ts/bindings/ks_config/settings/SqliteConfig.ts")] pub struct SqliteConfig { /// SQLite database path. pub path: std::string::String, @@ -170,7 +170,7 @@ pub struct SqliteConfig { /// Local data directory configuration. #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] -#[ts(export, export_to = "../frontend/ts/bindings/kb_config/settings/DataConfig.ts")] +#[ts(export, export_to = "../frontend/ts/bindings/ks_config/settings/DataConfig.ts")] pub struct DataConfig { /// Wallet directory path. pub wallets_directory: std::string::String, @@ -180,7 +180,7 @@ pub struct DataConfig { /// Solana endpoints and listener configuration. #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] -#[ts(export, export_to = "../frontend/ts/bindings/kb_config/settings/SolanaConfig.ts")] +#[ts(export, export_to = "../frontend/ts/bindings/ks_config/settings/SolanaConfig.ts")] pub struct SolanaConfig { /// HTTP JSON-RPC endpoints. pub http_endpoints: std::vec::Vec, @@ -194,7 +194,7 @@ pub struct SolanaConfig { #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_config/settings/HttpEndpointConfig.ts" + export_to = "../frontend/ts/bindings/ks_config/settings/HttpEndpointConfig.ts" )] pub struct HttpEndpointConfig { /// Endpoint name. @@ -223,7 +223,7 @@ pub struct HttpEndpointConfig { #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_config/settings/WsEndpointConfig.ts" + export_to = "../frontend/ts/bindings/ks_config/settings/WsEndpointConfig.ts" )] pub struct WsEndpointConfig { /// Endpoint name. @@ -259,7 +259,7 @@ pub struct WsEndpointConfig { #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_config/settings/EndpointRoleConfig.ts" + export_to = "../frontend/ts/bindings/ks_config/settings/EndpointRoleConfig.ts" )] pub struct EndpointRoleConfig { /// Role code used by endpoint pools. @@ -287,7 +287,7 @@ pub struct EndpointRoleConfig { #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_config/settings/ListenerConfig.ts" + export_to = "../frontend/ts/bindings/ks_config/settings/ListenerConfig.ts" )] pub struct ListenerConfig { /// Enables listener creation. @@ -306,7 +306,7 @@ pub struct ListenerConfig { #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_config/settings/LogListenerConfig.ts" + export_to = "../frontend/ts/bindings/ks_config/settings/LogListenerConfig.ts" )] pub struct LogListenerConfig { /// Listener name. @@ -325,7 +325,7 @@ pub struct LogListenerConfig { #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_config/settings/ProgramListenerConfig.ts" + export_to = "../frontend/ts/bindings/ks_config/settings/ProgramListenerConfig.ts" )] pub struct ProgramListenerConfig { /// Listener name. @@ -344,7 +344,7 @@ pub struct ProgramListenerConfig { #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_config/settings/AccountListenerConfig.ts" + export_to = "../frontend/ts/bindings/ks_config/settings/AccountListenerConfig.ts" )] pub struct AccountListenerConfig { /// Listener name. @@ -361,7 +361,7 @@ pub struct AccountListenerConfig { /// Wallet configuration. #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] -#[ts(export, export_to = "../frontend/ts/bindings/kb_config/settings/WalletConfig.ts")] +#[ts(export, export_to = "../frontend/ts/bindings/ks_config/settings/WalletConfig.ts")] pub struct WalletConfig { /// Wallet directory path. pub wallet_dir: std::string::String, @@ -387,7 +387,7 @@ pub struct WalletConfig { #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_config/settings/ExecutionConfig.ts" + export_to = "../frontend/ts/bindings/ks_config/settings/ExecutionConfig.ts" )] pub struct ExecutionConfig { /// Enables dry-run for newly prepared execution policies. @@ -431,7 +431,7 @@ pub struct ExecutionConfig { /// Demo application configuration. #[derive(Clone, Debug, serde::Deserialize, Eq, PartialEq, serde::Serialize, TS)] -#[ts(export, export_to = "../frontend/ts/bindings/kb_config/settings/DemoConfig.ts")] +#[ts(export, export_to = "../frontend/ts/bindings/ks_config/settings/DemoConfig.ts")] pub struct DemoConfig { /// Enables live demo pages. pub live_demo_enabled: bool, @@ -445,11 +445,11 @@ pub fn config_json_schema_text() -> &'static str { } /// Parses the embedded JSON Schema into a JSON value. -pub fn config_json_schema_value() -> kb_core::Result { +pub fn config_json_schema_value() -> ks_core::Result { let schema_result = serde_json::from_str::(CONFIG_JSON_SCHEMA); return match schema_result { std::result::Result::Ok(schema) => std::result::Result::Ok(schema), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "config_schema_parse_failed", error.to_string(), )), @@ -457,7 +457,7 @@ pub fn config_json_schema_value() -> kb_core::Result { } /// Validates a raw JSON configuration string against the embedded JSON Schema. -pub fn validate_config_json_schema(raw_json: &str) -> kb_core::Result<()> { +pub fn validate_config_json_schema(raw_json: &str) -> ks_core::Result<()> { let schema = match config_json_schema_value() { std::result::Result::Ok(schema) => schema, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -465,7 +465,7 @@ pub fn validate_config_json_schema(raw_json: &str) -> kb_core::Result<()> { let instance = match serde_json::from_str::(raw_json) { std::result::Result::Ok(instance) => instance, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "config_json_parse_failed", error.to_string(), )); @@ -474,7 +474,7 @@ pub fn validate_config_json_schema(raw_json: &str) -> kb_core::Result<()> { let validator = match jsonschema::validator_for(&schema) { std::result::Result::Ok(validator) => validator, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "config_schema_compile_failed", error.to_string(), )); @@ -483,7 +483,7 @@ pub fn validate_config_json_schema(raw_json: &str) -> kb_core::Result<()> { let validation_result = validator.validate(&instance); return match validation_result { std::result::Result::Ok(()) => std::result::Result::Ok(()), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "config_json_schema_validation_failed", error.to_string(), )), @@ -491,7 +491,7 @@ pub fn validate_config_json_schema(raw_json: &str) -> kb_core::Result<()> { } /// Parses the application configuration from a JSON string and validates it. -pub fn parse_config_json(raw_json: &str) -> kb_core::Result { +pub fn parse_config_json(raw_json: &str) -> ks_core::Result { match validate_config_json_schema(raw_json) { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -499,7 +499,7 @@ pub fn parse_config_json(raw_json: &str) -> kb_core::Result { let config = match serde_json::from_str::(raw_json) { std::result::Result::Ok(config) => config, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "config_json_decode_failed", error.to_string(), )); @@ -512,11 +512,11 @@ pub fn parse_config_json(raw_json: &str) -> kb_core::Result { } /// Reads and parses the application configuration from a filesystem path. -pub fn read_config_json_file(path: &std::path::Path) -> kb_core::Result { +pub fn read_config_json_file(path: &std::path::Path) -> ks_core::Result { let raw_json = match std::fs::read_to_string(path) { std::result::Result::Ok(content) => content, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "config_file_read_failed", error.to_string(), )); @@ -529,7 +529,7 @@ pub fn read_config_json_file(path: &std::path::Path) -> kb_core::Result kb_core::Result { +) -> ks_core::Result { match crate::load_workspace_environment(workspace_root) { std::result::Result::Ok(_) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -537,7 +537,7 @@ pub fn read_config_json_file_with_environment( let raw_json = match std::fs::read_to_string(path) { std::result::Result::Ok(content) => content, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "config_file_read_failed", error.to_string(), )); @@ -548,14 +548,14 @@ pub fn read_config_json_file_with_environment( } /// Serializes a configuration value to compact JSON. -pub fn serialize_config_json(config: &AppConfig) -> kb_core::Result { +pub fn serialize_config_json(config: &AppConfig) -> ks_core::Result { match validate_config(config) { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), } return match serde_json::to_string(config) { std::result::Result::Ok(serialized) => std::result::Result::Ok(serialized), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "config_json_serialize_failed", error.to_string(), )), @@ -563,14 +563,14 @@ pub fn serialize_config_json(config: &AppConfig) -> kb_core::Result kb_core::Result { +pub fn serialize_config_json_pretty(config: &AppConfig) -> ks_core::Result { match validate_config(config) { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), } return match serde_json::to_string_pretty(config) { std::result::Result::Ok(serialized) => std::result::Result::Ok(serialized), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "config_json_pretty_serialize_failed", error.to_string(), )), @@ -578,20 +578,20 @@ pub fn serialize_config_json_pretty(config: &AppConfig) -> kb_core::Result kb_core::Result<&ProfileConfig> { +pub fn active_profile(config: &AppConfig) -> ks_core::Result<&ProfileConfig> { for profile in &config.profiles { if profile.name == config.active_profile { return std::result::Result::Ok(profile); } } - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "active_profile_not_found", config.active_profile.clone(), )); } /// Validates a typed configuration after JSON Schema validation and deserialization. -pub fn validate_config(config: &AppConfig) -> kb_core::Result<()> { +pub fn validate_config(config: &AppConfig) -> ks_core::Result<()> { match validate_root_config(config) { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -608,13 +608,13 @@ pub fn validate_config(config: &AppConfig) -> kb_core::Result<()> { }; } -fn validate_root_config(config: &AppConfig) -> kb_core::Result<()> { +fn validate_root_config(config: &AppConfig) -> ks_core::Result<()> { match require_non_empty(&config.active_profile, "active_profile") { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), } if config.profiles.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "config_profiles_empty", "at least one profile is required", )); @@ -627,7 +627,7 @@ fn validate_root_config(config: &AppConfig) -> kb_core::Result<()> { std::result::Result::Err(error) => return std::result::Result::Err(error), } if !names.insert(profile.name.clone()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "profile_name_duplicate", profile.name.clone(), )); @@ -637,7 +637,7 @@ fn validate_root_config(config: &AppConfig) -> kb_core::Result<()> { } } if active_count != 1 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "active_profile_count_invalid", format!("active profile '{}' must match exactly one profile", config.active_profile), )); @@ -645,7 +645,7 @@ fn validate_root_config(config: &AppConfig) -> kb_core::Result<()> { return std::result::Result::Ok(()); } -fn validate_profile(profile: &ProfileConfig) -> kb_core::Result<()> { +fn validate_profile(profile: &ProfileConfig) -> ks_core::Result<()> { match validate_app_section(&profile.app) { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -677,7 +677,7 @@ fn validate_profile(profile: &ProfileConfig) -> kb_core::Result<()> { return validate_wallet_execution_pair(&profile.wallet, &profile.execution); } -fn validate_app_section(config: &AppSectionConfig) -> kb_core::Result<()> { +fn validate_app_section(config: &AppSectionConfig) -> ks_core::Result<()> { match require_non_empty(&config.name, "app.name") { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -685,13 +685,13 @@ fn validate_app_section(config: &AppSectionConfig) -> kb_core::Result<()> { return require_non_empty(&config.environment, "app.environment"); } -fn validate_logging(config: &LoggingConfig) -> kb_core::Result<()> { +fn validate_logging(config: &LoggingConfig) -> ks_core::Result<()> { match validate_log_level(&config.default_level, "logging.default_level") { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), } if config.targets.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "logging_targets_empty", "at least one logging target is required", )); @@ -703,7 +703,7 @@ fn validate_logging(config: &LoggingConfig) -> kb_core::Result<()> { enabled_count += 1; } if !names.insert(target.name.clone()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "logging_target_duplicate", target.name.clone(), )); @@ -724,7 +724,7 @@ fn validate_logging(config: &LoggingConfig) -> kb_core::Result<()> { } } if enabled_count == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "logging_no_enabled_targets", "at least one logging target must be enabled", )); @@ -732,7 +732,7 @@ fn validate_logging(config: &LoggingConfig) -> kb_core::Result<()> { return std::result::Result::Ok(()); } -fn validate_log_target(config: &LogTargetConfig) -> kb_core::Result<()> { +fn validate_log_target(config: &LogTargetConfig) -> ks_core::Result<()> { match require_non_empty(&config.name, "logging.targets.name") { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -742,7 +742,7 @@ fn validate_log_target(config: &LogTargetConfig) -> kb_core::Result<()> { std::result::Result::Err(error) => return std::result::Result::Err(error), } if config.sink != "console" && config.sink != "file" { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "logging_sink_invalid", config.sink.clone(), )); @@ -752,7 +752,7 @@ fn validate_log_target(config: &LogTargetConfig) -> kb_core::Result<()> { && config.rotation != "daily" && config.rotation != "hourly" { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "logging_rotation_invalid", config.rotation.clone(), )); @@ -762,19 +762,19 @@ fn validate_log_target(config: &LogTargetConfig) -> kb_core::Result<()> { && config.format != "pretty" && config.format != "json" { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "logging_format_invalid", config.format.clone(), )); } if config.sink == "file" && config.path.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "logging_file_path_empty", config.name.clone(), )); } if config.sink == "console" && !config.path.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "logging_console_path_not_empty", config.name.clone(), )); @@ -788,9 +788,9 @@ fn validate_log_target(config: &LogTargetConfig) -> kb_core::Result<()> { return std::result::Result::Ok(()); } -fn validate_database(config: &DatabaseConfig) -> kb_core::Result<()> { +fn validate_database(config: &DatabaseConfig) -> ks_core::Result<()> { if config.backend != "postgres" && config.backend != "sqlite" { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "database_backend_invalid", config.backend.clone(), )); @@ -800,13 +800,13 @@ fn validate_database(config: &DatabaseConfig) -> kb_core::Result<()> { std::result::Result::Err(error) => return std::result::Result::Err(error), } if config.postgres.max_connections == 0 || config.sqlite.max_connections == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "database_max_connections_zero", "database connection limits must be greater than zero", )); } if config.postgres.connect_timeout_ms == 0 || config.sqlite.busy_timeout_ms == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "database_timeout_zero", "database timeouts must be greater than zero", )); @@ -814,7 +814,7 @@ fn validate_database(config: &DatabaseConfig) -> kb_core::Result<()> { return require_non_empty(&config.sqlite.path, "database.sqlite.path"); } -fn validate_data(config: &DataConfig) -> kb_core::Result<()> { +fn validate_data(config: &DataConfig) -> ks_core::Result<()> { match require_non_empty(&config.wallets_directory, "data.wallets_directory") { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -822,15 +822,15 @@ fn validate_data(config: &DataConfig) -> kb_core::Result<()> { return require_non_empty(&config.logs_directory, "data.logs_directory"); } -fn validate_solana(config: &SolanaConfig) -> kb_core::Result<()> { +fn validate_solana(config: &SolanaConfig) -> ks_core::Result<()> { if config.http_endpoints.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "http_endpoints_empty", "at least one HTTP JSON-RPC endpoint is required", )); } if config.ws_endpoints.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "ws_endpoints_empty", "at least one standard Solana WebSocket endpoint is required", )); @@ -838,7 +838,7 @@ fn validate_solana(config: &SolanaConfig) -> kb_core::Result<()> { let mut http_names = std::collections::BTreeSet::::new(); for endpoint in &config.http_endpoints { if !http_names.insert(endpoint.name.clone()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "http_endpoint_duplicate", endpoint.name.clone(), )); @@ -851,7 +851,7 @@ fn validate_solana(config: &SolanaConfig) -> kb_core::Result<()> { let mut ws_names = std::collections::BTreeSet::::new(); for endpoint in &config.ws_endpoints { if !ws_names.insert(endpoint.name.clone()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "ws_endpoint_duplicate", endpoint.name.clone(), )); @@ -864,13 +864,13 @@ fn validate_solana(config: &SolanaConfig) -> kb_core::Result<()> { return validate_listeners(&config.listeners); } -fn validate_http_endpoint(config: &HttpEndpointConfig) -> kb_core::Result<()> { +fn validate_http_endpoint(config: &HttpEndpointConfig) -> ks_core::Result<()> { match validate_endpoint_common(&config.name, &config.provider, &config.cluster, &config.roles) { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), } if !config.url.starts_with("http://") && !config.url.starts_with("https://") { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "http_endpoint_url_invalid", config.url.clone(), )); @@ -879,14 +879,14 @@ fn validate_http_endpoint(config: &HttpEndpointConfig) -> kb_core::Result<()> { || config.request_timeout_ms == 0 || config.max_idle_connections_per_host == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "http_endpoint_limit_zero", config.name.clone(), )); } for role in &config.roles { if role.max_subscriptions != 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "http_endpoint_subscriptions_invalid", role.role.clone(), )); @@ -895,13 +895,13 @@ fn validate_http_endpoint(config: &HttpEndpointConfig) -> kb_core::Result<()> { return std::result::Result::Ok(()); } -fn validate_ws_endpoint(config: &WsEndpointConfig) -> kb_core::Result<()> { +fn validate_ws_endpoint(config: &WsEndpointConfig) -> ks_core::Result<()> { match validate_endpoint_common(&config.name, &config.provider, &config.cluster, &config.roles) { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), } if !config.url.starts_with("ws://") && !config.url.starts_with("wss://") { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "ws_endpoint_url_invalid", config.url.clone(), )); @@ -912,7 +912,7 @@ fn validate_ws_endpoint(config: &WsEndpointConfig) -> kb_core::Result<()> { || config.write_channel_capacity == 0 || config.event_channel_capacity == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "ws_endpoint_limit_zero", config.name.clone(), )); @@ -925,7 +925,7 @@ fn validate_endpoint_common( provider: &str, cluster: &str, roles: &[EndpointRoleConfig], -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { match require_non_empty(name, "endpoint.name") { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -939,7 +939,7 @@ fn validate_endpoint_common( std::result::Result::Err(error) => return std::result::Result::Err(error), } if roles.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "endpoint_roles_empty", name.to_string(), )); @@ -947,7 +947,7 @@ fn validate_endpoint_common( let mut role_names = std::collections::BTreeSet::::new(); for role in roles { if !role_names.insert(role.role.clone()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "endpoint_role_duplicate", role.role.clone(), )); @@ -960,13 +960,13 @@ fn validate_endpoint_common( return std::result::Result::Ok(()); } -fn validate_endpoint_role(config: &EndpointRoleConfig) -> kb_core::Result<()> { +fn validate_endpoint_role(config: &EndpointRoleConfig) -> ks_core::Result<()> { match require_non_empty(&config.role, "endpoint.roles.role") { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), } if config.request_kinds.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "endpoint_role_request_kinds_empty", config.role.clone(), )); @@ -982,7 +982,7 @@ fn validate_endpoint_role(config: &EndpointRoleConfig) -> kb_core::Result<()> { || config.max_concurrent_requests == 0 || config.pause_after_rate_limit_ms == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "endpoint_role_limit_zero", config.role.clone(), )); @@ -990,7 +990,7 @@ fn validate_endpoint_role(config: &EndpointRoleConfig) -> kb_core::Result<()> { return std::result::Result::Ok(()); } -fn validate_listeners(config: &ListenerConfig) -> kb_core::Result<()> { +fn validate_listeners(config: &ListenerConfig) -> ks_core::Result<()> { match require_non_empty(&config.default_commitment, "solana.listeners.default_commitment") { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1016,7 +1016,7 @@ fn validate_listeners(config: &ListenerConfig) -> kb_core::Result<()> { return std::result::Result::Ok(()); } -fn validate_log_listener(config: &LogListenerConfig) -> kb_core::Result<()> { +fn validate_log_listener(config: &LogListenerConfig) -> ks_core::Result<()> { match require_non_empty(&config.name, "log_listener.name") { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1028,7 +1028,7 @@ fn validate_log_listener(config: &LogListenerConfig) -> kb_core::Result<()> { return require_non_empty(&config.program_id, "log_listener.program_id"); } -fn validate_program_listener(config: &ProgramListenerConfig) -> kb_core::Result<()> { +fn validate_program_listener(config: &ProgramListenerConfig) -> ks_core::Result<()> { match require_non_empty(&config.name, "program_listener.name") { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1040,7 +1040,7 @@ fn validate_program_listener(config: &ProgramListenerConfig) -> kb_core::Result< return require_non_empty(&config.program_id, "program_listener.program_id"); } -fn validate_account_listener(config: &AccountListenerConfig) -> kb_core::Result<()> { +fn validate_account_listener(config: &AccountListenerConfig) -> ks_core::Result<()> { match require_non_empty(&config.name, "account_listener.name") { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1052,7 +1052,7 @@ fn validate_account_listener(config: &AccountListenerConfig) -> kb_core::Result< return require_non_empty(&config.account_pubkey, "account_listener.account_pubkey"); } -fn validate_wallet(config: &WalletConfig) -> kb_core::Result<()> { +fn validate_wallet(config: &WalletConfig) -> ks_core::Result<()> { match require_non_empty(&config.wallet_dir, "wallet.wallet_dir") { std::result::Result::Ok(()) => (), std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1066,13 +1066,13 @@ fn validate_wallet(config: &WalletConfig) -> kb_core::Result<()> { std::result::Result::Err(error) => return std::result::Result::Err(error), } if config.temporary_wallet_persist && !config.temporary_wallet_enabled { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_temporary_persist_without_enablement", "temporary wallet persistence requires temporary_wallet_enabled", )); } if config.temporary_wallet_enabled && config.cluster == "mainnet-beta" { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_temporary_mainnet_forbidden", "the managed temporary wallet is forbidden on mainnet-beta profiles", )); @@ -1080,9 +1080,9 @@ fn validate_wallet(config: &WalletConfig) -> kb_core::Result<()> { return std::result::Result::Ok(()); } -fn validate_wallet_alias(value: &str) -> kb_core::Result<()> { +fn validate_wallet_alias(value: &str) -> ks_core::Result<()> { if value.is_empty() || value.len() > 64 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_alias_length_invalid", "temporary wallet alias length must be between 1 and 64 bytes", )); @@ -1090,7 +1090,7 @@ fn validate_wallet_alias(value: &str) -> kb_core::Result<()> { if !value.bytes().enumerate().all(|(index, byte)| { return byte.is_ascii_alphanumeric() || (index > 0 && (byte == b'_' || byte == b'-')); }) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_alias_invalid", "temporary wallet alias contains invalid characters", )); @@ -1098,44 +1098,44 @@ fn validate_wallet_alias(value: &str) -> kb_core::Result<()> { return std::result::Result::Ok(()); } -fn validate_execution(config: &ExecutionConfig) -> kb_core::Result<()> { +fn validate_execution(config: &ExecutionConfig) -> ks_core::Result<()> { let configured_spend = config .localnet_max_spend_lamports .saturating_add(config.devnet_max_spend_lamports) .saturating_add(config.testnet_max_spend_lamports) .saturating_add(config.mainnet_max_spend_lamports); if configured_spend > 0 && !config.require_simulation { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spend_without_simulation", "any configured spend requires simulation", )); } if config.mainnet_max_spend_lamports > 0 && !config.require_operator_confirmation { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_mainnet_without_confirmation", "mainnet spend requires operator confirmation", )); } if config.max_fee_lamports == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_fee_limit_zero", "max_fee_lamports must be greater than zero", )); } if config.recent_blockhash_max_age_slots == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_blockhash_age_zero", "recent_blockhash_max_age_slots must be greater than zero", )); } if config.confirmation_poll_interval_ms == 0 || config.confirmation_poll_interval_ms > 60_000 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_confirmation_poll_interval_invalid", "confirmation_poll_interval_ms must be between 1 and 60000", )); } if config.confirmation_max_attempts == 0 || config.confirmation_max_attempts > 10_000 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_confirmation_attempts_invalid", "confirmation_max_attempts must be between 1 and 10000", )); @@ -1146,7 +1146,7 @@ fn validate_execution(config: &ExecutionConfig) -> kb_core::Result<()> { fn validate_wallet_execution_pair( wallet: &WalletConfig, execution: &ExecutionConfig, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { for (enabled, limit, cluster) in [ (wallet.localnet_send_enabled, execution.localnet_max_spend_lamports, "localnet"), (wallet.devnet_send_enabled, execution.devnet_max_spend_lamports, "devnet"), @@ -1158,20 +1158,20 @@ fn validate_wallet_execution_pair( ), ] { if enabled && limit == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_enabled_cluster_without_spend_limit", format!("{cluster} sending requires a positive spend limit"), )); } } if wallet.mainnet_send_enabled && !execution.require_operator_confirmation { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_mainnet_send_without_confirmation", "mainnet sending requires operator confirmation", )); } if wallet.cluster != "devnet" && execution.devnet_airdrop_max_lamports > 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_devnet_airdrop_on_non_devnet_profile", "devnet_airdrop_max_lamports must be zero outside devnet profiles", )); @@ -1179,7 +1179,7 @@ fn validate_wallet_execution_pair( return std::result::Result::Ok(()); } -fn validate_log_level(value: &str, field_name: &str) -> kb_core::Result<()> { +fn validate_log_level(value: &str, field_name: &str) -> ks_core::Result<()> { if value == "trace" || value == "debug" || value == "info" @@ -1189,15 +1189,15 @@ fn validate_log_level(value: &str, field_name: &str) -> kb_core::Result<()> { { return std::result::Result::Ok(()); } - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "log_level_invalid", format!("{field_name}: {value}"), )); } -fn require_non_empty(value: &str, field_name: &str) -> kb_core::Result<()> { +fn require_non_empty(value: &str, field_name: &str) -> ks_core::Result<()> { if value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "config_field_empty", field_name.to_string(), )); @@ -1349,8 +1349,8 @@ mod tests { ("info.log", "info", "human"), ("error.jsonl", "error", "json"), ] { - let route_directory = if crate_name == "kb-pipeline-demo-scenarios" { - "kb-pipeline" + let route_directory = if crate_name == "ks-pipeline-demo-scenarios" { + "ks-pipeline" } else { crate_name.as_str() }; @@ -1380,10 +1380,10 @@ mod tests { std::result::Result::Err(error) => panic!("example config must parse: {error}"), }; assert!(!EXAMPLE_CONFIG.contains("api-key=95e73621")); - assert!(!EXAMPLE_CONFIG.contains("\"kb_wallet\"")); + assert!(!EXAMPLE_CONFIG.contains("\"ks_wallet\"")); for profile in config.profiles { assert!(profile.logging.targets.iter().any(|target| { - return target.enabled && target.targets == std::vec!["kb-wallet".to_string()]; + return target.enabled && target.targets == std::vec!["ks-wallet".to_string()]; })); } } @@ -1391,11 +1391,11 @@ mod tests { #[test] fn example_config_uses_canonical_pipeline_tracing_routes() { let source = include_str!("../../config/example.config.json"); - assert!(source.contains("\"kb-pipeline\"")); - assert!(source.contains("logs/devnet/kb-pipeline/debug.log")); - assert!(source.contains("logs/mainnet_research/kb-pipeline/info.log")); - assert!(source.contains("logs/mainnet/kb-pipeline/error.jsonl")); - assert!(!source.contains("kb_pipeline")); + assert!(source.contains("\"ks-pipeline\"")); + assert!(source.contains("logs/devnet/ks-pipeline/debug.log")); + assert!(source.contains("logs/mainnet_research/ks-pipeline/info.log")); + assert!(source.contains("logs/mainnet/ks-pipeline/error.jsonl")); + assert!(!source.contains("ks_pipeline")); } #[test] diff --git a/kb-core/CHANGELOG.md b/ks-core/CHANGELOG.md similarity index 71% rename from kb-core/CHANGELOG.md rename to ks-core/CHANGELOG.md index 7f0b6cd..0d44e79 100644 --- a/kb-core/CHANGELOG.md +++ b/ks-core/CHANGELOG.md @@ -1,7 +1,12 @@ - - + + -# CHANGELOG — kb-core +# CHANGELOG — ks-core + +## `0.5.1-pre.002` + +- renomme le package et le répertoire `kb-core` en `ks-core` et l'identifiant Rust `kb_core` en `ks_core` ; +- met à jour ses consommateurs, chemins documentaires et tests sans changer les primitives d'erreur partagées. ## 0.4.6 @@ -21,6 +26,6 @@ ## 0.1.0-pre.062 -- migration des primitives communes vers la crate consolidée `kb-core` ; +- migration des primitives communes vers la crate consolidée `ks-core` ; - maintien d’un type d’erreur explicite sans `anyhow` ni `thiserror` ; - adaptation aux normes Rust 2024 et Khadhroony bot3. diff --git a/kb-core/Cargo.toml b/ks-core/Cargo.toml similarity index 70% rename from kb-core/Cargo.toml rename to ks-core/Cargo.toml index 2e41b7e..6fcf850 100644 --- a/kb-core/Cargo.toml +++ b/ks-core/Cargo.toml @@ -1,8 +1,8 @@ -# file: kb-core/Cargo.toml -# version: 1 +# file: ks-core/Cargo.toml +# version: 2 [package] -name = "kb-core" +name = "ks-core" version.workspace = true edition.workspace = true license.workspace = true diff --git a/kb-core/README.md b/ks-core/README.md similarity index 81% rename from kb-core/README.md rename to ks-core/README.md index 7920cb8..84787c7 100644 --- a/kb-core/README.md +++ b/ks-core/README.md @@ -1,9 +1,9 @@ - - + + -# kb-core +# ks-core -`kb-core` fournit les primitives minimales partagées par l’ensemble de `khadhroony-bot3`. +`ks-core` fournit les primitives minimales partagées par l’ensemble de `khadhroony-bot3`. ## Responsabilités @@ -26,7 +26,7 @@ Voir [USAGE.md](USAGE.md) pour les exemples. ## Relations -`kb-core` est utilisée par toutes les crates qui ont besoin d’un contrat d’erreur ou d’une identité de module partagée. Elle ne contient ni configuration, ni transport, ni stockage, ni logique Solana. +`ks-core` est utilisée par toutes les crates qui ont besoin d’un contrat d’erreur ou d’une identité de module partagée. Elle ne contient ni configuration, ni transport, ni stockage, ni logique Solana. ## Documentation diff --git a/kb-core/TODO.md b/ks-core/TODO.md similarity index 79% rename from kb-core/TODO.md rename to ks-core/TODO.md index 0ce088d..eef8582 100644 --- a/kb-core/TODO.md +++ b/ks-core/TODO.md @@ -1,7 +1,7 @@ - - + + -# TODO — kb-core +# TODO — ks-core ## Versions ultérieures diff --git a/kb-core/USAGE.md b/ks-core/USAGE.md similarity index 75% rename from kb-core/USAGE.md rename to ks-core/USAGE.md index 924aace..181d6e1 100644 --- a/kb-core/USAGE.md +++ b/ks-core/USAGE.md @@ -1,7 +1,7 @@ - - + + -# Utilisation de kb-core +# Utilisation de ks-core ## Objectif @@ -10,9 +10,9 @@ La crate expose les contrats minimaux communs utilisés par les autres crates du ## Résultat partagé ```rust -fn validate_name(name: &str) -> kb_core::Result<()> { +fn validate_name(name: &str) -> ks_core::Result<()> { if name.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "name_empty", "name must not be empty", )); @@ -25,7 +25,7 @@ fn validate_name(name: &str) -> kb_core::Result<()> { ## Erreur personnalisée stable ```rust -let error = kb_core::Error::new( +let error = ks_core::Error::new( "profile_missing", "the requested profile does not exist", ); @@ -42,9 +42,9 @@ assert_eq!( ## Familles d’erreur ```rust -let config_error = kb_core::Error::config("missing active profile"); -let io_error = kb_core::Error::io("cannot read configuration file"); -let db_error = kb_core::Error::db("database connection refused"); +let config_error = ks_core::Error::config("missing active profile"); +let io_error = ks_core::Error::io("cannot read configuration file"); +let db_error = ks_core::Error::db("database connection refused"); assert_eq!(config_error.code(), "config"); assert_eq!(io_error.code(), "io"); @@ -58,13 +58,13 @@ Les constructeurs publics disponibles couvrent notamment la configuration, les I ```rust let read_result = std::fs::read_to_string("missing.file"); -let core_result: kb_core::Result = +let core_result: ks_core::Result = match read_result { std::result::Result::Ok(value) => { std::result::Result::Ok(value) }, std::result::Result::Err(error) => { - std::result::Result::Err(kb_core::Error::from(error)) + std::result::Result::Err(ks_core::Error::from(error)) }, }; ``` @@ -72,17 +72,17 @@ let core_result: kb_core::Result = ## Identité d’un module ```rust -let name = kb_core::ModuleName( +let name = ks_core::ModuleName( "spl_token_decoder".to_string(), ); -let version = kb_core::ModuleVersion( +let version = ks_core::ModuleVersion( "0.4.6".to_string(), ); -let kind = kb_core::ModuleKind::Decoder; +let kind = ks_core::ModuleKind::Decoder; assert_eq!(name.0, "spl_token_decoder"); assert_eq!(version.0, "0.4.6"); -assert_eq!(kind, kb_core::ModuleKind::Decoder); +assert_eq!(kind, ks_core::ModuleKind::Decoder); ``` `ModuleKind` distingue actuellement les ingestors, extractors, observers, decoders, materializers, aggregators et validators. @@ -103,6 +103,6 @@ Ces tests illustrent le contrat stable entre code, message et représentation te ## Limites durables -- `kb-core` ne remplace pas les types métier spécialisés ; +- `ks-core` ne remplace pas les types métier spécialisés ; - elle ne fournit pas de journalisation ni de sérialisation automatique des erreurs ; - elle ne contient pas de logique de transport, stockage ou protocole. diff --git a/kb-core/src/error.rs b/ks-core/src/error.rs similarity index 99% rename from kb-core/src/error.rs rename to ks-core/src/error.rs index ce21e38..28b9bed 100644 --- a/kb-core/src/error.rs +++ b/ks-core/src/error.rs @@ -1,5 +1,5 @@ -// file: kb-core/src/error.rs -// version: 6 +// file: ks-core/src/error.rs +// version: 7 //! Error and result primitives shared by the workspace. diff --git a/kb-core/src/lib.rs b/ks-core/src/lib.rs similarity index 92% rename from kb-core/src/lib.rs rename to ks-core/src/lib.rs index 6c42af2..8c4d95e 100644 --- a/kb-core/src/lib.rs +++ b/ks-core/src/lib.rs @@ -1,5 +1,5 @@ -// file: kb-core/src/lib.rs -// version: 2 +// file: ks-core/src/lib.rs +// version: 3 //! Core primitives, module identity and shared errors for the workspace. #![warn(missing_docs)] diff --git a/kb-core/src/module.rs b/ks-core/src/module.rs similarity index 94% rename from kb-core/src/module.rs rename to ks-core/src/module.rs index 0e66553..50bf364 100644 --- a/kb-core/src/module.rs +++ b/ks-core/src/module.rs @@ -1,5 +1,5 @@ -// file: kb-core/src/module.rs -// version: 1 +// file: ks-core/src/module.rs +// version: 2 //! Module identity and module-kind primitives. diff --git a/kb-lib/CHANGELOG.md b/ks-lib/CHANGELOG.md similarity index 97% rename from kb-lib/CHANGELOG.md rename to ks-lib/CHANGELOG.md index a6f3973..0056cf1 100644 --- a/kb-lib/CHANGELOG.md +++ b/ks-lib/CHANGELOG.md @@ -1,7 +1,12 @@ - - + + -# CHANGELOG — kb-lib +# CHANGELOG — ks-lib + +## `0.5.1-pre.002` + +- renomme physiquement `kb-lib` en `ks-lib` et l'identifiant Rust public `kb_lib` en `ks_lib` dans les consommateurs et tests d'API externe ; +- conserve volontairement les identités runtime/persistées `kb-lib.*` pour `0.5.1-pre.003`, afin de séparer le renommage Cargo de la migration de provenance/replay. ## `0.4.8-pre.015` — réconciliation des matrices Metadata @@ -104,7 +109,7 @@ - ajoute les helpers publics de matérialisation d’états et le test d’API externe correspondant. - corrige le helper de test de snapshot afin d’utiliser les variantes wire existantes `Encoding::Utf8` et `Format::Json`. - précise que les opérations destructrices, irréversibles ou écrasantes restent exécutables : leur progression vers simulation, signature et envoi doit être gouvernée par le cadre commun `ExSafetyChecker`, et non supprimée du périmètre de l’exécuteur. -- validation reçue le 5 août 2026 : `cargo fmt`, `cargo check --workspace`, `cargo clippy --all-targets`, audit workspace et 667 tests unitaires `kb-lib` réussis, avec les tests d’API externes et les doc-tests. +- validation reçue le 5 août 2026 : `cargo fmt`, `cargo check --workspace`, `cargo clippy --all-targets`, audit workspace et 667 tests unitaires `ks-lib` réussis, avec les tests d’API externes et les doc-tests. ## 0.4.8-pre.005 — instructions Solana Program Metadata @@ -117,7 +122,7 @@ - retire le décodeur Solana Program Metadata de l’inventaire des décodeurs réservés. - aligne la structure du composant sur les règles du workspace : façade limitée aux sous-modules et réexports, implémentation déplacée dans `decoder.rs`, constantes centralisées dans `constants.rs` et accès internes via `crate::`. - corrige les vecteurs négatifs `Initialize` afin de placer explicitement les valeurs invalides après les 16 octets du seed et de vérifier séparément `Encoding`, `Compression`, `Format` et `DataSource`. -- validation reçue le 5 août 2026 : `cargo fmt`, `cargo check --workspace`, `cargo clippy --all-targets`, audit workspace et 660 tests unitaires `kb-lib` réussis, ainsi que les tests d’API externes et la matrice de nomenclature. +- validation reçue le 5 août 2026 : `cargo fmt`, `cargo check --workspace`, `cargo clippy --all-targets`, audit workspace et 660 tests unitaires `ks-lib` réussis, ainsi que les tests d’API externes et la matrice de nomenclature. ## 0.4.8-pre.004 — comptes Solana Program Metadata @@ -149,7 +154,7 @@ - réorganisation de `README.md`, `USAGE.md`, `TODO.md` et du changelog selon leur rôle documentaire ; - suppression des tâches Metaplex terminées du TODO ; -- maintien des campagnes réseau hors du TODO de `kb-lib`, la surface de builders étant achevée. +- maintien des campagnes réseau hors du TODO de `ks-lib`, la surface de builders étant achevée. ## 0.4.7-pre.006 — fermeture de l’exécuteur Metaplex diff --git a/kb-lib/Cargo.toml b/ks-lib/Cargo.toml similarity index 92% rename from kb-lib/Cargo.toml rename to ks-lib/Cargo.toml index 59098d5..cea0fc7 100644 --- a/kb-lib/Cargo.toml +++ b/ks-lib/Cargo.toml @@ -1,8 +1,8 @@ -# file: kb-lib/Cargo.toml -# version: 15 +# file: ks-lib/Cargo.toml +# version: 16 [package] -name = "kb-lib" +name = "ks-lib" version.workspace = true edition.workspace = true license.workspace = true @@ -14,8 +14,8 @@ base64.workspace = true borsh.workspace = true borsh_0_10.workspace = true bs58.workspace = true -kb-core = { path = "../kb-core" } -kb-program-ids = { path = "../kb-program-ids" } +ks-core = { path = "../ks-core" } +ks-program-ids = { path = "../ks-program-ids" } mpl-token-metadata.workspace = true serde.workspace = true serde_json.workspace = true diff --git a/kb-lib/README.md b/ks-lib/README.md similarity index 94% rename from kb-lib/README.md rename to ks-lib/README.md index bdc360c..be91b66 100644 --- a/kb-lib/README.md +++ b/ks-lib/README.md @@ -1,9 +1,9 @@ - - + + -# kb-lib +# ks-lib -`kb-lib` est la bibliothèque fonctionnelle consolidée de `khadhroony-bot3`. Elle fournit les modèles, décodeurs, matérialisateurs, exécuteurs et contrats de sécurité indépendants du transport, du stockage et de l’interface utilisateur. +`ks-lib` est la bibliothèque fonctionnelle consolidée de `khadhroony-bot3`. Elle fournit les modèles, décodeurs, matérialisateurs, exécuteurs et contrats de sécurité indépendants du transport, du stockage et de l’interface utilisateur. ## Périmètre @@ -63,7 +63,7 @@ L’inventaire audité comprend 25 composants nommés : onze matérialisateurs a ## Hors périmètre -`kb-lib` ne sélectionne aucun endpoint, ne lit pas directement un RPC, ne persiste aucune donnée, ne gère pas les secrets de wallet et ne soumet aucune transaction. +`ks-lib` ne sélectionne aucun endpoint, ne lit pas directement un RPC, ne persiste aucune donnée, ne gère pas les secrets de wallet et ne soumet aucune transaction. ## Surface publique principale @@ -80,13 +80,13 @@ Les exemples d’appel et invariants sont documentés dans [USAGE.md](USAGE.md). ## Relations avec le workspace -- dépend de `kb-core` et `kb-program-ids` ; -- est consommée par `kb-pipeline`, `kb-store`, `kb-onchain-transport`, `kb-pipeline-demo-scenarios` et `kb-app-demo-desktop` ; -- ne dépend jamais de `kb-store`, `kb-pipeline` ni d’une application. +- dépend de `ks-core` et `ks-program-ids` ; +- est consommée par `ks-pipeline`, `ks-store`, `ks-onchain-transport`, `ks-pipeline-demo-scenarios` et `kb-app-demo-desktop` ; +- ne dépend jamais de `ks-store`, `ks-pipeline` ni d’une application. ## Statut et limites -La surface fonctionnelle Metaplex de la crate est achevée. Les campagnes Devnet restantes relèvent de `kb-pipeline-demo-scenarios` et de `kb-app-demo-desktop`, non d’un manque de builder dans `kb-lib`. +La surface fonctionnelle Metaplex de la crate est achevée. Les campagnes Devnet restantes relèvent de `ks-pipeline-demo-scenarios` et de `kb-app-demo-desktop`, non d’un manque de builder dans `ks-lib`. Pour Solana Program Metadata, les modèles wire, les décodeurs bornés de comptes, le décodeur contextualisé, la matérialisation des deux comptes et des neuf instructions stables, ainsi que l’exécuteur typé des neuf opérations sont actifs. `Buffer` accepte tout reliquat comme données allouées sans inventer de PDA stable après changement d’autorité ; `Metadata` valide la dérivation canonical ou non-canonical et distingue le contenu logique de la capacité ajoutée par `Extend`. Les instructions produisent des faits committés non autoritatifs ; les snapshots post-exécution restent la source de l’état final. Les variantes qui dépendent de l’état du compte restent des intentions wire jusqu’aux lectures stateful prévues, et aucune forme pré-stable n’est déclarée compatible réseau sans preuve de cluster. diff --git a/kb-lib/TODO.md b/ks-lib/TODO.md similarity index 96% rename from kb-lib/TODO.md rename to ks-lib/TODO.md index e460108..efb8e45 100644 --- a/kb-lib/TODO.md +++ b/ks-lib/TODO.md @@ -1,7 +1,7 @@ - - + + -# TODO — kb-lib +# TODO — ks-lib ## `0.5.x` — audit transversal décodage, matérialisation, exécution et sécurité diff --git a/kb-lib/USAGE.md b/ks-lib/USAGE.md similarity index 90% rename from kb-lib/USAGE.md rename to ks-lib/USAGE.md index 5f5d277..8353f5c 100644 --- a/kb-lib/USAGE.md +++ b/ks-lib/USAGE.md @@ -1,27 +1,27 @@ - - + + -# Utilisation de kb-lib +# Utilisation de ks-lib ## Objectif -Ce guide présente les familles d’API publiques significatives de `kb-lib`. Les helpers privés, éléments `pub(crate)` et modules non réexportés ne font pas partie du contrat consommateur. +Ce guide présente les familles d’API publiques significatives de `ks-lib`. Les helpers privés, éléments `pub(crate)` et modules non réexportés ne font pas partie du contrat consommateur. ## Dépendance ```toml [dependencies] -kb-lib = { path = "../kb-lib" } +ks-lib = { path = "../ks-lib" } ``` -Toutes les fonctions retournant `kb_core::Result` utilisent le contrat d’erreur structuré du workspace. +Toutes les fonctions retournant `ks_core::Result` utilisent le contrat d’erreur structuré du workspace. ## Décodage contextualisé `DcApiInstructionDecoder` définit la reconnaissance et le décodage d’une instruction contextualisée. Les décodeurs concrets sont des valeurs sans état. ```rust -use kb_lib::{DcApiInstructionDecoder, DcSolanaCoreDecoder}; +use ks_lib::{DcApiInstructionDecoder, DcSolanaCoreDecoder}; let decoder = DcSolanaCoreDecoder; let recognition = DcApiInstructionDecoder::recognize(&decoder, &input); @@ -59,8 +59,8 @@ Les types réservés `Dc*Decoder` ne doivent pas être interprétés comme des d ## Lecture d’états Token-2022 et ElGamal ```rust -let state = match kb_lib::decoder_spl_token_2022_parse_token_2022_state( - kb_lib::DcToken2022StateKind::Account, +let state = match ks_lib::decoder_spl_token_2022_parse_token_2022_state( + ks_lib::DcToken2022StateKind::Account, &account_data, ) { Ok(value) => value, @@ -71,7 +71,7 @@ println!("parsed token-2022 state: {state:#?}"); ``` ```rust -let registry = match kb_lib::decoder_spl_elgamal_registry_parse_elgamal_registry_state( +let registry = match ks_lib::decoder_spl_elgamal_registry_parse_elgamal_registry_state( &account_data, ) { Ok(value) => value, @@ -88,23 +88,23 @@ Les parseurs vérifient les bornes et formats qu’ils annoncent. Ils ne reconst Les modèles `DcMetadataSpm*` représentent uniquement le contrat on-chain du programme `ProgM6JCCvbYkfKqJYHePx4xxSUSqJp7rh8Lyv7nk7S`. Ils ne téléchargent jamais les URL et ne lisent pas automatiquement les comptes référencés par `External`. ```rust -let seed_result = kb_lib::DcMetadataSpmSeed::from_utf8("idl"); +let seed_result = ks_lib::DcMetadataSpmSeed::from_utf8("idl"); let seed = match seed_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; -let external = kb_lib::DcMetadataSpmExternalData::from_zeroable_length( +let external = ks_lib::DcMetadataSpmExternalData::from_zeroable_length( solana_pubkey::Pubkey::new_from_array([7_u8; 32]), 128, 4096, ); -let data = kb_lib::DcMetadataSpmData::External(external); +let data = ks_lib::DcMetadataSpmData::External(external); let wire_bytes = match data.to_wire_bytes() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()), }; -assert_eq!(seed.as_bytes().len(), kb_lib::DC_METADATA_SPM_SEED_BYTES); -assert_eq!(wire_bytes.len(), kb_lib::DC_METADATA_SPM_EXTERNAL_DATA_BYTES); +assert_eq!(seed.as_bytes().len(), ks_lib::DC_METADATA_SPM_SEED_BYTES); +assert_eq!(wire_bytes.len(), ks_lib::DC_METADATA_SPM_EXTERNAL_DATA_BYTES); ``` Le champ `length` externe suit le contrat zeroable : la valeur wire `0` devient `None` et signifie que la référence porte sur tout le compte à partir de `offset`. Les contenus `Direct` et `Url` doivent être non vides, et toute longueur doit rester représentable par le `u32` du header. @@ -116,7 +116,7 @@ Les trois fonctions publiques de comptes vérifient le propriétaire `ProgM6…` - `decoder_metadata_solana_program_metadata_decode_metadata_account` valide le PDA canonical ou non-canonical, `data_length`, les enums fermées et les contraintes propres à `Direct`, `Url` et `External`. ```rust -let snapshot = match kb_lib::decoder_metadata_solana_program_metadata_decode_account( +let snapshot = match ks_lib::decoder_metadata_solana_program_metadata_decode_account( metadata_account.as_str(), account_owner.as_str(), &account_data, @@ -126,10 +126,10 @@ let snapshot = match kb_lib::decoder_metadata_solana_program_metadata_decode_acc }; match snapshot { - kb_lib::DcMetadataSpmAccountSnapshot::Buffer(value) => { + ks_lib::DcMetadataSpmAccountSnapshot::Buffer(value) => { println!("buffer bytes={}", value.allocated_data_bytes); }, - kb_lib::DcMetadataSpmAccountSnapshot::Metadata(value) => { + ks_lib::DcMetadataSpmAccountSnapshot::Metadata(value) => { println!("metadata program={}", value.program); println!("logical bytes={}", value.data_length); println!("reserved capacity={}", value.trailing_capacity_bytes); @@ -142,12 +142,12 @@ Une URL est seulement décodée comme chaîne UTF-8 on-chain. Aucune requête HT Le décodeur `DcMetadataSolanaProgramMetadataDecoder` reconnaît le Program ID `ProgM6…` et les neuf tags stables `0..8`. Il conserve les différences utiles entre le wire SDK et le runtime actuel, sans interpréter un suffixe ignoré comme un nouvel argument. ```rust -let decoder = kb_lib::DcMetadataSolanaProgramMetadataDecoder; -let recognition = kb_lib::DcApiInstructionDecoder::recognize(&decoder, &input); +let decoder = ks_lib::DcMetadataSolanaProgramMetadataDecoder; +let recognition = ks_lib::DcApiInstructionDecoder::recognize(&decoder, &input); if !recognition.compatible { return std::result::Result::Err("instruction incompatible".to_string()); } -let result = kb_lib::DcApiInstructionDecoder::decode(&decoder, &input); +let result = ks_lib::DcApiInstructionDecoder::decode(&decoder, &input); println!("status={:?}", result.status); ``` @@ -162,9 +162,9 @@ Les trois domaines metadata disposent de matérialiseurs instructionnels spécia Chaque type possède son propre `componentName`, son propre `processorName`, ses familles acceptées et un ownership exact. Les transactions échouées sont refusées. Les faits d’instructions ne remplacent jamais les snapshots autoritatifs lus après exécution. ```rust -let materializer = kb_lib::MtMetadataSolanaProgramMaterializer; -if kb_lib::MtApiEventMaterializer::accepts_observation(&materializer, &observation) { - let result = kb_lib::MtApiEventMaterializer::materialize(&materializer, &observation); +let materializer = ks_lib::MtMetadataSolanaProgramMaterializer; +if ks_lib::MtApiEventMaterializer::accepts_observation(&materializer, &observation) { + let result = ks_lib::MtApiEventMaterializer::materialize(&materializer, &observation); println!("materialization status={:?}", result.status); } ``` @@ -176,7 +176,7 @@ Les trois helpers d’état acceptent les snapshots déjà validés par le déco - `materializer_metadata_materialize_solana_program_metadata_metadata_snapshot` conserve le contenu direct, l’URL ou la référence externe, ainsi que l’autorité, la mutabilité, le format et la capacité allouée. ```rust -let output = match kb_lib::materializer_metadata_materialize_solana_program_metadata_account_snapshot( +let output = match ks_lib::materializer_metadata_materialize_solana_program_metadata_account_snapshot( slot, &snapshot, ) { @@ -193,7 +193,7 @@ Une URL reste une chaîne observée avec `fetched = false`. Une référence exte Les fonctions `decoder_metadata_metaplex_token_metadata_decode_*_account` décodent les familles de comptes publiques prises en charge. Le consommateur doit fournir les données et le contexte attendus par la signature exacte de la fonction concernée. Les parseurs conservent les variantes historiques et refusent les longueurs, propriétaires ou suffixes incompatibles. ```rust -let metadata = match kb_lib::decoder_metadata_metaplex_token_metadata_decode_metadata_account( +let metadata = match ks_lib::decoder_metadata_metaplex_token_metadata_decode_metadata_account( metadata_account.as_str(), metadata_owner.as_str(), &account_data, @@ -207,7 +207,7 @@ println!("metadata name={}", metadata.name); ``` ```rust -let edition = match kb_lib::decoder_metadata_metaplex_token_metadata_decode_edition_account( +let edition = match ks_lib::decoder_metadata_metaplex_token_metadata_decode_edition_account( edition_account.as_str(), metadata_owner.as_str(), mint.as_str(), @@ -236,7 +236,7 @@ Les signatures exactes doivent être vérifiées lors de l’utilisation : certa - `ExMetadataSolanaProgramMetadataExecutor`. ```rust -use kb_lib::{ExApiTypedInstructionExecutor, ExSplMemoExecutor}; +use ks_lib::{ExApiTypedInstructionExecutor, ExSplMemoExecutor}; let executor = ExSplMemoExecutor; let plan = ExApiTypedInstructionExecutor::build_prepared_plan( @@ -270,20 +270,20 @@ Memo v1 et v3 restent non exécutables. Memo v4 est la seule génération exécu Les mutations écrasantes, destructrices ou irréversibles ne sont pas retirées de l’API. Elles exigent `allow_destructive_operation = true`, puis le plan complet est évalué par `ExSafetyChecker`. Cette approbation locale ne remplace ni la simulation RPC, ni la confirmation opérateur, ni les postconditions stateful. ```rust -let intent = kb_lib::ExMetadataSpmExecutionIntent { +let intent = ks_lib::ExMetadataSpmExecutionIntent { intent_id: "extend-program-metadata".to_string(), fee_payer: authority.clone(), policy, allow_destructive_operation: false, - operation: kb_lib::ExMetadataSpmOperation::Extend { + operation: ks_lib::ExMetadataSpmOperation::Extend { account: metadata_account, authority, length: 256, program_context: std::option::Option::None, }, }; -let executor = kb_lib::ExMetadataSolanaProgramMetadataExecutor; -let plan = match kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan( +let executor = ks_lib::ExMetadataSolanaProgramMetadataExecutor; +let plan = match ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan( &executor, &intent, ) { @@ -313,7 +313,7 @@ Le consommateur construit un intent typé, puis appelle `ExApiTypedInstructionEx Les opérations courantes utilisent leur wrapper canonique final. Les versions remplacées ne possèdent pas de builder public distinct. Les opérations obsolètes encore constructibles exigent que l’intent autorise explicitement l’exécution dépréciée ; leurs variantes Rust sont marquées `#[deprecated]`. -Avant utilisation du plan, le consommateur doit transmettre celui-ci au préflight et à l’orchestration de `kb-pipeline`. +Avant utilisation du plan, le consommateur doit transmettre celui-ci au préflight et à l’orchestration de `ks-pipeline`. ### Prérequis des opérations Metaplex @@ -339,10 +339,10 @@ let evaluation = match checker.evaluate_prepared_plan(&plan) { }; match evaluation.decision { - kb_lib::ExSafetyDecision::Allow => { + ks_lib::ExSafetyDecision::Allow => { println!("execution plan accepted"); }, - kb_lib::ExSafetyDecision::Deny => { + ks_lib::ExSafetyDecision::Deny => { for violation in evaluation.violations { eprintln!("safety violation: {violation:#?}"); } @@ -355,7 +355,7 @@ match evaluation.decision { `MtApiEventMaterializer` définit le contrat public de matérialisation. Les résultats `MtApiMaterializerExecutionResult` contiennent les sorties et diagnostics sans dépendre d’un backend de stockage. ```rust -let result = kb_lib::MtApiEventMaterializer::materialize( +let result = ks_lib::MtApiEventMaterializer::materialize( &materializer, &decoded_observation, ); diff --git a/kb-lib/src/decoder.rs b/ks-lib/src/decoder.rs similarity index 99% rename from kb-lib/src/decoder.rs rename to ks-lib/src/decoder.rs index 571e7f2..a5b581e 100644 --- a/kb-lib/src/decoder.rs +++ b/ks-lib/src/decoder.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder.rs -// version: 17 +// file: ks-lib/src/decoder.rs +// version: 18 //! Consolidated decoder modules. @@ -916,7 +916,7 @@ mod reserved_decoder_tests { } assert_eq!(decoder.program_ids().len(), 1); for program_id in decoder.program_ids() { - assert!(kb_program_ids::find_registered_program_id(program_id).is_some()); + assert!(ks_program_ids::find_registered_program_id(program_id).is_some()); let observation = crate::MdProgramObservation { signature: crate::MdSignature("signature".to_string()), slot: crate::MdSlot(1), diff --git a/kb-lib/src/decoder/adapter.rs b/ks-lib/src/decoder/adapter.rs similarity index 86% rename from kb-lib/src/decoder/adapter.rs rename to ks-lib/src/decoder/adapter.rs index 66d6958..6707fa3 100644 --- a/kb-lib/src/decoder/adapter.rs +++ b/ks-lib/src/decoder/adapter.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/adapter.rs -// version: 5 +// file: ks-lib/src/decoder/adapter.rs +// version: 6 //! `adapter` decoder family. diff --git a/kb-lib/src/decoder/adapter/saber_decimal_wrapper.rs b/ks-lib/src/decoder/adapter/saber_decimal_wrapper.rs similarity index 84% rename from kb-lib/src/decoder/adapter/saber_decimal_wrapper.rs rename to ks-lib/src/decoder/adapter/saber_decimal_wrapper.rs index b7a95ab..d9875c5 100644 --- a/kb-lib/src/decoder/adapter/saber_decimal_wrapper.rs +++ b/ks-lib/src/decoder/adapter/saber_decimal_wrapper.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/adapter/saber_decimal_wrapper.rs -// version: 4 +// file: ks-lib/src/decoder/adapter/saber_decimal_wrapper.rs +// version: 5 //! Reserved protocol decoder for `adapter_saber_decimal_wrapper`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAdapterSaberDecimalWrapperDecoder } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ADAPTER_SABER_DECIMAL_WRAPPER_PROGRAM_ID]; + return &[ks_program_ids::ADAPTER_SABER_DECIMAL_WRAPPER_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAdapterSaberDecimalWrapperDecoder fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/adapter/spl_token_wrap.rs b/ks-lib/src/decoder/adapter/spl_token_wrap.rs similarity index 84% rename from kb-lib/src/decoder/adapter/spl_token_wrap.rs rename to ks-lib/src/decoder/adapter/spl_token_wrap.rs index 4ab612b..7951a63 100644 --- a/kb-lib/src/decoder/adapter/spl_token_wrap.rs +++ b/ks-lib/src/decoder/adapter/spl_token_wrap.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/adapter/spl_token_wrap.rs -// version: 1 +// file: ks-lib/src/decoder/adapter/spl_token_wrap.rs +// version: 2 //! Reserved protocol decoder for `adapter_spl_token_wrap`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAdapterSplTokenWrapDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ADAPTER_SPL_TOKEN_WRAP_PROGRAM_ID]; + return &[ks_program_ids::ADAPTER_SPL_TOKEN_WRAP_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAdapterSplTokenWrapDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm.rs b/ks-lib/src/decoder/amm.rs similarity index 98% rename from kb-lib/src/decoder/amm.rs rename to ks-lib/src/decoder/amm.rs index 8d37ff4..45d9c5e 100644 --- a/kb-lib/src/decoder/amm.rs +++ b/ks-lib/src/decoder/amm.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm.rs -// version: 5 +// file: ks-lib/src/decoder/amm.rs +// version: 6 //! `amm` decoder family. diff --git a/kb-lib/src/decoder/amm/aldrin_v1.rs b/ks-lib/src/decoder/amm/aldrin_v1.rs similarity index 84% rename from kb-lib/src/decoder/amm/aldrin_v1.rs rename to ks-lib/src/decoder/amm/aldrin_v1.rs index b08d585..5b9a2b4 100644 --- a/kb-lib/src/decoder/amm/aldrin_v1.rs +++ b/ks-lib/src/decoder/amm/aldrin_v1.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/aldrin_v1.rs -// version: 4 +// file: ks-lib/src/decoder/amm/aldrin_v1.rs +// version: 5 //! Reserved protocol decoder for `amm_aldrin_v1`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmAldrinV1Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_ALDRIN_V1_PROGRAM_ID]; + return &[ks_program_ids::AMM_ALDRIN_V1_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmAldrinV1Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/aldrin_v2.rs b/ks-lib/src/decoder/amm/aldrin_v2.rs similarity index 84% rename from kb-lib/src/decoder/amm/aldrin_v2.rs rename to ks-lib/src/decoder/amm/aldrin_v2.rs index 95fb5ec..6a32a50 100644 --- a/kb-lib/src/decoder/amm/aldrin_v2.rs +++ b/ks-lib/src/decoder/amm/aldrin_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/aldrin_v2.rs -// version: 4 +// file: ks-lib/src/decoder/amm/aldrin_v2.rs +// version: 5 //! Reserved protocol decoder for `amm_aldrin_v2`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmAldrinV2Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_ALDRIN_V2_PROGRAM_ID]; + return &[ks_program_ids::AMM_ALDRIN_V2_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmAldrinV2Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/alphaq.rs b/ks-lib/src/decoder/amm/alphaq.rs similarity index 85% rename from kb-lib/src/decoder/amm/alphaq.rs rename to ks-lib/src/decoder/amm/alphaq.rs index 6a6f2da..9596600 100644 --- a/kb-lib/src/decoder/amm/alphaq.rs +++ b/ks-lib/src/decoder/amm/alphaq.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/alphaq.rs -// version: 4 +// file: ks-lib/src/decoder/amm/alphaq.rs +// version: 5 //! Reserved protocol decoder for `amm_alphaq`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmAlphaqDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_ALPHAQ_PROGRAM_ID]; + return &[ks_program_ids::AMM_ALPHAQ_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmAlphaqDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/believe.rs b/ks-lib/src/decoder/amm/believe.rs similarity index 85% rename from kb-lib/src/decoder/amm/believe.rs rename to ks-lib/src/decoder/amm/believe.rs index e9396a1..b6def8a 100644 --- a/kb-lib/src/decoder/amm/believe.rs +++ b/ks-lib/src/decoder/amm/believe.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/believe.rs -// version: 4 +// file: ks-lib/src/decoder/amm/believe.rs +// version: 5 //! Reserved protocol decoder for `amm_believe`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmBelieveDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_BELIEVE_PROGRAM_ID]; + return &[ks_program_ids::AMM_BELIEVE_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmBelieveDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/bonk_swap.rs b/ks-lib/src/decoder/amm/bonk_swap.rs similarity index 84% rename from kb-lib/src/decoder/amm/bonk_swap.rs rename to ks-lib/src/decoder/amm/bonk_swap.rs index de9f2d3..ea98a90 100644 --- a/kb-lib/src/decoder/amm/bonk_swap.rs +++ b/ks-lib/src/decoder/amm/bonk_swap.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/bonk_swap.rs -// version: 4 +// file: ks-lib/src/decoder/amm/bonk_swap.rs +// version: 5 //! Reserved protocol decoder for `amm_bonk_swap`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmBonkSwapDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_BONK_SWAP_PROGRAM_ID]; + return &[ks_program_ids::AMM_BONK_SWAP_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmBonkSwapDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/fluxbeam.rs b/ks-lib/src/decoder/amm/fluxbeam.rs similarity index 84% rename from kb-lib/src/decoder/amm/fluxbeam.rs rename to ks-lib/src/decoder/amm/fluxbeam.rs index 56bd189..0b38d95 100644 --- a/kb-lib/src/decoder/amm/fluxbeam.rs +++ b/ks-lib/src/decoder/amm/fluxbeam.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/fluxbeam.rs -// version: 4 +// file: ks-lib/src/decoder/amm/fluxbeam.rs +// version: 5 //! Reserved protocol decoder for `amm_fluxbeam`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmFluxbeamDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_FLUXBEAM_PROGRAM_ID]; + return &[ks_program_ids::AMM_FLUXBEAM_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmFluxbeamDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/goon_fi.rs b/ks-lib/src/decoder/amm/goon_fi.rs similarity index 84% rename from kb-lib/src/decoder/amm/goon_fi.rs rename to ks-lib/src/decoder/amm/goon_fi.rs index ff9357f..53c6206 100644 --- a/kb-lib/src/decoder/amm/goon_fi.rs +++ b/ks-lib/src/decoder/amm/goon_fi.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/goon_fi.rs -// version: 4 +// file: ks-lib/src/decoder/amm/goon_fi.rs +// version: 5 //! Reserved protocol decoder for `amm_goon_fi`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmGoonFiDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_GOON_FI_PROGRAM_ID]; + return &[ks_program_ids::AMM_GOON_FI_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmGoonFiDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/goosefx_gamma.rs b/ks-lib/src/decoder/amm/goosefx_gamma.rs similarity index 84% rename from kb-lib/src/decoder/amm/goosefx_gamma.rs rename to ks-lib/src/decoder/amm/goosefx_gamma.rs index ac90a12..3557c24 100644 --- a/kb-lib/src/decoder/amm/goosefx_gamma.rs +++ b/ks-lib/src/decoder/amm/goosefx_gamma.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/goosefx_gamma.rs -// version: 4 +// file: ks-lib/src/decoder/amm/goosefx_gamma.rs +// version: 5 //! Reserved protocol decoder for `amm_goosefx_gamma`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmGoosefxGammaDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_GOOSEFX_GAMMA_PROGRAM_ID]; + return &[ks_program_ids::AMM_GOOSEFX_GAMMA_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmGoosefxGammaDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/goosefx_v2.rs b/ks-lib/src/decoder/amm/goosefx_v2.rs similarity index 84% rename from kb-lib/src/decoder/amm/goosefx_v2.rs rename to ks-lib/src/decoder/amm/goosefx_v2.rs index b342702..6146a09 100644 --- a/kb-lib/src/decoder/amm/goosefx_v2.rs +++ b/ks-lib/src/decoder/amm/goosefx_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/goosefx_v2.rs -// version: 4 +// file: ks-lib/src/decoder/amm/goosefx_v2.rs +// version: 5 //! Reserved protocol decoder for `amm_goosefx_v2`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmGoosefxV2Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_GOOSEFX_V2_PROGRAM_ID]; + return &[ks_program_ids::AMM_GOOSEFX_V2_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmGoosefxV2Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/guac_swap.rs b/ks-lib/src/decoder/amm/guac_swap.rs similarity index 84% rename from kb-lib/src/decoder/amm/guac_swap.rs rename to ks-lib/src/decoder/amm/guac_swap.rs index 25e2409..db95ee0 100644 --- a/kb-lib/src/decoder/amm/guac_swap.rs +++ b/ks-lib/src/decoder/amm/guac_swap.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/guac_swap.rs -// version: 4 +// file: ks-lib/src/decoder/amm/guac_swap.rs +// version: 5 //! Reserved protocol decoder for `amm_guac_swap`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmGuacSwapDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_GUAC_SWAP_PROGRAM_ID]; + return &[ks_program_ids::AMM_GUAC_SWAP_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmGuacSwapDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/lifinity_swap_v2.rs b/ks-lib/src/decoder/amm/lifinity_swap_v2.rs similarity index 84% rename from kb-lib/src/decoder/amm/lifinity_swap_v2.rs rename to ks-lib/src/decoder/amm/lifinity_swap_v2.rs index 0d085e5..daeba96 100644 --- a/kb-lib/src/decoder/amm/lifinity_swap_v2.rs +++ b/ks-lib/src/decoder/amm/lifinity_swap_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/lifinity_swap_v2.rs -// version: 4 +// file: ks-lib/src/decoder/amm/lifinity_swap_v2.rs +// version: 5 //! Reserved protocol decoder for `amm_lifinity_swap_v2`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmLifinitySwapV2Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_LIFINITY_SWAP_V2_PROGRAM_ID]; + return &[ks_program_ids::AMM_LIFINITY_SWAP_V2_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmLifinitySwapV2Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/metadao_v0_5.rs b/ks-lib/src/decoder/amm/metadao_v0_5.rs similarity index 84% rename from kb-lib/src/decoder/amm/metadao_v0_5.rs rename to ks-lib/src/decoder/amm/metadao_v0_5.rs index 2bf6573..2e35fda 100644 --- a/kb-lib/src/decoder/amm/metadao_v0_5.rs +++ b/ks-lib/src/decoder/amm/metadao_v0_5.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/metadao_v0_5.rs -// version: 4 +// file: ks-lib/src/decoder/amm/metadao_v0_5.rs +// version: 5 //! Reserved protocol decoder for `amm_metadao_v0_5`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmMetadaoV05Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_METADAO_V0_5_PROGRAM_ID]; + return &[ks_program_ids::AMM_METADAO_V0_5_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmMetadaoV05Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/meteora_damm_v1.rs b/ks-lib/src/decoder/amm/meteora_damm_v1.rs similarity index 84% rename from kb-lib/src/decoder/amm/meteora_damm_v1.rs rename to ks-lib/src/decoder/amm/meteora_damm_v1.rs index 424fe3f..3271446 100644 --- a/kb-lib/src/decoder/amm/meteora_damm_v1.rs +++ b/ks-lib/src/decoder/amm/meteora_damm_v1.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/meteora_damm_v1.rs -// version: 4 +// file: ks-lib/src/decoder/amm/meteora_damm_v1.rs +// version: 5 //! Reserved protocol decoder for `amm_meteora_damm_v1`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmMeteoraDammV1Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_METEORA_DAMM_V1_PROGRAM_ID]; + return &[ks_program_ids::AMM_METEORA_DAMM_V1_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmMeteoraDammV1Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/meteora_damm_v2.rs b/ks-lib/src/decoder/amm/meteora_damm_v2.rs similarity index 84% rename from kb-lib/src/decoder/amm/meteora_damm_v2.rs rename to ks-lib/src/decoder/amm/meteora_damm_v2.rs index 706552e..aa5e957 100644 --- a/kb-lib/src/decoder/amm/meteora_damm_v2.rs +++ b/ks-lib/src/decoder/amm/meteora_damm_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/meteora_damm_v2.rs -// version: 4 +// file: ks-lib/src/decoder/amm/meteora_damm_v2.rs +// version: 5 //! Reserved protocol decoder for `amm_meteora_damm_v2`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmMeteoraDammV2Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_METEORA_DAMM_V2_PROGRAM_ID]; + return &[ks_program_ids::AMM_METEORA_DAMM_V2_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmMeteoraDammV2Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/obric_v2.rs b/ks-lib/src/decoder/amm/obric_v2.rs similarity index 84% rename from kb-lib/src/decoder/amm/obric_v2.rs rename to ks-lib/src/decoder/amm/obric_v2.rs index 8ca6bda..8c0f652 100644 --- a/kb-lib/src/decoder/amm/obric_v2.rs +++ b/ks-lib/src/decoder/amm/obric_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/obric_v2.rs -// version: 4 +// file: ks-lib/src/decoder/amm/obric_v2.rs +// version: 5 //! Reserved protocol decoder for `amm_obric_v2`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmObricV2Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_OBRIC_V2_PROGRAM_ID]; + return &[ks_program_ids::AMM_OBRIC_V2_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmObricV2Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/one_dex.rs b/ks-lib/src/decoder/amm/one_dex.rs similarity index 84% rename from kb-lib/src/decoder/amm/one_dex.rs rename to ks-lib/src/decoder/amm/one_dex.rs index 43a6544..5f9e337 100644 --- a/kb-lib/src/decoder/amm/one_dex.rs +++ b/ks-lib/src/decoder/amm/one_dex.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/one_dex.rs -// version: 4 +// file: ks-lib/src/decoder/amm/one_dex.rs +// version: 5 //! Reserved protocol decoder for `amm_one_dex`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmOneDexDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_ONE_DEX_PROGRAM_ID]; + return &[ks_program_ids::AMM_ONE_DEX_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmOneDexDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/pump_swap.rs b/ks-lib/src/decoder/amm/pump_swap.rs similarity index 84% rename from kb-lib/src/decoder/amm/pump_swap.rs rename to ks-lib/src/decoder/amm/pump_swap.rs index 8d71cb3..36d141a 100644 --- a/kb-lib/src/decoder/amm/pump_swap.rs +++ b/ks-lib/src/decoder/amm/pump_swap.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/pump_swap.rs -// version: 4 +// file: ks-lib/src/decoder/amm/pump_swap.rs +// version: 5 //! Reserved protocol decoder for `amm_pump_swap`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmPumpSwapDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_PUMP_SWAP_PROGRAM_ID]; + return &[ks_program_ids::AMM_PUMP_SWAP_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmPumpSwapDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/raydium_lp_v4.rs b/ks-lib/src/decoder/amm/raydium_lp_v4.rs similarity index 84% rename from kb-lib/src/decoder/amm/raydium_lp_v4.rs rename to ks-lib/src/decoder/amm/raydium_lp_v4.rs index 77c6ea8..699eba6 100644 --- a/kb-lib/src/decoder/amm/raydium_lp_v4.rs +++ b/ks-lib/src/decoder/amm/raydium_lp_v4.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/raydium_lp_v4.rs -// version: 4 +// file: ks-lib/src/decoder/amm/raydium_lp_v4.rs +// version: 5 //! Reserved protocol decoder for `amm_raydium_lp_v4`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmRaydiumLpV4Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_RAYDIUM_LP_V4_PROGRAM_ID]; + return &[ks_program_ids::AMM_RAYDIUM_LP_V4_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmRaydiumLpV4Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/solfi.rs b/ks-lib/src/decoder/amm/solfi.rs similarity index 85% rename from kb-lib/src/decoder/amm/solfi.rs rename to ks-lib/src/decoder/amm/solfi.rs index 619802d..4aee1c7 100644 --- a/kb-lib/src/decoder/amm/solfi.rs +++ b/ks-lib/src/decoder/amm/solfi.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/solfi.rs -// version: 4 +// file: ks-lib/src/decoder/amm/solfi.rs +// version: 5 //! Reserved protocol decoder for `amm_solfi`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmSolfiDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_SOLFI_PROGRAM_ID]; + return &[ks_program_ids::AMM_SOLFI_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmSolfiDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/solfi_v2.rs b/ks-lib/src/decoder/amm/solfi_v2.rs similarity index 84% rename from kb-lib/src/decoder/amm/solfi_v2.rs rename to ks-lib/src/decoder/amm/solfi_v2.rs index 7d3dae3..3c4c6f2 100644 --- a/kb-lib/src/decoder/amm/solfi_v2.rs +++ b/ks-lib/src/decoder/amm/solfi_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/solfi_v2.rs -// version: 4 +// file: ks-lib/src/decoder/amm/solfi_v2.rs +// version: 5 //! Reserved protocol decoder for `amm_solfi_v2`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmSolfiV2Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_SOLFI_V2_PROGRAM_ID]; + return &[ks_program_ids::AMM_SOLFI_V2_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmSolfiV2Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/vertigo.rs b/ks-lib/src/decoder/amm/vertigo.rs similarity index 85% rename from kb-lib/src/decoder/amm/vertigo.rs rename to ks-lib/src/decoder/amm/vertigo.rs index 203cdc9..01794b9 100644 --- a/kb-lib/src/decoder/amm/vertigo.rs +++ b/ks-lib/src/decoder/amm/vertigo.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/vertigo.rs -// version: 4 +// file: ks-lib/src/decoder/amm/vertigo.rs +// version: 5 //! Reserved protocol decoder for `amm_vertigo`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmVertigoDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_VERTIGO_PROGRAM_ID]; + return &[ks_program_ids::AMM_VERTIGO_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmVertigoDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/woofi.rs b/ks-lib/src/decoder/amm/woofi.rs similarity index 85% rename from kb-lib/src/decoder/amm/woofi.rs rename to ks-lib/src/decoder/amm/woofi.rs index 749ecf0..e42072f 100644 --- a/kb-lib/src/decoder/amm/woofi.rs +++ b/ks-lib/src/decoder/amm/woofi.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/woofi.rs -// version: 4 +// file: ks-lib/src/decoder/amm/woofi.rs +// version: 5 //! Reserved protocol decoder for `amm_woofi`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmWoofiDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_WOOFI_PROGRAM_ID]; + return &[ks_program_ids::AMM_WOOFI_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmWoofiDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/zero_fi.rs b/ks-lib/src/decoder/amm/zero_fi.rs similarity index 84% rename from kb-lib/src/decoder/amm/zero_fi.rs rename to ks-lib/src/decoder/amm/zero_fi.rs index 5637ac9..2fe35a3 100644 --- a/kb-lib/src/decoder/amm/zero_fi.rs +++ b/ks-lib/src/decoder/amm/zero_fi.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/zero_fi.rs -// version: 4 +// file: ks-lib/src/decoder/amm/zero_fi.rs +// version: 5 //! Reserved protocol decoder for `amm_zero_fi`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmZeroFiDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_ZERO_FI_PROGRAM_ID]; + return &[ks_program_ids::AMM_ZERO_FI_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmZeroFiDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/amm/zora.rs b/ks-lib/src/decoder/amm/zora.rs similarity index 85% rename from kb-lib/src/decoder/amm/zora.rs rename to ks-lib/src/decoder/amm/zora.rs index 1ddc71f..dbe141c 100644 --- a/kb-lib/src/decoder/amm/zora.rs +++ b/ks-lib/src/decoder/amm/zora.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/amm/zora.rs -// version: 4 +// file: ks-lib/src/decoder/amm/zora.rs +// version: 5 //! Reserved protocol decoder for `amm_zora`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmZoraDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_ZORA_PROGRAM_ID]; + return &[ks_program_ids::AMM_ZORA_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAmmZoraDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/anchor.rs b/ks-lib/src/decoder/anchor.rs similarity index 70% rename from kb-lib/src/decoder/anchor.rs rename to ks-lib/src/decoder/anchor.rs index 405a029..7f81f7d 100644 --- a/kb-lib/src/decoder/anchor.rs +++ b/ks-lib/src/decoder/anchor.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/anchor.rs -// version: 4 +// file: ks-lib/src/decoder/anchor.rs +// version: 5 //! `anchor` decoder family. diff --git a/kb-lib/src/decoder/anchor/core.rs b/ks-lib/src/decoder/anchor/core.rs similarity index 89% rename from kb-lib/src/decoder/anchor/core.rs rename to ks-lib/src/decoder/anchor/core.rs index 59c7f92..6970881 100644 --- a/kb-lib/src/decoder/anchor/core.rs +++ b/ks-lib/src/decoder/anchor/core.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/anchor/core.rs -// version: 4 +// file: ks-lib/src/decoder/anchor/core.rs +// version: 5 //! Reserved protocol decoder for `anchor`. @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcAnchorDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/api.rs b/ks-lib/src/decoder/api.rs similarity index 97% rename from kb-lib/src/decoder/api.rs rename to ks-lib/src/decoder/api.rs index bca74fd..28be5e3 100644 --- a/kb-lib/src/decoder/api.rs +++ b/ks-lib/src/decoder/api.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/api.rs -// version: 6 +// file: ks-lib/src/decoder/api.rs +// version: 7 //! Decoder contracts. diff --git a/kb-lib/src/decoder/api/contracts.rs b/ks-lib/src/decoder/api/contracts.rs similarity index 94% rename from kb-lib/src/decoder/api/contracts.rs rename to ks-lib/src/decoder/api/contracts.rs index ce5aa20..aef0076 100644 --- a/kb-lib/src/decoder/api/contracts.rs +++ b/ks-lib/src/decoder/api/contracts.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/api/contracts.rs -// version: 8 +// file: ks-lib/src/decoder/api/contracts.rs +// version: 9 //! Backend-neutral contextual instruction decoder contracts. @@ -23,13 +23,13 @@ impl DcApiDecoderIdentity { pub fn new( name: impl std::convert::Into, version: impl std::convert::Into, - ) -> kb_core::Result { + ) -> ks_core::Result { let value = Self { name: name.into(), version: version.into(), }; if value.name.trim().is_empty() || value.version.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "decoder identity fields must not be empty", )); } @@ -85,7 +85,7 @@ impl DcApiDecoderCoverageDeclaration { entry_code: impl std::convert::Into, discriminator_hex: std::option::Option, historical: bool, - ) -> kb_core::Result { + ) -> ks_core::Result { let value = Self { program_id: program_id.into(), surface_code, @@ -95,7 +95,7 @@ impl DcApiDecoderCoverageDeclaration { historical, }; if value.program_id.trim().is_empty() || value.entry_code.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "decoder coverage program id and entry code must not be empty", )); } @@ -104,7 +104,7 @@ impl DcApiDecoderCoverageDeclaration { .as_deref() .is_some_and(|surface| return surface.trim().is_empty()) { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "decoder coverage surface code must not be empty when present", )); } @@ -113,7 +113,7 @@ impl DcApiDecoderCoverageDeclaration { .as_deref() .is_some_and(|discriminator| return discriminator.trim().is_empty()) { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "decoder coverage discriminator must not be empty when present", )); } @@ -234,14 +234,14 @@ impl DcApiDecoderDiagnostic { code: impl std::convert::Into, message: impl std::convert::Into, retriable: bool, - ) -> kb_core::Result { + ) -> ks_core::Result { let value = Self { code: code.into(), message: message.into(), retriable, }; if value.code.trim().is_empty() || value.message.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "decoder diagnostic code and message must not be empty", )); } @@ -270,14 +270,14 @@ pub struct DcApiDecodedObservation { impl DcApiDecodedObservation { /// Validates failed transaction commit semantics and stable identity fields. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.event_key.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "decoded observation event key must not be empty", )); } if self.transaction_failed && self.observation_committed { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "failed transaction observations must not be marked committed", )); } @@ -286,7 +286,7 @@ impl DcApiDecodedObservation { || self.event.program_id.0.trim().is_empty() || self.event.event_code.0.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "decoded observation event identity fields must not be empty", )); } @@ -329,19 +329,19 @@ impl DcApiDecoderExecutionResult { } /// Validates status and observation consistency. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.status == DcApiDecoderOutcomeStatus::Decoded && self.observations.is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "decoded status requires at least one observation", )); } if self.status != DcApiDecoderOutcomeStatus::Decoded && !self.observations.is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "non-decoded status must not contain observations", )); } if self.status == DcApiDecoderOutcomeStatus::Failed && self.diagnostics.is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "failed decoder status requires at least one diagnostic", )); } @@ -385,12 +385,12 @@ pub fn decoder_api_decoder_handles_program_id( /// Computes a deterministic lowercase SHA-256 hash for one contextual input. pub fn decoder_api_contextual_input_hash( input: &crate::MdCoreInstructionReplayInput, -) -> kb_core::Result { +) -> ks_core::Result { let serialization_result = serde_json::to_value(input); let mut value = match serialization_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot serialize contextual decoder input: {error}" ))); }, @@ -401,13 +401,13 @@ pub fn decoder_api_contextual_input_hash( /// Computes a deterministic lowercase SHA-256 hash for one JSON value. pub fn decoder_api_deterministic_json_hash( value: &mut serde_json::Value, -) -> kb_core::Result { +) -> ks_core::Result { sort_json_value(value); let bytes_result = serde_json::to_vec(value); let bytes = match bytes_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot serialize deterministic JSON bytes: {error}" ))); }, diff --git a/kb-lib/src/decoder/api/decoder.rs b/ks-lib/src/decoder/api/decoder.rs similarity index 92% rename from kb-lib/src/decoder/api/decoder.rs rename to ks-lib/src/decoder/api/decoder.rs index 37483ea..a984051 100644 --- a/kb-lib/src/decoder/api/decoder.rs +++ b/ks-lib/src/decoder/api/decoder.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/api/decoder.rs -// version: 6 +// file: ks-lib/src/decoder/api/decoder.rs +// version: 7 //! Shared decoder contracts for protocol decoder crates. @@ -40,7 +40,7 @@ pub trait DcApiProtocolDecoder { fn decode_observation( &self, observation: &crate::MdProgramObservation, - ) -> kb_core::Result>; + ) -> ks_core::Result>; } /// Initial decoder implementation placeholder for API-level tests. @@ -73,7 +73,7 @@ impl DcApiProtocolDecoder for DcApiInitialDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/bridge.rs b/ks-lib/src/decoder/bridge.rs similarity index 93% rename from kb-lib/src/decoder/bridge.rs rename to ks-lib/src/decoder/bridge.rs index bc52152..4ede5bc 100644 --- a/kb-lib/src/decoder/bridge.rs +++ b/ks-lib/src/decoder/bridge.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/bridge.rs -// version: 4 +// file: ks-lib/src/decoder/bridge.rs +// version: 5 //! `bridge` decoder family. diff --git a/kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter.rs b/ks-lib/src/decoder/bridge/circle_cctp_token_messenger_minter.rs similarity index 85% rename from kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter.rs rename to ks-lib/src/decoder/bridge/circle_cctp_token_messenger_minter.rs index 126750e..cda5e5b 100644 --- a/kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter.rs +++ b/ks-lib/src/decoder/bridge/circle_cctp_token_messenger_minter.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter.rs -// version: 4 +// file: ks-lib/src/decoder/bridge/circle_cctp_token_messenger_minter.rs +// version: 5 //! Reserved protocol decoder for `bridge_circle_cctp_token_messenger_minter`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcBridgeCircleCctpTokenMessengerMint } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::BRIDGE_CIRCLE_CCTP_TOKEN_MESSENGER_MINTER_PROGRAM_ID]; + return &[ks_program_ids::BRIDGE_CIRCLE_CCTP_TOKEN_MESSENGER_MINTER_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcBridgeCircleCctpTokenMessengerMint fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter_v2.rs b/ks-lib/src/decoder/bridge/circle_cctp_token_messenger_minter_v2.rs similarity index 85% rename from kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter_v2.rs rename to ks-lib/src/decoder/bridge/circle_cctp_token_messenger_minter_v2.rs index a0467c1..12afa9b 100644 --- a/kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter_v2.rs +++ b/ks-lib/src/decoder/bridge/circle_cctp_token_messenger_minter_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter_v2.rs -// version: 4 +// file: ks-lib/src/decoder/bridge/circle_cctp_token_messenger_minter_v2.rs +// version: 5 //! Reserved protocol decoder for `bridge_circle_cctp_token_messenger_minter_v2`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcBridgeCircleCctpTokenMessengerMint } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::BRIDGE_CIRCLE_CCTP_TOKEN_MESSENGER_MINTER_V2_PROGRAM_ID]; + return &[ks_program_ids::BRIDGE_CIRCLE_CCTP_TOKEN_MESSENGER_MINTER_V2_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcBridgeCircleCctpTokenMessengerMint fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/bridge/layer_zero_endpoint.rs b/ks-lib/src/decoder/bridge/layer_zero_endpoint.rs similarity index 84% rename from kb-lib/src/decoder/bridge/layer_zero_endpoint.rs rename to ks-lib/src/decoder/bridge/layer_zero_endpoint.rs index e41ce88..6faf9a9 100644 --- a/kb-lib/src/decoder/bridge/layer_zero_endpoint.rs +++ b/ks-lib/src/decoder/bridge/layer_zero_endpoint.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/bridge/layer_zero_endpoint.rs -// version: 4 +// file: ks-lib/src/decoder/bridge/layer_zero_endpoint.rs +// version: 5 //! Reserved protocol decoder for `bridge_layer_zero_endpoint`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcBridgeLayerZeroEndpointDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::BRIDGE_LAYER_ZERO_ENDPOINT_PROGRAM_ID]; + return &[ks_program_ids::BRIDGE_LAYER_ZERO_ENDPOINT_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcBridgeLayerZeroEndpointDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/bridge/layer_zero_executor.rs b/ks-lib/src/decoder/bridge/layer_zero_executor.rs similarity index 84% rename from kb-lib/src/decoder/bridge/layer_zero_executor.rs rename to ks-lib/src/decoder/bridge/layer_zero_executor.rs index 2bd4138..083deee 100644 --- a/kb-lib/src/decoder/bridge/layer_zero_executor.rs +++ b/ks-lib/src/decoder/bridge/layer_zero_executor.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/bridge/layer_zero_executor.rs -// version: 4 +// file: ks-lib/src/decoder/bridge/layer_zero_executor.rs +// version: 5 //! Reserved protocol decoder for `bridge_layer_zero_executor`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcBridgeLayerZeroExecutorDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::BRIDGE_LAYER_ZERO_EXECUTOR_PROGRAM_ID]; + return &[ks_program_ids::BRIDGE_LAYER_ZERO_EXECUTOR_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcBridgeLayerZeroExecutorDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/clmm.rs b/ks-lib/src/decoder/clmm.rs similarity index 93% rename from kb-lib/src/decoder/clmm.rs rename to ks-lib/src/decoder/clmm.rs index aeb8920..5026842 100644 --- a/kb-lib/src/decoder/clmm.rs +++ b/ks-lib/src/decoder/clmm.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/clmm.rs -// version: 4 +// file: ks-lib/src/decoder/clmm.rs +// version: 5 //! `clmm` decoder family. diff --git a/kb-lib/src/decoder/clmm/byreal.rs b/ks-lib/src/decoder/clmm/byreal.rs similarity index 85% rename from kb-lib/src/decoder/clmm/byreal.rs rename to ks-lib/src/decoder/clmm/byreal.rs index 9758d95..df19209 100644 --- a/kb-lib/src/decoder/clmm/byreal.rs +++ b/ks-lib/src/decoder/clmm/byreal.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/clmm/byreal.rs -// version: 4 +// file: ks-lib/src/decoder/clmm/byreal.rs +// version: 5 //! Reserved protocol decoder for `clmm_byreal`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcClmmByrealDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::CLMM_BYREAL_PROGRAM_ID]; + return &[ks_program_ids::CLMM_BYREAL_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcClmmByrealDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/clmm/fusion.rs b/ks-lib/src/decoder/clmm/fusion.rs similarity index 85% rename from kb-lib/src/decoder/clmm/fusion.rs rename to ks-lib/src/decoder/clmm/fusion.rs index 5d8c8b2..39fb020 100644 --- a/kb-lib/src/decoder/clmm/fusion.rs +++ b/ks-lib/src/decoder/clmm/fusion.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/clmm/fusion.rs -// version: 4 +// file: ks-lib/src/decoder/clmm/fusion.rs +// version: 5 //! Reserved protocol decoder for `clmm_fusion`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcClmmFusionDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::CLMM_FUSION_PROGRAM_ID]; + return &[ks_program_ids::CLMM_FUSION_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcClmmFusionDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/clmm/orca_whirlpool.rs b/ks-lib/src/decoder/clmm/orca_whirlpool.rs similarity index 84% rename from kb-lib/src/decoder/clmm/orca_whirlpool.rs rename to ks-lib/src/decoder/clmm/orca_whirlpool.rs index dbf2532..87dc74e 100644 --- a/kb-lib/src/decoder/clmm/orca_whirlpool.rs +++ b/ks-lib/src/decoder/clmm/orca_whirlpool.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/clmm/orca_whirlpool.rs -// version: 4 +// file: ks-lib/src/decoder/clmm/orca_whirlpool.rs +// version: 5 //! Reserved protocol decoder for `clmm_orca_whirlpool`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcClmmOrcaWhirlpoolDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::CLMM_ORCA_WHIRLPOOL_PROGRAM_ID]; + return &[ks_program_ids::CLMM_ORCA_WHIRLPOOL_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcClmmOrcaWhirlpoolDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/clmm/pancake_swap.rs b/ks-lib/src/decoder/clmm/pancake_swap.rs similarity index 84% rename from kb-lib/src/decoder/clmm/pancake_swap.rs rename to ks-lib/src/decoder/clmm/pancake_swap.rs index 726562f..e1559eb 100644 --- a/kb-lib/src/decoder/clmm/pancake_swap.rs +++ b/ks-lib/src/decoder/clmm/pancake_swap.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/clmm/pancake_swap.rs -// version: 4 +// file: ks-lib/src/decoder/clmm/pancake_swap.rs +// version: 5 //! Reserved protocol decoder for `clmm_pancake_swap`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcClmmPancakeSwapDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::CLMM_PANCAKE_SWAP_PROGRAM_ID]; + return &[ks_program_ids::CLMM_PANCAKE_SWAP_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcClmmPancakeSwapDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/clmm/raydium.rs b/ks-lib/src/decoder/clmm/raydium.rs similarity index 84% rename from kb-lib/src/decoder/clmm/raydium.rs rename to ks-lib/src/decoder/clmm/raydium.rs index 9ab6271..4d76d79 100644 --- a/kb-lib/src/decoder/clmm/raydium.rs +++ b/ks-lib/src/decoder/clmm/raydium.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/clmm/raydium.rs -// version: 4 +// file: ks-lib/src/decoder/clmm/raydium.rs +// version: 5 //! Reserved protocol decoder for `clmm_raydium`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcClmmRaydiumDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::CLMM_RAYDIUM_PROGRAM_ID]; + return &[ks_program_ids::CLMM_RAYDIUM_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcClmmRaydiumDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/clmm/stabble.rs b/ks-lib/src/decoder/clmm/stabble.rs similarity index 84% rename from kb-lib/src/decoder/clmm/stabble.rs rename to ks-lib/src/decoder/clmm/stabble.rs index df53d03..6854226 100644 --- a/kb-lib/src/decoder/clmm/stabble.rs +++ b/ks-lib/src/decoder/clmm/stabble.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/clmm/stabble.rs -// version: 4 +// file: ks-lib/src/decoder/clmm/stabble.rs +// version: 5 //! Reserved protocol decoder for `clmm_stabble`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcClmmStabbleDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::CLMM_STABBLE_PROGRAM_ID]; + return &[ks_program_ids::CLMM_STABBLE_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcClmmStabbleDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/cpmm.rs b/ks-lib/src/decoder/cpmm.rs similarity index 73% rename from kb-lib/src/decoder/cpmm.rs rename to ks-lib/src/decoder/cpmm.rs index 7f494f4..c06017e 100644 --- a/kb-lib/src/decoder/cpmm.rs +++ b/ks-lib/src/decoder/cpmm.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/cpmm.rs -// version: 4 +// file: ks-lib/src/decoder/cpmm.rs +// version: 5 //! `cpmm` decoder family. diff --git a/kb-lib/src/decoder/cpmm/raydium.rs b/ks-lib/src/decoder/cpmm/raydium.rs similarity index 84% rename from kb-lib/src/decoder/cpmm/raydium.rs rename to ks-lib/src/decoder/cpmm/raydium.rs index 13d4be0..120bc65 100644 --- a/kb-lib/src/decoder/cpmm/raydium.rs +++ b/ks-lib/src/decoder/cpmm/raydium.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/cpmm/raydium.rs -// version: 4 +// file: ks-lib/src/decoder/cpmm/raydium.rs +// version: 5 //! Reserved protocol decoder for `cpmm_raydium`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcCpmmRaydiumDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::CPMM_RAYDIUM_PROGRAM_ID]; + return &[ks_program_ids::CPMM_RAYDIUM_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcCpmmRaydiumDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/dlmm.rs b/ks-lib/src/decoder/dlmm.rs similarity index 73% rename from kb-lib/src/decoder/dlmm.rs rename to ks-lib/src/decoder/dlmm.rs index 20e9240..a15a796 100644 --- a/kb-lib/src/decoder/dlmm.rs +++ b/ks-lib/src/decoder/dlmm.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/dlmm.rs -// version: 4 +// file: ks-lib/src/decoder/dlmm.rs +// version: 5 //! `dlmm` decoder family. diff --git a/kb-lib/src/decoder/dlmm/meteora.rs b/ks-lib/src/decoder/dlmm/meteora.rs similarity index 84% rename from kb-lib/src/decoder/dlmm/meteora.rs rename to ks-lib/src/decoder/dlmm/meteora.rs index 7a734c6..4dffb21 100644 --- a/kb-lib/src/decoder/dlmm/meteora.rs +++ b/ks-lib/src/decoder/dlmm/meteora.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/dlmm/meteora.rs -// version: 4 +// file: ks-lib/src/decoder/dlmm/meteora.rs +// version: 5 //! Reserved protocol decoder for `dlmm_meteora`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcDlmmMeteoraDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::DLMM_METEORA_PROGRAM_ID]; + return &[ks_program_ids::DLMM_METEORA_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcDlmmMeteoraDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/fees.rs b/ks-lib/src/decoder/fees.rs similarity index 89% rename from kb-lib/src/decoder/fees.rs rename to ks-lib/src/decoder/fees.rs index fee0a30..d558637 100644 --- a/kb-lib/src/decoder/fees.rs +++ b/ks-lib/src/decoder/fees.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/fees.rs -// version: 5 +// file: ks-lib/src/decoder/fees.rs +// version: 6 //! `fees` decoder family. diff --git a/kb-lib/src/decoder/fees/bags_fee_share_v1.rs b/ks-lib/src/decoder/fees/bags_fee_share_v1.rs similarity index 84% rename from kb-lib/src/decoder/fees/bags_fee_share_v1.rs rename to ks-lib/src/decoder/fees/bags_fee_share_v1.rs index ccac49c..804ca81 100644 --- a/kb-lib/src/decoder/fees/bags_fee_share_v1.rs +++ b/ks-lib/src/decoder/fees/bags_fee_share_v1.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/fees/bags_fee_share_v1.rs -// version: 4 +// file: ks-lib/src/decoder/fees/bags_fee_share_v1.rs +// version: 5 //! Reserved protocol decoder for `fees_bags_fee_share_v1`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcFeesBagsFeeShareV1Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::FEES_BAGS_FEE_SHARE_V1_PROGRAM_ID]; + return &[ks_program_ids::FEES_BAGS_FEE_SHARE_V1_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcFeesBagsFeeShareV1Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/fees/bags_fee_share_v2.rs b/ks-lib/src/decoder/fees/bags_fee_share_v2.rs similarity index 84% rename from kb-lib/src/decoder/fees/bags_fee_share_v2.rs rename to ks-lib/src/decoder/fees/bags_fee_share_v2.rs index 1587b00..c55e815 100644 --- a/kb-lib/src/decoder/fees/bags_fee_share_v2.rs +++ b/ks-lib/src/decoder/fees/bags_fee_share_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/fees/bags_fee_share_v2.rs -// version: 4 +// file: ks-lib/src/decoder/fees/bags_fee_share_v2.rs +// version: 5 //! Reserved protocol decoder for `fees_bags_fee_share_v2`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcFeesBagsFeeShareV2Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::FEES_BAGS_FEE_SHARE_V2_PROGRAM_ID]; + return &[ks_program_ids::FEES_BAGS_FEE_SHARE_V2_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcFeesBagsFeeShareV2Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/fees/pump_fees.rs b/ks-lib/src/decoder/fees/pump_fees.rs similarity index 84% rename from kb-lib/src/decoder/fees/pump_fees.rs rename to ks-lib/src/decoder/fees/pump_fees.rs index 6556747..48a94b7 100644 --- a/kb-lib/src/decoder/fees/pump_fees.rs +++ b/ks-lib/src/decoder/fees/pump_fees.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/fees/pump_fees.rs -// version: 4 +// file: ks-lib/src/decoder/fees/pump_fees.rs +// version: 5 //! Reserved protocol decoder for `fees_pump_fees`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcFeesPumpFeesDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::FEES_PUMP_FEES_PROGRAM_ID]; + return &[ks_program_ids::FEES_PUMP_FEES_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcFeesPumpFeesDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/governance.rs b/ks-lib/src/decoder/governance.rs similarity index 89% rename from kb-lib/src/decoder/governance.rs rename to ks-lib/src/decoder/governance.rs index 4a45cd9..65d00cd 100644 --- a/kb-lib/src/decoder/governance.rs +++ b/ks-lib/src/decoder/governance.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/governance.rs -// version: 5 +// file: ks-lib/src/decoder/governance.rs +// version: 6 //! `governance` decoder family. diff --git a/kb-lib/src/decoder/governance/metadao_bid_wall.rs b/ks-lib/src/decoder/governance/metadao_bid_wall.rs similarity index 84% rename from kb-lib/src/decoder/governance/metadao_bid_wall.rs rename to ks-lib/src/decoder/governance/metadao_bid_wall.rs index f7191e9..22d4aba 100644 --- a/kb-lib/src/decoder/governance/metadao_bid_wall.rs +++ b/ks-lib/src/decoder/governance/metadao_bid_wall.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/governance/metadao_bid_wall.rs -// version: 4 +// file: ks-lib/src/decoder/governance/metadao_bid_wall.rs +// version: 5 //! Reserved protocol decoder for `governance_metadao_bid_wall`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcGovernanceMetadaoBidWallDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::GOVERNANCE_METADAO_BID_WALL_PROGRAM_ID]; + return &[ks_program_ids::GOVERNANCE_METADAO_BID_WALL_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcGovernanceMetadaoBidWallDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/governance/metadao_futarchy.rs b/ks-lib/src/decoder/governance/metadao_futarchy.rs similarity index 84% rename from kb-lib/src/decoder/governance/metadao_futarchy.rs rename to ks-lib/src/decoder/governance/metadao_futarchy.rs index 01aecc1..9dc23bb 100644 --- a/kb-lib/src/decoder/governance/metadao_futarchy.rs +++ b/ks-lib/src/decoder/governance/metadao_futarchy.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/governance/metadao_futarchy.rs -// version: 4 +// file: ks-lib/src/decoder/governance/metadao_futarchy.rs +// version: 5 //! Reserved protocol decoder for `governance_metadao_futarchy`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcGovernanceMetadaoFutarchyDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::GOVERNANCE_METADAO_FUTARCHY_PROGRAM_ID]; + return &[ks_program_ids::GOVERNANCE_METADAO_FUTARCHY_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcGovernanceMetadaoFutarchyDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/governance/squads_multisig.rs b/ks-lib/src/decoder/governance/squads_multisig.rs similarity index 84% rename from kb-lib/src/decoder/governance/squads_multisig.rs rename to ks-lib/src/decoder/governance/squads_multisig.rs index 77bc631..2d26e35 100644 --- a/kb-lib/src/decoder/governance/squads_multisig.rs +++ b/ks-lib/src/decoder/governance/squads_multisig.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/governance/squads_multisig.rs -// version: 1 +// file: ks-lib/src/decoder/governance/squads_multisig.rs +// version: 2 //! Reserved protocol decoder for `governance_squads_multisig`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcGovernanceSquadsMultisigDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::GOVERNANCE_SQUADS_MULTISIG_PROGRAM_ID]; + return &[ks_program_ids::GOVERNANCE_SQUADS_MULTISIG_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcGovernanceSquadsMultisigDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/launchpad.rs b/ks-lib/src/decoder/launchpad.rs similarity index 96% rename from kb-lib/src/decoder/launchpad.rs rename to ks-lib/src/decoder/launchpad.rs index 4ec96d7..c461f97 100644 --- a/kb-lib/src/decoder/launchpad.rs +++ b/ks-lib/src/decoder/launchpad.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/launchpad.rs -// version: 5 +// file: ks-lib/src/decoder/launchpad.rs +// version: 6 //! `launchpad` decoder family. diff --git a/kb-lib/src/decoder/launchpad/boop_fun.rs b/ks-lib/src/decoder/launchpad/boop_fun.rs similarity index 84% rename from kb-lib/src/decoder/launchpad/boop_fun.rs rename to ks-lib/src/decoder/launchpad/boop_fun.rs index 912f4bd..c1d9192 100644 --- a/kb-lib/src/decoder/launchpad/boop_fun.rs +++ b/ks-lib/src/decoder/launchpad/boop_fun.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/launchpad/boop_fun.rs -// version: 4 +// file: ks-lib/src/decoder/launchpad/boop_fun.rs +// version: 5 //! Reserved protocol decoder for `launchpad_boop_fun`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadBoopFunDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_BOOP_FUN_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_BOOP_FUN_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadBoopFunDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/launchpad/metadao_ico.rs b/ks-lib/src/decoder/launchpad/metadao_ico.rs similarity index 84% rename from kb-lib/src/decoder/launchpad/metadao_ico.rs rename to ks-lib/src/decoder/launchpad/metadao_ico.rs index 91e0f5b..8da9704 100644 --- a/kb-lib/src/decoder/launchpad/metadao_ico.rs +++ b/ks-lib/src/decoder/launchpad/metadao_ico.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/launchpad/metadao_ico.rs -// version: 4 +// file: ks-lib/src/decoder/launchpad/metadao_ico.rs +// version: 5 //! Reserved protocol decoder for `launchpad_metadao_ico`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadMetadaoIcoDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_METADAO_ICO_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_METADAO_ICO_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadMetadaoIcoDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/launchpad/meteora_dbc.rs b/ks-lib/src/decoder/launchpad/meteora_dbc.rs similarity index 84% rename from kb-lib/src/decoder/launchpad/meteora_dbc.rs rename to ks-lib/src/decoder/launchpad/meteora_dbc.rs index c6eab10..c9d160b 100644 --- a/kb-lib/src/decoder/launchpad/meteora_dbc.rs +++ b/ks-lib/src/decoder/launchpad/meteora_dbc.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/launchpad/meteora_dbc.rs -// version: 4 +// file: ks-lib/src/decoder/launchpad/meteora_dbc.rs +// version: 5 //! Reserved protocol decoder for `launchpad_meteora_dbc`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadMeteoraDbcDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_METEORA_DBC_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_METEORA_DBC_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadMeteoraDbcDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/launchpad/moonit.rs b/ks-lib/src/decoder/launchpad/moonit.rs similarity index 84% rename from kb-lib/src/decoder/launchpad/moonit.rs rename to ks-lib/src/decoder/launchpad/moonit.rs index 38b8b53..69bbb7b 100644 --- a/kb-lib/src/decoder/launchpad/moonit.rs +++ b/ks-lib/src/decoder/launchpad/moonit.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/launchpad/moonit.rs -// version: 4 +// file: ks-lib/src/decoder/launchpad/moonit.rs +// version: 5 //! Reserved protocol decoder for `launchpad_moonit`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadMoonitDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_MOONIT_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_MOONIT_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadMoonitDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/launchpad/orca_wavebreak.rs b/ks-lib/src/decoder/launchpad/orca_wavebreak.rs similarity index 84% rename from kb-lib/src/decoder/launchpad/orca_wavebreak.rs rename to ks-lib/src/decoder/launchpad/orca_wavebreak.rs index 62458bd..176f305 100644 --- a/kb-lib/src/decoder/launchpad/orca_wavebreak.rs +++ b/ks-lib/src/decoder/launchpad/orca_wavebreak.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/launchpad/orca_wavebreak.rs -// version: 4 +// file: ks-lib/src/decoder/launchpad/orca_wavebreak.rs +// version: 5 //! Reserved protocol decoder for `launchpad_orca_wavebreak`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadOrcaWavebreakDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_ORCA_WAVEBREAK_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_ORCA_WAVEBREAK_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadOrcaWavebreakDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/launchpad/printr.rs b/ks-lib/src/decoder/launchpad/printr.rs similarity index 84% rename from kb-lib/src/decoder/launchpad/printr.rs rename to ks-lib/src/decoder/launchpad/printr.rs index 269c2b0..4695736 100644 --- a/kb-lib/src/decoder/launchpad/printr.rs +++ b/ks-lib/src/decoder/launchpad/printr.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/launchpad/printr.rs -// version: 4 +// file: ks-lib/src/decoder/launchpad/printr.rs +// version: 5 //! Reserved protocol decoder for `launchpad_printr`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadPrintrDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_PRINTR_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_PRINTR_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadPrintrDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/launchpad/pump_fun.rs b/ks-lib/src/decoder/launchpad/pump_fun.rs similarity index 84% rename from kb-lib/src/decoder/launchpad/pump_fun.rs rename to ks-lib/src/decoder/launchpad/pump_fun.rs index 7e9e20d..2f6fdc8 100644 --- a/kb-lib/src/decoder/launchpad/pump_fun.rs +++ b/ks-lib/src/decoder/launchpad/pump_fun.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/launchpad/pump_fun.rs -// version: 4 +// file: ks-lib/src/decoder/launchpad/pump_fun.rs +// version: 5 //! Reserved protocol decoder for `launchpad_pump_fun`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadPumpFunDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_PUMP_FUN_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_PUMP_FUN_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadPumpFunDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/launchpad/pump_pumpup_ai.rs b/ks-lib/src/decoder/launchpad/pump_pumpup_ai.rs similarity index 84% rename from kb-lib/src/decoder/launchpad/pump_pumpup_ai.rs rename to ks-lib/src/decoder/launchpad/pump_pumpup_ai.rs index 867a2a1..7a52051 100644 --- a/kb-lib/src/decoder/launchpad/pump_pumpup_ai.rs +++ b/ks-lib/src/decoder/launchpad/pump_pumpup_ai.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/launchpad/pump_pumpup_ai.rs -// version: 4 +// file: ks-lib/src/decoder/launchpad/pump_pumpup_ai.rs +// version: 5 //! Reserved protocol decoder for `launchpad_pump_pumpup_ai`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadPumpPumpupAiDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_PUMP_PUMPUP_AI_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_PUMP_PUMPUP_AI_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadPumpPumpupAiDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/launchpad/raydium_launchlab.rs b/ks-lib/src/decoder/launchpad/raydium_launchlab.rs similarity index 84% rename from kb-lib/src/decoder/launchpad/raydium_launchlab.rs rename to ks-lib/src/decoder/launchpad/raydium_launchlab.rs index a5901ba..e006f1b 100644 --- a/kb-lib/src/decoder/launchpad/raydium_launchlab.rs +++ b/ks-lib/src/decoder/launchpad/raydium_launchlab.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/launchpad/raydium_launchlab.rs -// version: 4 +// file: ks-lib/src/decoder/launchpad/raydium_launchlab.rs +// version: 5 //! Reserved protocol decoder for `launchpad_raydium_launchlab`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadRaydiumLaunchlabDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_RAYDIUM_LAUNCHLAB_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_RAYDIUM_LAUNCHLAB_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadRaydiumLaunchlabDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/launchpad/virtuals.rs b/ks-lib/src/decoder/launchpad/virtuals.rs similarity index 84% rename from kb-lib/src/decoder/launchpad/virtuals.rs rename to ks-lib/src/decoder/launchpad/virtuals.rs index ddde032..6446d8b 100644 --- a/kb-lib/src/decoder/launchpad/virtuals.rs +++ b/ks-lib/src/decoder/launchpad/virtuals.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/launchpad/virtuals.rs -// version: 4 +// file: ks-lib/src/decoder/launchpad/virtuals.rs +// version: 5 //! Reserved protocol decoder for `launchpad_virtuals`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadVirtualsDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_VIRTUALS_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_VIRTUALS_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLaunchpadVirtualsDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/lending.rs b/ks-lib/src/decoder/lending.rs similarity index 95% rename from kb-lib/src/decoder/lending.rs rename to ks-lib/src/decoder/lending.rs index 2fe76a0..5fbc4d6 100644 --- a/kb-lib/src/decoder/lending.rs +++ b/ks-lib/src/decoder/lending.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/lending.rs -// version: 4 +// file: ks-lib/src/decoder/lending.rs +// version: 5 //! `lending` decoder family. diff --git a/kb-lib/src/decoder/lending/clone.rs b/ks-lib/src/decoder/lending/clone.rs similarity index 84% rename from kb-lib/src/decoder/lending/clone.rs rename to ks-lib/src/decoder/lending/clone.rs index 3638136..83d5851 100644 --- a/kb-lib/src/decoder/lending/clone.rs +++ b/ks-lib/src/decoder/lending/clone.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/lending/clone.rs -// version: 4 +// file: ks-lib/src/decoder/lending/clone.rs +// version: 5 //! Reserved protocol decoder for `lending_clone`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLendingCloneDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LENDING_CLONE_PROGRAM_ID]; + return &[ks_program_ids::LENDING_CLONE_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLendingCloneDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/lending/jupiter_lend_borrow.rs b/ks-lib/src/decoder/lending/jupiter_lend_borrow.rs similarity index 84% rename from kb-lib/src/decoder/lending/jupiter_lend_borrow.rs rename to ks-lib/src/decoder/lending/jupiter_lend_borrow.rs index 4a14247..32a463d 100644 --- a/kb-lib/src/decoder/lending/jupiter_lend_borrow.rs +++ b/ks-lib/src/decoder/lending/jupiter_lend_borrow.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/lending/jupiter_lend_borrow.rs -// version: 4 +// file: ks-lib/src/decoder/lending/jupiter_lend_borrow.rs +// version: 5 //! Reserved protocol decoder for `lending_jupiter_lend_borrow`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLendingJupiterLendBorrowDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LENDING_JUPITER_LEND_BORROW_PROGRAM_ID]; + return &[ks_program_ids::LENDING_JUPITER_LEND_BORROW_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLendingJupiterLendBorrowDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/lending/jupiter_lend_earn.rs b/ks-lib/src/decoder/lending/jupiter_lend_earn.rs similarity index 84% rename from kb-lib/src/decoder/lending/jupiter_lend_earn.rs rename to ks-lib/src/decoder/lending/jupiter_lend_earn.rs index cf5475f..b7ae6a1 100644 --- a/kb-lib/src/decoder/lending/jupiter_lend_earn.rs +++ b/ks-lib/src/decoder/lending/jupiter_lend_earn.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/lending/jupiter_lend_earn.rs -// version: 4 +// file: ks-lib/src/decoder/lending/jupiter_lend_earn.rs +// version: 5 //! Reserved protocol decoder for `lending_jupiter_lend_earn`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLendingJupiterLendEarnDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LENDING_JUPITER_LEND_EARN_PROGRAM_ID]; + return &[ks_program_ids::LENDING_JUPITER_LEND_EARN_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLendingJupiterLendEarnDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/lending/jupiter_lend_flash_loan.rs b/ks-lib/src/decoder/lending/jupiter_lend_flash_loan.rs similarity index 84% rename from kb-lib/src/decoder/lending/jupiter_lend_flash_loan.rs rename to ks-lib/src/decoder/lending/jupiter_lend_flash_loan.rs index 7872980..ba2a6bf 100644 --- a/kb-lib/src/decoder/lending/jupiter_lend_flash_loan.rs +++ b/ks-lib/src/decoder/lending/jupiter_lend_flash_loan.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/lending/jupiter_lend_flash_loan.rs -// version: 4 +// file: ks-lib/src/decoder/lending/jupiter_lend_flash_loan.rs +// version: 5 //! Reserved protocol decoder for `lending_jupiter_lend_flash_loan`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLendingJupiterLendFlashLoanDecoder } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LENDING_JUPITER_LEND_FLASH_LOAN_PROGRAM_ID]; + return &[ks_program_ids::LENDING_JUPITER_LEND_FLASH_LOAN_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLendingJupiterLendFlashLoanDecoder fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/lending/jupiter_lend_liquidity.rs b/ks-lib/src/decoder/lending/jupiter_lend_liquidity.rs similarity index 84% rename from kb-lib/src/decoder/lending/jupiter_lend_liquidity.rs rename to ks-lib/src/decoder/lending/jupiter_lend_liquidity.rs index 6859f30..2189057 100644 --- a/kb-lib/src/decoder/lending/jupiter_lend_liquidity.rs +++ b/ks-lib/src/decoder/lending/jupiter_lend_liquidity.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/lending/jupiter_lend_liquidity.rs -// version: 4 +// file: ks-lib/src/decoder/lending/jupiter_lend_liquidity.rs +// version: 5 //! Reserved protocol decoder for `lending_jupiter_lend_liquidity`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLendingJupiterLendLiquidityDecoder } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LENDING_JUPITER_LEND_LIQUIDITY_PROGRAM_ID]; + return &[ks_program_ids::LENDING_JUPITER_LEND_LIQUIDITY_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLendingJupiterLendLiquidityDecoder fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/lending/kamino.rs b/ks-lib/src/decoder/lending/kamino.rs similarity index 84% rename from kb-lib/src/decoder/lending/kamino.rs rename to ks-lib/src/decoder/lending/kamino.rs index 052b2c2..e4f8c4c 100644 --- a/kb-lib/src/decoder/lending/kamino.rs +++ b/ks-lib/src/decoder/lending/kamino.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/lending/kamino.rs -// version: 4 +// file: ks-lib/src/decoder/lending/kamino.rs +// version: 5 //! Reserved protocol decoder for `lending_kamino`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLendingKaminoDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LENDING_KAMINO_PROGRAM_ID]; + return &[ks_program_ids::LENDING_KAMINO_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLendingKaminoDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/lending/marginfi_v2.rs b/ks-lib/src/decoder/lending/marginfi_v2.rs similarity index 84% rename from kb-lib/src/decoder/lending/marginfi_v2.rs rename to ks-lib/src/decoder/lending/marginfi_v2.rs index 37a96f5..6f2fe88 100644 --- a/kb-lib/src/decoder/lending/marginfi_v2.rs +++ b/ks-lib/src/decoder/lending/marginfi_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/lending/marginfi_v2.rs -// version: 4 +// file: ks-lib/src/decoder/lending/marginfi_v2.rs +// version: 5 //! Reserved protocol decoder for `lending_marginfi_v2`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLendingMarginfiV2Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LENDING_MARGINFI_V2_PROGRAM_ID]; + return &[ks_program_ids::LENDING_MARGINFI_V2_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLendingMarginfiV2Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/lock.rs b/ks-lib/src/decoder/lock.rs similarity index 75% rename from kb-lib/src/decoder/lock.rs rename to ks-lib/src/decoder/lock.rs index d899e7f..462e050 100644 --- a/kb-lib/src/decoder/lock.rs +++ b/ks-lib/src/decoder/lock.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/lock.rs -// version: 4 +// file: ks-lib/src/decoder/lock.rs +// version: 5 //! `lock` decoder family. diff --git a/kb-lib/src/decoder/lock/raydium_lp.rs b/ks-lib/src/decoder/lock/raydium_lp.rs similarity index 84% rename from kb-lib/src/decoder/lock/raydium_lp.rs rename to ks-lib/src/decoder/lock/raydium_lp.rs index bb2c75d..1c01196 100644 --- a/kb-lib/src/decoder/lock/raydium_lp.rs +++ b/ks-lib/src/decoder/lock/raydium_lp.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/lock/raydium_lp.rs -// version: 4 +// file: ks-lib/src/decoder/lock/raydium_lp.rs +// version: 5 //! Reserved protocol decoder for `lock_raydium_lp`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLockRaydiumLpDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LOCK_RAYDIUM_LP_PROGRAM_ID]; + return &[ks_program_ids::LOCK_RAYDIUM_LP_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcLockRaydiumLpDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/metadata.rs b/ks-lib/src/decoder/metadata.rs similarity index 99% rename from kb-lib/src/decoder/metadata.rs rename to ks-lib/src/decoder/metadata.rs index c214029..253172f 100644 --- a/kb-lib/src/decoder/metadata.rs +++ b/ks-lib/src/decoder/metadata.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/metadata.rs -// version: 11 +// file: ks-lib/src/decoder/metadata.rs +// version: 12 //! `metadata` decoder family. diff --git a/kb-lib/src/decoder/metadata/metaplex_token_metadata.rs b/ks-lib/src/decoder/metadata/metaplex_token_metadata.rs similarity index 99% rename from kb-lib/src/decoder/metadata/metaplex_token_metadata.rs rename to ks-lib/src/decoder/metadata/metaplex_token_metadata.rs index 5db4e78..7376ebb 100644 --- a/kb-lib/src/decoder/metadata/metaplex_token_metadata.rs +++ b/ks-lib/src/decoder/metadata/metaplex_token_metadata.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/metadata/metaplex_token_metadata.rs -// version: 4 +// file: ks-lib/src/decoder/metadata/metaplex_token_metadata.rs +// version: 5 //! Contextual instruction and bounded account decoder for Metaplex Token Metadata. diff --git a/kb-lib/src/decoder/metadata/metaplex_token_metadata/account.rs b/ks-lib/src/decoder/metadata/metaplex_token_metadata/account.rs similarity index 97% rename from kb-lib/src/decoder/metadata/metaplex_token_metadata/account.rs rename to ks-lib/src/decoder/metadata/metaplex_token_metadata/account.rs index 204ae9e..1d27c25 100644 --- a/kb-lib/src/decoder/metadata/metaplex_token_metadata/account.rs +++ b/ks-lib/src/decoder/metadata/metaplex_token_metadata/account.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/metadata/metaplex_token_metadata/account.rs -// version: 15 +// file: ks-lib/src/decoder/metadata/metaplex_token_metadata/account.rs +// version: 16 //! Bounded decoding and PDA validation for Metaplex Token Metadata accounts. @@ -255,7 +255,7 @@ pub fn decoder_metadata_metaplex_token_metadata_decode_metadata_account( }, }; let expected_owner = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { @@ -459,7 +459,7 @@ pub fn decoder_metadata_metaplex_token_metadata_decode_edition_account( }, }; let expected_owner = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { @@ -674,7 +674,7 @@ pub fn decoder_metadata_metaplex_token_metadata_decode_edition_marker_account( }, }; let program_key = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { @@ -878,7 +878,7 @@ pub fn decoder_metadata_metaplex_token_metadata_decode_token_record_account( }, }; let expected_owner = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { @@ -1020,7 +1020,7 @@ fn parse_record_boundary( }, }; let expected_owner = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { @@ -1687,7 +1687,7 @@ pub fn decoder_metadata_metaplex_token_metadata_decode_reservation_list_account( }, }; let program_key = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { @@ -1959,7 +1959,7 @@ mod tests { }; let snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_metadata_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &data, ) { std::result::Result::Ok(value) => value, @@ -1993,7 +1993,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_metadata_account( &solana_pubkey::Pubkey::new_unique().to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &data ), std::result::Result::Err( @@ -2003,7 +2003,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_metadata_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &[] ), std::result::Result::Err( @@ -2030,7 +2030,7 @@ mod tests { let master_v2_snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_edition_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), &master_v2_data, ) { @@ -2056,7 +2056,7 @@ mod tests { let edition_snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_edition_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), &edition_data, ) { @@ -2092,7 +2092,7 @@ mod tests { assert!( crate::decoder_metadata_metaplex_token_metadata_decode_edition_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), padded.as_slice(), ) @@ -2116,7 +2116,7 @@ mod tests { assert!( crate::decoder_metadata_metaplex_token_metadata_decode_edition_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), padded.as_slice(), ) @@ -2128,7 +2128,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_edition_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), unexpected_len.as_slice(), ), @@ -2141,7 +2141,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_edition_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), non_zero_padding.as_slice(), ), @@ -2173,7 +2173,7 @@ mod tests { mpl_token_metadata::types::TokenStandard::ProgrammableNonFungible as u8; let snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_edition_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), pnft.as_slice(), ) { @@ -2190,7 +2190,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_edition_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), invalid_fee_flag.as_slice(), ), @@ -2204,7 +2204,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_edition_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), invalid_token_standard.as_slice(), ), @@ -2231,7 +2231,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_edition_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), invalid_reserved.as_slice(), ), @@ -2260,7 +2260,7 @@ mod tests { }; let snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_edition_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), &data, ) { @@ -2277,7 +2277,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_edition_account( &solana_pubkey::Pubkey::new_unique().to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), &data ), @@ -2288,7 +2288,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_edition_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), &[255] ), @@ -2302,7 +2302,7 @@ mod tests { fn edition_marker_v1_decodes_group_bitmap_and_exact_pda() { let mint = mpl_token_metadata::ID.to_string(); let program = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("program parse failed: {error}"), @@ -2339,7 +2339,7 @@ mod tests { let snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_edition_marker_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint, edition, &data, @@ -2359,7 +2359,7 @@ mod tests { fn edition_marker_v2_decodes_extensible_bitmap_and_rejects_boundaries() { let mint = mpl_token_metadata::ID.to_string(); let program = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("program parse failed: {error}"), @@ -2385,7 +2385,7 @@ mod tests { let snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_edition_marker_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint, 9, &data, @@ -2406,7 +2406,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_edition_marker_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint, 9, &suffixed @@ -2418,7 +2418,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_edition_marker_account( &solana_pubkey::Pubkey::new_unique().to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint, 9, &data @@ -2434,7 +2434,7 @@ mod tests { let mint = solana_pubkey::Pubkey::new_unique(); let token = solana_pubkey::Pubkey::new_unique(); let program = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("program parse failed: {error}"), @@ -2462,7 +2462,7 @@ mod tests { let snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_token_record_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), &token.to_string(), &data, @@ -2500,7 +2500,7 @@ mod tests { let mint = solana_pubkey::Pubkey::new_unique(); let token = solana_pubkey::Pubkey::new_unique(); let program = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("program parse failed: {error}"), @@ -2542,7 +2542,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_token_record_account( &solana_pubkey::Pubkey::new_unique().to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), &token.to_string(), &data @@ -2556,7 +2556,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_token_record_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), &token.to_string(), &wrong_bump @@ -2569,7 +2569,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_token_record_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), &token.to_string(), &wrong_key @@ -2581,7 +2581,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_token_record_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), &token.to_string(), &data[..data.len() - 1] @@ -2595,7 +2595,7 @@ mod tests { #[test] fn delegate_records_decode_exact_role_seeds_and_pdas() { let program = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("program parse failed: {error}"), @@ -2632,7 +2632,7 @@ mod tests { assert_eq!(data.len(), mpl_token_metadata::accounts::MetadataDelegateRecord::LEN); let snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_metadata_delegate_record_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, role, &data, ) { @@ -2669,7 +2669,7 @@ mod tests { }; let holder_snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_holder_delegate_record_account( &holder_account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &authority.to_string(), holder_role, &holder_data, @@ -2684,7 +2684,7 @@ mod tests { #[test] fn authority_records_decode_exact_values_and_reject_invalid_boundaries() { let program = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("program parse failed: {error}"), @@ -2714,7 +2714,7 @@ mod tests { }; let collection_snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_collection_authority_record_account( &collection_account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), &authority.to_string(), &collection_data, @@ -2745,7 +2745,7 @@ mod tests { }; let use_snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_use_authority_record_account( &use_account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), &authority.to_string(), &use_data, @@ -2757,7 +2757,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_use_authority_record_account( &solana_pubkey::Pubkey::new_unique().to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), &authority.to_string(), &use_data @@ -2769,7 +2769,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_use_authority_record_account( &use_account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &mint.to_string(), &authority.to_string(), &use_data[..9] @@ -2783,7 +2783,7 @@ mod tests { #[test] fn token_owned_escrow_decodes_token_owner_and_creator_authorities() { let program = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("program parse failed: {error}"), @@ -2808,7 +2808,7 @@ mod tests { let owner_snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_token_owned_escrow_account( &owner_account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &owner_data, ) { std::result::Result::Ok(value) => value, @@ -2847,7 +2847,7 @@ mod tests { let creator_snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_token_owned_escrow_account( &creator_account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &creator_data, ) { std::result::Result::Ok(value) => value, @@ -2866,7 +2866,7 @@ mod tests { #[test] fn token_owned_escrow_rejects_wrong_pda_bump_key_and_length() { let program = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("program parse failed: {error}"), @@ -2891,7 +2891,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_token_owned_escrow_account( &solana_pubkey::Pubkey::new_unique().to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &data ), std::result::Result::Err( @@ -2903,7 +2903,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_token_owned_escrow_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &wrong_bump ), std::result::Result::Err( @@ -2914,7 +2914,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_token_owned_escrow_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &wrong_key ), std::result::Result::Err( @@ -2924,7 +2924,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_token_owned_escrow_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &data[..34] ), std::result::Result::Err( @@ -2936,7 +2936,7 @@ mod tests { #[test] fn historical_reservation_lists_decode_v1_and_v2_exactly() { let program = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("program parse failed: {error}"), @@ -2965,7 +2965,7 @@ mod tests { let snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_reservation_list_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &resource.to_string(), &v1, ) { @@ -2987,7 +2987,7 @@ mod tests { let snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_reservation_list_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &resource.to_string(), &v2, ) { @@ -3082,7 +3082,7 @@ mod tests { #[test] fn historical_reservation_lists_reject_wrong_pda_key_bounds_and_suffix() { let program = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("program parse failed: {error}"), @@ -3106,7 +3106,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_reservation_list_account( &solana_pubkey::Pubkey::new_unique().to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &resource.to_string(), &data ), @@ -3119,7 +3119,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_reservation_list_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &resource.to_string(), &wrong_key ), @@ -3132,7 +3132,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_reservation_list_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &resource.to_string(), &too_many ), @@ -3145,7 +3145,7 @@ mod tests { assert_eq!( crate::decoder_metadata_metaplex_token_metadata_decode_reservation_list_account( &account.to_string(), - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, &resource.to_string(), &suffix ), diff --git a/kb-lib/src/decoder/metadata/metaplex_token_metadata/canonical.rs b/ks-lib/src/decoder/metadata/metaplex_token_metadata/canonical.rs similarity index 99% rename from kb-lib/src/decoder/metadata/metaplex_token_metadata/canonical.rs rename to ks-lib/src/decoder/metadata/metaplex_token_metadata/canonical.rs index bf350e7..b53ab3b 100644 --- a/kb-lib/src/decoder/metadata/metaplex_token_metadata/canonical.rs +++ b/ks-lib/src/decoder/metadata/metaplex_token_metadata/canonical.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/metadata/metaplex_token_metadata/canonical.rs -// version: 2 +// file: ks-lib/src/decoder/metadata/metaplex_token_metadata/canonical.rs +// version: 3 //! Canonical Metaplex account identities, provenance and materialization policy. @@ -129,7 +129,7 @@ fn canonical_identity( discriminant: u8, lifecycle: DcMetadataMtmCanonicalAccountLifecycle, ) -> DcMetadataMtmCanonicalAccountIdentity { - let program_id = kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(); + let program_id = ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(); let materialization = match lifecycle { DcMetadataMtmCanonicalAccountLifecycle::Historical => { DcMetadataMtmCanonicalMaterializationPolicy::HistoricalState diff --git a/kb-lib/src/decoder/metadata/metaplex_token_metadata/constants.rs b/ks-lib/src/decoder/metadata/metaplex_token_metadata/constants.rs similarity index 99% rename from kb-lib/src/decoder/metadata/metaplex_token_metadata/constants.rs rename to ks-lib/src/decoder/metadata/metaplex_token_metadata/constants.rs index 971e922..d7b5df4 100644 --- a/kb-lib/src/decoder/metadata/metaplex_token_metadata/constants.rs +++ b/ks-lib/src/decoder/metadata/metaplex_token_metadata/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/metadata/metaplex_token_metadata/constants.rs -// version: 31 +// file: ks-lib/src/decoder/metadata/metaplex_token_metadata/constants.rs +// version: 32 //! Internal constants for Metaplex Token Metadata decoding. diff --git a/kb-lib/src/decoder/metadata/metaplex_token_metadata/decoder.rs b/ks-lib/src/decoder/metadata/metaplex_token_metadata/decoder.rs similarity index 99% rename from kb-lib/src/decoder/metadata/metaplex_token_metadata/decoder.rs rename to ks-lib/src/decoder/metadata/metaplex_token_metadata/decoder.rs index 3a35570..989d3fd 100644 --- a/kb-lib/src/decoder/metadata/metaplex_token_metadata/decoder.rs +++ b/ks-lib/src/decoder/metadata/metaplex_token_metadata/decoder.rs @@ -1,15 +1,15 @@ -// file: kb-lib/src/decoder/metadata/metaplex_token_metadata/decoder.rs -// version: 39 +// file: ks-lib/src/decoder/metadata/metaplex_token_metadata/decoder.rs +// version: 40 //! Exact contextual dispatch for Metaplex Token Metadata. const SURFACES: &[crate::DcApiDecoderSurface] = &[crate::DcApiDecoderSurface { - program_id: kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + program_id: ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, surface_code: crate::DC_METADATA_MTM_SURFACE_CODE, priority: 100, }]; -const PROGRAM_IDS: &[&str] = &[kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID]; +const PROGRAM_IDS: &[&str] = &[ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID]; /// Exact decoder for the Metaplex Token Metadata program. #[derive(Clone, Debug, Default)] @@ -42,7 +42,7 @@ impl crate::DcApiProtocolDecoder for crate::DcMetadataMetaplexTokenMetadataDecod fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -64,7 +64,7 @@ impl crate::DcApiInstructionDecoder for crate::DcMetadataMetaplexTokenMetadataDe .iter() .map(|(discriminator, code, historical)| { return crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID + program_id: ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID .to_string(), surface_code: std::option::Option::Some( crate::DC_METADATA_MTM_SURFACE_CODE.to_string(), @@ -82,7 +82,7 @@ impl crate::DcApiInstructionDecoder for crate::DcMetadataMetaplexTokenMetadataDe &self, input: &crate::MdCoreInstructionReplayInput, ) -> crate::DcApiDecoderRecognition { - if input.program_id != kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID { + if input.program_id != ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID { return crate::DcApiDecoderRecognition::incompatible(); } let discriminator = @@ -102,7 +102,7 @@ impl crate::DcApiInstructionDecoder for crate::DcMetadataMetaplexTokenMetadataDe &self, input: &crate::MdCoreInstructionReplayInput, ) -> crate::DcApiDecoderExecutionResult { - if input.program_id != kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID { + if input.program_id != ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID { return crate::DcApiDecoderExecutionResult::unsupported(std::option::Option::None); } let result = crate::decoder_metadata_metaplex_token_metadata_decode(input); @@ -175,7 +175,7 @@ mod tests { "signature", 42, path, - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, failed, if failed { std::option::Option::Some(serde_json::json!({"InstructionError":[0,"Custom"]})) @@ -233,7 +233,7 @@ mod tests { "signature", 42, path, - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, failed, if failed { std::option::Option::Some(serde_json::json!({ @@ -493,7 +493,7 @@ mod tests { ); assert_eq!( crate::DcApiProtocolDecoder::program_ids(&decoder), - &[kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID] + &[ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID] ); assert_eq!( crate::TRACING_TARGET_DECODER_METADATA_METAPLEX_TOKEN_METADATA, diff --git a/kb-lib/src/decoder/metadata/metaplex_token_metadata/instruction.rs b/ks-lib/src/decoder/metadata/metaplex_token_metadata/instruction.rs similarity index 98% rename from kb-lib/src/decoder/metadata/metaplex_token_metadata/instruction.rs rename to ks-lib/src/decoder/metadata/metaplex_token_metadata/instruction.rs index 8f5ad12..736500b 100644 --- a/kb-lib/src/decoder/metadata/metaplex_token_metadata/instruction.rs +++ b/ks-lib/src/decoder/metadata/metaplex_token_metadata/instruction.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/metadata/metaplex_token_metadata/instruction.rs -// version: 34 +// file: ks-lib/src/decoder/metadata/metaplex_token_metadata/instruction.rs +// version: 35 //! Bounded Metaplex Token Metadata instruction wire decoding. @@ -133,11 +133,11 @@ pub(crate) fn decoder_metadata_metaplex_token_metadata_decode( fn decode_payload( input: &crate::MdCoreInstructionReplayInput, -) -> kb_core::Result> { +) -> ks_core::Result> { let payload = match input.instruction_payload_json.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Metaplex Token Metadata instruction payload is not retained", )); }, @@ -145,13 +145,13 @@ fn decode_payload( let encoded = match payload.get("dataBase64").and_then(serde_json::Value::as_str) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Metaplex Token Metadata payload does not contain dataBase64", )); }, }; if encoded.len() > crate::DC_METADATA_MTM_MAX_BASE64_BYTES { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Metaplex Token Metadata base64 payload exceeds {} bytes", crate::DC_METADATA_MTM_MAX_BASE64_BYTES ))); @@ -159,13 +159,13 @@ fn decode_payload( let decoded = match base64::engine::general_purpose::STANDARD.decode(encoded.as_bytes()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Metaplex Token Metadata payload is not valid base64: {error}" ))); }, }; if decoded.len() > crate::DC_METADATA_MTM_MAX_INSTRUCTION_BYTES { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Metaplex Token Metadata payload exceeds {} decoded bytes", crate::DC_METADATA_MTM_MAX_INSTRUCTION_BYTES ))); @@ -1032,24 +1032,24 @@ fn validate_data_v2( fn resolve_accounts( input: &crate::MdCoreInstructionReplayInput, -) -> kb_core::Result> { +) -> ks_core::Result> { let instruction_accounts = match input.instruction_accounts_json.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Metaplex Token Metadata instruction accounts must be a JSON array", )); }, }; if instruction_accounts.len() > crate::DC_METADATA_MTM_MAX_INSTRUCTION_ACCOUNTS { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Metaplex Token Metadata instruction account count exceeds bound", )); } let account_keys = match input.account_keys_json.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Metaplex Token Metadata transaction account keys must be a JSON array", )); }, @@ -1059,7 +1059,7 @@ fn resolve_accounts( let account_index = match account.get("accountIndex").and_then(serde_json::Value::as_u64) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Metaplex Token Metadata instruction account {position} has no accountIndex" ))); }, @@ -1067,7 +1067,7 @@ fn resolve_accounts( let account_key = match account.get("accountKey").and_then(serde_json::Value::as_str) { std::option::Option::Some(value) if !value.trim().is_empty() => value, _ => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Metaplex Token Metadata instruction account {position} has no accountKey" ))); }, @@ -1078,7 +1078,7 @@ fn resolve_accounts( }) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Metaplex Token Metadata account index {account_index} is not resolved" ))); }, @@ -1086,14 +1086,14 @@ fn resolve_accounts( if resolved.get("accountKey").and_then(serde_json::Value::as_str) != std::option::Option::Some(account_key) { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Metaplex Token Metadata account index {account_index} resolves to a different key" ))); } let signer = match resolved.get("signer").and_then(serde_json::Value::as_bool) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Metaplex Token Metadata account index {account_index} has no signer flag" ))); }, @@ -1101,7 +1101,7 @@ fn resolve_accounts( let writable = match resolved.get("writable").and_then(serde_json::Value::as_bool) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Metaplex Token Metadata account index {account_index} has no writable flag" ))); }, @@ -1183,7 +1183,7 @@ fn validate_accounts( }, }; if master_edition.account_key.as_str() - != kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID + != ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID && !master_edition.writable { return std::result::Result::Err( @@ -1224,7 +1224,7 @@ fn validate_accounts( }, }; if account.account_key.as_str() - != kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID + != ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID && !account.writable { return std::result::Result::Err(format!( @@ -1279,7 +1279,7 @@ fn validate_accounts( ); } if edition_token_record.account_key.as_str() - != kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID + != ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID && !edition_token_record.writable { return std::result::Result::Err( @@ -1516,7 +1516,7 @@ fn validate_accounts( }, }; if token_record.account_key.as_str() - != kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID + != ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID && !token_record.writable { return std::result::Result::Err(format!( @@ -1562,7 +1562,7 @@ fn validate_accounts( )); } if account.account_key.as_str() - != kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID + != ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID && !account.writable { return std::result::Result::Err(format!( @@ -1602,7 +1602,7 @@ fn validate_accounts( }, }; if collection_metadata.account_key.as_str() - != kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID + != ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID && !collection_metadata.writable { return std::result::Result::Err( @@ -1643,7 +1643,7 @@ fn validate_accounts( }, }; if collection_metadata.account_key.as_str() - != kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID + != ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID && !collection_metadata.writable { return std::result::Result::Err( @@ -1730,7 +1730,7 @@ fn validate_accounts( }, }; if account.account_key.as_str() - != kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID + != ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID && !account.writable { return std::result::Result::Err(format!( diff --git a/kb-lib/src/decoder/metadata/solana_program_metadata.rs b/ks-lib/src/decoder/metadata/solana_program_metadata.rs similarity index 98% rename from kb-lib/src/decoder/metadata/solana_program_metadata.rs rename to ks-lib/src/decoder/metadata/solana_program_metadata.rs index 81e6db3..a011746 100644 --- a/kb-lib/src/decoder/metadata/solana_program_metadata.rs +++ b/ks-lib/src/decoder/metadata/solana_program_metadata.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/metadata/solana_program_metadata.rs -// version: 5 +// file: ks-lib/src/decoder/metadata/solana_program_metadata.rs +// version: 6 //! Public Solana Program Metadata models and exact account and instruction decoders. diff --git a/kb-lib/src/decoder/metadata/solana_program_metadata/account.rs b/ks-lib/src/decoder/metadata/solana_program_metadata/account.rs similarity index 98% rename from kb-lib/src/decoder/metadata/solana_program_metadata/account.rs rename to ks-lib/src/decoder/metadata/solana_program_metadata/account.rs index 6116a73..4a5b372 100644 --- a/kb-lib/src/decoder/metadata/solana_program_metadata/account.rs +++ b/ks-lib/src/decoder/metadata/solana_program_metadata/account.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/metadata/solana_program_metadata/account.rs -// version: 3 +// file: ks-lib/src/decoder/metadata/solana_program_metadata/account.rs +// version: 4 //! Bounded account decoding for the Solana Program Metadata program. @@ -449,7 +449,7 @@ fn decoder_metadata_solana_program_metadata_validate_account_context( }, }; let expected_owner = match ::from_str( - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { @@ -568,7 +568,7 @@ fn decoder_metadata_solana_program_metadata_validate_metadata_pda( mod tests { fn metadata_program_id() -> std::option::Option { return match ::from_str( - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => std::option::Option::Some(value), std::result::Result::Err(_) => std::option::Option::None, @@ -653,7 +653,7 @@ mod tests { assert_eq!( matrix["program_id"], serde_json::Value::String( - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), ), ); assert_eq!( @@ -691,7 +691,7 @@ mod tests { data.extend_from_slice(&[8_u8, 9_u8]); let result = crate::decoder_metadata_solana_program_metadata_decode_buffer_account( account.to_string().as_str(), - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, &data, ); assert!(result.is_ok()); @@ -708,7 +708,7 @@ mod tests { zeroable[1..65].fill(0); let zeroable_result = crate::decoder_metadata_solana_program_metadata_decode_buffer_account( account.to_string().as_str(), - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, &zeroable, ); assert!(zeroable_result.is_ok()); @@ -866,7 +866,7 @@ mod tests { assert_eq!( crate::decoder_metadata_solana_program_metadata_decode_account( account.to_string().as_str(), - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, &[], ), std::result::Result::Err(crate::DcMetadataSpmAccountDecodeError::EmptyAccountData), @@ -875,7 +875,7 @@ mod tests { assert_eq!( crate::decoder_metadata_solana_program_metadata_decode_account( account.to_string().as_str(), - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, &oversized, ), std::result::Result::Err(crate::DcMetadataSpmAccountDecodeError::AccountDataTooLarge { @@ -886,7 +886,7 @@ mod tests { assert_eq!( crate::decoder_metadata_solana_program_metadata_decode_account( "invalid", - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, &[1_u8], ), std::result::Result::Err(crate::DcMetadataSpmAccountDecodeError::InvalidAccountKey), @@ -902,7 +902,7 @@ mod tests { assert_eq!( crate::decoder_metadata_solana_program_metadata_decode_account( account.to_string().as_str(), - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, &[0_u8], ), std::result::Result::Err(crate::DcMetadataSpmAccountDecodeError::UninitializedAccount), @@ -910,7 +910,7 @@ mod tests { assert_eq!( crate::decoder_metadata_solana_program_metadata_decode_account( account.to_string().as_str(), - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, &[9_u8], ), std::result::Result::Err(crate::DcMetadataSpmAccountDecodeError::Model( @@ -920,7 +920,7 @@ mod tests { assert_eq!( crate::decoder_metadata_solana_program_metadata_decode_buffer_account( account.to_string().as_str(), - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, &[1_u8], ), std::result::Result::Err(crate::DcMetadataSpmAccountDecodeError::TruncatedHeader { @@ -935,7 +935,7 @@ mod tests { assert_eq!( crate::decoder_metadata_solana_program_metadata_decode_metadata_account( account.to_string().as_str(), - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, &metadata, ), std::result::Result::Err( diff --git a/kb-lib/src/decoder/metadata/solana_program_metadata/constants.rs b/ks-lib/src/decoder/metadata/solana_program_metadata/constants.rs similarity index 98% rename from kb-lib/src/decoder/metadata/solana_program_metadata/constants.rs rename to ks-lib/src/decoder/metadata/solana_program_metadata/constants.rs index d20bb7a..70f79ab 100644 --- a/kb-lib/src/decoder/metadata/solana_program_metadata/constants.rs +++ b/ks-lib/src/decoder/metadata/solana_program_metadata/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/metadata/solana_program_metadata/constants.rs -// version: 4 +// file: ks-lib/src/decoder/metadata/solana_program_metadata/constants.rs +// version: 5 //! Bounded Solana Program Metadata wire and decoder constants. @@ -46,11 +46,11 @@ pub(crate) const DC_METADATA_SPM_INSTRUCTION_ENTRIES: &[(u8, &str)] = &[ ]; /// Program ids handled by the Solana Program Metadata decoder. pub(crate) const DC_METADATA_SPM_PROGRAM_IDS: &[&str] = - &[kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID]; + &[ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID]; /// Surfaces handled by the Solana Program Metadata decoder. pub(crate) const DC_METADATA_SPM_DECODER_SURFACES: &[crate::DcApiDecoderSurface] = &[crate::DcApiDecoderSurface { - program_id: kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + program_id: ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, surface_code: crate::DC_METADATA_SPM_SURFACE_CODE, priority: 100, }]; diff --git a/kb-lib/src/decoder/metadata/solana_program_metadata/decoder.rs b/ks-lib/src/decoder/metadata/solana_program_metadata/decoder.rs similarity index 93% rename from kb-lib/src/decoder/metadata/solana_program_metadata/decoder.rs rename to ks-lib/src/decoder/metadata/solana_program_metadata/decoder.rs index d8b7134..1f6884d 100644 --- a/kb-lib/src/decoder/metadata/solana_program_metadata/decoder.rs +++ b/ks-lib/src/decoder/metadata/solana_program_metadata/decoder.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/metadata/solana_program_metadata/decoder.rs -// version: 1 +// file: ks-lib/src/decoder/metadata/solana_program_metadata/decoder.rs +// version: 2 //! Exact contextual dispatch for Solana Program Metadata. @@ -34,7 +34,7 @@ impl crate::DcApiProtocolDecoder for crate::DcMetadataSolanaProgramMetadataDecod fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -56,7 +56,7 @@ impl crate::DcApiInstructionDecoder for crate::DcMetadataSolanaProgramMetadataDe .iter() .map(|(tag, code)| { return crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID + program_id: ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID .to_string(), surface_code: std::option::Option::Some( crate::DC_METADATA_SPM_SURFACE_CODE.to_string(), @@ -74,7 +74,7 @@ impl crate::DcApiInstructionDecoder for crate::DcMetadataSolanaProgramMetadataDe &self, input: &crate::MdCoreInstructionReplayInput, ) -> crate::DcApiDecoderRecognition { - if input.program_id != kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID { + if input.program_id != ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID { return crate::DcApiDecoderRecognition::incompatible(); } let discriminator = @@ -94,7 +94,7 @@ impl crate::DcApiInstructionDecoder for crate::DcMetadataSolanaProgramMetadataDe &self, input: &crate::MdCoreInstructionReplayInput, ) -> crate::DcApiDecoderExecutionResult { - if input.program_id != kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID { + if input.program_id != ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID { return crate::DcApiDecoderExecutionResult::unsupported(std::option::Option::None); } let result = crate::decoder_metadata_solana_program_metadata_decode(input); diff --git a/kb-lib/src/decoder/metadata/solana_program_metadata/instruction.rs b/ks-lib/src/decoder/metadata/solana_program_metadata/instruction.rs similarity index 99% rename from kb-lib/src/decoder/metadata/solana_program_metadata/instruction.rs rename to ks-lib/src/decoder/metadata/solana_program_metadata/instruction.rs index 5911cfc..1c62000 100644 --- a/kb-lib/src/decoder/metadata/solana_program_metadata/instruction.rs +++ b/ks-lib/src/decoder/metadata/solana_program_metadata/instruction.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/metadata/solana_program_metadata/instruction.rs -// version: 5 +// file: ks-lib/src/decoder/metadata/solana_program_metadata/instruction.rs +// version: 6 //! Exact contextual instruction decoding for Solana Program Metadata. @@ -708,7 +708,7 @@ fn validate_source_contract( fn optional_account_present(accounts: &[ResolvedAccount], position: usize) -> bool { return accounts.get(position).is_some_and(|account| { - return account.account_key != kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID; + return account.account_key != ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID; }); } @@ -739,7 +739,7 @@ fn accounts_json(code: &str, accounts: &[ResolvedAccount]) -> serde_json::Value let optional = contract.is_some_and(|value| return value.optional); let present = !optional || account.account_key - != kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID; + != ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID; let role = match contract { std::option::Option::Some(value) => value.role, std::option::Option::None => "remaining_account", @@ -819,9 +819,9 @@ fn observation( "preStableNameDecodedSeparately": false, }, "programBoundary": { - "solanaProgramMetadataProgramId": kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, - "metaplexTokenMetadataProgramId": kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, - "token2022ProgramId": kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + "solanaProgramMetadataProgramId": ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + "metaplexTokenMetadataProgramId": ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + "token2022ProgramId": ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, "offchainContentFetched": false, }, }), @@ -927,7 +927,7 @@ mod tests { "signature", 42, path, - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, failed, if failed { std::option::Option::Some(serde_json::json!({"InstructionError":[0,"Custom"]})) @@ -954,7 +954,7 @@ mod tests { } fn placeholder() -> &'static str { - return kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID; + return ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID; } fn decode( diff --git a/kb-lib/src/decoder/metadata/solana_program_metadata/model.rs b/ks-lib/src/decoder/metadata/solana_program_metadata/model.rs similarity index 99% rename from kb-lib/src/decoder/metadata/solana_program_metadata/model.rs rename to ks-lib/src/decoder/metadata/solana_program_metadata/model.rs index da9af02..34b7694 100644 --- a/kb-lib/src/decoder/metadata/solana_program_metadata/model.rs +++ b/ks-lib/src/decoder/metadata/solana_program_metadata/model.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/metadata/solana_program_metadata/model.rs -// version: 3 +// file: ks-lib/src/decoder/metadata/solana_program_metadata/model.rs +// version: 4 //! Public bounded models for the Solana Program Metadata wire contract. diff --git a/kb-lib/src/decoder/metadata/spl_name_service.rs b/ks-lib/src/decoder/metadata/spl_name_service.rs similarity index 84% rename from kb-lib/src/decoder/metadata/spl_name_service.rs rename to ks-lib/src/decoder/metadata/spl_name_service.rs index 9f38d55..06e9353 100644 --- a/kb-lib/src/decoder/metadata/spl_name_service.rs +++ b/ks-lib/src/decoder/metadata/spl_name_service.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/metadata/spl_name_service.rs -// version: 4 +// file: ks-lib/src/decoder/metadata/spl_name_service.rs +// version: 5 //! Reserved protocol decoder for `metadata_spl_name_service`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcMetadataSplNameServiceDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::METADATA_SPL_NAME_SERVICE_PROGRAM_ID]; + return &[ks_program_ids::METADATA_SPL_NAME_SERVICE_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcMetadataSplNameServiceDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/nft.rs b/ks-lib/src/decoder/nft.rs similarity index 86% rename from kb-lib/src/decoder/nft.rs rename to ks-lib/src/decoder/nft.rs index 968a41f..bce4877 100644 --- a/kb-lib/src/decoder/nft.rs +++ b/ks-lib/src/decoder/nft.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/nft.rs -// version: 5 +// file: ks-lib/src/decoder/nft.rs +// version: 6 //! `nft` decoder family. diff --git a/kb-lib/src/decoder/nft/metaplex_bubblegum.rs b/ks-lib/src/decoder/nft/metaplex_bubblegum.rs similarity index 84% rename from kb-lib/src/decoder/nft/metaplex_bubblegum.rs rename to ks-lib/src/decoder/nft/metaplex_bubblegum.rs index 7e0d3eb..9364566 100644 --- a/kb-lib/src/decoder/nft/metaplex_bubblegum.rs +++ b/ks-lib/src/decoder/nft/metaplex_bubblegum.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/nft/metaplex_bubblegum.rs -// version: 4 +// file: ks-lib/src/decoder/nft/metaplex_bubblegum.rs +// version: 5 //! Reserved protocol decoder for `nft_metaplex_bubblegum`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcNftMetaplexBubblegumDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::NFT_METAPLEX_BUBBLEGUM_PROGRAM_ID]; + return &[ks_program_ids::NFT_METAPLEX_BUBBLEGUM_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcNftMetaplexBubblegumDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/nft/tensor_cnft.rs b/ks-lib/src/decoder/nft/tensor_cnft.rs similarity index 84% rename from kb-lib/src/decoder/nft/tensor_cnft.rs rename to ks-lib/src/decoder/nft/tensor_cnft.rs index 986e9bb..b4a38e1 100644 --- a/kb-lib/src/decoder/nft/tensor_cnft.rs +++ b/ks-lib/src/decoder/nft/tensor_cnft.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/nft/tensor_cnft.rs -// version: 1 +// file: ks-lib/src/decoder/nft/tensor_cnft.rs +// version: 2 //! Reserved protocol decoder for `nft_tensor_cnft`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcNftTensorCnftDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::NFT_TENSOR_CNFT_PROGRAM_ID]; + return &[ks_program_ids::NFT_TENSOR_CNFT_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcNftTensorCnftDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/orderbook.rs b/ks-lib/src/decoder/orderbook.rs similarity index 90% rename from kb-lib/src/decoder/orderbook.rs rename to ks-lib/src/decoder/orderbook.rs index ff8707b..f06ea00 100644 --- a/kb-lib/src/decoder/orderbook.rs +++ b/ks-lib/src/decoder/orderbook.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/orderbook.rs -// version: 4 +// file: ks-lib/src/decoder/orderbook.rs +// version: 5 //! `orderbook` decoder family. diff --git a/kb-lib/src/decoder/orderbook/jupiter_limit_order.rs b/ks-lib/src/decoder/orderbook/jupiter_limit_order.rs similarity index 84% rename from kb-lib/src/decoder/orderbook/jupiter_limit_order.rs rename to ks-lib/src/decoder/orderbook/jupiter_limit_order.rs index 0e0f236..0919a23 100644 --- a/kb-lib/src/decoder/orderbook/jupiter_limit_order.rs +++ b/ks-lib/src/decoder/orderbook/jupiter_limit_order.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/orderbook/jupiter_limit_order.rs -// version: 4 +// file: ks-lib/src/decoder/orderbook/jupiter_limit_order.rs +// version: 5 //! Reserved protocol decoder for `orderbook_jupiter_limit_order`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcOrderbookJupiterLimitOrderDecoder } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ORDERBOOK_JUPITER_LIMIT_ORDER_PROGRAM_ID]; + return &[ks_program_ids::ORDERBOOK_JUPITER_LIMIT_ORDER_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcOrderbookJupiterLimitOrderDecoder fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/orderbook/jupiter_limit_order_v2.rs b/ks-lib/src/decoder/orderbook/jupiter_limit_order_v2.rs similarity index 84% rename from kb-lib/src/decoder/orderbook/jupiter_limit_order_v2.rs rename to ks-lib/src/decoder/orderbook/jupiter_limit_order_v2.rs index 001f9b4..17949d5 100644 --- a/kb-lib/src/decoder/orderbook/jupiter_limit_order_v2.rs +++ b/ks-lib/src/decoder/orderbook/jupiter_limit_order_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/orderbook/jupiter_limit_order_v2.rs -// version: 4 +// file: ks-lib/src/decoder/orderbook/jupiter_limit_order_v2.rs +// version: 5 //! Reserved protocol decoder for `orderbook_jupiter_limit_order_v2`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcOrderbookJupiterLimitOrderV2Decode } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ORDERBOOK_JUPITER_LIMIT_ORDER_V2_PROGRAM_ID]; + return &[ks_program_ids::ORDERBOOK_JUPITER_LIMIT_ORDER_V2_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcOrderbookJupiterLimitOrderV2Decode fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/orderbook/openbook_v2.rs b/ks-lib/src/decoder/orderbook/openbook_v2.rs similarity index 84% rename from kb-lib/src/decoder/orderbook/openbook_v2.rs rename to ks-lib/src/decoder/orderbook/openbook_v2.rs index aa746ad..dd81025 100644 --- a/kb-lib/src/decoder/orderbook/openbook_v2.rs +++ b/ks-lib/src/decoder/orderbook/openbook_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/orderbook/openbook_v2.rs -// version: 4 +// file: ks-lib/src/decoder/orderbook/openbook_v2.rs +// version: 5 //! Reserved protocol decoder for `orderbook_openbook_v2`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcOrderbookOpenbookV2Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ORDERBOOK_OPENBOOK_V2_PROGRAM_ID]; + return &[ks_program_ids::ORDERBOOK_OPENBOOK_V2_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcOrderbookOpenbookV2Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/perpetuals.rs b/ks-lib/src/decoder/perpetuals.rs similarity index 90% rename from kb-lib/src/decoder/perpetuals.rs rename to ks-lib/src/decoder/perpetuals.rs index 9683170..de6dc3d 100644 --- a/kb-lib/src/decoder/perpetuals.rs +++ b/ks-lib/src/decoder/perpetuals.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/perpetuals.rs -// version: 5 +// file: ks-lib/src/decoder/perpetuals.rs +// version: 6 //! `perpetuals` decoder family. diff --git a/kb-lib/src/decoder/perpetuals/drift_v2.rs b/ks-lib/src/decoder/perpetuals/drift_v2.rs similarity index 84% rename from kb-lib/src/decoder/perpetuals/drift_v2.rs rename to ks-lib/src/decoder/perpetuals/drift_v2.rs index 5ec2bc6..872db40 100644 --- a/kb-lib/src/decoder/perpetuals/drift_v2.rs +++ b/ks-lib/src/decoder/perpetuals/drift_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/perpetuals/drift_v2.rs -// version: 4 +// file: ks-lib/src/decoder/perpetuals/drift_v2.rs +// version: 5 //! Reserved protocol decoder for `perpetuals_drift_v2`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcPerpetualsDriftV2Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::PERPETUALS_DRIFT_V2_PROGRAM_ID]; + return &[ks_program_ids::PERPETUALS_DRIFT_V2_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcPerpetualsDriftV2Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/perpetuals/jupiter.rs b/ks-lib/src/decoder/perpetuals/jupiter.rs similarity index 84% rename from kb-lib/src/decoder/perpetuals/jupiter.rs rename to ks-lib/src/decoder/perpetuals/jupiter.rs index a04eae1..9952650 100644 --- a/kb-lib/src/decoder/perpetuals/jupiter.rs +++ b/ks-lib/src/decoder/perpetuals/jupiter.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/perpetuals/jupiter.rs -// version: 4 +// file: ks-lib/src/decoder/perpetuals/jupiter.rs +// version: 5 //! Reserved protocol decoder for `perpetuals_jupiter`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcPerpetualsJupiterDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::PERPETUALS_JUPITER_PROGRAM_ID]; + return &[ks_program_ids::PERPETUALS_JUPITER_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcPerpetualsJupiterDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/perpetuals/phoenix_eternal.rs b/ks-lib/src/decoder/perpetuals/phoenix_eternal.rs similarity index 84% rename from kb-lib/src/decoder/perpetuals/phoenix_eternal.rs rename to ks-lib/src/decoder/perpetuals/phoenix_eternal.rs index 2171e55..873fc32 100644 --- a/kb-lib/src/decoder/perpetuals/phoenix_eternal.rs +++ b/ks-lib/src/decoder/perpetuals/phoenix_eternal.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/perpetuals/phoenix_eternal.rs -// version: 1 +// file: ks-lib/src/decoder/perpetuals/phoenix_eternal.rs +// version: 2 //! Reserved protocol decoder for `perpetuals_phoenix_eternal`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcPerpetualsPhoenixEternalDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::PERPETUALS_PHOENIX_ETERNAL_PROGRAM_ID]; + return &[ks_program_ids::PERPETUALS_PHOENIX_ETERNAL_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcPerpetualsPhoenixEternalDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/perpetuals/zeta.rs b/ks-lib/src/decoder/perpetuals/zeta.rs similarity index 84% rename from kb-lib/src/decoder/perpetuals/zeta.rs rename to ks-lib/src/decoder/perpetuals/zeta.rs index 14fa209..dda7d7d 100644 --- a/kb-lib/src/decoder/perpetuals/zeta.rs +++ b/ks-lib/src/decoder/perpetuals/zeta.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/perpetuals/zeta.rs -// version: 4 +// file: ks-lib/src/decoder/perpetuals/zeta.rs +// version: 5 //! Reserved protocol decoder for `perpetuals_zeta`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcPerpetualsZetaDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::PERPETUALS_ZETA_PROGRAM_ID]; + return &[ks_program_ids::PERPETUALS_ZETA_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcPerpetualsZetaDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/router.rs b/ks-lib/src/decoder/router.rs similarity index 93% rename from kb-lib/src/decoder/router.rs rename to ks-lib/src/decoder/router.rs index 1ef0b6f..b5d2038 100644 --- a/kb-lib/src/decoder/router.rs +++ b/ks-lib/src/decoder/router.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/router.rs -// version: 5 +// file: ks-lib/src/decoder/router.rs +// version: 6 //! `router` decoder family. diff --git a/kb-lib/src/decoder/router/dflow_aggregator_v4.rs b/ks-lib/src/decoder/router/dflow_aggregator_v4.rs similarity index 84% rename from kb-lib/src/decoder/router/dflow_aggregator_v4.rs rename to ks-lib/src/decoder/router/dflow_aggregator_v4.rs index b52e124..87a8e33 100644 --- a/kb-lib/src/decoder/router/dflow_aggregator_v4.rs +++ b/ks-lib/src/decoder/router/dflow_aggregator_v4.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/router/dflow_aggregator_v4.rs -// version: 4 +// file: ks-lib/src/decoder/router/dflow_aggregator_v4.rs +// version: 5 //! Reserved protocol decoder for `router_dflow_aggregator_v4`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcRouterDflowAggregatorV4Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ROUTER_DFLOW_AGGREGATOR_V4_PROGRAM_ID]; + return &[ks_program_ids::ROUTER_DFLOW_AGGREGATOR_V4_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcRouterDflowAggregatorV4Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/router/jupiter_aggregator_v4.rs b/ks-lib/src/decoder/router/jupiter_aggregator_v4.rs similarity index 84% rename from kb-lib/src/decoder/router/jupiter_aggregator_v4.rs rename to ks-lib/src/decoder/router/jupiter_aggregator_v4.rs index e0678b8..962953c 100644 --- a/kb-lib/src/decoder/router/jupiter_aggregator_v4.rs +++ b/ks-lib/src/decoder/router/jupiter_aggregator_v4.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/router/jupiter_aggregator_v4.rs -// version: 4 +// file: ks-lib/src/decoder/router/jupiter_aggregator_v4.rs +// version: 5 //! Reserved protocol decoder for `router_jupiter_aggregator_v4`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcRouterJupiterAggregatorV4Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ROUTER_JUPITER_AGGREGATOR_V4_PROGRAM_ID]; + return &[ks_program_ids::ROUTER_JUPITER_AGGREGATOR_V4_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcRouterJupiterAggregatorV4Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/router/jupiter_aggregator_v6.rs b/ks-lib/src/decoder/router/jupiter_aggregator_v6.rs similarity index 84% rename from kb-lib/src/decoder/router/jupiter_aggregator_v6.rs rename to ks-lib/src/decoder/router/jupiter_aggregator_v6.rs index 121cd09..6386792 100644 --- a/kb-lib/src/decoder/router/jupiter_aggregator_v6.rs +++ b/ks-lib/src/decoder/router/jupiter_aggregator_v6.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/router/jupiter_aggregator_v6.rs -// version: 4 +// file: ks-lib/src/decoder/router/jupiter_aggregator_v6.rs +// version: 5 //! Reserved protocol decoder for `router_jupiter_aggregator_v6`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcRouterJupiterAggregatorV6Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ROUTER_JUPITER_AGGREGATOR_V6_PROGRAM_ID]; + return &[ks_program_ids::ROUTER_JUPITER_AGGREGATOR_V6_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcRouterJupiterAggregatorV6Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/router/okx_labs_v1.rs b/ks-lib/src/decoder/router/okx_labs_v1.rs similarity index 84% rename from kb-lib/src/decoder/router/okx_labs_v1.rs rename to ks-lib/src/decoder/router/okx_labs_v1.rs index 907536d..2925ed2 100644 --- a/kb-lib/src/decoder/router/okx_labs_v1.rs +++ b/ks-lib/src/decoder/router/okx_labs_v1.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/router/okx_labs_v1.rs -// version: 4 +// file: ks-lib/src/decoder/router/okx_labs_v1.rs +// version: 5 //! Reserved protocol decoder for `router_okx_labs_v1`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcRouterOkxLabsV1Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ROUTER_OKX_LABS_V1_PROGRAM_ID]; + return &[ks_program_ids::ROUTER_OKX_LABS_V1_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcRouterOkxLabsV1Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/router/okx_labs_v2.rs b/ks-lib/src/decoder/router/okx_labs_v2.rs similarity index 84% rename from kb-lib/src/decoder/router/okx_labs_v2.rs rename to ks-lib/src/decoder/router/okx_labs_v2.rs index 5970d6b..ee27342 100644 --- a/kb-lib/src/decoder/router/okx_labs_v2.rs +++ b/ks-lib/src/decoder/router/okx_labs_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/router/okx_labs_v2.rs -// version: 4 +// file: ks-lib/src/decoder/router/okx_labs_v2.rs +// version: 5 //! Reserved protocol decoder for `router_okx_labs_v2`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcRouterOkxLabsV2Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ROUTER_OKX_LABS_V2_PROGRAM_ID]; + return &[ks_program_ids::ROUTER_OKX_LABS_V2_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcRouterOkxLabsV2Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/rwa.rs b/ks-lib/src/decoder/rwa.rs similarity index 78% rename from kb-lib/src/decoder/rwa.rs rename to ks-lib/src/decoder/rwa.rs index 4dcdcb2..31d9c7d 100644 --- a/kb-lib/src/decoder/rwa.rs +++ b/ks-lib/src/decoder/rwa.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/rwa.rs -// version: 4 +// file: ks-lib/src/decoder/rwa.rs +// version: 5 //! `rwa` decoder family. diff --git a/kb-lib/src/decoder/rwa/ondo_global_markets.rs b/ks-lib/src/decoder/rwa/ondo_global_markets.rs similarity index 84% rename from kb-lib/src/decoder/rwa/ondo_global_markets.rs rename to ks-lib/src/decoder/rwa/ondo_global_markets.rs index cd0cad1..8613da0 100644 --- a/kb-lib/src/decoder/rwa/ondo_global_markets.rs +++ b/ks-lib/src/decoder/rwa/ondo_global_markets.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/rwa/ondo_global_markets.rs -// version: 3 +// file: ks-lib/src/decoder/rwa/ondo_global_markets.rs +// version: 4 //! Reserved protocol decoder for `rwa_ondo_global_markets`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcRwaOndoGlobalMarketsDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::RWA_ONDO_GLOBAL_MARKETS_PROGRAM_ID]; + return &[ks_program_ids::RWA_ONDO_GLOBAL_MARKETS_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcRwaOndoGlobalMarketsDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/solana.rs b/ks-lib/src/decoder/solana.rs similarity index 99% rename from kb-lib/src/decoder/solana.rs rename to ks-lib/src/decoder/solana.rs index f09b4e3..315ad44 100644 --- a/kb-lib/src/decoder/solana.rs +++ b/ks-lib/src/decoder/solana.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana.rs -// version: 5 +// file: ks-lib/src/decoder/solana.rs +// version: 6 //! `solana` decoder family. diff --git a/kb-lib/src/decoder/solana/core.rs b/ks-lib/src/decoder/solana/core.rs similarity index 99% rename from kb-lib/src/decoder/solana/core.rs rename to ks-lib/src/decoder/solana/core.rs index 4b67def..9699d24 100644 --- a/kb-lib/src/decoder/solana/core.rs +++ b/ks-lib/src/decoder/solana/core.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core.rs -// version: 19 +// file: ks-lib/src/decoder/solana/core.rs +// version: 20 //! Solana Core decoder component. diff --git a/kb-lib/src/decoder/solana/core/accounts.rs b/ks-lib/src/decoder/solana/core/accounts.rs similarity index 88% rename from kb-lib/src/decoder/solana/core/accounts.rs rename to ks-lib/src/decoder/solana/core/accounts.rs index 26d100f..5678f5b 100644 --- a/kb-lib/src/decoder/solana/core/accounts.rs +++ b/ks-lib/src/decoder/solana/core/accounts.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core/accounts.rs -// version: 4 +// file: ks-lib/src/decoder/solana/core/accounts.rs +// version: 5 //! Resolved account-role validation for native instructions. @@ -44,23 +44,23 @@ pub(crate) fn decoder_solana_core_resolve_accounts( roles: &[crate::DcSolanaCoreAccountRole], minimum_count: usize, maximum_count: std::option::Option, -) -> kb_core::Result { +) -> ks_core::Result { let instruction_accounts = match input.instruction_accounts_json.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "native instruction accounts must be a JSON array", )); }, }; if instruction_accounts.len() < minimum_count { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "native instruction requires at least {minimum_count} accounts but received {}", instruction_accounts.len() ))); } if maximum_count.is_some_and(|value| return instruction_accounts.len() > value) { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "native instruction accepts at most {} accounts but received {}", maximum_count.unwrap_or(0), instruction_accounts.len() @@ -69,7 +69,7 @@ pub(crate) fn decoder_solana_core_resolve_accounts( let account_keys = match input.account_keys_json.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "native transaction account keys must be a JSON array", )); }, @@ -80,7 +80,7 @@ pub(crate) fn decoder_solana_core_resolve_accounts( match instruction_account.get("accountIndex").and_then(serde_json::Value::as_u64) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "native instruction account {position} has no valid accountIndex" ))); }, @@ -89,7 +89,7 @@ pub(crate) fn decoder_solana_core_resolve_accounts( match instruction_account.get("accountKey").and_then(serde_json::Value::as_str) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "native instruction account {position} has no accountKey" ))); }, @@ -101,7 +101,7 @@ pub(crate) fn decoder_solana_core_resolve_accounts( let resolved = match resolved { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "native instruction account index {account_index} is absent from resolved keys" ))); }, @@ -109,13 +109,13 @@ pub(crate) fn decoder_solana_core_resolve_accounts( let resolved_key = match resolved.get("accountKey").and_then(serde_json::Value::as_str) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "resolved native account index {account_index} has no accountKey" ))); }, }; if resolved_key != instruction_key { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "native instruction account index {account_index} resolves to a different key" ))); } diff --git a/kb-lib/src/decoder/solana/core/address_lookup_table.rs b/ks-lib/src/decoder/solana/core/address_lookup_table.rs similarity index 99% rename from kb-lib/src/decoder/solana/core/address_lookup_table.rs rename to ks-lib/src/decoder/solana/core/address_lookup_table.rs index 2b11763..35077a2 100644 --- a/kb-lib/src/decoder/solana/core/address_lookup_table.rs +++ b/ks-lib/src/decoder/solana/core/address_lookup_table.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core/address_lookup_table.rs -// version: 5 +// file: ks-lib/src/decoder/solana/core/address_lookup_table.rs +// version: 6 //! Exact Address Lookup Table instruction decoding through the official interface schema. @@ -315,7 +315,7 @@ fn coverage_entry( std::result::Result::Err(_error) => std::option::Option::None, }; return crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID.to_string(), + program_id: ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID.to_string(), surface_code: std::option::Option::Some( crate::DC_SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE.to_string(), ), @@ -374,7 +374,7 @@ mod tests { "signature", 42, "0", - kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID, + ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID, transaction_failed, if transaction_failed { std::option::Option::Some(serde_json::json!({"InstructionError": [0, "Custom"]})) diff --git a/kb-lib/src/decoder/solana/core/compute_budget.rs b/ks-lib/src/decoder/solana/core/compute_budget.rs similarity index 98% rename from kb-lib/src/decoder/solana/core/compute_budget.rs rename to ks-lib/src/decoder/solana/core/compute_budget.rs index 589c740..e406cb2 100644 --- a/kb-lib/src/decoder/solana/core/compute_budget.rs +++ b/ks-lib/src/decoder/solana/core/compute_budget.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core/compute_budget.rs -// version: 6 +// file: ks-lib/src/decoder/solana/core/compute_budget.rs +// version: 7 //! Maximal current and historical Compute Budget instruction decoding. @@ -347,7 +347,7 @@ fn compute_budget_outer_rows( }; for value in outer_values { if value.get("programId").and_then(serde_json::Value::as_str) - != std::option::Option::Some(kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID) + != std::option::Option::Some(ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID) { continue; } @@ -393,7 +393,7 @@ fn compute_budget_outer_rows( bytes.as_slice(), )); } - if rows.is_empty() && input.program_id == kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID { + if rows.is_empty() && input.program_id == ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID { let bytes_result = crate::decoder_solana_core_decode_instruction_data(input); let bytes = match bytes_result { std::result::Result::Ok(value) => value, @@ -658,7 +658,7 @@ fn coverage_entry( historical: bool, ) -> crate::DcApiDecoderCoverageDeclaration { return crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID.to_string(), + program_id: ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID.to_string(), surface_code: std::option::Option::Some( crate::DC_SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE.to_string(), ), @@ -680,7 +680,7 @@ mod tests { "signature", 42, "0", - kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID, + ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID, transaction_failed, if transaction_failed { std::option::Option::Some(serde_json::json!({"InstructionError": [0, "Custom"]})) @@ -713,7 +713,7 @@ mod tests { "signature", 42, instruction_path, - kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID, + ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID, false, std::option::Option::None, serde_json::json!([]), @@ -753,20 +753,20 @@ mod tests { outer_instruction( 0, "0", - kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID, + ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID, &[2, 64, 66, 15, 0], ), - outer_instruction(1, "1", kb_program_ids::SYSTEM_PROGRAM_ID, &[2, 1, 0, 0, 0],), + outer_instruction(1, "1", ks_program_ids::SYSTEM_PROGRAM_ID, &[2, 1, 0, 0, 0],), outer_instruction( 2, "2", - kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID, + ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID, &[3, 7, 0, 0, 0, 0, 0, 0, 0], ), outer_instruction( 3, "3", - kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID, + ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID, &[2, 128, 132, 30, 0], ), ]); diff --git a/kb-lib/src/decoder/solana/core/config.rs b/ks-lib/src/decoder/solana/core/config.rs similarity index 93% rename from kb-lib/src/decoder/solana/core/config.rs rename to ks-lib/src/decoder/solana/core/config.rs index 23c5fb8..4d05b6e 100644 --- a/kb-lib/src/decoder/solana/core/config.rs +++ b/ks-lib/src/decoder/solana/core/config.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core/config.rs -// version: 4 +// file: ks-lib/src/decoder/solana/core/config.rs +// version: 5 //! Generic bounded Config Program store decoding without inventing payload semantics. @@ -17,7 +17,7 @@ struct ParsedConfigPayload { pub(crate) fn decoder_solana_core_config_coverage() -> std::vec::Vec { return vec![crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::CONFIG_PROGRAM_ID.to_string(), + program_id: ks_program_ids::CONFIG_PROGRAM_ID.to_string(), surface_code: std::option::Option::Some( crate::DC_SOLANA_CORE_CONFIG_SURFACE_CODE.to_string(), ), @@ -135,7 +135,7 @@ pub(crate) fn decoder_solana_core_config_decode( ); } -fn parse_payload(bytes: &[u8]) -> kb_core::Result { +fn parse_payload(bytes: &[u8]) -> ks_core::Result { let length_result = read_compact_u16(bytes); let (key_count, mut offset) = match length_result { std::result::Result::Ok(value) => value, @@ -143,14 +143,14 @@ fn parse_payload(bytes: &[u8]) -> kb_core::Result { }; let key_count_usize = usize::from(key_count); if key_count_usize > MAX_CONFIG_KEYS { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Config key count {key_count_usize} exceeds bounded maximum {}", MAX_CONFIG_KEYS ))); } let required = offset.saturating_add(key_count_usize.saturating_mul(33)); if required > bytes.len() { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Config key vector requires {required} bytes but payload contains {}", bytes.len() ))); @@ -161,7 +161,7 @@ fn parse_payload(bytes: &[u8]) -> kb_core::Result { let pubkey_bytes = match bytes.get(offset..pubkey_end) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Config key {index} pubkey is truncated" ))); }, @@ -169,7 +169,7 @@ fn parse_payload(bytes: &[u8]) -> kb_core::Result { let signer_byte = match bytes.get(pubkey_end) { std::option::Option::Some(value) => *value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Config key {index} signer flag is truncated" ))); }, @@ -178,7 +178,7 @@ fn parse_payload(bytes: &[u8]) -> kb_core::Result { 0 => false, 1 => true, value => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Config key {index} signer flag {value} is not a canonical bool" ))); }, @@ -187,7 +187,7 @@ fn parse_payload(bytes: &[u8]) -> kb_core::Result { if keys.iter().any(|(existing_pubkey, existing_signer)| { return existing_pubkey == &pubkey && *existing_signer == signer; }) { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Config key {index} duplicates an earlier key/signature pair" ))); } @@ -197,11 +197,11 @@ fn parse_payload(bytes: &[u8]) -> kb_core::Result { return std::result::Result::Ok(ParsedConfigPayload { keys, data_offset: offset }); } -fn read_compact_u16(bytes: &[u8]) -> kb_core::Result<(u16, usize)> { +fn read_compact_u16(bytes: &[u8]) -> ks_core::Result<(u16, usize)> { let first = match bytes.first() { std::option::Option::Some(value) => *value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Config compact-u16 key count is missing", )); }, @@ -213,7 +213,7 @@ fn read_compact_u16(bytes: &[u8]) -> kb_core::Result<(u16, usize)> { let second = match bytes.get(1) { std::option::Option::Some(value) => *value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Config compact-u16 key count is truncated after one byte", )); }, @@ -221,7 +221,7 @@ fn read_compact_u16(bytes: &[u8]) -> kb_core::Result<(u16, usize)> { value |= u16::from(second & 0x7f) << 7; if second & 0x80 == 0 { if value < 128 { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Config compact-u16 key count uses a non-canonical two-byte encoding", )); } @@ -230,19 +230,19 @@ fn read_compact_u16(bytes: &[u8]) -> kb_core::Result<(u16, usize)> { let third = match bytes.get(2) { std::option::Option::Some(value) => *value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Config compact-u16 key count is truncated after two bytes", )); }, }; if third & 0xfc != 0 { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Config compact-u16 key count exceeds u16 or has a continuation bit", )); } value |= u16::from(third) << 14; if value < 16_384 { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Config compact-u16 key count uses a non-canonical three-byte encoding", )); } @@ -252,11 +252,11 @@ fn read_compact_u16(bytes: &[u8]) -> kb_core::Result<(u16, usize)> { fn resolve_and_validate_accounts( input: &crate::MdCoreInstructionReplayInput, parsed: &ParsedConfigPayload, -) -> kb_core::Result { +) -> ks_core::Result { let instruction_accounts = match input.instruction_accounts_json.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Config instruction accounts must be an array", )); }, @@ -268,7 +268,7 @@ fn resolve_and_validate_accounts( { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Config instruction requires a config account at position zero", )); }, @@ -297,7 +297,7 @@ fn resolve_and_validate_accounts( let resolved = match accounts.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "resolved Config accounts must be an array", )); }, @@ -309,7 +309,7 @@ fn resolve_and_validate_accounts( .and_then(|value| return value.get("accountKey")) .and_then(serde_json::Value::as_str); if actual != std::option::Option::Some(*expected) { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Config signer account {position} must match encoded key {expected}" ))); } @@ -370,7 +370,7 @@ mod tests { "signature", 42, "0", - kb_program_ids::CONFIG_PROGRAM_ID, + ks_program_ids::CONFIG_PROGRAM_ID, transaction_failed, if transaction_failed { std::option::Option::Some(serde_json::json!({"InstructionError": [0, "Custom"]})) diff --git a/kb-lib/src/decoder/solana/core/constants.rs b/ks-lib/src/decoder/solana/core/constants.rs similarity index 98% rename from kb-lib/src/decoder/solana/core/constants.rs rename to ks-lib/src/decoder/solana/core/constants.rs index a6836dc..71987b1 100644 --- a/kb-lib/src/decoder/solana/core/constants.rs +++ b/ks-lib/src/decoder/solana/core/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core/constants.rs -// version: 15 +// file: ks-lib/src/decoder/solana/core/constants.rs +// version: 16 //! Local constants for the Solana Core decoder component. diff --git a/kb-lib/src/decoder/solana/core/decoder.rs b/ks-lib/src/decoder/solana/core/decoder.rs similarity index 81% rename from kb-lib/src/decoder/solana/core/decoder.rs rename to ks-lib/src/decoder/solana/core/decoder.rs index 8440fea..548e9fe 100644 --- a/kb-lib/src/decoder/solana/core/decoder.rs +++ b/ks-lib/src/decoder/solana/core/decoder.rs @@ -1,120 +1,120 @@ -// file: kb-lib/src/decoder/solana/core/decoder.rs -// version: 27 +// file: ks-lib/src/decoder/solana/core/decoder.rs +// version: 28 //! Runtime-native Solana program classifier for the common decode pipeline. const NATIVE_SURFACES: &[crate::DcApiDecoderSurface] = &[ crate::DcApiDecoderSurface { - program_id: kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID, + program_id: ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID, surface_code: "solana.core.address_lookup_table", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID, + program_id: ks_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID, surface_code: "solana.core.bpf_loader_deprecated", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::BPF_LOADER_PROGRAM_ID, + program_id: ks_program_ids::BPF_LOADER_PROGRAM_ID, surface_code: "solana.core.bpf_loader", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, + program_id: ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, surface_code: "solana.core.bpf_loader_upgradeable", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID, + program_id: ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID, surface_code: "solana.core.compute_budget", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::CONFIG_PROGRAM_ID, + program_id: ks_program_ids::CONFIG_PROGRAM_ID, surface_code: "solana.core.config", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::ED25519_PROGRAM_ID, + program_id: ks_program_ids::ED25519_PROGRAM_ID, surface_code: "solana.core.ed25519", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::FEATURE_PROGRAM_ID, + program_id: ks_program_ids::FEATURE_PROGRAM_ID, surface_code: "solana.core.feature", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::LOADER_V4_PROGRAM_ID, + program_id: ks_program_ids::LOADER_V4_PROGRAM_ID, surface_code: "solana.core.loader_v4", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::NATIVE_LOADER_PROGRAM_ID, + program_id: ks_program_ids::NATIVE_LOADER_PROGRAM_ID, surface_code: "solana.core.loader", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::SECP256K1_PROGRAM_ID, + program_id: ks_program_ids::SECP256K1_PROGRAM_ID, surface_code: "solana.core.secp256k1", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::SECP256R1_PROGRAM_ID, + program_id: ks_program_ids::SECP256R1_PROGRAM_ID, surface_code: "solana.core.secp256r1", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::SLASHING_PROGRAM_ID, + program_id: ks_program_ids::SLASHING_PROGRAM_ID, surface_code: "solana.core.slashing", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::STAKE_PROGRAM_ID, + program_id: ks_program_ids::STAKE_PROGRAM_ID, surface_code: "solana.core.stake", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::SYSTEM_PROGRAM_ID, + program_id: ks_program_ids::SYSTEM_PROGRAM_ID, surface_code: "solana.core.system", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::VOTE_PROGRAM_ID, + program_id: ks_program_ids::VOTE_PROGRAM_ID, surface_code: "solana.core.vote", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, + program_id: ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, surface_code: "solana.core.zk_elgamal_proof", priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID, + program_id: ks_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID, surface_code: "solana.core.zk_token_proof", priority: 100, }, ]; const LEGACY_PROGRAM_IDS: &[&str] = &[ - kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID, - kb_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID, - kb_program_ids::BPF_LOADER_PROGRAM_ID, - kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, - kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID, - kb_program_ids::CONFIG_PROGRAM_ID, - kb_program_ids::ED25519_PROGRAM_ID, - kb_program_ids::FEATURE_PROGRAM_ID, - kb_program_ids::LOADER_V4_PROGRAM_ID, - kb_program_ids::NATIVE_LOADER_PROGRAM_ID, - kb_program_ids::SECP256K1_PROGRAM_ID, - kb_program_ids::SECP256R1_PROGRAM_ID, - kb_program_ids::SLASHING_PROGRAM_ID, - kb_program_ids::STAKE_PROGRAM_ID, - kb_program_ids::SYSTEM_PROGRAM_ID, - kb_program_ids::VOTE_PROGRAM_ID, - kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, - kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID, + ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID, + ks_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID, + ks_program_ids::BPF_LOADER_PROGRAM_ID, + ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, + ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID, + ks_program_ids::CONFIG_PROGRAM_ID, + ks_program_ids::ED25519_PROGRAM_ID, + ks_program_ids::FEATURE_PROGRAM_ID, + ks_program_ids::LOADER_V4_PROGRAM_ID, + ks_program_ids::NATIVE_LOADER_PROGRAM_ID, + ks_program_ids::SECP256K1_PROGRAM_ID, + ks_program_ids::SECP256R1_PROGRAM_ID, + ks_program_ids::SLASHING_PROGRAM_ID, + ks_program_ids::STAKE_PROGRAM_ID, + ks_program_ids::SYSTEM_PROGRAM_ID, + ks_program_ids::VOTE_PROGRAM_ID, + ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, + ks_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID, ]; /// Runtime-native Solana decoder with phased maximal instruction coverage. @@ -148,7 +148,7 @@ impl crate::DcApiProtocolDecoder for crate::DcSolanaCoreDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { tracing::debug!(target: crate::TRACING_TARGET_DECODER_SOLANA_CORE, "legacy native decoder adapter classified an observation without maximal decoding"); return std::result::Result::Ok(std::vec::Vec::new()); } @@ -180,17 +180,17 @@ impl crate::DcApiInstructionDecoder for crate::DcSolanaCoreDecoder { coverage.extend(crate::decoder_solana_core_zk_elgamal_coverage()); coverage.extend(crate::decoder_solana_core_zk_token_proof_coverage()); for surface in NATIVE_SURFACES { - if surface.program_id == kb_program_ids::SYSTEM_PROGRAM_ID - || surface.program_id == kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID - || surface.program_id == kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID - || surface.program_id == kb_program_ids::CONFIG_PROGRAM_ID - || surface.program_id == kb_program_ids::FEATURE_PROGRAM_ID - || surface.program_id == kb_program_ids::VOTE_PROGRAM_ID - || surface.program_id == kb_program_ids::STAKE_PROGRAM_ID + if surface.program_id == ks_program_ids::SYSTEM_PROGRAM_ID + || surface.program_id == ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID + || surface.program_id == ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID + || surface.program_id == ks_program_ids::CONFIG_PROGRAM_ID + || surface.program_id == ks_program_ids::FEATURE_PROGRAM_ID + || surface.program_id == ks_program_ids::VOTE_PROGRAM_ID + || surface.program_id == ks_program_ids::STAKE_PROGRAM_ID || is_signature_precompile(surface.program_id) - || surface.program_id == kb_program_ids::SLASHING_PROGRAM_ID - || surface.program_id == kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID - || surface.program_id == kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID + || surface.program_id == ks_program_ids::SLASHING_PROGRAM_ID + || surface.program_id == ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID + || surface.program_id == ks_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID || is_loader_program(surface.program_id) { continue; @@ -222,27 +222,27 @@ impl crate::DcApiInstructionDecoder for crate::DcSolanaCoreDecoder { return crate::DcApiDecoderRecognition::incompatible(); }, }; - let recognition = if input.program_id == kb_program_ids::SYSTEM_PROGRAM_ID { + let recognition = if input.program_id == ks_program_ids::SYSTEM_PROGRAM_ID { crate::decoder_solana_core_system_recognize(input, surface.priority) - } else if input.program_id == kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID { + } else if input.program_id == ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID { crate::decoder_solana_core_compute_budget_recognize(input, surface.priority) - } else if input.program_id == kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID { + } else if input.program_id == ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID { crate::decoder_solana_core_address_lookup_table_recognize(input, surface.priority) - } else if input.program_id == kb_program_ids::CONFIG_PROGRAM_ID { + } else if input.program_id == ks_program_ids::CONFIG_PROGRAM_ID { crate::decoder_solana_core_config_recognize(input, surface.priority) - } else if input.program_id == kb_program_ids::FEATURE_PROGRAM_ID { + } else if input.program_id == ks_program_ids::FEATURE_PROGRAM_ID { crate::decoder_solana_core_feature_recognize(input, surface.priority) - } else if input.program_id == kb_program_ids::VOTE_PROGRAM_ID { + } else if input.program_id == ks_program_ids::VOTE_PROGRAM_ID { crate::decoder_solana_core_vote_recognize(input, surface.priority) - } else if input.program_id == kb_program_ids::STAKE_PROGRAM_ID { + } else if input.program_id == ks_program_ids::STAKE_PROGRAM_ID { crate::decoder_solana_core_stake_recognize(input, surface.priority) - } else if input.program_id == kb_program_ids::SLASHING_PROGRAM_ID { + } else if input.program_id == ks_program_ids::SLASHING_PROGRAM_ID { crate::decoder_solana_core_slashing_recognize(input, surface.priority) } else if is_signature_precompile(input.program_id.as_str()) { crate::decoder_solana_core_precompiles_recognize(input, surface.priority) - } else if input.program_id == kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID { + } else if input.program_id == ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID { crate::decoder_solana_core_zk_elgamal_recognize(input, surface.priority) - } else if input.program_id == kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID { + } else if input.program_id == ks_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID { crate::decoder_solana_core_zk_token_proof_recognize(input, surface.priority) } else if is_loader_program(input.program_id.as_str()) { crate::decoder_solana_core_loaders_recognize(input, surface.priority) @@ -263,27 +263,27 @@ impl crate::DcApiInstructionDecoder for crate::DcSolanaCoreDecoder { &self, input: &crate::MdCoreInstructionReplayInput, ) -> crate::DcApiDecoderExecutionResult { - let result = if input.program_id == kb_program_ids::SYSTEM_PROGRAM_ID { + let result = if input.program_id == ks_program_ids::SYSTEM_PROGRAM_ID { crate::decoder_solana_core_system_decode(input) - } else if input.program_id == kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID { + } else if input.program_id == ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID { crate::decoder_solana_core_compute_budget_decode(input) - } else if input.program_id == kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID { + } else if input.program_id == ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID { crate::decoder_solana_core_address_lookup_table_decode(input) - } else if input.program_id == kb_program_ids::CONFIG_PROGRAM_ID { + } else if input.program_id == ks_program_ids::CONFIG_PROGRAM_ID { crate::decoder_solana_core_config_decode(input) - } else if input.program_id == kb_program_ids::FEATURE_PROGRAM_ID { + } else if input.program_id == ks_program_ids::FEATURE_PROGRAM_ID { crate::decoder_solana_core_feature_decode(input) - } else if input.program_id == kb_program_ids::VOTE_PROGRAM_ID { + } else if input.program_id == ks_program_ids::VOTE_PROGRAM_ID { crate::decoder_solana_core_vote_decode(input) - } else if input.program_id == kb_program_ids::STAKE_PROGRAM_ID { + } else if input.program_id == ks_program_ids::STAKE_PROGRAM_ID { crate::decoder_solana_core_stake_decode(input) - } else if input.program_id == kb_program_ids::SLASHING_PROGRAM_ID { + } else if input.program_id == ks_program_ids::SLASHING_PROGRAM_ID { crate::decoder_solana_core_slashing_decode(input) } else if is_signature_precompile(input.program_id.as_str()) { crate::decoder_solana_core_precompiles_decode(input) - } else if input.program_id == kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID { + } else if input.program_id == ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID { crate::decoder_solana_core_zk_elgamal_decode(input) - } else if input.program_id == kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID { + } else if input.program_id == ks_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID { crate::decoder_solana_core_zk_token_proof_decode(input) } else if is_loader_program(input.program_id.as_str()) { crate::decoder_solana_core_loaders_decode(input) @@ -323,23 +323,23 @@ impl crate::DcApiInstructionDecoder for crate::DcSolanaCoreDecoder { } fn is_signature_precompile(program_id: &str) -> bool { - return program_id == kb_program_ids::ED25519_PROGRAM_ID - || program_id == kb_program_ids::SECP256K1_PROGRAM_ID - || program_id == kb_program_ids::SECP256R1_PROGRAM_ID; + return program_id == ks_program_ids::ED25519_PROGRAM_ID + || program_id == ks_program_ids::SECP256K1_PROGRAM_ID + || program_id == ks_program_ids::SECP256R1_PROGRAM_ID; } fn is_loader_program(program_id: &str) -> bool { - return program_id == kb_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID - || program_id == kb_program_ids::BPF_LOADER_PROGRAM_ID - || program_id == kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID - || program_id == kb_program_ids::LOADER_V4_PROGRAM_ID - || program_id == kb_program_ids::NATIVE_LOADER_PROGRAM_ID; + return program_id == ks_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID + || program_id == ks_program_ids::BPF_LOADER_PROGRAM_ID + || program_id == ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID + || program_id == ks_program_ids::LOADER_V4_PROGRAM_ID + || program_id == ks_program_ids::NATIVE_LOADER_PROGRAM_ID; } fn is_historical_native_program(program_id: &str) -> bool { - return program_id == kb_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID - || program_id == kb_program_ids::BPF_LOADER_PROGRAM_ID - || program_id == kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID; + return program_id == ks_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID + || program_id == ks_program_ids::BPF_LOADER_PROGRAM_ID + || program_id == ks_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID; } #[cfg(test)] @@ -371,7 +371,7 @@ mod tests { #[test] fn vote_program_is_dispatched_without_false_decode_for_unknown_tag() { let decoder = crate::DcSolanaCoreDecoder; - let input = replay_input(kb_program_ids::VOTE_PROGRAM_ID); + let input = replay_input(ks_program_ids::VOTE_PROGRAM_ID); let recognition = crate::DcApiInstructionDecoder::recognize(&decoder, &input); assert!(recognition.compatible); assert_eq!( @@ -390,7 +390,7 @@ mod tests { #[test] fn stake_program_is_dispatched_without_false_decode_for_unknown_tag() { let decoder = crate::DcSolanaCoreDecoder; - let input = replay_input(kb_program_ids::STAKE_PROGRAM_ID); + let input = replay_input(ks_program_ids::STAKE_PROGRAM_ID); let recognition = crate::DcApiInstructionDecoder::recognize(&decoder, &input); assert!(recognition.compatible); assert_eq!( @@ -409,7 +409,7 @@ mod tests { #[test] fn zk_token_proof_program_dispatches_to_current_noop_fallback() { let decoder = crate::DcSolanaCoreDecoder; - let input = replay_input(kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID); + let input = replay_input(ks_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID); let recognition = crate::DcApiInstructionDecoder::recognize(&decoder, &input); assert!(recognition.compatible); assert_eq!( @@ -433,8 +433,8 @@ mod tests { fn every_native_registry_program_has_one_surface() { let decoder = crate::DcSolanaCoreDecoder; let surfaces = crate::DcApiInstructionDecoder::surfaces(&decoder); - assert_eq!(surfaces.len(), kb_program_ids::native_program_ids().len()); - for entry in kb_program_ids::native_program_ids() { + assert_eq!(surfaces.len(), ks_program_ids::native_program_ids().len()); + for entry in ks_program_ids::native_program_ids() { assert!(surfaces.iter().any(|surface| return surface.program_id == entry.program_id())); } } @@ -481,7 +481,7 @@ mod tests { #[test] fn slashing_program_is_dispatched_to_exact_decoder() { let decoder = crate::DcSolanaCoreDecoder; - let input = replay_input(kb_program_ids::SLASHING_PROGRAM_ID); + let input = replay_input(ks_program_ids::SLASHING_PROGRAM_ID); let recognition = crate::DcApiInstructionDecoder::recognize(&decoder, &input); assert!(recognition.compatible); assert_eq!( @@ -499,9 +499,9 @@ mod tests { let decoder = crate::DcSolanaCoreDecoder; let surfaces = crate::DcApiInstructionDecoder::surfaces(&decoder); assert!(!surfaces.iter().any(|surface| { - return surface.program_id == kb_program_ids::STAKE_CONFIG_ACCOUNT_ID; + return surface.program_id == ks_program_ids::STAKE_CONFIG_ACCOUNT_ID; })); - let input = replay_input(kb_program_ids::STAKE_CONFIG_ACCOUNT_ID); + let input = replay_input(ks_program_ids::STAKE_CONFIG_ACCOUNT_ID); let recognition = crate::DcApiInstructionDecoder::recognize(&decoder, &input); assert!(!recognition.compatible); } @@ -536,7 +536,7 @@ mod tests { .collect::>(); assert_eq!(compiled_surface_map.len(), 18); - let native_registry = kb_program_ids::native_program_ids() + let native_registry = ks_program_ids::native_program_ids() .iter() .map(|entry| return entry.program_id().to_string()) .collect::>(); @@ -607,7 +607,7 @@ mod tests { #[test] fn unrelated_program_is_not_dispatched() { let decoder = crate::DcSolanaCoreDecoder; - let input = replay_input(kb_program_ids::SPL_TOKEN_PROGRAM_ID); + let input = replay_input(ks_program_ids::SPL_TOKEN_PROGRAM_ID); let recognition = crate::DcApiInstructionDecoder::recognize(&decoder, &input); assert!(!recognition.compatible); } diff --git a/kb-lib/src/decoder/solana/core/event.rs b/ks-lib/src/decoder/solana/core/event.rs similarity index 98% rename from kb-lib/src/decoder/solana/core/event.rs rename to ks-lib/src/decoder/solana/core/event.rs index 9363fac..3d371d4 100644 --- a/kb-lib/src/decoder/solana/core/event.rs +++ b/ks-lib/src/decoder/solana/core/event.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core/event.rs -// version: 3 +// file: ks-lib/src/decoder/solana/core/event.rs +// version: 4 //! Stable native event and decoder result builders. diff --git a/kb-lib/src/decoder/solana/core/feature.rs b/ks-lib/src/decoder/solana/core/feature.rs similarity index 94% rename from kb-lib/src/decoder/solana/core/feature.rs rename to ks-lib/src/decoder/solana/core/feature.rs index d0bde64..49aaf9e 100644 --- a/kb-lib/src/decoder/solana/core/feature.rs +++ b/ks-lib/src/decoder/solana/core/feature.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core/feature.rs -// version: 4 +// file: ks-lib/src/decoder/solana/core/feature.rs +// version: 5 //! Exact Feature Gate instruction decoding from the official interface contract. @@ -14,7 +14,7 @@ const REVOKE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[ pub(crate) fn decoder_solana_core_feature_coverage() -> std::vec::Vec { return vec![crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::FEATURE_PROGRAM_ID.to_string(), + program_id: ks_program_ids::FEATURE_PROGRAM_ID.to_string(), surface_code: std::option::Option::Some( crate::DC_SOLANA_CORE_FEATURE_SURFACE_CODE.to_string(), ), @@ -139,25 +139,25 @@ pub(crate) fn decoder_solana_core_feature_decode( ); } -fn validate_fixed_accounts(accounts: &serde_json::Value) -> kb_core::Result<()> { +fn validate_fixed_accounts(accounts: &serde_json::Value) -> ks_core::Result<()> { let array = match accounts.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "resolved Feature Gate accounts must be an array", )); }, }; for (position, expected) in [ - (1_usize, kb_program_ids::INCINERATOR_PROGRAM_ID), - (2_usize, kb_program_ids::SYSTEM_PROGRAM_ID), + (1_usize, ks_program_ids::INCINERATOR_PROGRAM_ID), + (2_usize, ks_program_ids::SYSTEM_PROGRAM_ID), ] { let actual = array .get(position) .and_then(|value| return value.get("accountKey")) .and_then(serde_json::Value::as_str); if actual != std::option::Option::Some(expected) { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Feature Gate account {position} must be {expected}" ))); } @@ -172,8 +172,8 @@ mod tests { fn replay_input(bytes: &[u8], transaction_failed: bool) -> crate::MdCoreInstructionReplayInput { let keys = [ "FeatureAccount11111111111111111111111111111", - kb_program_ids::INCINERATOR_PROGRAM_ID, - kb_program_ids::SYSTEM_PROGRAM_ID, + ks_program_ids::INCINERATOR_PROGRAM_ID, + ks_program_ids::SYSTEM_PROGRAM_ID, ]; let account_keys = keys .iter() @@ -201,7 +201,7 @@ mod tests { "signature", 42, "0", - kb_program_ids::FEATURE_PROGRAM_ID, + ks_program_ids::FEATURE_PROGRAM_ID, transaction_failed, if transaction_failed { std::option::Option::Some(serde_json::json!({"InstructionError": [0, "Custom"]})) diff --git a/kb-lib/src/decoder/solana/core/loaders.rs b/ks-lib/src/decoder/solana/core/loaders.rs similarity index 95% rename from kb-lib/src/decoder/solana/core/loaders.rs rename to ks-lib/src/decoder/solana/core/loaders.rs index 91c9f63..62e3fe9 100644 --- a/kb-lib/src/decoder/solana/core/loaders.rs +++ b/ks-lib/src/decoder/solana/core/loaders.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core/loaders.rs -// version: 10 +// file: ks-lib/src/decoder/solana/core/loaders.rs +// version: 11 //! Exact bounded decoding for Solana native loader generations. @@ -102,7 +102,7 @@ pub(crate) fn decoder_solana_core_loaders_coverage() -> std::vec::Vec { let mut output = std::vec::Vec::new(); output.push(coverage_entry( - kb_program_ids::NATIVE_LOADER_PROGRAM_ID, + ks_program_ids::NATIVE_LOADER_PROGRAM_ID, crate::DC_SOLANA_CORE_NATIVE_LOADER_SURFACE_CODE, "direct_invocation_opaque", std::option::Option::None, @@ -110,12 +110,12 @@ pub(crate) fn decoder_solana_core_loaders_coverage() )); for (program_id, surface_code, historical) in [ ( - kb_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID, + ks_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID, crate::DC_SOLANA_CORE_BPF_LOADER_DEPRECATED_SURFACE_CODE, true, ), ( - kb_program_ids::BPF_LOADER_PROGRAM_ID, + ks_program_ids::BPF_LOADER_PROGRAM_ID, crate::DC_SOLANA_CORE_BPF_LOADER_SURFACE_CODE, true, ), @@ -146,7 +146,7 @@ pub(crate) fn decoder_solana_core_loaders_coverage() ("set_authority_checked", 7_u32), ] { output.push(coverage_entry( - kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, + ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, crate::DC_SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE, entry_code, std::option::Option::Some(tag_hex(tag)), @@ -163,7 +163,7 @@ pub(crate) fn decoder_solana_core_loaders_coverage() ("finalize", 6_u32), ] { output.push(coverage_entry( - kb_program_ids::LOADER_V4_PROGRAM_ID, + ks_program_ids::LOADER_V4_PROGRAM_ID, crate::DC_SOLANA_CORE_LOADER_V4_SURFACE_CODE, entry_code, std::option::Option::Some(tag_hex(tag)), @@ -182,7 +182,7 @@ pub(crate) fn decoder_solana_core_loaders_recognize( std::option::Option::Some(value) => value, std::option::Option::None => return crate::DcApiDecoderRecognition::incompatible(), }; - if input.program_id == kb_program_ids::NATIVE_LOADER_PROGRAM_ID { + if input.program_id == ks_program_ids::NATIVE_LOADER_PROGRAM_ID { return crate::DcApiDecoderRecognition::compatible( true, priority, @@ -220,7 +220,7 @@ pub(crate) fn decoder_solana_core_loaders_recognize( pub(crate) fn decoder_solana_core_loaders_decode( input: &crate::MdCoreInstructionReplayInput, ) -> crate::DcApiDecoderExecutionResult { - if input.program_id == kb_program_ids::NATIVE_LOADER_PROGRAM_ID { + if input.program_id == ks_program_ids::NATIVE_LOADER_PROGRAM_ID { tracing::debug!(target: crate::TRACING_TARGET_DECODER_SOLANA_CORE, action = "decode_native_loader", signature = %input.signature, instruction_path = %input.instruction_path, source = SOURCE_NATIVE_LOADER, "ignore opaque direct Native Loader invocation without inventing an instruction schema"); return crate::DcApiDecoderExecutionResult::ignored(std::option::Option::Some( "direct_invocation_opaque".to_string(), @@ -237,15 +237,15 @@ pub(crate) fn decoder_solana_core_loaders_decode( ); }, }; - if input.program_id == kb_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID - || input.program_id == kb_program_ids::BPF_LOADER_PROGRAM_ID + if input.program_id == ks_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID + || input.program_id == ks_program_ids::BPF_LOADER_PROGRAM_ID { return decode_immutable(input, bytes.as_slice()); } - if input.program_id == kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID { + if input.program_id == ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID { return decode_upgradeable(input, bytes.as_slice()); } - if input.program_id == kb_program_ids::LOADER_V4_PROGRAM_ID { + if input.program_id == ks_program_ids::LOADER_V4_PROGRAM_ID { return decode_v4(input, bytes.as_slice()); } return crate::decoder_solana_core_unsupported_result( @@ -262,7 +262,7 @@ fn decode_immutable( if bytes.len() < 4 && input.transaction_failed { return malformed_failed_transaction( input, - if input.program_id == kb_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID { + if input.program_id == ks_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID { crate::DC_SOLANA_CORE_BPF_LOADER_DEPRECATED_SURFACE_CODE } else { crate::DC_SOLANA_CORE_BPF_LOADER_SURFACE_CODE @@ -276,7 +276,7 @@ fn decode_immutable( std::result::Result::Ok(value) => value, std::result::Result::Err(result) => return result, }; - let surface_code = if input.program_id == kb_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID { + let surface_code = if input.program_id == ks_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID { crate::DC_SOLANA_CORE_BPF_LOADER_DEPRECATED_SURFACE_CODE } else { crate::DC_SOLANA_CORE_BPF_LOADER_SURFACE_CODE @@ -971,15 +971,15 @@ fn unknown_tag( } fn surface_code(program_id: &str) -> std::option::Option<&'static str> { - return if program_id == kb_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID { + return if program_id == ks_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID { std::option::Option::Some(crate::DC_SOLANA_CORE_BPF_LOADER_DEPRECATED_SURFACE_CODE) - } else if program_id == kb_program_ids::BPF_LOADER_PROGRAM_ID { + } else if program_id == ks_program_ids::BPF_LOADER_PROGRAM_ID { std::option::Option::Some(crate::DC_SOLANA_CORE_BPF_LOADER_SURFACE_CODE) - } else if program_id == kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID { + } else if program_id == ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID { std::option::Option::Some(crate::DC_SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE) - } else if program_id == kb_program_ids::LOADER_V4_PROGRAM_ID { + } else if program_id == ks_program_ids::LOADER_V4_PROGRAM_ID { std::option::Option::Some(crate::DC_SOLANA_CORE_LOADER_V4_SURFACE_CODE) - } else if program_id == kb_program_ids::NATIVE_LOADER_PROGRAM_ID { + } else if program_id == ks_program_ids::NATIVE_LOADER_PROGRAM_ID { std::option::Option::Some(crate::DC_SOLANA_CORE_NATIVE_LOADER_SURFACE_CODE) } else { std::option::Option::None @@ -987,15 +987,15 @@ fn surface_code(program_id: &str) -> std::option::Option<&'static str> { } fn entry_code(program_id: &str, bytes: &[u8]) -> std::option::Option<&'static str> { - if program_id == kb_program_ids::NATIVE_LOADER_PROGRAM_ID { + if program_id == ks_program_ids::NATIVE_LOADER_PROGRAM_ID { return std::option::Option::Some("direct_invocation_opaque"); } let tag = match crate::decoder_solana_core_read_u32_le(bytes, 0) { std::result::Result::Ok(value) => value, std::result::Result::Err(_error) => return std::option::Option::None, }; - if program_id == kb_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID - || program_id == kb_program_ids::BPF_LOADER_PROGRAM_ID + if program_id == ks_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID + || program_id == ks_program_ids::BPF_LOADER_PROGRAM_ID { return match tag { 0 => std::option::Option::Some("write"), @@ -1003,7 +1003,7 @@ fn entry_code(program_id: &str, bytes: &[u8]) -> std::option::Option<&'static st _ => std::option::Option::None, }; } - if program_id == kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID { + if program_id == ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID { return match tag { 0 => std::option::Option::Some("initialize_buffer"), 1 => std::option::Option::Some("write"), @@ -1016,7 +1016,7 @@ fn entry_code(program_id: &str, bytes: &[u8]) -> std::option::Option<&'static st _ => std::option::Option::None, }; } - if program_id == kb_program_ids::LOADER_V4_PROGRAM_ID { + if program_id == ks_program_ids::LOADER_V4_PROGRAM_ID { return match tag { 0 => std::option::Option::Some("write"), 1 => std::option::Option::Some("copy"), @@ -1158,8 +1158,8 @@ mod tests { #[test] fn immutable_generations_decode_write_and_finalize() { for program_id in [ - kb_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID, - kb_program_ids::BPF_LOADER_PROGRAM_ID, + ks_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID, + ks_program_ids::BPF_LOADER_PROGRAM_ID, ] { let write_result = decode(program_id, immutable_write(0, 7, &[1, 2, 3]).as_slice(), 1); assert_eq!(write_result.status, crate::DcApiDecoderOutcomeStatus::Decoded); @@ -1181,7 +1181,7 @@ mod tests { bytes.extend_from_slice(&13_600_u32.to_le_bytes()); bytes.extend_from_slice(&800_u32.to_le_bytes()); bytes.extend_from_slice(vec![0x5a_u8; 800].as_slice()); - let result = decode(kb_program_ids::BPF_LOADER_PROGRAM_ID, bytes.as_slice(), 1); + let result = decode(ks_program_ids::BPF_LOADER_PROGRAM_ID, bytes.as_slice(), 1); assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded); assert_eq!(result.observations[0].payload_json["parameters"]["offset"], 13_600); assert_eq!(result.observations[0].payload_json["parameters"]["byteLength"], 800); @@ -1246,7 +1246,7 @@ mod tests { for (instruction, account_count, entry_code) in fixtures { let bytes = upgradeable(&instruction); let result = decode( - kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, + ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, bytes.as_slice(), account_count, ); @@ -1264,7 +1264,7 @@ mod tests { &solana_loader_v3_interface::instruction::UpgradeableLoaderInstruction::InitializeBuffer, ); bytes.push(0); - let result = decode(kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, bytes.as_slice(), 1); + let result = decode(ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, bytes.as_slice(), 1); assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Failed); assert_eq!( result.recognized_entry_code.as_deref(), @@ -1277,15 +1277,15 @@ mod tests { let mut deploy = unit(2); deploy.extend_from_slice(&2048_u64.to_le_bytes()); let deploy_result = - decode(kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, deploy.as_slice(), 8); + decode(ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, deploy.as_slice(), 8); assert_eq!(deploy_result.observations[0].payload_json["parameters"]["closeBuffer"], true); assert_eq!(deploy_result.observations[0].payload_json["historical"], true); let upgrade_result = - decode(kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, unit(3).as_slice(), 7); + decode(ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, unit(3).as_slice(), 7); assert_eq!(upgrade_result.observations[0].payload_json["parameters"]["closeBuffer"], true); assert_eq!(upgrade_result.observations[0].payload_json["historical"], true); let close_result = - decode(kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, unit(5).as_slice(), 2); + decode(ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, unit(5).as_slice(), 2); assert_eq!(close_result.observations[0].payload_json["parameters"]["tombstone"], false); assert_eq!(close_result.observations[0].payload_json["historical"], true); } @@ -1321,7 +1321,7 @@ mod tests { ]; for (bytes, account_count, entry_code) in fixtures { let result = - decode(kb_program_ids::LOADER_V4_PROGRAM_ID, bytes.as_slice(), account_count); + decode(ks_program_ids::LOADER_V4_PROGRAM_ID, bytes.as_slice(), account_count); assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded); assert_eq!( result.recognized_entry_code.as_deref(), @@ -1332,19 +1332,19 @@ mod tests { #[test] fn malformed_lengths_unknown_tags_and_invalid_boole_are_safe() { - let truncated = decode(kb_program_ids::BPF_LOADER_PROGRAM_ID, &[0, 0, 0], 1); + let truncated = decode(ks_program_ids::BPF_LOADER_PROGRAM_ID, &[0, 0, 0], 1); assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed); let mut mismatched = immutable_write(0, 0, &[1, 2]); mismatched[8] = 3; let mismatched_result = - decode(kb_program_ids::BPF_LOADER_PROGRAM_ID, mismatched.as_slice(), 1); + decode(ks_program_ids::BPF_LOADER_PROGRAM_ID, mismatched.as_slice(), 1); assert_eq!(mismatched_result.status, crate::DcApiDecoderOutcomeStatus::Failed); - let unknown = decode(kb_program_ids::LOADER_V4_PROGRAM_ID, unit(99).as_slice(), 0); + let unknown = decode(ks_program_ids::LOADER_V4_PROGRAM_ID, unit(99).as_slice(), 0); assert_eq!(unknown.status, crate::DcApiDecoderOutcomeStatus::Unsupported); let mut invalid_bool = unit(3); invalid_bool.push(2); let invalid_bool_result = - decode(kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, invalid_bool.as_slice(), 7); + decode(ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, invalid_bool.as_slice(), 7); assert_eq!(invalid_bool_result.status, crate::DcApiDecoderOutcomeStatus::Failed); } @@ -1353,17 +1353,17 @@ mod tests { let mut bytes = unit(6); bytes.extend_from_slice(&128_u32.to_le_bytes()); let incomplete = - decode(kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, bytes.as_slice(), 3); + decode(ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, bytes.as_slice(), 3); assert_eq!(incomplete.status, crate::DcApiDecoderOutcomeStatus::Failed); let complete = - decode(kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, bytes.as_slice(), 4); + decode(ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, bytes.as_slice(), 4); assert_eq!(complete.status, crate::DcApiDecoderOutcomeStatus::Decoded); } #[test] fn failed_loader_lifecycle_is_uncommitted() { let bytes = unit(3); - let input = replay_input(kb_program_ids::LOADER_V4_PROGRAM_ID, bytes.as_slice(), 2, true); + let input = replay_input(ks_program_ids::LOADER_V4_PROGRAM_ID, bytes.as_slice(), 2, true); let result = crate::decoder_solana_core_loaders_decode(&input); assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded); assert!(result.observations[0].transaction_failed); @@ -1372,7 +1372,7 @@ mod tests { #[test] fn native_loader_direct_invocation_is_ignored_without_false_event() { - let input = replay_input(kb_program_ids::NATIVE_LOADER_PROGRAM_ID, &[], 0, false); + let input = replay_input(ks_program_ids::NATIVE_LOADER_PROGRAM_ID, &[], 0, false); let result = crate::decoder_solana_core_loaders_decode(&input); assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Ignored); assert!(result.observations.is_empty()); diff --git a/kb-lib/src/decoder/solana/core/payload.rs b/ks-lib/src/decoder/solana/core/payload.rs similarity index 90% rename from kb-lib/src/decoder/solana/core/payload.rs rename to ks-lib/src/decoder/solana/core/payload.rs index 9a4ab8f..21a0433 100644 --- a/kb-lib/src/decoder/solana/core/payload.rs +++ b/ks-lib/src/decoder/solana/core/payload.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core/payload.rs -// version: 6 +// file: ks-lib/src/decoder/solana/core/payload.rs +// version: 7 //! Bounded native instruction payload helpers. @@ -21,11 +21,11 @@ pub(crate) struct DcSolanaCoreResolvedInstructionPayload { /// Decodes one retained base64 instruction payload with an explicit byte limit. pub(crate) fn decoder_solana_core_decode_instruction_data( input: &crate::MdCoreInstructionReplayInput, -) -> kb_core::Result> { +) -> ks_core::Result> { let payload = match input.instruction_payload_json.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "native instruction payload is not retained", )); }, @@ -37,7 +37,7 @@ pub(crate) fn decoder_solana_core_decode_instruction_data( pub(crate) fn decoder_solana_core_resolve_u16_instruction_payload( input: &crate::MdCoreInstructionReplayInput, raw_instruction_index: u16, -) -> kb_core::Result { +) -> ks_core::Result { if raw_instruction_index == u16::MAX { let target_index_result = crate::decoder_solana_core_target_outer_instruction_index(input); let target_index = match target_index_result { @@ -64,23 +64,23 @@ pub(crate) fn decoder_solana_core_resolve_u16_instruction_payload( pub(crate) fn decoder_solana_core_resolve_u8_instruction_payload( input: &crate::MdCoreInstructionReplayInput, raw_instruction_index: u8, -) -> kb_core::Result { +) -> ks_core::Result { return resolve_explicit_outer_instruction(input, usize::from(raw_instruction_index)); } /// Returns the numeric outer index of the target instruction. pub(crate) fn decoder_solana_core_target_outer_instruction_index( input: &crate::MdCoreInstructionReplayInput, -) -> kb_core::Result { +) -> ks_core::Result { if input.instruction_path.contains('/') { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "signature precompiles can only resolve outer instruction paths", )); } let parse_result = input.instruction_path.parse::(); return match parse_result { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::invalid_state( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::invalid_state( format!("target outer instruction path is not numeric: {error}"), )), }; @@ -92,11 +92,11 @@ pub(crate) fn decoder_solana_core_bounded_slice<'a>( offset: usize, length: usize, label: &str, -) -> kb_core::Result<&'a [u8]> { +) -> ks_core::Result<&'a [u8]> { let end = match offset.checked_add(length) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "{label} range overflows usize: offset={offset}, length={length}" ))); }, @@ -104,7 +104,7 @@ pub(crate) fn decoder_solana_core_bounded_slice<'a>( return match bytes.get(offset..end) { std::option::Option::Some(value) => std::result::Result::Ok(value), std::option::Option::None => { - std::result::Result::Err(kb_core::Error::invalid_state(format!( + std::result::Result::Err(ks_core::Error::invalid_state(format!( "{label} range is outside referenced instruction: offset={offset}, length={length}, instructionLength={}", bytes.len() ))) @@ -153,7 +153,7 @@ pub(crate) fn decoder_solana_core_payload_hash( } /// Reads one little-endian `u32` from an exact byte range. -pub(crate) fn decoder_solana_core_read_u32_le(bytes: &[u8], offset: usize) -> kb_core::Result { +pub(crate) fn decoder_solana_core_read_u32_le(bytes: &[u8], offset: usize) -> ks_core::Result { let slice_result = crate::decoder_solana_core_bounded_slice(bytes, offset, 4, "native instruction u32"); let slice = match slice_result { @@ -164,13 +164,13 @@ pub(crate) fn decoder_solana_core_read_u32_le(bytes: &[u8], offset: usize) -> kb return match array_result { std::result::Result::Ok(value) => std::result::Result::Ok(u32::from_le_bytes(value)), std::result::Result::Err(_error) => std::result::Result::Err( - kb_core::Error::invalid_state("native instruction u32 slice has an invalid length"), + ks_core::Error::invalid_state("native instruction u32 slice has an invalid length"), ), }; } /// Reads one little-endian `u64` from an exact byte range. -pub(crate) fn decoder_solana_core_read_u64_le(bytes: &[u8], offset: usize) -> kb_core::Result { +pub(crate) fn decoder_solana_core_read_u64_le(bytes: &[u8], offset: usize) -> ks_core::Result { let slice_result = crate::decoder_solana_core_bounded_slice(bytes, offset, 8, "native instruction u64"); let slice = match slice_result { @@ -181,7 +181,7 @@ pub(crate) fn decoder_solana_core_read_u64_le(bytes: &[u8], offset: usize) -> kb return match array_result { std::result::Result::Ok(value) => std::result::Result::Ok(u64::from_le_bytes(value)), std::result::Result::Err(_error) => std::result::Result::Err( - kb_core::Error::invalid_state("native instruction u64 slice has an invalid length"), + ks_core::Error::invalid_state("native instruction u64 slice has an invalid length"), ), }; } @@ -227,11 +227,11 @@ pub(crate) fn decoder_solana_core_bounded_hexadecimal_prefix( fn resolve_explicit_outer_instruction( input: &crate::MdCoreInstructionReplayInput, instruction_index: usize, -) -> kb_core::Result { +) -> ks_core::Result { let entries = match input.outer_instructions_json.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "outer instruction context is not a JSON array", )); }, @@ -251,7 +251,7 @@ fn resolve_explicit_outer_instruction( let entry = match entry { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "referenced outer instruction index is absent: {instruction_index}" ))); }, @@ -259,7 +259,7 @@ fn resolve_explicit_outer_instruction( let instruction_path = match entry.get("instructionPath").and_then(serde_json::Value::as_str) { std::option::Option::Some(value) if !value.trim().is_empty() => value.to_string(), _ => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "referenced outer instruction {instruction_index} has no instructionPath" ))); }, @@ -267,7 +267,7 @@ fn resolve_explicit_outer_instruction( let payload_json = match entry.get("payloadJson") { std::option::Option::Some(value) if !value.is_null() => value, _ => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "referenced outer instruction {instruction_index} has no retained payloadJson" ))); }, @@ -295,11 +295,11 @@ fn resolve_explicit_outer_instruction( fn decode_payload_json( payload: &serde_json::Value, label: &str, -) -> kb_core::Result> { +) -> ks_core::Result> { let encoded = match payload.get("dataBase64").and_then(serde_json::Value::as_str) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "{label} payload does not contain dataBase64" ))); }, @@ -309,7 +309,7 @@ fn decode_payload_json( .saturating_div(3) .saturating_add(4); if encoded.len() > maximum_encoded_length { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "{label} base64 payload exceeds {maximum_encoded_length} bytes" ))); } @@ -317,13 +317,13 @@ fn decode_payload_json( let decoded = match decoded_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "{label} payload is not valid base64: {error}" ))); }, }; if decoded.len() > crate::DC_SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "{label} payload exceeds {} decoded bytes", crate::DC_SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES ))); diff --git a/kb-lib/src/decoder/solana/core/precompiles.rs b/ks-lib/src/decoder/solana/core/precompiles.rs similarity index 95% rename from kb-lib/src/decoder/solana/core/precompiles.rs rename to ks-lib/src/decoder/solana/core/precompiles.rs index e703625..1dfb521 100644 --- a/kb-lib/src/decoder/solana/core/precompiles.rs +++ b/ks-lib/src/decoder/solana/core/precompiles.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core/precompiles.rs -// version: 5 +// file: ks-lib/src/decoder/solana/core/precompiles.rs +// version: 6 //! Bounded structural decoding for Solana signature verification precompiles. @@ -45,15 +45,15 @@ pub(crate) fn decoder_solana_core_precompiles_coverage() -> std::vec::Vec { return vec![ coverage_entry( - kb_program_ids::ED25519_PROGRAM_ID, + ks_program_ids::ED25519_PROGRAM_ID, crate::DC_SOLANA_CORE_ED25519_SURFACE_CODE, ), coverage_entry( - kb_program_ids::SECP256K1_PROGRAM_ID, + ks_program_ids::SECP256K1_PROGRAM_ID, crate::DC_SOLANA_CORE_SECP256K1_SURFACE_CODE, ), coverage_entry( - kb_program_ids::SECP256R1_PROGRAM_ID, + ks_program_ids::SECP256R1_PROGRAM_ID, crate::DC_SOLANA_CORE_SECP256R1_SURFACE_CODE, ), ]; @@ -100,7 +100,7 @@ pub(crate) fn decoder_solana_core_precompiles_recognize( pub(crate) fn decoder_solana_core_precompiles_decode( input: &crate::MdCoreInstructionReplayInput, ) -> crate::DcApiDecoderExecutionResult { - if input.program_id == kb_program_ids::ED25519_PROGRAM_ID { + if input.program_id == ks_program_ids::ED25519_PROGRAM_ID { return decode_u16_precompile( input, &U16PrecompileSpec { @@ -113,10 +113,10 @@ pub(crate) fn decoder_solana_core_precompiles_decode( }, ); } - if input.program_id == kb_program_ids::SECP256K1_PROGRAM_ID { + if input.program_id == ks_program_ids::SECP256K1_PROGRAM_ID { return decode_secp256k1(input); } - if input.program_id == kb_program_ids::SECP256R1_PROGRAM_ID { + if input.program_id == ks_program_ids::SECP256R1_PROGRAM_ID { return decode_u16_precompile( input, &U16PrecompileSpec { @@ -481,7 +481,7 @@ fn resolve_u16_entry( padding: u8, entry_index: usize, offsets: &U16SignatureOffsets, -) -> kb_core::Result { +) -> ks_core::Result { let signature_payload_result = crate::decoder_solana_core_resolve_u16_instruction_payload( input, offsets.signature_instruction_index, @@ -584,7 +584,7 @@ fn resolve_u8_entry( signature_count: usize, entry_index: usize, offsets: &U8SignatureOffsets, -) -> kb_core::Result { +) -> ks_core::Result { let signature_payload_result = crate::decoder_solana_core_resolve_u8_instruction_payload( input, offsets.signature_instruction_index, @@ -624,7 +624,7 @@ fn resolve_u8_entry( { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "secp256k1 recovery id offset overflows usize", )); }, @@ -642,7 +642,7 @@ fn resolve_u8_entry( let recovery = match recovery_slice.first() { std::option::Option::Some(value) => *value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "secp256k1 recovery id slice is unexpectedly empty", )); }, @@ -709,7 +709,7 @@ fn resolve_u8_entry( })); } -fn read_u16_offsets(bytes: &[u8], offset: usize) -> kb_core::Result { +fn read_u16_offsets(bytes: &[u8], offset: usize) -> ks_core::Result { let table_result = crate::decoder_solana_core_bounded_slice( bytes, offset, @@ -724,7 +724,7 @@ fn read_u16_offsets(bytes: &[u8], offset: usize) -> kb_core::Result value, std::result::Result::Err(_error) => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Ed25519 or secp256r1 offsets have an invalid byte length", )); }, @@ -768,7 +768,7 @@ fn read_u16_offsets(bytes: &[u8], offset: usize) -> kb_core::Result kb_core::Result { +fn read_u8_offsets(bytes: &[u8], offset: usize) -> ks_core::Result { let table_result = crate::decoder_solana_core_bounded_slice( bytes, offset, @@ -783,7 +783,7 @@ fn read_u8_offsets(bytes: &[u8], offset: usize) -> kb_core::Result value, std::result::Result::Err(_error) => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "secp256k1 offsets have an invalid byte length", )); }, @@ -981,13 +981,13 @@ fn coverage_entry(program_id: &str, surface_code: &str) -> crate::DcApiDecoderCo } fn surface_code(program_id: &str) -> std::option::Option<&'static str> { - if program_id == kb_program_ids::ED25519_PROGRAM_ID { + if program_id == ks_program_ids::ED25519_PROGRAM_ID { return std::option::Option::Some(crate::DC_SOLANA_CORE_ED25519_SURFACE_CODE); } - if program_id == kb_program_ids::SECP256K1_PROGRAM_ID { + if program_id == ks_program_ids::SECP256K1_PROGRAM_ID { return std::option::Option::Some(crate::DC_SOLANA_CORE_SECP256K1_SURFACE_CODE); } - if program_id == kb_program_ids::SECP256R1_PROGRAM_ID { + if program_id == ks_program_ids::SECP256R1_PROGRAM_ID { return std::option::Option::Some(crate::DC_SOLANA_CORE_SECP256R1_SURFACE_CODE); } return std::option::Option::None; @@ -1284,7 +1284,7 @@ mod tests { #[test] fn ed25519_current_reference_decodes_exact_component_sizes_and_padding() { let input = replay_input( - kb_program_ids::ED25519_PROGRAM_ID, + ks_program_ids::ED25519_PROGRAM_ID, u16_current_payload(crate::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"message", 7), vec![], false, @@ -1300,7 +1300,7 @@ mod tests { #[test] fn secp256r1_current_reference_decodes_compressed_public_key() { let input = replay_input( - kb_program_ids::SECP256R1_PROGRAM_ID, + ks_program_ids::SECP256R1_PROGRAM_ID, u16_current_payload(crate::DC_SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES, b"r1", 11), vec![], false, @@ -1315,7 +1315,7 @@ mod tests { #[test] fn secp256k1_current_reference_is_explicit_and_retains_recovery_id() { let input = replay_input( - kb_program_ids::SECP256K1_PROGRAM_ID, + ks_program_ids::SECP256K1_PROGRAM_ID, secp256k1_current_payload(b"keccak message"), vec![], false, @@ -1336,9 +1336,9 @@ mod tests { let (r1_target, r1_external) = u16_external_payload(crate::DC_SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES, b"external"); let cases = [ - (kb_program_ids::ED25519_PROGRAM_ID, ed_target, ed_external), - (kb_program_ids::SECP256K1_PROGRAM_ID, k1_target, k1_external), - (kb_program_ids::SECP256R1_PROGRAM_ID, r1_target, r1_external), + (ks_program_ids::ED25519_PROGRAM_ID, ed_target, ed_external), + (ks_program_ids::SECP256K1_PROGRAM_ID, k1_target, k1_external), + (ks_program_ids::SECP256R1_PROGRAM_ID, r1_target, r1_external), ]; for (program_id, target, external) in cases { let input = replay_input(program_id, target, vec![(0, external)], false); @@ -1360,9 +1360,9 @@ mod tests { let (r1_target, r1_external) = u16_mixed_payload(crate::DC_SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES); let cases = [ - (kb_program_ids::ED25519_PROGRAM_ID, ed_target, ed_external), - (kb_program_ids::SECP256K1_PROGRAM_ID, k1_target, k1_external), - (kb_program_ids::SECP256R1_PROGRAM_ID, r1_target, r1_external), + (ks_program_ids::ED25519_PROGRAM_ID, ed_target, ed_external), + (ks_program_ids::SECP256K1_PROGRAM_ID, k1_target, k1_external), + (ks_program_ids::SECP256R1_PROGRAM_ID, r1_target, r1_external), ]; for (program_id, target, external) in cases { let input = replay_input(program_id, target, external, false); @@ -1377,11 +1377,11 @@ mod tests { fn ed25519_and_secp256r1_decode_multiple_signatures() { let cases = [ ( - kb_program_ids::ED25519_PROGRAM_ID, + ks_program_ids::ED25519_PROGRAM_ID, two_u16_entries(crate::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES), ), ( - kb_program_ids::SECP256R1_PROGRAM_ID, + ks_program_ids::SECP256R1_PROGRAM_ID, two_u16_entries(crate::DC_SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES), ), ]; @@ -1397,7 +1397,7 @@ mod tests { #[test] fn secp256k1_decodes_multiple_signatures() { let input = replay_input( - kb_program_ids::SECP256K1_PROGRAM_ID, + ks_program_ids::SECP256K1_PROGRAM_ID, two_secp256k1_entries(), vec![], false, @@ -1412,7 +1412,7 @@ mod tests { #[test] fn empty_and_large_messages_are_hashed_without_full_message_retention() { let empty_input = replay_input( - kb_program_ids::ED25519_PROGRAM_ID, + ks_program_ids::ED25519_PROGRAM_ID, u16_current_payload(crate::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"", 0), vec![], false, @@ -1421,7 +1421,7 @@ mod tests { assert_eq!(parameters(&empty_result)["message"]["length"], 0); let large_message = vec![0xA5; 1_024]; let large_input = replay_input( - kb_program_ids::SECP256K1_PROGRAM_ID, + ks_program_ids::SECP256K1_PROGRAM_ID, secp256k1_current_payload(large_message.as_slice()), vec![], false, @@ -1438,19 +1438,19 @@ mod tests { #[test] fn official_zero_signature_rules_are_preserved() { let ed_result = crate::decoder_solana_core_precompiles_decode(&replay_input( - kb_program_ids::ED25519_PROGRAM_ID, + ks_program_ids::ED25519_PROGRAM_ID, vec![0, 9], vec![], false, )); let k1_result = crate::decoder_solana_core_precompiles_decode(&replay_input( - kb_program_ids::SECP256K1_PROGRAM_ID, + ks_program_ids::SECP256K1_PROGRAM_ID, vec![0], vec![], false, )); let r1_result = crate::decoder_solana_core_precompiles_decode(&replay_input( - kb_program_ids::SECP256R1_PROGRAM_ID, + ks_program_ids::SECP256R1_PROGRAM_ID, vec![0, 0], vec![], false, @@ -1465,12 +1465,12 @@ mod tests { #[test] fn header_and_offsets_truncation_fail_deterministically() { let cases = [ - (kb_program_ids::ED25519_PROGRAM_ID, vec![1]), - (kb_program_ids::ED25519_PROGRAM_ID, vec![1, 0, 1]), - (kb_program_ids::SECP256K1_PROGRAM_ID, vec![]), - (kb_program_ids::SECP256K1_PROGRAM_ID, vec![1, 1]), - (kb_program_ids::SECP256R1_PROGRAM_ID, vec![1]), - (kb_program_ids::SECP256R1_PROGRAM_ID, vec![1, 0, 1]), + (ks_program_ids::ED25519_PROGRAM_ID, vec![1]), + (ks_program_ids::ED25519_PROGRAM_ID, vec![1, 0, 1]), + (ks_program_ids::SECP256K1_PROGRAM_ID, vec![]), + (ks_program_ids::SECP256K1_PROGRAM_ID, vec![1, 1]), + (ks_program_ids::SECP256R1_PROGRAM_ID, vec![1]), + (ks_program_ids::SECP256R1_PROGRAM_ID, vec![1, 0, 1]), ]; for (program_id, bytes) in cases { let result = crate::decoder_solana_core_precompiles_decode(&replay_input( @@ -1487,9 +1487,9 @@ mod tests { #[test] fn inconsistent_zero_count_and_runtime_r1_count_limit_fail() { let cases = [ - (kb_program_ids::ED25519_PROGRAM_ID, vec![0, 0, 1]), - (kb_program_ids::SECP256K1_PROGRAM_ID, vec![0, 1]), - (kb_program_ids::SECP256R1_PROGRAM_ID, vec![9, 0]), + (ks_program_ids::ED25519_PROGRAM_ID, vec![0, 0, 1]), + (ks_program_ids::SECP256K1_PROGRAM_ID, vec![0, 1]), + (ks_program_ids::SECP256R1_PROGRAM_ID, vec![9, 0]), ]; for (program_id, bytes) in cases { let result = crate::decoder_solana_core_precompiles_decode(&replay_input( @@ -1505,9 +1505,9 @@ mod tests { #[test] fn absent_instruction_indexes_fail_for_all_precompiles() { let cases = [ - (kb_program_ids::ED25519_PROGRAM_ID, malformed_u16_index()), - (kb_program_ids::SECP256K1_PROGRAM_ID, malformed_k1_index()), - (kb_program_ids::SECP256R1_PROGRAM_ID, malformed_u16_index()), + (ks_program_ids::ED25519_PROGRAM_ID, malformed_u16_index()), + (ks_program_ids::SECP256K1_PROGRAM_ID, malformed_k1_index()), + (ks_program_ids::SECP256R1_PROGRAM_ID, malformed_u16_index()), ]; for (program_id, bytes) in cases { let result = crate::decoder_solana_core_precompiles_decode(&replay_input( @@ -1535,9 +1535,9 @@ mod tests { r1[10] = 0xFF; r1[11] = 0xFF; let cases = [ - (kb_program_ids::ED25519_PROGRAM_ID, ed), - (kb_program_ids::SECP256K1_PROGRAM_ID, k1), - (kb_program_ids::SECP256R1_PROGRAM_ID, r1), + (ks_program_ids::ED25519_PROGRAM_ID, ed), + (ks_program_ids::SECP256K1_PROGRAM_ID, k1), + (ks_program_ids::SECP256R1_PROGRAM_ID, r1), ]; for (program_id, bytes) in cases { let result = crate::decoder_solana_core_precompiles_decode(&replay_input( @@ -1562,9 +1562,9 @@ mod tests { r1[12] = 0xFF; r1[13] = 0xFF; let cases = [ - (kb_program_ids::ED25519_PROGRAM_ID, ed), - (kb_program_ids::SECP256K1_PROGRAM_ID, k1), - (kb_program_ids::SECP256R1_PROGRAM_ID, r1), + (ks_program_ids::ED25519_PROGRAM_ID, ed), + (ks_program_ids::SECP256K1_PROGRAM_ID, k1), + (ks_program_ids::SECP256R1_PROGRAM_ID, r1), ]; for (program_id, bytes) in cases { let result = crate::decoder_solana_core_precompiles_decode(&replay_input( @@ -1592,9 +1592,9 @@ mod tests { let (r1_target, r1_external) = u16_external_payload(crate::DC_SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES, b"external"); let cases = [ - (kb_program_ids::ED25519_PROGRAM_ID, ed_target, ed_external), - (kb_program_ids::SECP256K1_PROGRAM_ID, k1_target, k1_external), - (kb_program_ids::SECP256R1_PROGRAM_ID, r1_target, r1_external), + (ks_program_ids::ED25519_PROGRAM_ID, ed_target, ed_external), + (ks_program_ids::SECP256K1_PROGRAM_ID, k1_target, k1_external), + (ks_program_ids::SECP256R1_PROGRAM_ID, r1_target, r1_external), ]; for (program_id, target, external) in cases { let mut missing = @@ -1617,7 +1617,7 @@ mod tests { bytes[6] = u8::MAX; bytes[11] = u8::MAX; let result = crate::decoder_solana_core_precompiles_decode(&replay_input( - kb_program_ids::SECP256K1_PROGRAM_ID, + ks_program_ids::SECP256K1_PROGRAM_ID, bytes, vec![], false, @@ -1629,7 +1629,7 @@ mod tests { #[test] fn failed_transaction_is_decoded_without_commit_or_runtime_validity_claim() { let input = replay_input( - kb_program_ids::ED25519_PROGRAM_ID, + ks_program_ids::ED25519_PROGRAM_ID, u16_current_payload(crate::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"failed", 0), vec![], true, @@ -1644,7 +1644,7 @@ mod tests { #[test] fn event_kind_and_serialization_are_stable() { let input = replay_input( - kb_program_ids::SECP256R1_PROGRAM_ID, + ks_program_ids::SECP256R1_PROGRAM_ID, u16_current_payload(crate::DC_SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES, b"stable", 0), vec![], false, diff --git a/kb-lib/src/decoder/solana/core/slashing.rs b/ks-lib/src/decoder/solana/core/slashing.rs similarity index 96% rename from kb-lib/src/decoder/solana/core/slashing.rs rename to ks-lib/src/decoder/solana/core/slashing.rs index 40754f5..1c3b98b 100644 --- a/kb-lib/src/decoder/solana/core/slashing.rs +++ b/ks-lib/src/decoder/solana/core/slashing.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core/slashing.rs -// version: 3 +// file: ks-lib/src/decoder/solana/core/slashing.rs +// version: 4 //! Exact structural decoding for the enshrined stateless Slashing Program. @@ -25,7 +25,7 @@ pub(crate) fn decoder_solana_core_slashing_coverage() -> std::vec::Vec { return vec![ crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::SLASHING_PROGRAM_ID.to_string(), + program_id: ks_program_ids::SLASHING_PROGRAM_ID.to_string(), surface_code: std::option::Option::Some( crate::DC_SOLANA_CORE_SLASHING_SURFACE_CODE.to_string(), ), @@ -35,7 +35,7 @@ pub(crate) fn decoder_solana_core_slashing_coverage() historical: false, }, crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::SLASHING_PROGRAM_ID.to_string(), + program_id: ks_program_ids::SLASHING_PROGRAM_ID.to_string(), surface_code: std::option::Option::Some( crate::DC_SOLANA_CORE_SLASHING_SURFACE_CODE.to_string(), ), @@ -233,7 +233,7 @@ fn decode_duplicate_block_proof( fn parse_duplicate_block_parameters( input: &crate::MdCoreInstructionReplayInput, bytes: &[u8], -) -> kb_core::Result { +) -> ks_core::Result { let offset_result = crate::decoder_solana_core_read_u64_le(bytes, 1); let offset = match offset_result { std::result::Result::Ok(value) => value, @@ -332,25 +332,25 @@ fn parse_duplicate_block_parameters( })); } -fn validate_duplicate_block_fixed_accounts(accounts: &serde_json::Value) -> kb_core::Result<()> { +fn validate_duplicate_block_fixed_accounts(accounts: &serde_json::Value) -> ks_core::Result<()> { let array = match accounts.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "resolved Slashing Program accounts must be an array", )); }, }; for (position, expected) in [ - (2_usize, kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID), - (3_usize, kb_program_ids::SYSTEM_PROGRAM_ID), + (2_usize, ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID), + (3_usize, ks_program_ids::SYSTEM_PROGRAM_ID), ] { let actual = array .get(position) .and_then(|value| return value.get("accountKey")) .and_then(serde_json::Value::as_str); if actual != std::option::Option::Some(expected) { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Slashing Program account {position} must be {expected}" ))); } @@ -358,7 +358,7 @@ fn validate_duplicate_block_fixed_accounts(accounts: &serde_json::Value) -> kb_c return std::result::Result::Ok(()); } -fn read_pubkey(bytes: &[u8], offset: usize, label: &str) -> kb_core::Result { +fn read_pubkey(bytes: &[u8], offset: usize, label: &str) -> ks_core::Result { let slice_result = crate::decoder_solana_core_bounded_slice(bytes, offset, PUBKEY_BYTES, label); return match slice_result { std::result::Result::Ok(value) => { @@ -393,7 +393,7 @@ fn preceding_ed25519_instruction(input: &crate::MdCoreInstructionReplayInput) -> std::result::Result::Err(error) => { return serde_json::json!({ "requiredRelativeInstructionOffset": -1, - "expectedProgramId": kb_program_ids::ED25519_PROGRAM_ID, + "expectedProgramId": ks_program_ids::ED25519_PROGRAM_ID, "resolved": false, "matchesExpectedProgram": false, "diagnostic": error.to_string(), @@ -406,7 +406,7 @@ fn preceding_ed25519_instruction(input: &crate::MdCoreInstructionReplayInput) -> return serde_json::json!({ "requiredRelativeInstructionOffset": -1, "currentInstructionIndex": target_index, - "expectedProgramId": kb_program_ids::ED25519_PROGRAM_ID, + "expectedProgramId": ks_program_ids::ED25519_PROGRAM_ID, "resolved": false, "matchesExpectedProgram": false, "diagnostic": "target instruction has no preceding outer instruction", @@ -433,10 +433,10 @@ fn preceding_ed25519_instruction(input: &crate::MdCoreInstructionReplayInput) -> "currentInstructionIndex": target_index, "resolvedInstructionIndex": previous_index, "resolvedInstructionPath": instruction_path, - "expectedProgramId": kb_program_ids::ED25519_PROGRAM_ID, + "expectedProgramId": ks_program_ids::ED25519_PROGRAM_ID, "resolvedProgramId": program_id, "resolved": previous.is_some(), - "matchesExpectedProgram": program_id == std::option::Option::Some(kb_program_ids::ED25519_PROGRAM_ID), + "matchesExpectedProgram": program_id == std::option::Option::Some(ks_program_ids::ED25519_PROGRAM_ID), "expectedSignatureCount": 2, "signatureTableInspectedByDecoder": false, }); @@ -479,8 +479,8 @@ mod tests { let keys = [ "Proof1111111111111111111111111111111111111", "Report111111111111111111111111111111111111", - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, - kb_program_ids::SYSTEM_PROGRAM_ID, + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, + ks_program_ids::SYSTEM_PROGRAM_ID, ]; let account_keys = keys .iter() @@ -509,14 +509,14 @@ mod tests { { "instructionIndex": previous_index, "instructionPath": previous_index.to_string(), - "programId": kb_program_ids::ED25519_PROGRAM_ID, + "programId": ks_program_ids::ED25519_PROGRAM_ID, "payloadJson": {"dataBase64": ""}, "payloadHash": "ed25519-hash" }, { "instructionIndex": current_index, "instructionPath": instruction_path, - "programId": kb_program_ids::SLASHING_PROGRAM_ID, + "programId": ks_program_ids::SLASHING_PROGRAM_ID, "payloadJson": { "dataBase64": base64::engine::general_purpose::STANDARD.encode(bytes), }, @@ -528,7 +528,7 @@ mod tests { "signature", 42, instruction_path, - kb_program_ids::SLASHING_PROGRAM_ID, + ks_program_ids::SLASHING_PROGRAM_ID, transaction_failed, if transaction_failed { std::option::Option::Some(serde_json::json!({"InstructionError": [2, "Custom"]})) diff --git a/kb-lib/src/decoder/solana/core/stake.rs b/ks-lib/src/decoder/solana/core/stake.rs similarity index 97% rename from kb-lib/src/decoder/solana/core/stake.rs rename to ks-lib/src/decoder/solana/core/stake.rs index 9200179..e23393c 100644 --- a/kb-lib/src/decoder/solana/core/stake.rs +++ b/ks-lib/src/decoder/solana/core/stake.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core/stake.rs -// version: 5 +// file: ks-lib/src/decoder/solana/core/stake.rs +// version: 6 //! Exact Stake Program instruction decoding through a bounded wincode-compatible wire mirror. @@ -88,7 +88,7 @@ pub(crate) fn decoder_solana_core_stake_coverage() .into_iter() .map(|(entry_code, tag, historical)| { return crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::STAKE_PROGRAM_ID.to_string(), + program_id: ks_program_ids::STAKE_PROGRAM_ID.to_string(), surface_code: std::option::Option::Some( crate::DC_SOLANA_CORE_STAKE_SURFACE_CODE.to_string(), ), @@ -423,7 +423,7 @@ fn contract(input: &crate::MdCoreInstructionReplayInput, entry_code: &str) -> Ac return match entry_code { "initialize" => { if account_key(input, 1) - == std::option::Option::Some(kb_program_ids::SYSVAR_RENT_PROGRAM_ID) + == std::option::Option::Some(ks_program_ids::SYSVAR_RENT_PROGRAM_ID) { AccountContract { roles: vec![ @@ -570,7 +570,7 @@ fn contract(input: &crate::MdCoreInstructionReplayInput, entry_code: &str) -> Ac ), "initialize_checked" => { if account_key(input, 1) - == std::option::Option::Some(kb_program_ids::SYSVAR_RENT_PROGRAM_ID) + == std::option::Option::Some(ks_program_ids::SYSVAR_RENT_PROGRAM_ID) { AccountContract { roles: vec![ @@ -696,7 +696,7 @@ fn clock_branch_contract( current_minimum_count: usize, ) -> AccountContract { if account_key(input, branch_position) - == std::option::Option::Some(kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID) + == std::option::Option::Some(ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID) { return AccountContract { roles: legacy_roles, @@ -831,7 +831,7 @@ mod tests { fixture( super::StakeInstructionWire::Initialize(authorized, lockup), "initialize", - vec!["Stake0", kb_program_ids::SYSVAR_RENT_PROGRAM_ID], + vec!["Stake0", ks_program_ids::SYSVAR_RENT_PROGRAM_ID], false, ), fixture( @@ -840,7 +840,7 @@ mod tests { solana_stake_interface::state::StakeAuthorize::Withdrawer, ), "authorize", - vec!["Stake0", kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID, "Authority2", "Custodian3"], + vec!["Stake0", ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID, "Authority2", "Custodian3"], false, ), fixture( @@ -849,9 +849,9 @@ mod tests { vec![ "Stake0", "Vote1", - kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID, - kb_program_ids::SYSVAR_STAKE_HISTORY_PROGRAM_ID, - kb_program_ids::STAKE_CONFIG_ACCOUNT_ID, + ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID, + ks_program_ids::SYSVAR_STAKE_HISTORY_PROGRAM_ID, + ks_program_ids::STAKE_CONFIG_ACCOUNT_ID, "Authority5", ], false, @@ -868,8 +868,8 @@ mod tests { vec![ "Stake0", "Recipient1", - kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID, - kb_program_ids::SYSVAR_STAKE_HISTORY_PROGRAM_ID, + ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID, + ks_program_ids::SYSVAR_STAKE_HISTORY_PROGRAM_ID, "Authority4", "Custodian5", ], @@ -878,7 +878,7 @@ mod tests { fixture( super::StakeInstructionWire::Deactivate, "deactivate", - vec!["Stake0", kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID, "Authority2"], + vec!["Stake0", ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID, "Authority2"], false, ), fixture( @@ -893,8 +893,8 @@ mod tests { vec![ "Stake0", "Stake1", - kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID, - kb_program_ids::SYSVAR_STAKE_HISTORY_PROGRAM_ID, + ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID, + ks_program_ids::SYSVAR_STAKE_HISTORY_PROGRAM_ID, "Authority4", ], false, @@ -907,13 +907,13 @@ mod tests { authority_owner: pubkey(7), }), "authorize_with_seed", - vec!["Stake0", "Base1", kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID, "Custodian3"], + vec!["Stake0", "Base1", ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID, "Custodian3"], false, ), fixture( super::StakeInstructionWire::InitializeChecked, "initialize_checked", - vec!["Stake0", kb_program_ids::SYSVAR_RENT_PROGRAM_ID, "Authority2", "Authority3"], + vec!["Stake0", ks_program_ids::SYSVAR_RENT_PROGRAM_ID, "Authority2", "Authority3"], false, ), fixture( @@ -923,7 +923,7 @@ mod tests { "authorize_checked", vec![ "Stake0", - kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID, + ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID, "Authority2", "Authority3", "Custodian4", @@ -942,7 +942,7 @@ mod tests { vec![ "Stake0", "Base1", - kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID, + ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID, "Authority3", "Custodian4", ], @@ -973,7 +973,7 @@ mod tests { "Stake0", "Stake1", "Vote2", - kb_program_ids::STAKE_CONFIG_ACCOUNT_ID, + ks_program_ids::STAKE_CONFIG_ACCOUNT_ID, "Authority4", ], true, @@ -1056,7 +1056,7 @@ mod tests { "signature", 42, "0", - kb_program_ids::STAKE_PROGRAM_ID, + ks_program_ids::STAKE_PROGRAM_ID, transaction_failed, if transaction_failed { std::option::Option::Some(serde_json::json!({"InstructionError": [0, "Custom"]})) @@ -1091,7 +1091,7 @@ mod tests { == std::option::Option::Some(expected.as_str()); })); } - assert_eq!(solana_sdk_ids::stake::id().to_string(), kb_program_ids::STAKE_PROGRAM_ID); + assert_eq!(solana_sdk_ids::stake::id().to_string(), ks_program_ids::STAKE_PROGRAM_ID); } #[test] @@ -1170,9 +1170,9 @@ mod tests { let legacy_keys = [ "Stake0".to_string(), "Vote1".to_string(), - kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID.to_string(), - kb_program_ids::SYSVAR_STAKE_HISTORY_PROGRAM_ID.to_string(), - kb_program_ids::STAKE_CONFIG_ACCOUNT_ID.to_string(), + ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID.to_string(), + ks_program_ids::SYSVAR_STAKE_HISTORY_PROGRAM_ID.to_string(), + ks_program_ids::STAKE_CONFIG_ACCOUNT_ID.to_string(), "Authority5".to_string(), ]; let current_keys = ["Stake0".to_string(), "Vote1".to_string(), "Authority2".to_string()]; diff --git a/kb-lib/src/decoder/solana/core/system.rs b/ks-lib/src/decoder/solana/core/system.rs similarity index 99% rename from kb-lib/src/decoder/solana/core/system.rs rename to ks-lib/src/decoder/solana/core/system.rs index b80e951..b15bd57 100644 --- a/kb-lib/src/decoder/solana/core/system.rs +++ b/ks-lib/src/decoder/solana/core/system.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core/system.rs -// version: 6 +// file: ks-lib/src/decoder/solana/core/system.rs +// version: 7 //! Maximal current System Program instruction decoding through the official interface enum and wincode schema. @@ -82,7 +82,7 @@ pub(crate) fn decoder_solana_core_system_coverage() .into_iter() .map(|(entry_code, tag)| { return crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::SYSTEM_PROGRAM_ID.to_string(), + program_id: ks_program_ids::SYSTEM_PROGRAM_ID.to_string(), surface_code: std::option::Option::Some( crate::DC_SOLANA_CORE_SYSTEM_SURFACE_CODE.to_string(), ), @@ -476,7 +476,7 @@ mod tests { "signature", 42, "0", - kb_program_ids::SYSTEM_PROGRAM_ID, + ks_program_ids::SYSTEM_PROGRAM_ID, transaction_failed, if transaction_failed { std::option::Option::Some(serde_json::json!({"InstructionError": [0, "Custom"]})) diff --git a/kb-lib/src/decoder/solana/core/vote.rs b/ks-lib/src/decoder/solana/core/vote.rs similarity index 97% rename from kb-lib/src/decoder/solana/core/vote.rs rename to ks-lib/src/decoder/solana/core/vote.rs index 03e2906..434b158 100644 --- a/kb-lib/src/decoder/solana/core/vote.rs +++ b/ks-lib/src/decoder/solana/core/vote.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core/vote.rs -// version: 6 +// file: ks-lib/src/decoder/solana/core/vote.rs +// version: 7 //! Exact Vote Program instruction decoding through the official interface wincode contract. @@ -102,7 +102,7 @@ pub(crate) fn decoder_solana_core_vote_coverage() .into_iter() .map(|(entry_code, tag)| { return crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::VOTE_PROGRAM_ID.to_string(), + program_id: ks_program_ids::VOTE_PROGRAM_ID.to_string(), surface_code: std::option::Option::Some( crate::DC_SOLANA_CORE_VOTE_SURFACE_CODE.to_string(), ), @@ -225,8 +225,8 @@ fn decoded_instruction( INITIALIZE_ACCOUNT_ROLES, 4, &[ - (1, kb_program_ids::SYSVAR_RENT_PROGRAM_ID), - (2, kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID), + (1, ks_program_ids::SYSVAR_RENT_PROGRAM_ID), + (2, ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID), ], vote_init_json(value), ), @@ -239,7 +239,7 @@ fn decoded_instruction( crate::MdEventFamily::Admin, AUTHORIZE_ROLES, 3, - &[(1, kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID)], + &[(1, ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID)], serde_json::json!({ "newAuthority": new_authority.to_string(), "authorizationType": vote_authorize_json(authorization_type), @@ -252,8 +252,8 @@ fn decoded_instruction( VOTE_ROLES, 4, &[ - (1, kb_program_ids::SYSVAR_SLOT_HASHES_PROGRAM_ID), - (2, kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID), + (1, ks_program_ids::SYSVAR_SLOT_HASHES_PROGRAM_ID), + (2, ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID), ], vote_json(value), ), @@ -298,8 +298,8 @@ fn decoded_instruction( VOTE_ROLES, 4, &[ - (1, kb_program_ids::SYSVAR_SLOT_HASHES_PROGRAM_ID), - (2, kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID), + (1, ks_program_ids::SYSVAR_SLOT_HASHES_PROGRAM_ID), + (2, ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID), ], parameters, ) @@ -312,7 +312,7 @@ fn decoded_instruction( crate::MdEventFamily::Admin, AUTHORIZE_CHECKED_ROLES, 4, - &[(1, kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID)], + &[(1, ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID)], serde_json::json!({ "authorizationType": vote_authorize_json(authorization_type), "newAuthorityFromAccount": true, @@ -350,7 +350,7 @@ fn decoded_instruction( crate::MdEventFamily::Admin, AUTHORIZE_WITH_SEED_ROLES, 3, - &[(1, kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID)], + &[(1, ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID)], serde_json::json!({ "authorizationType": vote_authorize_json(value.authorization_type), "currentAuthorityDerivedKeyOwner": value.current_authority_derived_key_owner.to_string(), @@ -365,7 +365,7 @@ fn decoded_instruction( crate::MdEventFamily::Admin, AUTHORIZE_CHECKED_WITH_SEED_ROLES, 4, - &[(1, kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID)], + &[(1, ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID)], serde_json::json!({ "authorizationType": vote_authorize_json(value.authorization_type), "currentAuthorityDerivedKeyOwner": value.current_authority_derived_key_owner.to_string(), @@ -525,11 +525,11 @@ fn build( fn validate_fixed_accounts( accounts: &serde_json::Value, fixed_accounts: &[(usize, &str)], -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let array = match accounts.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "resolved Vote Program accounts must be an array", )); }, @@ -540,7 +540,7 @@ fn validate_fixed_accounts( .and_then(|value| return value.get("accountKey")) .and_then(serde_json::Value::as_str); if actual != std::option::Option::Some(*expected) { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Vote Program account {position} must be {expected}" ))); } @@ -900,7 +900,7 @@ mod tests { "signature", 42, "0", - kb_program_ids::VOTE_PROGRAM_ID, + ks_program_ids::VOTE_PROGRAM_ID, transaction_failed, if transaction_failed { std::option::Option::Some(serde_json::json!({"InstructionError": [0, "Custom"]})) @@ -926,10 +926,10 @@ mod tests { fn account_key(entry_code: &str, index: usize) -> std::string::String { if entry_code == "initialize_account" && index == 1 { - return kb_program_ids::SYSVAR_RENT_PROGRAM_ID.to_string(); + return ks_program_ids::SYSVAR_RENT_PROGRAM_ID.to_string(); } if matches!(entry_code, "vote" | "vote_switch") && index == 1 { - return kb_program_ids::SYSVAR_SLOT_HASHES_PROGRAM_ID.to_string(); + return ks_program_ids::SYSVAR_SLOT_HASHES_PROGRAM_ID.to_string(); } if (matches!(entry_code, "vote" | "vote_switch") || entry_code == "initialize_account") && index == 2 @@ -941,7 +941,7 @@ mod tests { | "authorize_checked_with_seed" ) && index == 1) { - return kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID.to_string(); + return ks_program_ids::SYSVAR_CLOCK_PROGRAM_ID.to_string(); } return format!("VoteAccount{index}111111111111111111111111111"); } diff --git a/kb-lib/src/decoder/solana/core/zk_elgamal.rs b/ks-lib/src/decoder/solana/core/zk_elgamal.rs similarity index 99% rename from kb-lib/src/decoder/solana/core/zk_elgamal.rs rename to ks-lib/src/decoder/solana/core/zk_elgamal.rs index 5d9c473..f215cd9 100644 --- a/kb-lib/src/decoder/solana/core/zk_elgamal.rs +++ b/ks-lib/src/decoder/solana/core/zk_elgamal.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core/zk_elgamal.rs -// version: 4 +// file: ks-lib/src/decoder/solana/core/zk_elgamal.rs +// version: 5 //! Exact structural decoding for the native ZK ElGamal Proof program. @@ -21,7 +21,7 @@ pub(crate) fn decoder_solana_core_zk_elgamal_coverage() .iter() .map(|(tag, entry_code)| { return crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID.to_string(), + program_id: ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID.to_string(), surface_code: std::option::Option::Some( crate::DC_SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE.to_string(), ), @@ -555,7 +555,7 @@ mod tests { "signature", 42, "0", - kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, + ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, transaction_failed, if transaction_failed { std::option::Option::Some(serde_json::json!({"InstructionError": [0, "Custom"]})) diff --git a/kb-lib/src/decoder/solana/core/zk_token_proof.rs b/ks-lib/src/decoder/solana/core/zk_token_proof.rs similarity index 99% rename from kb-lib/src/decoder/solana/core/zk_token_proof.rs rename to ks-lib/src/decoder/solana/core/zk_token_proof.rs index 7ef76e2..7050615 100644 --- a/kb-lib/src/decoder/solana/core/zk_token_proof.rs +++ b/ks-lib/src/decoder/solana/core/zk_token_proof.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/solana/core/zk_token_proof.rs -// version: 4 +// file: ks-lib/src/decoder/solana/core/zk_token_proof.rs +// version: 5 //! Historical ZK Token Proof interface decoding with explicit current no-op runtime semantics. @@ -73,7 +73,7 @@ pub(crate) fn decoder_solana_core_zk_token_proof_coverage() .iter() .map(|(tag, entry_code)| { return crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID.to_string(), + program_id: ks_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID.to_string(), surface_code: std::option::Option::Some( crate::DC_SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE.to_string(), ), @@ -85,7 +85,7 @@ pub(crate) fn decoder_solana_core_zk_token_proof_coverage() }) .collect::>(); coverage.push(crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID.to_string(), + program_id: ks_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID.to_string(), surface_code: std::option::Option::Some( crate::DC_SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE.to_string(), ), @@ -687,7 +687,7 @@ mod tests { "signature", 42, instruction_path, - kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID, + ks_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID, transaction_failed, if transaction_failed { std::option::Option::Some(serde_json::json!({"InstructionError": [0, "Custom"]})) diff --git a/kb-lib/src/decoder/spl.rs b/ks-lib/src/decoder/spl.rs similarity index 99% rename from kb-lib/src/decoder/spl.rs rename to ks-lib/src/decoder/spl.rs index 05265ce..e76785d 100644 --- a/kb-lib/src/decoder/spl.rs +++ b/ks-lib/src/decoder/spl.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl.rs -// version: 11 +// file: ks-lib/src/decoder/spl.rs +// version: 12 //! `spl` decoder family. diff --git a/kb-lib/src/decoder/spl/account_compression.rs b/ks-lib/src/decoder/spl/account_compression.rs similarity index 84% rename from kb-lib/src/decoder/spl/account_compression.rs rename to ks-lib/src/decoder/spl/account_compression.rs index 1db2f33..778e083 100644 --- a/kb-lib/src/decoder/spl/account_compression.rs +++ b/ks-lib/src/decoder/spl/account_compression.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/account_compression.rs -// version: 4 +// file: ks-lib/src/decoder/spl/account_compression.rs +// version: 5 //! Reserved protocol decoder for `spl_account_compression`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcSplAccountCompressionDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::SPL_ACCOUNT_COMPRESSION_PROGRAM_ID]; + return &[ks_program_ids::SPL_ACCOUNT_COMPRESSION_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcSplAccountCompressionDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/spl/associated_token_account.rs b/ks-lib/src/decoder/spl/associated_token_account.rs similarity index 95% rename from kb-lib/src/decoder/spl/associated_token_account.rs rename to ks-lib/src/decoder/spl/associated_token_account.rs index 888a98e..7d2b728 100644 --- a/kb-lib/src/decoder/spl/associated_token_account.rs +++ b/ks-lib/src/decoder/spl/associated_token_account.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/associated_token_account.rs -// version: 4 +// file: ks-lib/src/decoder/spl/associated_token_account.rs +// version: 5 //! Exact SPL Associated Token Account decoder component. diff --git a/kb-lib/src/decoder/spl/associated_token_account/constants.rs b/ks-lib/src/decoder/spl/associated_token_account/constants.rs similarity index 89% rename from kb-lib/src/decoder/spl/associated_token_account/constants.rs rename to ks-lib/src/decoder/spl/associated_token_account/constants.rs index 279067d..b066de7 100644 --- a/kb-lib/src/decoder/spl/associated_token_account/constants.rs +++ b/ks-lib/src/decoder/spl/associated_token_account/constants.rs @@ -1,7 +1,7 @@ -// file: kb-lib/src/decoder/spl/associated_token_account/constants.rs -// version: 3 +// file: ks-lib/src/decoder/spl/associated_token_account/constants.rs +// version: 4 -//! Local constants for the `kb-lib` SPL Associated Token Account component. +//! Local constants for the `ks-lib` SPL Associated Token Account component. /// Stable protocol and surface code for the Associated Token Account program. pub(crate) const DC_SPL_ATA_SURFACE_CODE: &str = "spl.associated_token_account"; diff --git a/kb-lib/src/decoder/spl/associated_token_account/decoder.rs b/ks-lib/src/decoder/spl/associated_token_account/decoder.rs similarity index 95% rename from kb-lib/src/decoder/spl/associated_token_account/decoder.rs rename to ks-lib/src/decoder/spl/associated_token_account/decoder.rs index 3286a3d..e787c96 100644 --- a/kb-lib/src/decoder/spl/associated_token_account/decoder.rs +++ b/ks-lib/src/decoder/spl/associated_token_account/decoder.rs @@ -1,15 +1,15 @@ -// file: kb-lib/src/decoder/spl/associated_token_account/decoder.rs -// version: 4 +// file: ks-lib/src/decoder/spl/associated_token_account/decoder.rs +// version: 5 //! Exact SPL Associated Token Account dispatch for the common decode pipeline. const SURFACES: &[crate::DcApiDecoderSurface] = &[crate::DcApiDecoderSurface { - program_id: kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID, + program_id: ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID, surface_code: crate::DC_SPL_ATA_SURFACE_CODE, priority: 100, }]; -const PROGRAM_IDS: &[&str] = &[kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID]; +const PROGRAM_IDS: &[&str] = &[ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID]; /// Exact decoder for the SPL Associated Token Account program. #[derive(Clone, Debug, Default)] @@ -42,7 +42,7 @@ impl crate::DcApiProtocolDecoder for crate::DcSplAssociatedTokenAccountDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -64,7 +64,7 @@ impl crate::DcApiInstructionDecoder for crate::DcSplAssociatedTokenAccountDecode .iter() .map(|(tag, code, historical)| { return crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string(), + program_id: ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string(), surface_code: std::option::Option::Some( crate::DC_SPL_ATA_SURFACE_CODE.to_string(), ), @@ -81,7 +81,7 @@ impl crate::DcApiInstructionDecoder for crate::DcSplAssociatedTokenAccountDecode &self, input: &crate::MdCoreInstructionReplayInput, ) -> crate::DcApiDecoderRecognition { - if input.program_id != kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID { + if input.program_id != ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID { return crate::DcApiDecoderRecognition::incompatible(); } let wire = crate::decoder_spl_associated_token_account_payload(input).ok(); @@ -101,7 +101,7 @@ impl crate::DcApiInstructionDecoder for crate::DcSplAssociatedTokenAccountDecode &self, input: &crate::MdCoreInstructionReplayInput, ) -> crate::DcApiDecoderExecutionResult { - if input.program_id != kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID { + if input.program_id != ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID { return crate::DcApiDecoderExecutionResult::unsupported(std::option::Option::None); } let result = crate::decoder_spl_associated_token_account_decode(input); @@ -208,10 +208,10 @@ mod tests { #[test] fn program_ids_accounts_and_pda_seed_order_are_explicit() { let matrix = matrix(); - assert_eq!(matrix["programId"], kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID); + assert_eq!(matrix["programId"], ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID); assert_eq!( spl_associated_token_account_interface::program::ID.to_string(), - kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID + ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID ); assert_eq!(matrix["limits"]["createRequiredAccountCount"], 6); assert_eq!(matrix["limits"]["recoverNestedRequiredAccountCount"], 7); @@ -247,7 +247,7 @@ mod tests { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("invalid nested mint fixture: {error}"), }; - let token_program = match kb_program_ids::SPL_TOKEN_PROGRAM_ID.parse() { + let token_program = match ks_program_ids::SPL_TOKEN_PROGRAM_ID.parse() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("invalid Token fixture: {error}"), }; @@ -364,7 +364,7 @@ mod tests { "signature", 42, path, - kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID, + ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID, failed, if failed { std::option::Option::Some(serde_json::json!({"InstructionError":[0,"Custom"]})) @@ -442,7 +442,7 @@ mod tests { signature: crate::MdSignature("signature".to_string()), slot: crate::MdSlot(1), instruction_path: crate::MdInstructionPath("0".to_string()), - program_id: crate::MdProgramId(kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string()), + program_id: crate::MdProgramId(ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string()), discriminator_8: std::option::Option::None, data_len: 1, accounts_len: 6, @@ -459,7 +459,7 @@ mod tests { #[test] fn create_and_legacy_empty_create_decode_with_canonical_address() { - let (wire, metas) = create_fixture(kb_program_ids::SPL_TOKEN_PROGRAM_ID, false); + let (wire, metas) = create_fixture(ks_program_ids::SPL_TOKEN_PROGRAM_ID, false); for candidate in [wire.as_slice(), &[]] { let input = replay(candidate, metas.as_slice(), false, "0"); let result = crate::DcApiInstructionDecoder::decode( @@ -490,7 +490,7 @@ mod tests { #[test] fn token_2022_inner_failed_idempotent_remains_an_uncommitted_intent() { - let (wire, metas) = create_fixture(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, true); + let (wire, metas) = create_fixture(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, true); let input = replay(wire.as_slice(), metas.as_slice(), true, "2/1"); let result = crate::DcApiInstructionDecoder::decode( &crate::DcSplAssociatedTokenAccountDecoder, @@ -523,7 +523,7 @@ mod tests { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("invalid nested mint fixture: {error}"), }; - let token_program = match kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.parse() { + let token_program = match ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.parse() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("invalid token program fixture: {error}"), }; @@ -562,7 +562,7 @@ mod tests { #[test] fn wrong_address_flags_duplicates_extra_and_missing_accounts_stay_decodable() { - let (wire, mut metas) = create_fixture(kb_program_ids::SPL_TOKEN_PROGRAM_ID, false); + let (wire, mut metas) = create_fixture(ks_program_ids::SPL_TOKEN_PROGRAM_ID, false); metas[1].0 = metas[0].0.clone(); metas[0].1 = false; metas.push(("SysvarC1ock11111111111111111111111111111111".to_string(), false, false)); @@ -604,7 +604,7 @@ mod tests { #[test] fn unknown_and_suffixed_wire_fail_with_bounded_diagnostics() { - let (_, metas) = create_fixture(kb_program_ids::SPL_TOKEN_PROGRAM_ID, false); + let (_, metas) = create_fixture(ks_program_ids::SPL_TOKEN_PROGRAM_ID, false); for wire in [std::vec![9], std::vec![0, 0]] { let input = replay(wire.as_slice(), metas.as_slice(), false, "0"); let result = crate::DcApiInstructionDecoder::decode( diff --git a/kb-lib/src/decoder/spl/associated_token_account/wire.rs b/ks-lib/src/decoder/spl/associated_token_account/wire.rs similarity index 92% rename from kb-lib/src/decoder/spl/associated_token_account/wire.rs rename to ks-lib/src/decoder/spl/associated_token_account/wire.rs index 033644f..1cd4b9c 100644 --- a/kb-lib/src/decoder/spl/associated_token_account/wire.rs +++ b/ks-lib/src/decoder/spl/associated_token_account/wire.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/associated_token_account/wire.rs -// version: 3 +// file: ks-lib/src/decoder/spl/associated_token_account/wire.rs +// version: 4 //! Bounded ATA wire, ordered account and canonical PDA decoding. @@ -33,11 +33,11 @@ pub(crate) fn decoder_spl_associated_token_account_entry( pub(crate) fn decoder_spl_associated_token_account_payload( input: &crate::MdCoreInstructionReplayInput, -) -> kb_core::Result> { +) -> ks_core::Result> { let value = match input.instruction_payload_json.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "ATA instruction payload is not retained", )); }, @@ -45,26 +45,26 @@ pub(crate) fn decoder_spl_associated_token_account_payload( let encoded = match value.get("dataBase64").and_then(serde_json::Value::as_str) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "ATA payload does not contain dataBase64", )); }, }; if encoded.len() > 92 { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "ATA base64 payload exceeds the bounded input limit", )); } let bytes = match base64::engine::general_purpose::STANDARD.decode(encoded.as_bytes()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "ATA payload is not valid base64: {error}" ))); }, }; if bytes.len() > crate::DC_SPL_ATA_MAX_INSTRUCTION_BYTES { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "ATA decoded payload exceeds 64 bytes", )); } @@ -180,11 +180,11 @@ pub(crate) fn decoder_spl_associated_token_account_decode( fn accounts( input: &crate::MdCoreInstructionReplayInput, -) -> kb_core::Result> { +) -> ks_core::Result> { let instruction_accounts = match input.instruction_accounts_json.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "ATA instruction accounts must be a JSON array", )); }, @@ -192,18 +192,18 @@ fn accounts( let keys = match input.account_keys_json.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "ATA transaction account keys must be a JSON array", )); }, }; if instruction_accounts.len() > crate::DC_SPL_ATA_MAX_ACCOUNTS { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "ATA instruction account count exceeds 64", )); } if keys.len() > crate::DC_SPL_ATA_MAX_TRANSACTION_KEYS { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "ATA transaction account key count exceeds 4096", )); } @@ -212,7 +212,7 @@ fn accounts( let index = match value.get("accountIndex").and_then(serde_json::Value::as_u64) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "ATA instruction account {position} has no accountIndex" ))); }, @@ -224,7 +224,7 @@ fn accounts( value }, _ => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "ATA instruction account {position} has no accountKey" ))); }, @@ -235,7 +235,7 @@ fn accounts( }) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "ATA account index {index} is not resolved" ))); }, @@ -243,14 +243,14 @@ fn accounts( if resolved.get("accountKey").and_then(serde_json::Value::as_str) != std::option::Option::Some(key) { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "ATA account index {index} resolves to a different key" ))); } let signer = match resolved.get("signer").and_then(serde_json::Value::as_bool) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "ATA account index {index} has no signer flag" ))); }, @@ -258,7 +258,7 @@ fn accounts( let writable = match resolved.get("writable").and_then(serde_json::Value::as_bool) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "ATA account index {index} has no writable flag" ))); }, @@ -351,8 +351,8 @@ fn diagnostics(code: &str, accounts: &[Account]) -> serde_json::Value { } let token_position = if code == "recover_nested" { 6 } else { 5 }; if accounts.get(token_position).is_some_and(|account| { - return account.key != kb_program_ids::SPL_TOKEN_PROGRAM_ID - && account.key != kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID; + return account.key != ks_program_ids::SPL_TOKEN_PROGRAM_ID + && account.key != ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID; }) { values.push(serde_json::json!({"code":"unsupported_token_program","observed":accounts.get(token_position).map(|value| return value.key.clone())})); } @@ -420,11 +420,11 @@ fn derived( fn token_kind(token: std::option::Option<&str>) -> serde_json::Value { return match token { - std::option::Option::Some(kb_program_ids::SPL_TOKEN_PROGRAM_ID) => { - serde_json::json!({"programId":kb_program_ids::SPL_TOKEN_PROGRAM_ID,"kind":"spl_token_classic","supported":true}) + std::option::Option::Some(ks_program_ids::SPL_TOKEN_PROGRAM_ID) => { + serde_json::json!({"programId":ks_program_ids::SPL_TOKEN_PROGRAM_ID,"kind":"spl_token_classic","supported":true}) }, - std::option::Option::Some(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID) => { - serde_json::json!({"programId":kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID,"kind":"token_2022","supported":true}) + std::option::Option::Some(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID) => { + serde_json::json!({"programId":ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID,"kind":"token_2022","supported":true}) }, std::option::Option::Some(value) => { serde_json::json!({"programId":value,"kind":"unsupported","supported":false}) diff --git a/kb-lib/src/decoder/spl/elgamal_registry.rs b/ks-lib/src/decoder/spl/elgamal_registry.rs similarity index 96% rename from kb-lib/src/decoder/spl/elgamal_registry.rs rename to ks-lib/src/decoder/spl/elgamal_registry.rs index 609f333..0bf47e9 100644 --- a/kb-lib/src/decoder/spl/elgamal_registry.rs +++ b/ks-lib/src/decoder/spl/elgamal_registry.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/elgamal_registry.rs -// version: 3 +// file: ks-lib/src/decoder/spl/elgamal_registry.rs +// version: 4 //! Exact SPL Token-2022 ElGamal public-key registry decoder component. diff --git a/kb-lib/src/decoder/spl/elgamal_registry/constants.rs b/ks-lib/src/decoder/spl/elgamal_registry/constants.rs similarity index 85% rename from kb-lib/src/decoder/spl/elgamal_registry/constants.rs rename to ks-lib/src/decoder/spl/elgamal_registry/constants.rs index c61ae17..c607018 100644 --- a/kb-lib/src/decoder/spl/elgamal_registry/constants.rs +++ b/ks-lib/src/decoder/spl/elgamal_registry/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/elgamal_registry/constants.rs -// version: 3 +// file: ks-lib/src/decoder/spl/elgamal_registry/constants.rs +// version: 4 //! Constants for the SPL ElGamal registry decoder. diff --git a/kb-lib/src/decoder/spl/elgamal_registry/decoder.rs b/ks-lib/src/decoder/spl/elgamal_registry/decoder.rs similarity index 92% rename from kb-lib/src/decoder/spl/elgamal_registry/decoder.rs rename to ks-lib/src/decoder/spl/elgamal_registry/decoder.rs index 1d77ed1..e6d2c90 100644 --- a/kb-lib/src/decoder/spl/elgamal_registry/decoder.rs +++ b/ks-lib/src/decoder/spl/elgamal_registry/decoder.rs @@ -1,15 +1,15 @@ -// file: kb-lib/src/decoder/spl/elgamal_registry/decoder.rs -// version: 3 +// file: ks-lib/src/decoder/spl/elgamal_registry/decoder.rs +// version: 4 //! Exact dispatch for the SPL ElGamal registry program. const SURFACES: &[crate::DcApiDecoderSurface] = &[crate::DcApiDecoderSurface { - program_id: kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, + program_id: ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, surface_code: crate::DC_SPL_ELGAMAL_REGISTRY_SURFACE_CODE, priority: 101, }]; -const PROGRAM_IDS: &[&str] = &[kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID]; +const PROGRAM_IDS: &[&str] = &[ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID]; /// Decoder for the dedicated Token-2022 ElGamal public-key registry program. #[derive(Clone, Debug, Default)] @@ -42,7 +42,7 @@ impl crate::DcApiProtocolDecoder for crate::DcSplElgamalRegistryDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -64,7 +64,7 @@ impl crate::DcApiInstructionDecoder for crate::DcSplElgamalRegistryDecoder { .into_iter() .map(|(tag, code)| { return crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID + program_id: ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID .to_string(), surface_code: std::option::Option::Some( crate::DC_SPL_ELGAMAL_REGISTRY_SURFACE_CODE.to_string(), @@ -82,7 +82,7 @@ impl crate::DcApiInstructionDecoder for crate::DcSplElgamalRegistryDecoder { &self, input: &crate::MdCoreInstructionReplayInput, ) -> crate::DcApiDecoderRecognition { - if input.program_id != kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID { + if input.program_id != ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID { return crate::DcApiDecoderRecognition::incompatible(); } let entry = input @@ -115,7 +115,7 @@ impl crate::DcApiInstructionDecoder for crate::DcSplElgamalRegistryDecoder { &self, input: &crate::MdCoreInstructionReplayInput, ) -> crate::DcApiDecoderExecutionResult { - if input.program_id != kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID { + if input.program_id != ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID { return crate::DcApiDecoderExecutionResult::unsupported(std::option::Option::None); } let result = crate::decoder_spl_elgamal_registry_decode(input); @@ -199,11 +199,11 @@ mod tests { fn exact_program_boundary_and_interface_id_are_preserved() { assert_eq!( spl_elgamal_registry_interface::id().to_string(), - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID ); let decoder = crate::DcSplElgamalRegistryDecoder; assert_eq!(crate::DcApiInstructionDecoder::coverage(&decoder).len(), 2); - let foreign = input(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, &[0, 1], false, "0"); + let foreign = input(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, &[0, 1], false, "0"); assert_eq!( crate::DcApiInstructionDecoder::decode(&decoder, &foreign).status, crate::DcApiDecoderOutcomeStatus::Unsupported @@ -218,7 +218,7 @@ mod tests { (1_u8, "update_registry", 0_i8, false, "2"), ] { let input = input( - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, &[tag, offset as u8], failed, path, @@ -239,7 +239,7 @@ mod tests { fn malformed_unknown_and_suffixed_wire_fail_closed() { for payload in [std::vec::Vec::new(), vec![0], vec![2, 0], vec![0, 1, 2]] { let input = input( - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, payload.as_slice(), false, "0", diff --git a/kb-lib/src/decoder/spl/elgamal_registry/state.rs b/ks-lib/src/decoder/spl/elgamal_registry/state.rs similarity index 97% rename from kb-lib/src/decoder/spl/elgamal_registry/state.rs rename to ks-lib/src/decoder/spl/elgamal_registry/state.rs index 73f10f5..4d75b2c 100644 --- a/kb-lib/src/decoder/spl/elgamal_registry/state.rs +++ b/ks-lib/src/decoder/spl/elgamal_registry/state.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/elgamal_registry/state.rs -// version: 1 +// file: ks-lib/src/decoder/spl/elgamal_registry/state.rs +// version: 2 //! Strict SPL ElGamal registry account-state parsing. diff --git a/kb-lib/src/decoder/spl/elgamal_registry/wire.rs b/ks-lib/src/decoder/spl/elgamal_registry/wire.rs similarity index 96% rename from kb-lib/src/decoder/spl/elgamal_registry/wire.rs rename to ks-lib/src/decoder/spl/elgamal_registry/wire.rs index cefbd96..465ba97 100644 --- a/kb-lib/src/decoder/spl/elgamal_registry/wire.rs +++ b/ks-lib/src/decoder/spl/elgamal_registry/wire.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/elgamal_registry/wire.rs -// version: 1 +// file: ks-lib/src/decoder/spl/elgamal_registry/wire.rs +// version: 2 //! Exact two-byte SPL ElGamal registry instruction decoding. @@ -161,9 +161,9 @@ pub(crate) fn decoder_spl_elgamal_registry_decode( "complete": true, }, "programBoundary": { - "registryProgramId": kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, - "token_2022ProgramId": kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, - "zkProofProgramId": kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, + "registryProgramId": ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, + "token_2022ProgramId": ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + "zkProofProgramId": ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, "proofDecodedHere": false, } }), diff --git a/kb-lib/src/decoder/spl/memo.rs b/ks-lib/src/decoder/spl/memo.rs similarity index 95% rename from kb-lib/src/decoder/spl/memo.rs rename to ks-lib/src/decoder/spl/memo.rs index ff946c0..4160d60 100644 --- a/kb-lib/src/decoder/spl/memo.rs +++ b/ks-lib/src/decoder/spl/memo.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/memo.rs -// version: 3 +// file: ks-lib/src/decoder/spl/memo.rs +// version: 4 //! Exact SPL Memo v1, v3 and v4 decoder component. diff --git a/kb-lib/src/decoder/spl/memo/constants.rs b/ks-lib/src/decoder/spl/memo/constants.rs similarity index 84% rename from kb-lib/src/decoder/spl/memo/constants.rs rename to ks-lib/src/decoder/spl/memo/constants.rs index 4086f8d..8cc419b 100644 --- a/kb-lib/src/decoder/spl/memo/constants.rs +++ b/ks-lib/src/decoder/spl/memo/constants.rs @@ -1,7 +1,7 @@ -// file: kb-lib/src/decoder/spl/memo/constants.rs -// version: 4 +// file: ks-lib/src/decoder/spl/memo/constants.rs +// version: 5 -//! Local constants for the `kb-lib` SPL Memo component. Program identifiers live in `kb_program_ids`. +//! Local constants for the `ks-lib` SPL Memo component. Program identifiers live in `ks_program_ids`. /// Stable protocol code shared by Memo generations. pub(crate) const DC_SPL_MEMO_PROTOCOL_CODE: &str = "spl.memo"; diff --git a/kb-lib/src/decoder/spl/memo/decoder.rs b/ks-lib/src/decoder/spl/memo/decoder.rs similarity index 92% rename from kb-lib/src/decoder/spl/memo/decoder.rs rename to ks-lib/src/decoder/spl/memo/decoder.rs index 18f76b3..8931570 100644 --- a/kb-lib/src/decoder/spl/memo/decoder.rs +++ b/ks-lib/src/decoder/spl/memo/decoder.rs @@ -1,30 +1,30 @@ -// file: kb-lib/src/decoder/spl/memo/decoder.rs -// version: 4 +// file: ks-lib/src/decoder/spl/memo/decoder.rs +// version: 5 //! Exact SPL Memo v1, v3 and v4 dispatch for the common decode pipeline. const MEMO_SURFACES: &[crate::DcApiDecoderSurface] = &[ crate::DcApiDecoderSurface { - program_id: kb_program_ids::SPL_MEMO_V1_PROGRAM_ID, + program_id: ks_program_ids::SPL_MEMO_V1_PROGRAM_ID, surface_code: crate::DC_SPL_MEMO_V1_SURFACE_CODE, priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::SPL_MEMO_V3_PROGRAM_ID, + program_id: ks_program_ids::SPL_MEMO_V3_PROGRAM_ID, surface_code: crate::DC_SPL_MEMO_V3_SURFACE_CODE, priority: 100, }, crate::DcApiDecoderSurface { - program_id: kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + program_id: ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, surface_code: crate::DC_SPL_MEMO_V4_SURFACE_CODE, priority: 100, }, ]; const LEGACY_PROGRAM_IDS: &[&str] = &[ - kb_program_ids::SPL_MEMO_V1_PROGRAM_ID, - kb_program_ids::SPL_MEMO_V3_PROGRAM_ID, - kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V1_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V3_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, ]; /// Exact decoder for the three registered SPL Memo generations. @@ -57,7 +57,7 @@ impl crate::DcApiProtocolDecoder for crate::DcSplMemoDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -84,7 +84,7 @@ impl crate::DcApiInstructionDecoder for crate::DcSplMemoDecoder { entry_kind: crate::DcApiDecoderCoverageEntryKind::Instruction, entry_code: "add_memo".to_string(), discriminator_hex: std::option::Option::None, - historical: surface.program_id != kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + historical: surface.program_id != ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, }; }) .collect(); @@ -206,9 +206,9 @@ mod tests { #[test] fn exact_support_and_interface_ids_cover_all_generations() { let decoder = crate::DcSplMemoDecoder; - assert_eq!(spl_memo_interface::v1::ID.to_string(), kb_program_ids::SPL_MEMO_V1_PROGRAM_ID); - assert_eq!(spl_memo_interface::v3::ID.to_string(), kb_program_ids::SPL_MEMO_V3_PROGRAM_ID); - assert_eq!(spl_memo_interface::v4::ID.to_string(), kb_program_ids::SPL_MEMO_V4_PROGRAM_ID); + assert_eq!(spl_memo_interface::v1::ID.to_string(), ks_program_ids::SPL_MEMO_V1_PROGRAM_ID); + assert_eq!(spl_memo_interface::v3::ID.to_string(), ks_program_ids::SPL_MEMO_V3_PROGRAM_ID); + assert_eq!(spl_memo_interface::v4::ID.to_string(), ks_program_ids::SPL_MEMO_V4_PROGRAM_ID); assert_eq!(crate::DcApiInstructionDecoder::surfaces(&decoder).len(), 3); assert!( crate::DcApiInstructionDecoder::coverage(&decoder) @@ -225,7 +225,7 @@ mod tests { { let path = if index == 2 { "1/0" } else { "0" }; let input = input( - kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, payload, serde_json::json!([]), serde_json::json!([]), @@ -254,7 +254,7 @@ mod tests { fn v1_ignores_accounts_while_v3_and_v4_require_every_account_to_sign() { let (accounts, keys) = one_account(false); let v1 = input( - kb_program_ids::SPL_MEMO_V1_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V1_PROGRAM_ID, b"legacy", accounts.clone(), keys.clone(), @@ -268,7 +268,7 @@ mod tests { "not_applicable" ); for program_id in - [kb_program_ids::SPL_MEMO_V3_PROGRAM_ID, kb_program_ids::SPL_MEMO_V4_PROGRAM_ID] + [ks_program_ids::SPL_MEMO_V3_PROGRAM_ID, ks_program_ids::SPL_MEMO_V4_PROGRAM_ID] { let input = input(program_id, b"signed", accounts.clone(), keys.clone(), false, "0"); let result = crate::DcApiInstructionDecoder::decode(&crate::DcSplMemoDecoder, &input); @@ -284,7 +284,7 @@ mod tests { #[test] fn invalid_utf8_and_failed_transactions_are_explicit_uncommitted_intents() { let invalid = input( - kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, &[0xf0, 0x9f, 0x90, 0xff], serde_json::json!([]), serde_json::json!([]), @@ -300,7 +300,7 @@ mod tests { ); assert!(!invalid_result.observations[0].observation_committed); let valid_failed = input( - kb_program_ids::SPL_MEMO_V3_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V3_PROGRAM_ID, b"rolled back", serde_json::json!([]), serde_json::json!([]), @@ -329,7 +329,7 @@ mod tests { {"accountIndex":2,"accountKey":"second","signer":true,"writable":false,"source":"static"} ]); let input = - input(kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, b"ordered", accounts, keys, false, "0"); + input(ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, b"ordered", accounts, keys, false, "0"); let result = crate::DcApiInstructionDecoder::decode(&crate::DcSplMemoDecoder, &input); assert_eq!(result.observations[0].payload_json["accounts"][0]["pubkey"], "first"); assert_eq!(result.observations[0].payload_json["accounts"][0]["writable"], true); @@ -347,7 +347,7 @@ mod tests { #[test] fn payload_hash_is_canonical_sha256() { let input = input( - kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, b"abc", serde_json::json!([]), serde_json::json!([]), @@ -365,7 +365,7 @@ mod tests { fn payload_bound_accepts_limit_and_rejects_oversize_and_malformed_base64() { let at_limit = std::vec![b'x'; crate::DC_SPL_MEMO_MAX_PAYLOAD_BYTES]; let cinput = input( - kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, at_limit.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -376,7 +376,7 @@ mod tests { assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded); let oversize = std::vec![b'x'; crate::DC_SPL_MEMO_MAX_PAYLOAD_BYTES + 1]; let cinput = input( - kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, oversize.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -386,7 +386,7 @@ mod tests { let result = crate::DcApiInstructionDecoder::decode(&crate::DcSplMemoDecoder, &cinput); assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Failed); let mut malformed = input( - kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, b"valid", serde_json::json!([]), serde_json::json!([]), @@ -403,7 +403,7 @@ mod tests { #[test] fn unknown_program_is_incompatible_and_never_emits_an_observation() { let input = input( - kb_program_ids::SYSTEM_PROGRAM_ID, + ks_program_ids::SYSTEM_PROGRAM_ID, b"not memo", serde_json::json!([]), serde_json::json!([]), diff --git a/kb-lib/src/decoder/spl/memo/payload.rs b/ks-lib/src/decoder/spl/memo/payload.rs similarity index 92% rename from kb-lib/src/decoder/spl/memo/payload.rs rename to ks-lib/src/decoder/spl/memo/payload.rs index 93ac339..aac7338 100644 --- a/kb-lib/src/decoder/spl/memo/payload.rs +++ b/ks-lib/src/decoder/spl/memo/payload.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/memo/payload.rs -// version: 1 +// file: ks-lib/src/decoder/spl/memo/payload.rs +// version: 2 //! Bounded Memo payload, account and validation projection. @@ -15,13 +15,13 @@ enum MemoGeneration { impl MemoGeneration { fn from_program_id(program_id: &str) -> std::option::Option { - if program_id == kb_program_ids::SPL_MEMO_V1_PROGRAM_ID { + if program_id == ks_program_ids::SPL_MEMO_V1_PROGRAM_ID { return std::option::Option::Some(Self::V1); } - if program_id == kb_program_ids::SPL_MEMO_V3_PROGRAM_ID { + if program_id == ks_program_ids::SPL_MEMO_V3_PROGRAM_ID { return std::option::Option::Some(Self::V3); } - if program_id == kb_program_ids::SPL_MEMO_V4_PROGRAM_ID { + if program_id == ks_program_ids::SPL_MEMO_V4_PROGRAM_ID { return std::option::Option::Some(Self::V4); } return std::option::Option::None; @@ -198,11 +198,11 @@ pub(crate) fn decoder_spl_memo_decode( fn decode_payload( input: &crate::MdCoreInstructionReplayInput, -) -> kb_core::Result> { +) -> ks_core::Result> { let payload = match input.instruction_payload_json.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Memo instruction payload is not retained", )); }, @@ -210,7 +210,7 @@ fn decode_payload( let encoded = match payload.get("dataBase64").and_then(serde_json::Value::as_str) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Memo instruction payload does not contain dataBase64", )); }, @@ -220,20 +220,20 @@ fn decode_payload( .saturating_div(3) .saturating_add(4); if encoded.len() > maximum_encoded { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Memo base64 payload exceeds {maximum_encoded} bytes" ))); } let decoded = match base64::engine::general_purpose::STANDARD.decode(encoded.as_bytes()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Memo payload is not valid base64: {error}" ))); }, }; if decoded.len() > crate::DC_SPL_MEMO_MAX_PAYLOAD_BYTES { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Memo payload exceeds {} decoded bytes", crate::DC_SPL_MEMO_MAX_PAYLOAD_BYTES ))); @@ -243,11 +243,11 @@ fn decode_payload( fn resolve_accounts( input: &crate::MdCoreInstructionReplayInput, -) -> kb_core::Result { +) -> ks_core::Result { let instruction_accounts = match input.instruction_accounts_json.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Memo instruction accounts must be a JSON array", )); }, @@ -255,7 +255,7 @@ fn resolve_accounts( let account_keys = match input.account_keys_json.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Memo transaction account keys must be a JSON array", )); }, @@ -268,7 +268,7 @@ fn resolve_accounts( let account_index = match account.get("accountIndex").and_then(serde_json::Value::as_u64) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Memo instruction account {position} has no accountIndex" ))); }, @@ -276,7 +276,7 @@ fn resolve_accounts( let account_key = match account.get("accountKey").and_then(serde_json::Value::as_str) { std::option::Option::Some(value) if !value.trim().is_empty() => value, _ => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Memo instruction account {position} has no accountKey" ))); }, @@ -288,7 +288,7 @@ fn resolve_accounts( let resolved = match resolved { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Memo account index {account_index} is absent from resolved keys" ))); }, @@ -296,14 +296,14 @@ fn resolve_accounts( if resolved.get("accountKey").and_then(serde_json::Value::as_str) != std::option::Option::Some(account_key) { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Memo account index {account_index} resolves to a different key" ))); } let signer = match resolved.get("signer").and_then(serde_json::Value::as_bool) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Memo account index {account_index} has no signer flag" ))); }, @@ -311,7 +311,7 @@ fn resolve_accounts( let writable = match resolved.get("writable").and_then(serde_json::Value::as_bool) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Memo account index {account_index} has no writable flag" ))); }, diff --git a/kb-lib/src/decoder/spl/noop.rs b/ks-lib/src/decoder/spl/noop.rs similarity index 85% rename from kb-lib/src/decoder/spl/noop.rs rename to ks-lib/src/decoder/spl/noop.rs index 5211ae2..8feaca1 100644 --- a/kb-lib/src/decoder/spl/noop.rs +++ b/ks-lib/src/decoder/spl/noop.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/noop.rs -// version: 4 +// file: ks-lib/src/decoder/spl/noop.rs +// version: 5 //! Reserved protocol decoder for `spl_noop`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcSplNoopDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::SPL_NOOP_PROGRAM_ID]; + return &[ks_program_ids::SPL_NOOP_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcSplNoopDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/spl/single_pool.rs b/ks-lib/src/decoder/spl/single_pool.rs similarity index 84% rename from kb-lib/src/decoder/spl/single_pool.rs rename to ks-lib/src/decoder/spl/single_pool.rs index d31e004..fbb774d 100644 --- a/kb-lib/src/decoder/spl/single_pool.rs +++ b/ks-lib/src/decoder/spl/single_pool.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/single_pool.rs -// version: 4 +// file: ks-lib/src/decoder/spl/single_pool.rs +// version: 5 //! Reserved protocol decoder for `spl_single_pool`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcSplSinglePoolDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::SPL_SINGLE_POOL_PROGRAM_ID]; + return &[ks_program_ids::SPL_SINGLE_POOL_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcSplSinglePoolDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/spl/stake_pool.rs b/ks-lib/src/decoder/spl/stake_pool.rs similarity index 84% rename from kb-lib/src/decoder/spl/stake_pool.rs rename to ks-lib/src/decoder/spl/stake_pool.rs index 08bcc00..11dd405 100644 --- a/kb-lib/src/decoder/spl/stake_pool.rs +++ b/ks-lib/src/decoder/spl/stake_pool.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/stake_pool.rs -// version: 4 +// file: ks-lib/src/decoder/spl/stake_pool.rs +// version: 5 //! Reserved protocol decoder for `spl_stake_pool`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcSplStakePoolDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::SPL_STAKE_POOL_PROGRAM_ID]; + return &[ks_program_ids::SPL_STAKE_POOL_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcSplStakePoolDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/spl/token.rs b/ks-lib/src/decoder/spl/token.rs similarity index 96% rename from kb-lib/src/decoder/spl/token.rs rename to ks-lib/src/decoder/spl/token.rs index ae397ed..fb9e4ee 100644 --- a/kb-lib/src/decoder/spl/token.rs +++ b/ks-lib/src/decoder/spl/token.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/token.rs -// version: 3 +// file: ks-lib/src/decoder/spl/token.rs +// version: 4 //! Exact classic SPL Token decoder component. diff --git a/kb-lib/src/decoder/spl/token/constants.rs b/ks-lib/src/decoder/spl/token/constants.rs similarity index 92% rename from kb-lib/src/decoder/spl/token/constants.rs rename to ks-lib/src/decoder/spl/token/constants.rs index 40b6d62..5b52d6e 100644 --- a/kb-lib/src/decoder/spl/token/constants.rs +++ b/ks-lib/src/decoder/spl/token/constants.rs @@ -1,7 +1,7 @@ -// file: kb-lib/src/decoder/spl/token/constants.rs -// version: 3 +// file: ks-lib/src/decoder/spl/token/constants.rs +// version: 4 -//! Local constants for the `kb-lib` SPL Token component. Program identifiers live in `kb_program_ids`. +//! Local constants for the `ks-lib` SPL Token component. Program identifiers live in `ks_program_ids`. /// Stable protocol and surface code for the classic SPL Token program. pub(crate) const DC_SPL_TOKEN_SURFACE_CODE: &str = "spl.token"; diff --git a/kb-lib/src/decoder/spl/token/decoder.rs b/ks-lib/src/decoder/spl/token/decoder.rs similarity index 95% rename from kb-lib/src/decoder/spl/token/decoder.rs rename to ks-lib/src/decoder/spl/token/decoder.rs index 7686338..30967e9 100644 --- a/kb-lib/src/decoder/spl/token/decoder.rs +++ b/ks-lib/src/decoder/spl/token/decoder.rs @@ -1,15 +1,15 @@ -// file: kb-lib/src/decoder/spl/token/decoder.rs -// version: 4 +// file: ks-lib/src/decoder/spl/token/decoder.rs +// version: 5 //! Exact classic SPL Token dispatch for the common decode pipeline. const TOKEN_SURFACES: &[crate::DcApiDecoderSurface] = &[crate::DcApiDecoderSurface { - program_id: kb_program_ids::SPL_TOKEN_PROGRAM_ID, + program_id: ks_program_ids::SPL_TOKEN_PROGRAM_ID, surface_code: crate::DC_SPL_TOKEN_SURFACE_CODE, priority: 100, }]; -const PROGRAM_IDS: &[&str] = &[kb_program_ids::SPL_TOKEN_PROGRAM_ID]; +const PROGRAM_IDS: &[&str] = &[ks_program_ids::SPL_TOKEN_PROGRAM_ID]; /// Exact decoder for the classic SPL Token program. #[derive(Clone, Debug, Default)] @@ -42,7 +42,7 @@ impl crate::DcApiProtocolDecoder for crate::DcSplTokenDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -64,7 +64,7 @@ impl crate::DcApiInstructionDecoder for crate::DcSplTokenDecoder { .iter() .map(|(tag, code, historical)| { return crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string(), + program_id: ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string(), surface_code: std::option::Option::Some( crate::DC_SPL_TOKEN_SURFACE_CODE.to_string(), ), @@ -81,7 +81,7 @@ impl crate::DcApiInstructionDecoder for crate::DcSplTokenDecoder { &self, input: &crate::MdCoreInstructionReplayInput, ) -> crate::DcApiDecoderRecognition { - if input.program_id != kb_program_ids::SPL_TOKEN_PROGRAM_ID { + if input.program_id != ks_program_ids::SPL_TOKEN_PROGRAM_ID { return crate::DcApiDecoderRecognition::incompatible(); } let tag = crate::decoder_spl_token_payload_tag(input); @@ -99,7 +99,7 @@ impl crate::DcApiInstructionDecoder for crate::DcSplTokenDecoder { &self, input: &crate::MdCoreInstructionReplayInput, ) -> crate::DcApiDecoderExecutionResult { - if input.program_id != kb_program_ids::SPL_TOKEN_PROGRAM_ID { + if input.program_id != ks_program_ids::SPL_TOKEN_PROGRAM_ID { return crate::DcApiDecoderExecutionResult::unsupported(std::option::Option::None); } let result = crate::decoder_spl_token_decode(input); @@ -225,14 +225,14 @@ mod tests { #[test] fn exact_support_program_id_and_interface_match() { - assert_eq!(spl_token_interface::ID.to_string(), kb_program_ids::SPL_TOKEN_PROGRAM_ID); + assert_eq!(spl_token_interface::ID.to_string(), ks_program_ids::SPL_TOKEN_PROGRAM_ID); let decoder = crate::DcSplTokenDecoder; assert_eq!(crate::DcApiInstructionDecoder::surfaces(&decoder).len(), 1); let observation = crate::MdProgramObservation { signature: crate::MdSignature("signature".to_string()), slot: crate::MdSlot(1), instruction_path: crate::MdInstructionPath("0".to_string()), - program_id: crate::MdProgramId(kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), + program_id: crate::MdProgramId(ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), discriminator_8: std::option::Option::None, data_len: 1, accounts_len: 0, @@ -338,7 +338,7 @@ mod tests { let official = spl_token_interface::instruction::TokenInstruction::unpack(&wire); assert!(official.is_ok(), "official unpack rejected tag {tag}"); let input = input( - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -366,7 +366,7 @@ mod tests { {"accountIndex":2,"accountKey":"authority","signer":true,"writable":false,"source":"static"} ]); let input = input( - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, wire.as_slice(), accounts, keys, @@ -392,7 +392,7 @@ mod tests { let mut transfer = minimal_wire(3); transfer.extend_from_slice(&[0xaa, 0xbb]); let suffix = input( - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, transfer.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -405,7 +405,7 @@ mod tests { assert_eq!(suffix_result.observations[0].payload_json["wire"]["suffixLengthBytes"], 2); for wire in [std::vec::Vec::new(), std::vec![3, 1], std::vec![24, 0xff], std::vec![255]] { let input = input( - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -417,7 +417,7 @@ mod tests { assert!(result.observations.is_empty()); } let unknown = input( - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, &[44], serde_json::json!([]), serde_json::json!([]), @@ -435,7 +435,7 @@ mod tests { batch.extend_from_slice(&1_u64.to_le_bytes()); batch.extend_from_slice(&[0, 1, 17]); let cinput = input( - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, batch.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -449,7 +449,7 @@ mod tests { assert_eq!(result.observations[2].event.instruction_path.0, "4/2/batch/1"); assert_eq!(result.observations[0].payload_json["parameters"]["subInstructionCount"], 2); let nested = input( - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, &[255, 0, 1, 255], serde_json::json!([]), serde_json::json!([]), @@ -475,7 +475,7 @@ mod tests { account(2, true, false) ]); let simple = input( - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, wire.as_slice(), simple_accounts.clone(), simple_keys, @@ -495,7 +495,7 @@ mod tests { account(3, true, false) ]); let multisig = input( - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, wire.as_slice(), serde_json::Value::Array(multisig_accounts), multisig_keys, diff --git a/kb-lib/src/decoder/spl/token/wire.rs b/ks-lib/src/decoder/spl/token/wire.rs similarity index 97% rename from kb-lib/src/decoder/spl/token/wire.rs rename to ks-lib/src/decoder/spl/token/wire.rs index 27bbfef..73f1eda 100644 --- a/kb-lib/src/decoder/spl/token/wire.rs +++ b/ks-lib/src/decoder/spl/token/wire.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/token/wire.rs -// version: 1 +// file: ks-lib/src/decoder/spl/token/wire.rs +// version: 2 //! Bounded classic SPL Token wire, account and authority decoding. @@ -148,11 +148,11 @@ pub(crate) fn decoder_spl_token_decode( fn decode_payload( input: &crate::MdCoreInstructionReplayInput, -) -> kb_core::Result> { +) -> ks_core::Result> { let payload = match input.instruction_payload_json.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "classic SPL Token instruction payload is not retained", )); }, @@ -160,7 +160,7 @@ fn decode_payload( let encoded = match payload.get("dataBase64").and_then(serde_json::Value::as_str) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "classic SPL Token payload does not contain dataBase64", )); }, @@ -170,20 +170,20 @@ fn decode_payload( .saturating_div(3) .saturating_add(4); if encoded.len() > maximum_encoded { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "classic SPL Token base64 payload exceeds {maximum_encoded} bytes" ))); } let decoded = match base64::engine::general_purpose::STANDARD.decode(encoded.as_bytes()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "classic SPL Token payload is not valid base64: {error}" ))); }, }; if decoded.len() > crate::DC_SPL_TOKEN_MAX_INSTRUCTION_BYTES { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "classic SPL Token payload exceeds {} decoded bytes", crate::DC_SPL_TOKEN_MAX_INSTRUCTION_BYTES ))); @@ -461,11 +461,11 @@ fn one_parameter(field: &str, value: serde_json::Value) -> serde_json::Value { fn resolve_accounts( input: &crate::MdCoreInstructionReplayInput, -) -> kb_core::Result> { +) -> ks_core::Result> { let instruction_accounts = match input.instruction_accounts_json.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "classic SPL Token instruction accounts must be a JSON array", )); }, @@ -473,7 +473,7 @@ fn resolve_accounts( let account_keys = match input.account_keys_json.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "classic SPL Token transaction account keys must be a JSON array", )); }, @@ -483,7 +483,7 @@ fn resolve_accounts( let account_index = match account.get("accountIndex").and_then(serde_json::Value::as_u64) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "classic SPL Token instruction account {position} has no accountIndex" ))); }, @@ -491,7 +491,7 @@ fn resolve_accounts( let account_key = match account.get("accountKey").and_then(serde_json::Value::as_str) { std::option::Option::Some(value) if !value.trim().is_empty() => value, _ => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "classic SPL Token instruction account {position} has no accountKey" ))); }, @@ -503,7 +503,7 @@ fn resolve_accounts( let resolved = match resolved { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "classic SPL Token account index {account_index} is not resolved" ))); }, @@ -511,14 +511,14 @@ fn resolve_accounts( if resolved.get("accountKey").and_then(serde_json::Value::as_str) != std::option::Option::Some(account_key) { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "classic SPL Token account index {account_index} resolves to a different key" ))); } let signer = match resolved.get("signer").and_then(serde_json::Value::as_bool) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "classic SPL Token account index {account_index} has no signer flag" ))); }, @@ -526,7 +526,7 @@ fn resolve_accounts( let writable = match resolved.get("writable").and_then(serde_json::Value::as_bool) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "classic SPL Token account index {account_index} has no writable flag" ))); }, diff --git a/kb-lib/src/decoder/spl/token_2022.rs b/ks-lib/src/decoder/spl/token_2022.rs similarity index 97% rename from kb-lib/src/decoder/spl/token_2022.rs rename to ks-lib/src/decoder/spl/token_2022.rs index 571f6c4..53a85f4 100644 --- a/kb-lib/src/decoder/spl/token_2022.rs +++ b/ks-lib/src/decoder/spl/token_2022.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/token_2022.rs -// version: 5 +// file: ks-lib/src/decoder/spl/token_2022.rs +// version: 6 //! Exact Token-2022 instruction and state decoder component. diff --git a/kb-lib/src/decoder/spl/token_2022/constants.rs b/ks-lib/src/decoder/spl/token_2022/constants.rs similarity index 96% rename from kb-lib/src/decoder/spl/token_2022/constants.rs rename to ks-lib/src/decoder/spl/token_2022/constants.rs index 5cad341..6b6a8b8 100644 --- a/kb-lib/src/decoder/spl/token_2022/constants.rs +++ b/ks-lib/src/decoder/spl/token_2022/constants.rs @@ -1,7 +1,7 @@ -// file: kb-lib/src/decoder/spl/token_2022/constants.rs -// version: 4 +// file: ks-lib/src/decoder/spl/token_2022/constants.rs +// version: 5 -//! Local constants for the exact Token-2022 decoder. Program identifiers live in `kb_program_ids`. +//! Local constants for the exact Token-2022 decoder. Program identifiers live in `ks_program_ids`. /// Stable Token-2022 surface code. pub(crate) const DC_SPL_TOKEN_2022_SURFACE_CODE: &str = "spl.token_2022"; diff --git a/kb-lib/src/decoder/spl/token_2022/decoder.rs b/ks-lib/src/decoder/spl/token_2022/decoder.rs similarity index 95% rename from kb-lib/src/decoder/spl/token_2022/decoder.rs rename to ks-lib/src/decoder/spl/token_2022/decoder.rs index a4ac65e..c0c2c68 100644 --- a/kb-lib/src/decoder/spl/token_2022/decoder.rs +++ b/ks-lib/src/decoder/spl/token_2022/decoder.rs @@ -1,15 +1,15 @@ -// file: kb-lib/src/decoder/spl/token_2022/decoder.rs -// version: 5 +// file: ks-lib/src/decoder/spl/token_2022/decoder.rs +// version: 6 //! Exact Token-2022 dispatch for the common decode pipeline. const TOKEN_SURFACES: &[crate::DcApiDecoderSurface] = &[crate::DcApiDecoderSurface { - program_id: kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + program_id: ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, surface_code: crate::DC_SPL_TOKEN_2022_SURFACE_CODE, priority: 100, }]; -const PROGRAM_IDS: &[&str] = &[kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID]; +const PROGRAM_IDS: &[&str] = &[ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID]; /// Exact decoder for the Token-2022 program. #[derive(Clone, Debug, Default)] @@ -42,7 +42,7 @@ impl crate::DcApiProtocolDecoder for crate::DcSplToken2022Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -64,7 +64,7 @@ impl crate::DcApiInstructionDecoder for crate::DcSplToken2022Decoder { .iter() .map(|(tag, code, historical)| { return crate::DcApiDecoderCoverageDeclaration { - program_id: kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string(), + program_id: ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string(), surface_code: std::option::Option::Some( crate::DC_SPL_TOKEN_2022_SURFACE_CODE.to_string(), ), @@ -81,7 +81,7 @@ impl crate::DcApiInstructionDecoder for crate::DcSplToken2022Decoder { &self, input: &crate::MdCoreInstructionReplayInput, ) -> crate::DcApiDecoderRecognition { - if input.program_id != kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID { + if input.program_id != ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID { return crate::DcApiDecoderRecognition::incompatible(); } let tag = crate::decoder_spl_token_2022_payload_tag(input); @@ -99,7 +99,7 @@ impl crate::DcApiInstructionDecoder for crate::DcSplToken2022Decoder { &self, input: &crate::MdCoreInstructionReplayInput, ) -> crate::DcApiDecoderExecutionResult { - if input.program_id != kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID { + if input.program_id != ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID { return crate::DcApiDecoderExecutionResult::unsupported(std::option::Option::None); } let result = crate::decoder_spl_token_2022_decode(input); @@ -196,7 +196,7 @@ mod tests { wire.extend_from_slice(&u64::MAX.to_le_bytes()); wire.push(9); let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([ {"position":0,"accountIndex":0,"accountKey":"account0"}, @@ -220,7 +220,7 @@ mod tests { assert!(result.observations[0].observation_committed); assert_eq!( result.observations[0].event.program_id.0, - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID ); assert_eq!( result.observations[0].payload_json["parameters"]["amountRaw"], @@ -234,7 +234,7 @@ mod tests { let mut wire = std::vec![7]; wire.extend_from_slice(&42_u64.to_le_bytes()); let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([ {"position":0,"accountIndex":0,"accountKey":"account0"}, @@ -280,7 +280,7 @@ mod tests { ]; for (wire, expected, expected_rate) in cases { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([{"position":0,"accountIndex":0,"accountKey":"account0"}]), serde_json::json!([account(0, true, true)]), @@ -305,7 +305,7 @@ mod tests { fn interest_bearing_wire_rejects_unknown_truncated_and_suffixed_forms() { for wire in [vec![33], vec![33, 0], vec![33, 1, 0], vec![33, 1, 0, 0, 0], vec![33, 2]] { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -351,7 +351,7 @@ mod tests { }) .collect::>(); let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::Value::Array(instruction_accounts), serde_json::Value::Array(resolved_accounts), @@ -364,7 +364,7 @@ mod tests { assert_eq!(result.recognized_entry_code.as_deref(), Some(expected)); assert_eq!( result.observations[0].event.program_id.0, - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID ); } } @@ -385,7 +385,7 @@ mod tests { ]; for wire in malformed { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -428,7 +428,7 @@ mod tests { update.extend_from_slice(&[11_u8; 32]); for (wire, expected) in [(initialize, initialize_code), (update, update_code)] { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([{"position":0,"accountIndex":0,"accountKey":"account0"}]), serde_json::json!([account(0, true, true)]), @@ -464,7 +464,7 @@ mod tests { }, ] { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -479,7 +479,7 @@ mod tests { #[test] fn classic_token_and_unknown_programs_never_emit_token_2022_events() { - for program_id in [kb_program_ids::SPL_TOKEN_PROGRAM_ID, kb_program_ids::SYSTEM_PROGRAM_ID] + for program_id in [ks_program_ids::SPL_TOKEN_PROGRAM_ID, ks_program_ids::SYSTEM_PROGRAM_ID] { let input = input(program_id, &[17], serde_json::json!([]), serde_json::json!([]), false, "0"); @@ -502,7 +502,7 @@ mod tests { #[test] fn initial_matrix_has_exact_program_boundary_and_candidate_inventory() { let matrix = matrix(); - assert_eq!(matrix["programId"], kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID); + assert_eq!(matrix["programId"], ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID); assert_eq!(matrix["surfaceEquality"]["topLevelInstructionCount"], 48); assert_eq!(matrix["surfaceEquality"]["productionExtensionTypeCount"], 29); assert_eq!(matrix["instructions"].as_array().map(std::vec::Vec::len), Some(48)); @@ -555,11 +555,11 @@ mod tests { let matrix = matrix(); assert_eq!( spl_token_2022_interface::ID.to_string(), - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, ); assert_eq!( spl_elgamal_registry_interface::ID.to_string(), - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, ); assert_eq!(spl_elgamal_registry_interface::REGISTRY_ADDRESS_SEED, b"elgamal-registry",); assert_eq!(matrix["interfaceAudit"]["resolvedVersion"], "3.1.1"); @@ -571,7 +571,7 @@ mod tests { assert_eq!(matrix["elgamalRegistryBoundary"]["resolvedVersion"], "0.2.1"); assert_eq!( matrix["elgamalRegistryBoundary"]["programId"], - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID ); assert_eq!(matrix["elgamalRegistryBoundary"]["sharedDecoder"], false); assert_eq!(matrix["elgamalRegistryBoundary"]["sharedExecutor"], false); @@ -821,7 +821,7 @@ mod tests { ]; for (wire, expected) in cases { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -851,7 +851,7 @@ mod tests { ]; for (wire, expected) in cases { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -879,7 +879,7 @@ mod tests { std::vec![34, 2], ] { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -922,7 +922,7 @@ mod tests { ]; for (wire, expected) in cases { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -961,7 +961,7 @@ mod tests { }, ] { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -1001,7 +1001,7 @@ mod tests { (std::vec![27, 12], "disable_non_confidential_credits"), ] { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -1038,7 +1038,7 @@ mod tests { std::vec![27, 15], ] { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -1080,7 +1080,7 @@ mod tests { (std::vec![27, 14], "configure_confidential_transfer_account_with_registry"), ] { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -1115,7 +1115,7 @@ mod tests { std::vec![27, 14, 0], ] { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -1146,7 +1146,7 @@ mod tests { (std::vec![37, 5], "disable_confidential_harvest_to_mint"), ] { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -1176,7 +1176,7 @@ mod tests { std::vec![37, 6], ] { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -1219,7 +1219,7 @@ mod tests { (permissioned, "permissioned_confidential_burn"), ] { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), @@ -1249,7 +1249,7 @@ mod tests { std::vec![46, 3, 0], ] { let input = input( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, wire.as_slice(), serde_json::json!([]), serde_json::json!([]), diff --git a/kb-lib/src/decoder/spl/token_2022/state.rs b/ks-lib/src/decoder/spl/token_2022/state.rs similarity index 99% rename from kb-lib/src/decoder/spl/token_2022/state.rs rename to ks-lib/src/decoder/spl/token_2022/state.rs index 6eea778..973ec08 100644 --- a/kb-lib/src/decoder/spl/token_2022/state.rs +++ b/ks-lib/src/decoder/spl/token_2022/state.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/token_2022/state.rs -// version: 4 +// file: ks-lib/src/decoder/spl/token_2022/state.rs +// version: 5 //! Strict Token-2022 base-state and TLV parsing. diff --git a/kb-lib/src/decoder/spl/token_2022/wire.rs b/ks-lib/src/decoder/spl/token_2022/wire.rs similarity index 99% rename from kb-lib/src/decoder/spl/token_2022/wire.rs rename to ks-lib/src/decoder/spl/token_2022/wire.rs index 38d1e35..419f55f 100644 --- a/kb-lib/src/decoder/spl/token_2022/wire.rs +++ b/ks-lib/src/decoder/spl/token_2022/wire.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/spl/token_2022/wire.rs -// version: 3 +// file: ks-lib/src/decoder/spl/token_2022/wire.rs +// version: 4 //! Bounded Token-2022 wire, account and authority decoding. @@ -148,11 +148,11 @@ pub(crate) fn decoder_spl_token_2022_decode( fn decode_payload( input: &crate::MdCoreInstructionReplayInput, -) -> kb_core::Result> { +) -> ks_core::Result> { let payload = match input.instruction_payload_json.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Token-2022 instruction payload is not retained", )); }, @@ -160,7 +160,7 @@ fn decode_payload( let encoded = match payload.get("dataBase64").and_then(serde_json::Value::as_str) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Token-2022 payload does not contain dataBase64", )); }, @@ -170,20 +170,20 @@ fn decode_payload( .saturating_div(3) .saturating_add(4); if encoded.len() > maximum_encoded { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Token-2022 base64 payload exceeds {maximum_encoded} bytes" ))); } let decoded = match base64::engine::general_purpose::STANDARD.decode(encoded.as_bytes()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Token-2022 payload is not valid base64: {error}" ))); }, }; if decoded.len() > crate::DC_SPL_TOKEN_2022_MAX_INSTRUCTION_BYTES { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Token-2022 payload exceeds {} decoded bytes", crate::DC_SPL_TOKEN_2022_MAX_INSTRUCTION_BYTES ))); @@ -1965,11 +1965,11 @@ fn one_parameter(field: &str, value: serde_json::Value) -> serde_json::Value { fn resolve_accounts( input: &crate::MdCoreInstructionReplayInput, -) -> kb_core::Result> { +) -> ks_core::Result> { let instruction_accounts = match input.instruction_accounts_json.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Token-2022 instruction accounts must be a JSON array", )); }, @@ -1977,7 +1977,7 @@ fn resolve_accounts( let account_keys = match input.account_keys_json.as_array() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Token-2022 transaction account keys must be a JSON array", )); }, @@ -1987,7 +1987,7 @@ fn resolve_accounts( let account_index = match account.get("accountIndex").and_then(serde_json::Value::as_u64) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Token-2022 instruction account {position} has no accountIndex" ))); }, @@ -1995,7 +1995,7 @@ fn resolve_accounts( let account_key = match account.get("accountKey").and_then(serde_json::Value::as_str) { std::option::Option::Some(value) if !value.trim().is_empty() => value, _ => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Token-2022 instruction account {position} has no accountKey" ))); }, @@ -2007,7 +2007,7 @@ fn resolve_accounts( let resolved = match resolved { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Token-2022 account index {account_index} is not resolved" ))); }, @@ -2015,14 +2015,14 @@ fn resolve_accounts( if resolved.get("accountKey").and_then(serde_json::Value::as_str) != std::option::Option::Some(account_key) { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Token-2022 account index {account_index} resolves to a different key" ))); } let signer = match resolved.get("signer").and_then(serde_json::Value::as_bool) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Token-2022 account index {account_index} has no signer flag" ))); }, @@ -2030,7 +2030,7 @@ fn resolve_accounts( let writable = match resolved.get("writable").and_then(serde_json::Value::as_bool) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "Token-2022 account index {account_index} has no writable flag" ))); }, diff --git a/kb-lib/src/decoder/stable.rs b/ks-lib/src/decoder/stable.rs similarity index 92% rename from kb-lib/src/decoder/stable.rs rename to ks-lib/src/decoder/stable.rs index 8d8a55a..2773d7a 100644 --- a/kb-lib/src/decoder/stable.rs +++ b/ks-lib/src/decoder/stable.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/stable.rs -// version: 4 +// file: ks-lib/src/decoder/stable.rs +// version: 5 //! `stable` decoder family. diff --git a/kb-lib/src/decoder/stable/swap_hylo_exchange.rs b/ks-lib/src/decoder/stable/swap_hylo_exchange.rs similarity index 84% rename from kb-lib/src/decoder/stable/swap_hylo_exchange.rs rename to ks-lib/src/decoder/stable/swap_hylo_exchange.rs index b4af389..a61a223 100644 --- a/kb-lib/src/decoder/stable/swap_hylo_exchange.rs +++ b/ks-lib/src/decoder/stable/swap_hylo_exchange.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/stable/swap_hylo_exchange.rs -// version: 4 +// file: ks-lib/src/decoder/stable/swap_hylo_exchange.rs +// version: 5 //! Reserved protocol decoder for `stable_swap_hylo_exchange`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStableSwapHyloExchangeDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STABLE_SWAP_HYLO_EXCHANGE_PROGRAM_ID]; + return &[ks_program_ids::STABLE_SWAP_HYLO_EXCHANGE_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStableSwapHyloExchangeDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/stable/swap_jupiter_stable.rs b/ks-lib/src/decoder/stable/swap_jupiter_stable.rs similarity index 84% rename from kb-lib/src/decoder/stable/swap_jupiter_stable.rs rename to ks-lib/src/decoder/stable/swap_jupiter_stable.rs index efb35ea..96c2ee4 100644 --- a/kb-lib/src/decoder/stable/swap_jupiter_stable.rs +++ b/ks-lib/src/decoder/stable/swap_jupiter_stable.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/stable/swap_jupiter_stable.rs -// version: 4 +// file: ks-lib/src/decoder/stable/swap_jupiter_stable.rs +// version: 5 //! Reserved protocol decoder for `stable_swap_jupiter_stable`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStableSwapJupiterStableDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STABLE_SWAP_JUPITER_STABLE_PROGRAM_ID]; + return &[ks_program_ids::STABLE_SWAP_JUPITER_STABLE_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStableSwapJupiterStableDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/stable/swap_numeraire.rs b/ks-lib/src/decoder/stable/swap_numeraire.rs similarity index 84% rename from kb-lib/src/decoder/stable/swap_numeraire.rs rename to ks-lib/src/decoder/stable/swap_numeraire.rs index 8f8acc5..e8c72a7 100644 --- a/kb-lib/src/decoder/stable/swap_numeraire.rs +++ b/ks-lib/src/decoder/stable/swap_numeraire.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/stable/swap_numeraire.rs -// version: 4 +// file: ks-lib/src/decoder/stable/swap_numeraire.rs +// version: 5 //! Reserved protocol decoder for `stable_swap_numeraire`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStableSwapNumeraireDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STABLE_SWAP_NUMERAIRE_PROGRAM_ID]; + return &[ks_program_ids::STABLE_SWAP_NUMERAIRE_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStableSwapNumeraireDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/stable/swap_stabble.rs b/ks-lib/src/decoder/stable/swap_stabble.rs similarity index 84% rename from kb-lib/src/decoder/stable/swap_stabble.rs rename to ks-lib/src/decoder/stable/swap_stabble.rs index 69f871b..eeeb882 100644 --- a/kb-lib/src/decoder/stable/swap_stabble.rs +++ b/ks-lib/src/decoder/stable/swap_stabble.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/stable/swap_stabble.rs -// version: 4 +// file: ks-lib/src/decoder/stable/swap_stabble.rs +// version: 5 //! Reserved protocol decoder for `stable_swap_stabble`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStableSwapStabbleDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STABLE_SWAP_STABBLE_PROGRAM_ID]; + return &[ks_program_ids::STABLE_SWAP_STABBLE_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStableSwapStabbleDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/staking.rs b/ks-lib/src/decoder/staking.rs similarity index 91% rename from kb-lib/src/decoder/staking.rs rename to ks-lib/src/decoder/staking.rs index 0566dbf..4567088 100644 --- a/kb-lib/src/decoder/staking.rs +++ b/ks-lib/src/decoder/staking.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/staking.rs -// version: 5 +// file: ks-lib/src/decoder/staking.rs +// version: 6 //! `staking` decoder family. diff --git a/kb-lib/src/decoder/staking/jito_tip_distribution.rs b/ks-lib/src/decoder/staking/jito_tip_distribution.rs similarity index 84% rename from kb-lib/src/decoder/staking/jito_tip_distribution.rs rename to ks-lib/src/decoder/staking/jito_tip_distribution.rs index 53aa6bd..b941e5c 100644 --- a/kb-lib/src/decoder/staking/jito_tip_distribution.rs +++ b/ks-lib/src/decoder/staking/jito_tip_distribution.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/staking/jito_tip_distribution.rs -// version: 1 +// file: ks-lib/src/decoder/staking/jito_tip_distribution.rs +// version: 2 //! Reserved protocol decoder for `staking_jito_tip_distribution`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStakingJitoTipDistributionDecoder } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STAKING_JITO_TIP_DISTRIBUTION_PROGRAM_ID]; + return &[ks_program_ids::STAKING_JITO_TIP_DISTRIBUTION_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStakingJitoTipDistributionDecoder fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/staking/kamino_farm.rs b/ks-lib/src/decoder/staking/kamino_farm.rs similarity index 84% rename from kb-lib/src/decoder/staking/kamino_farm.rs rename to ks-lib/src/decoder/staking/kamino_farm.rs index a20ec37..d07c22a 100644 --- a/kb-lib/src/decoder/staking/kamino_farm.rs +++ b/ks-lib/src/decoder/staking/kamino_farm.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/staking/kamino_farm.rs -// version: 4 +// file: ks-lib/src/decoder/staking/kamino_farm.rs +// version: 5 //! Reserved protocol decoder for `staking_kamino_farm`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStakingKaminoFarmDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STAKING_KAMINO_FARM_PROGRAM_ID]; + return &[ks_program_ids::STAKING_KAMINO_FARM_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStakingKaminoFarmDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/staking/marinade_finance.rs b/ks-lib/src/decoder/staking/marinade_finance.rs similarity index 84% rename from kb-lib/src/decoder/staking/marinade_finance.rs rename to ks-lib/src/decoder/staking/marinade_finance.rs index 25ef3e9..9fdf182 100644 --- a/kb-lib/src/decoder/staking/marinade_finance.rs +++ b/ks-lib/src/decoder/staking/marinade_finance.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/staking/marinade_finance.rs -// version: 4 +// file: ks-lib/src/decoder/staking/marinade_finance.rs +// version: 5 //! Reserved protocol decoder for `staking_marinade_finance`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStakingMarinadeFinanceDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STAKING_MARINADE_FINANCE_PROGRAM_ID]; + return &[ks_program_ids::STAKING_MARINADE_FINANCE_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStakingMarinadeFinanceDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/staking/solayer.rs b/ks-lib/src/decoder/staking/solayer.rs similarity index 84% rename from kb-lib/src/decoder/staking/solayer.rs rename to ks-lib/src/decoder/staking/solayer.rs index 9e56b5e..8768203 100644 --- a/kb-lib/src/decoder/staking/solayer.rs +++ b/ks-lib/src/decoder/staking/solayer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/staking/solayer.rs -// version: 4 +// file: ks-lib/src/decoder/staking/solayer.rs +// version: 5 //! Reserved protocol decoder for `staking_solayer`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStakingSolayerDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STAKING_SOLAYER_PROGRAM_ID]; + return &[ks_program_ids::STAKING_SOLAYER_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStakingSolayerDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/storage.rs b/ks-lib/src/decoder/storage.rs similarity index 76% rename from kb-lib/src/decoder/storage.rs rename to ks-lib/src/decoder/storage.rs index 603560f..95f1ff5 100644 --- a/kb-lib/src/decoder/storage.rs +++ b/ks-lib/src/decoder/storage.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/storage.rs -// version: 5 +// file: ks-lib/src/decoder/storage.rs +// version: 6 //! `storage` decoder family. diff --git a/kb-lib/src/decoder/storage/solana_record.rs b/ks-lib/src/decoder/storage/solana_record.rs similarity index 84% rename from kb-lib/src/decoder/storage/solana_record.rs rename to ks-lib/src/decoder/storage/solana_record.rs index f6a1dad..4232920 100644 --- a/kb-lib/src/decoder/storage/solana_record.rs +++ b/ks-lib/src/decoder/storage/solana_record.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/storage/solana_record.rs -// version: 1 +// file: ks-lib/src/decoder/storage/solana_record.rs +// version: 2 //! Reserved protocol decoder for `storage_solana_record`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStorageSolanaRecordDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STORAGE_SOLANA_RECORD_PROGRAM_ID]; + return &[ks_program_ids::STORAGE_SOLANA_RECORD_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStorageSolanaRecordDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/strategy.rs b/ks-lib/src/decoder/strategy.rs similarity index 75% rename from kb-lib/src/decoder/strategy.rs rename to ks-lib/src/decoder/strategy.rs index bb4f09c..c672396 100644 --- a/kb-lib/src/decoder/strategy.rs +++ b/ks-lib/src/decoder/strategy.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/strategy.rs -// version: 5 +// file: ks-lib/src/decoder/strategy.rs +// version: 6 //! `strategy` decoder family. diff --git a/kb-lib/src/decoder/strategy/jupiter_dca.rs b/ks-lib/src/decoder/strategy/jupiter_dca.rs similarity index 84% rename from kb-lib/src/decoder/strategy/jupiter_dca.rs rename to ks-lib/src/decoder/strategy/jupiter_dca.rs index 8badd64..dad8960 100644 --- a/kb-lib/src/decoder/strategy/jupiter_dca.rs +++ b/ks-lib/src/decoder/strategy/jupiter_dca.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/strategy/jupiter_dca.rs -// version: 4 +// file: ks-lib/src/decoder/strategy/jupiter_dca.rs +// version: 5 //! Reserved protocol decoder for `strategy_jupiter_dca`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStrategyJupiterDcaDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STRATEGY_JUPITER_DCA_PROGRAM_ID]; + return &[ks_program_ids::STRATEGY_JUPITER_DCA_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcStrategyJupiterDcaDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/treasury.rs b/ks-lib/src/decoder/treasury.rs similarity index 80% rename from kb-lib/src/decoder/treasury.rs rename to ks-lib/src/decoder/treasury.rs index 94f8672..5b4b4c4 100644 --- a/kb-lib/src/decoder/treasury.rs +++ b/ks-lib/src/decoder/treasury.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/treasury.rs -// version: 4 +// file: ks-lib/src/decoder/treasury.rs +// version: 5 //! `treasury` decoder family. diff --git a/kb-lib/src/decoder/treasury/helium_treasury_management.rs b/ks-lib/src/decoder/treasury/helium_treasury_management.rs similarity index 84% rename from kb-lib/src/decoder/treasury/helium_treasury_management.rs rename to ks-lib/src/decoder/treasury/helium_treasury_management.rs index d9c0d8d..2d44b32 100644 --- a/kb-lib/src/decoder/treasury/helium_treasury_management.rs +++ b/ks-lib/src/decoder/treasury/helium_treasury_management.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/treasury/helium_treasury_management.rs -// version: 4 +// file: ks-lib/src/decoder/treasury/helium_treasury_management.rs +// version: 5 //! Reserved protocol decoder for `treasury_helium_treasury_management`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcTreasuryHeliumTreasuryManagementDe } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::TREASURY_HELIUM_TREASURY_MANAGEMENT_PROGRAM_ID]; + return &[ks_program_ids::TREASURY_HELIUM_TREASURY_MANAGEMENT_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcTreasuryHeliumTreasuryManagementDe fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/vault.rs b/ks-lib/src/decoder/vault.rs similarity index 93% rename from kb-lib/src/decoder/vault.rs rename to ks-lib/src/decoder/vault.rs index 5b83924..929b0bf 100644 --- a/kb-lib/src/decoder/vault.rs +++ b/ks-lib/src/decoder/vault.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/vault.rs -// version: 4 +// file: ks-lib/src/decoder/vault.rs +// version: 5 //! `vault` decoder family. diff --git a/kb-lib/src/decoder/vault/carrot_defi.rs b/ks-lib/src/decoder/vault/carrot_defi.rs similarity index 84% rename from kb-lib/src/decoder/vault/carrot_defi.rs rename to ks-lib/src/decoder/vault/carrot_defi.rs index e0cc3d2..a3426cb 100644 --- a/kb-lib/src/decoder/vault/carrot_defi.rs +++ b/ks-lib/src/decoder/vault/carrot_defi.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/vault/carrot_defi.rs -// version: 4 +// file: ks-lib/src/decoder/vault/carrot_defi.rs +// version: 5 //! Reserved protocol decoder for `vault_carrot_defi`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcVaultCarrotDefiDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::VAULT_CARROT_DEFI_PROGRAM_ID]; + return &[ks_program_ids::VAULT_CARROT_DEFI_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcVaultCarrotDefiDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/vault/hylo_stability_pool.rs b/ks-lib/src/decoder/vault/hylo_stability_pool.rs similarity index 84% rename from kb-lib/src/decoder/vault/hylo_stability_pool.rs rename to ks-lib/src/decoder/vault/hylo_stability_pool.rs index b53de0d..31ec487 100644 --- a/kb-lib/src/decoder/vault/hylo_stability_pool.rs +++ b/ks-lib/src/decoder/vault/hylo_stability_pool.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/vault/hylo_stability_pool.rs -// version: 4 +// file: ks-lib/src/decoder/vault/hylo_stability_pool.rs +// version: 5 //! Reserved protocol decoder for `vault_hylo_stability_pool`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcVaultHyloStabilityPoolDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::VAULT_HYLO_STABILITY_POOL_PROGRAM_ID]; + return &[ks_program_ids::VAULT_HYLO_STABILITY_POOL_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcVaultHyloStabilityPoolDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/vault/kamino.rs b/ks-lib/src/decoder/vault/kamino.rs similarity index 84% rename from kb-lib/src/decoder/vault/kamino.rs rename to ks-lib/src/decoder/vault/kamino.rs index f4aa97a..b8d436a 100644 --- a/kb-lib/src/decoder/vault/kamino.rs +++ b/ks-lib/src/decoder/vault/kamino.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/vault/kamino.rs -// version: 4 +// file: ks-lib/src/decoder/vault/kamino.rs +// version: 5 //! Reserved protocol decoder for `vault_kamino`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcVaultKaminoDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::VAULT_KAMINO_PROGRAM_ID]; + return &[ks_program_ids::VAULT_KAMINO_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcVaultKaminoDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/vault/kamino_v2.rs b/ks-lib/src/decoder/vault/kamino_v2.rs similarity index 84% rename from kb-lib/src/decoder/vault/kamino_v2.rs rename to ks-lib/src/decoder/vault/kamino_v2.rs index 19abce3..771b35e 100644 --- a/kb-lib/src/decoder/vault/kamino_v2.rs +++ b/ks-lib/src/decoder/vault/kamino_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/vault/kamino_v2.rs -// version: 4 +// file: ks-lib/src/decoder/vault/kamino_v2.rs +// version: 5 //! Reserved protocol decoder for `vault_kamino_v2`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcVaultKaminoV2Decoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::VAULT_KAMINO_V2_PROGRAM_ID]; + return &[ks_program_ids::VAULT_KAMINO_V2_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcVaultKaminoV2Decoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/vault/kamino_yvaults.rs b/ks-lib/src/decoder/vault/kamino_yvaults.rs similarity index 84% rename from kb-lib/src/decoder/vault/kamino_yvaults.rs rename to ks-lib/src/decoder/vault/kamino_yvaults.rs index b40c7ec..e204e7c 100644 --- a/kb-lib/src/decoder/vault/kamino_yvaults.rs +++ b/ks-lib/src/decoder/vault/kamino_yvaults.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/vault/kamino_yvaults.rs -// version: 4 +// file: ks-lib/src/decoder/vault/kamino_yvaults.rs +// version: 5 //! Reserved protocol decoder for `vault_kamino_yvaults`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcVaultKaminoYvaultsDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::VAULT_KAMINO_YVAULTS_PROGRAM_ID]; + return &[ks_program_ids::VAULT_KAMINO_YVAULTS_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcVaultKaminoYvaultsDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/vault/meteora.rs b/ks-lib/src/decoder/vault/meteora.rs similarity index 84% rename from kb-lib/src/decoder/vault/meteora.rs rename to ks-lib/src/decoder/vault/meteora.rs index 628a992..7856895 100644 --- a/kb-lib/src/decoder/vault/meteora.rs +++ b/ks-lib/src/decoder/vault/meteora.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/vault/meteora.rs -// version: 4 +// file: ks-lib/src/decoder/vault/meteora.rs +// version: 5 //! Reserved protocol decoder for `vault_meteora`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcVaultMeteoraDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::VAULT_METEORA_PROGRAM_ID]; + return &[ks_program_ids::VAULT_METEORA_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcVaultMeteoraDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/vesting.rs b/ks-lib/src/decoder/vesting.rs similarity index 84% rename from kb-lib/src/decoder/vesting.rs rename to ks-lib/src/decoder/vesting.rs index c7cc698..b3b5e66 100644 --- a/kb-lib/src/decoder/vesting.rs +++ b/ks-lib/src/decoder/vesting.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/vesting.rs -// version: 5 +// file: ks-lib/src/decoder/vesting.rs +// version: 6 //! `vesting` decoder family. diff --git a/kb-lib/src/decoder/vesting/jupiter_lock.rs b/ks-lib/src/decoder/vesting/jupiter_lock.rs similarity index 84% rename from kb-lib/src/decoder/vesting/jupiter_lock.rs rename to ks-lib/src/decoder/vesting/jupiter_lock.rs index 46da3dd..fd1ae88 100644 --- a/kb-lib/src/decoder/vesting/jupiter_lock.rs +++ b/ks-lib/src/decoder/vesting/jupiter_lock.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/vesting/jupiter_lock.rs -// version: 4 +// file: ks-lib/src/decoder/vesting/jupiter_lock.rs +// version: 5 //! Reserved protocol decoder for `vesting_jupiter_lock`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcVestingJupiterLockDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::VESTING_JUPITER_LOCK_PROGRAM_ID]; + return &[ks_program_ids::VESTING_JUPITER_LOCK_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcVestingJupiterLockDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/vesting/streamflow.rs b/ks-lib/src/decoder/vesting/streamflow.rs similarity index 84% rename from kb-lib/src/decoder/vesting/streamflow.rs rename to ks-lib/src/decoder/vesting/streamflow.rs index 7c85e31..4e27ec1 100644 --- a/kb-lib/src/decoder/vesting/streamflow.rs +++ b/ks-lib/src/decoder/vesting/streamflow.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/vesting/streamflow.rs -// version: 4 +// file: ks-lib/src/decoder/vesting/streamflow.rs +// version: 5 //! Reserved protocol decoder for `vesting_streamflow`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcVestingStreamflowDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::VESTING_STREAMFLOW_PROGRAM_ID]; + return &[ks_program_ids::VESTING_STREAMFLOW_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcVestingStreamflowDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/wallet.rs b/ks-lib/src/decoder/wallet.rs similarity index 81% rename from kb-lib/src/decoder/wallet.rs rename to ks-lib/src/decoder/wallet.rs index e3a7d91..3531d2e 100644 --- a/kb-lib/src/decoder/wallet.rs +++ b/ks-lib/src/decoder/wallet.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/wallet.rs -// version: 4 +// file: ks-lib/src/decoder/wallet.rs +// version: 5 //! `wallet` decoder family. diff --git a/kb-lib/src/decoder/wallet/jupiter_apepro_smart_wallet.rs b/ks-lib/src/decoder/wallet/jupiter_apepro_smart_wallet.rs similarity index 84% rename from kb-lib/src/decoder/wallet/jupiter_apepro_smart_wallet.rs rename to ks-lib/src/decoder/wallet/jupiter_apepro_smart_wallet.rs index 3dcbe82..1f776e1 100644 --- a/kb-lib/src/decoder/wallet/jupiter_apepro_smart_wallet.rs +++ b/ks-lib/src/decoder/wallet/jupiter_apepro_smart_wallet.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/wallet/jupiter_apepro_smart_wallet.rs -// version: 4 +// file: ks-lib/src/decoder/wallet/jupiter_apepro_smart_wallet.rs +// version: 5 //! Reserved protocol decoder for `wallet_jupiter_apepro_smart_wallet`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcWalletJupiterApeproSmartWalletDeco } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::WALLET_JUPITER_APEPRO_SMART_WALLET_PROGRAM_ID]; + return &[ks_program_ids::WALLET_JUPITER_APEPRO_SMART_WALLET_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcWalletJupiterApeproSmartWalletDeco fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/decoder/weighted.rs b/ks-lib/src/decoder/weighted.rs similarity index 76% rename from kb-lib/src/decoder/weighted.rs rename to ks-lib/src/decoder/weighted.rs index d99afde..c619c44 100644 --- a/kb-lib/src/decoder/weighted.rs +++ b/ks-lib/src/decoder/weighted.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/weighted.rs -// version: 4 +// file: ks-lib/src/decoder/weighted.rs +// version: 5 //! `weighted` decoder family. diff --git a/kb-lib/src/decoder/weighted/swap_stabble.rs b/ks-lib/src/decoder/weighted/swap_stabble.rs similarity index 84% rename from kb-lib/src/decoder/weighted/swap_stabble.rs rename to ks-lib/src/decoder/weighted/swap_stabble.rs index 79d418d..1650a30 100644 --- a/kb-lib/src/decoder/weighted/swap_stabble.rs +++ b/ks-lib/src/decoder/weighted/swap_stabble.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/decoder/weighted/swap_stabble.rs -// version: 4 +// file: ks-lib/src/decoder/weighted/swap_stabble.rs +// version: 5 //! Reserved protocol decoder for `weighted_swap_stabble`. @@ -17,7 +17,7 @@ impl crate::DcApiProtocolDecoder for crate::DcWeightedSwapStabbleDecoder { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::WEIGHTED_SWAP_STABBLE_PROGRAM_ID]; + return &[ks_program_ids::WEIGHTED_SWAP_STABBLE_PROGRAM_ID]; } fn supports_observation( @@ -33,7 +33,7 @@ impl crate::DcApiProtocolDecoder for crate::DcWeightedSwapStabbleDecoder { fn decode_observation( &self, _observation: &crate::MdProgramObservation, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/executor.rs b/ks-lib/src/executor.rs similarity index 99% rename from kb-lib/src/executor.rs rename to ks-lib/src/executor.rs index e9a8a15..69f5ec4 100644 --- a/kb-lib/src/executor.rs +++ b/ks-lib/src/executor.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor.rs -// version: 17 +// file: ks-lib/src/executor.rs +// version: 18 //! Consolidated executor modules. @@ -1243,7 +1243,7 @@ mod reserved_executor_tests { for executor in executors { assert!(!executor.program_ids().is_empty()); for program_id in executor.program_ids() { - assert!(kb_program_ids::find_registered_program_id(program_id).is_some()); + assert!(ks_program_ids::find_registered_program_id(program_id).is_some()); } let program_id = crate::MdProgramId(executor.program_ids()[0].to_string()); let request = crate::ExApiExecutionRequest { diff --git a/kb-lib/src/executor/adapter.rs b/ks-lib/src/executor/adapter.rs similarity index 86% rename from kb-lib/src/executor/adapter.rs rename to ks-lib/src/executor/adapter.rs index 7f24b5a..f8a57f9 100644 --- a/kb-lib/src/executor/adapter.rs +++ b/ks-lib/src/executor/adapter.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/adapter.rs -// version: 3 +// file: ks-lib/src/executor/adapter.rs +// version: 4 //! `adapter` executor family. diff --git a/kb-lib/src/executor/adapter/saber_decimal_wrapper.rs b/ks-lib/src/executor/adapter/saber_decimal_wrapper.rs similarity index 89% rename from kb-lib/src/executor/adapter/saber_decimal_wrapper.rs rename to ks-lib/src/executor/adapter/saber_decimal_wrapper.rs index 8bb9115..b39b4b5 100644 --- a/kb-lib/src/executor/adapter/saber_decimal_wrapper.rs +++ b/ks-lib/src/executor/adapter/saber_decimal_wrapper.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/adapter/saber_decimal_wrapper.rs -// version: 3 +// file: ks-lib/src/executor/adapter/saber_decimal_wrapper.rs +// version: 4 //! Reserved executor for `adapter_saber_decimal_wrapper`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAdapterSaberDecimalWrapperExec } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ADAPTER_SABER_DECIMAL_WRAPPER_PROGRAM_ID]; + return &[ks_program_ids::ADAPTER_SABER_DECIMAL_WRAPPER_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAdapterSaberDecimalWrapperExec fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"adapter_saber_decimal_wrapper"}), ) { diff --git a/kb-lib/src/executor/adapter/spl_token_wrap.rs b/ks-lib/src/executor/adapter/spl_token_wrap.rs similarity index 89% rename from kb-lib/src/executor/adapter/spl_token_wrap.rs rename to ks-lib/src/executor/adapter/spl_token_wrap.rs index b42ef0b..195bb68 100644 --- a/kb-lib/src/executor/adapter/spl_token_wrap.rs +++ b/ks-lib/src/executor/adapter/spl_token_wrap.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/adapter/spl_token_wrap.rs -// version: 1 +// file: ks-lib/src/executor/adapter/spl_token_wrap.rs +// version: 2 //! Reserved executor for `adapter_spl_token_wrap`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAdapterSplTokenWrapExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ADAPTER_SPL_TOKEN_WRAP_PROGRAM_ID]; + return &[ks_program_ids::ADAPTER_SPL_TOKEN_WRAP_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAdapterSplTokenWrapExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"adapter_spl_token_wrap"}), ) { diff --git a/kb-lib/src/executor/amm.rs b/ks-lib/src/executor/amm.rs similarity index 98% rename from kb-lib/src/executor/amm.rs rename to ks-lib/src/executor/amm.rs index 8234a8d..3a65975 100644 --- a/kb-lib/src/executor/amm.rs +++ b/ks-lib/src/executor/amm.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm.rs -// version: 3 +// file: ks-lib/src/executor/amm.rs +// version: 4 //! `amm` executor family. diff --git a/kb-lib/src/executor/amm/aldrin_v1.rs b/ks-lib/src/executor/amm/aldrin_v1.rs similarity index 89% rename from kb-lib/src/executor/amm/aldrin_v1.rs rename to ks-lib/src/executor/amm/aldrin_v1.rs index f2b8711..7694217 100644 --- a/kb-lib/src/executor/amm/aldrin_v1.rs +++ b/ks-lib/src/executor/amm/aldrin_v1.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/aldrin_v1.rs -// version: 3 +// file: ks-lib/src/executor/amm/aldrin_v1.rs +// version: 4 //! Reserved executor for `amm_aldrin_v1`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmAldrinV1Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_ALDRIN_V1_PROGRAM_ID]; + return &[ks_program_ids::AMM_ALDRIN_V1_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmAldrinV1Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_aldrin_v1"}), ) { diff --git a/kb-lib/src/executor/amm/aldrin_v2.rs b/ks-lib/src/executor/amm/aldrin_v2.rs similarity index 89% rename from kb-lib/src/executor/amm/aldrin_v2.rs rename to ks-lib/src/executor/amm/aldrin_v2.rs index 38651fd..c64459c 100644 --- a/kb-lib/src/executor/amm/aldrin_v2.rs +++ b/ks-lib/src/executor/amm/aldrin_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/aldrin_v2.rs -// version: 3 +// file: ks-lib/src/executor/amm/aldrin_v2.rs +// version: 4 //! Reserved executor for `amm_aldrin_v2`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmAldrinV2Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_ALDRIN_V2_PROGRAM_ID]; + return &[ks_program_ids::AMM_ALDRIN_V2_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmAldrinV2Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_aldrin_v2"}), ) { diff --git a/kb-lib/src/executor/amm/alphaq.rs b/ks-lib/src/executor/amm/alphaq.rs similarity index 89% rename from kb-lib/src/executor/amm/alphaq.rs rename to ks-lib/src/executor/amm/alphaq.rs index 7424319..b01779e 100644 --- a/kb-lib/src/executor/amm/alphaq.rs +++ b/ks-lib/src/executor/amm/alphaq.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/alphaq.rs -// version: 3 +// file: ks-lib/src/executor/amm/alphaq.rs +// version: 4 //! Reserved executor for `amm_alphaq`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmAlphaqExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_ALPHAQ_PROGRAM_ID]; + return &[ks_program_ids::AMM_ALPHAQ_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmAlphaqExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_alphaq"}), ) { diff --git a/kb-lib/src/executor/amm/believe.rs b/ks-lib/src/executor/amm/believe.rs similarity index 89% rename from kb-lib/src/executor/amm/believe.rs rename to ks-lib/src/executor/amm/believe.rs index a140c48..f6ace09 100644 --- a/kb-lib/src/executor/amm/believe.rs +++ b/ks-lib/src/executor/amm/believe.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/believe.rs -// version: 3 +// file: ks-lib/src/executor/amm/believe.rs +// version: 4 //! Reserved executor for `amm_believe`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmBelieveExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_BELIEVE_PROGRAM_ID]; + return &[ks_program_ids::AMM_BELIEVE_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmBelieveExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_believe"}), ) { diff --git a/kb-lib/src/executor/amm/bonk_swap.rs b/ks-lib/src/executor/amm/bonk_swap.rs similarity index 89% rename from kb-lib/src/executor/amm/bonk_swap.rs rename to ks-lib/src/executor/amm/bonk_swap.rs index 3f780d2..df6ddbd 100644 --- a/kb-lib/src/executor/amm/bonk_swap.rs +++ b/ks-lib/src/executor/amm/bonk_swap.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/bonk_swap.rs -// version: 3 +// file: ks-lib/src/executor/amm/bonk_swap.rs +// version: 4 //! Reserved executor for `amm_bonk_swap`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmBonkSwapExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_BONK_SWAP_PROGRAM_ID]; + return &[ks_program_ids::AMM_BONK_SWAP_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmBonkSwapExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_bonk_swap"}), ) { diff --git a/kb-lib/src/executor/amm/fluxbeam.rs b/ks-lib/src/executor/amm/fluxbeam.rs similarity index 89% rename from kb-lib/src/executor/amm/fluxbeam.rs rename to ks-lib/src/executor/amm/fluxbeam.rs index f179574..ea5c320 100644 --- a/kb-lib/src/executor/amm/fluxbeam.rs +++ b/ks-lib/src/executor/amm/fluxbeam.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/fluxbeam.rs -// version: 3 +// file: ks-lib/src/executor/amm/fluxbeam.rs +// version: 4 //! Reserved executor for `amm_fluxbeam`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmFluxbeamExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_FLUXBEAM_PROGRAM_ID]; + return &[ks_program_ids::AMM_FLUXBEAM_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmFluxbeamExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_fluxbeam"}), ) { diff --git a/kb-lib/src/executor/amm/goon_fi.rs b/ks-lib/src/executor/amm/goon_fi.rs similarity index 89% rename from kb-lib/src/executor/amm/goon_fi.rs rename to ks-lib/src/executor/amm/goon_fi.rs index 4473a66..fde71c2 100644 --- a/kb-lib/src/executor/amm/goon_fi.rs +++ b/ks-lib/src/executor/amm/goon_fi.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/goon_fi.rs -// version: 3 +// file: ks-lib/src/executor/amm/goon_fi.rs +// version: 4 //! Reserved executor for `amm_goon_fi`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmGoonFiExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_GOON_FI_PROGRAM_ID]; + return &[ks_program_ids::AMM_GOON_FI_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmGoonFiExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_goon_fi"}), ) { diff --git a/kb-lib/src/executor/amm/goosefx_gamma.rs b/ks-lib/src/executor/amm/goosefx_gamma.rs similarity index 89% rename from kb-lib/src/executor/amm/goosefx_gamma.rs rename to ks-lib/src/executor/amm/goosefx_gamma.rs index 343abd1..15a5a73 100644 --- a/kb-lib/src/executor/amm/goosefx_gamma.rs +++ b/ks-lib/src/executor/amm/goosefx_gamma.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/goosefx_gamma.rs -// version: 3 +// file: ks-lib/src/executor/amm/goosefx_gamma.rs +// version: 4 //! Reserved executor for `amm_goosefx_gamma`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmGoosefxGammaExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_GOOSEFX_GAMMA_PROGRAM_ID]; + return &[ks_program_ids::AMM_GOOSEFX_GAMMA_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmGoosefxGammaExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_goosefx_gamma"}), ) { diff --git a/kb-lib/src/executor/amm/goosefx_v2.rs b/ks-lib/src/executor/amm/goosefx_v2.rs similarity index 89% rename from kb-lib/src/executor/amm/goosefx_v2.rs rename to ks-lib/src/executor/amm/goosefx_v2.rs index 09bdda9..7b2e139 100644 --- a/kb-lib/src/executor/amm/goosefx_v2.rs +++ b/ks-lib/src/executor/amm/goosefx_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/goosefx_v2.rs -// version: 3 +// file: ks-lib/src/executor/amm/goosefx_v2.rs +// version: 4 //! Reserved executor for `amm_goosefx_v2`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmGoosefxV2Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_GOOSEFX_V2_PROGRAM_ID]; + return &[ks_program_ids::AMM_GOOSEFX_V2_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmGoosefxV2Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_goosefx_v2"}), ) { diff --git a/kb-lib/src/executor/amm/guac_swap.rs b/ks-lib/src/executor/amm/guac_swap.rs similarity index 89% rename from kb-lib/src/executor/amm/guac_swap.rs rename to ks-lib/src/executor/amm/guac_swap.rs index 6214974..9b4b94b 100644 --- a/kb-lib/src/executor/amm/guac_swap.rs +++ b/ks-lib/src/executor/amm/guac_swap.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/guac_swap.rs -// version: 3 +// file: ks-lib/src/executor/amm/guac_swap.rs +// version: 4 //! Reserved executor for `amm_guac_swap`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmGuacSwapExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_GUAC_SWAP_PROGRAM_ID]; + return &[ks_program_ids::AMM_GUAC_SWAP_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmGuacSwapExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_guac_swap"}), ) { diff --git a/kb-lib/src/executor/amm/lifinity_swap_v2.rs b/ks-lib/src/executor/amm/lifinity_swap_v2.rs similarity index 89% rename from kb-lib/src/executor/amm/lifinity_swap_v2.rs rename to ks-lib/src/executor/amm/lifinity_swap_v2.rs index d21705f..0a9f596 100644 --- a/kb-lib/src/executor/amm/lifinity_swap_v2.rs +++ b/ks-lib/src/executor/amm/lifinity_swap_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/lifinity_swap_v2.rs -// version: 3 +// file: ks-lib/src/executor/amm/lifinity_swap_v2.rs +// version: 4 //! Reserved executor for `amm_lifinity_swap_v2`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmLifinitySwapV2Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_LIFINITY_SWAP_V2_PROGRAM_ID]; + return &[ks_program_ids::AMM_LIFINITY_SWAP_V2_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmLifinitySwapV2Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_lifinity_swap_v2"}), ) { diff --git a/kb-lib/src/executor/amm/metadao_v0_5.rs b/ks-lib/src/executor/amm/metadao_v0_5.rs similarity index 89% rename from kb-lib/src/executor/amm/metadao_v0_5.rs rename to ks-lib/src/executor/amm/metadao_v0_5.rs index 859c772..cab85f7 100644 --- a/kb-lib/src/executor/amm/metadao_v0_5.rs +++ b/ks-lib/src/executor/amm/metadao_v0_5.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/metadao_v0_5.rs -// version: 3 +// file: ks-lib/src/executor/amm/metadao_v0_5.rs +// version: 4 //! Reserved executor for `amm_metadao_v0_5`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmMetadaoV05Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_METADAO_V0_5_PROGRAM_ID]; + return &[ks_program_ids::AMM_METADAO_V0_5_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmMetadaoV05Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_metadao_v0_5"}), ) { diff --git a/kb-lib/src/executor/amm/meteora_damm_v1.rs b/ks-lib/src/executor/amm/meteora_damm_v1.rs similarity index 89% rename from kb-lib/src/executor/amm/meteora_damm_v1.rs rename to ks-lib/src/executor/amm/meteora_damm_v1.rs index b8f15fe..0c2d8ba 100644 --- a/kb-lib/src/executor/amm/meteora_damm_v1.rs +++ b/ks-lib/src/executor/amm/meteora_damm_v1.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/meteora_damm_v1.rs -// version: 3 +// file: ks-lib/src/executor/amm/meteora_damm_v1.rs +// version: 4 //! Reserved executor for `amm_meteora_damm_v1`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmMeteoraDammV1Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_METEORA_DAMM_V1_PROGRAM_ID]; + return &[ks_program_ids::AMM_METEORA_DAMM_V1_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmMeteoraDammV1Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_meteora_damm_v1"}), ) { diff --git a/kb-lib/src/executor/amm/meteora_damm_v2.rs b/ks-lib/src/executor/amm/meteora_damm_v2.rs similarity index 89% rename from kb-lib/src/executor/amm/meteora_damm_v2.rs rename to ks-lib/src/executor/amm/meteora_damm_v2.rs index 3bfc749..6017b04 100644 --- a/kb-lib/src/executor/amm/meteora_damm_v2.rs +++ b/ks-lib/src/executor/amm/meteora_damm_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/meteora_damm_v2.rs -// version: 3 +// file: ks-lib/src/executor/amm/meteora_damm_v2.rs +// version: 4 //! Reserved executor for `amm_meteora_damm_v2`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmMeteoraDammV2Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_METEORA_DAMM_V2_PROGRAM_ID]; + return &[ks_program_ids::AMM_METEORA_DAMM_V2_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmMeteoraDammV2Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_meteora_damm_v2"}), ) { diff --git a/kb-lib/src/executor/amm/obric_v2.rs b/ks-lib/src/executor/amm/obric_v2.rs similarity index 89% rename from kb-lib/src/executor/amm/obric_v2.rs rename to ks-lib/src/executor/amm/obric_v2.rs index 133af16..695b024 100644 --- a/kb-lib/src/executor/amm/obric_v2.rs +++ b/ks-lib/src/executor/amm/obric_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/obric_v2.rs -// version: 3 +// file: ks-lib/src/executor/amm/obric_v2.rs +// version: 4 //! Reserved executor for `amm_obric_v2`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmObricV2Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_OBRIC_V2_PROGRAM_ID]; + return &[ks_program_ids::AMM_OBRIC_V2_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmObricV2Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_obric_v2"}), ) { diff --git a/kb-lib/src/executor/amm/one_dex.rs b/ks-lib/src/executor/amm/one_dex.rs similarity index 89% rename from kb-lib/src/executor/amm/one_dex.rs rename to ks-lib/src/executor/amm/one_dex.rs index 09a2dbb..60cc5d1 100644 --- a/kb-lib/src/executor/amm/one_dex.rs +++ b/ks-lib/src/executor/amm/one_dex.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/one_dex.rs -// version: 3 +// file: ks-lib/src/executor/amm/one_dex.rs +// version: 4 //! Reserved executor for `amm_one_dex`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmOneDexExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_ONE_DEX_PROGRAM_ID]; + return &[ks_program_ids::AMM_ONE_DEX_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmOneDexExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_one_dex"}), ) { diff --git a/kb-lib/src/executor/amm/pump_swap.rs b/ks-lib/src/executor/amm/pump_swap.rs similarity index 89% rename from kb-lib/src/executor/amm/pump_swap.rs rename to ks-lib/src/executor/amm/pump_swap.rs index d742b89..4e878d4 100644 --- a/kb-lib/src/executor/amm/pump_swap.rs +++ b/ks-lib/src/executor/amm/pump_swap.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/pump_swap.rs -// version: 3 +// file: ks-lib/src/executor/amm/pump_swap.rs +// version: 4 //! Reserved executor for `amm_pump_swap`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmPumpSwapExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_PUMP_SWAP_PROGRAM_ID]; + return &[ks_program_ids::AMM_PUMP_SWAP_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmPumpSwapExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_pump_swap"}), ) { diff --git a/kb-lib/src/executor/amm/raydium_lp_v4.rs b/ks-lib/src/executor/amm/raydium_lp_v4.rs similarity index 89% rename from kb-lib/src/executor/amm/raydium_lp_v4.rs rename to ks-lib/src/executor/amm/raydium_lp_v4.rs index 274f554..cab446c 100644 --- a/kb-lib/src/executor/amm/raydium_lp_v4.rs +++ b/ks-lib/src/executor/amm/raydium_lp_v4.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/raydium_lp_v4.rs -// version: 3 +// file: ks-lib/src/executor/amm/raydium_lp_v4.rs +// version: 4 //! Reserved executor for `amm_raydium_lp_v4`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmRaydiumLpV4Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_RAYDIUM_LP_V4_PROGRAM_ID]; + return &[ks_program_ids::AMM_RAYDIUM_LP_V4_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmRaydiumLpV4Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_raydium_lp_v4"}), ) { diff --git a/kb-lib/src/executor/amm/solfi.rs b/ks-lib/src/executor/amm/solfi.rs similarity index 89% rename from kb-lib/src/executor/amm/solfi.rs rename to ks-lib/src/executor/amm/solfi.rs index 565274e..275f930 100644 --- a/kb-lib/src/executor/amm/solfi.rs +++ b/ks-lib/src/executor/amm/solfi.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/solfi.rs -// version: 3 +// file: ks-lib/src/executor/amm/solfi.rs +// version: 4 //! Reserved executor for `amm_solfi`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmSolfiExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_SOLFI_PROGRAM_ID]; + return &[ks_program_ids::AMM_SOLFI_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmSolfiExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_solfi"}), ) { diff --git a/kb-lib/src/executor/amm/solfi_v2.rs b/ks-lib/src/executor/amm/solfi_v2.rs similarity index 89% rename from kb-lib/src/executor/amm/solfi_v2.rs rename to ks-lib/src/executor/amm/solfi_v2.rs index be161ea..7fc55ee 100644 --- a/kb-lib/src/executor/amm/solfi_v2.rs +++ b/ks-lib/src/executor/amm/solfi_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/solfi_v2.rs -// version: 3 +// file: ks-lib/src/executor/amm/solfi_v2.rs +// version: 4 //! Reserved executor for `amm_solfi_v2`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmSolfiV2Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_SOLFI_V2_PROGRAM_ID]; + return &[ks_program_ids::AMM_SOLFI_V2_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmSolfiV2Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_solfi_v2"}), ) { diff --git a/kb-lib/src/executor/amm/vertigo.rs b/ks-lib/src/executor/amm/vertigo.rs similarity index 89% rename from kb-lib/src/executor/amm/vertigo.rs rename to ks-lib/src/executor/amm/vertigo.rs index a6859da..7a946ad 100644 --- a/kb-lib/src/executor/amm/vertigo.rs +++ b/ks-lib/src/executor/amm/vertigo.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/vertigo.rs -// version: 3 +// file: ks-lib/src/executor/amm/vertigo.rs +// version: 4 //! Reserved executor for `amm_vertigo`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmVertigoExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_VERTIGO_PROGRAM_ID]; + return &[ks_program_ids::AMM_VERTIGO_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmVertigoExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_vertigo"}), ) { diff --git a/kb-lib/src/executor/amm/woofi.rs b/ks-lib/src/executor/amm/woofi.rs similarity index 89% rename from kb-lib/src/executor/amm/woofi.rs rename to ks-lib/src/executor/amm/woofi.rs index 01b791b..5a8b420 100644 --- a/kb-lib/src/executor/amm/woofi.rs +++ b/ks-lib/src/executor/amm/woofi.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/woofi.rs -// version: 3 +// file: ks-lib/src/executor/amm/woofi.rs +// version: 4 //! Reserved executor for `amm_woofi`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmWoofiExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_WOOFI_PROGRAM_ID]; + return &[ks_program_ids::AMM_WOOFI_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmWoofiExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_woofi"}), ) { diff --git a/kb-lib/src/executor/amm/zero_fi.rs b/ks-lib/src/executor/amm/zero_fi.rs similarity index 89% rename from kb-lib/src/executor/amm/zero_fi.rs rename to ks-lib/src/executor/amm/zero_fi.rs index 435c385..be71ade 100644 --- a/kb-lib/src/executor/amm/zero_fi.rs +++ b/ks-lib/src/executor/amm/zero_fi.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/zero_fi.rs -// version: 3 +// file: ks-lib/src/executor/amm/zero_fi.rs +// version: 4 //! Reserved executor for `amm_zero_fi`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmZeroFiExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_ZERO_FI_PROGRAM_ID]; + return &[ks_program_ids::AMM_ZERO_FI_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmZeroFiExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_zero_fi"}), ) { diff --git a/kb-lib/src/executor/amm/zora.rs b/ks-lib/src/executor/amm/zora.rs similarity index 89% rename from kb-lib/src/executor/amm/zora.rs rename to ks-lib/src/executor/amm/zora.rs index 32d7789..4b64730 100644 --- a/kb-lib/src/executor/amm/zora.rs +++ b/ks-lib/src/executor/amm/zora.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/amm/zora.rs -// version: 3 +// file: ks-lib/src/executor/amm/zora.rs +// version: 4 //! Reserved executor for `amm_zora`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmZoraExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::AMM_ZORA_PROGRAM_ID]; + return &[ks_program_ids::AMM_ZORA_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExAmmZoraExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"amm_zora"}), ) { diff --git a/kb-lib/src/executor/api.rs b/ks-lib/src/executor/api.rs similarity index 98% rename from kb-lib/src/executor/api.rs rename to ks-lib/src/executor/api.rs index 66597c6..fc73764 100644 --- a/kb-lib/src/executor/api.rs +++ b/ks-lib/src/executor/api.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/api.rs -// version: 3 +// file: ks-lib/src/executor/api.rs +// version: 4 //! Executor contracts. diff --git a/kb-lib/src/executor/api/execution.rs b/ks-lib/src/executor/api/execution.rs similarity index 93% rename from kb-lib/src/executor/api/execution.rs rename to ks-lib/src/executor/api/execution.rs index 372a677..12a9082 100644 --- a/kb-lib/src/executor/api/execution.rs +++ b/ks-lib/src/executor/api/execution.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/api/execution.rs -// version: 9 +// file: ks-lib/src/executor/api/execution.rs +// version: 10 //! Typed execution plans, policies and result contracts. @@ -10,7 +10,7 @@ use ts_rs::TS; // rust-rules: derive-import #[serde(tag = "status", rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/ExecutionCapability.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionCapability.ts" )] pub enum ExApiExecutionCapability { /// The operation is implemented by the executor. @@ -55,7 +55,7 @@ impl crate::ExApiExecutionCapability { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/ExecutionCluster.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionCluster.ts" )] pub enum ExApiExecutionCluster { /// Local validator cluster. @@ -104,7 +104,7 @@ impl<'de> serde::Deserialize<'de> for crate::ExApiExecutionCluster { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/ExecutionClusterPolicy.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionClusterPolicy.ts" )] pub struct ExApiExecutionClusterPolicy { /// Cluster that the RPC endpoint must report. @@ -130,7 +130,7 @@ impl std::default::Default for crate::ExApiExecutionClusterPolicy { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/ExecutionSimulationPolicy.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionSimulationPolicy.ts" )] pub enum ExApiExecutionSimulationPolicy { /// Simulation must succeed before signing or sending. @@ -144,7 +144,7 @@ pub enum ExApiExecutionSimulationPolicy { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/ExecutionBlockhashKind.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionBlockhashKind.ts" )] pub enum ExApiExecutionBlockhashKind { /// Fetch a recent blockhash and enforce a bounded age. @@ -157,7 +157,7 @@ pub enum ExApiExecutionBlockhashKind { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/ExecutionBlockhashPolicy.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionBlockhashPolicy.ts" )] pub struct ExApiExecutionBlockhashPolicy { /// Selected blockhash source. @@ -185,7 +185,7 @@ impl std::default::Default for crate::ExApiExecutionBlockhashPolicy { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/ExecutionCostLimit.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionCostLimit.ts" )] pub struct ExApiExecutionCostLimit { /// Maximum lamports that operation instructions may transfer or lock. @@ -210,7 +210,7 @@ impl std::default::Default for crate::ExApiExecutionCostLimit { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/PostExecutionValidationPolicy.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/PostExecutionValidationPolicy.ts" )] pub struct ExApiPostExecutionValidationPolicy { /// Whether the sent signature must be inserted into canonical storage. @@ -238,7 +238,7 @@ impl std::default::Default for crate::ExApiPostExecutionValidationPolicy { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/ExecutionPolicy.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionPolicy.ts" )] pub struct ExApiExecutionPolicy { /// Cluster restrictions. @@ -275,7 +275,7 @@ impl std::default::Default for crate::ExApiExecutionPolicy { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/PlannedAccount.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/PlannedAccount.ts" )] pub struct ExApiPlannedAccount { /// Account public key. @@ -290,7 +290,7 @@ pub struct ExApiPlannedAccount { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/PlannedInstruction.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/PlannedInstruction.ts" )] pub struct ExApiPlannedInstruction { /// Target program id. @@ -307,7 +307,7 @@ pub struct ExApiPlannedInstruction { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/RequiredSigner.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/RequiredSigner.ts" )] pub struct ExApiRequiredSigner { /// Signer public key. @@ -320,7 +320,7 @@ pub struct ExApiRequiredSigner { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/PreparedExecutionPlan.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/PreparedExecutionPlan.ts" )] pub struct ExApiPreparedExecutionPlan { /// Stable executor crate name. @@ -349,7 +349,7 @@ pub struct ExApiPreparedExecutionPlan { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/ExecutionSimulationResult.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionSimulationResult.ts" )] pub struct ExApiExecutionSimulationResult { /// Whether an RPC simulation call was actually performed. @@ -389,7 +389,7 @@ pub struct ExApiExecutionSimulationResult { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/ExecutionSendResult.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionSendResult.ts" )] pub struct ExApiExecutionSendResult { /// Cluster used for submission. @@ -405,7 +405,7 @@ pub struct ExApiExecutionSendResult { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/ExecutionConfirmationStatus.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionConfirmationStatus.ts" )] pub enum ExApiExecutionConfirmationStatus { /// The transaction was observed at processed commitment. @@ -426,7 +426,7 @@ pub enum ExApiExecutionConfirmationStatus { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/ExecutionConfirmationResult.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/ExecutionConfirmationResult.ts" )] pub struct ExApiExecutionConfirmationResult { /// Cluster queried for confirmation. @@ -449,7 +449,7 @@ pub struct ExApiExecutionConfirmationResult { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/execution/PostExecutionDiagnostic.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/execution/PostExecutionDiagnostic.ts" )] pub struct ExApiPostExecutionDiagnostic { /// Executed transaction signature. @@ -482,7 +482,7 @@ pub trait ExApiTypedInstructionExecutor { fn build_prepared_plan( &self, intent: &Self::Intent, - ) -> kb_core::Result; + ) -> ks_core::Result; } #[cfg(test)] diff --git a/kb-lib/src/executor/api/executor.rs b/ks-lib/src/executor/api/executor.rs similarity index 88% rename from kb-lib/src/executor/api/executor.rs rename to ks-lib/src/executor/api/executor.rs index 5d2cd90..3f05b47 100644 --- a/kb-lib/src/executor/api/executor.rs +++ b/ks-lib/src/executor/api/executor.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/api/executor.rs -// version: 4 +// file: ks-lib/src/executor/api/executor.rs +// version: 5 //! Shared execution contract and neutral request models. @@ -9,7 +9,7 @@ use ts_rs::TS; // rust-rules: derive-import #[derive(Clone, Copy, Debug, Eq, PartialEq, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/executor/ExecutionSupport.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/executor/ExecutionSupport.ts" )] pub enum ExApiExecutionSupport { /// The executor cannot handle the request. @@ -24,7 +24,7 @@ pub enum ExApiExecutionSupport { #[derive(Clone, Debug, Eq, PartialEq, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/executor/ExecutionRequest.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/executor/ExecutionRequest.ts" )] pub struct ExApiExecutionRequest { /// Target program id. @@ -39,7 +39,7 @@ pub struct ExApiExecutionRequest { #[derive(Clone, Debug, Eq, PartialEq, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/api/executor/ExecutionPlan.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/api/executor/ExecutionPlan.ts" )] pub struct ExApiExecutionPlan { /// Stable executor crate name. @@ -53,10 +53,10 @@ pub struct ExApiExecutionPlan { /// Serializes a JSON payload to its compact string representation. pub fn executor_api_serialize_payload_json( value: &serde_json::Value, -) -> kb_core::Result { +) -> ks_core::Result { return match serde_json::to_string(value) { std::result::Result::Ok(serialized) => std::result::Result::Ok(serialized), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_payload_json_serialize_failed", error.to_string(), )), @@ -66,10 +66,10 @@ pub fn executor_api_serialize_payload_json( /// Serializes a JSON payload to its pretty string representation. pub fn executor_api_serialize_payload_json_pretty( value: &serde_json::Value, -) -> kb_core::Result { +) -> ks_core::Result { return match serde_json::to_string_pretty(value) { std::result::Result::Ok(serialized) => std::result::Result::Ok(serialized), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_payload_json_pretty_serialize_failed", error.to_string(), )), @@ -105,5 +105,5 @@ pub trait ExApiInstructionExecutor { fn build_plan( &self, request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result; + ) -> ks_core::Result; } diff --git a/kb-lib/src/executor/bridge.rs b/ks-lib/src/executor/bridge.rs similarity index 93% rename from kb-lib/src/executor/bridge.rs rename to ks-lib/src/executor/bridge.rs index 36ac5bc..8fad9b7 100644 --- a/kb-lib/src/executor/bridge.rs +++ b/ks-lib/src/executor/bridge.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/bridge.rs -// version: 2 +// file: ks-lib/src/executor/bridge.rs +// version: 3 //! `bridge` executor family. diff --git a/kb-lib/src/executor/bridge/circle_cctp_token_messenger_minter.rs b/ks-lib/src/executor/bridge/circle_cctp_token_messenger_minter.rs similarity index 89% rename from kb-lib/src/executor/bridge/circle_cctp_token_messenger_minter.rs rename to ks-lib/src/executor/bridge/circle_cctp_token_messenger_minter.rs index 65eb26e..00bec97 100644 --- a/kb-lib/src/executor/bridge/circle_cctp_token_messenger_minter.rs +++ b/ks-lib/src/executor/bridge/circle_cctp_token_messenger_minter.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/bridge/circle_cctp_token_messenger_minter.rs -// version: 3 +// file: ks-lib/src/executor/bridge/circle_cctp_token_messenger_minter.rs +// version: 4 //! Reserved executor for `bridge_circle_cctp_token_messenger_minter`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExBridgeCircleCctpTokenMessenger } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::BRIDGE_CIRCLE_CCTP_TOKEN_MESSENGER_MINTER_PROGRAM_ID]; + return &[ks_program_ids::BRIDGE_CIRCLE_CCTP_TOKEN_MESSENGER_MINTER_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExBridgeCircleCctpTokenMessenger fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"bridge_circle_cctp_token_messenger_minter"}), ) { diff --git a/kb-lib/src/executor/bridge/circle_cctp_token_messenger_minter_v2.rs b/ks-lib/src/executor/bridge/circle_cctp_token_messenger_minter_v2.rs similarity index 89% rename from kb-lib/src/executor/bridge/circle_cctp_token_messenger_minter_v2.rs rename to ks-lib/src/executor/bridge/circle_cctp_token_messenger_minter_v2.rs index cde169c..104b96d 100644 --- a/kb-lib/src/executor/bridge/circle_cctp_token_messenger_minter_v2.rs +++ b/ks-lib/src/executor/bridge/circle_cctp_token_messenger_minter_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/bridge/circle_cctp_token_messenger_minter_v2.rs -// version: 3 +// file: ks-lib/src/executor/bridge/circle_cctp_token_messenger_minter_v2.rs +// version: 4 //! Reserved executor for `bridge_circle_cctp_token_messenger_minter_v2`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExBridgeCircleCctpTokenMessenger } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::BRIDGE_CIRCLE_CCTP_TOKEN_MESSENGER_MINTER_V2_PROGRAM_ID]; + return &[ks_program_ids::BRIDGE_CIRCLE_CCTP_TOKEN_MESSENGER_MINTER_V2_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExBridgeCircleCctpTokenMessenger fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"bridge_circle_cctp_token_messenger_minter_v2"}), ) { diff --git a/kb-lib/src/executor/bridge/layer_zero_endpoint.rs b/ks-lib/src/executor/bridge/layer_zero_endpoint.rs similarity index 89% rename from kb-lib/src/executor/bridge/layer_zero_endpoint.rs rename to ks-lib/src/executor/bridge/layer_zero_endpoint.rs index c7da104..d0cc987 100644 --- a/kb-lib/src/executor/bridge/layer_zero_endpoint.rs +++ b/ks-lib/src/executor/bridge/layer_zero_endpoint.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/bridge/layer_zero_endpoint.rs -// version: 3 +// file: ks-lib/src/executor/bridge/layer_zero_endpoint.rs +// version: 4 //! Reserved executor for `bridge_layer_zero_endpoint`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExBridgeLayerZeroEndpointExecuto } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::BRIDGE_LAYER_ZERO_ENDPOINT_PROGRAM_ID]; + return &[ks_program_ids::BRIDGE_LAYER_ZERO_ENDPOINT_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExBridgeLayerZeroEndpointExecuto fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"bridge_layer_zero_endpoint"}), ) { diff --git a/kb-lib/src/executor/bridge/layer_zero_executor.rs b/ks-lib/src/executor/bridge/layer_zero_executor.rs similarity index 89% rename from kb-lib/src/executor/bridge/layer_zero_executor.rs rename to ks-lib/src/executor/bridge/layer_zero_executor.rs index 8f624b1..f232051 100644 --- a/kb-lib/src/executor/bridge/layer_zero_executor.rs +++ b/ks-lib/src/executor/bridge/layer_zero_executor.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/bridge/layer_zero_executor.rs -// version: 3 +// file: ks-lib/src/executor/bridge/layer_zero_executor.rs +// version: 4 //! Reserved executor for `bridge_layer_zero_executor`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExBridgeLayerZeroExecutorExecuto } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::BRIDGE_LAYER_ZERO_EXECUTOR_PROGRAM_ID]; + return &[ks_program_ids::BRIDGE_LAYER_ZERO_EXECUTOR_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExBridgeLayerZeroExecutorExecuto fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"bridge_layer_zero_executor"}), ) { diff --git a/kb-lib/src/executor/clmm.rs b/ks-lib/src/executor/clmm.rs similarity index 93% rename from kb-lib/src/executor/clmm.rs rename to ks-lib/src/executor/clmm.rs index 1316648..9a19f25 100644 --- a/kb-lib/src/executor/clmm.rs +++ b/ks-lib/src/executor/clmm.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/clmm.rs -// version: 2 +// file: ks-lib/src/executor/clmm.rs +// version: 3 //! `clmm` executor family. diff --git a/kb-lib/src/executor/clmm/byreal.rs b/ks-lib/src/executor/clmm/byreal.rs similarity index 89% rename from kb-lib/src/executor/clmm/byreal.rs rename to ks-lib/src/executor/clmm/byreal.rs index 65e00a8..13e3e68 100644 --- a/kb-lib/src/executor/clmm/byreal.rs +++ b/ks-lib/src/executor/clmm/byreal.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/clmm/byreal.rs -// version: 3 +// file: ks-lib/src/executor/clmm/byreal.rs +// version: 4 //! Reserved executor for `clmm_byreal`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExClmmByrealExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::CLMM_BYREAL_PROGRAM_ID]; + return &[ks_program_ids::CLMM_BYREAL_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExClmmByrealExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"clmm_byreal"}), ) { diff --git a/kb-lib/src/executor/clmm/fusion.rs b/ks-lib/src/executor/clmm/fusion.rs similarity index 89% rename from kb-lib/src/executor/clmm/fusion.rs rename to ks-lib/src/executor/clmm/fusion.rs index d4658fe..a7367e8 100644 --- a/kb-lib/src/executor/clmm/fusion.rs +++ b/ks-lib/src/executor/clmm/fusion.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/clmm/fusion.rs -// version: 3 +// file: ks-lib/src/executor/clmm/fusion.rs +// version: 4 //! Reserved executor for `clmm_fusion`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExClmmFusionExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::CLMM_FUSION_PROGRAM_ID]; + return &[ks_program_ids::CLMM_FUSION_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExClmmFusionExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"clmm_fusion"}), ) { diff --git a/kb-lib/src/executor/clmm/orca_whirlpool.rs b/ks-lib/src/executor/clmm/orca_whirlpool.rs similarity index 89% rename from kb-lib/src/executor/clmm/orca_whirlpool.rs rename to ks-lib/src/executor/clmm/orca_whirlpool.rs index d61b25e..3affde3 100644 --- a/kb-lib/src/executor/clmm/orca_whirlpool.rs +++ b/ks-lib/src/executor/clmm/orca_whirlpool.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/clmm/orca_whirlpool.rs -// version: 3 +// file: ks-lib/src/executor/clmm/orca_whirlpool.rs +// version: 4 //! Reserved executor for `clmm_orca_whirlpool`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExClmmOrcaWhirlpoolExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::CLMM_ORCA_WHIRLPOOL_PROGRAM_ID]; + return &[ks_program_ids::CLMM_ORCA_WHIRLPOOL_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExClmmOrcaWhirlpoolExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"clmm_orca_whirlpool"}), ) { diff --git a/kb-lib/src/executor/clmm/pancake_swap.rs b/ks-lib/src/executor/clmm/pancake_swap.rs similarity index 89% rename from kb-lib/src/executor/clmm/pancake_swap.rs rename to ks-lib/src/executor/clmm/pancake_swap.rs index 9c38e3f..d12844c 100644 --- a/kb-lib/src/executor/clmm/pancake_swap.rs +++ b/ks-lib/src/executor/clmm/pancake_swap.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/clmm/pancake_swap.rs -// version: 3 +// file: ks-lib/src/executor/clmm/pancake_swap.rs +// version: 4 //! Reserved executor for `clmm_pancake_swap`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExClmmPancakeSwapExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::CLMM_PANCAKE_SWAP_PROGRAM_ID]; + return &[ks_program_ids::CLMM_PANCAKE_SWAP_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExClmmPancakeSwapExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"clmm_pancake_swap"}), ) { diff --git a/kb-lib/src/executor/clmm/raydium.rs b/ks-lib/src/executor/clmm/raydium.rs similarity index 89% rename from kb-lib/src/executor/clmm/raydium.rs rename to ks-lib/src/executor/clmm/raydium.rs index 9292fd0..c23a800 100644 --- a/kb-lib/src/executor/clmm/raydium.rs +++ b/ks-lib/src/executor/clmm/raydium.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/clmm/raydium.rs -// version: 3 +// file: ks-lib/src/executor/clmm/raydium.rs +// version: 4 //! Reserved executor for `clmm_raydium`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExClmmRaydiumExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::CLMM_RAYDIUM_PROGRAM_ID]; + return &[ks_program_ids::CLMM_RAYDIUM_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExClmmRaydiumExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"clmm_raydium"}), ) { diff --git a/kb-lib/src/executor/clmm/stabble.rs b/ks-lib/src/executor/clmm/stabble.rs similarity index 89% rename from kb-lib/src/executor/clmm/stabble.rs rename to ks-lib/src/executor/clmm/stabble.rs index 803c46d..bc4fad6 100644 --- a/kb-lib/src/executor/clmm/stabble.rs +++ b/ks-lib/src/executor/clmm/stabble.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/clmm/stabble.rs -// version: 3 +// file: ks-lib/src/executor/clmm/stabble.rs +// version: 4 //! Reserved executor for `clmm_stabble`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExClmmStabbleExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::CLMM_STABBLE_PROGRAM_ID]; + return &[ks_program_ids::CLMM_STABBLE_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExClmmStabbleExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"clmm_stabble"}), ) { diff --git a/kb-lib/src/executor/cpmm.rs b/ks-lib/src/executor/cpmm.rs similarity index 73% rename from kb-lib/src/executor/cpmm.rs rename to ks-lib/src/executor/cpmm.rs index 84276f6..71a948e 100644 --- a/kb-lib/src/executor/cpmm.rs +++ b/ks-lib/src/executor/cpmm.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/cpmm.rs -// version: 2 +// file: ks-lib/src/executor/cpmm.rs +// version: 3 //! `cpmm` executor family. diff --git a/kb-lib/src/executor/cpmm/raydium.rs b/ks-lib/src/executor/cpmm/raydium.rs similarity index 89% rename from kb-lib/src/executor/cpmm/raydium.rs rename to ks-lib/src/executor/cpmm/raydium.rs index eda94ee..fd17b9b 100644 --- a/kb-lib/src/executor/cpmm/raydium.rs +++ b/ks-lib/src/executor/cpmm/raydium.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/cpmm/raydium.rs -// version: 3 +// file: ks-lib/src/executor/cpmm/raydium.rs +// version: 4 //! Reserved executor for `cpmm_raydium`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExCpmmRaydiumExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::CPMM_RAYDIUM_PROGRAM_ID]; + return &[ks_program_ids::CPMM_RAYDIUM_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExCpmmRaydiumExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"cpmm_raydium"}), ) { diff --git a/kb-lib/src/executor/dlmm.rs b/ks-lib/src/executor/dlmm.rs similarity index 73% rename from kb-lib/src/executor/dlmm.rs rename to ks-lib/src/executor/dlmm.rs index f1874e6..cd439bb 100644 --- a/kb-lib/src/executor/dlmm.rs +++ b/ks-lib/src/executor/dlmm.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/dlmm.rs -// version: 2 +// file: ks-lib/src/executor/dlmm.rs +// version: 3 //! `dlmm` executor family. diff --git a/kb-lib/src/executor/dlmm/meteora.rs b/ks-lib/src/executor/dlmm/meteora.rs similarity index 89% rename from kb-lib/src/executor/dlmm/meteora.rs rename to ks-lib/src/executor/dlmm/meteora.rs index 34e3a7f..93b944d 100644 --- a/kb-lib/src/executor/dlmm/meteora.rs +++ b/ks-lib/src/executor/dlmm/meteora.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/dlmm/meteora.rs -// version: 3 +// file: ks-lib/src/executor/dlmm/meteora.rs +// version: 4 //! Reserved executor for `dlmm_meteora`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExDlmmMeteoraExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::DLMM_METEORA_PROGRAM_ID]; + return &[ks_program_ids::DLMM_METEORA_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExDlmmMeteoraExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"dlmm_meteora"}), ) { diff --git a/kb-lib/src/executor/fees.rs b/ks-lib/src/executor/fees.rs similarity index 89% rename from kb-lib/src/executor/fees.rs rename to ks-lib/src/executor/fees.rs index 8a064e2..fb5ee66 100644 --- a/kb-lib/src/executor/fees.rs +++ b/ks-lib/src/executor/fees.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/fees.rs -// version: 3 +// file: ks-lib/src/executor/fees.rs +// version: 4 //! `fees` executor family. diff --git a/kb-lib/src/executor/fees/bags_fee_share_v1.rs b/ks-lib/src/executor/fees/bags_fee_share_v1.rs similarity index 89% rename from kb-lib/src/executor/fees/bags_fee_share_v1.rs rename to ks-lib/src/executor/fees/bags_fee_share_v1.rs index e1c1161..14e560e 100644 --- a/kb-lib/src/executor/fees/bags_fee_share_v1.rs +++ b/ks-lib/src/executor/fees/bags_fee_share_v1.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/fees/bags_fee_share_v1.rs -// version: 3 +// file: ks-lib/src/executor/fees/bags_fee_share_v1.rs +// version: 4 //! Reserved executor for `fees_bags_fee_share_v1`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExFeesBagsFeeShareV1Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::FEES_BAGS_FEE_SHARE_V1_PROGRAM_ID]; + return &[ks_program_ids::FEES_BAGS_FEE_SHARE_V1_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExFeesBagsFeeShareV1Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"fees_bags_fee_share_v1"}), ) { diff --git a/kb-lib/src/executor/fees/bags_fee_share_v2.rs b/ks-lib/src/executor/fees/bags_fee_share_v2.rs similarity index 89% rename from kb-lib/src/executor/fees/bags_fee_share_v2.rs rename to ks-lib/src/executor/fees/bags_fee_share_v2.rs index 84172b6..72025a2 100644 --- a/kb-lib/src/executor/fees/bags_fee_share_v2.rs +++ b/ks-lib/src/executor/fees/bags_fee_share_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/fees/bags_fee_share_v2.rs -// version: 3 +// file: ks-lib/src/executor/fees/bags_fee_share_v2.rs +// version: 4 //! Reserved executor for `fees_bags_fee_share_v2`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExFeesBagsFeeShareV2Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::FEES_BAGS_FEE_SHARE_V2_PROGRAM_ID]; + return &[ks_program_ids::FEES_BAGS_FEE_SHARE_V2_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExFeesBagsFeeShareV2Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"fees_bags_fee_share_v2"}), ) { diff --git a/kb-lib/src/executor/fees/pump_fees.rs b/ks-lib/src/executor/fees/pump_fees.rs similarity index 89% rename from kb-lib/src/executor/fees/pump_fees.rs rename to ks-lib/src/executor/fees/pump_fees.rs index e7a5ebe..e234789 100644 --- a/kb-lib/src/executor/fees/pump_fees.rs +++ b/ks-lib/src/executor/fees/pump_fees.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/fees/pump_fees.rs -// version: 3 +// file: ks-lib/src/executor/fees/pump_fees.rs +// version: 4 //! Reserved executor for `fees_pump_fees`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExFeesPumpFeesExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::FEES_PUMP_FEES_PROGRAM_ID]; + return &[ks_program_ids::FEES_PUMP_FEES_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExFeesPumpFeesExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"fees_pump_fees"}), ) { diff --git a/kb-lib/src/executor/governance.rs b/ks-lib/src/executor/governance.rs similarity index 89% rename from kb-lib/src/executor/governance.rs rename to ks-lib/src/executor/governance.rs index 16c8fc9..53d2f94 100644 --- a/kb-lib/src/executor/governance.rs +++ b/ks-lib/src/executor/governance.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/governance.rs -// version: 3 +// file: ks-lib/src/executor/governance.rs +// version: 4 //! `governance` executor family. diff --git a/kb-lib/src/executor/governance/metadao_bid_wall.rs b/ks-lib/src/executor/governance/metadao_bid_wall.rs similarity index 89% rename from kb-lib/src/executor/governance/metadao_bid_wall.rs rename to ks-lib/src/executor/governance/metadao_bid_wall.rs index 43da29e..e32deb9 100644 --- a/kb-lib/src/executor/governance/metadao_bid_wall.rs +++ b/ks-lib/src/executor/governance/metadao_bid_wall.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/governance/metadao_bid_wall.rs -// version: 3 +// file: ks-lib/src/executor/governance/metadao_bid_wall.rs +// version: 4 //! Reserved executor for `governance_metadao_bid_wall`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExGovernanceMetadaoBidWallExecut } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::GOVERNANCE_METADAO_BID_WALL_PROGRAM_ID]; + return &[ks_program_ids::GOVERNANCE_METADAO_BID_WALL_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExGovernanceMetadaoBidWallExecut fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"governance_metadao_bid_wall"}), ) { diff --git a/kb-lib/src/executor/governance/metadao_futarchy.rs b/ks-lib/src/executor/governance/metadao_futarchy.rs similarity index 89% rename from kb-lib/src/executor/governance/metadao_futarchy.rs rename to ks-lib/src/executor/governance/metadao_futarchy.rs index 36cfff3..628dfa6 100644 --- a/kb-lib/src/executor/governance/metadao_futarchy.rs +++ b/ks-lib/src/executor/governance/metadao_futarchy.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/governance/metadao_futarchy.rs -// version: 3 +// file: ks-lib/src/executor/governance/metadao_futarchy.rs +// version: 4 //! Reserved executor for `governance_metadao_futarchy`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExGovernanceMetadaoFutarchyExecu } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::GOVERNANCE_METADAO_FUTARCHY_PROGRAM_ID]; + return &[ks_program_ids::GOVERNANCE_METADAO_FUTARCHY_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExGovernanceMetadaoFutarchyExecu fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"governance_metadao_futarchy"}), ) { diff --git a/kb-lib/src/executor/governance/squads_multisig.rs b/ks-lib/src/executor/governance/squads_multisig.rs similarity index 89% rename from kb-lib/src/executor/governance/squads_multisig.rs rename to ks-lib/src/executor/governance/squads_multisig.rs index c9f688b..2464280 100644 --- a/kb-lib/src/executor/governance/squads_multisig.rs +++ b/ks-lib/src/executor/governance/squads_multisig.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/governance/squads_multisig.rs -// version: 1 +// file: ks-lib/src/executor/governance/squads_multisig.rs +// version: 2 //! Reserved executor for `governance_squads_multisig`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExGovernanceSquadsMultisigExecut } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::GOVERNANCE_SQUADS_MULTISIG_PROGRAM_ID]; + return &[ks_program_ids::GOVERNANCE_SQUADS_MULTISIG_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExGovernanceSquadsMultisigExecut fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"governance_squads_multisig"}), ) { diff --git a/kb-lib/src/executor/launchpad.rs b/ks-lib/src/executor/launchpad.rs similarity index 96% rename from kb-lib/src/executor/launchpad.rs rename to ks-lib/src/executor/launchpad.rs index b67ccee..46d43ab 100644 --- a/kb-lib/src/executor/launchpad.rs +++ b/ks-lib/src/executor/launchpad.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/launchpad.rs -// version: 3 +// file: ks-lib/src/executor/launchpad.rs +// version: 4 //! `launchpad` executor family. diff --git a/kb-lib/src/executor/launchpad/boop_fun.rs b/ks-lib/src/executor/launchpad/boop_fun.rs similarity index 89% rename from kb-lib/src/executor/launchpad/boop_fun.rs rename to ks-lib/src/executor/launchpad/boop_fun.rs index 021fe20..29edfb6 100644 --- a/kb-lib/src/executor/launchpad/boop_fun.rs +++ b/ks-lib/src/executor/launchpad/boop_fun.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/launchpad/boop_fun.rs -// version: 3 +// file: ks-lib/src/executor/launchpad/boop_fun.rs +// version: 4 //! Reserved executor for `launchpad_boop_fun`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadBoopFunExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_BOOP_FUN_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_BOOP_FUN_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadBoopFunExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"launchpad_boop_fun"}), ) { diff --git a/kb-lib/src/executor/launchpad/metadao_ico.rs b/ks-lib/src/executor/launchpad/metadao_ico.rs similarity index 89% rename from kb-lib/src/executor/launchpad/metadao_ico.rs rename to ks-lib/src/executor/launchpad/metadao_ico.rs index a4dd586..a5da952 100644 --- a/kb-lib/src/executor/launchpad/metadao_ico.rs +++ b/ks-lib/src/executor/launchpad/metadao_ico.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/launchpad/metadao_ico.rs -// version: 3 +// file: ks-lib/src/executor/launchpad/metadao_ico.rs +// version: 4 //! Reserved executor for `launchpad_metadao_ico`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadMetadaoIcoExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_METADAO_ICO_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_METADAO_ICO_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadMetadaoIcoExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"launchpad_metadao_ico"}), ) { diff --git a/kb-lib/src/executor/launchpad/meteora_dbc.rs b/ks-lib/src/executor/launchpad/meteora_dbc.rs similarity index 89% rename from kb-lib/src/executor/launchpad/meteora_dbc.rs rename to ks-lib/src/executor/launchpad/meteora_dbc.rs index 3899807..b36d9ee 100644 --- a/kb-lib/src/executor/launchpad/meteora_dbc.rs +++ b/ks-lib/src/executor/launchpad/meteora_dbc.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/launchpad/meteora_dbc.rs -// version: 3 +// file: ks-lib/src/executor/launchpad/meteora_dbc.rs +// version: 4 //! Reserved executor for `launchpad_meteora_dbc`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadMeteoraDbcExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_METEORA_DBC_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_METEORA_DBC_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadMeteoraDbcExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"launchpad_meteora_dbc"}), ) { diff --git a/kb-lib/src/executor/launchpad/moonit.rs b/ks-lib/src/executor/launchpad/moonit.rs similarity index 89% rename from kb-lib/src/executor/launchpad/moonit.rs rename to ks-lib/src/executor/launchpad/moonit.rs index db3fb56..2625ba5 100644 --- a/kb-lib/src/executor/launchpad/moonit.rs +++ b/ks-lib/src/executor/launchpad/moonit.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/launchpad/moonit.rs -// version: 3 +// file: ks-lib/src/executor/launchpad/moonit.rs +// version: 4 //! Reserved executor for `launchpad_moonit`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadMoonitExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_MOONIT_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_MOONIT_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadMoonitExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"launchpad_moonit"}), ) { diff --git a/kb-lib/src/executor/launchpad/orca_wavebreak.rs b/ks-lib/src/executor/launchpad/orca_wavebreak.rs similarity index 89% rename from kb-lib/src/executor/launchpad/orca_wavebreak.rs rename to ks-lib/src/executor/launchpad/orca_wavebreak.rs index 09b1264..010b3b8 100644 --- a/kb-lib/src/executor/launchpad/orca_wavebreak.rs +++ b/ks-lib/src/executor/launchpad/orca_wavebreak.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/launchpad/orca_wavebreak.rs -// version: 3 +// file: ks-lib/src/executor/launchpad/orca_wavebreak.rs +// version: 4 //! Reserved executor for `launchpad_orca_wavebreak`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadOrcaWavebreakExecutor } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_ORCA_WAVEBREAK_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_ORCA_WAVEBREAK_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadOrcaWavebreakExecutor fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"launchpad_orca_wavebreak"}), ) { diff --git a/kb-lib/src/executor/launchpad/printr.rs b/ks-lib/src/executor/launchpad/printr.rs similarity index 89% rename from kb-lib/src/executor/launchpad/printr.rs rename to ks-lib/src/executor/launchpad/printr.rs index 3139dd5..3d66e34 100644 --- a/kb-lib/src/executor/launchpad/printr.rs +++ b/ks-lib/src/executor/launchpad/printr.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/launchpad/printr.rs -// version: 3 +// file: ks-lib/src/executor/launchpad/printr.rs +// version: 4 //! Reserved executor for `launchpad_printr`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadPrintrExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_PRINTR_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_PRINTR_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadPrintrExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"launchpad_printr"}), ) { diff --git a/kb-lib/src/executor/launchpad/pump_fun.rs b/ks-lib/src/executor/launchpad/pump_fun.rs similarity index 89% rename from kb-lib/src/executor/launchpad/pump_fun.rs rename to ks-lib/src/executor/launchpad/pump_fun.rs index 832a206..79996f8 100644 --- a/kb-lib/src/executor/launchpad/pump_fun.rs +++ b/ks-lib/src/executor/launchpad/pump_fun.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/launchpad/pump_fun.rs -// version: 3 +// file: ks-lib/src/executor/launchpad/pump_fun.rs +// version: 4 //! Reserved executor for `launchpad_pump_fun`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadPumpFunExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_PUMP_FUN_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_PUMP_FUN_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadPumpFunExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"launchpad_pump_fun"}), ) { diff --git a/kb-lib/src/executor/launchpad/pump_pumpup_ai.rs b/ks-lib/src/executor/launchpad/pump_pumpup_ai.rs similarity index 89% rename from kb-lib/src/executor/launchpad/pump_pumpup_ai.rs rename to ks-lib/src/executor/launchpad/pump_pumpup_ai.rs index 3ea67f8..8529032 100644 --- a/kb-lib/src/executor/launchpad/pump_pumpup_ai.rs +++ b/ks-lib/src/executor/launchpad/pump_pumpup_ai.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/launchpad/pump_pumpup_ai.rs -// version: 3 +// file: ks-lib/src/executor/launchpad/pump_pumpup_ai.rs +// version: 4 //! Reserved executor for `launchpad_pump_pumpup_ai`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadPumpPumpupAiExecutor } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_PUMP_PUMPUP_AI_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_PUMP_PUMPUP_AI_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadPumpPumpupAiExecutor fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"launchpad_pump_pumpup_ai"}), ) { diff --git a/kb-lib/src/executor/launchpad/raydium_launchlab.rs b/ks-lib/src/executor/launchpad/raydium_launchlab.rs similarity index 89% rename from kb-lib/src/executor/launchpad/raydium_launchlab.rs rename to ks-lib/src/executor/launchpad/raydium_launchlab.rs index 2dc2d7b..a0835ca 100644 --- a/kb-lib/src/executor/launchpad/raydium_launchlab.rs +++ b/ks-lib/src/executor/launchpad/raydium_launchlab.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/launchpad/raydium_launchlab.rs -// version: 3 +// file: ks-lib/src/executor/launchpad/raydium_launchlab.rs +// version: 4 //! Reserved executor for `launchpad_raydium_launchlab`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadRaydiumLaunchlabExecu } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_RAYDIUM_LAUNCHLAB_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_RAYDIUM_LAUNCHLAB_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadRaydiumLaunchlabExecu fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"launchpad_raydium_launchlab"}), ) { diff --git a/kb-lib/src/executor/launchpad/virtuals.rs b/ks-lib/src/executor/launchpad/virtuals.rs similarity index 89% rename from kb-lib/src/executor/launchpad/virtuals.rs rename to ks-lib/src/executor/launchpad/virtuals.rs index 31187f7..aa51ae8 100644 --- a/kb-lib/src/executor/launchpad/virtuals.rs +++ b/ks-lib/src/executor/launchpad/virtuals.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/launchpad/virtuals.rs -// version: 3 +// file: ks-lib/src/executor/launchpad/virtuals.rs +// version: 4 //! Reserved executor for `launchpad_virtuals`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadVirtualsExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LAUNCHPAD_VIRTUALS_PROGRAM_ID]; + return &[ks_program_ids::LAUNCHPAD_VIRTUALS_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLaunchpadVirtualsExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"launchpad_virtuals"}), ) { diff --git a/kb-lib/src/executor/lending.rs b/ks-lib/src/executor/lending.rs similarity index 95% rename from kb-lib/src/executor/lending.rs rename to ks-lib/src/executor/lending.rs index 1617482..358cf7d 100644 --- a/kb-lib/src/executor/lending.rs +++ b/ks-lib/src/executor/lending.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/lending.rs -// version: 2 +// file: ks-lib/src/executor/lending.rs +// version: 3 //! `lending` executor family. diff --git a/kb-lib/src/executor/lending/clone.rs b/ks-lib/src/executor/lending/clone.rs similarity index 89% rename from kb-lib/src/executor/lending/clone.rs rename to ks-lib/src/executor/lending/clone.rs index 6c088a0..dd5fa5a 100644 --- a/kb-lib/src/executor/lending/clone.rs +++ b/ks-lib/src/executor/lending/clone.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/lending/clone.rs -// version: 3 +// file: ks-lib/src/executor/lending/clone.rs +// version: 4 //! Reserved executor for `lending_clone`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLendingCloneExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LENDING_CLONE_PROGRAM_ID]; + return &[ks_program_ids::LENDING_CLONE_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLendingCloneExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"lending_clone"}), ) { diff --git a/kb-lib/src/executor/lending/jupiter_lend_borrow.rs b/ks-lib/src/executor/lending/jupiter_lend_borrow.rs similarity index 89% rename from kb-lib/src/executor/lending/jupiter_lend_borrow.rs rename to ks-lib/src/executor/lending/jupiter_lend_borrow.rs index 2135cf7..08f2db3 100644 --- a/kb-lib/src/executor/lending/jupiter_lend_borrow.rs +++ b/ks-lib/src/executor/lending/jupiter_lend_borrow.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/lending/jupiter_lend_borrow.rs -// version: 3 +// file: ks-lib/src/executor/lending/jupiter_lend_borrow.rs +// version: 4 //! Reserved executor for `lending_jupiter_lend_borrow`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLendingJupiterLendBorrowExecut } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LENDING_JUPITER_LEND_BORROW_PROGRAM_ID]; + return &[ks_program_ids::LENDING_JUPITER_LEND_BORROW_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLendingJupiterLendBorrowExecut fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"lending_jupiter_lend_borrow"}), ) { diff --git a/kb-lib/src/executor/lending/jupiter_lend_earn.rs b/ks-lib/src/executor/lending/jupiter_lend_earn.rs similarity index 89% rename from kb-lib/src/executor/lending/jupiter_lend_earn.rs rename to ks-lib/src/executor/lending/jupiter_lend_earn.rs index 54ceac2..587f945 100644 --- a/kb-lib/src/executor/lending/jupiter_lend_earn.rs +++ b/ks-lib/src/executor/lending/jupiter_lend_earn.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/lending/jupiter_lend_earn.rs -// version: 3 +// file: ks-lib/src/executor/lending/jupiter_lend_earn.rs +// version: 4 //! Reserved executor for `lending_jupiter_lend_earn`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLendingJupiterLendEarnExecutor } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LENDING_JUPITER_LEND_EARN_PROGRAM_ID]; + return &[ks_program_ids::LENDING_JUPITER_LEND_EARN_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLendingJupiterLendEarnExecutor fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"lending_jupiter_lend_earn"}), ) { diff --git a/kb-lib/src/executor/lending/jupiter_lend_flash_loan.rs b/ks-lib/src/executor/lending/jupiter_lend_flash_loan.rs similarity index 89% rename from kb-lib/src/executor/lending/jupiter_lend_flash_loan.rs rename to ks-lib/src/executor/lending/jupiter_lend_flash_loan.rs index ba3434b..3169ee7 100644 --- a/kb-lib/src/executor/lending/jupiter_lend_flash_loan.rs +++ b/ks-lib/src/executor/lending/jupiter_lend_flash_loan.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/lending/jupiter_lend_flash_loan.rs -// version: 3 +// file: ks-lib/src/executor/lending/jupiter_lend_flash_loan.rs +// version: 4 //! Reserved executor for `lending_jupiter_lend_flash_loan`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLendingJupiterLendFlashLoanExe } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LENDING_JUPITER_LEND_FLASH_LOAN_PROGRAM_ID]; + return &[ks_program_ids::LENDING_JUPITER_LEND_FLASH_LOAN_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLendingJupiterLendFlashLoanExe fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"lending_jupiter_lend_flash_loan"}), ) { diff --git a/kb-lib/src/executor/lending/jupiter_lend_liquidity.rs b/ks-lib/src/executor/lending/jupiter_lend_liquidity.rs similarity index 89% rename from kb-lib/src/executor/lending/jupiter_lend_liquidity.rs rename to ks-lib/src/executor/lending/jupiter_lend_liquidity.rs index c453b60..7e6d9a9 100644 --- a/kb-lib/src/executor/lending/jupiter_lend_liquidity.rs +++ b/ks-lib/src/executor/lending/jupiter_lend_liquidity.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/lending/jupiter_lend_liquidity.rs -// version: 3 +// file: ks-lib/src/executor/lending/jupiter_lend_liquidity.rs +// version: 4 //! Reserved executor for `lending_jupiter_lend_liquidity`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLendingJupiterLendLiquidityExe } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LENDING_JUPITER_LEND_LIQUIDITY_PROGRAM_ID]; + return &[ks_program_ids::LENDING_JUPITER_LEND_LIQUIDITY_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLendingJupiterLendLiquidityExe fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"lending_jupiter_lend_liquidity"}), ) { diff --git a/kb-lib/src/executor/lending/kamino.rs b/ks-lib/src/executor/lending/kamino.rs similarity index 89% rename from kb-lib/src/executor/lending/kamino.rs rename to ks-lib/src/executor/lending/kamino.rs index 8fc1e51..464613c 100644 --- a/kb-lib/src/executor/lending/kamino.rs +++ b/ks-lib/src/executor/lending/kamino.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/lending/kamino.rs -// version: 3 +// file: ks-lib/src/executor/lending/kamino.rs +// version: 4 //! Reserved executor for `lending_kamino`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLendingKaminoExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LENDING_KAMINO_PROGRAM_ID]; + return &[ks_program_ids::LENDING_KAMINO_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLendingKaminoExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"lending_kamino"}), ) { diff --git a/kb-lib/src/executor/lending/marginfi_v2.rs b/ks-lib/src/executor/lending/marginfi_v2.rs similarity index 89% rename from kb-lib/src/executor/lending/marginfi_v2.rs rename to ks-lib/src/executor/lending/marginfi_v2.rs index 192a1a9..23554f2 100644 --- a/kb-lib/src/executor/lending/marginfi_v2.rs +++ b/ks-lib/src/executor/lending/marginfi_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/lending/marginfi_v2.rs -// version: 3 +// file: ks-lib/src/executor/lending/marginfi_v2.rs +// version: 4 //! Reserved executor for `lending_marginfi_v2`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLendingMarginfiV2Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LENDING_MARGINFI_V2_PROGRAM_ID]; + return &[ks_program_ids::LENDING_MARGINFI_V2_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLendingMarginfiV2Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"lending_marginfi_v2"}), ) { diff --git a/kb-lib/src/executor/lock.rs b/ks-lib/src/executor/lock.rs similarity index 74% rename from kb-lib/src/executor/lock.rs rename to ks-lib/src/executor/lock.rs index ef57f47..9baf9bb 100644 --- a/kb-lib/src/executor/lock.rs +++ b/ks-lib/src/executor/lock.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/lock.rs -// version: 2 +// file: ks-lib/src/executor/lock.rs +// version: 3 //! `lock` executor family. diff --git a/kb-lib/src/executor/lock/raydium_lp.rs b/ks-lib/src/executor/lock/raydium_lp.rs similarity index 89% rename from kb-lib/src/executor/lock/raydium_lp.rs rename to ks-lib/src/executor/lock/raydium_lp.rs index d2e3ea6..2553fcc 100644 --- a/kb-lib/src/executor/lock/raydium_lp.rs +++ b/ks-lib/src/executor/lock/raydium_lp.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/lock/raydium_lp.rs -// version: 3 +// file: ks-lib/src/executor/lock/raydium_lp.rs +// version: 4 //! Reserved executor for `lock_raydium_lp`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLockRaydiumLpExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::LOCK_RAYDIUM_LP_PROGRAM_ID]; + return &[ks_program_ids::LOCK_RAYDIUM_LP_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExLockRaydiumLpExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"lock_raydium_lp"}), ) { diff --git a/kb-lib/src/executor/metadata.rs b/ks-lib/src/executor/metadata.rs similarity index 99% rename from kb-lib/src/executor/metadata.rs rename to ks-lib/src/executor/metadata.rs index a79182e..f317985 100644 --- a/kb-lib/src/executor/metadata.rs +++ b/ks-lib/src/executor/metadata.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/metadata.rs -// version: 9 +// file: ks-lib/src/executor/metadata.rs +// version: 10 //! `metadata` executor family. diff --git a/kb-lib/src/executor/metadata/metaplex_token_metadata.rs b/ks-lib/src/executor/metadata/metaplex_token_metadata.rs similarity index 98% rename from kb-lib/src/executor/metadata/metaplex_token_metadata.rs rename to ks-lib/src/executor/metadata/metaplex_token_metadata.rs index 933a6a0..8f0e1ec 100644 --- a/kb-lib/src/executor/metadata/metaplex_token_metadata.rs +++ b/ks-lib/src/executor/metadata/metaplex_token_metadata.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/metadata/metaplex_token_metadata.rs -// version: 10 +// file: ks-lib/src/executor/metadata/metaplex_token_metadata.rs +// version: 11 //! Metaplex Token Metadata typed execution surface. diff --git a/kb-lib/src/executor/metadata/metaplex_token_metadata/builder.rs b/ks-lib/src/executor/metadata/metaplex_token_metadata/builder.rs similarity index 94% rename from kb-lib/src/executor/metadata/metaplex_token_metadata/builder.rs rename to ks-lib/src/executor/metadata/metaplex_token_metadata/builder.rs index 6b45768..ba2a324 100644 --- a/kb-lib/src/executor/metadata/metaplex_token_metadata/builder.rs +++ b/ks-lib/src/executor/metadata/metaplex_token_metadata/builder.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/metadata/metaplex_token_metadata/builder.rs -// version: 11 +// file: ks-lib/src/executor/metadata/metaplex_token_metadata/builder.rs +// version: 12 //! Official Metaplex builders and conservative plan validation. @@ -10,7 +10,7 @@ macro_rules! parse_official_pubkey { match std::str::FromStr::from_str($value) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_pubkey_invalid", format!("invalid {} public key: {}", $field, error), )); @@ -61,7 +61,7 @@ macro_rules! convert_official_instruction { #[allow(deprecated)] pub(crate) fn executor_metaplex_token_metadata_build_prepared_plan( intent: &crate::ExMetaplexTokenMetadataExecutionIntent, -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Err(error) = validate_intent(intent) { return std::result::Result::Err(error); } @@ -214,21 +214,21 @@ pub(crate) fn executor_metaplex_token_metadata_build_prepared_plan( }); } -fn validate_intent(intent: &crate::ExMetaplexTokenMetadataExecutionIntent) -> kb_core::Result<()> { +fn validate_intent(intent: &crate::ExMetaplexTokenMetadataExecutionIntent) -> ks_core::Result<()> { if intent.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_intent_id_empty", "Metaplex Token Metadata execution intent id must not be empty", )); } if intent.operation.is_deprecated() && !intent.allow_deprecated_operation { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_deprecated_operation_not_approved", "deprecated Metaplex Token Metadata operation requires explicit operator approval", )); } if intent.policy.simulation != crate::ExApiExecutionSimulationPolicy::Required { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_simulation_required", "Metaplex Token Metadata execution requires simulation before signing or sending", )); @@ -236,7 +236,7 @@ fn validate_intent(intent: &crate::ExMetaplexTokenMetadataExecutionIntent) -> kb match intent.policy.cost_limit.max_fee_lamports { std::option::Option::Some(value) if value > 0 => {}, std::option::Option::Some(_) | std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_fee_limit_missing", "Metaplex Token Metadata execution requires a positive transaction fee ceiling", )); @@ -245,7 +245,7 @@ fn validate_intent(intent: &crate::ExMetaplexTokenMetadataExecutionIntent) -> kb match intent.policy.cost_limit.max_spend_lamports { std::option::Option::Some(value) if value >= intent.max_rent_lamports => {}, std::option::Option::Some(_) | std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_spend_limit_insufficient", "Metaplex Token Metadata execution spend ceiling must cover max_rent_lamports", )); @@ -266,7 +266,7 @@ fn build_create( update_authority_as_signer: bool, spl_token_program: std::option::Option<&crate::MdProgramId>, create_args: &mpl_token_metadata::types::CreateArgs, -) -> kb_core::Result { +) -> ks_core::Result { let metadata = match parse_pubkey(metadata, "metadata") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -288,7 +288,7 @@ fn build_create( } } if !matches!(create_args, mpl_token_metadata::types::CreateArgs::V1 { .. }) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_create_args_unsupported", "only CreateArgs::V1 is current and supported", )); @@ -309,9 +309,9 @@ fn build_create( parse_official_pubkey!(&update_authority.0, "update_authority"), update_authority_as_signer, ), - system_program: parse_official_pubkey!(kb_program_ids::SYSTEM_PROGRAM_ID, "system_program"), + system_program: parse_official_pubkey!(ks_program_ids::SYSTEM_PROGRAM_ID, "system_program"), sysvar_instructions: parse_official_pubkey!( - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, "sysvar_instructions" ), spl_token_program: match spl_token_program { @@ -338,9 +338,9 @@ fn build_update( authorization_rules_program: std::option::Option<&crate::MdProgramId>, authorization_rules: std::option::Option<&crate::MdPubkey>, update_args: &mpl_token_metadata::types::UpdateArgs, -) -> kb_core::Result { +) -> ks_core::Result { if !matches!(update_args, mpl_token_metadata::types::UpdateArgs::AsUpdateAuthorityV2 { .. }) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_update_variant_not_yet_enabled", "pre.003 enables only UpdateArgs::AsUpdateAuthorityV2; delegate variants are scheduled later", )); @@ -366,7 +366,7 @@ fn build_update( } } if authorization_rules_program.is_some() != authorization_rules.is_some() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_rule_set_accounts_incomplete", "authorization rules program and account must be supplied together", )); @@ -389,9 +389,9 @@ fn build_update( std::option::Option::None => std::option::Option::None, }, payer: parse_official_pubkey!(&intent.fee_payer.0, "fee_payer"), - system_program: parse_official_pubkey!(kb_program_ids::SYSTEM_PROGRAM_ID, "system_program"), + system_program: parse_official_pubkey!(ks_program_ids::SYSTEM_PROGRAM_ID, "system_program"), sysvar_instructions: parse_official_pubkey!( - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, "sysvar_instructions" ), authorization_rules_program: match authorization_rules_program { @@ -416,7 +416,7 @@ fn build_update( fn build_puff_metadata( metadata: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { let metadata = match parse_pubkey(metadata, "metadata") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -433,7 +433,7 @@ fn build_set_token_standard( update_authority: &crate::MdPubkey, mint: &crate::MdPubkey, edition: std::option::Option<&crate::MdPubkey>, -) -> kb_core::Result { +) -> ks_core::Result { let metadata = match parse_pubkey(metadata, "metadata") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -478,13 +478,13 @@ fn build_verify( collection_metadata: std::option::Option<&crate::MdPubkey>, collection_master_edition: std::option::Option<&crate::MdPubkey>, verification_args: &mpl_token_metadata::types::VerificationArgs, -) -> kb_core::Result { +) -> ks_core::Result { if matches!(verification_args, mpl_token_metadata::types::VerificationArgs::CollectionV1) && (collection_mint.is_none() || collection_metadata.is_none() || collection_master_edition.is_none()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_collection_accounts_incomplete", "collection verification requires mint, metadata and master edition accounts", )); @@ -494,7 +494,7 @@ fn build_verify( || collection_metadata.is_some() || collection_master_edition.is_some()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_creator_accounts_unexpected", "creator verification must not provide collection accounts", )); @@ -559,9 +559,9 @@ fn build_verify( )), std::option::Option::None => std::option::Option::None, }, - system_program: parse_official_pubkey!(kb_program_ids::SYSTEM_PROGRAM_ID, "system_program"), + system_program: parse_official_pubkey!(ks_program_ids::SYSTEM_PROGRAM_ID, "system_program"), sysvar_instructions: parse_official_pubkey!( - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, "sysvar_instructions" ), } @@ -579,11 +579,11 @@ fn build_unverify( collection_mint: std::option::Option<&crate::MdPubkey>, collection_metadata: std::option::Option<&crate::MdPubkey>, verification_args: &mpl_token_metadata::types::VerificationArgs, -) -> kb_core::Result { +) -> ks_core::Result { if matches!(verification_args, mpl_token_metadata::types::VerificationArgs::CollectionV1) && (collection_mint.is_none() || collection_metadata.is_none()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_collection_accounts_incomplete", "collection unverification requires mint and metadata accounts", )); @@ -591,7 +591,7 @@ fn build_unverify( if matches!(verification_args, mpl_token_metadata::types::VerificationArgs::CreatorV1) && (collection_mint.is_some() || collection_metadata.is_some()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_creator_accounts_unexpected", "creator unverification must not provide collection accounts", )); @@ -635,9 +635,9 @@ fn build_unverify( )), std::option::Option::None => std::option::Option::None, }, - system_program: parse_official_pubkey!(kb_program_ids::SYSTEM_PROGRAM_ID, "system_program"), + system_program: parse_official_pubkey!(ks_program_ids::SYSTEM_PROGRAM_ID, "system_program"), sysvar_instructions: parse_official_pubkey!( - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, "sysvar_instructions" ), } @@ -653,7 +653,7 @@ fn build_set_collection_size( collection_mint: &crate::MdPubkey, collection_authority_record: std::option::Option<&crate::MdPubkey>, size: u64, -) -> kb_core::Result { +) -> ks_core::Result { let mint = match parse_pubkey(collection_mint, "collection_mint") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -689,9 +689,9 @@ fn build_set_collection_size( fn validate_metadata_pda( metadata: &solana_pubkey::Pubkey, mint: &solana_pubkey::Pubkey, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let program_id = match parse_str_pubkey( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, "program_id", ) { std::result::Result::Ok(value) => value, @@ -702,7 +702,7 @@ fn validate_metadata_pda( &program_id, ); if *metadata != expected { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_metadata_pda_mismatch", format!("metadata PDA {} does not match expected {}", metadata, expected), )); @@ -713,9 +713,9 @@ fn validate_metadata_pda( fn validate_edition_pda( edition: &solana_pubkey::Pubkey, mint: &solana_pubkey::Pubkey, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let program_id = match parse_str_pubkey( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, "program_id", ) { std::result::Result::Ok(value) => value, @@ -726,7 +726,7 @@ fn validate_edition_pda( &program_id, ); if *edition != expected { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_edition_pda_mismatch", format!("edition PDA {} does not match expected {}", edition, expected), )); @@ -737,10 +737,10 @@ fn validate_edition_pda( fn validate_authorized_signers( intent: &crate::ExMetaplexTokenMetadataExecutionIntent, required: &[crate::ExApiRequiredSigner], -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { for signer in required { if !intent.policy.authorized_signers.contains(&signer.pubkey) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_signer_not_authorized", format!("required signer {} is not authorized", signer.pubkey.0), )); @@ -749,13 +749,13 @@ fn validate_authorized_signers( return std::result::Result::Ok(()); } -fn parse_pubkey(value: &crate::MdPubkey, field: &str) -> kb_core::Result { +fn parse_pubkey(value: &crate::MdPubkey, field: &str) -> ks_core::Result { return parse_str_pubkey(&value.0, field); } -fn parse_str_pubkey(value: &str, field: &str) -> kb_core::Result { +fn parse_str_pubkey(value: &str, field: &str) -> ks_core::Result { return solana_pubkey::Pubkey::from_str(value).map_err(|error| { - return kb_core::Error::new( + return ks_core::Error::new( "execution_metaplex_pubkey_invalid", format!("invalid {field} public key: {error}"), ); @@ -765,7 +765,7 @@ fn parse_str_pubkey(value: &str, field: &str) -> kb_core::Result, field: &str, -) -> kb_core::Result> { +) -> ks_core::Result> { return match value { std::option::Option::Some(value) => { parse_pubkey(value, field).map(std::option::Option::Some) @@ -823,9 +823,9 @@ fn required_signers( fn validate_rule_accounts( program: std::option::Option<&crate::MdProgramId>, rules: std::option::Option<&crate::MdPubkey>, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if program.is_some() != rules.is_some() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_rule_set_accounts_incomplete", "authorization rules program and account must be supplied together", )); @@ -848,7 +848,7 @@ fn build_delegate( authorization_rules_program: std::option::Option<&crate::MdProgramId>, authorization_rules: std::option::Option<&crate::MdPubkey>, delegate_args: &mpl_token_metadata::types::DelegateArgs, -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Err(error) = validate_rule_accounts(authorization_rules_program, authorization_rules) { @@ -864,9 +864,9 @@ fn build_delegate( token: parse_optional_official_pubkey!(token, "token"), authority: parse_official_pubkey!(&authority.0, "authority"), payer: parse_official_pubkey!(&intent.fee_payer.0, "fee_payer"), - system_program: parse_official_pubkey!(kb_program_ids::SYSTEM_PROGRAM_ID, "system_program"), + system_program: parse_official_pubkey!(ks_program_ids::SYSTEM_PROGRAM_ID, "system_program"), sysvar_instructions: parse_official_pubkey!( - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, "sysvar_instructions" ), spl_token_program: match spl_token_program { @@ -908,7 +908,7 @@ fn build_revoke( authorization_rules_program: std::option::Option<&crate::MdProgramId>, authorization_rules: std::option::Option<&crate::MdPubkey>, revoke_args: &mpl_token_metadata::types::RevokeArgs, -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Err(error) = validate_rule_accounts(authorization_rules_program, authorization_rules) { @@ -924,9 +924,9 @@ fn build_revoke( token: parse_optional_official_pubkey!(token, "token"), authority: parse_official_pubkey!(&authority.0, "authority"), payer: parse_official_pubkey!(&intent.fee_payer.0, "fee_payer"), - system_program: parse_official_pubkey!(kb_program_ids::SYSTEM_PROGRAM_ID, "system_program"), + system_program: parse_official_pubkey!(ks_program_ids::SYSTEM_PROGRAM_ID, "system_program"), sysvar_instructions: parse_official_pubkey!( - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, "sysvar_instructions" ), spl_token_program: match spl_token_program { @@ -967,7 +967,7 @@ fn build_lock( authorization_rules_program: std::option::Option<&crate::MdProgramId>, authorization_rules: std::option::Option<&crate::MdPubkey>, lock_args: &mpl_token_metadata::types::LockArgs, -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Err(error) = validate_rule_accounts(authorization_rules_program, authorization_rules) { @@ -982,9 +982,9 @@ fn build_lock( edition: parse_optional_official_pubkey!(edition, "edition"), token_record: parse_optional_official_pubkey!(token_record, "token_record"), payer: parse_official_pubkey!(&intent.fee_payer.0, "fee_payer"), - system_program: parse_official_pubkey!(kb_program_ids::SYSTEM_PROGRAM_ID, "system_program"), + system_program: parse_official_pubkey!(ks_program_ids::SYSTEM_PROGRAM_ID, "system_program"), sysvar_instructions: parse_official_pubkey!( - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, "sysvar_instructions" ), spl_token_program: match spl_token_program { @@ -1025,7 +1025,7 @@ fn build_unlock( authorization_rules_program: std::option::Option<&crate::MdProgramId>, authorization_rules: std::option::Option<&crate::MdPubkey>, unlock_args: &mpl_token_metadata::types::UnlockArgs, -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Err(error) = validate_rule_accounts(authorization_rules_program, authorization_rules) { @@ -1040,9 +1040,9 @@ fn build_unlock( edition: parse_optional_official_pubkey!(edition, "edition"), token_record: parse_optional_official_pubkey!(token_record, "token_record"), payer: parse_official_pubkey!(&intent.fee_payer.0, "fee_payer"), - system_program: parse_official_pubkey!(kb_program_ids::SYSTEM_PROGRAM_ID, "system_program"), + system_program: parse_official_pubkey!(ks_program_ids::SYSTEM_PROGRAM_ID, "system_program"), sysvar_instructions: parse_official_pubkey!( - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, "sysvar_instructions" ), spl_token_program: match spl_token_program { @@ -1085,7 +1085,7 @@ fn build_transfer( authorization_rules_program: std::option::Option<&crate::MdProgramId>, authorization_rules: std::option::Option<&crate::MdPubkey>, transfer_args: &mpl_token_metadata::types::TransferArgs, -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Err(error) = validate_rule_accounts(authorization_rules_program, authorization_rules) { @@ -1106,17 +1106,17 @@ fn build_transfer( ), authority: parse_official_pubkey!(&authority.0, "authority"), payer: parse_official_pubkey!(&intent.fee_payer.0, "fee_payer"), - system_program: parse_official_pubkey!(kb_program_ids::SYSTEM_PROGRAM_ID, "system_program"), + system_program: parse_official_pubkey!(ks_program_ids::SYSTEM_PROGRAM_ID, "system_program"), sysvar_instructions: parse_official_pubkey!( - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, "sysvar_instructions" ), spl_token_program: parse_official_pubkey!( - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, "spl_token_program" ), spl_ata_program: parse_official_pubkey!( - kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID, + ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID, "spl_ata_program" ), authorization_rules_program: match authorization_rules_program { @@ -1151,7 +1151,7 @@ fn build_burn( edition_marker: std::option::Option<&crate::MdPubkey>, token_record: std::option::Option<&crate::MdPubkey>, burn_args: &mpl_token_metadata::types::BurnArgs, -) -> kb_core::Result { +) -> ks_core::Result { let official = mpl_token_metadata::instructions::Burn { authority: parse_official_pubkey!(&authority.0, "authority"), collection_metadata: parse_optional_official_pubkey!( @@ -1173,13 +1173,13 @@ fn build_burn( ), edition_marker: parse_optional_official_pubkey!(edition_marker, "edition_marker"), token_record: parse_optional_official_pubkey!(token_record, "token_record"), - system_program: parse_official_pubkey!(kb_program_ids::SYSTEM_PROGRAM_ID, "system_program"), + system_program: parse_official_pubkey!(ks_program_ids::SYSTEM_PROGRAM_ID, "system_program"), sysvar_instructions: parse_official_pubkey!( - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, "sysvar_instructions" ), spl_token_program: parse_official_pubkey!( - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, "spl_token_program" ), } @@ -1195,7 +1195,7 @@ fn build_close_accounts( mint: &crate::MdPubkey, authority: &crate::MdPubkey, destination: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { let official = mpl_token_metadata::instructions::CloseAccounts { metadata: parse_official_pubkey!(&metadata.0, "metadata"), edition: parse_official_pubkey!(&edition.0, "edition"), @@ -1228,7 +1228,7 @@ fn build_print( sysvar_instructions: &crate::MdPubkey, system_program: &crate::MdPubkey, args: &mpl_token_metadata::types::PrintArgs, -) -> kb_core::Result { +) -> ks_core::Result { let mut builder = mpl_token_metadata::instructions::PrintBuilder::new(); builder .edition_metadata(parse_official_pubkey!(&edition_metadata.0, "edition_metadata")) @@ -1280,7 +1280,7 @@ fn build_resize( authority: std::option::Option<&crate::MdPubkey>, token: std::option::Option<&crate::MdPubkey>, system_program: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { let mut builder = mpl_token_metadata::instructions::ResizeBuilder::new(); builder .metadata(parse_official_pubkey!(&metadata.0, "metadata")) @@ -1298,7 +1298,7 @@ fn build_idl_instruction_trailing_optional_no_args( discriminator: u8, accounts: &[(&crate::MdPubkey, bool, bool)], trailing_account: std::option::Option<(&crate::MdPubkey, bool, bool)>, -) -> kb_core::Result { +) -> ks_core::Result { let mut exact_accounts = accounts.to_vec(); if let std::option::Option::Some(value) = trailing_account { exact_accounts.push(value); @@ -1311,7 +1311,7 @@ fn build_idl_instruction_trailing_optional_with_args, args: &T, -) -> kb_core::Result { +) -> ks_core::Result { let mut exact_accounts = accounts.to_vec(); if let std::option::Option::Some(value) = trailing_account { exact_accounts.push(value); @@ -1322,7 +1322,7 @@ fn build_idl_instruction_trailing_optional_with_args, bool, bool)], -) -> kb_core::Result { +) -> ks_core::Result { return build_idl_instruction_optional(discriminator, accounts, std::option::Option::None); } @@ -1330,11 +1330,11 @@ fn build_idl_instruction_optional_with_args( discriminator: u8, accounts: &[(std::option::Option<&crate::MdPubkey>, bool, bool)], args: &T, -) -> kb_core::Result { +) -> ks_core::Result { let encoded = match borsh_0_10::BorshSerialize::try_to_vec(args) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_arguments_serialize_failed", error.to_string(), )); @@ -1351,9 +1351,9 @@ fn build_idl_instruction_optional( discriminator: u8, accounts: &[(std::option::Option<&crate::MdPubkey>, bool, bool)], encoded_args: std::option::Option>, -) -> kb_core::Result { +) -> ks_core::Result { let program_id = match parse_str_pubkey( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, "program_id", ) { std::result::Result::Ok(value) => value, @@ -1396,7 +1396,7 @@ fn build_idl_instruction_optional( fn build_idl_instruction_no_args( discriminator: u8, accounts: &[(&crate::MdPubkey, bool, bool)], -) -> kb_core::Result { +) -> ks_core::Result { return build_idl_instruction(discriminator, accounts, std::option::Option::None); } @@ -1404,11 +1404,11 @@ fn build_idl_instruction_with_args( discriminator: u8, accounts: &[(&crate::MdPubkey, bool, bool)], args: &T, -) -> kb_core::Result { +) -> ks_core::Result { let encoded = match borsh_0_10::BorshSerialize::try_to_vec(args) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_arguments_serialize_failed", error.to_string(), )); @@ -1421,9 +1421,9 @@ fn build_idl_instruction( discriminator: u8, accounts: &[(&crate::MdPubkey, bool, bool)], encoded_args: std::option::Option>, -) -> kb_core::Result { +) -> ks_core::Result { let program_id = match parse_str_pubkey( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, "program_id", ) { std::result::Result::Ok(value) => value, @@ -1482,7 +1482,7 @@ mod tests { intent.allow_deprecated_operation = false; let result = super::validate_intent(&intent); assert_eq!( - result.as_ref().err().map(kb_core::Error::code), + result.as_ref().err().map(ks_core::Error::code), std::option::Option::Some("execution_metaplex_deprecated_operation_not_approved"), ); } @@ -1494,7 +1494,7 @@ mod tests { intent.policy.cost_limit.max_spend_lamports = std::option::Option::Some(9_999); let spend_result = super::validate_intent(&intent); assert_eq!( - spend_result.as_ref().err().map(kb_core::Error::code), + spend_result.as_ref().err().map(ks_core::Error::code), std::option::Option::Some("execution_metaplex_spend_limit_insufficient"), ); intent.policy.cost_limit.max_spend_lamports = std::option::Option::Some(10_000); @@ -1505,7 +1505,7 @@ mod tests { #[test] fn metadata_and_edition_pda_validation_is_exact() { let program_id_result = super::parse_str_pubkey( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, "program_id", ); assert!(program_id_result.is_ok()); @@ -1527,12 +1527,12 @@ mod tests { let wrong = solana_pubkey::Pubkey::new_unique(); let metadata_result = super::validate_metadata_pda(&wrong, &mint); assert_eq!( - metadata_result.as_ref().err().map(kb_core::Error::code), + metadata_result.as_ref().err().map(ks_core::Error::code), std::option::Option::Some("execution_metaplex_metadata_pda_mismatch"), ); let edition_result = super::validate_edition_pda(&wrong, &mint); assert_eq!( - edition_result.as_ref().err().map(kb_core::Error::code), + edition_result.as_ref().err().map(ks_core::Error::code), std::option::Option::Some("execution_metaplex_edition_pda_mismatch"), ); } @@ -1551,7 +1551,7 @@ mod tests { assert_eq!(plan.instructions.len(), 1); assert_eq!( plan.instructions[0].program_id.0, - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ); assert_eq!(plan.instructions[0].data.first().copied(), std::option::Option::Some(14),); assert_eq!(plan.required_signers.len(), 1); @@ -1709,7 +1709,7 @@ mod tests { .map(|_| return crate::MdPubkey(solana_pubkey::Pubkey::new_unique().to_string())) .collect(); let program_id = match super::parse_str_pubkey( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, "program_id", ) { std::result::Result::Ok(value) => value, @@ -1884,7 +1884,7 @@ mod tests { .map(|_| return crate::MdPubkey(solana_pubkey::Pubkey::new_unique().to_string())) .collect(); let program_id = match super::parse_str_pubkey( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, "program_id", ) { std::result::Result::Ok(value) => value, diff --git a/kb-lib/src/executor/metadata/metaplex_token_metadata/executor.rs b/ks-lib/src/executor/metadata/metaplex_token_metadata/executor.rs similarity index 92% rename from kb-lib/src/executor/metadata/metaplex_token_metadata/executor.rs rename to ks-lib/src/executor/metadata/metaplex_token_metadata/executor.rs index b48380a..49cb712 100644 --- a/kb-lib/src/executor/metadata/metaplex_token_metadata/executor.rs +++ b/ks-lib/src/executor/metadata/metaplex_token_metadata/executor.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/metadata/metaplex_token_metadata/executor.rs -// version: 6 +// file: ks-lib/src/executor/metadata/metaplex_token_metadata/executor.rs +// version: 7 //! Exact Metaplex Token Metadata capability dispatch. @@ -13,7 +13,7 @@ impl crate::ExMetadataMetaplexTokenMetadataExecutor { program_id: &crate::MdProgramId, operation_code: &str, ) -> crate::ExApiExecutionCapability { - if program_id.0 != kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID { + if program_id.0 != ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID { return crate::ExApiExecutionCapability::unsupported( "execution_metaplex_program_not_owned", format!("program {} is not Metaplex Token Metadata", program_id.0), @@ -43,7 +43,7 @@ impl crate::ExApiTypedInstructionExecutor for crate::ExMetadataMetaplexTokenMeta fn build_prepared_plan( &self, intent: &Self::Intent, - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::executor_metaplex_token_metadata_build_prepared_plan(intent); } } @@ -58,7 +58,7 @@ impl crate::ExApiInstructionExecutor for crate::ExMetadataMetaplexTokenMetadataE } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID]; + return &[ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID]; } fn supports_request( @@ -78,11 +78,11 @@ impl crate::ExApiInstructionExecutor for crate::ExMetadataMetaplexTokenMetadataE fn build_plan( &self, request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { match self.exact_capability(&request.program_id, &request.operation_code) { crate::ExApiExecutionCapability::Supported { operation_code: _ } => {}, crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => { - return std::result::Result::Err(kb_core::Error::new(reason_code, reason)); + return std::result::Result::Err(ks_core::Error::new(reason_code, reason)); }, } let intent = match serde_json::from_str::( @@ -90,14 +90,14 @@ impl crate::ExApiInstructionExecutor for crate::ExMetadataMetaplexTokenMetadataE ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_intent_deserialize_failed", error.to_string(), )); }, }; if intent.operation.operation_code() != request.operation_code { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_operation_code_mismatch", "request operation code does not match the typed Metaplex intent", )); @@ -109,7 +109,7 @@ impl crate::ExApiInstructionExecutor for crate::ExMetadataMetaplexTokenMetadataE let payload_value = match serde_json::to_value(&prepared) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_plan_serialize_failed", error.to_string(), )); @@ -154,7 +154,7 @@ mod tests { fn capability_is_exact_for_program_and_operation() { let executor = crate::ExMetadataMetaplexTokenMetadataExecutor; let program_id = crate::MdProgramId( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(), + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(), ); let supported = ::capability( &executor, @@ -182,7 +182,7 @@ mod tests { assert!(matches!(unknown, crate::ExApiExecutionCapability::Unsupported { .. })); let foreign = ::capability( &executor, - &crate::MdProgramId(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), + &crate::MdProgramId(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), crate::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION, ); assert!(matches!(foreign, crate::ExApiExecutionCapability::Unsupported { .. })); @@ -201,7 +201,7 @@ mod tests { }; let request = crate::ExApiExecutionRequest { program_id: crate::MdProgramId( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(), + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(), ), operation_code: crate::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION.to_string(), payload_json, @@ -211,7 +211,7 @@ mod tests { &request, ); assert_eq!( - result.as_ref().err().map(kb_core::Error::code), + result.as_ref().err().map(ks_core::Error::code), std::option::Option::Some("execution_operation_code_mismatch"), ); } @@ -238,7 +238,7 @@ mod tests { }; let request = crate::ExApiExecutionRequest { program_id: crate::MdProgramId( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(), + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(), ), operation_code: crate::EX_METAPLEX_TOKEN_METADATA_PUFF_METADATA_OPERATION.to_string(), payload_json, diff --git a/kb-lib/src/executor/metadata/metaplex_token_metadata/intent.rs b/ks-lib/src/executor/metadata/metaplex_token_metadata/intent.rs similarity index 99% rename from kb-lib/src/executor/metadata/metaplex_token_metadata/intent.rs rename to ks-lib/src/executor/metadata/metaplex_token_metadata/intent.rs index 4426c26..f62b4f4 100644 --- a/kb-lib/src/executor/metadata/metaplex_token_metadata/intent.rs +++ b/ks-lib/src/executor/metadata/metaplex_token_metadata/intent.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/metadata/metaplex_token_metadata/intent.rs -// version: 10 +// file: ks-lib/src/executor/metadata/metaplex_token_metadata/intent.rs +// version: 11 //! Typed current and deprecated Metaplex Token Metadata execution intents. @@ -168,7 +168,7 @@ pub const EX_METAPLEX_TOKEN_METADATA_SUPPORTED_OPERATION_CODES: &[&str] = &[ #[serde(tag = "operation", rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/metadata/metaplex_token_metadata/intent/ExMetaplexTokenMetadataOperation.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/metaplex_token_metadata/intent/ExMetaplexTokenMetadataOperation.ts" )] pub enum ExMetaplexTokenMetadataOperation { /// Build the current Create wrapper with `CreateArgs::V1`. @@ -1030,7 +1030,7 @@ impl crate::ExMetaplexTokenMetadataOperation { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/metadata/metaplex_token_metadata/intent/ExMetaplexTokenMetadataExecutionIntent.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/metaplex_token_metadata/intent/ExMetaplexTokenMetadataExecutionIntent.ts" )] pub struct ExMetaplexTokenMetadataExecutionIntent { /// Stable caller-provided identifier used for logs and replay correlation. diff --git a/kb-lib/src/executor/metadata/solana_program_metadata.rs b/ks-lib/src/executor/metadata/solana_program_metadata.rs similarity index 97% rename from kb-lib/src/executor/metadata/solana_program_metadata.rs rename to ks-lib/src/executor/metadata/solana_program_metadata.rs index 6b94a69..9b07867 100644 --- a/kb-lib/src/executor/metadata/solana_program_metadata.rs +++ b/ks-lib/src/executor/metadata/solana_program_metadata.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/metadata/solana_program_metadata.rs -// version: 2 +// file: ks-lib/src/executor/metadata/solana_program_metadata.rs +// version: 3 //! Typed executor for Solana Program Metadata. diff --git a/kb-lib/src/executor/metadata/solana_program_metadata/builder.rs b/ks-lib/src/executor/metadata/solana_program_metadata/builder.rs similarity index 91% rename from kb-lib/src/executor/metadata/solana_program_metadata/builder.rs rename to ks-lib/src/executor/metadata/solana_program_metadata/builder.rs index 1d42c12..f072dd1 100644 --- a/kb-lib/src/executor/metadata/solana_program_metadata/builder.rs +++ b/ks-lib/src/executor/metadata/solana_program_metadata/builder.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/metadata/solana_program_metadata/builder.rs -// version: 1 +// file: ks-lib/src/executor/metadata/solana_program_metadata/builder.rs +// version: 2 //! Exact Solana Program Metadata builders and safety integration. @@ -15,7 +15,7 @@ struct BuiltOperation { pub fn executor_metadata_solana_program_metadata_derive_canonical_pda( program: &crate::MdPubkey, seed: &[u8], -) -> kb_core::Result { +) -> ks_core::Result { let program_key = match parse_pubkey(program, "program") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -25,7 +25,7 @@ pub fn executor_metadata_solana_program_metadata_derive_canonical_pda( std::result::Result::Err(error) => return std::result::Result::Err(error), }; if seed.len() != crate::DC_METADATA_SPM_SEED_BYTES { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_seed_length_invalid", format!( "Solana Program Metadata seed requires {} bytes, received {}", @@ -46,7 +46,7 @@ pub fn executor_metadata_solana_program_metadata_derive_non_canonical_pda( program: &crate::MdPubkey, authority: &crate::MdPubkey, seed: &[u8], -) -> kb_core::Result { +) -> ks_core::Result { let program_key = match parse_pubkey(program, "program") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -60,7 +60,7 @@ pub fn executor_metadata_solana_program_metadata_derive_non_canonical_pda( std::result::Result::Err(error) => return std::result::Result::Err(error), }; if seed.len() != crate::DC_METADATA_SPM_SEED_BYTES { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_seed_length_invalid", format!( "Solana Program Metadata seed requires {} bytes, received {}", @@ -78,15 +78,15 @@ pub fn executor_metadata_solana_program_metadata_derive_non_canonical_pda( pub(crate) fn executor_metadata_solana_program_metadata_build_prepared_plan( intent: &crate::ExMetadataSpmExecutionIntent, -) -> kb_core::Result { +) -> ks_core::Result { if intent.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_intent_id_empty", "Solana Program Metadata execution intent id must not be empty", )); } if intent.policy.simulation != crate::ExApiExecutionSimulationPolicy::Required { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_simulation_required", "Solana Program Metadata execution requires RPC simulation", )); @@ -97,13 +97,13 @@ pub(crate) fn executor_metadata_solana_program_metadata_build_prepared_plan( || !validation.decode_replay_required || !validation.materialization_required { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_post_validation_required", "Solana Program Metadata execution requires canonical insert, core extraction, decode replay and materialization", )); } if intent.operation.requires_explicit_approval() && !intent.allow_destructive_operation { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_destructive_approval_required", format!( "operation {} requires explicit destructive-operation approval", @@ -159,7 +159,7 @@ pub(crate) fn executor_metadata_solana_program_metadata_build_prepared_plan( "common safety policy denied the prepared plan".to_string() }, }; - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_safety_denied", detail, )); @@ -167,7 +167,7 @@ pub(crate) fn executor_metadata_solana_program_metadata_build_prepared_plan( return std::result::Result::Ok(plan); } -fn build_operation(operation: &crate::ExMetadataSpmOperation) -> kb_core::Result { +fn build_operation(operation: &crate::ExMetadataSpmOperation) -> ks_core::Result { return match operation { crate::ExMetadataSpmOperation::Write { buffer, authority, offset, source } => { build_write(buffer, authority, *offset, source) @@ -271,7 +271,7 @@ fn build_write( authority: &crate::MdPubkey, offset: u32, source: &crate::ExMetadataSpmWriteSource, -) -> kb_core::Result { +) -> ks_core::Result { let buffer_key = match parse_pubkey(buffer, "buffer") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -285,7 +285,7 @@ fn build_write( let source_account = match source { crate::ExMetadataSpmWriteSource::Inline { data: inline } => { if inline.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_write_data_empty", "Write inline data must not be empty", )); @@ -302,7 +302,7 @@ fn build_write( std::result::Result::Err(error) => return std::result::Result::Err(error), }; if source_key == buffer_key { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_write_source_same_as_destination", "Write source Buffer must differ from the destination Buffer", )); @@ -339,7 +339,7 @@ fn build_initialize( declared_data_source: crate::ExMetadataSpmDataSource, inline_data: std::option::Option<&crate::ExMetadataSpmDataInput>, allocate_account: bool, -) -> kb_core::Result { +) -> ks_core::Result { let metadata_key = match parse_pubkey(metadata, "metadata") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -367,13 +367,13 @@ fn build_initialize( std::result::Result::Err(error) => return std::result::Result::Err(error), }; if expected.0 != metadata_key.to_string() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_metadata_pda_mismatch", format!("metadata account {} does not match expected PDA {}", metadata.0, expected.0), )); } if allocate_account && inline_data.is_none() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_initialize_data_missing", "Initialize with System Program allocation requires inline data", )); @@ -386,7 +386,7 @@ fn build_initialize( data.push(declared_data_source.wire_value()); if let std::option::Option::Some(value) = inline_data { if value.data_source() != declared_data_source { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_data_source_mismatch", "Initialize inline data does not match the declared data source", )); @@ -414,7 +414,7 @@ fn build_initialize( }; let system_account = if allocate_account { planned_account( - crate::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), + crate::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), false, false, ) @@ -443,7 +443,7 @@ fn build_set_authority( authority: &crate::MdPubkey, new_authority: std::option::Option<&crate::MdPubkey>, program_context: std::option::Option<&crate::ExMetadataSpmProgramContext>, -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Err(error) = validate_pubkeys(&[(account, "account"), (authority, "authority")]) { @@ -489,7 +489,7 @@ fn build_set_data( format: crate::ExMetadataSpmFormat, source: &crate::ExMetadataSpmSetDataSource, program_context: std::option::Option<&crate::ExMetadataSpmProgramContext>, -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Err(error) = validate_pubkeys(&[(metadata, "metadata"), (authority, "authority")]) { @@ -518,7 +518,7 @@ fn build_set_data( return std::result::Result::Err(error); } if buffer == metadata { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_set_data_buffer_same_as_metadata", "SetData source Buffer must differ from the Metadata account", )); @@ -552,7 +552,7 @@ fn build_set_immutable( metadata: &crate::MdPubkey, authority: &crate::MdPubkey, program_context: std::option::Option<&crate::ExMetadataSpmProgramContext>, -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Err(error) = validate_pubkeys(&[(metadata, "metadata"), (authority, "authority")]) { @@ -583,7 +583,7 @@ fn build_trim( authority: &crate::MdPubkey, destination: &crate::MdPubkey, program_context: std::option::Option<&crate::ExMetadataSpmProgramContext>, -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Err(error) = validate_destination_contract(account, authority, destination) { @@ -605,7 +605,7 @@ fn build_trim( program_data_account, planned_account(destination.clone(), false, true), planned_account( - crate::MdPubkey(kb_program_ids::SYSVAR_RENT_PROGRAM_ID.to_string()), + crate::MdPubkey(ks_program_ids::SYSVAR_RENT_PROGRAM_ID.to_string()), false, false, ), @@ -620,7 +620,7 @@ fn build_close( authority: &crate::MdPubkey, destination: &crate::MdPubkey, program_context: std::option::Option<&crate::ExMetadataSpmProgramContext>, -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Err(error) = validate_destination_contract(account, authority, destination) { @@ -654,7 +654,7 @@ fn build_allocate( program_context: std::option::Option<&crate::ExMetadataSpmProgramContext>, canonical: bool, allocate_account: bool, -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Err(error) = validate_pubkeys(&[(buffer, "buffer"), (authority, "authority")]) { @@ -669,7 +669,7 @@ fn build_allocate( let context = match program_context { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_allocate_program_context_required", "PDA Buffer allocation requires an executable program context", )); @@ -692,7 +692,7 @@ fn build_allocate( std::result::Result::Err(error) => return std::result::Result::Err(error), }; if expected != *buffer { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_allocate_buffer_pda_mismatch", format!( "buffer account {} does not match expected PDA {}", @@ -704,13 +704,13 @@ fn build_allocate( }, std::option::Option::None => { if canonical { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_allocate_keypair_canonical_invalid", "keypair Buffer allocation cannot be canonical", )); } if buffer != authority { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_allocate_keypair_authority_mismatch", "keypair Buffer allocation requires the Buffer account and authority to be identical", )); @@ -723,7 +723,7 @@ fn build_allocate( }; let system_account = if allocate_account { planned_account( - crate::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), + crate::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), false, false, ) @@ -752,14 +752,14 @@ fn build_extend( authority: &crate::MdPubkey, length: u16, program_context: std::option::Option<&crate::ExMetadataSpmProgramContext>, -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Err(error) = validate_pubkeys(&[(account, "account"), (authority, "authority")]) { return std::result::Result::Err(error); } if length == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_extend_length_zero", "Extend length must be positive", )); @@ -786,11 +786,11 @@ fn build_extend( }); } -fn encode_data_input(input: &crate::ExMetadataSpmDataInput) -> kb_core::Result> { +fn encode_data_input(input: &crate::ExMetadataSpmDataInput) -> ks_core::Result> { return match input { crate::ExMetadataSpmDataInput::Direct { bytes } => { if bytes.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_direct_data_empty", "direct metadata content must not be empty", )); @@ -799,7 +799,7 @@ fn encode_data_input(input: &crate::ExMetadataSpmDataInput) -> kb_core::Result { if url.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_url_empty", "metadata URL must not be empty", )); @@ -812,7 +812,7 @@ fn encode_data_input(input: &crate::ExMetadataSpmDataInput) -> kb_core::Result return std::result::Result::Err(error), }; if *length == std::option::Option::Some(0) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_external_length_zero", "external metadata length must be absent or positive", )); @@ -832,7 +832,7 @@ fn encode_data_input(input: &crate::ExMetadataSpmDataInput) -> kb_core::Result, -) -> kb_core::Result<(crate::ExApiPlannedAccount, crate::ExApiPlannedAccount)> { +) -> ks_core::Result<(crate::ExApiPlannedAccount, crate::ExApiPlannedAccount)> { return match context { std::option::Option::Some(value) => { if let std::result::Result::Err(error) = @@ -867,7 +867,7 @@ fn validate_destination_contract( account: &crate::MdPubkey, authority: &crate::MdPubkey, destination: &crate::MdPubkey, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if let std::result::Result::Err(error) = validate_pubkeys(&[ (account, "account"), (authority, "authority"), @@ -876,7 +876,7 @@ fn validate_destination_contract( return std::result::Result::Err(error); } if account == destination { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_destination_same_as_account", "destination must differ from the account being trimmed or closed", )); @@ -884,9 +884,9 @@ fn validate_destination_contract( return std::result::Result::Ok(()); } -fn validate_seed(seed: &[u8]) -> kb_core::Result<()> { +fn validate_seed(seed: &[u8]) -> ks_core::Result<()> { if seed.len() != crate::DC_METADATA_SPM_SEED_BYTES { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_seed_length_invalid", format!( "Solana Program Metadata seed requires {} bytes, received {}", @@ -898,9 +898,9 @@ fn validate_seed(seed: &[u8]) -> kb_core::Result<()> { return std::result::Result::Ok(()); } -fn validate_inline_length(length: usize, operation: &str) -> kb_core::Result<()> { +fn validate_inline_length(length: usize, operation: &str) -> ks_core::Result<()> { if length > crate::EX_METADATA_SPM_MAX_INLINE_DATA_BYTES { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_inline_data_too_large", format!( "{operation} instruction payload exceeds {} bytes", @@ -911,7 +911,7 @@ fn validate_inline_length(length: usize, operation: &str) -> kb_core::Result<()> return std::result::Result::Ok(()); } -fn validate_pubkeys(values: &[(&crate::MdPubkey, &str)]) -> kb_core::Result<()> { +fn validate_pubkeys(values: &[(&crate::MdPubkey, &str)]) -> ks_core::Result<()> { for (value, role) in values { match parse_pubkey(value, role) { std::result::Result::Ok(_) => {}, @@ -921,22 +921,22 @@ fn validate_pubkeys(values: &[(&crate::MdPubkey, &str)]) -> kb_core::Result<()> return std::result::Result::Ok(()); } -fn parse_pubkey(value: &crate::MdPubkey, role: &str) -> kb_core::Result { +fn parse_pubkey(value: &crate::MdPubkey, role: &str) -> ks_core::Result { return match solana_pubkey::Pubkey::from_str(&value.0) { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_pubkey_invalid", format!("invalid {role} public key: {error}"), )), }; } -fn metadata_program_id() -> kb_core::Result { +fn metadata_program_id() -> ks_core::Result { return match solana_pubkey::Pubkey::from_str( - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_program_id_invalid", error.to_string(), )), @@ -945,7 +945,7 @@ fn metadata_program_id() -> kb_core::Result { fn optional_placeholder_account(writable: bool) -> crate::ExApiPlannedAccount { return planned_account( - crate::MdPubkey(kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string()), + crate::MdPubkey(ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string()), false, writable, ); @@ -966,7 +966,7 @@ fn instruction( ) -> crate::ExApiPlannedInstruction { return crate::ExApiPlannedInstruction { program_id: crate::MdProgramId( - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), ), operation_code: operation_code.to_string(), accounts, @@ -1022,8 +1022,8 @@ mod tests { #[test] fn pda_helpers_match_the_exact_seed_contract() { - let program = pubkey(kb_program_ids::VOTE_PROGRAM_ID); - let authority = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); + let program = pubkey(ks_program_ids::VOTE_PROGRAM_ID); + let authority = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); let seed = vec![7_u8; crate::DC_METADATA_SPM_SEED_BYTES]; let canonical = crate::executor_metadata_solana_program_metadata_derive_canonical_pda(&program, &seed); @@ -1046,10 +1046,10 @@ mod tests { #[test] fn all_nine_operations_build_exact_tags_and_account_counts() { - let authority = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); - let account = pubkey(kb_program_ids::VOTE_PROGRAM_ID); - let destination = pubkey(kb_program_ids::STAKE_PROGRAM_ID); - let program = pubkey(kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID); + let authority = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); + let account = pubkey(ks_program_ids::VOTE_PROGRAM_ID); + let destination = pubkey(ks_program_ids::STAKE_PROGRAM_ID); + let program = pubkey(ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID); let seed = vec![1_u8; crate::DC_METADATA_SPM_SEED_BYTES]; let metadata = crate::executor_metadata_solana_program_metadata_derive_non_canonical_pda( &program, &authority, &seed, @@ -1148,8 +1148,8 @@ mod tests { #[test] fn initialize_canonicity_is_explicit_without_program_data_inference() { - let authority = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); - let program = pubkey(kb_program_ids::VOTE_PROGRAM_ID); + let authority = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); + let program = pubkey(ks_program_ids::VOTE_PROGRAM_ID); let seed = vec![2_u8; crate::DC_METADATA_SPM_SEED_BYTES]; let metadata = crate::executor_metadata_solana_program_metadata_derive_canonical_pda(&program, &seed); @@ -1181,9 +1181,9 @@ mod tests { #[test] fn inline_content_is_bounded_and_large_content_requires_a_buffer() { - let authority = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); + let authority = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); let value = intent(crate::ExMetadataSpmOperation::Write { - buffer: pubkey(kb_program_ids::VOTE_PROGRAM_ID), + buffer: pubkey(ks_program_ids::VOTE_PROGRAM_ID), authority, offset: 0, source: crate::ExMetadataSpmWriteSource::Inline { @@ -1192,16 +1192,16 @@ mod tests { }); let result = crate::executor_metadata_solana_program_metadata_build_prepared_plan(&value); assert_eq!( - result.as_ref().err().map(kb_core::Error::code), + result.as_ref().err().map(ks_core::Error::code), std::option::Option::Some("execution_metadata_spm_inline_data_too_large") ); } #[test] fn allocate_enforces_keypair_identity_and_exact_pda_derivation() { - let authority = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); + let authority = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); let invalid_keypair = intent(crate::ExMetadataSpmOperation::Allocate { - buffer: pubkey(kb_program_ids::VOTE_PROGRAM_ID), + buffer: pubkey(ks_program_ids::VOTE_PROGRAM_ID), authority: authority.clone(), seed: std::option::Option::None, program_context: std::option::Option::None, @@ -1211,12 +1211,12 @@ mod tests { let invalid_keypair_result = crate::executor_metadata_solana_program_metadata_build_prepared_plan(&invalid_keypair); assert_eq!( - invalid_keypair_result.as_ref().err().map(kb_core::Error::code), + invalid_keypair_result.as_ref().err().map(ks_core::Error::code), std::option::Option::Some("execution_metadata_spm_allocate_keypair_authority_mismatch") ); let seed = vec![4_u8; crate::DC_METADATA_SPM_SEED_BYTES]; let context = crate::ExMetadataSpmProgramContext { - program: pubkey(kb_program_ids::VOTE_PROGRAM_ID), + program: pubkey(ks_program_ids::VOTE_PROGRAM_ID), program_data: std::option::Option::None, }; let expected = crate::executor_metadata_solana_program_metadata_derive_non_canonical_pda( @@ -1245,17 +1245,17 @@ mod tests { #[test] fn destructive_operations_require_approval_and_common_safety() { - let authority = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); + let authority = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); let mut value = intent(crate::ExMetadataSpmOperation::Close { - account: pubkey(kb_program_ids::VOTE_PROGRAM_ID), + account: pubkey(ks_program_ids::VOTE_PROGRAM_ID), authority: authority.clone(), - destination: pubkey(kb_program_ids::STAKE_PROGRAM_ID), + destination: pubkey(ks_program_ids::STAKE_PROGRAM_ID), program_context: std::option::Option::None, }); value.allow_destructive_operation = false; let denied = crate::executor_metadata_solana_program_metadata_build_prepared_plan(&value); assert_eq!( - denied.as_ref().err().map(kb_core::Error::code), + denied.as_ref().err().map(ks_core::Error::code), std::option::Option::Some("execution_metadata_spm_destructive_approval_required") ); value.allow_destructive_operation = true; @@ -1263,7 +1263,7 @@ mod tests { let denied_plan = crate::executor_metadata_solana_program_metadata_build_prepared_plan(&value); assert_eq!( - denied_plan.as_ref().err().map(kb_core::Error::code), + denied_plan.as_ref().err().map(ks_core::Error::code), std::option::Option::Some("execution_metadata_spm_safety_denied") ); } diff --git a/kb-lib/src/executor/metadata/solana_program_metadata/constants.rs b/ks-lib/src/executor/metadata/solana_program_metadata/constants.rs similarity index 97% rename from kb-lib/src/executor/metadata/solana_program_metadata/constants.rs rename to ks-lib/src/executor/metadata/solana_program_metadata/constants.rs index fc9dc05..830041e 100644 --- a/kb-lib/src/executor/metadata/solana_program_metadata/constants.rs +++ b/ks-lib/src/executor/metadata/solana_program_metadata/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/metadata/solana_program_metadata/constants.rs -// version: 1 +// file: ks-lib/src/executor/metadata/solana_program_metadata/constants.rs +// version: 2 //! Stable Solana Program Metadata executor constants. diff --git a/kb-lib/src/executor/metadata/solana_program_metadata/executor.rs b/ks-lib/src/executor/metadata/solana_program_metadata/executor.rs similarity index 90% rename from kb-lib/src/executor/metadata/solana_program_metadata/executor.rs rename to ks-lib/src/executor/metadata/solana_program_metadata/executor.rs index 3862d8d..94131d0 100644 --- a/kb-lib/src/executor/metadata/solana_program_metadata/executor.rs +++ b/ks-lib/src/executor/metadata/solana_program_metadata/executor.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/metadata/solana_program_metadata/executor.rs -// version: 1 +// file: ks-lib/src/executor/metadata/solana_program_metadata/executor.rs +// version: 2 //! Exact capability dispatch for Solana Program Metadata. @@ -13,7 +13,7 @@ impl crate::ExMetadataSolanaProgramMetadataExecutor { program_id: &crate::MdProgramId, operation_code: &str, ) -> crate::ExApiExecutionCapability { - if program_id.0 != kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID { + if program_id.0 != ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID { return crate::ExApiExecutionCapability::unsupported( "execution_metadata_spm_program_not_owned", format!("program {} is not Solana Program Metadata", program_id.0), @@ -46,16 +46,16 @@ impl crate::ExApiTypedInstructionExecutor for crate::ExMetadataSolanaProgramMeta fn build_prepared_plan( &self, intent: &Self::Intent, - ) -> kb_core::Result { + ) -> ks_core::Result { let program_id = crate::MdProgramId( - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), ); return match self.exact_capability(&program_id, intent.operation.operation_code()) { crate::ExApiExecutionCapability::Supported { operation_code: _ } => { crate::executor_metadata_solana_program_metadata_build_prepared_plan(intent) }, crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => { - std::result::Result::Err(kb_core::Error::new(reason_code, reason)) + std::result::Result::Err(ks_core::Error::new(reason_code, reason)) }, }; } @@ -71,7 +71,7 @@ impl crate::ExApiInstructionExecutor for crate::ExMetadataSolanaProgramMetadataE } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID]; + return &[ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID]; } fn supports_request( @@ -91,11 +91,11 @@ impl crate::ExApiInstructionExecutor for crate::ExMetadataSolanaProgramMetadataE fn build_plan( &self, request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { match self.exact_capability(&request.program_id, &request.operation_code) { crate::ExApiExecutionCapability::Supported { operation_code: _ } => {}, crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => { - return std::result::Result::Err(kb_core::Error::new(reason_code, reason)); + return std::result::Result::Err(ks_core::Error::new(reason_code, reason)); }, } let intent = match serde_json::from_str::( @@ -103,14 +103,14 @@ impl crate::ExApiInstructionExecutor for crate::ExMetadataSolanaProgramMetadataE ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_intent_deserialize_failed", error.to_string(), )); }, }; if intent.operation.operation_code() != request.operation_code { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_operation_code_mismatch", "request and typed Solana Program Metadata intent operations differ", )); @@ -123,7 +123,7 @@ impl crate::ExApiInstructionExecutor for crate::ExMetadataSolanaProgramMetadataE let payload = match serde_json::to_value(&prepared) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_plan_serialize_failed", error.to_string(), )); @@ -201,7 +201,7 @@ mod tests { fn capabilities_cover_exactly_the_nine_stable_operations() { let executor = crate::ExMetadataSolanaProgramMetadataExecutor; let program_id = crate::MdProgramId( - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), ); for operation in crate::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES { let capability = @@ -216,7 +216,7 @@ mod tests { assert!(!unknown.is_supported()); let foreign = crate::ExApiTypedInstructionExecutor::capability( &executor, - &crate::MdProgramId(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), + &crate::MdProgramId(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), crate::EX_METADATA_SPM_WRITE_OPERATION, ); assert!(!foreign.is_supported()); diff --git a/kb-lib/src/executor/metadata/solana_program_metadata/intent.rs b/ks-lib/src/executor/metadata/solana_program_metadata/intent.rs similarity index 95% rename from kb-lib/src/executor/metadata/solana_program_metadata/intent.rs rename to ks-lib/src/executor/metadata/solana_program_metadata/intent.rs index c2a1c80..3811bdc 100644 --- a/kb-lib/src/executor/metadata/solana_program_metadata/intent.rs +++ b/ks-lib/src/executor/metadata/solana_program_metadata/intent.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/metadata/solana_program_metadata/intent.rs -// version: 1 +// file: ks-lib/src/executor/metadata/solana_program_metadata/intent.rs +// version: 2 //! Typed intents for the Solana Program Metadata executor. @@ -11,7 +11,7 @@ use ts_rs::TS; // rust-rules: derive-import #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmEncoding.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmEncoding.ts" )] pub enum ExMetadataSpmEncoding { /// No encoding declaration. @@ -37,7 +37,7 @@ impl crate::ExMetadataSpmEncoding { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmCompression.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmCompression.ts" )] pub enum ExMetadataSpmCompression { /// No compression declaration. @@ -61,7 +61,7 @@ impl crate::ExMetadataSpmCompression { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmFormat.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmFormat.ts" )] pub enum ExMetadataSpmFormat { /// No structured format declaration. @@ -87,7 +87,7 @@ impl crate::ExMetadataSpmFormat { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmDataSource.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmDataSource.ts" )] pub enum ExMetadataSpmDataSource { /// Direct on-chain bytes. @@ -110,7 +110,7 @@ impl crate::ExMetadataSpmDataSource { #[serde(tag = "source", rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmDataInput.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmDataInput.ts" )] pub enum ExMetadataSpmDataInput { /// Direct on-chain bytes. @@ -152,7 +152,7 @@ impl crate::ExMetadataSpmDataInput { #[serde(tag = "source", rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmWriteSource.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmWriteSource.ts" )] pub enum ExMetadataSpmWriteSource { /// Inline bytes placed after the offset argument. @@ -172,7 +172,7 @@ pub enum ExMetadataSpmWriteSource { #[serde(tag = "source", rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmSetDataSource.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmSetDataSource.ts" )] pub enum ExMetadataSpmSetDataSource { /// Runtime-supported three-byte variant that preserves current data bytes. @@ -195,7 +195,7 @@ pub enum ExMetadataSpmSetDataSource { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmProgramContext.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmProgramContext.ts" )] pub struct ExMetadataSpmProgramContext { /// Executable program account. @@ -209,7 +209,7 @@ pub struct ExMetadataSpmProgramContext { #[serde(tag = "operation", rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmOperation.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmOperation.ts" )] pub enum ExMetadataSpmOperation { /// Write bytes to a Buffer account. @@ -455,7 +455,7 @@ impl crate::ExMetadataSpmOperation { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmExecutionIntent.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/metadata/solana_program_metadata/intent/ExMetadataSpmExecutionIntent.ts" )] pub struct ExMetadataSpmExecutionIntent { /// Caller-provided correlation identifier. diff --git a/kb-lib/src/executor/metadata/spl_name_service.rs b/ks-lib/src/executor/metadata/spl_name_service.rs similarity index 89% rename from kb-lib/src/executor/metadata/spl_name_service.rs rename to ks-lib/src/executor/metadata/spl_name_service.rs index 2c045d8..6df78d3 100644 --- a/kb-lib/src/executor/metadata/spl_name_service.rs +++ b/ks-lib/src/executor/metadata/spl_name_service.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/metadata/spl_name_service.rs -// version: 3 +// file: ks-lib/src/executor/metadata/spl_name_service.rs +// version: 4 //! Reserved executor for `metadata_spl_name_service`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExMetadataSplNameServiceExecutor } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::METADATA_SPL_NAME_SERVICE_PROGRAM_ID]; + return &[ks_program_ids::METADATA_SPL_NAME_SERVICE_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExMetadataSplNameServiceExecutor fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"metadata_spl_name_service"}), ) { diff --git a/kb-lib/src/executor/nft.rs b/ks-lib/src/executor/nft.rs similarity index 85% rename from kb-lib/src/executor/nft.rs rename to ks-lib/src/executor/nft.rs index f01f0c7..fc3153b 100644 --- a/kb-lib/src/executor/nft.rs +++ b/ks-lib/src/executor/nft.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/nft.rs -// version: 3 +// file: ks-lib/src/executor/nft.rs +// version: 4 //! `nft` executor family. diff --git a/kb-lib/src/executor/nft/metaplex_bubblegum.rs b/ks-lib/src/executor/nft/metaplex_bubblegum.rs similarity index 89% rename from kb-lib/src/executor/nft/metaplex_bubblegum.rs rename to ks-lib/src/executor/nft/metaplex_bubblegum.rs index 664b26f..f5f23ca 100644 --- a/kb-lib/src/executor/nft/metaplex_bubblegum.rs +++ b/ks-lib/src/executor/nft/metaplex_bubblegum.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/nft/metaplex_bubblegum.rs -// version: 3 +// file: ks-lib/src/executor/nft/metaplex_bubblegum.rs +// version: 4 //! Reserved executor for `nft_metaplex_bubblegum`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExNftMetaplexBubblegumExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::NFT_METAPLEX_BUBBLEGUM_PROGRAM_ID]; + return &[ks_program_ids::NFT_METAPLEX_BUBBLEGUM_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExNftMetaplexBubblegumExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"nft_metaplex_bubblegum"}), ) { diff --git a/kb-lib/src/executor/nft/tensor_cnft.rs b/ks-lib/src/executor/nft/tensor_cnft.rs similarity index 89% rename from kb-lib/src/executor/nft/tensor_cnft.rs rename to ks-lib/src/executor/nft/tensor_cnft.rs index c774ea8..cd71449 100644 --- a/kb-lib/src/executor/nft/tensor_cnft.rs +++ b/ks-lib/src/executor/nft/tensor_cnft.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/nft/tensor_cnft.rs -// version: 1 +// file: ks-lib/src/executor/nft/tensor_cnft.rs +// version: 2 //! Reserved executor for `nft_tensor_cnft`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExNftTensorCnftExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::NFT_TENSOR_CNFT_PROGRAM_ID]; + return &[ks_program_ids::NFT_TENSOR_CNFT_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExNftTensorCnftExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"nft_tensor_cnft"}), ) { diff --git a/kb-lib/src/executor/orderbook.rs b/ks-lib/src/executor/orderbook.rs similarity index 90% rename from kb-lib/src/executor/orderbook.rs rename to ks-lib/src/executor/orderbook.rs index 322ee33..00af614 100644 --- a/kb-lib/src/executor/orderbook.rs +++ b/ks-lib/src/executor/orderbook.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/orderbook.rs -// version: 2 +// file: ks-lib/src/executor/orderbook.rs +// version: 3 //! `orderbook` executor family. diff --git a/kb-lib/src/executor/orderbook/jupiter_limit_order.rs b/ks-lib/src/executor/orderbook/jupiter_limit_order.rs similarity index 89% rename from kb-lib/src/executor/orderbook/jupiter_limit_order.rs rename to ks-lib/src/executor/orderbook/jupiter_limit_order.rs index 14c443a..df4b61d 100644 --- a/kb-lib/src/executor/orderbook/jupiter_limit_order.rs +++ b/ks-lib/src/executor/orderbook/jupiter_limit_order.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/orderbook/jupiter_limit_order.rs -// version: 3 +// file: ks-lib/src/executor/orderbook/jupiter_limit_order.rs +// version: 4 //! Reserved executor for `orderbook_jupiter_limit_order`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExOrderbookJupiterLimitOrderExec } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ORDERBOOK_JUPITER_LIMIT_ORDER_PROGRAM_ID]; + return &[ks_program_ids::ORDERBOOK_JUPITER_LIMIT_ORDER_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExOrderbookJupiterLimitOrderExec fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"orderbook_jupiter_limit_order"}), ) { diff --git a/kb-lib/src/executor/orderbook/jupiter_limit_order_v2.rs b/ks-lib/src/executor/orderbook/jupiter_limit_order_v2.rs similarity index 89% rename from kb-lib/src/executor/orderbook/jupiter_limit_order_v2.rs rename to ks-lib/src/executor/orderbook/jupiter_limit_order_v2.rs index 01ba3c3..d4b9206 100644 --- a/kb-lib/src/executor/orderbook/jupiter_limit_order_v2.rs +++ b/ks-lib/src/executor/orderbook/jupiter_limit_order_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/orderbook/jupiter_limit_order_v2.rs -// version: 3 +// file: ks-lib/src/executor/orderbook/jupiter_limit_order_v2.rs +// version: 4 //! Reserved executor for `orderbook_jupiter_limit_order_v2`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExOrderbookJupiterLimitOrderV2Ex } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ORDERBOOK_JUPITER_LIMIT_ORDER_V2_PROGRAM_ID]; + return &[ks_program_ids::ORDERBOOK_JUPITER_LIMIT_ORDER_V2_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExOrderbookJupiterLimitOrderV2Ex fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"orderbook_jupiter_limit_order_v2"}), ) { diff --git a/kb-lib/src/executor/orderbook/openbook_v2.rs b/ks-lib/src/executor/orderbook/openbook_v2.rs similarity index 89% rename from kb-lib/src/executor/orderbook/openbook_v2.rs rename to ks-lib/src/executor/orderbook/openbook_v2.rs index 7508767..495e74f 100644 --- a/kb-lib/src/executor/orderbook/openbook_v2.rs +++ b/ks-lib/src/executor/orderbook/openbook_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/orderbook/openbook_v2.rs -// version: 3 +// file: ks-lib/src/executor/orderbook/openbook_v2.rs +// version: 4 //! Reserved executor for `orderbook_openbook_v2`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExOrderbookOpenbookV2Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ORDERBOOK_OPENBOOK_V2_PROGRAM_ID]; + return &[ks_program_ids::ORDERBOOK_OPENBOOK_V2_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExOrderbookOpenbookV2Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"orderbook_openbook_v2"}), ) { diff --git a/kb-lib/src/executor/perpetuals.rs b/ks-lib/src/executor/perpetuals.rs similarity index 90% rename from kb-lib/src/executor/perpetuals.rs rename to ks-lib/src/executor/perpetuals.rs index 31a36bb..2ad4786 100644 --- a/kb-lib/src/executor/perpetuals.rs +++ b/ks-lib/src/executor/perpetuals.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/perpetuals.rs -// version: 3 +// file: ks-lib/src/executor/perpetuals.rs +// version: 4 //! `perpetuals` executor family. diff --git a/kb-lib/src/executor/perpetuals/drift_v2.rs b/ks-lib/src/executor/perpetuals/drift_v2.rs similarity index 89% rename from kb-lib/src/executor/perpetuals/drift_v2.rs rename to ks-lib/src/executor/perpetuals/drift_v2.rs index 79b2218..692f643 100644 --- a/kb-lib/src/executor/perpetuals/drift_v2.rs +++ b/ks-lib/src/executor/perpetuals/drift_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/perpetuals/drift_v2.rs -// version: 3 +// file: ks-lib/src/executor/perpetuals/drift_v2.rs +// version: 4 //! Reserved executor for `perpetuals_drift_v2`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExPerpetualsDriftV2Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::PERPETUALS_DRIFT_V2_PROGRAM_ID]; + return &[ks_program_ids::PERPETUALS_DRIFT_V2_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExPerpetualsDriftV2Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"perpetuals_drift_v2"}), ) { diff --git a/kb-lib/src/executor/perpetuals/jupiter.rs b/ks-lib/src/executor/perpetuals/jupiter.rs similarity index 89% rename from kb-lib/src/executor/perpetuals/jupiter.rs rename to ks-lib/src/executor/perpetuals/jupiter.rs index c8933c8..6d0db17 100644 --- a/kb-lib/src/executor/perpetuals/jupiter.rs +++ b/ks-lib/src/executor/perpetuals/jupiter.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/perpetuals/jupiter.rs -// version: 3 +// file: ks-lib/src/executor/perpetuals/jupiter.rs +// version: 4 //! Reserved executor for `perpetuals_jupiter`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExPerpetualsJupiterExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::PERPETUALS_JUPITER_PROGRAM_ID]; + return &[ks_program_ids::PERPETUALS_JUPITER_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExPerpetualsJupiterExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"perpetuals_jupiter"}), ) { diff --git a/kb-lib/src/executor/perpetuals/phoenix_eternal.rs b/ks-lib/src/executor/perpetuals/phoenix_eternal.rs similarity index 89% rename from kb-lib/src/executor/perpetuals/phoenix_eternal.rs rename to ks-lib/src/executor/perpetuals/phoenix_eternal.rs index e431f41..3b9e614 100644 --- a/kb-lib/src/executor/perpetuals/phoenix_eternal.rs +++ b/ks-lib/src/executor/perpetuals/phoenix_eternal.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/perpetuals/phoenix_eternal.rs -// version: 1 +// file: ks-lib/src/executor/perpetuals/phoenix_eternal.rs +// version: 2 //! Reserved executor for `perpetuals_phoenix_eternal`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExPerpetualsPhoenixEternalExecut } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::PERPETUALS_PHOENIX_ETERNAL_PROGRAM_ID]; + return &[ks_program_ids::PERPETUALS_PHOENIX_ETERNAL_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExPerpetualsPhoenixEternalExecut fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"perpetuals_phoenix_eternal"}), ) { diff --git a/kb-lib/src/executor/perpetuals/zeta.rs b/ks-lib/src/executor/perpetuals/zeta.rs similarity index 89% rename from kb-lib/src/executor/perpetuals/zeta.rs rename to ks-lib/src/executor/perpetuals/zeta.rs index 925f947..30fd2ba 100644 --- a/kb-lib/src/executor/perpetuals/zeta.rs +++ b/ks-lib/src/executor/perpetuals/zeta.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/perpetuals/zeta.rs -// version: 3 +// file: ks-lib/src/executor/perpetuals/zeta.rs +// version: 4 //! Reserved executor for `perpetuals_zeta`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExPerpetualsZetaExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::PERPETUALS_ZETA_PROGRAM_ID]; + return &[ks_program_ids::PERPETUALS_ZETA_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExPerpetualsZetaExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"perpetuals_zeta"}), ) { diff --git a/kb-lib/src/executor/router.rs b/ks-lib/src/executor/router.rs similarity index 93% rename from kb-lib/src/executor/router.rs rename to ks-lib/src/executor/router.rs index 546b5df..7e03abe 100644 --- a/kb-lib/src/executor/router.rs +++ b/ks-lib/src/executor/router.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/router.rs -// version: 3 +// file: ks-lib/src/executor/router.rs +// version: 4 //! `router` executor family. diff --git a/kb-lib/src/executor/router/dflow_aggregator_v4.rs b/ks-lib/src/executor/router/dflow_aggregator_v4.rs similarity index 89% rename from kb-lib/src/executor/router/dflow_aggregator_v4.rs rename to ks-lib/src/executor/router/dflow_aggregator_v4.rs index c838ff1..9bcb3b3 100644 --- a/kb-lib/src/executor/router/dflow_aggregator_v4.rs +++ b/ks-lib/src/executor/router/dflow_aggregator_v4.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/router/dflow_aggregator_v4.rs -// version: 3 +// file: ks-lib/src/executor/router/dflow_aggregator_v4.rs +// version: 4 //! Reserved executor for `router_dflow_aggregator_v4`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExRouterDflowAggregatorV4Executo } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ROUTER_DFLOW_AGGREGATOR_V4_PROGRAM_ID]; + return &[ks_program_ids::ROUTER_DFLOW_AGGREGATOR_V4_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExRouterDflowAggregatorV4Executo fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"router_dflow_aggregator_v4"}), ) { diff --git a/kb-lib/src/executor/router/jupiter_aggregator_v4.rs b/ks-lib/src/executor/router/jupiter_aggregator_v4.rs similarity index 89% rename from kb-lib/src/executor/router/jupiter_aggregator_v4.rs rename to ks-lib/src/executor/router/jupiter_aggregator_v4.rs index 3bf0beb..2d90e85 100644 --- a/kb-lib/src/executor/router/jupiter_aggregator_v4.rs +++ b/ks-lib/src/executor/router/jupiter_aggregator_v4.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/router/jupiter_aggregator_v4.rs -// version: 3 +// file: ks-lib/src/executor/router/jupiter_aggregator_v4.rs +// version: 4 //! Reserved executor for `router_jupiter_aggregator_v4`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExRouterJupiterAggregatorV4Execu } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ROUTER_JUPITER_AGGREGATOR_V4_PROGRAM_ID]; + return &[ks_program_ids::ROUTER_JUPITER_AGGREGATOR_V4_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExRouterJupiterAggregatorV4Execu fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"router_jupiter_aggregator_v4"}), ) { diff --git a/kb-lib/src/executor/router/jupiter_aggregator_v6.rs b/ks-lib/src/executor/router/jupiter_aggregator_v6.rs similarity index 89% rename from kb-lib/src/executor/router/jupiter_aggregator_v6.rs rename to ks-lib/src/executor/router/jupiter_aggregator_v6.rs index b43d3db..3082b32 100644 --- a/kb-lib/src/executor/router/jupiter_aggregator_v6.rs +++ b/ks-lib/src/executor/router/jupiter_aggregator_v6.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/router/jupiter_aggregator_v6.rs -// version: 3 +// file: ks-lib/src/executor/router/jupiter_aggregator_v6.rs +// version: 4 //! Reserved executor for `router_jupiter_aggregator_v6`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExRouterJupiterAggregatorV6Execu } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ROUTER_JUPITER_AGGREGATOR_V6_PROGRAM_ID]; + return &[ks_program_ids::ROUTER_JUPITER_AGGREGATOR_V6_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExRouterJupiterAggregatorV6Execu fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"router_jupiter_aggregator_v6"}), ) { diff --git a/kb-lib/src/executor/router/okx_labs_v1.rs b/ks-lib/src/executor/router/okx_labs_v1.rs similarity index 89% rename from kb-lib/src/executor/router/okx_labs_v1.rs rename to ks-lib/src/executor/router/okx_labs_v1.rs index 42f14f4..cbe8fb4 100644 --- a/kb-lib/src/executor/router/okx_labs_v1.rs +++ b/ks-lib/src/executor/router/okx_labs_v1.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/router/okx_labs_v1.rs -// version: 3 +// file: ks-lib/src/executor/router/okx_labs_v1.rs +// version: 4 //! Reserved executor for `router_okx_labs_v1`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExRouterOkxLabsV1Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ROUTER_OKX_LABS_V1_PROGRAM_ID]; + return &[ks_program_ids::ROUTER_OKX_LABS_V1_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExRouterOkxLabsV1Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"router_okx_labs_v1"}), ) { diff --git a/kb-lib/src/executor/router/okx_labs_v2.rs b/ks-lib/src/executor/router/okx_labs_v2.rs similarity index 89% rename from kb-lib/src/executor/router/okx_labs_v2.rs rename to ks-lib/src/executor/router/okx_labs_v2.rs index 75ad677..ecc2363 100644 --- a/kb-lib/src/executor/router/okx_labs_v2.rs +++ b/ks-lib/src/executor/router/okx_labs_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/router/okx_labs_v2.rs -// version: 3 +// file: ks-lib/src/executor/router/okx_labs_v2.rs +// version: 4 //! Reserved executor for `router_okx_labs_v2`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExRouterOkxLabsV2Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ROUTER_OKX_LABS_V2_PROGRAM_ID]; + return &[ks_program_ids::ROUTER_OKX_LABS_V2_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExRouterOkxLabsV2Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"router_okx_labs_v2"}), ) { diff --git a/kb-lib/src/executor/rwa.rs b/ks-lib/src/executor/rwa.rs similarity index 78% rename from kb-lib/src/executor/rwa.rs rename to ks-lib/src/executor/rwa.rs index 5e7dd99..079def3 100644 --- a/kb-lib/src/executor/rwa.rs +++ b/ks-lib/src/executor/rwa.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/rwa.rs -// version: 2 +// file: ks-lib/src/executor/rwa.rs +// version: 3 //! `rwa` executor family. diff --git a/kb-lib/src/executor/rwa/ondo_global_markets.rs b/ks-lib/src/executor/rwa/ondo_global_markets.rs similarity index 89% rename from kb-lib/src/executor/rwa/ondo_global_markets.rs rename to ks-lib/src/executor/rwa/ondo_global_markets.rs index fbc74c5..f7202cd 100644 --- a/kb-lib/src/executor/rwa/ondo_global_markets.rs +++ b/ks-lib/src/executor/rwa/ondo_global_markets.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/rwa/ondo_global_markets.rs -// version: 3 +// file: ks-lib/src/executor/rwa/ondo_global_markets.rs +// version: 4 //! Reserved executor for `rwa_ondo_global_markets`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExRwaOndoGlobalMarketsExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::RWA_ONDO_GLOBAL_MARKETS_PROGRAM_ID]; + return &[ks_program_ids::RWA_ONDO_GLOBAL_MARKETS_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExRwaOndoGlobalMarketsExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"rwa_ondo_global_markets"}), ) { diff --git a/kb-lib/src/executor/safety.rs b/ks-lib/src/executor/safety.rs similarity index 88% rename from kb-lib/src/executor/safety.rs rename to ks-lib/src/executor/safety.rs index 7f1a1ff..607b2b5 100644 --- a/kb-lib/src/executor/safety.rs +++ b/ks-lib/src/executor/safety.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/safety.rs -// version: 1 +// file: ks-lib/src/executor/safety.rs +// version: 2 //! Shared execution safety policy. diff --git a/kb-lib/src/executor/safety/evaluation.rs b/ks-lib/src/executor/safety/evaluation.rs similarity index 98% rename from kb-lib/src/executor/safety/evaluation.rs rename to ks-lib/src/executor/safety/evaluation.rs index a55fe80..c1064d2 100644 --- a/kb-lib/src/executor/safety/evaluation.rs +++ b/ks-lib/src/executor/safety/evaluation.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/safety/evaluation.rs -// version: 3 +// file: ks-lib/src/executor/safety/evaluation.rs +// version: 4 //! Safety checks applied before simulation, signing or sending. @@ -10,7 +10,7 @@ use ts_rs::TS; // rust-rules: derive-import #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/safety/evaluation/ExSafetyDecision.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/safety/evaluation/ExSafetyDecision.ts" )] pub enum ExSafetyDecision { /// The plan is not allowed to continue. @@ -25,7 +25,7 @@ pub enum ExSafetyDecision { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/safety/evaluation/ExSafetyViolation.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/safety/evaluation/ExSafetyViolation.ts" )] pub struct ExSafetyViolation { /// Stable violation code. @@ -38,7 +38,7 @@ pub struct ExSafetyViolation { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/safety/evaluation/ExSafetyEvaluation.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/safety/evaluation/ExSafetyEvaluation.ts" )] pub struct ExSafetyEvaluation { /// Aggregate decision. @@ -56,7 +56,7 @@ impl crate::ExSafetyChecker { pub fn evaluate_plan( &self, _plan: &crate::ExApiExecutionPlan, - ) -> kb_core::Result { + ) -> ks_core::Result { return std::result::Result::Ok(crate::ExSafetyDecision::RequireConfirmation); } @@ -64,7 +64,7 @@ impl crate::ExSafetyChecker { pub fn evaluate_prepared_plan( &self, plan: &crate::ExApiPreparedExecutionPlan, - ) -> kb_core::Result { + ) -> ks_core::Result { let mut violations = std::vec::Vec::new(); if plan.instructions.is_empty() { push_violation( @@ -132,7 +132,7 @@ impl crate::ExSafetyChecker { &self, plan: &crate::ExApiPreparedExecutionPlan, simulation: &crate::ExApiExecutionSimulationResult, - ) -> kb_core::Result { + ) -> ks_core::Result { let plan_evaluation = match self.evaluate_prepared_plan(plan) { std::result::Result::Ok(evaluation) => evaluation, std::result::Result::Err(error) => return std::result::Result::Err(error), diff --git a/kb-lib/src/executor/solana.rs b/ks-lib/src/executor/solana.rs similarity index 99% rename from kb-lib/src/executor/solana.rs rename to ks-lib/src/executor/solana.rs index 85acda6..2bd7a9a 100644 --- a/kb-lib/src/executor/solana.rs +++ b/ks-lib/src/executor/solana.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana.rs -// version: 5 +// file: ks-lib/src/executor/solana.rs +// version: 6 //! `solana` executor family. diff --git a/kb-lib/src/executor/solana/core.rs b/ks-lib/src/executor/solana/core.rs similarity index 99% rename from kb-lib/src/executor/solana/core.rs rename to ks-lib/src/executor/solana/core.rs index 057e940..d09203d 100644 --- a/kb-lib/src/executor/solana/core.rs +++ b/ks-lib/src/executor/solana/core.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana/core.rs -// version: 4 +// file: ks-lib/src/executor/solana/core.rs +// version: 5 //! Safe typed executor for supported Solana core operations. diff --git a/kb-lib/src/executor/solana/core/address_lookup_table.rs b/ks-lib/src/executor/solana/core/address_lookup_table.rs similarity index 94% rename from kb-lib/src/executor/solana/core/address_lookup_table.rs rename to ks-lib/src/executor/solana/core/address_lookup_table.rs index c991d01..b7e3e58 100644 --- a/kb-lib/src/executor/solana/core/address_lookup_table.rs +++ b/ks-lib/src/executor/solana/core/address_lookup_table.rs @@ -1,12 +1,12 @@ -// file: kb-lib/src/executor/solana/core/address_lookup_table.rs -// version: 1 +// file: ks-lib/src/executor/solana/core/address_lookup_table.rs +// version: 2 //! Official Address Lookup Table instruction builders. pub(crate) fn executor_solana_core_address_lookup_table_build_prepared_plan( intent: &crate::ExSolanaCoreExecutionIntent, fee_payer: &solana_pubkey::Pubkey, -) -> kb_core::Result { +) -> ks_core::Result { return match &intent.operation { crate::ExSolanaCoreOperation::AddressLookupTableCreate { authority, @@ -37,7 +37,7 @@ pub(crate) fn executor_solana_core_address_lookup_table_build_prepared_plan( authority, recipient, } => build_close_plan(intent, fee_payer, lookup_table, authority, recipient), - _ => std::result::Result::Err(kb_core::Error::new( + _ => std::result::Result::Err(ks_core::Error::new( "execution_address_lookup_table_operation_mismatch", "Address Lookup Table builder received a non-ALT operation", )), @@ -50,7 +50,7 @@ fn build_create_plan( authority: &crate::MdPubkey, payer: &crate::MdPubkey, recent_slot: u64, -) -> kb_core::Result { +) -> ks_core::Result { let authority_address = match crate::executor_solana_core_parse_pubkey(authority, "authority") { std::result::Result::Ok(pubkey) => pubkey, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -66,7 +66,7 @@ fn build_create_plan( recent_slot, ); if lookup_table_address == authority_address || lookup_table_address == payer_address { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_address_lookup_table_derived_address_conflict", "derived lookup table address must differ from its authority and payer", )); @@ -89,9 +89,9 @@ fn build_extend_plan( authority: &crate::MdPubkey, payer: std::option::Option<&crate::MdPubkey>, new_addresses: &[crate::MdPubkey], -) -> kb_core::Result { +) -> ks_core::Result { if new_addresses.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_address_lookup_table_extend_empty", "Address Lookup Table extension requires at least one address", )); @@ -99,7 +99,7 @@ fn build_extend_plan( if new_addresses.len() > solana_address_lookup_table_interface::state::LOOKUP_TABLE_MAX_ADDRESSES { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_address_lookup_table_extend_too_many_addresses", format!( "Address Lookup Table extension cannot contain more than {} addresses", @@ -181,7 +181,7 @@ fn build_freeze_plan( fee_payer: &solana_pubkey::Pubkey, lookup_table: &crate::MdPubkey, authority: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { let (lookup_table_address, authority_address) = match parse_authority_pair(lookup_table, authority) { std::result::Result::Ok(pair) => pair, @@ -207,7 +207,7 @@ fn build_deactivate_plan( fee_payer: &solana_pubkey::Pubkey, lookup_table: &crate::MdPubkey, authority: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { let (lookup_table_address, authority_address) = match parse_authority_pair(lookup_table, authority) { std::result::Result::Ok(pair) => pair, @@ -234,7 +234,7 @@ fn build_close_plan( lookup_table: &crate::MdPubkey, authority: &crate::MdPubkey, recipient: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { let (lookup_table_address, authority_address) = match parse_authority_pair(lookup_table, authority) { std::result::Result::Ok(pair) => pair, @@ -272,7 +272,7 @@ fn build_close_plan( fn parse_authority_pair( lookup_table: &crate::MdPubkey, authority: &crate::MdPubkey, -) -> kb_core::Result<(solana_pubkey::Pubkey, solana_pubkey::Pubkey)> { +) -> ks_core::Result<(solana_pubkey::Pubkey, solana_pubkey::Pubkey)> { match crate::executor_solana_core_validate_distinct_pubkeys( lookup_table, authority, @@ -339,8 +339,8 @@ mod tests { #[test] fn create_lookup_table_matches_official_builder_and_signers() { - let authority = kb_program_ids::VOTE_PROGRAM_ID; - let payer = kb_program_ids::STAKE_PROGRAM_ID; + let authority = ks_program_ids::VOTE_PROGRAM_ID; + let payer = ks_program_ids::STAKE_PROGRAM_ID; let recent_slot = 42; let intent = crate::ExSolanaCoreExecutionIntent { intent_id: std::string::String::from("alt-create-1"), @@ -374,15 +374,15 @@ mod tests { #[test] fn extend_lookup_table_matches_official_builder_with_optional_payer() { - let authority = parsed(kb_program_ids::STAKE_PROGRAM_ID); - let payer = parsed(kb_program_ids::VOTE_PROGRAM_ID); + let authority = parsed(ks_program_ids::STAKE_PROGRAM_ID); + let payer = parsed(ks_program_ids::VOTE_PROGRAM_ID); let (lookup_table, _bump) = solana_address_lookup_table_interface::instruction::derive_lookup_table_address( &authority, 100, ); let addresses = vec![ - parsed(kb_program_ids::SYSTEM_PROGRAM_ID), - parsed(kb_program_ids::CONFIG_PROGRAM_ID), + parsed(ks_program_ids::SYSTEM_PROGRAM_ID), + parsed(ks_program_ids::CONFIG_PROGRAM_ID), ]; let authority_text = authority.to_string(); let payer_text = payer.to_string(); @@ -447,8 +447,8 @@ mod tests { #[test] fn lookup_table_authority_lifecycle_matches_official_builders() { - let authority = parsed(kb_program_ids::VOTE_PROGRAM_ID); - let recipient = parsed(kb_program_ids::CONFIG_PROGRAM_ID); + let authority = parsed(ks_program_ids::VOTE_PROGRAM_ID); + let recipient = parsed(ks_program_ids::CONFIG_PROGRAM_ID); let (lookup_table, _bump) = solana_address_lookup_table_interface::instruction::derive_lookup_table_address( &authority, 200, @@ -510,7 +510,7 @@ mod tests { #[test] fn lookup_table_invalid_contracts_are_rejected() { - let authority = parsed(kb_program_ids::VOTE_PROGRAM_ID); + let authority = parsed(ks_program_ids::VOTE_PROGRAM_ID); let (lookup_table, _bump) = solana_address_lookup_table_interface::instruction::derive_lookup_table_address( &authority, 300, @@ -535,7 +535,7 @@ mod tests { let too_many_addresses = (0 ..=solana_address_lookup_table_interface::state::LOOKUP_TABLE_MAX_ADDRESSES) .map(|_| { - return pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); + return pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); }) .collect::>(); let too_many = crate::ExSolanaCoreExecutionIntent { diff --git a/kb-lib/src/executor/solana/core/builder.rs b/ks-lib/src/executor/solana/core/builder.rs similarity index 94% rename from kb-lib/src/executor/solana/core/builder.rs rename to ks-lib/src/executor/solana/core/builder.rs index 7defc91..c7bc353 100644 --- a/kb-lib/src/executor/solana/core/builder.rs +++ b/ks-lib/src/executor/solana/core/builder.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana/core/builder.rs -// version: 4 +// file: ks-lib/src/executor/solana/core/builder.rs +// version: 5 //! Official Solana core instruction builders and shared plan finalization. @@ -18,9 +18,9 @@ const MAX_LOADED_ACCOUNTS_DATA_SIZE_BYTES: u32 = 64 * 1_024 * 1_024; pub(crate) fn executor_solana_core_builder_build_prepared_plan( intent: &crate::ExSolanaCoreExecutionIntent, -) -> kb_core::Result { +) -> ks_core::Result { if intent.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_intent_id_empty", "Solana core execution intent id must not be empty", )); @@ -30,16 +30,16 @@ pub(crate) fn executor_solana_core_builder_build_prepared_plan( std::result::Result::Err(error) => return std::result::Result::Err(error), }; let operation_code = intent.operation.operation_code(); - if intent.operation.program_id() == kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID { + if intent.operation.program_id() == ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID { return crate::executor_solana_core_loader_v3_build_prepared_plan(intent, &fee_payer); } - if intent.operation.program_id() == kb_program_ids::LOADER_V4_PROGRAM_ID { + if intent.operation.program_id() == ks_program_ids::LOADER_V4_PROGRAM_ID { return crate::executor_solana_core_loader_v4_build_prepared_plan(intent, &fee_payer); } - if intent.operation.program_id() == kb_program_ids::STAKE_PROGRAM_ID { + if intent.operation.program_id() == ks_program_ids::STAKE_PROGRAM_ID { return crate::executor_solana_core_stake_build_prepared_plan(intent, &fee_payer); } - if intent.operation.program_id() == kb_program_ids::VOTE_PROGRAM_ID { + if intent.operation.program_id() == ks_program_ids::VOTE_PROGRAM_ID { return crate::executor_solana_core_vote_build_prepared_plan(intent, &fee_payer); } match &intent.operation { @@ -434,7 +434,7 @@ pub(crate) fn executor_solana_core_builder_build_prepared_plan( }, } if payer.is_none() && *lamports != 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_prefund_payer_missing", "create-account-allow-prefund requires a payer when additional lamports are requested", )); @@ -638,7 +638,7 @@ pub(crate) fn executor_solana_core_builder_build_prepared_plan( if !(MIN_HEAP_FRAME_BYTES..=MAX_HEAP_FRAME_BYTES).contains(bytes) || *bytes % HEAP_FRAME_BYTES_GRANULARITY != 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_compute_budget_heap_frame_invalid", format!( "heap frame must be between {} and {} bytes and aligned to {} bytes", @@ -659,7 +659,7 @@ pub(crate) fn executor_solana_core_builder_build_prepared_plan( }, crate::ExSolanaCoreOperation::ComputeBudgetSetUnitLimit { units } => { if *units == 0 || *units > MAX_COMPUTE_UNIT_LIMIT { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_compute_unit_limit_out_of_range", format!( "compute-unit limit must be between 1 and {}", @@ -686,7 +686,7 @@ pub(crate) fn executor_solana_core_builder_build_prepared_plan( ), crate::ExSolanaCoreOperation::ComputeBudgetSetLoadedAccountsDataSizeLimit { bytes } => { if !(1..=MAX_LOADED_ACCOUNTS_DATA_SIZE_BYTES).contains(bytes) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_compute_budget_loaded_accounts_data_size_limit_invalid", format!( "loaded-account data-size limit must be between 1 and {} bytes", @@ -704,7 +704,7 @@ pub(crate) fn executor_solana_core_builder_build_prepared_plan( ) }, _ => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_solana_core_internal_dispatch_failed", format!("operation {operation_code} was not routed to its dedicated builder"), )); @@ -726,9 +726,9 @@ fn build_transfer_many_plan( fee_payer: &solana_pubkey::Pubkey, from: &crate::MdPubkey, recipients: &[crate::ExSolanaCoreSystemTransferRecipient], -) -> kb_core::Result { +) -> ks_core::Result { if recipients.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_transfer_many_empty", "System transfer-many requires at least one recipient", )); @@ -765,7 +765,7 @@ fn build_transfer_many_plan( requested_spend_lamports = match requested_spend_lamports.checked_add(recipient.lamports) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_transfer_many_lamports_overflow", "System transfer-many total lamports exceed u64", )); @@ -793,7 +793,7 @@ fn build_create_nonce_account_plan( nonce_account: &crate::MdPubkey, authority: &crate::MdPubkey, lamports: u64, -) -> kb_core::Result { +) -> ks_core::Result { match validate_nonce_management_policy(intent) { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -852,7 +852,7 @@ fn build_create_nonce_account_with_seed_plan( intent: &crate::ExSolanaCoreExecutionIntent, fee_payer: &solana_pubkey::Pubkey, operation: &crate::ExSolanaCoreOperation, -) -> kb_core::Result { +) -> ks_core::Result { let (from, nonce_account, base, seed, authority, lamports) = match operation { crate::ExSolanaCoreOperation::SystemCreateNonceAccountWithSeed { from, @@ -863,7 +863,7 @@ fn build_create_nonce_account_with_seed_plan( lamports, } => (from, nonce_account, base, seed, authority, *lamports), _ => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_solana_core_internal_dispatch_failed", "seeded nonce builder received an incompatible operation", )); @@ -907,10 +907,10 @@ fn build_create_nonce_account_with_seed_plan( std::result::Result::Ok(pubkey) => pubkey, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let system_program = match solana_pubkey::Pubkey::from_str(kb_program_ids::SYSTEM_PROGRAM_ID) { + let system_program = match solana_pubkey::Pubkey::from_str(ks_program_ids::SYSTEM_PROGRAM_ID) { std::result::Result::Ok(pubkey) => pubkey, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_system_program_id_invalid", error.to_string(), )); @@ -956,7 +956,7 @@ fn build_initialize_nonce_account_plan( fee_payer: &solana_pubkey::Pubkey, nonce_account: &crate::MdPubkey, authority: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { match validate_nonce_management_policy(intent) { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -991,7 +991,7 @@ fn build_advance_nonce_account_plan( fee_payer: &solana_pubkey::Pubkey, nonce_account: &crate::MdPubkey, authority: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { match validate_nonce_management_policy(intent) { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1025,7 +1025,7 @@ fn build_authorize_nonce_account_plan( nonce_account: &crate::MdPubkey, authority: &crate::MdPubkey, new_authority: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { match validate_nonce_management_policy(intent) { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1066,7 +1066,7 @@ fn build_withdraw_nonce_account_plan( authority: &crate::MdPubkey, to: &crate::MdPubkey, lamports: u64, -) -> kb_core::Result { +) -> ks_core::Result { match validate_nonce_management_policy(intent) { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1121,7 +1121,7 @@ fn build_upgrade_nonce_account_plan( intent: &crate::ExSolanaCoreExecutionIntent, fee_payer: &solana_pubkey::Pubkey, nonce_account: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { match validate_nonce_management_policy(intent) { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1144,9 +1144,9 @@ fn build_upgrade_nonce_account_plan( fn validate_nonce_management_policy( intent: &crate::ExSolanaCoreExecutionIntent, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if intent.policy.blockhash.kind != crate::ExApiExecutionBlockhashKind::Latest { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_nonce_management_requires_latest_blockhash", "nonce account lifecycle operations use a recent blockhash; durable nonce transaction assembly is a separate execution path", )); @@ -1158,7 +1158,7 @@ fn validate_nonce_management_policy( fn initialize_nonce_account_instruction( nonce_account: &solana_pubkey::Pubkey, authority: &solana_pubkey::Pubkey, -) -> kb_core::Result { +) -> ks_core::Result { let data = match wincode::serialize( &solana_system_interface::instruction::SystemInstruction::InitializeNonceAccount( *authority, @@ -1166,7 +1166,7 @@ fn initialize_nonce_account_instruction( ) { std::result::Result::Ok(data) => data, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_nonce_initialize_serialize_failed", error.to_string(), )); @@ -1197,9 +1197,9 @@ pub(crate) fn executor_solana_core_finalize_prepared_plan( requested_spend_lamports: u64, requested_compute_unit_price: std::option::Option, signer_roles: std::vec::Vec<(crate::MdPubkey, std::string::String)>, -) -> kb_core::Result { +) -> ks_core::Result { if instructions.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_operation_has_no_instructions", format!("operation {operation_code} produced no instructions"), )); @@ -1211,13 +1211,13 @@ pub(crate) fn executor_solana_core_finalize_prepared_plan( let mut signer_roles = signer_roles; if intent.policy.blockhash.kind == crate::ExApiExecutionBlockhashKind::DurableNonce { if intent.policy.blockhash.max_age_slots.is_some() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_durable_nonce_has_blockhash_age", "durable nonce plans must not declare a recent blockhash age", )); } if intent.policy.blockhash.nonce_account.is_none() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_durable_nonce_account_missing", "durable nonce plans require a nonce account", )); @@ -1225,7 +1225,7 @@ pub(crate) fn executor_solana_core_finalize_prepared_plan( let nonce_authority = match &intent.policy.blockhash.nonce_authority { std::option::Option::Some(authority) => authority.clone(), std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_durable_nonce_authority_missing", "durable nonce plans require a nonce authority", )); @@ -1261,9 +1261,9 @@ pub(crate) fn executor_solana_core_finalize_prepared_plan( }); } -fn validate_create_space(space: u64) -> kb_core::Result<()> { +fn validate_create_space(space: u64) -> ks_core::Result<()> { if space > solana_system_interface::MAX_PERMITTED_DATA_LENGTH { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_system_space_out_of_range", format!( "System account space must not exceed {} bytes", @@ -1274,9 +1274,9 @@ fn validate_create_space(space: u64) -> kb_core::Result<()> { return std::result::Result::Ok(()); } -fn validate_allocate_space(space: u64) -> kb_core::Result<()> { +fn validate_allocate_space(space: u64) -> ks_core::Result<()> { if space == 0 || space > solana_system_interface::MAX_PERMITTED_DATA_LENGTH { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_system_space_out_of_range", format!( "System allocation space must be between 1 and {} bytes", @@ -1332,13 +1332,13 @@ fn required_signers( fn validate_signer_contract( instructions: &[crate::ExApiPlannedInstruction], required_signers: &[crate::ExApiRequiredSigner], -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { for instruction in instructions { for account in &instruction.accounts { if account.is_signer && !required_signers.iter().any(|signer| return signer.pubkey == account.pubkey) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_instruction_signer_not_declared", format!( "instruction signer {} is missing from required signers", @@ -1415,8 +1415,8 @@ mod tests { #[test] fn transfer_matches_official_builder_and_signers() { - let from = kb_program_ids::VOTE_PROGRAM_ID; - let to = kb_program_ids::STAKE_PROGRAM_ID; + let from = ks_program_ids::VOTE_PROGRAM_ID; + let to = ks_program_ids::STAKE_PROGRAM_ID; let intent = crate::ExSolanaCoreExecutionIntent { intent_id: std::string::String::from("transfer-1"), fee_payer: pubkey(from), @@ -1440,9 +1440,9 @@ mod tests { #[test] fn create_account_matches_official_builder_and_allows_zero_space() { - let from = kb_program_ids::VOTE_PROGRAM_ID; - let new_account = kb_program_ids::STAKE_PROGRAM_ID; - let owner = kb_program_ids::SYSTEM_PROGRAM_ID; + let from = ks_program_ids::VOTE_PROGRAM_ID; + let new_account = ks_program_ids::STAKE_PROGRAM_ID; + let owner = ks_program_ids::SYSTEM_PROGRAM_ID; let intent = crate::ExSolanaCoreExecutionIntent { intent_id: std::string::String::from("create-1"), fee_payer: pubkey(from), @@ -1471,8 +1471,8 @@ mod tests { #[test] fn allocate_and_assign_match_official_builders() { - let account = kb_program_ids::VOTE_PROGRAM_ID; - let owner = kb_program_ids::STAKE_PROGRAM_ID; + let account = ks_program_ids::VOTE_PROGRAM_ID; + let owner = ks_program_ids::STAKE_PROGRAM_ID; let allocate_intent = crate::ExSolanaCoreExecutionIntent { intent_id: std::string::String::from("allocate-1"), fee_payer: pubkey(account), @@ -1510,9 +1510,9 @@ mod tests { #[test] fn seeded_system_operations_match_official_builders() { - let base = parsed(kb_program_ids::VOTE_PROGRAM_ID); - let owner = parsed(kb_program_ids::SYSTEM_PROGRAM_ID); - let destination = parsed(kb_program_ids::STAKE_PROGRAM_ID); + let base = parsed(ks_program_ids::VOTE_PROGRAM_ID); + let owner = parsed(ks_program_ids::SYSTEM_PROGRAM_ID); + let destination = parsed(ks_program_ids::STAKE_PROGRAM_ID); let seed = "khadhroony-seed"; let derived = solana_pubkey::Pubkey::create_with_seed(&base, seed, &owner) .unwrap_or_else(|error| panic!("seed fixture failed: {error}")); @@ -1625,9 +1625,9 @@ mod tests { #[test] fn seeded_create_with_distinct_funding_and_base_declares_both_signers() { - let funding = parsed(kb_program_ids::VOTE_PROGRAM_ID); - let base = parsed(kb_program_ids::CONFIG_PROGRAM_ID); - let owner = parsed(kb_program_ids::SYSTEM_PROGRAM_ID); + let funding = parsed(ks_program_ids::VOTE_PROGRAM_ID); + let base = parsed(ks_program_ids::CONFIG_PROGRAM_ID); + let owner = parsed(ks_program_ids::SYSTEM_PROGRAM_ID); let seed = "khadhroony-distinct-base"; let derived = solana_pubkey::Pubkey::create_with_seed(&base, seed, &owner) .unwrap_or_else(|error| panic!("seed fixture failed: {error}")); @@ -1666,9 +1666,9 @@ mod tests { #[test] fn create_account_allow_prefund_matches_official_builder() { - let payer = kb_program_ids::VOTE_PROGRAM_ID; - let new_account = kb_program_ids::STAKE_PROGRAM_ID; - let owner = kb_program_ids::SYSTEM_PROGRAM_ID; + let payer = ks_program_ids::VOTE_PROGRAM_ID; + let new_account = ks_program_ids::STAKE_PROGRAM_ID; + let owner = ks_program_ids::SYSTEM_PROGRAM_ID; let funded_intent = crate::ExSolanaCoreExecutionIntent { intent_id: std::string::String::from("prefund-funded"), fee_payer: pubkey(payer), @@ -1700,7 +1700,7 @@ mod tests { assert_eq!(funded_plan.requested_spend_lamports, 5_000); assert_eq!(funded_plan.required_signers.len(), 2); - let prefunded_account = kb_program_ids::CONFIG_PROGRAM_ID; + let prefunded_account = ks_program_ids::CONFIG_PROGRAM_ID; let prefunded_intent = crate::ExSolanaCoreExecutionIntent { intent_id: std::string::String::from("prefund-existing"), fee_payer: pubkey(payer), @@ -1729,9 +1729,9 @@ mod tests { #[test] fn transfer_many_matches_official_builder_and_sums_spend() { - let from = kb_program_ids::VOTE_PROGRAM_ID; - let first = kb_program_ids::STAKE_PROGRAM_ID; - let second = kb_program_ids::CONFIG_PROGRAM_ID; + let from = ks_program_ids::VOTE_PROGRAM_ID; + let first = ks_program_ids::STAKE_PROGRAM_ID; + let second = ks_program_ids::CONFIG_PROGRAM_ID; let intent = crate::ExSolanaCoreExecutionIntent { intent_id: std::string::String::from("transfer-many-1"), fee_payer: pubkey(from), @@ -1761,9 +1761,9 @@ mod tests { #[test] fn nonce_creation_helpers_match_official_builders() { - let from = kb_program_ids::VOTE_PROGRAM_ID; - let nonce = kb_program_ids::STAKE_PROGRAM_ID; - let authority = kb_program_ids::CONFIG_PROGRAM_ID; + let from = ks_program_ids::VOTE_PROGRAM_ID; + let nonce = ks_program_ids::STAKE_PROGRAM_ID; + let authority = ks_program_ids::CONFIG_PROGRAM_ID; let create_intent = crate::ExSolanaCoreExecutionIntent { intent_id: std::string::String::from("nonce-create-1"), fee_payer: pubkey(from), @@ -1787,8 +1787,8 @@ mod tests { assert_eq!(create_plan.required_signers.len(), 2); assert_eq!(create_plan.requested_spend_lamports, 5_000); - let base = parsed(kb_program_ids::STAKE_PROGRAM_ID); - let system = parsed(kb_program_ids::SYSTEM_PROGRAM_ID); + let base = parsed(ks_program_ids::STAKE_PROGRAM_ID); + let system = parsed(ks_program_ids::SYSTEM_PROGRAM_ID); let seed = "nonce-seed"; let seeded_nonce = solana_pubkey::Pubkey::create_with_seed(&base, seed, &system) .unwrap_or_else(|error| panic!("seed fixture failed: {error}")); @@ -1796,11 +1796,11 @@ mod tests { let seeded_intent = crate::ExSolanaCoreExecutionIntent { intent_id: std::string::String::from("nonce-create-seed-1"), fee_payer: pubkey(from), - policy: policy(&[from, kb_program_ids::STAKE_PROGRAM_ID]), + policy: policy(&[from, ks_program_ids::STAKE_PROGRAM_ID]), operation: crate::ExSolanaCoreOperation::SystemCreateNonceAccountWithSeed { from: pubkey(from), nonce_account: pubkey(seeded_nonce_text.as_str()), - base: pubkey(kb_program_ids::STAKE_PROGRAM_ID), + base: pubkey(ks_program_ids::STAKE_PROGRAM_ID), seed: std::string::String::from(seed), authority: pubkey(authority), lamports: 5_000, @@ -1822,11 +1822,11 @@ mod tests { #[test] fn nonce_lifecycle_operations_match_official_builders() { - let payer = kb_program_ids::VOTE_PROGRAM_ID; - let nonce = kb_program_ids::STAKE_PROGRAM_ID; - let authority = kb_program_ids::CONFIG_PROGRAM_ID; - let new_authority = kb_program_ids::FEATURE_PROGRAM_ID; - let recipient = kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID; + let payer = ks_program_ids::VOTE_PROGRAM_ID; + let nonce = ks_program_ids::STAKE_PROGRAM_ID; + let authority = ks_program_ids::CONFIG_PROGRAM_ID; + let new_authority = ks_program_ids::FEATURE_PROGRAM_ID; + let recipient = ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID; let base_policy = policy(&[payer, authority]); let initialize_intent = crate::ExSolanaCoreExecutionIntent { @@ -1928,7 +1928,7 @@ mod tests { #[test] fn transfer_many_and_nonce_policy_reject_invalid_contracts() { - let payer = kb_program_ids::VOTE_PROGRAM_ID; + let payer = ks_program_ids::VOTE_PROGRAM_ID; let empty_intent = crate::ExSolanaCoreExecutionIntent { intent_id: std::string::String::from("transfer-many-empty"), fee_payer: pubkey(payer), @@ -1946,7 +1946,7 @@ mod tests { nonce_policy.blockhash = crate::ExApiExecutionBlockhashPolicy { kind: crate::ExApiExecutionBlockhashKind::DurableNonce, max_age_slots: std::option::Option::None, - nonce_account: std::option::Option::Some(pubkey(kb_program_ids::STAKE_PROGRAM_ID)), + nonce_account: std::option::Option::Some(pubkey(ks_program_ids::STAKE_PROGRAM_ID)), nonce_authority: std::option::Option::Some(pubkey(payer)), }; let nonce_intent = crate::ExSolanaCoreExecutionIntent { @@ -1954,7 +1954,7 @@ mod tests { fee_payer: pubkey(payer), policy: nonce_policy, operation: crate::ExSolanaCoreOperation::SystemAdvanceNonceAccount { - nonce_account: pubkey(kb_program_ids::STAKE_PROGRAM_ID), + nonce_account: pubkey(ks_program_ids::STAKE_PROGRAM_ID), authority: pubkey(payer), }, }; @@ -1965,9 +1965,9 @@ mod tests { #[test] fn durable_nonce_policy_declares_nonce_authority_signer() { - let payer = kb_program_ids::VOTE_PROGRAM_ID; - let authority = kb_program_ids::STAKE_PROGRAM_ID; - let nonce_account = kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID; + let payer = ks_program_ids::VOTE_PROGRAM_ID; + let authority = ks_program_ids::STAKE_PROGRAM_ID; + let nonce_account = ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID; let mut policy = policy(&[payer, authority]); policy.blockhash = crate::ExApiExecutionBlockhashPolicy { kind: crate::ExApiExecutionBlockhashKind::DurableNonce, @@ -1981,7 +1981,7 @@ mod tests { policy, operation: crate::ExSolanaCoreOperation::SystemTransfer { from: pubkey(payer), - to: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), + to: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), lamports: 500, }, }; @@ -1995,7 +1995,7 @@ mod tests { #[test] fn compute_budget_operations_match_official_builders() { - let payer = kb_program_ids::VOTE_PROGRAM_ID; + let payer = ks_program_ids::VOTE_PROGRAM_ID; let heap_intent = crate::ExSolanaCoreExecutionIntent { intent_id: std::string::String::from("heap-1"), fee_payer: pubkey(payer), @@ -2076,7 +2076,7 @@ mod tests { #[test] fn compute_budget_resource_limits_reject_invalid_values() { - let payer = kb_program_ids::VOTE_PROGRAM_ID; + let payer = ks_program_ids::VOTE_PROGRAM_ID; let invalid_heap_values = [ super::MIN_HEAP_FRAME_BYTES - 1, super::MIN_HEAP_FRAME_BYTES + 1, @@ -2115,14 +2115,14 @@ mod tests { #[test] fn malformed_seed_and_prefund_contracts_are_rejected() { - let payer = kb_program_ids::VOTE_PROGRAM_ID; - let owner = kb_program_ids::SYSTEM_PROGRAM_ID; + let payer = ks_program_ids::VOTE_PROGRAM_ID; + let owner = ks_program_ids::SYSTEM_PROGRAM_ID; let mismatch_intent = crate::ExSolanaCoreExecutionIntent { intent_id: std::string::String::from("seed-mismatch"), fee_payer: pubkey(payer), policy: policy(&[payer]), operation: crate::ExSolanaCoreOperation::SystemAllocateWithSeed { - account: pubkey(kb_program_ids::STAKE_PROGRAM_ID), + account: pubkey(ks_program_ids::STAKE_PROGRAM_ID), base: pubkey(payer), seed: std::string::String::from("seed"), space: 1, @@ -2140,7 +2140,7 @@ mod tests { fee_payer: pubkey(payer), policy: policy(&[payer]), operation: crate::ExSolanaCoreOperation::SystemAllocateWithSeed { - account: pubkey(kb_program_ids::STAKE_PROGRAM_ID), + account: pubkey(ks_program_ids::STAKE_PROGRAM_ID), base: pubkey(payer), seed: long_seed, space: 1, @@ -2155,9 +2155,9 @@ mod tests { let missing_payer_intent = crate::ExSolanaCoreExecutionIntent { intent_id: std::string::String::from("prefund-missing-payer"), fee_payer: pubkey(payer), - policy: policy(&[payer, kb_program_ids::STAKE_PROGRAM_ID]), + policy: policy(&[payer, ks_program_ids::STAKE_PROGRAM_ID]), operation: crate::ExSolanaCoreOperation::SystemCreateAccountAllowPrefund { - new_account: pubkey(kb_program_ids::STAKE_PROGRAM_ID), + new_account: pubkey(ks_program_ids::STAKE_PROGRAM_ID), payer: std::option::Option::None, lamports: 1, space: 0, @@ -2172,7 +2172,7 @@ mod tests { #[test] fn malformed_and_dangerous_values_are_rejected() { - let payer = kb_program_ids::VOTE_PROGRAM_ID; + let payer = ks_program_ids::VOTE_PROGRAM_ID; let invalid_pubkey = crate::ExSolanaCoreExecutionIntent { intent_id: std::string::String::from("invalid-key"), fee_payer: pubkey("invalid"), @@ -2189,7 +2189,7 @@ mod tests { policy: policy(&[payer]), operation: crate::ExSolanaCoreOperation::SystemTransfer { from: pubkey(payer), - to: pubkey(kb_program_ids::STAKE_PROGRAM_ID), + to: pubkey(ks_program_ids::STAKE_PROGRAM_ID), lamports: 0, }, }; diff --git a/kb-lib/src/executor/solana/core/constants.rs b/ks-lib/src/executor/solana/core/constants.rs similarity index 63% rename from kb-lib/src/executor/solana/core/constants.rs rename to ks-lib/src/executor/solana/core/constants.rs index 95c2d40..bbe2fa0 100644 --- a/kb-lib/src/executor/solana/core/constants.rs +++ b/ks-lib/src/executor/solana/core/constants.rs @@ -1,7 +1,7 @@ -// file: kb-lib/src/executor/solana/core/constants.rs -// version: 3 +// file: ks-lib/src/executor/solana/core/constants.rs +// version: 4 -//! Local constants for the `kb-lib.executor.solana.core` crate. Program identifiers live in `kb_program_ids`. +//! Local constants for the `kb-lib.executor.solana.core` crate. Program identifiers live in `ks_program_ids`. /// Canonical tracing target for this crate. pub(crate) const TRACING_TARGET_EXECUTOR_SOLANA_CORE: &str = "kb-lib.executor.solana.core"; diff --git a/kb-lib/src/executor/solana/core/executor.rs b/ks-lib/src/executor/solana/core/executor.rs similarity index 86% rename from kb-lib/src/executor/solana/core/executor.rs rename to ks-lib/src/executor/solana/core/executor.rs index 1cbb9ec..8cba62a 100644 --- a/kb-lib/src/executor/solana/core/executor.rs +++ b/ks-lib/src/executor/solana/core/executor.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana/core/executor.rs -// version: 3 +// file: ks-lib/src/executor/solana/core/executor.rs +// version: 4 //! Exact capability dispatch and typed plan construction for Solana core. @@ -13,7 +13,7 @@ impl crate::ExSolanaCoreExecutor { program_id: &crate::MdProgramId, operation_code: &str, ) -> crate::ExApiExecutionCapability { - if program_id.0.as_str() == kb_program_ids::SYSTEM_PROGRAM_ID { + if program_id.0.as_str() == ks_program_ids::SYSTEM_PROGRAM_ID { return match operation_code { crate::EX_SOLANA_CORE_SYSTEM_TRANSFER_OPERATION | crate::EX_SOLANA_CORE_SYSTEM_TRANSFER_MANY_OPERATION @@ -40,7 +40,7 @@ impl crate::ExSolanaCoreExecutor { ), }; } - if program_id.0.as_str() == kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID { + if program_id.0.as_str() == ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID { return match operation_code { crate::EX_SOLANA_CORE_COMPUTE_BUDGET_REQUEST_HEAP_FRAME_OPERATION | crate::EX_SOLANA_CORE_COMPUTE_BUDGET_SET_UNIT_LIMIT_OPERATION @@ -54,7 +54,7 @@ impl crate::ExSolanaCoreExecutor { ), }; } - if program_id.0.as_str() == kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID { + if program_id.0.as_str() == ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID { return match operation_code { crate::EX_SOLANA_CORE_ADDRESS_LOOKUP_TABLE_CREATE_OPERATION | crate::EX_SOLANA_CORE_ADDRESS_LOOKUP_TABLE_EXTEND_OPERATION @@ -69,7 +69,7 @@ impl crate::ExSolanaCoreExecutor { ), }; } - if program_id.0.as_str() == kb_program_ids::ED25519_PROGRAM_ID { + if program_id.0.as_str() == ks_program_ids::ED25519_PROGRAM_ID { return match operation_code { crate::EX_SOLANA_CORE_ED25519_VERIFY_INLINE_OPERATION | crate::EX_SOLANA_CORE_ED25519_VERIFY_OFFSETS_OPERATION => { @@ -81,7 +81,7 @@ impl crate::ExSolanaCoreExecutor { ), }; } - if program_id.0.as_str() == kb_program_ids::SECP256K1_PROGRAM_ID { + if program_id.0.as_str() == ks_program_ids::SECP256K1_PROGRAM_ID { return match operation_code { crate::EX_SOLANA_CORE_SECP256K1_VERIFY_INLINE_OPERATION | crate::EX_SOLANA_CORE_SECP256K1_VERIFY_OFFSETS_OPERATION => { @@ -93,7 +93,7 @@ impl crate::ExSolanaCoreExecutor { ), }; } - if program_id.0.as_str() == kb_program_ids::SECP256R1_PROGRAM_ID { + if program_id.0.as_str() == ks_program_ids::SECP256R1_PROGRAM_ID { return match operation_code { crate::EX_SOLANA_CORE_SECP256R1_VERIFY_INLINE_OPERATION | crate::EX_SOLANA_CORE_SECP256R1_VERIFY_OFFSETS_OPERATION => { @@ -105,7 +105,7 @@ impl crate::ExSolanaCoreExecutor { ), }; } - if program_id.0.as_str() == kb_program_ids::STAKE_PROGRAM_ID { + if program_id.0.as_str() == ks_program_ids::STAKE_PROGRAM_ID { return match operation_code { crate::EX_SOLANA_CORE_STAKE_INITIALIZE_OPERATION | crate::EX_SOLANA_CORE_STAKE_INITIALIZE_CHECKED_OPERATION @@ -139,7 +139,7 @@ impl crate::ExSolanaCoreExecutor { ), }; } - if program_id.0.as_str() == kb_program_ids::VOTE_PROGRAM_ID { + if program_id.0.as_str() == ks_program_ids::VOTE_PROGRAM_ID { return match operation_code { crate::EX_SOLANA_CORE_VOTE_INITIALIZE_ACCOUNT_OPERATION | crate::EX_SOLANA_CORE_VOTE_INITIALIZE_ACCOUNT_V2_OPERATION @@ -173,7 +173,7 @@ impl crate::ExSolanaCoreExecutor { ), }; } - if program_id.0.as_str() == kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID { + if program_id.0.as_str() == ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID { return match operation_code { crate::EX_SOLANA_CORE_LOADER_V3_CREATE_BUFFER_OPERATION | crate::EX_SOLANA_CORE_LOADER_V3_WRITE_OPERATION @@ -194,15 +194,15 @@ impl crate::ExSolanaCoreExecutor { ), }; } - if program_id.0.as_str() == kb_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID - || program_id.0.as_str() == kb_program_ids::BPF_LOADER_PROGRAM_ID + if program_id.0.as_str() == ks_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID + || program_id.0.as_str() == ks_program_ids::BPF_LOADER_PROGRAM_ID { return crate::ExApiExecutionCapability::unsupported( "execution_legacy_bpf_loader_management_disabled", "BPF Loader v1/v2 management is historical and disabled on current clusters; the surfaces remain decode-only", ); } - if program_id.0.as_str() == kb_program_ids::LOADER_V4_PROGRAM_ID { + if program_id.0.as_str() == ks_program_ids::LOADER_V4_PROGRAM_ID { return match operation_code { crate::EX_SOLANA_CORE_LOADER_V4_CREATE_BUFFER_OPERATION | crate::EX_SOLANA_CORE_LOADER_V4_SET_PROGRAM_LENGTH_OPERATION @@ -221,13 +221,13 @@ impl crate::ExSolanaCoreExecutor { ), }; } - if program_id.0.as_str() == kb_program_ids::NATIVE_LOADER_PROGRAM_ID { + if program_id.0.as_str() == ks_program_ids::NATIVE_LOADER_PROGRAM_ID { return crate::ExApiExecutionCapability::unsupported( "execution_native_loader_validator_only", "Native Loader deployment is a validator software upgrade path and has no client instruction builder", ); } - if program_id.0.as_str() == kb_program_ids::CONFIG_PROGRAM_ID { + if program_id.0.as_str() == ks_program_ids::CONFIG_PROGRAM_ID { return match operation_code { crate::EX_SOLANA_CORE_CONFIG_CREATE_ACCOUNT_OPERATION | crate::EX_SOLANA_CORE_CONFIG_STORE_OPERATION => { @@ -239,7 +239,7 @@ impl crate::ExSolanaCoreExecutor { ), }; } - if program_id.0.as_str() == kb_program_ids::FEATURE_PROGRAM_ID { + if program_id.0.as_str() == ks_program_ids::FEATURE_PROGRAM_ID { return match operation_code { crate::EX_SOLANA_CORE_FEATURE_ACTIVATE_OPERATION | crate::EX_SOLANA_CORE_FEATURE_REVOKE_PENDING_ACTIVATION_OPERATION => { @@ -251,7 +251,7 @@ impl crate::ExSolanaCoreExecutor { ), }; } - if program_id.0.as_str() == kb_program_ids::SLASHING_PROGRAM_ID { + if program_id.0.as_str() == ks_program_ids::SLASHING_PROGRAM_ID { return match operation_code { crate::EX_SOLANA_CORE_SLASHING_CLOSE_VIOLATION_REPORT_OPERATION | crate::EX_SOLANA_CORE_SLASHING_SUBMIT_DUPLICATE_BLOCK_PROOF_OPERATION => { @@ -263,7 +263,7 @@ impl crate::ExSolanaCoreExecutor { ), }; } - if program_id.0.as_str() == kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID { + if program_id.0.as_str() == ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID { return match operation_code { crate::EX_SOLANA_CORE_ZK_ELGAMAL_VERIFY_INLINE_OPERATION | crate::EX_SOLANA_CORE_ZK_ELGAMAL_VERIFY_FROM_ACCOUNT_OPERATION @@ -276,7 +276,7 @@ impl crate::ExSolanaCoreExecutor { ), }; } - if program_id.0.as_str() == kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID { + if program_id.0.as_str() == ks_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID { return crate::ExApiExecutionCapability::unsupported( "execution_historical_zk_token_proof_decode_only", "the historical ZK Token Proof program is retained for decoding only and has no current callable runtime surface", @@ -312,7 +312,7 @@ impl crate::ExApiTypedInstructionExecutor for crate::ExSolanaCoreExecutor { fn build_prepared_plan( &self, intent: &Self::Intent, - ) -> kb_core::Result { + ) -> ks_core::Result { let program_id = crate::MdProgramId(std::string::String::from(intent.operation.program_id())); return match self.exact_capability(&program_id, intent.operation.operation_code()) { @@ -320,7 +320,7 @@ impl crate::ExApiTypedInstructionExecutor for crate::ExSolanaCoreExecutor { crate::executor_solana_core_builder_build_prepared_plan(intent) }, crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => { - std::result::Result::Err(kb_core::Error::new(reason_code, reason)) + std::result::Result::Err(ks_core::Error::new(reason_code, reason)) }, }; } @@ -337,24 +337,24 @@ impl crate::ExApiInstructionExecutor for crate::ExSolanaCoreExecutor { fn program_ids(&self) -> &'static [&'static str] { return &[ - kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID, - kb_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID, - kb_program_ids::BPF_LOADER_PROGRAM_ID, - kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, - kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID, - kb_program_ids::CONFIG_PROGRAM_ID, - kb_program_ids::ED25519_PROGRAM_ID, - kb_program_ids::FEATURE_PROGRAM_ID, - kb_program_ids::LOADER_V4_PROGRAM_ID, - kb_program_ids::NATIVE_LOADER_PROGRAM_ID, - kb_program_ids::SLASHING_PROGRAM_ID, - kb_program_ids::SECP256K1_PROGRAM_ID, - kb_program_ids::SECP256R1_PROGRAM_ID, - kb_program_ids::STAKE_PROGRAM_ID, - kb_program_ids::SYSTEM_PROGRAM_ID, - kb_program_ids::VOTE_PROGRAM_ID, - kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, - kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID, + ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID, + ks_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID, + ks_program_ids::BPF_LOADER_PROGRAM_ID, + ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, + ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID, + ks_program_ids::CONFIG_PROGRAM_ID, + ks_program_ids::ED25519_PROGRAM_ID, + ks_program_ids::FEATURE_PROGRAM_ID, + ks_program_ids::LOADER_V4_PROGRAM_ID, + ks_program_ids::NATIVE_LOADER_PROGRAM_ID, + ks_program_ids::SLASHING_PROGRAM_ID, + ks_program_ids::SECP256K1_PROGRAM_ID, + ks_program_ids::SECP256R1_PROGRAM_ID, + ks_program_ids::STAKE_PROGRAM_ID, + ks_program_ids::SYSTEM_PROGRAM_ID, + ks_program_ids::VOTE_PROGRAM_ID, + ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, + ks_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID, ]; } @@ -375,11 +375,11 @@ impl crate::ExApiInstructionExecutor for crate::ExSolanaCoreExecutor { fn build_plan( &self, request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { match self.exact_capability(&request.program_id, &request.operation_code) { crate::ExApiExecutionCapability::Supported { operation_code: _ } => {}, crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => { - return std::result::Result::Err(kb_core::Error::new(reason_code, reason)); + return std::result::Result::Err(ks_core::Error::new(reason_code, reason)); }, } let intent = @@ -387,14 +387,14 @@ impl crate::ExApiInstructionExecutor for crate::ExSolanaCoreExecutor { { std::result::Result::Ok(intent) => intent, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_solana_core_intent_deserialize_failed", error.to_string(), )); }, }; if intent.operation.operation_code() != request.operation_code.as_str() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_operation_code_mismatch", format!( "request operation {} does not match typed intent operation {}", @@ -404,7 +404,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSolanaCoreExecutor { )); } if intent.operation.program_id() != request.program_id.0.as_str() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_program_id_mismatch", format!( "request program {} does not match typed intent program {}", @@ -428,7 +428,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSolanaCoreExecutor { } }, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_solana_core_plan_serialize_failed", error.to_string(), )); @@ -448,16 +448,16 @@ mod tests { fn executor_programs_match_native_registry_without_spl_memo() { let executor = crate::ExSolanaCoreExecutor; let executor_ids = crate::ExApiInstructionExecutor::program_ids(&executor); - let native_ids = kb_program_ids::native_program_ids() + let native_ids = ks_program_ids::native_program_ids() .iter() .map(|entry| return entry.program_id()) .collect::>(); let actual_ids = executor_ids.iter().copied().collect::>(); assert_eq!(actual_ids, native_ids); - assert!(!actual_ids.contains(kb_program_ids::SPL_MEMO_V1_PROGRAM_ID)); - assert!(!actual_ids.contains(kb_program_ids::SPL_MEMO_V3_PROGRAM_ID)); - assert!(!actual_ids.contains(kb_program_ids::SPL_MEMO_V4_PROGRAM_ID)); - assert!(!actual_ids.contains(kb_program_ids::STAKE_CONFIG_ACCOUNT_ID)); + assert!(!actual_ids.contains(ks_program_ids::SPL_MEMO_V1_PROGRAM_ID)); + assert!(!actual_ids.contains(ks_program_ids::SPL_MEMO_V3_PROGRAM_ID)); + assert!(!actual_ids.contains(ks_program_ids::SPL_MEMO_V4_PROGRAM_ID)); + assert!(!actual_ids.contains(ks_program_ids::STAKE_CONFIG_ACCOUNT_ID)); } #[test] @@ -465,38 +465,38 @@ mod tests { let executor = crate::ExSolanaCoreExecutor; let transfer = crate::ExApiTypedInstructionExecutor::capability( &executor, - &crate::MdProgramId(std::string::String::from(kb_program_ids::SYSTEM_PROGRAM_ID)), + &crate::MdProgramId(std::string::String::from(ks_program_ids::SYSTEM_PROGRAM_ID)), crate::EX_SOLANA_CORE_SYSTEM_TRANSFER_OPERATION, ); assert!(transfer.is_supported()); let seeded_transfer = crate::ExApiTypedInstructionExecutor::capability( &executor, - &crate::MdProgramId(std::string::String::from(kb_program_ids::SYSTEM_PROGRAM_ID)), + &crate::MdProgramId(std::string::String::from(ks_program_ids::SYSTEM_PROGRAM_ID)), crate::EX_SOLANA_CORE_SYSTEM_TRANSFER_WITH_SEED_OPERATION, ); assert!(seeded_transfer.is_supported()); let prefund = crate::ExApiTypedInstructionExecutor::capability( &executor, - &crate::MdProgramId(std::string::String::from(kb_program_ids::SYSTEM_PROGRAM_ID)), + &crate::MdProgramId(std::string::String::from(ks_program_ids::SYSTEM_PROGRAM_ID)), crate::EX_SOLANA_CORE_SYSTEM_CREATE_ACCOUNT_ALLOW_PREFUND_OPERATION, ); assert!(prefund.is_supported()); let nonce = crate::ExApiTypedInstructionExecutor::capability( &executor, - &crate::MdProgramId(std::string::String::from(kb_program_ids::SYSTEM_PROGRAM_ID)), + &crate::MdProgramId(std::string::String::from(ks_program_ids::SYSTEM_PROGRAM_ID)), crate::EX_SOLANA_CORE_SYSTEM_NONCE_ADVANCE_OPERATION, ); assert!(nonce.is_supported()); let transfer_many = crate::ExApiTypedInstructionExecutor::capability( &executor, - &crate::MdProgramId(std::string::String::from(kb_program_ids::SYSTEM_PROGRAM_ID)), + &crate::MdProgramId(std::string::String::from(ks_program_ids::SYSTEM_PROGRAM_ID)), crate::EX_SOLANA_CORE_SYSTEM_TRANSFER_MANY_OPERATION, ); assert!(transfer_many.is_supported()); let heap_frame = crate::ExApiTypedInstructionExecutor::capability( &executor, &crate::MdProgramId(std::string::String::from( - kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID, + ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID, )), crate::EX_SOLANA_CORE_COMPUTE_BUDGET_REQUEST_HEAP_FRAME_OPERATION, ); @@ -504,7 +504,7 @@ mod tests { let loaded_accounts_data_size = crate::ExApiTypedInstructionExecutor::capability( &executor, &crate::MdProgramId(std::string::String::from( - kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID, + ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID, )), crate::EX_SOLANA_CORE_COMPUTE_BUDGET_SET_LOADED_ACCOUNTS_DATA_SIZE_LIMIT_OPERATION, ); @@ -512,51 +512,51 @@ mod tests { let lookup_table_create = crate::ExApiTypedInstructionExecutor::capability( &executor, &crate::MdProgramId(std::string::String::from( - kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID, + ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID, )), crate::EX_SOLANA_CORE_ADDRESS_LOOKUP_TABLE_CREATE_OPERATION, ); assert!(lookup_table_create.is_supported()); let ed25519 = crate::ExApiTypedInstructionExecutor::capability( &executor, - &crate::MdProgramId(std::string::String::from(kb_program_ids::ED25519_PROGRAM_ID)), + &crate::MdProgramId(std::string::String::from(ks_program_ids::ED25519_PROGRAM_ID)), crate::EX_SOLANA_CORE_ED25519_VERIFY_INLINE_OPERATION, ); assert!(ed25519.is_supported()); let secp256k1 = crate::ExApiTypedInstructionExecutor::capability( &executor, - &crate::MdProgramId(std::string::String::from(kb_program_ids::SECP256K1_PROGRAM_ID)), + &crate::MdProgramId(std::string::String::from(ks_program_ids::SECP256K1_PROGRAM_ID)), crate::EX_SOLANA_CORE_SECP256K1_VERIFY_OFFSETS_OPERATION, ); assert!(secp256k1.is_supported()); let secp256r1 = crate::ExApiTypedInstructionExecutor::capability( &executor, - &crate::MdProgramId(std::string::String::from(kb_program_ids::SECP256R1_PROGRAM_ID)), + &crate::MdProgramId(std::string::String::from(ks_program_ids::SECP256R1_PROGRAM_ID)), crate::EX_SOLANA_CORE_SECP256R1_VERIFY_INLINE_OPERATION, ); assert!(secp256r1.is_supported()); let config = crate::ExApiTypedInstructionExecutor::capability( &executor, - &crate::MdProgramId(std::string::String::from(kb_program_ids::CONFIG_PROGRAM_ID)), + &crate::MdProgramId(std::string::String::from(ks_program_ids::CONFIG_PROGRAM_ID)), crate::EX_SOLANA_CORE_CONFIG_STORE_OPERATION, ); assert!(config.is_supported()); let feature = crate::ExApiTypedInstructionExecutor::capability( &executor, - &crate::MdProgramId(std::string::String::from(kb_program_ids::FEATURE_PROGRAM_ID)), + &crate::MdProgramId(std::string::String::from(ks_program_ids::FEATURE_PROGRAM_ID)), crate::EX_SOLANA_CORE_FEATURE_ACTIVATE_OPERATION, ); assert!(feature.is_supported()); let slashing = crate::ExApiTypedInstructionExecutor::capability( &executor, - &crate::MdProgramId(std::string::String::from(kb_program_ids::SLASHING_PROGRAM_ID)), + &crate::MdProgramId(std::string::String::from(ks_program_ids::SLASHING_PROGRAM_ID)), crate::EX_SOLANA_CORE_SLASHING_SUBMIT_DUPLICATE_BLOCK_PROOF_OPERATION, ); assert!(slashing.is_supported()); let zk_elgamal = crate::ExApiTypedInstructionExecutor::capability( &executor, &crate::MdProgramId(std::string::String::from( - kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, + ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, )), crate::EX_SOLANA_CORE_ZK_ELGAMAL_VERIFY_INLINE_OPERATION, ); @@ -564,7 +564,7 @@ mod tests { let historical_zk = crate::ExApiTypedInstructionExecutor::capability( &executor, &crate::MdProgramId(std::string::String::from( - kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID, + ks_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID, )), "solana.core.zk_token.verify_zero_balance", ); @@ -575,13 +575,13 @@ mod tests { )); let stake = crate::ExApiTypedInstructionExecutor::capability( &executor, - &crate::MdProgramId(std::string::String::from(kb_program_ids::STAKE_PROGRAM_ID)), + &crate::MdProgramId(std::string::String::from(ks_program_ids::STAKE_PROGRAM_ID)), crate::EX_SOLANA_CORE_STAKE_DELEGATE_OPERATION, ); assert!(stake.is_supported()); let vote = crate::ExApiTypedInstructionExecutor::capability( &executor, - &crate::MdProgramId(std::string::String::from(kb_program_ids::VOTE_PROGRAM_ID)), + &crate::MdProgramId(std::string::String::from(ks_program_ids::VOTE_PROGRAM_ID)), crate::EX_SOLANA_CORE_VOTE_TOWER_SYNC_SWITCH_OPERATION, ); assert!(vote.is_supported()); @@ -589,7 +589,7 @@ mod tests { &executor, &crate::ExApiExecutionRequest { program_id: crate::MdProgramId(std::string::String::from( - kb_program_ids::SYSTEM_PROGRAM_ID, + ks_program_ids::SYSTEM_PROGRAM_ID, )), operation_code: std::string::String::from( crate::EX_SOLANA_CORE_SYSTEM_TRANSFER_OPERATION, @@ -602,7 +602,7 @@ mod tests { &executor, &crate::ExApiExecutionRequest { program_id: crate::MdProgramId(std::string::String::from( - kb_program_ids::SYSTEM_PROGRAM_ID, + ks_program_ids::SYSTEM_PROGRAM_ID, )), operation_code: std::string::String::from( crate::EX_SOLANA_CORE_SYSTEM_NONCE_ADVANCE_OPERATION, @@ -615,7 +615,7 @@ mod tests { #[test] fn legacy_request_builds_the_same_typed_plan_payload() { - let payer = crate::MdPubkey(std::string::String::from(kb_program_ids::VOTE_PROGRAM_ID)); + let payer = crate::MdPubkey(std::string::String::from(ks_program_ids::VOTE_PROGRAM_ID)); let intent = crate::ExSolanaCoreExecutionIntent { intent_id: std::string::String::from("legacy-transfer"), fee_payer: payer.clone(), @@ -630,7 +630,7 @@ mod tests { }, operation: crate::ExSolanaCoreOperation::SystemTransfer { from: payer, - to: crate::MdPubkey(std::string::String::from(kb_program_ids::STAKE_PROGRAM_ID)), + to: crate::MdPubkey(std::string::String::from(ks_program_ids::STAKE_PROGRAM_ID)), lamports: 10, }, }; @@ -640,7 +640,7 @@ mod tests { &crate::ExSolanaCoreExecutor, &crate::ExApiExecutionRequest { program_id: crate::MdProgramId(std::string::String::from( - kb_program_ids::SYSTEM_PROGRAM_ID, + ks_program_ids::SYSTEM_PROGRAM_ID, )), operation_code: std::string::String::from( crate::EX_SOLANA_CORE_SYSTEM_TRANSFER_OPERATION, diff --git a/kb-lib/src/executor/solana/core/intent.rs b/ks-lib/src/executor/solana/core/intent.rs similarity index 98% rename from kb-lib/src/executor/solana/core/intent.rs rename to ks-lib/src/executor/solana/core/intent.rs index e62cfa6..dfe49a8 100644 --- a/kb-lib/src/executor/solana/core/intent.rs +++ b/ks-lib/src/executor/solana/core/intent.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana/core/intent.rs -// version: 2 +// file: ks-lib/src/executor/solana/core/intent.rs +// version: 3 //! Typed Solana core execution intents. @@ -415,7 +415,7 @@ pub const EX_SOLANA_CORE_OPERATION_CODES: [&str; 109] = [ #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/solana/core/intent/ExSolanaCoreSystemTransferRecipient.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/solana/core/intent/ExSolanaCoreSystemTransferRecipient.ts" )] pub struct ExSolanaCoreSystemTransferRecipient { /// Recipient account. @@ -428,7 +428,7 @@ pub struct ExSolanaCoreSystemTransferRecipient { #[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/solana/core/intent/ExSolanaCoreEd25519VerificationOffsets.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/solana/core/intent/ExSolanaCoreEd25519VerificationOffsets.ts" )] pub struct ExSolanaCoreEd25519VerificationOffsets { /// Offset to the 64-byte signature. @@ -451,7 +451,7 @@ pub struct ExSolanaCoreEd25519VerificationOffsets { #[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/solana/core/intent/ExSolanaCoreSecp256k1VerificationOffsets.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/solana/core/intent/ExSolanaCoreSecp256k1VerificationOffsets.ts" )] pub struct ExSolanaCoreSecp256k1VerificationOffsets { /// Offset to the 64-byte signature followed by its one-byte recovery id. @@ -474,7 +474,7 @@ pub struct ExSolanaCoreSecp256k1VerificationOffsets { #[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/solana/core/intent/ExSolanaCoreSecp256r1VerificationOffsets.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/solana/core/intent/ExSolanaCoreSecp256r1VerificationOffsets.ts" )] pub struct ExSolanaCoreSecp256r1VerificationOffsets { /// Offset to the compact 64-byte signature. @@ -498,7 +498,7 @@ pub struct ExSolanaCoreSecp256r1VerificationOffsets { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/solana/core/intent/ExSolanaCoreStakeAuthorizationKind.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/solana/core/intent/ExSolanaCoreStakeAuthorizationKind.ts" )] pub enum ExSolanaCoreStakeAuthorizationKind { /// Staker authority controlling delegation and stake movement. @@ -521,7 +521,7 @@ impl crate::ExSolanaCoreStakeAuthorizationKind { #[serde(tag = "kind", rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/solana/core/intent/ExSolanaCoreVoteAuthorizationKind.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/solana/core/intent/ExSolanaCoreVoteAuthorizationKind.ts" )] pub enum ExSolanaCoreVoteAuthorizationKind { /// Vote authority using an Ed25519 public key. @@ -542,7 +542,7 @@ pub enum ExSolanaCoreVoteAuthorizationKind { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/solana/core/intent/ExSolanaCoreVoteCommissionKind.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/solana/core/intent/ExSolanaCoreVoteCommissionKind.ts" )] pub enum ExSolanaCoreVoteCommissionKind { /// Inflation-reward commission. @@ -566,7 +566,7 @@ impl crate::ExSolanaCoreVoteCommissionKind { #[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/solana/core/intent/ExSolanaCoreVoteLockout.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/solana/core/intent/ExSolanaCoreVoteLockout.ts" )] pub struct ExSolanaCoreVoteLockout { /// Voted slot. @@ -579,7 +579,7 @@ pub struct ExSolanaCoreVoteLockout { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/solana/core/intent/ExSolanaCoreConfigKey.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/solana/core/intent/ExSolanaCoreConfigKey.ts" )] pub struct ExSolanaCoreConfigKey { /// Public key stored in the Config Program key list. @@ -592,7 +592,7 @@ pub struct ExSolanaCoreConfigKey { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/solana/core/intent/ExSolanaCoreZkElGamalContextState.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/solana/core/intent/ExSolanaCoreZkElGamalContextState.ts" )] pub struct ExSolanaCoreZkElGamalContextState { /// Preallocated writable context-state account. @@ -606,7 +606,7 @@ pub struct ExSolanaCoreZkElGamalContextState { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/solana/core/intent/ExSolanaCoreZkElGamalProofType.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/solana/core/intent/ExSolanaCoreZkElGamalProofType.ts" )] pub enum ExSolanaCoreZkElGamalProofType { /// Zero-ciphertext proof. @@ -736,7 +736,7 @@ impl crate::ExSolanaCoreZkElGamalProofType { #[serde(tag = "operation", rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/solana/core/intent/ExSolanaCoreOperation.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/solana/core/intent/ExSolanaCoreOperation.ts" )] pub enum ExSolanaCoreOperation { /// Transfer lamports between System Program accounts. @@ -2338,28 +2338,28 @@ impl crate::ExSolanaCoreOperation { | Self::SystemAdvanceNonceAccount { .. } | Self::SystemAuthorizeNonceAccount { .. } | Self::SystemWithdrawNonceAccount { .. } - | Self::SystemUpgradeNonceAccount { .. } => kb_program_ids::SYSTEM_PROGRAM_ID, + | Self::SystemUpgradeNonceAccount { .. } => ks_program_ids::SYSTEM_PROGRAM_ID, Self::ComputeBudgetRequestHeapFrame { .. } | Self::ComputeBudgetSetUnitLimit { .. } | Self::ComputeBudgetSetUnitPrice { .. } | Self::ComputeBudgetSetLoadedAccountsDataSizeLimit { .. } => { - kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID + ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID }, Self::AddressLookupTableCreate { .. } | Self::AddressLookupTableExtend { .. } | Self::AddressLookupTableFreeze { .. } | Self::AddressLookupTableDeactivate { .. } | Self::AddressLookupTableClose { .. } => { - kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID + ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID }, Self::Ed25519VerifyInline { .. } | Self::Ed25519VerifyOffsets { .. } => { - kb_program_ids::ED25519_PROGRAM_ID + ks_program_ids::ED25519_PROGRAM_ID }, Self::Secp256k1VerifyInline { .. } | Self::Secp256k1VerifyOffsets { .. } => { - kb_program_ids::SECP256K1_PROGRAM_ID + ks_program_ids::SECP256K1_PROGRAM_ID }, Self::Secp256r1VerifyInline { .. } | Self::Secp256r1VerifyOffsets { .. } => { - kb_program_ids::SECP256R1_PROGRAM_ID + ks_program_ids::SECP256R1_PROGRAM_ID }, Self::StakeInitialize { .. } | Self::StakeInitializeChecked { .. } @@ -2384,7 +2384,7 @@ impl crate::ExSolanaCoreOperation { | Self::StakeGetMinimumDelegation | Self::StakeDeactivateDelinquent { .. } | Self::StakeMoveStake { .. } - | Self::StakeMoveLamports { .. } => kb_program_ids::STAKE_PROGRAM_ID, + | Self::StakeMoveLamports { .. } => ks_program_ids::STAKE_PROGRAM_ID, Self::VoteInitializeAccount { .. } | Self::VoteInitializeAccountV2 { .. } | Self::VoteCreateAccount { .. } @@ -2408,7 +2408,7 @@ impl crate::ExSolanaCoreOperation { | Self::VoteTowerSyncSwitch { .. } | Self::VoteUpdateCommissionCollector { .. } | Self::VoteUpdateCommissionBps { .. } - | Self::VoteDepositDelegatorRewards { .. } => kb_program_ids::VOTE_PROGRAM_ID, + | Self::VoteDepositDelegatorRewards { .. } => ks_program_ids::VOTE_PROGRAM_ID, Self::LoaderV3CreateBuffer { .. } | Self::LoaderV3Write { .. } | Self::LoaderV3DeployWithMaxProgramLen { .. } @@ -2420,7 +2420,7 @@ impl crate::ExSolanaCoreOperation { | Self::LoaderV3Close { .. } | Self::LoaderV3CloseAny { .. } | Self::LoaderV3ExtendProgram { .. } => { - kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID + ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID }, Self::LoaderV4CreateBuffer { .. } | Self::LoaderV4SetProgramLength { .. } @@ -2430,19 +2430,19 @@ impl crate::ExSolanaCoreOperation { | Self::LoaderV4DeployFromSource { .. } | Self::LoaderV4Retract { .. } | Self::LoaderV4TransferAuthority { .. } - | Self::LoaderV4Finalize { .. } => kb_program_ids::LOADER_V4_PROGRAM_ID, + | Self::LoaderV4Finalize { .. } => ks_program_ids::LOADER_V4_PROGRAM_ID, Self::ConfigCreateAccount { .. } | Self::ConfigStore { .. } => { - kb_program_ids::CONFIG_PROGRAM_ID + ks_program_ids::CONFIG_PROGRAM_ID }, Self::FeatureActivate { .. } | Self::FeatureRevokePendingActivation { .. } => { - kb_program_ids::FEATURE_PROGRAM_ID + ks_program_ids::FEATURE_PROGRAM_ID }, Self::SlashingCloseViolationReport { .. } - | Self::SlashingSubmitDuplicateBlockProof { .. } => kb_program_ids::SLASHING_PROGRAM_ID, + | Self::SlashingSubmitDuplicateBlockProof { .. } => ks_program_ids::SLASHING_PROGRAM_ID, Self::ZkElGamalVerifyInline { .. } | Self::ZkElGamalVerifyFromAccount { .. } | Self::ZkElGamalCloseContextState { .. } => { - kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID + ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID }, }; } @@ -2452,7 +2452,7 @@ impl crate::ExSolanaCoreOperation { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/solana/core/intent/ExSolanaCoreExecutionIntent.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/solana/core/intent/ExSolanaCoreExecutionIntent.ts" )] pub struct ExSolanaCoreExecutionIntent { /// Stable caller-provided identifier used for logs and replay correlation. @@ -2507,9 +2507,9 @@ mod matrix_tests { }; assert_eq!(surfaces.len(), 18); - let registered = kb_program_ids::registered_program_ids() + let registered = ks_program_ids::registered_program_ids() .iter() - .map(kb_program_ids::ProgramIdEntry::program_id) + .map(ks_program_ids::ProgramIdEntry::program_id) .collect::>(); let mut surface_codes = std::collections::BTreeSet::new(); let mut matrix_program_ids = std::collections::BTreeSet::new(); diff --git a/kb-lib/src/executor/solana/core/loader_v3.rs b/ks-lib/src/executor/solana/core/loader_v3.rs similarity index 98% rename from kb-lib/src/executor/solana/core/loader_v3.rs rename to ks-lib/src/executor/solana/core/loader_v3.rs index 54cd3c5..1b8397f 100644 --- a/kb-lib/src/executor/solana/core/loader_v3.rs +++ b/ks-lib/src/executor/solana/core/loader_v3.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana/core/loader_v3.rs -// version: 1 +// file: ks-lib/src/executor/solana/core/loader_v3.rs +// version: 2 //! Exact client-constructible Loader v3 plans backed by `solana-loader-v3-interface`. @@ -9,7 +9,7 @@ const MAX_WRITE_BYTES: usize = 1_024; pub(crate) fn executor_solana_core_loader_v3_build_prepared_plan( intent: &crate::ExSolanaCoreExecutionIntent, fee_payer: &solana_pubkey::Pubkey, -) -> kb_core::Result { +) -> ks_core::Result { return match &intent.operation { crate::ExSolanaCoreOperation::LoaderV3CreateBuffer { payer, @@ -133,7 +133,7 @@ pub(crate) fn executor_solana_core_loader_v3_build_prepared_plan( } => { build_extend_program_plan(intent, fee_payer, program, payer.as_ref(), *additional_bytes) }, - _ => std::result::Result::Err(kb_core::Error::new( + _ => std::result::Result::Err(ks_core::Error::new( "execution_loader_v3_operation_dispatch_invalid", format!( "operation {} was dispatched to the Loader v3 builder", @@ -151,7 +151,7 @@ fn build_create_buffer_plan( authority: &crate::MdPubkey, lamports: u64, program_len: u64, -) -> kb_core::Result { +) -> ks_core::Result { if lamports == 0 { return crate::executor_solana_core_invalid( "execution_loader_v3_buffer_lamports_zero", @@ -222,7 +222,7 @@ fn build_write_plan( authority: &crate::MdPubkey, offset: u32, bytes: &[u8], -) -> kb_core::Result { +) -> ks_core::Result { if bytes.is_empty() || bytes.len() > MAX_WRITE_BYTES { return crate::executor_solana_core_invalid( "execution_loader_v3_write_size_invalid", @@ -280,7 +280,7 @@ fn build_deploy_plan( program_lamports: u64, max_data_len: u64, close_buffer: bool, -) -> kb_core::Result { +) -> ks_core::Result { if program_lamports == 0 { return crate::executor_solana_core_invalid( "execution_loader_v3_program_lamports_zero", @@ -366,7 +366,7 @@ fn build_upgrade_plan( authority: &crate::MdPubkey, spill: &crate::MdPubkey, close_buffer: bool, -) -> kb_core::Result { +) -> ks_core::Result { for (first, second, first_name, second_name) in [ (program, buffer, "program", "buffer"), (program, spill, "program", "spill"), @@ -418,7 +418,7 @@ fn build_set_buffer_authority_plan( current_authority: &crate::MdPubkey, new_authority: &crate::MdPubkey, checked: bool, -) -> kb_core::Result { +) -> ks_core::Result { match distinct(current_authority, new_authority, "current_authority", "new_authority") { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -482,7 +482,7 @@ fn build_set_upgrade_authority_plan( current_authority: &crate::MdPubkey, new_authority: std::option::Option<&crate::MdPubkey>, checked: bool, -) -> kb_core::Result { +) -> ks_core::Result { if checked && new_authority.is_none() { return crate::executor_solana_core_invalid( "execution_loader_v3_checked_authority_missing", @@ -579,7 +579,7 @@ fn build_close_plan( recipient: &crate::MdPubkey, authority: &crate::MdPubkey, tombstone: bool, -) -> kb_core::Result { +) -> ks_core::Result { match distinct(close_account, recipient, "close_account", "recipient") { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -622,7 +622,7 @@ fn build_close_any_plan( authority: std::option::Option<&crate::MdPubkey>, program: std::option::Option<&crate::MdPubkey>, tombstone: bool, -) -> kb_core::Result { +) -> ks_core::Result { match distinct(close_account, recipient, "close_account", "recipient") { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -690,7 +690,7 @@ fn build_extend_program_plan( program: &crate::MdPubkey, payer: std::option::Option<&crate::MdPubkey>, additional_bytes: u32, -) -> kb_core::Result { +) -> ks_core::Result { if additional_bytes < solana_loader_v3_interface::instruction::MINIMUM_EXTEND_PROGRAM_BYTES { return crate::executor_solana_core_invalid( "execution_loader_v3_extend_below_current_minimum", @@ -741,7 +741,7 @@ fn build_extend_program_plan( ); } -fn bounded_data_length(value: u64, field_name: &str) -> kb_core::Result { +fn bounded_data_length(value: u64, field_name: &str) -> ks_core::Result { if value == 0 || value > solana_system_interface::MAX_PERMITTED_DATA_LENGTH { return crate::executor_solana_core_invalid( "execution_loader_v3_data_length_out_of_range", @@ -765,7 +765,7 @@ fn distinct( second: &crate::MdPubkey, first_name: &str, second_name: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { return crate::executor_solana_core_validate_distinct_pubkeys( first, second, @@ -777,7 +777,7 @@ fn distinct( fn official_error( operation: &str, error: solana_instruction::error::InstructionError, -) -> kb_core::Result { +) -> ks_core::Result { return crate::executor_solana_core_invalid( "execution_loader_v3_official_builder_failed", format!("official {operation} builder from {} failed: {error:?}", SOURCE), @@ -817,7 +817,7 @@ mod tests { fn build( intent: &crate::ExSolanaCoreExecutionIntent, - ) -> kb_core::Result { + ) -> ks_core::Result { let executor = crate::ExSolanaCoreExecutor; return crate::ExApiTypedInstructionExecutor::build_prepared_plan(&executor, intent); } diff --git a/kb-lib/src/executor/solana/core/loader_v4.rs b/ks-lib/src/executor/solana/core/loader_v4.rs similarity index 97% rename from kb-lib/src/executor/solana/core/loader_v4.rs rename to ks-lib/src/executor/solana/core/loader_v4.rs index 2059764..646038a 100644 --- a/kb-lib/src/executor/solana/core/loader_v4.rs +++ b/ks-lib/src/executor/solana/core/loader_v4.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana/core/loader_v4.rs -// version: 1 +// file: ks-lib/src/executor/solana/core/loader_v4.rs +// version: 2 //! Exact Loader v4 client plans without activating the interface's `bincode` helpers. @@ -17,7 +17,7 @@ const FINALIZE_TAG: u32 = 6; pub(crate) fn executor_solana_core_loader_v4_build_prepared_plan( intent: &crate::ExSolanaCoreExecutionIntent, fee_payer: &solana_pubkey::Pubkey, -) -> kb_core::Result { +) -> ks_core::Result { return match &intent.operation { crate::ExSolanaCoreOperation::LoaderV4CreateBuffer { payer, @@ -98,7 +98,7 @@ pub(crate) fn executor_solana_core_loader_v4_build_prepared_plan( authority, next_version_program, } => build_finalize_plan(intent, fee_payer, program, authority, next_version_program), - _ => std::result::Result::Err(kb_core::Error::new( + _ => std::result::Result::Err(ks_core::Error::new( "execution_loader_v4_operation_dispatch_invalid", format!( "operation {} was dispatched to the Loader v4 builder", @@ -117,7 +117,7 @@ fn build_create_buffer_plan( recipient: &crate::MdPubkey, lamports: u64, new_size: u32, -) -> kb_core::Result { +) -> ks_core::Result { if lamports == 0 { return crate::executor_solana_core_invalid( "execution_loader_v4_buffer_lamports_zero", @@ -195,7 +195,7 @@ fn build_set_program_length_plan( authority: &crate::MdPubkey, recipient: &crate::MdPubkey, new_size: u32, -) -> kb_core::Result { +) -> ks_core::Result { match validate_size(new_size) { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -238,7 +238,7 @@ fn build_write_plan( authority: &crate::MdPubkey, offset: u32, bytes: &[u8], -) -> kb_core::Result { +) -> ks_core::Result { if bytes.is_empty() || bytes.len() > MAX_WRITE_BYTES { return crate::executor_solana_core_invalid( "execution_loader_v4_write_size_invalid", @@ -294,7 +294,7 @@ fn build_copy_plan( destination_offset: u32, source_offset: u32, length: u32, -) -> kb_core::Result { +) -> ks_core::Result { if length == 0 { return crate::executor_solana_core_invalid( "execution_loader_v4_copy_length_zero", @@ -351,7 +351,7 @@ fn build_authority_unit_plan( program: &crate::MdPubkey, authority: &crate::MdPubkey, tag: u32, -) -> kb_core::Result { +) -> ks_core::Result { let program_address = match crate::executor_solana_core_parse_pubkey(program, "program") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -383,7 +383,7 @@ fn build_deploy_from_source_plan( program: &crate::MdPubkey, authority: &crate::MdPubkey, source_program: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { match distinct(program, source_program, "program", "source_program") { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -425,7 +425,7 @@ fn build_transfer_authority_plan( program: &crate::MdPubkey, current_authority: &crate::MdPubkey, new_authority: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { match distinct(current_authority, new_authority, "current_authority", "new_authority") { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -474,7 +474,7 @@ fn build_finalize_plan( program: &crate::MdPubkey, authority: &crate::MdPubkey, next_version_program: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { let program_address = match crate::executor_solana_core_parse_pubkey(program, "program") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -549,7 +549,7 @@ fn finalize_single( operation_code: &str, instruction: solana_instruction::Instruction, signer_roles: std::vec::Vec<(crate::MdPubkey, std::string::String)>, -) -> kb_core::Result { +) -> ks_core::Result { return crate::executor_solana_core_finalize_prepared_plan( intent, fee_payer, @@ -561,7 +561,7 @@ fn finalize_single( ); } -fn validate_size(new_size: u32) -> kb_core::Result<()> { +fn validate_size(new_size: u32) -> ks_core::Result<()> { if u64::from(new_size) > solana_system_interface::MAX_PERMITTED_DATA_LENGTH { return crate::executor_solana_core_invalid( "execution_loader_v4_program_size_out_of_range", @@ -579,7 +579,7 @@ fn distinct( second: &crate::MdPubkey, first_name: &str, second_name: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { return crate::executor_solana_core_validate_distinct_pubkeys( first, second, @@ -621,7 +621,7 @@ mod tests { fn build( intent: &crate::ExSolanaCoreExecutionIntent, - ) -> kb_core::Result { + ) -> ks_core::Result { let executor = crate::ExSolanaCoreExecutor; return crate::ExApiTypedInstructionExecutor::build_prepared_plan(&executor, intent); } diff --git a/kb-lib/src/executor/solana/core/native_admin.rs b/ks-lib/src/executor/solana/core/native_admin.rs similarity index 92% rename from kb-lib/src/executor/solana/core/native_admin.rs rename to ks-lib/src/executor/solana/core/native_admin.rs index 874c979..ece07a1 100644 --- a/kb-lib/src/executor/solana/core/native_admin.rs +++ b/ks-lib/src/executor/solana/core/native_admin.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana/core/native_admin.rs -// version: 1 +// file: ks-lib/src/executor/solana/core/native_admin.rs +// version: 2 //! Config Program and Feature Program instruction builders. @@ -9,7 +9,7 @@ const MAX_CONFIG_INSTRUCTION_DATA_BYTES: usize = u16::MAX as usize; pub(crate) fn executor_solana_core_native_admin_build_prepared_plan( intent: &crate::ExSolanaCoreExecutionIntent, fee_payer: &solana_pubkey::Pubkey, -) -> kb_core::Result { +) -> ks_core::Result { return match &intent.operation { crate::ExSolanaCoreOperation::ConfigCreateAccount { from, @@ -55,7 +55,7 @@ pub(crate) fn executor_solana_core_native_admin_build_prepared_plan( crate::ExSolanaCoreOperation::FeatureRevokePendingActivation { feature_account } => { build_feature_revoke_plan(intent, fee_payer, feature_account) }, - _ => std::result::Result::Err(kb_core::Error::new( + _ => std::result::Result::Err(ks_core::Error::new( "execution_native_admin_operation_mismatch", "Config/Feature builder received an unrelated Solana core operation", )), @@ -71,15 +71,15 @@ fn build_config_create_plan( max_config_data_space: u64, max_keys: &[crate::ExSolanaCoreConfigKey], initial_data: &[u8], -) -> kb_core::Result { +) -> ks_core::Result { if lamports == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_config_create_lamports_zero", "Config account creation requires a positive rent-exempt lamport amount", )); } if from == config_account { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_config_create_same_account", "Config funding and new account addresses must differ", )); @@ -99,7 +99,7 @@ fn build_config_create_plan( }; let initial_data_len = initial_data.len() as u64; if initial_data_len > max_config_data_space { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_config_initial_data_exceeds_max_space", "serialized initial Config data exceeds max_config_data_space", )); @@ -107,14 +107,14 @@ fn build_config_create_plan( let space = match max_config_data_space.checked_add(encoded_max_keys.len() as u64) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_config_space_overflow", "Config account space exceeds u64", )); }, }; if space > solana_system_interface::MAX_PERMITTED_DATA_LENGTH { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_config_space_out_of_range", format!( "Config account space must not exceed {} bytes", @@ -123,7 +123,7 @@ fn build_config_create_plan( )); } let config_program = match crate::executor_solana_core_parse_native_program_id( - kb_program_ids::CONFIG_PROGRAM_ID, + ks_program_ids::CONFIG_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -163,7 +163,7 @@ fn build_config_store_plan( config_account_is_signer: bool, keys: &[crate::ExSolanaCoreConfigKey], data: &[u8], -) -> kb_core::Result { +) -> ks_core::Result { let config_address = match crate::executor_solana_core_parse_pubkey(config_account, "config_account") { std::result::Result::Ok(value) => value, @@ -176,14 +176,14 @@ fn build_config_store_plan( let total_length = match instruction_data.len().checked_add(data.len()) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_config_store_data_overflow", "Config store instruction data length overflows usize", )); }, }; if total_length > MAX_CONFIG_INSTRUCTION_DATA_BYTES { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_config_store_data_too_large", format!( "Config store instruction data must not exceed {MAX_CONFIG_INSTRUCTION_DATA_BYTES} bytes" @@ -211,13 +211,13 @@ fn build_config_store_plan( signer_roles.push((key.pubkey.clone(), std::string::String::from("config_key_authority"))); } if signer_roles.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_config_store_signer_missing", "Config store requires the config account or at least one declared key signer", )); } let program_id = match crate::executor_solana_core_parse_native_program_id( - kb_program_ids::CONFIG_PROGRAM_ID, + ks_program_ids::CONFIG_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -244,15 +244,15 @@ fn build_feature_activate_plan( feature_account: &crate::MdPubkey, funding_account: &crate::MdPubkey, lamports: u64, -) -> kb_core::Result { +) -> ks_core::Result { if lamports == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_feature_activation_lamports_zero", "feature activation requires a positive rent-exempt lamport amount", )); } if feature_account == funding_account { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_feature_activation_same_account", "feature and funding accounts must differ", )); @@ -268,7 +268,7 @@ fn build_feature_activate_plan( std::result::Result::Err(error) => return std::result::Result::Err(error), }; let feature_program = match crate::executor_solana_core_parse_native_program_id( - kb_program_ids::FEATURE_PROGRAM_ID, + ks_program_ids::FEATURE_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -303,20 +303,20 @@ fn build_feature_revoke_plan( intent: &crate::ExSolanaCoreExecutionIntent, fee_payer: &solana_pubkey::Pubkey, feature_account: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { let feature_address = match crate::executor_solana_core_parse_pubkey(feature_account, "feature_account") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; let feature_program = match crate::executor_solana_core_parse_native_program_id( - kb_program_ids::FEATURE_PROGRAM_ID, + ks_program_ids::FEATURE_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; let incinerator = match crate::executor_solana_core_parse_native_program_id( - kb_program_ids::INCINERATOR_PROGRAM_ID, + ks_program_ids::INCINERATOR_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -344,9 +344,9 @@ fn build_feature_revoke_plan( ); } -fn encode_config_keys(keys: &[crate::ExSolanaCoreConfigKey]) -> kb_core::Result> { +fn encode_config_keys(keys: &[crate::ExSolanaCoreConfigKey]) -> ks_core::Result> { if keys.len() > MAX_CONFIG_KEYS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_config_keys_too_many", format!("Config key list must not exceed {MAX_CONFIG_KEYS} entries"), )); @@ -355,7 +355,7 @@ fn encode_config_keys(keys: &[crate::ExSolanaCoreConfigKey]) -> kb_core::Result< let mut encoded = encode_compact_u16(keys.len() as u16); for key in keys { if !seen.insert(key.pubkey.0.clone()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_config_key_duplicate", format!("Config key {} is declared more than once", key.pubkey.0), )); @@ -485,7 +485,7 @@ mod tests { let activate_plan = crate::executor_solana_core_builder_build_prepared_plan(&activate) .unwrap_or_else(|error| panic!("unexpected error: {error}")); assert_eq!(activate_plan.instructions.len(), 3); - assert_eq!(activate_plan.instructions[0].program_id.0, kb_program_ids::SYSTEM_PROGRAM_ID); + assert_eq!(activate_plan.instructions[0].program_id.0, ks_program_ids::SYSTEM_PROGRAM_ID); assert_eq!(activate_plan.requested_spend_lamports, 600); let revoke = crate::ExSolanaCoreExecutionIntent { @@ -502,7 +502,7 @@ mod tests { assert_eq!(revoke_plan.instructions[0].accounts.len(), 3); assert_eq!( revoke_plan.instructions[0].accounts[1].pubkey.0, - kb_program_ids::INCINERATOR_PROGRAM_ID + ks_program_ids::INCINERATOR_PROGRAM_ID ); } @@ -540,10 +540,10 @@ mod tests { #[test] fn official_program_ids_parse() { assert_eq!( - solana_pubkey::Pubkey::from_str(kb_program_ids::CONFIG_PROGRAM_ID) + solana_pubkey::Pubkey::from_str(ks_program_ids::CONFIG_PROGRAM_ID) .unwrap_or_else(|error| panic!("invalid id: {error}")) .to_string(), - kb_program_ids::CONFIG_PROGRAM_ID + ks_program_ids::CONFIG_PROGRAM_ID ); } } diff --git a/kb-lib/src/executor/solana/core/precompiles.rs b/ks-lib/src/executor/solana/core/precompiles.rs similarity index 93% rename from kb-lib/src/executor/solana/core/precompiles.rs rename to ks-lib/src/executor/solana/core/precompiles.rs index e1b5304..d49cfad 100644 --- a/kb-lib/src/executor/solana/core/precompiles.rs +++ b/ks-lib/src/executor/solana/core/precompiles.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana/core/precompiles.rs -// version: 1 +// file: ks-lib/src/executor/solana/core/precompiles.rs +// version: 2 //! Deterministic native signature-precompile instruction builders. @@ -31,7 +31,7 @@ const SECP256R1_HALF_ORDER: [u8; 32] = [ pub(crate) fn executor_solana_core_precompiles_build_prepared_plan( intent: &crate::ExSolanaCoreExecutionIntent, fee_payer: &solana_pubkey::Pubkey, -) -> kb_core::Result { +) -> ks_core::Result { return match &intent.operation { crate::ExSolanaCoreOperation::Ed25519VerifyInline { message, signature, public_key } => { build_ed25519_inline_plan( @@ -73,7 +73,7 @@ pub(crate) fn executor_solana_core_precompiles_build_prepared_plan( crate::ExSolanaCoreOperation::Secp256r1VerifyOffsets { offsets, data } => { build_secp256r1_offsets_plan(intent, fee_payer, offsets.as_slice(), data.as_slice()) }, - _ => std::result::Result::Err(kb_core::Error::new( + _ => std::result::Result::Err(ks_core::Error::new( "execution_precompile_operation_mismatch", "precompile builder received an unrelated Solana core operation", )), @@ -86,7 +86,7 @@ fn build_ed25519_inline_plan( message: &[u8], signature: &[u8], public_key: &[u8], -) -> kb_core::Result { +) -> ks_core::Result { match crate::executor_solana_core_validate_exact_length( signature, ED25519_SIGNATURE_SIZE, @@ -129,7 +129,7 @@ fn build_ed25519_inline_plan( data.extend_from_slice(public_key); data.extend_from_slice(signature); data.extend_from_slice(message); - let instruction = match instruction(kb_program_ids::ED25519_PROGRAM_ID, data) { + let instruction = match instruction(ks_program_ids::ED25519_PROGRAM_ID, data) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -149,7 +149,7 @@ fn build_ed25519_offsets_plan( fee_payer: &solana_pubkey::Pubkey, offsets: &[crate::ExSolanaCoreEd25519VerificationOffsets], appended_data: &[u8], -) -> kb_core::Result { +) -> ks_core::Result { let total_length = match validate_table_shape( offsets.len(), ED25519_OFFSETS_START, @@ -175,7 +175,7 @@ fn build_ed25519_offsets_plan( append_ed25519_offsets(&mut data, offset); } data.extend_from_slice(appended_data); - let instruction = match instruction(kb_program_ids::ED25519_PROGRAM_ID, data) { + let instruction = match instruction(ks_program_ids::ED25519_PROGRAM_ID, data) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -197,7 +197,7 @@ fn build_secp256k1_inline_plan( signature: &[u8], recovery_id: u8, ethereum_address: &[u8], -) -> kb_core::Result { +) -> ks_core::Result { match crate::executor_solana_core_validate_exact_length( signature, SECP256K1_SIGNATURE_SIZE, @@ -217,7 +217,7 @@ fn build_secp256k1_inline_plan( std::result::Result::Err(error) => return std::result::Result::Err(error), } if recovery_id > 3 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_secp256k1_recovery_id_invalid", "secp256k1 recovery id must be between 0 and 3", )); @@ -246,7 +246,7 @@ fn build_secp256k1_inline_plan( data.extend_from_slice(signature); data.push(recovery_id); data.extend_from_slice(message); - let instruction = match instruction(kb_program_ids::SECP256K1_PROGRAM_ID, data) { + let instruction = match instruction(ks_program_ids::SECP256K1_PROGRAM_ID, data) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -266,7 +266,7 @@ fn build_secp256k1_offsets_plan( fee_payer: &solana_pubkey::Pubkey, offsets: &[crate::ExSolanaCoreSecp256k1VerificationOffsets], appended_data: &[u8], -) -> kb_core::Result { +) -> ks_core::Result { let total_length = match validate_table_shape( offsets.len(), SECP256K1_OFFSETS_START, @@ -297,7 +297,7 @@ fn build_secp256k1_offsets_plan( std::result::Result::Err(error) => return std::result::Result::Err(error), } } - let instruction = match instruction(kb_program_ids::SECP256K1_PROGRAM_ID, data) { + let instruction = match instruction(ks_program_ids::SECP256K1_PROGRAM_ID, data) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -318,7 +318,7 @@ fn build_secp256r1_inline_plan( message: &[u8], signature: &[u8], public_key: &[u8], -) -> kb_core::Result { +) -> ks_core::Result { match crate::executor_solana_core_validate_exact_length( signature, SECP256R1_SIGNATURE_SIZE, @@ -369,7 +369,7 @@ fn build_secp256r1_inline_plan( data.extend_from_slice(public_key); data.extend_from_slice(signature); data.extend_from_slice(message); - let instruction = match instruction(kb_program_ids::SECP256R1_PROGRAM_ID, data) { + let instruction = match instruction(ks_program_ids::SECP256R1_PROGRAM_ID, data) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -389,7 +389,7 @@ fn build_secp256r1_offsets_plan( fee_payer: &solana_pubkey::Pubkey, offsets: &[crate::ExSolanaCoreSecp256r1VerificationOffsets], appended_data: &[u8], -) -> kb_core::Result { +) -> ks_core::Result { let total_length = match validate_table_shape( offsets.len(), SECP256R1_OFFSETS_START, @@ -421,7 +421,7 @@ fn build_secp256r1_offsets_plan( std::result::Result::Err(error) => return std::result::Result::Err(error), } } - let instruction = match instruction(kb_program_ids::SECP256R1_PROGRAM_ID, data) { + let instruction = match instruction(ks_program_ids::SECP256R1_PROGRAM_ID, data) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -439,11 +439,11 @@ fn build_secp256r1_offsets_plan( fn instruction( program_id: &str, data: std::vec::Vec, -) -> kb_core::Result { +) -> ks_core::Result { let parsed_program_id = match solana_pubkey::Pubkey::from_str(program_id) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_precompile_program_id_invalid", format!("invalid native precompile program id {program_id}: {error}"), )); @@ -456,18 +456,18 @@ fn instruction( }); } -fn validate_inline_message_length(message: &[u8], prefix_length: usize) -> kb_core::Result<()> { +fn validate_inline_message_length(message: &[u8], prefix_length: usize) -> ks_core::Result<()> { let total_length = match prefix_length.checked_add(message.len()) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_precompile_message_length_overflow", "precompile message length overflows the addressable instruction size", )); }, }; if message.len() > u16::MAX as usize || total_length > MAX_OFFSET_ADDRESSABLE_DATA_LENGTH { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_precompile_message_too_large", format!( "precompile message and inline payload must fit within {MAX_OFFSET_ADDRESSABLE_DATA_LENGTH} bytes" @@ -485,15 +485,15 @@ fn validate_table_shape( empty_code: &str, count_code: &str, size_code: &str, -) -> kb_core::Result { +) -> ks_core::Result { if count == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( empty_code, "precompile offset table requires at least one signature record", )); } if count > MAX_SIGNATURES_PER_INSTRUCTION { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( count_code, format!( "precompile offset table cannot contain more than {MAX_SIGNATURES_PER_INSTRUCTION} records" @@ -503,7 +503,7 @@ fn validate_table_shape( let offsets_length = match offsets_size.checked_mul(count) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( size_code, "precompile offset table length overflow", )); @@ -512,7 +512,7 @@ fn validate_table_shape( let header_length = match offsets_start.checked_add(offsets_length) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( size_code, "precompile offset header length overflow", )); @@ -521,14 +521,14 @@ fn validate_table_shape( let total_length = match header_length.checked_add(appended_data_length) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( size_code, "precompile instruction length overflow", )); }, }; if total_length > MAX_OFFSET_ADDRESSABLE_DATA_LENGTH { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( size_code, format!( "precompile instruction data must not exceed {MAX_OFFSET_ADDRESSABLE_DATA_LENGTH} bytes" @@ -541,7 +541,7 @@ fn validate_table_shape( fn validate_ed25519_local_ranges( offsets: &crate::ExSolanaCoreEd25519VerificationOffsets, total_length: usize, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if offsets.signature_instruction_index == u16::MAX { match validate_local_range( offsets.signature_offset, @@ -584,7 +584,7 @@ fn validate_ed25519_local_ranges( fn validate_secp256k1_local_ranges( offsets: &crate::ExSolanaCoreSecp256k1VerificationOffsets, total_length: usize, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if offsets.signature_instruction_index == 0 { match validate_local_range( offsets.signature_offset, @@ -627,7 +627,7 @@ fn validate_secp256k1_local_ranges( fn validate_secp256r1_local_ranges( offsets: &crate::ExSolanaCoreSecp256r1VerificationOffsets, total_length: usize, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if offsets.signature_instruction_index == u16::MAX { match validate_local_range( offsets.signature_offset, @@ -673,19 +673,19 @@ fn validate_local_range( total_length: usize, code: &str, label: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let start = offset as usize; let end = match start.checked_add(length) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( code, format!("{label} range overflows the instruction data"), )); }, }; if end > total_length { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( code, format!("{label} range exceeds the generated instruction data"), )); @@ -696,7 +696,7 @@ fn validate_local_range( fn validate_secp256k1_local_payload( offsets: &crate::ExSolanaCoreSecp256k1VerificationOffsets, data: &[u8], -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if offsets.signature_instruction_index != 0 { return std::result::Result::Ok(()); } @@ -704,7 +704,7 @@ fn validate_secp256k1_local_payload( match (offsets.signature_offset as usize).checked_add(SECP256K1_SIGNATURE_SIZE) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_secp256k1_signature_offset_out_of_bounds", "secp256k1 recovery id offset overflows the instruction data", )); @@ -713,14 +713,14 @@ fn validate_secp256k1_local_payload( let recovery_id = match data.get(recovery_offset) { std::option::Option::Some(value) => *value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_secp256k1_signature_offset_out_of_bounds", "secp256k1 recovery id exceeds the generated instruction data", )); }, }; if recovery_id > 3 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_secp256k1_recovery_id_invalid", "secp256k1 recovery id must be between 0 and 3", )); @@ -731,13 +731,13 @@ fn validate_secp256k1_local_payload( fn validate_secp256r1_local_payload( offsets: &crate::ExSolanaCoreSecp256r1VerificationOffsets, data: &[u8], -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if offsets.signature_instruction_index == u16::MAX { let start = offsets.signature_offset as usize; let end = match start.checked_add(SECP256R1_SIGNATURE_SIZE) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_secp256r1_signature_offset_out_of_bounds", "secp256r1 signature range overflows the instruction data", )); @@ -746,7 +746,7 @@ fn validate_secp256r1_local_payload( let signature = match data.get(start..end) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_secp256r1_signature_offset_out_of_bounds", "secp256r1 signature exceeds the generated instruction data", )); @@ -762,7 +762,7 @@ fn validate_secp256r1_local_payload( let end = match start.checked_add(SECP256R1_PUBLIC_KEY_SIZE) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_secp256r1_public_key_offset_out_of_bounds", "secp256r1 public key range overflows the instruction data", )); @@ -771,7 +771,7 @@ fn validate_secp256r1_local_payload( let public_key = match data.get(start..end) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_secp256r1_public_key_offset_out_of_bounds", "secp256r1 public key exceeds the generated instruction data", )); @@ -785,18 +785,18 @@ fn validate_secp256r1_local_payload( return std::result::Result::Ok(()); } -fn validate_secp256r1_public_key(public_key: &[u8]) -> kb_core::Result<()> { +fn validate_secp256r1_public_key(public_key: &[u8]) -> ks_core::Result<()> { let prefix = match public_key.first() { std::option::Option::Some(value) => *value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_secp256r1_public_key_length_invalid", "secp256r1 compressed public key must contain 33 bytes", )); }, }; if prefix != 2 && prefix != 3 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_secp256r1_public_key_prefix_invalid", "secp256r1 compressed public key must start with 0x02 or 0x03", )); @@ -804,17 +804,17 @@ fn validate_secp256r1_public_key(public_key: &[u8]) -> kb_core::Result<()> { return std::result::Result::Ok(()); } -fn validate_secp256r1_signature(signature: &[u8]) -> kb_core::Result<()> { +fn validate_secp256r1_signature(signature: &[u8]) -> ks_core::Result<()> { let r = &signature[..32]; let s = &signature[32..]; if r.iter().all(|value| return *value == 0) || s.iter().all(|value| return *value == 0) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_secp256r1_signature_zero_component", "secp256r1 signature components r and s must both be non-zero", )); } if s > SECP256R1_HALF_ORDER.as_slice() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_secp256r1_signature_not_low_s", "secp256r1 signature must use the runtime-required low-S canonical form", )); @@ -893,7 +893,7 @@ mod tests { } fn policy() -> crate::ExApiExecutionPolicy { - let fee_payer = pubkey(kb_program_ids::VOTE_PROGRAM_ID); + let fee_payer = pubkey(ks_program_ids::VOTE_PROGRAM_ID); return crate::ExApiExecutionPolicy { cost_limit: crate::ExApiExecutionCostLimit { max_spend_lamports: std::option::Option::Some(0), @@ -908,7 +908,7 @@ mod tests { fn intent(operation: crate::ExSolanaCoreOperation) -> crate::ExSolanaCoreExecutionIntent { return crate::ExSolanaCoreExecutionIntent { intent_id: std::string::String::from("precompile-test"), - fee_payer: pubkey(kb_program_ids::VOTE_PROGRAM_ID), + fee_payer: pubkey(ks_program_ids::VOTE_PROGRAM_ID), policy: policy(), operation, }; @@ -923,7 +923,7 @@ mod tests { assert_eq!(plan.instructions[0].data, expected.data); assert!(plan.instructions[0].accounts.is_empty()); assert_eq!(plan.required_signers.len(), 1); - assert_eq!(plan.required_signers[0].pubkey.0, kb_program_ids::VOTE_PROGRAM_ID); + assert_eq!(plan.required_signers[0].pubkey.0, ks_program_ids::VOTE_PROGRAM_ID); assert_eq!(plan.requested_spend_lamports, 0); return; } @@ -1008,7 +1008,7 @@ mod tests { }, )) .unwrap_or_else(|error| panic!("unexpected secp256k1 error: {error}")); - assert_eq!(k1_plan.instructions[0].program_id.0, kb_program_ids::SECP256K1_PROGRAM_ID); + assert_eq!(k1_plan.instructions[0].program_id.0, ks_program_ids::SECP256K1_PROGRAM_ID); assert_eq!(k1_plan.instructions[0].data[0], 1); assert_eq!( &k1_plan.instructions[0].data[1..12], diff --git a/kb-lib/src/executor/solana/core/slashing.rs b/ks-lib/src/executor/solana/core/slashing.rs similarity index 94% rename from kb-lib/src/executor/solana/core/slashing.rs rename to ks-lib/src/executor/solana/core/slashing.rs index c6d480a..75d4106 100644 --- a/kb-lib/src/executor/solana/core/slashing.rs +++ b/ks-lib/src/executor/solana/core/slashing.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana/core/slashing.rs -// version: 1 +// file: ks-lib/src/executor/solana/core/slashing.rs +// version: 2 //! Stateless Slashing Program builders and the atomic duplicate-block proof plan. @@ -11,7 +11,7 @@ const DUPLICATE_BLOCK_PROOF_TYPE: u8 = 1; pub(crate) fn executor_solana_core_slashing_build_prepared_plan( intent: &crate::ExSolanaCoreExecutionIntent, fee_payer: &solana_pubkey::Pubkey, -) -> kb_core::Result { +) -> ks_core::Result { return match &intent.operation { crate::ExSolanaCoreOperation::SlashingCloseViolationReport { report_account, @@ -48,7 +48,7 @@ pub(crate) fn executor_solana_core_slashing_build_prepared_plan( shred_2_merkle_root.as_slice(), shred_2_signature.as_slice(), ), - _ => std::result::Result::Err(kb_core::Error::new( + _ => std::result::Result::Err(ks_core::Error::new( "execution_slashing_operation_mismatch", "Slashing builder received an unrelated Solana core operation", )), @@ -60,9 +60,9 @@ fn build_close_plan( fee_payer: &solana_pubkey::Pubkey, report_account: &crate::MdPubkey, destination: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { if report_account == destination { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_slashing_close_same_account", "Slashing report and destination accounts must differ", )); @@ -77,7 +77,7 @@ fn build_close_plan( std::result::Result::Err(error) => return std::result::Result::Err(error), }; let program_id = match crate::executor_solana_core_parse_native_program_id( - kb_program_ids::SLASHING_PROGRAM_ID, + ks_program_ids::SLASHING_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -118,21 +118,21 @@ fn build_duplicate_block_plan( shred_1_signature: &[u8], shred_2_merkle_root: &[u8], shred_2_signature: &[u8], -) -> kb_core::Result { +) -> ks_core::Result { if intent.policy.blockhash.kind != crate::ExApiExecutionBlockhashKind::Latest { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_slashing_duplicate_block_requires_latest_blockhash", "duplicate-block proof submission must remain the first three transaction instructions and cannot use durable-nonce prepending", )); } if report_lamports == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_slashing_report_lamports_zero", "duplicate-block proof submission requires a positive measured report-account rent amount", )); } if report_account == destination { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_slashing_destination_is_report", "Slashing report PDA and close destination must differ", )); @@ -203,7 +203,7 @@ fn build_duplicate_block_plan( std::result::Result::Err(error) => return std::result::Result::Err(error), }; let slashing_program = match crate::executor_solana_core_parse_native_program_id( - kb_program_ids::SLASHING_PROGRAM_ID, + ks_program_ids::SLASHING_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -215,13 +215,13 @@ fn build_duplicate_block_plan( &slashing_program, ); if derived_report != report { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_slashing_report_pda_mismatch", format!("supplied report account {report} does not match derived PDA {derived_report}"), )); } if funding_address == report { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_slashing_funder_is_report", "Slashing report PDA cannot fund itself", )); @@ -238,7 +238,7 @@ fn build_duplicate_block_plan( shred_2_signature, ); if slashing_data.len() != DUPLICATE_BLOCK_PROOF_DATA_BYTES { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_slashing_duplicate_block_internal_size_invalid", "constructed duplicate-block instruction data has an invalid size", )); @@ -302,7 +302,7 @@ fn duplicate_block_instruction_data( return data; } -fn duplicate_block_sigverify_instruction() -> kb_core::Result { +fn duplicate_block_sigverify_instruction() -> ks_core::Result { let records = [ crate::ExSolanaCoreEd25519VerificationOffsets { signature_offset: 145, @@ -334,7 +334,7 @@ fn duplicate_block_sigverify_instruction() -> kb_core::Result value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -379,7 +379,7 @@ mod tests { let reporter = solana_pubkey::Pubkey::new_unique(); let destination = solana_pubkey::Pubkey::new_unique(); let slot = 42_u64; - let program = solana_pubkey::Pubkey::from_str(kb_program_ids::SLASHING_PROGRAM_ID) + let program = solana_pubkey::Pubkey::from_str(ks_program_ids::SLASHING_PROGRAM_ID) .unwrap_or_else(|error| panic!("invalid id: {error}")); let slot_bytes = slot.to_le_bytes(); let (report, _bump) = solana_pubkey::Pubkey::find_program_address( @@ -410,9 +410,9 @@ mod tests { let plan = crate::executor_solana_core_builder_build_prepared_plan(&intent) .unwrap_or_else(|error| panic!("unexpected error: {error}")); assert_eq!(plan.instructions.len(), 3); - assert_eq!(plan.instructions[0].program_id.0, kb_program_ids::SYSTEM_PROGRAM_ID); - assert_eq!(plan.instructions[1].program_id.0, kb_program_ids::ED25519_PROGRAM_ID); - assert_eq!(plan.instructions[2].program_id.0, kb_program_ids::SLASHING_PROGRAM_ID); + assert_eq!(plan.instructions[0].program_id.0, ks_program_ids::SYSTEM_PROGRAM_ID); + assert_eq!(plan.instructions[1].program_id.0, ks_program_ids::ED25519_PROGRAM_ID); + assert_eq!(plan.instructions[2].program_id.0, ks_program_ids::SLASHING_PROGRAM_ID); assert_eq!(plan.instructions[2].data.len(), 305); assert_eq!(&plan.instructions[2].data[1..9], &34_u64.to_le_bytes()); assert_eq!(&plan.instructions[2].data[9..17], &slot.to_le_bytes()); diff --git a/kb-lib/src/executor/solana/core/stake.rs b/ks-lib/src/executor/solana/core/stake.rs similarity index 97% rename from kb-lib/src/executor/solana/core/stake.rs rename to ks-lib/src/executor/solana/core/stake.rs index 3697be0..2aff342 100644 --- a/kb-lib/src/executor/solana/core/stake.rs +++ b/ks-lib/src/executor/solana/core/stake.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana/core/stake.rs -// version: 1 +// file: ks-lib/src/executor/solana/core/stake.rs +// version: 2 //! Stake Program instruction builders using the exact wincode-compatible wire contract. @@ -59,7 +59,7 @@ struct StakeLockupCheckedArgsWire { pub(crate) fn executor_solana_core_stake_build_prepared_plan( intent: &crate::ExSolanaCoreExecutionIntent, fee_payer: &solana_pubkey::Pubkey, -) -> kb_core::Result { +) -> ks_core::Result { return match &intent.operation { crate::ExSolanaCoreOperation::StakeInitialize { stake_account, @@ -439,7 +439,7 @@ pub(crate) fn executor_solana_core_stake_build_prepared_plan( *lamports, false, ), - _ => std::result::Result::Err(kb_core::Error::new( + _ => std::result::Result::Err(ks_core::Error::new( "execution_stake_operation_mismatch", "Stake builder received an unrelated Solana core operation", )), @@ -456,7 +456,7 @@ fn build_initialize_plan( lockup_unix_timestamp: i64, lockup_epoch: u64, lockup_custodian: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { let stake = match crate::executor_solana_core_parse_pubkey(stake_account, "stake_account") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -507,7 +507,7 @@ fn build_initialize_checked_plan( stake_account: &crate::MdPubkey, staker: &crate::MdPubkey, withdrawer: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { let stake = match crate::executor_solana_core_parse_pubkey(stake_account, "stake_account") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -562,7 +562,7 @@ fn build_create_account_plan( lamports: u64, checked: bool, vote_account: std::option::Option<&crate::MdPubkey>, -) -> kb_core::Result { +) -> ks_core::Result { match crate::executor_solana_core_validate_positive_u64( lamports, "execution_stake_create_lamports_zero", @@ -572,7 +572,7 @@ fn build_create_account_plan( std::result::Result::Err(error) => return std::result::Result::Err(error), } if from == stake_account { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stake_create_same_account", "Stake funding and new stake accounts must differ", )); @@ -669,7 +669,7 @@ fn build_create_account_plan( let lockup_custodian = match lockup_custodian { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stake_lockup_custodian_missing", "unchecked Stake account creation requires a lockup custodian", )); @@ -714,7 +714,7 @@ fn build_create_account_plan( crate::EX_SOLANA_CORE_STAKE_CREATE_ACCOUNT_WITH_SEED_AND_DELEGATE_OPERATION }, (_, true, true) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stake_checked_create_delegate_unavailable", "the official Stake interface does not expose a checked create-and-delegate helper", )); @@ -747,7 +747,7 @@ fn build_split_plan( lamports: u64, split_stake_account: &crate::MdPubkey, seed_contract: std::option::Option<(&crate::MdPubkey, &str)>, -) -> kb_core::Result { +) -> ks_core::Result { match crate::executor_solana_core_validate_positive_u64( lamports, "execution_stake_split_lamports_zero", @@ -861,7 +861,7 @@ fn build_merge_plan( destination_stake_account: &crate::MdPubkey, source_stake_account: &crate::MdPubkey, stake_authority: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { match crate::executor_solana_core_validate_distinct_pubkeys( destination_stake_account, source_stake_account, @@ -931,7 +931,7 @@ fn build_authorize_plan( authorization: crate::ExSolanaCoreStakeAuthorizationKind, lockup_authority: std::option::Option<&crate::MdPubkey>, checked: bool, -) -> kb_core::Result { +) -> ks_core::Result { let stake = match crate::executor_solana_core_parse_pubkey(stake_account, "stake_account") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1039,7 +1039,7 @@ fn delegate_instruction( stake_account: &crate::MdPubkey, stake_authority: &crate::MdPubkey, vote_account: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { let stake = match crate::executor_solana_core_parse_pubkey(stake_account, "stake_account") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1054,7 +1054,7 @@ fn delegate_instruction( std::result::Result::Err(error) => return std::result::Result::Err(error), }; let stake_config = match crate::executor_solana_core_parse_native_program_id( - kb_program_ids::STAKE_CONFIG_ACCOUNT_ID, + ks_program_ids::STAKE_CONFIG_ACCOUNT_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1084,7 +1084,7 @@ fn build_delegate_plan( stake_account: &crate::MdPubkey, stake_authority: &crate::MdPubkey, vote_account: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { let instruction = match delegate_instruction(stake_account, stake_authority, vote_account) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1108,7 +1108,7 @@ fn build_withdraw_plan( to: &crate::MdPubkey, lamports: u64, lockup_authority: std::option::Option<&crate::MdPubkey>, -) -> kb_core::Result { +) -> ks_core::Result { match crate::executor_solana_core_validate_positive_u64( lamports, "execution_stake_withdraw_lamports_zero", @@ -1182,7 +1182,7 @@ fn build_deactivate_plan( fee_payer: &solana_pubkey::Pubkey, stake_account: &crate::MdPubkey, stake_authority: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { let stake = match crate::executor_solana_core_parse_pubkey(stake_account, "stake_account") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1227,9 +1227,9 @@ fn build_set_lockup_plan( epoch: std::option::Option, custodian: std::option::Option<&crate::MdPubkey>, checked: bool, -) -> kb_core::Result { +) -> ks_core::Result { if unix_timestamp.is_none() && epoch.is_none() && custodian.is_none() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stake_lockup_empty", "Stake lockup update must change at least one field", )); @@ -1304,7 +1304,7 @@ fn build_set_lockup_plan( fn build_get_minimum_delegation_plan( intent: &crate::ExSolanaCoreExecutionIntent, fee_payer: &solana_pubkey::Pubkey, -) -> kb_core::Result { +) -> ks_core::Result { let instruction = match stake_instruction(StakeInstructionWire::GetMinimumDelegation, std::vec::Vec::new()) { std::result::Result::Ok(value) => value, @@ -1327,7 +1327,7 @@ fn build_deactivate_delinquent_plan( stake_account: &crate::MdPubkey, delinquent_vote_account: &crate::MdPubkey, reference_vote_account: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { match crate::executor_solana_core_validate_distinct_pubkeys( delinquent_vote_account, reference_vote_account, @@ -1385,7 +1385,7 @@ fn build_move_plan( stake_authority: &crate::MdPubkey, lamports: u64, move_stake: bool, -) -> kb_core::Result { +) -> ks_core::Result { match crate::executor_solana_core_validate_positive_u64( lamports, "execution_stake_move_lamports_zero", @@ -1456,7 +1456,7 @@ fn build_move_plan( fn authorized( staker: &crate::MdPubkey, withdrawer: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { let staker_address = match crate::executor_solana_core_parse_pubkey(staker, "staker") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1475,11 +1475,11 @@ fn authorized( fn stake_instruction( wire: StakeInstructionWire, accounts: std::vec::Vec, -) -> kb_core::Result { +) -> ks_core::Result { let data = match wincode::serialize(&wire) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stake_wincode_failed", format!("cannot serialize {SOURCE} instruction: {error}"), )); @@ -1492,8 +1492,8 @@ fn stake_instruction( return std::result::Result::Ok(solana_instruction::Instruction { program_id, accounts, data }); } -fn stake_program_id() -> kb_core::Result { - return crate::executor_solana_core_parse_native_program_id(kb_program_ids::STAKE_PROGRAM_ID); +fn stake_program_id() -> ks_core::Result { + return crate::executor_solana_core_parse_native_program_id(ks_program_ids::STAKE_PROGRAM_ID); } #[cfg(test)] @@ -1595,8 +1595,8 @@ mod tests { let plan = crate::executor_solana_core_builder_build_prepared_plan(&intent) .unwrap_or_else(|error| panic!("unexpected error: {error}")); assert_eq!(plan.instructions.len(), 2); - assert_eq!(plan.instructions[0].program_id.0, kb_program_ids::SYSTEM_PROGRAM_ID); - assert_eq!(plan.instructions[1].program_id.0, kb_program_ids::STAKE_PROGRAM_ID); + assert_eq!(plan.instructions[0].program_id.0, ks_program_ids::SYSTEM_PROGRAM_ID); + assert_eq!(plan.instructions[1].program_id.0, ks_program_ids::STAKE_PROGRAM_ID); assert_eq!(plan.requested_spend_lamports, 500); let checked_stake = model(solana_pubkey::Pubkey::new_unique()); let checked_withdrawer = model(solana_pubkey::Pubkey::new_unique()); @@ -1622,7 +1622,7 @@ mod tests { fn seeded_create_and_split_validate_derivations_and_signers() { let from = solana_pubkey::Pubkey::new_unique(); let base = solana_pubkey::Pubkey::new_unique(); - let stake_program = solana_pubkey::Pubkey::from_str(kb_program_ids::STAKE_PROGRAM_ID) + let stake_program = solana_pubkey::Pubkey::from_str(ks_program_ids::STAKE_PROGRAM_ID) .unwrap_or_else(|error| panic!("invalid Stake id: {error}")); let seed = "stake-seed"; let stake = solana_pubkey::Pubkey::create_with_seed(&base, seed, &stake_program) @@ -1736,7 +1736,7 @@ mod tests { assert_eq!(&plan.instructions[2].data[..4], &2_u32.to_le_bytes()); assert_eq!(plan.instructions[2].accounts.len(), 6); let base = solana_pubkey::Pubkey::new_unique(); - let stake_program = solana_pubkey::Pubkey::from_str(kb_program_ids::STAKE_PROGRAM_ID) + let stake_program = solana_pubkey::Pubkey::from_str(ks_program_ids::STAKE_PROGRAM_ID) .unwrap_or_else(|error| panic!("invalid Stake id: {error}")); let seed = "delegated-seed"; let seeded_stake = solana_pubkey::Pubkey::create_with_seed(&base, seed, &stake_program) diff --git a/kb-lib/src/executor/solana/core/validation.rs b/ks-lib/src/executor/solana/core/validation.rs similarity index 88% rename from kb-lib/src/executor/solana/core/validation.rs rename to ks-lib/src/executor/solana/core/validation.rs index 07e10b3..1717381 100644 --- a/kb-lib/src/executor/solana/core/validation.rs +++ b/ks-lib/src/executor/solana/core/validation.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana/core/validation.rs -// version: 1 +// file: ks-lib/src/executor/solana/core/validation.rs +// version: 2 //! Shared parsing and validation helpers for native execution plans. @@ -9,10 +9,10 @@ use std::str::FromStr; // rust-rules: trait-import pub(crate) fn executor_solana_core_parse_pubkey( pubkey: &crate::MdPubkey, field_name: &str, -) -> kb_core::Result { +) -> ks_core::Result { return match solana_pubkey::Pubkey::from_str(pubkey.0.as_str()) { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_pubkey_invalid", format!("invalid {field_name} public key {}: {error}", pubkey.0), )), @@ -22,10 +22,10 @@ pub(crate) fn executor_solana_core_parse_pubkey( /// Parses one canonical native program identifier. pub(crate) fn executor_solana_core_parse_native_program_id( value: &str, -) -> kb_core::Result { +) -> ks_core::Result { return match solana_pubkey::Pubkey::from_str(value) { std::result::Result::Ok(program_id) => std::result::Result::Ok(program_id), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_native_program_id_invalid", format!("invalid native program id {value}: {error}"), )), @@ -38,9 +38,9 @@ pub(crate) fn executor_solana_core_validate_distinct_pubkeys( second: &crate::MdPubkey, code: &str, message: impl std::convert::Into, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if first == second { - return std::result::Result::Err(kb_core::Error::new(code, message)); + return std::result::Result::Err(ks_core::Error::new(code, message)); } return std::result::Result::Ok(()); } @@ -49,8 +49,8 @@ pub(crate) fn executor_solana_core_validate_distinct_pubkeys( pub(crate) fn executor_solana_core_invalid( code: &str, message: impl std::convert::Into, -) -> kb_core::Result { - return std::result::Result::Err(kb_core::Error::new(code, message)); +) -> ks_core::Result { + return std::result::Result::Err(ks_core::Error::new(code, message)); } /// Validates that an unsigned execution amount is strictly positive. @@ -58,9 +58,9 @@ pub(crate) fn executor_solana_core_validate_positive_u64( value: u64, code: &str, message: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if value == 0 { - return std::result::Result::Err(kb_core::Error::new(code, message)); + return std::result::Result::Err(ks_core::Error::new(code, message)); } return std::result::Result::Ok(()); } @@ -74,18 +74,18 @@ pub(crate) fn executor_solana_core_validate_seeded_address( field_name: &str, invalid_seed_code: &str, mismatch_code: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let derived = match solana_pubkey::Pubkey::create_with_seed(base, seed, owner) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( invalid_seed_code, format!("cannot derive {field_name} from the supplied seed: {error}"), )); }, }; if derived != *address { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( mismatch_code, format!("{field_name} {address} does not match derived address {derived}"), )); @@ -99,9 +99,9 @@ pub(crate) fn executor_solana_core_validate_exact_length( expected: usize, code: &str, label: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if value.len() != expected { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( code, format!("{label} must contain exactly {expected} bytes"), )); @@ -135,8 +135,8 @@ mod tests { #[test] fn native_program_id_parser_accepts_official_ids_and_rejects_invalid_text() { let parsed = - crate::executor_solana_core_parse_native_program_id(kb_program_ids::SYSTEM_PROGRAM_ID); - let expected = solana_pubkey::Pubkey::from_str(kb_program_ids::SYSTEM_PROGRAM_ID) + crate::executor_solana_core_parse_native_program_id(ks_program_ids::SYSTEM_PROGRAM_ID); + let expected = solana_pubkey::Pubkey::from_str(ks_program_ids::SYSTEM_PROGRAM_ID) .unwrap_or_else(|error| panic!("invalid fixture: {error}")); match parsed { std::result::Result::Ok(value) => assert_eq!(value, expected), @@ -175,7 +175,7 @@ mod tests { crate::executor_solana_core_validate_positive_u64(0, "positive", "must be positive") .is_err() ); - let invalid: kb_core::Result<()> = + let invalid: ks_core::Result<()> = crate::executor_solana_core_invalid("invalid", "shared validation error"); assert!(invalid.is_err()); let base = solana_pubkey::Pubkey::new_unique(); diff --git a/kb-lib/src/executor/solana/core/vote.rs b/ks-lib/src/executor/solana/core/vote.rs similarity index 96% rename from kb-lib/src/executor/solana/core/vote.rs rename to ks-lib/src/executor/solana/core/vote.rs index ce6acd3..b8873ef 100644 --- a/kb-lib/src/executor/solana/core/vote.rs +++ b/ks-lib/src/executor/solana/core/vote.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana/core/vote.rs -// version: 1 +// file: ks-lib/src/executor/solana/core/vote.rs +// version: 2 //! Exact Vote Program instruction builders backed by `solana-vote-interface`. @@ -18,7 +18,7 @@ enum VoteStateWireKind { pub(crate) fn executor_solana_core_vote_build_prepared_plan( intent: &crate::ExSolanaCoreExecutionIntent, fee_payer: &solana_pubkey::Pubkey, -) -> kb_core::Result { +) -> ks_core::Result { return match &intent.operation { crate::ExSolanaCoreOperation::VoteInitializeAccount { vote_account, @@ -453,7 +453,7 @@ pub(crate) fn executor_solana_core_vote_build_prepared_plan( source, *deposit_lamports, ), - _ => std::result::Result::Err(kb_core::Error::new( + _ => std::result::Result::Err(ks_core::Error::new( "execution_vote_operation_mismatch", "Vote builder received an unrelated Solana core operation", )), @@ -469,7 +469,7 @@ fn build_initialize_plan( authorized_voter: &crate::MdPubkey, authorized_withdrawer: &crate::MdPubkey, commission_percent: u8, -) -> kb_core::Result { +) -> ks_core::Result { let instruction = match initialize_instruction( vote_account, node_pubkey, @@ -505,7 +505,7 @@ fn build_initialize_v2_plan( block_revenue_commission_bps: u16, inflation_rewards_collector: &crate::MdPubkey, block_revenue_collector: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { let instruction = match initialize_v2_instruction( vote_account, node_pubkey, @@ -544,7 +544,7 @@ fn build_create_account_plan( authorized_withdrawer: &crate::MdPubkey, commission_percent: u8, lamports: u64, -) -> kb_core::Result { +) -> ks_core::Result { match crate::executor_solana_core_validate_positive_u64( lamports, "execution_vote_create_lamports_zero", @@ -659,7 +659,7 @@ fn build_create_account_v2_plan( inflation_rewards_collector: &crate::MdPubkey, block_revenue_collector: &crate::MdPubkey, lamports: u64, -) -> kb_core::Result { +) -> ks_core::Result { match crate::executor_solana_core_validate_positive_u64( lamports, "execution_vote_create_lamports_zero", @@ -772,7 +772,7 @@ fn build_authorize_plan( new_authority: &crate::MdPubkey, authorization: &crate::ExSolanaCoreVoteAuthorizationKind, checked: bool, -) -> kb_core::Result { +) -> ks_core::Result { let vote_address = match crate::executor_solana_core_parse_pubkey(vote_account, "vote_account") { std::result::Result::Ok(value) => value, @@ -894,7 +894,7 @@ fn build_vote_plan( bank_hash: &str, timestamp: std::option::Option, switch_proof_hash: std::option::Option<&str>, -) -> kb_core::Result { +) -> ks_core::Result { let vote = match vote_value(slots, bank_hash, timestamp) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -961,7 +961,7 @@ fn build_withdraw_plan( withdraw_authority: &crate::MdPubkey, to: &crate::MdPubkey, lamports: u64, -) -> kb_core::Result { +) -> ks_core::Result { match crate::executor_solana_core_validate_positive_u64( lamports, "execution_vote_withdraw_lamports_zero", @@ -1021,7 +1021,7 @@ fn build_update_validator_identity_plan( vote_account: &crate::MdPubkey, withdraw_authority: &crate::MdPubkey, new_validator_identity: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { let vote_address = match crate::executor_solana_core_parse_pubkey(vote_account, "vote_account") { std::result::Result::Ok(value) => value, @@ -1073,7 +1073,7 @@ fn build_update_commission_plan( vote_account: &crate::MdPubkey, withdraw_authority: &crate::MdPubkey, commission_percent: u8, -) -> kb_core::Result { +) -> ks_core::Result { match validate_commission_percent(commission_percent) { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1110,7 +1110,7 @@ fn build_vote_state_plan( timestamp: std::option::Option, wire_kind: VoteStateWireKind, switch_proof_hash: std::option::Option<&str>, -) -> kb_core::Result { +) -> ks_core::Result { let update = match vote_state_update(lockouts, root, bank_hash, timestamp) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1171,7 +1171,7 @@ fn build_tower_sync_plan( timestamp: std::option::Option, block_id: &str, switch_proof_hash: std::option::Option<&str>, -) -> kb_core::Result { +) -> ks_core::Result { let tower = match tower_sync(lockouts, root, bank_hash, timestamp, block_id) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1209,7 +1209,7 @@ fn build_update_commission_collector_plan( withdraw_authority: &crate::MdPubkey, new_collector: &crate::MdPubkey, commission_kind: crate::ExSolanaCoreVoteCommissionKind, -) -> kb_core::Result { +) -> ks_core::Result { let instruction = match admin_instruction( solana_vote_interface::instruction::VoteInstruction::UpdateCommissionCollector( commission_kind.as_official(), @@ -1239,7 +1239,7 @@ fn build_update_commission_bps_plan( withdraw_authority: &crate::MdPubkey, commission_kind: crate::ExSolanaCoreVoteCommissionKind, commission_bps: u16, -) -> kb_core::Result { +) -> ks_core::Result { match validate_commission_bps(commission_bps, "commission_bps") { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1273,7 +1273,7 @@ fn build_deposit_delegator_rewards_plan( vote_account: &crate::MdPubkey, source: &crate::MdPubkey, deposit_lamports: u64, -) -> kb_core::Result { +) -> ks_core::Result { match crate::executor_solana_core_validate_positive_u64( deposit_lamports, "execution_vote_deposit_lamports_zero", @@ -1330,7 +1330,7 @@ fn initialize_instruction( authorized_voter: &crate::MdPubkey, authorized_withdrawer: &crate::MdPubkey, commission_percent: u8, -) -> kb_core::Result { +) -> ks_core::Result { match validate_commission_percent(commission_percent) { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1392,7 +1392,7 @@ fn initialize_v2_instruction( block_revenue_commission_bps: u16, inflation_rewards_collector: &crate::MdPubkey, block_revenue_collector: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { match validate_commission_bps( inflation_rewards_commission_bps, "inflation_rewards_commission_bps", @@ -1470,7 +1470,7 @@ fn initialize_v2_instruction( fn vote_authorization( value: &crate::ExSolanaCoreVoteAuthorizationKind, -) -> kb_core::Result { +) -> ks_core::Result { return match value { crate::ExSolanaCoreVoteAuthorizationKind::Voter => { std::result::Result::Ok(solana_vote_interface::state::VoteAuthorize::Voter) @@ -1504,7 +1504,7 @@ fn vote_value( slots: &[u64], bank_hash: &str, timestamp: std::option::Option, -) -> kb_core::Result { +) -> ks_core::Result { match validate_slots(slots) { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1525,7 +1525,7 @@ fn vote_state_update( root: std::option::Option, bank_hash: &str, timestamp: std::option::Option, -) -> kb_core::Result { +) -> ks_core::Result { let wire_lockouts = match lockout_deque(lockouts, root) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1548,7 +1548,7 @@ fn tower_sync( bank_hash: &str, timestamp: std::option::Option, block_id: &str, -) -> kb_core::Result { +) -> ks_core::Result { let wire_lockouts = match lockout_deque(lockouts, root) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1573,15 +1573,15 @@ fn tower_sync( fn lockout_deque( lockouts: &[crate::ExSolanaCoreVoteLockout], root: std::option::Option, -) -> kb_core::Result> { +) -> ks_core::Result> { if lockouts.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_vote_lockouts_empty", "Vote state and tower updates require at least one lockout", )); } if lockouts.len() > solana_vote_interface::state::MAX_LOCKOUT_HISTORY { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_vote_lockouts_too_many", format!( "Vote lockout count {} exceeds official maximum {}", @@ -1594,7 +1594,7 @@ fn lockout_deque( let mut output = std::collections::VecDeque::with_capacity(lockouts.len()); for lockout in lockouts { if lockout.confirmation_count > solana_vote_interface::state::MAX_LOCKOUT_HISTORY as u32 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_vote_confirmation_count_invalid", format!( "Vote confirmation count {} exceeds official maximum {}", @@ -1605,7 +1605,7 @@ fn lockout_deque( } if let std::option::Option::Some(previous_slot) = previous { if lockout.slot <= previous_slot { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_vote_lockouts_not_strictly_increasing", "Vote lockout slots must be strictly increasing", )); @@ -1620,7 +1620,7 @@ fn lockout_deque( if let std::option::Option::Some(root_slot) = root { if let std::option::Option::Some(first) = lockouts.first() { if root_slot > first.slot { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_vote_root_above_first_lockout", "Vote root must be at or below the first lockout slot", )); @@ -1637,7 +1637,7 @@ fn finalize_vote_authority_instruction( vote_account: &crate::MdPubkey, authorized_voter: &crate::MdPubkey, wire: solana_vote_interface::instruction::VoteInstruction, -) -> kb_core::Result { +) -> ks_core::Result { let vote_address = match crate::executor_solana_core_parse_pubkey(vote_account, "vote_account") { std::result::Result::Ok(value) => value, @@ -1674,7 +1674,7 @@ fn admin_instruction( vote_account: &crate::MdPubkey, withdraw_authority: &crate::MdPubkey, writable_middle_account: std::option::Option<&crate::MdPubkey>, -) -> kb_core::Result { +) -> ks_core::Result { let vote_address = match crate::executor_solana_core_parse_pubkey(vote_account, "vote_account") { std::result::Result::Ok(value) => value, @@ -1701,11 +1701,11 @@ fn admin_instruction( fn vote_instruction( wire: solana_vote_interface::instruction::VoteInstruction, accounts: std::vec::Vec, -) -> kb_core::Result { +) -> ks_core::Result { let data = match wincode::serialize(&wire) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_vote_wincode_failed", format!("cannot serialize {SOURCE} instruction: {error}"), )); @@ -1718,13 +1718,13 @@ fn vote_instruction( return std::result::Result::Ok(solana_instruction::Instruction { program_id, accounts, data }); } -fn vote_program_id() -> kb_core::Result { - return crate::executor_solana_core_parse_native_program_id(kb_program_ids::VOTE_PROGRAM_ID); +fn vote_program_id() -> ks_core::Result { + return crate::executor_solana_core_parse_native_program_id(ks_program_ids::VOTE_PROGRAM_ID); } -fn validate_commission_percent(value: u8) -> kb_core::Result<()> { +fn validate_commission_percent(value: u8) -> ks_core::Result<()> { if value > 100 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_vote_commission_percent_invalid", format!("Vote legacy commission percentage {value} exceeds 100"), )); @@ -1732,9 +1732,9 @@ fn validate_commission_percent(value: u8) -> kb_core::Result<()> { return std::result::Result::Ok(()); } -fn validate_commission_bps(value: u16, field_name: &str) -> kb_core::Result<()> { +fn validate_commission_bps(value: u16, field_name: &str) -> ks_core::Result<()> { if value > MAX_COMMISSION_BPS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_vote_commission_bps_invalid", format!("Vote {field_name} value {value} exceeds {MAX_COMMISSION_BPS}"), )); @@ -1744,9 +1744,9 @@ fn validate_commission_bps(value: u16, field_name: &str) -> kb_core::Result<()> fn fixed_bls_pubkey( value: &[u8], -) -> kb_core::Result<[u8; solana_vote_interface::state::BLS_PUBLIC_KEY_COMPRESSED_SIZE]> { +) -> ks_core::Result<[u8; solana_vote_interface::state::BLS_PUBLIC_KEY_COMPRESSED_SIZE]> { if value.len() != solana_vote_interface::state::BLS_PUBLIC_KEY_COMPRESSED_SIZE { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_vote_bls_pubkey_length_invalid", format!( "Vote BLS public key length {} must equal {}", @@ -1762,9 +1762,9 @@ fn fixed_bls_pubkey( fn fixed_bls_proof( value: &[u8], -) -> kb_core::Result<[u8; solana_vote_interface::state::BLS_PROOF_OF_POSSESSION_COMPRESSED_SIZE]> { +) -> ks_core::Result<[u8; solana_vote_interface::state::BLS_PROOF_OF_POSSESSION_COMPRESSED_SIZE]> { if value.len() != solana_vote_interface::state::BLS_PROOF_OF_POSSESSION_COMPRESSED_SIZE { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_vote_bls_proof_length_invalid", format!( "Vote BLS proof length {} must equal {}", @@ -1778,15 +1778,15 @@ fn fixed_bls_proof( return std::result::Result::Ok(output); } -fn validate_slots(slots: &[u64]) -> kb_core::Result<()> { +fn validate_slots(slots: &[u64]) -> ks_core::Result<()> { if slots.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_vote_slots_empty", "Vote submission requires at least one slot", )); } if slots.len() > solana_vote_interface::state::MAX_LOCKOUT_HISTORY { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_vote_slots_too_many", format!( "Vote slot count {} exceeds official maximum {}", @@ -1797,7 +1797,7 @@ fn validate_slots(slots: &[u64]) -> kb_core::Result<()> { } for pair in slots.windows(2) { if pair[1] <= pair[0] { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_vote_slots_not_strictly_increasing", "Vote slots must be strictly increasing", )); @@ -1806,15 +1806,15 @@ fn validate_slots(slots: &[u64]) -> kb_core::Result<()> { return std::result::Result::Ok(()); } -fn validate_seed(seed: &str, field_name: &str) -> kb_core::Result<()> { +fn validate_seed(seed: &str, field_name: &str) -> ks_core::Result<()> { if seed.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_vote_seed_empty", format!("Vote {field_name} must not be empty"), )); } if seed.len() > MAX_SEED_LENGTH { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_vote_seed_too_long", format!("Vote {field_name} length {} exceeds {}", seed.len(), MAX_SEED_LENGTH), )); @@ -1828,7 +1828,7 @@ fn executor_solana_core_validate_seeded_address( seed: &str, owner: &solana_pubkey::Pubkey, field_name: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { match validate_seed(seed, field_name) { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1844,10 +1844,10 @@ fn executor_solana_core_validate_seeded_address( ); } -fn parse_hash(value: &str, field_name: &str) -> kb_core::Result { +fn parse_hash(value: &str, field_name: &str) -> ks_core::Result { return match solana_hash::Hash::from_str(value) { std::result::Result::Ok(hash) => std::result::Result::Ok(hash), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_vote_hash_invalid", format!("invalid Vote {field_name} hash {value}: {error}"), )), @@ -1983,8 +1983,8 @@ mod tests { let plan = crate::executor_solana_core_builder_build_prepared_plan(&intent) .unwrap_or_else(|error| panic!("unexpected Vote creation error: {error}")); assert_eq!(plan.instructions.len(), 2); - assert_eq!(plan.instructions[0].program_id.0, kb_program_ids::SYSTEM_PROGRAM_ID); - assert_eq!(plan.instructions[1].program_id.0, kb_program_ids::VOTE_PROGRAM_ID); + assert_eq!(plan.instructions[0].program_id.0, ks_program_ids::SYSTEM_PROGRAM_ID); + assert_eq!(plan.instructions[1].program_id.0, ks_program_ids::VOTE_PROGRAM_ID); assert_eq!(plan.requested_spend_lamports, 500); assert_eq!(plan.instructions[1].data.first().copied(), std::option::Option::Some(0)); } @@ -1993,7 +1993,7 @@ mod tests { fn seeded_creation_validates_derivation_and_avoids_new_account_signature() { let from = solana_pubkey::Pubkey::new_unique(); let base = solana_pubkey::Pubkey::new_unique(); - let vote_program = solana_pubkey::Pubkey::from_str(kb_program_ids::VOTE_PROGRAM_ID) + let vote_program = solana_pubkey::Pubkey::from_str(ks_program_ids::VOTE_PROGRAM_ID) .unwrap_or_else(|error| panic!("invalid Vote program id: {error}")); let seed = "vote-seed"; let vote = solana_pubkey::Pubkey::create_with_seed(&base, seed, &vote_program) diff --git a/kb-lib/src/executor/solana/core/zk_elgamal.rs b/ks-lib/src/executor/solana/core/zk_elgamal.rs similarity index 96% rename from kb-lib/src/executor/solana/core/zk_elgamal.rs rename to ks-lib/src/executor/solana/core/zk_elgamal.rs index 1dae7c6..4c25de8 100644 --- a/kb-lib/src/executor/solana/core/zk_elgamal.rs +++ b/ks-lib/src/executor/solana/core/zk_elgamal.rs @@ -1,12 +1,12 @@ -// file: kb-lib/src/executor/solana/core/zk_elgamal.rs -// version: 1 +// file: ks-lib/src/executor/solana/core/zk_elgamal.rs +// version: 2 //! Native ZK ElGamal Proof instruction builders. pub(crate) fn executor_solana_core_zk_elgamal_build_prepared_plan( intent: &crate::ExSolanaCoreExecutionIntent, fee_payer: &solana_pubkey::Pubkey, -) -> kb_core::Result { +) -> ks_core::Result { return match &intent.operation { crate::ExSolanaCoreOperation::ZkElGamalVerifyInline { proof_type, @@ -37,7 +37,7 @@ pub(crate) fn executor_solana_core_zk_elgamal_build_prepared_plan( destination, authority, } => build_close_plan(intent, fee_payer, context_state, destination, authority), - _ => std::result::Result::Err(kb_core::Error::new( + _ => std::result::Result::Err(ks_core::Error::new( "execution_zk_elgamal_operation_mismatch", "ZK ElGamal builder received an unrelated Solana core operation", )), @@ -50,10 +50,10 @@ fn build_inline_plan( proof_type: crate::ExSolanaCoreZkElGamalProofType, proof_data: &[u8], context_state: std::option::Option<&crate::ExSolanaCoreZkElGamalContextState>, -) -> kb_core::Result { +) -> ks_core::Result { let expected = proof_type.proof_data_size(); if proof_data.len() != expected { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_zk_elgamal_proof_size_invalid", format!( "inline ZK ElGamal proof requires exactly {expected} bytes but received {}", @@ -90,7 +90,7 @@ fn build_account_plan( proof_account: &crate::MdPubkey, proof_offset: u32, context_state: std::option::Option<&crate::ExSolanaCoreZkElGamalContextState>, -) -> kb_core::Result { +) -> ks_core::Result { let proof_address = match crate::executor_solana_core_parse_pubkey(proof_account, "proof_account") { std::result::Result::Ok(value) => value, @@ -103,7 +103,7 @@ fn build_account_plan( }; if let std::option::Option::Some(context) = context_state { if context.account == *proof_account { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_zk_elgamal_proof_is_context", "proof and context-state accounts must differ", )); @@ -133,9 +133,9 @@ fn build_close_plan( context_state: &crate::MdPubkey, destination: &crate::MdPubkey, authority: &crate::MdPubkey, -) -> kb_core::Result { +) -> ks_core::Result { if context_state == destination { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_zk_elgamal_close_same_account", "ZK ElGamal context-state and destination accounts must differ", )); @@ -178,11 +178,11 @@ fn build_close_plan( fn context_accounts( context_state: std::option::Option<&crate::ExSolanaCoreZkElGamalContextState>, -) -> kb_core::Result> { +) -> ks_core::Result> { return match context_state { std::option::Option::Some(context) => { if context.account == context.authority { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_zk_elgamal_context_authority_is_account", "ZK ElGamal context-state account and authority must differ", )); @@ -211,9 +211,9 @@ fn context_accounts( fn instruction( accounts: std::vec::Vec, data: std::vec::Vec, -) -> kb_core::Result { +) -> ks_core::Result { let program_id = match crate::executor_solana_core_parse_native_program_id( - kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, + ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), diff --git a/kb-lib/src/executor/solana/transaction.rs b/ks-lib/src/executor/solana/transaction.rs similarity index 96% rename from kb-lib/src/executor/solana/transaction.rs rename to ks-lib/src/executor/solana/transaction.rs index 3e23924..cb19eed 100644 --- a/kb-lib/src/executor/solana/transaction.rs +++ b/ks-lib/src/executor/solana/transaction.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana/transaction.rs -// version: 2 +// file: ks-lib/src/executor/solana/transaction.rs +// version: 3 //! Solana transaction assembly and signing for prepared execution plans. diff --git a/kb-lib/src/executor/solana/transaction/constants.rs b/ks-lib/src/executor/solana/transaction/constants.rs similarity index 88% rename from kb-lib/src/executor/solana/transaction/constants.rs rename to ks-lib/src/executor/solana/transaction/constants.rs index b78bd06..c827c37 100644 --- a/kb-lib/src/executor/solana/transaction/constants.rs +++ b/ks-lib/src/executor/solana/transaction/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana/transaction/constants.rs -// version: 3 +// file: ks-lib/src/executor/solana/transaction/constants.rs +// version: 4 //! Local constants for Solana transaction assembly. diff --git a/kb-lib/src/executor/solana/transaction/core.rs b/ks-lib/src/executor/solana/transaction/core.rs similarity index 94% rename from kb-lib/src/executor/solana/transaction/core.rs rename to ks-lib/src/executor/solana/transaction/core.rs index 5b23222..24c26a6 100644 --- a/kb-lib/src/executor/solana/transaction/core.rs +++ b/ks-lib/src/executor/solana/transaction/core.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana/transaction/core.rs -// version: 10 +// file: ks-lib/src/executor/solana/transaction/core.rs +// version: 11 //! Legacy and durable nonce Solana transaction assembly, simulation binding and signing. @@ -45,7 +45,7 @@ impl crate::ExSolanaUnsignedTransaction { } /// Returns the unsigned serialized transaction in base64 for `simulateTransaction` with `sigVerify = false`. - pub fn transaction_base64(&self) -> kb_core::Result { + pub fn transaction_base64(&self) -> ks_core::Result { let wire_bytes = match serialize_transaction(&self.transaction) { std::result::Result::Ok(wire_bytes) => wire_bytes, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -72,15 +72,15 @@ impl crate::ExSolanaUnsignedTransaction { mut self, evidence: &crate::ExSolanaSimulationEvidence, signers: &[&dyn solana_signer::Signer], - ) -> kb_core::Result { + ) -> ks_core::Result { if evidence.message_hash != self.message_hash { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_simulation_message_mismatch", "the simulation result is not bound to the transaction message being signed", )); } if evidence.blockhash != self.blockhash { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_simulation_blockhash_mismatch", "the simulation result is not bound to the blockhash or durable nonce value being signed", )); @@ -91,7 +91,7 @@ impl crate::ExSolanaUnsignedTransaction { std::result::Result::Err(error) => return std::result::Result::Err(error), }; if safety_evaluation.decision != crate::ExSafetyDecision::Allow { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_signing_not_authorized", format!( "execution safety decision {:?} forbids signing: {}", @@ -108,13 +108,13 @@ impl crate::ExSolanaUnsignedTransaction { if let std::result::Result::Err(error) = self.transaction.try_sign(signers.as_slice(), recent_blockhash) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_transaction_sign_failed", error.to_string(), )); } if !self.transaction.is_signed() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_transaction_not_fully_signed", "the transaction is not fully signed after signer resolution", )); @@ -126,7 +126,7 @@ impl crate::ExSolanaUnsignedTransaction { let primary_signature = match self.transaction.signatures.first() { std::option::Option::Some(signature) => signature.to_string(), std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_primary_signature_missing", "the signed transaction contains no primary signature", )); @@ -214,10 +214,10 @@ impl crate::ExSolanaSignedTransaction { } /// Verifies every signature against the compiled message. - pub fn verify_signatures(&self) -> kb_core::Result<()> { + pub fn verify_signatures(&self) -> ks_core::Result<()> { return match self.transaction.verify() { std::result::Result::Ok(()) => std::result::Result::Ok(()), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_transaction_signature_verification_failed", error.to_string(), )), @@ -229,15 +229,15 @@ impl crate::ExSolanaSignedTransaction { pub fn executor_solana_build_legacy_transaction( plan: &crate::ExApiPreparedExecutionPlan, recent_blockhash: &str, -) -> kb_core::Result { +) -> ks_core::Result { if plan.policy.blockhash.kind != crate::ExApiExecutionBlockhashKind::Latest { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_durable_nonce_requires_dedicated_assembly", "durable nonce plans require executor_solana_build_durable_nonce_transaction", )); } if plan.instructions.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_plan_has_no_instructions", "cannot assemble a Solana transaction without instructions", )); @@ -249,7 +249,7 @@ pub fn executor_solana_build_legacy_transaction( let blockhash = match solana_hash::Hash::from_str(recent_blockhash) { std::result::Result::Ok(blockhash) => blockhash, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_recent_blockhash_invalid", format!("invalid recent blockhash: {error}"), )); @@ -307,21 +307,21 @@ pub fn executor_solana_build_legacy_transaction( pub fn executor_solana_build_durable_nonce_transaction( plan: &crate::ExApiPreparedExecutionPlan, nonce_state: &crate::ExSolanaDurableNonceAccountState, -) -> kb_core::Result { +) -> ks_core::Result { if plan.policy.blockhash.kind != crate::ExApiExecutionBlockhashKind::DurableNonce { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_durable_nonce_policy_required", "the dedicated durable nonce assembly path requires a DurableNonce blockhash policy", )); } if plan.policy.blockhash.max_age_slots.is_some() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_durable_nonce_has_blockhash_age", "durable nonce assembly cannot use a recent blockhash age limit", )); } if plan.instructions.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_plan_has_no_instructions", "cannot assemble a durable nonce transaction without operation instructions", )); @@ -329,7 +329,7 @@ pub fn executor_solana_build_durable_nonce_transaction( let policy_nonce_account = match &plan.policy.blockhash.nonce_account { std::option::Option::Some(account) => account, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_durable_nonce_account_missing", "durable nonce assembly requires the nonce account in the execution policy", )); @@ -338,14 +338,14 @@ pub fn executor_solana_build_durable_nonce_transaction( let policy_nonce_authority = match &plan.policy.blockhash.nonce_authority { std::option::Option::Some(authority) => authority, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_durable_nonce_authority_missing", "durable nonce assembly requires the nonce authority in the execution policy", )); }, }; if policy_nonce_account != nonce_state.account() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_durable_nonce_account_mismatch", format!( "execution policy nonce account {} differs from validated account {}", @@ -355,7 +355,7 @@ pub fn executor_solana_build_durable_nonce_transaction( )); } if policy_nonce_authority != nonce_state.authority() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_durable_nonce_authority_mismatch", format!( "execution policy nonce authority {} differs from validated authority {}", @@ -369,7 +369,7 @@ pub fn executor_solana_build_durable_nonce_transaction( .iter() .any(|required| return &required.pubkey == policy_nonce_authority) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_durable_nonce_authority_not_declared", format!( "durable nonce authority {} is missing from required signers", @@ -394,7 +394,7 @@ pub fn executor_solana_build_durable_nonce_transaction( let nonce_blockhash = match solana_hash::Hash::from_str(nonce_state.blockhash()) { std::result::Result::Ok(blockhash) => blockhash, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_durable_nonce_blockhash_invalid", format!("invalid durable nonce value: {error}"), )); @@ -438,7 +438,7 @@ pub fn executor_solana_build_durable_nonce_transaction( } let transaction = solana_transaction::Transaction::new_unsigned(message); if solana_transaction::uses_durable_nonce(&transaction).is_none() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_durable_nonce_marker_missing", "the assembled transaction is not recognized as a durable nonce transaction", )); @@ -473,7 +473,7 @@ pub fn executor_solana_build_durable_nonce_transaction( fn convert_instruction( planned: &crate::ExApiPlannedInstruction, -) -> kb_core::Result { +) -> ks_core::Result { let program_id = match parse_pubkey(planned.program_id.0.as_str(), "planned instruction program id") { std::result::Result::Ok(program_id) => program_id, @@ -521,10 +521,10 @@ fn planned_instruction( }; } -fn parse_pubkey(value: &str, field_name: &str) -> kb_core::Result { +fn parse_pubkey(value: &str, field_name: &str) -> ks_core::Result { return match solana_pubkey::Pubkey::from_str(value) { std::result::Result::Ok(pubkey) => std::result::Result::Ok(pubkey), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_pubkey_invalid", format!("invalid {field_name} {value}: {error}"), )), @@ -534,7 +534,7 @@ fn parse_pubkey(value: &str, field_name: &str) -> kb_core::Result kb_core::Result<()> { +) -> ks_core::Result<()> { let declared_signers = plan .required_signers .iter() @@ -545,7 +545,7 @@ fn validate_compiled_signers( .map(std::string::String::as_str) .collect::>(); if declared_signers != compiled_signer_set { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_compiled_signer_contract_mismatch", format!( "declared signers [{}] differ from compiled signers [{}]", @@ -560,19 +560,19 @@ fn validate_compiled_signers( fn resolve_signers<'a>( required_signers: &[std::string::String], signers: &'a [&'a dyn solana_signer::Signer], -) -> kb_core::Result> { +) -> ks_core::Result> { let mut signer_by_pubkey = std::collections::BTreeMap::new(); for signer in signers { let public_key = signer.pubkey().to_string(); if signer_by_pubkey.insert(public_key.clone(), *signer).is_some() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_signer_duplicate", format!("signer {public_key} was supplied more than once"), )); } } if signer_by_pubkey.len() != required_signers.len() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_signer_count_mismatch", format!( "{} signers were supplied for {} required signers", @@ -586,7 +586,7 @@ fn resolve_signers<'a>( let signer = match signer_by_pubkey.get(required_signer) { std::option::Option::Some(signer) => *signer, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_required_signer_missing", format!("required signer {required_signer} was not supplied"), )); @@ -599,18 +599,18 @@ fn resolve_signers<'a>( fn serialize_transaction( transaction: &solana_transaction::Transaction, -) -> kb_core::Result> { +) -> ks_core::Result> { let wire_bytes = match wincode::serialize(transaction) { std::result::Result::Ok(wire_bytes) => wire_bytes, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_transaction_serialize_failed", error.to_string(), )); }, }; if wire_bytes.len() > crate::EX_SOLANA_TRANSACTION_MAX_WIRE_BYTES { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_transaction_wire_size_exceeded", format!( "serialized transaction length {} exceeds the Solana packet limit {}", diff --git a/kb-lib/src/executor/solana/transaction/nonce.rs b/ks-lib/src/executor/solana/transaction/nonce.rs similarity index 93% rename from kb-lib/src/executor/solana/transaction/nonce.rs rename to ks-lib/src/executor/solana/transaction/nonce.rs index fd84e15..764cb35 100644 --- a/kb-lib/src/executor/solana/transaction/nonce.rs +++ b/ks-lib/src/executor/solana/transaction/nonce.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/solana/transaction/nonce.rs -// version: 6 +// file: ks-lib/src/executor/solana/transaction/nonce.rs +// version: 7 //! Durable nonce account state parsing and validation. @@ -48,11 +48,11 @@ pub fn executor_solana_parse_durable_nonce_account( executable: bool, space: u64, data: &[u8], -) -> kb_core::Result { +) -> ks_core::Result { let account_address = match solana_pubkey::Pubkey::from_str(account.0.as_str()) { std::result::Result::Ok(account_address) => account_address, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_nonce_account_address_invalid", format!("invalid durable nonce account address {}: {error}", account.0), )); @@ -61,14 +61,14 @@ pub fn executor_solana_parse_durable_nonce_account( let owner_address = match solana_pubkey::Pubkey::from_str(owner.0.as_str()) { std::result::Result::Ok(owner_address) => owner_address, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_nonce_account_owner_invalid", format!("invalid durable nonce account owner {}: {error}", owner.0), )); }, }; if owner_address != solana_sdk_ids::system_program::id() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_nonce_account_owner_mismatch", format!( "durable nonce account {account_address} is owned by {owner_address} instead of the System Program" @@ -76,14 +76,14 @@ pub fn executor_solana_parse_durable_nonce_account( )); } if executable { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_nonce_account_executable", format!("durable nonce account {account_address} must not be executable"), )); } let expected_length = crate::executor_solana_durable_nonce_account_data_length(); if space != expected_length as u64 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_nonce_account_space_invalid", format!( "durable nonce account {account_address} reports {space} bytes instead of {expected_length}" @@ -91,7 +91,7 @@ pub fn executor_solana_parse_durable_nonce_account( )); } if data.len() != expected_length { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_nonce_account_data_length_invalid", format!( "durable nonce account {account_address} contains {} decoded bytes instead of {expected_length}", @@ -102,7 +102,7 @@ pub fn executor_solana_parse_durable_nonce_account( let versions = match wincode::deserialize_exact::(data) { std::result::Result::Ok(versions) => versions, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_nonce_account_state_invalid", format!("cannot decode durable nonce account {account_address}: {error}"), )); @@ -110,7 +110,7 @@ pub fn executor_solana_parse_durable_nonce_account( }; let state = match versions { solana_nonce::versions::Versions::Legacy(_) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_nonce_account_legacy_version", format!( "durable nonce account {account_address} uses the legacy nonce domain and must be upgraded before use" @@ -121,7 +121,7 @@ pub fn executor_solana_parse_durable_nonce_account( }; let initialized = match *state { solana_nonce::state::State::Uninitialized => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_nonce_account_uninitialized", format!("durable nonce account {account_address} is not initialized"), )); diff --git a/kb-lib/src/executor/spl.rs b/ks-lib/src/executor/spl.rs similarity index 99% rename from kb-lib/src/executor/spl.rs rename to ks-lib/src/executor/spl.rs index ab4bed7..272afcb 100644 --- a/kb-lib/src/executor/spl.rs +++ b/ks-lib/src/executor/spl.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl.rs -// version: 8 +// file: ks-lib/src/executor/spl.rs +// version: 9 //! `spl` executor family. diff --git a/kb-lib/src/executor/spl/account_compression.rs b/ks-lib/src/executor/spl/account_compression.rs similarity index 89% rename from kb-lib/src/executor/spl/account_compression.rs rename to ks-lib/src/executor/spl/account_compression.rs index 5194ac2..1ec9854 100644 --- a/kb-lib/src/executor/spl/account_compression.rs +++ b/ks-lib/src/executor/spl/account_compression.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/account_compression.rs -// version: 3 +// file: ks-lib/src/executor/spl/account_compression.rs +// version: 4 //! Reserved executor for `spl_account_compression`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplAccountCompressionExecutor } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::SPL_ACCOUNT_COMPRESSION_PROGRAM_ID]; + return &[ks_program_ids::SPL_ACCOUNT_COMPRESSION_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplAccountCompressionExecutor fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"spl_account_compression"}), ) { diff --git a/kb-lib/src/executor/spl/associated_token_account.rs b/ks-lib/src/executor/spl/associated_token_account.rs similarity index 94% rename from kb-lib/src/executor/spl/associated_token_account.rs rename to ks-lib/src/executor/spl/associated_token_account.rs index 730d1cb..7155101 100644 --- a/kb-lib/src/executor/spl/associated_token_account.rs +++ b/ks-lib/src/executor/spl/associated_token_account.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/associated_token_account.rs -// version: 4 +// file: ks-lib/src/executor/spl/associated_token_account.rs +// version: 5 //! Safe typed executor for SPL Associated Token Account. diff --git a/kb-lib/src/executor/spl/associated_token_account/builder.rs b/ks-lib/src/executor/spl/associated_token_account/builder.rs similarity index 90% rename from kb-lib/src/executor/spl/associated_token_account/builder.rs rename to ks-lib/src/executor/spl/associated_token_account/builder.rs index b083ba0..8974ef7 100644 --- a/kb-lib/src/executor/spl/associated_token_account/builder.rs +++ b/ks-lib/src/executor/spl/associated_token_account/builder.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/associated_token_account/builder.rs -// version: 6 +// file: ks-lib/src/executor/spl/associated_token_account/builder.rs +// version: 7 //! Official ATA builders and conservative simulation-first plan validation. @@ -8,7 +8,7 @@ macro_rules! parse_key { match $value.0.parse() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_ata_pubkey_invalid", format!("invalid ATA {} public key: {error}", $field), )); @@ -19,9 +19,9 @@ macro_rules! parse_key { pub(crate) fn executor_spl_ata_build_prepared_plan( intent: &crate::ExSplAssociatedTokenAccountExecutionIntent, -) -> kb_core::Result { +) -> ks_core::Result { if intent.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_ata_intent_id_empty", "ATA execution intent id must not be empty", )); @@ -43,7 +43,7 @@ pub(crate) fn executor_spl_ata_build_prepared_plan( let token_program: solana_pubkey::Pubkey = match token_program_text.parse() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_ata_token_program_invalid", error.to_string(), )); @@ -66,7 +66,7 @@ pub(crate) fn executor_spl_ata_build_prepared_plan( let token_program: solana_pubkey::Pubkey = match token_program_text.parse() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_ata_token_program_invalid", error.to_string(), )); @@ -91,7 +91,7 @@ pub(crate) fn executor_spl_ata_build_prepared_plan( let token_program: solana_pubkey::Pubkey = match token_program_text.parse() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_ata_token_program_invalid", error.to_string(), )); @@ -135,21 +135,21 @@ pub(crate) fn executor_spl_ata_build_prepared_plan( fn validate_policy( intent: &crate::ExSplAssociatedTokenAccountExecutionIntent, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if intent.policy.simulation != crate::ExApiExecutionSimulationPolicy::Required { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_ata_simulation_required", "ATA execution requires simulation before signing or sending", )); } if intent.operation.is_creation() && intent.max_rent_lamports == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_ata_rent_limit_missing", "ATA creation requires a positive rent spending ceiling", )); } if !intent.operation.is_creation() && intent.max_rent_lamports != 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_ata_recovery_rent_must_be_zero", "RecoverNested must declare zero rent spending", )); @@ -157,7 +157,7 @@ fn validate_policy( if intent.policy.cost_limit.max_spend_lamports != std::option::Option::Some(intent.max_rent_lamports) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_ata_spend_limit_mismatch", "ATA policy max spend must equal the declared maximum rent lamports", )); @@ -165,7 +165,7 @@ fn validate_policy( match intent.policy.cost_limit.max_fee_lamports { std::option::Option::Some(value) if value > 0 => {}, std::option::Option::Some(_) | std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_ata_fee_limit_missing", "ATA execution requires a positive transaction fee ceiling", )); @@ -177,7 +177,7 @@ fn validate_policy( || !validation.decode_replay_required || !validation.materialization_required { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_ata_post_validation_required", "ATA execution requires canonical insertion, core extraction, decode replay and materialization validation", )); @@ -237,7 +237,7 @@ pub(crate) mod tests { operation: crate::ExSplAssociatedTokenAccountOperation, max_rent_lamports: u64, ) -> crate::ExSplAssociatedTokenAccountExecutionIntent { - let fee_payer = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); + let fee_payer = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); let wallet_owner = match &operation { crate::ExSplAssociatedTokenAccountOperation::Create { wallet_owner, .. } | crate::ExSplAssociatedTokenAccountOperation::CreateIdempotent { @@ -387,13 +387,13 @@ pub(crate) mod tests { ] { for operation in [ crate::ExSplAssociatedTokenAccountOperation::Create { - wallet_owner: pubkey(kb_program_ids::STAKE_PROGRAM_ID), - mint: pubkey(kb_program_ids::VOTE_PROGRAM_ID), + wallet_owner: pubkey(ks_program_ids::STAKE_PROGRAM_ID), + mint: pubkey(ks_program_ids::VOTE_PROGRAM_ID), token_program, }, crate::ExSplAssociatedTokenAccountOperation::CreateIdempotent { - wallet_owner: pubkey(kb_program_ids::STAKE_PROGRAM_ID), - mint: pubkey(kb_program_ids::VOTE_PROGRAM_ID), + wallet_owner: pubkey(ks_program_ids::STAKE_PROGRAM_ID), + mint: pubkey(ks_program_ids::VOTE_PROGRAM_ID), token_program, }, ] { @@ -402,9 +402,9 @@ pub(crate) mod tests { } let recovery = intent( crate::ExSplAssociatedTokenAccountOperation::RecoverNested { - wallet_owner: pubkey(kb_program_ids::STAKE_PROGRAM_ID), - owner_mint: pubkey(kb_program_ids::VOTE_PROGRAM_ID), - nested_mint: pubkey(kb_program_ids::CONFIG_PROGRAM_ID), + wallet_owner: pubkey(ks_program_ids::STAKE_PROGRAM_ID), + owner_mint: pubkey(ks_program_ids::VOTE_PROGRAM_ID), + nested_mint: pubkey(ks_program_ids::CONFIG_PROGRAM_ID), token_program, }, 0, @@ -417,9 +417,9 @@ pub(crate) mod tests { fn signer_set_is_unique_without_reordering_instruction_metas() { let intent = intent( crate::ExSplAssociatedTokenAccountOperation::RecoverNested { - wallet_owner: pubkey(kb_program_ids::STAKE_PROGRAM_ID), - owner_mint: pubkey(kb_program_ids::VOTE_PROGRAM_ID), - nested_mint: pubkey(kb_program_ids::CONFIG_PROGRAM_ID), + wallet_owner: pubkey(ks_program_ids::STAKE_PROGRAM_ID), + owner_mint: pubkey(ks_program_ids::VOTE_PROGRAM_ID), + nested_mint: pubkey(ks_program_ids::CONFIG_PROGRAM_ID), token_program: crate::ExSplAssociatedTokenProgram::Classic, }, 0, @@ -436,8 +436,8 @@ pub(crate) mod tests { #[test] fn conservative_policy_rejects_unsafe_cost_and_replay_shapes() { let operation = crate::ExSplAssociatedTokenAccountOperation::Create { - wallet_owner: pubkey(kb_program_ids::STAKE_PROGRAM_ID), - mint: pubkey(kb_program_ids::VOTE_PROGRAM_ID), + wallet_owner: pubkey(ks_program_ids::STAKE_PROGRAM_ID), + mint: pubkey(ks_program_ids::VOTE_PROGRAM_ID), token_program: crate::ExSplAssociatedTokenProgram::Classic, }; let mut intent = intent(operation, 2_100_000); @@ -463,8 +463,8 @@ pub(crate) mod tests { fn recovery_requires_zero_rent_and_creation_requires_a_positive_ceiling() { let create = intent( crate::ExSplAssociatedTokenAccountOperation::Create { - wallet_owner: pubkey(kb_program_ids::STAKE_PROGRAM_ID), - mint: pubkey(kb_program_ids::VOTE_PROGRAM_ID), + wallet_owner: pubkey(ks_program_ids::STAKE_PROGRAM_ID), + mint: pubkey(ks_program_ids::VOTE_PROGRAM_ID), token_program: crate::ExSplAssociatedTokenProgram::Classic, }, 0, @@ -475,9 +475,9 @@ pub(crate) mod tests { let recovery = intent( crate::ExSplAssociatedTokenAccountOperation::RecoverNested { - wallet_owner: pubkey(kb_program_ids::STAKE_PROGRAM_ID), - owner_mint: pubkey(kb_program_ids::VOTE_PROGRAM_ID), - nested_mint: pubkey(kb_program_ids::CONFIG_PROGRAM_ID), + wallet_owner: pubkey(ks_program_ids::STAKE_PROGRAM_ID), + owner_mint: pubkey(ks_program_ids::VOTE_PROGRAM_ID), + nested_mint: pubkey(ks_program_ids::CONFIG_PROGRAM_ID), token_program: crate::ExSplAssociatedTokenProgram::Token2022, }, 1, diff --git a/kb-lib/src/executor/spl/associated_token_account/constants.rs b/ks-lib/src/executor/spl/associated_token_account/constants.rs similarity index 61% rename from kb-lib/src/executor/spl/associated_token_account/constants.rs rename to ks-lib/src/executor/spl/associated_token_account/constants.rs index ef37fdc..f935221 100644 --- a/kb-lib/src/executor/spl/associated_token_account/constants.rs +++ b/ks-lib/src/executor/spl/associated_token_account/constants.rs @@ -1,7 +1,7 @@ -// file: kb-lib/src/executor/spl/associated_token_account/constants.rs -// version: 5 +// file: ks-lib/src/executor/spl/associated_token_account/constants.rs +// version: 6 -//! Local constants for the `kb-lib.executor.spl.associated_token_account` crate. Program identifiers live in `kb_program_ids`. +//! Local constants for the `kb-lib.executor.spl.associated_token_account` crate. Program identifiers live in `ks_program_ids`. /// Canonical tracing target for this crate. pub(crate) const TRACING_TARGET_EXECUTOR_SPL_ATA: &str = diff --git a/kb-lib/src/executor/spl/associated_token_account/executor.rs b/ks-lib/src/executor/spl/associated_token_account/executor.rs similarity index 90% rename from kb-lib/src/executor/spl/associated_token_account/executor.rs rename to ks-lib/src/executor/spl/associated_token_account/executor.rs index 7a4f23d..6e3b8f8 100644 --- a/kb-lib/src/executor/spl/associated_token_account/executor.rs +++ b/ks-lib/src/executor/spl/associated_token_account/executor.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/associated_token_account/executor.rs -// version: 6 +// file: ks-lib/src/executor/spl/associated_token_account/executor.rs +// version: 7 //! Exact ATA capability dispatch and typed plan construction. @@ -13,7 +13,7 @@ impl crate::ExSplAssociatedTokenAccountExecutor { program_id: &crate::MdProgramId, operation_code: &str, ) -> crate::ExApiExecutionCapability { - if program_id.0 != kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID { + if program_id.0 != ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID { return crate::ExApiExecutionCapability::unsupported( "execution_spl_ata_program_not_owned", format!( @@ -46,16 +46,16 @@ impl crate::ExApiTypedInstructionExecutor for crate::ExSplAssociatedTokenAccount fn build_prepared_plan( &self, intent: &Self::Intent, - ) -> kb_core::Result { + ) -> ks_core::Result { let program_id = crate::MdProgramId(std::string::String::from( - kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID, + ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID, )); return match self.exact_capability(&program_id, intent.operation.operation_code()) { crate::ExApiExecutionCapability::Supported { operation_code: _ } => { crate::executor_spl_ata_build_prepared_plan(intent) }, crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => { - std::result::Result::Err(kb_core::Error::new(reason_code, reason)) + std::result::Result::Err(ks_core::Error::new(reason_code, reason)) }, }; } @@ -71,7 +71,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplAssociatedTokenAccountExecu } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID]; + return &[ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID]; } fn supports_request( @@ -91,11 +91,11 @@ impl crate::ExApiInstructionExecutor for crate::ExSplAssociatedTokenAccountExecu fn build_plan( &self, request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { match self.exact_capability(&request.program_id, &request.operation_code) { crate::ExApiExecutionCapability::Supported { operation_code: _ } => {}, crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => { - return std::result::Result::Err(kb_core::Error::new(reason_code, reason)); + return std::result::Result::Err(ks_core::Error::new(reason_code, reason)); }, } let intent = match serde_json::from_str::( @@ -103,14 +103,14 @@ impl crate::ExApiInstructionExecutor for crate::ExSplAssociatedTokenAccountExecu ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_ata_intent_deserialize_failed", error.to_string(), )); }, }; if intent.operation.operation_code() != request.operation_code.as_str() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_operation_code_mismatch", format!( "request operation {} does not match typed intent operation {}", @@ -127,7 +127,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplAssociatedTokenAccountExecu let payload_value = match serde_json::to_value(&prepared) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_ata_plan_serialize_failed", error.to_string(), )); @@ -157,7 +157,7 @@ mod tests { operation: crate::ExSplAssociatedTokenAccountOperation, max_rent_lamports: u64, ) -> crate::ExSplAssociatedTokenAccountExecutionIntent { - let fee_payer = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); + let fee_payer = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); let wallet_owner = match &operation { crate::ExSplAssociatedTokenAccountOperation::Create { wallet_owner, .. } | crate::ExSplAssociatedTokenAccountOperation::CreateIdempotent { @@ -208,16 +208,16 @@ mod tests { fn exact_capabilities_cover_every_published_current_variant() { let executor = crate::ExSplAssociatedTokenAccountExecutor; for operation_code in crate::EX_SPL_ATA_SUPPORTED_OPERATION_CODES { - let request = request(kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID, operation_code); + let request = request(ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID, operation_code); assert_eq!( crate::ExApiInstructionExecutor::supports_request(&executor, &request), crate::ExApiExecutionSupport::Yes ); } for (program_id, operation_code) in [ - (kb_program_ids::SYSTEM_PROGRAM_ID, crate::EX_SPL_ATA_CREATE_OPERATION), + (ks_program_ids::SYSTEM_PROGRAM_ID, crate::EX_SPL_ATA_CREATE_OPERATION), ( - kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID, + ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID, "spl.associated_token_account.close", ), ] { @@ -233,8 +233,8 @@ mod tests { fn generic_request_roundtrips_one_typed_instruction() { let pintent = intent( crate::ExSplAssociatedTokenAccountOperation::CreateIdempotent { - wallet_owner: pubkey(kb_program_ids::STAKE_PROGRAM_ID), - mint: pubkey(kb_program_ids::VOTE_PROGRAM_ID), + wallet_owner: pubkey(ks_program_ids::STAKE_PROGRAM_ID), + mint: pubkey(ks_program_ids::VOTE_PROGRAM_ID), token_program: crate::ExSplAssociatedTokenProgram::Token2022, }, 2_100_000, @@ -242,7 +242,7 @@ mod tests { let payload_json = serde_json::to_string(&pintent) .unwrap_or_else(|error| panic!("ATA intent serialization failed: {error}")); let request = crate::ExApiExecutionRequest { - program_id: crate::MdProgramId(kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string()), + program_id: crate::MdProgramId(ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string()), operation_code: crate::EX_SPL_ATA_CREATE_IDEMPOTENT_OPERATION.to_string(), payload_json, }; diff --git a/kb-lib/src/executor/spl/associated_token_account/intent.rs b/ks-lib/src/executor/spl/associated_token_account/intent.rs similarity index 92% rename from kb-lib/src/executor/spl/associated_token_account/intent.rs rename to ks-lib/src/executor/spl/associated_token_account/intent.rs index f68f065..9fd9b8d 100644 --- a/kb-lib/src/executor/spl/associated_token_account/intent.rs +++ b/ks-lib/src/executor/spl/associated_token_account/intent.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/associated_token_account/intent.rs -// version: 5 +// file: ks-lib/src/executor/spl/associated_token_account/intent.rs +// version: 6 //! Typed SPL Associated Token Account execution intents. @@ -24,7 +24,7 @@ pub const EX_SPL_ATA_SUPPORTED_OPERATION_CODES: &[&str] = &[ #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/associated_token_account/intent/ExSplAssociatedTokenProgram.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/associated_token_account/intent/ExSplAssociatedTokenProgram.ts" )] pub enum ExSplAssociatedTokenProgram { /// Classic SPL Token program. @@ -39,8 +39,8 @@ impl crate::ExSplAssociatedTokenProgram { /// Returns the exact target Token Program ID. pub fn program_id(&self) -> &'static str { return match self { - Self::Classic => kb_program_ids::SPL_TOKEN_PROGRAM_ID, - Self::Token2022 => kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + Self::Classic => ks_program_ids::SPL_TOKEN_PROGRAM_ID, + Self::Token2022 => ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, }; } } @@ -50,7 +50,7 @@ impl crate::ExSplAssociatedTokenProgram { #[serde(tag = "operation", rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/associated_token_account/intent/ExSplAssociatedTokenAccountOperation.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/associated_token_account/intent/ExSplAssociatedTokenAccountOperation.ts" )] pub enum ExSplAssociatedTokenAccountOperation { /// Strictly create an absent canonical ATA. @@ -112,7 +112,7 @@ impl crate::ExSplAssociatedTokenAccountOperation { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/associated_token_account/intent/ExSplAssociatedTokenAccountExecutionIntent.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/associated_token_account/intent/ExSplAssociatedTokenAccountExecutionIntent.ts" )] pub struct ExSplAssociatedTokenAccountExecutionIntent { /// Stable caller-provided identifier used for logs and replay correlation. diff --git a/kb-lib/src/executor/spl/elgamal_registry.rs b/ks-lib/src/executor/spl/elgamal_registry.rs similarity index 93% rename from kb-lib/src/executor/spl/elgamal_registry.rs rename to ks-lib/src/executor/spl/elgamal_registry.rs index e7f280a..f0ee9e7 100644 --- a/kb-lib/src/executor/spl/elgamal_registry.rs +++ b/ks-lib/src/executor/spl/elgamal_registry.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/elgamal_registry.rs -// version: 4 +// file: ks-lib/src/executor/spl/elgamal_registry.rs +// version: 5 //! Typed executor for the SPL ElGamal public-key registry. diff --git a/kb-lib/src/executor/spl/elgamal_registry/builder.rs b/ks-lib/src/executor/spl/elgamal_registry/builder.rs similarity index 91% rename from kb-lib/src/executor/spl/elgamal_registry/builder.rs rename to ks-lib/src/executor/spl/elgamal_registry/builder.rs index 526516d..5afffad 100644 --- a/kb-lib/src/executor/spl/elgamal_registry/builder.rs +++ b/ks-lib/src/executor/spl/elgamal_registry/builder.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/elgamal_registry/builder.rs -// version: 7 +// file: ks-lib/src/executor/spl/elgamal_registry/builder.rs +// version: 8 //! Official registry builders and conservative plan validation. @@ -8,15 +8,15 @@ use std::str::FromStr; // rust-rules: trait-import pub(crate) fn executor_spl_elgamal_registry_build_prepared_plan( intent: &crate::ExSplElgamalRegistryExecutionIntent, -) -> kb_core::Result { +) -> ks_core::Result { if intent.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_elgamal_registry_intent_id_empty", "ElGamal registry execution intent id must not be empty", )); } if intent.policy.simulation != crate::ExApiExecutionSimulationPolicy::Required { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_elgamal_registry_simulation_required", "ElGamal registry execution requires simulation", )); @@ -24,7 +24,7 @@ pub(crate) fn executor_spl_elgamal_registry_build_prepared_plan( match intent.policy.cost_limit.max_fee_lamports { std::option::Option::Some(value) if value > 0 => {}, std::option::Option::Some(_) | std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_elgamal_registry_fee_limit_missing", "ElGamal registry execution requires a positive fee ceiling", )); @@ -36,7 +36,7 @@ pub(crate) fn executor_spl_elgamal_registry_build_prepared_plan( || !validation.decode_replay_required || !validation.materialization_required { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_elgamal_registry_post_validation_required", "ElGamal registry execution requires canonical insert, core extraction, decode replay and materialization", )); @@ -72,7 +72,7 @@ pub(crate) fn executor_spl_elgamal_registry_build_prepared_plan( { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_elgamal_registry_proof_base64_invalid", error.to_string(), )); @@ -82,7 +82,7 @@ pub(crate) fn executor_spl_elgamal_registry_build_prepared_plan( solana_zk_elgamal_proof_interface::proof_data::PubkeyValidityProofData, >(); if bytes.len() != expected { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_elgamal_registry_proof_size_invalid", format!( "PubkeyValidityProofData requires {expected} bytes, received {}", @@ -96,7 +96,7 @@ pub(crate) fn executor_spl_elgamal_registry_build_prepared_plan( let offset = match std::num::NonZeroI8::new(1) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_elgamal_registry_internal_offset_invalid", "inline proof offset must be one", )); @@ -153,7 +153,7 @@ fn build_official( location: spl_token_confidential_transfer_proof_extraction::instruction::ProofLocation< solana_zk_elgamal_proof_interface::proof_data::PubkeyValidityProofData, >, -) -> kb_core::Result> { +) -> ks_core::Result> { let result = if create { spl_elgamal_registry_interface::instruction::create_registry(owner, location) } else { @@ -161,17 +161,17 @@ fn build_official( }; return match result { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_spl_elgamal_registry_builder_failed", error.to_string(), )), }; } -fn parse_address(value: &crate::MdPubkey, field: &str) -> kb_core::Result { +fn parse_address(value: &crate::MdPubkey, field: &str) -> ks_core::Result { return match solana_pubkey::Pubkey::from_str(value.0.as_str()) { std::result::Result::Ok(address) => std::result::Result::Ok(address), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_spl_elgamal_registry_pubkey_invalid", format!("{field}: {error}"), )), @@ -207,7 +207,7 @@ mod tests { } fn intent(create: bool) -> crate::ExSplElgamalRegistryExecutionIntent { - let owner = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); + let owner = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); return crate::ExSplElgamalRegistryExecutionIntent { intent_id: std::string::String::from("registry-intent"), fee_payer: owner.clone(), @@ -231,14 +231,14 @@ mod tests { crate::ExSplElgamalRegistryOperation::CreateRegistry { owner, proof: crate::ExSplElgamalRegistryProofLocation::ContextStateAccount { - account: pubkey(kb_program_ids::VOTE_PROGRAM_ID), + account: pubkey(ks_program_ids::VOTE_PROGRAM_ID), }, } } else { crate::ExSplElgamalRegistryOperation::UpdateRegistry { owner, proof: crate::ExSplElgamalRegistryProofLocation::ContextStateAccount { - account: pubkey(kb_program_ids::VOTE_PROGRAM_ID), + account: pubkey(ks_program_ids::VOTE_PROGRAM_ID), }, } }, @@ -253,7 +253,7 @@ mod tests { assert_eq!(plan.instructions.len(), 1); assert_eq!( plan.instructions[0].program_id.0, - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID ); assert_eq!(plan.instructions[0].data, if create { vec![0, 0] } else { vec![1, 0] }); assert_eq!(plan.required_signers.len(), 1); @@ -269,7 +269,7 @@ mod tests { assert_eq!(error.code(), "execution_spl_elgamal_registry_simulation_required"); value = intent(true); value.operation = crate::ExSplElgamalRegistryOperation::CreateRegistry { - owner: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), + owner: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), proof: crate::ExSplElgamalRegistryProofLocation::Inline { proof_data_base64: std::string::String::from("AA=="), }, diff --git a/kb-lib/src/executor/spl/elgamal_registry/constants.rs b/ks-lib/src/executor/spl/elgamal_registry/constants.rs similarity index 71% rename from kb-lib/src/executor/spl/elgamal_registry/constants.rs rename to ks-lib/src/executor/spl/elgamal_registry/constants.rs index 39bc778..a6490c9 100644 --- a/kb-lib/src/executor/spl/elgamal_registry/constants.rs +++ b/ks-lib/src/executor/spl/elgamal_registry/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/elgamal_registry/constants.rs -// version: 3 +// file: ks-lib/src/executor/spl/elgamal_registry/constants.rs +// version: 4 //! Executor-local constants. diff --git a/kb-lib/src/executor/spl/elgamal_registry/executor.rs b/ks-lib/src/executor/spl/elgamal_registry/executor.rs similarity index 87% rename from kb-lib/src/executor/spl/elgamal_registry/executor.rs rename to ks-lib/src/executor/spl/elgamal_registry/executor.rs index 89cc6ab..00aa6b2 100644 --- a/kb-lib/src/executor/spl/elgamal_registry/executor.rs +++ b/ks-lib/src/executor/spl/elgamal_registry/executor.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/elgamal_registry/executor.rs -// version: 5 +// file: ks-lib/src/executor/spl/elgamal_registry/executor.rs +// version: 6 //! Exact capability dispatch for the SPL ElGamal registry. @@ -13,7 +13,7 @@ impl crate::ExSplElgamalRegistryExecutor { program_id: &crate::MdProgramId, operation_code: &str, ) -> crate::ExApiExecutionCapability { - if program_id.0 != kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID { + if program_id.0 != ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID { return crate::ExApiExecutionCapability::unsupported( "execution_spl_elgamal_registry_program_not_owned", format!("program {} is not the SPL ElGamal registry", program_id.0), @@ -46,16 +46,16 @@ impl crate::ExApiTypedInstructionExecutor for crate::ExSplElgamalRegistryExecuto fn build_prepared_plan( &self, intent: &Self::Intent, - ) -> kb_core::Result { + ) -> ks_core::Result { let program_id = crate::MdProgramId(std::string::String::from( - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, )); return match self.exact_capability(&program_id, intent.operation.operation_code()) { crate::ExApiExecutionCapability::Supported { operation_code: _ } => { crate::executor_spl_elgamal_registry_build_prepared_plan(intent) }, crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => { - std::result::Result::Err(kb_core::Error::new(reason_code, reason)) + std::result::Result::Err(ks_core::Error::new(reason_code, reason)) }, }; } @@ -69,7 +69,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplElgamalRegistryExecutor { return env!("CARGO_PKG_VERSION"); } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID]; + return &[ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID]; } fn supports_request( &self, @@ -87,11 +87,11 @@ impl crate::ExApiInstructionExecutor for crate::ExSplElgamalRegistryExecutor { fn build_plan( &self, request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { match self.exact_capability(&request.program_id, &request.operation_code) { crate::ExApiExecutionCapability::Supported { operation_code: _ } => {}, crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => { - return std::result::Result::Err(kb_core::Error::new(reason_code, reason)); + return std::result::Result::Err(ks_core::Error::new(reason_code, reason)); }, } let intent = match serde_json::from_str::( @@ -99,14 +99,14 @@ impl crate::ExApiInstructionExecutor for crate::ExSplElgamalRegistryExecutor { ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_elgamal_registry_intent_deserialize_failed", error.to_string(), )); }, }; if intent.operation.operation_code() != request.operation_code { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_operation_code_mismatch", "request and typed intent operations differ", )); @@ -119,7 +119,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplElgamalRegistryExecutor { let payload = match serde_json::to_value(&prepared) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_elgamal_registry_plan_serialize_failed", error.to_string(), )); @@ -149,7 +149,7 @@ mod tests { let capability = crate::ExApiTypedInstructionExecutor::capability( &executor, &crate::MdProgramId(std::string::String::from( - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, )), operation, ); @@ -158,7 +158,7 @@ mod tests { let foreign = crate::ExApiTypedInstructionExecutor::capability( &executor, &crate::MdProgramId(std::string::String::from( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, )), crate::EX_SPL_ELGAMAL_REGISTRY_CREATE_OPERATION, ); diff --git a/kb-lib/src/executor/spl/elgamal_registry/intent.rs b/ks-lib/src/executor/spl/elgamal_registry/intent.rs similarity index 91% rename from kb-lib/src/executor/spl/elgamal_registry/intent.rs rename to ks-lib/src/executor/spl/elgamal_registry/intent.rs index 72b09ee..1fc888e 100644 --- a/kb-lib/src/executor/spl/elgamal_registry/intent.rs +++ b/ks-lib/src/executor/spl/elgamal_registry/intent.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/elgamal_registry/intent.rs -// version: 3 +// file: ks-lib/src/executor/spl/elgamal_registry/intent.rs +// version: 4 //! Typed intents for the SPL ElGamal public-key registry. @@ -15,7 +15,7 @@ pub const EX_SPL_ELGAMAL_REGISTRY_UPDATE_OPERATION: &str = "spl.elgamal_registry #[serde(tag = "location", rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/elgamal_registry/intent/ExSplElgamalRegistryProofLocation.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/elgamal_registry/intent/ExSplElgamalRegistryProofLocation.ts" )] pub enum ExSplElgamalRegistryProofLocation { /// A pre-verified proof context-state account. @@ -35,7 +35,7 @@ pub enum ExSplElgamalRegistryProofLocation { #[serde(tag = "operation", rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/elgamal_registry/intent/ExSplElgamalRegistryOperation.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/elgamal_registry/intent/ExSplElgamalRegistryOperation.ts" )] pub enum ExSplElgamalRegistryOperation { /// Create the deterministic registry PDA for one owner. @@ -72,7 +72,7 @@ impl crate::ExSplElgamalRegistryOperation { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/elgamal_registry/intent/ExSplElgamalRegistryExecutionIntent.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/elgamal_registry/intent/ExSplElgamalRegistryExecutionIntent.ts" )] pub struct ExSplElgamalRegistryExecutionIntent { /// Caller-provided correlation identifier. diff --git a/kb-lib/src/executor/spl/memo.rs b/ks-lib/src/executor/spl/memo.rs similarity index 95% rename from kb-lib/src/executor/spl/memo.rs rename to ks-lib/src/executor/spl/memo.rs index 10309ef..9f600d9 100644 --- a/kb-lib/src/executor/spl/memo.rs +++ b/ks-lib/src/executor/spl/memo.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/memo.rs -// version: 5 +// file: ks-lib/src/executor/spl/memo.rs +// version: 6 //! Safe typed executor for `spl_memo`. diff --git a/kb-lib/src/executor/spl/memo/builder.rs b/ks-lib/src/executor/spl/memo/builder.rs similarity index 94% rename from kb-lib/src/executor/spl/memo/builder.rs rename to ks-lib/src/executor/spl/memo/builder.rs index bd5d7c4..5301cbf 100644 --- a/kb-lib/src/executor/spl/memo/builder.rs +++ b/ks-lib/src/executor/spl/memo/builder.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/memo/builder.rs -// version: 3 +// file: ks-lib/src/executor/spl/memo/builder.rs +// version: 4 //! Official SPL Memo instruction builder and conservative plan validation. @@ -7,9 +7,9 @@ use std::str::FromStr; // rust-rules: trait-import pub(crate) fn executor_spl_memo_build_prepared_plan( intent: &crate::ExSplMemoExecutionIntent, -) -> kb_core::Result { +) -> ks_core::Result { if intent.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_memo_intent_id_empty", "SPL Memo execution intent id must not be empty", )); @@ -28,7 +28,7 @@ pub(crate) fn executor_spl_memo_build_prepared_plan( }, }; if message.len() > crate::EX_SPL_MEMO_MAX_MESSAGE_BYTES { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_memo_payload_too_large", format!( "SPL Memo payload length {} exceeds the executor limit {}", @@ -38,7 +38,7 @@ pub(crate) fn executor_spl_memo_build_prepared_plan( )); } if signers.len() > crate::EX_SPL_MEMO_MAX_SIGNERS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_memo_signer_limit_exceeded", format!( "SPL Memo signer occurrence count {} exceeds the executor limit {}", @@ -50,7 +50,7 @@ pub(crate) fn executor_spl_memo_build_prepared_plan( let program_id = match solana_pubkey::Pubkey::from_str(generation.program_id()) { std::result::Result::Ok(pubkey) => pubkey, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_memo_program_id_invalid", error.to_string(), )); @@ -99,9 +99,9 @@ pub(crate) fn executor_spl_memo_build_prepared_plan( }); } -fn validate_policy(intent: &crate::ExSplMemoExecutionIntent) -> kb_core::Result<()> { +fn validate_policy(intent: &crate::ExSplMemoExecutionIntent) -> ks_core::Result<()> { if intent.policy.simulation != crate::ExApiExecutionSimulationPolicy::Required { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_memo_simulation_required", "SPL Memo execution requires simulation before signing or sending", )); @@ -109,7 +109,7 @@ fn validate_policy(intent: &crate::ExSplMemoExecutionIntent) -> kb_core::Result< match intent.policy.cost_limit.max_fee_lamports { std::option::Option::Some(limit) if limit > 0 => {}, std::option::Option::Some(_) | std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_memo_fee_limit_missing", "SPL Memo execution requires a positive transaction fee ceiling", )); @@ -121,7 +121,7 @@ fn validate_policy(intent: &crate::ExSplMemoExecutionIntent) -> kb_core::Result< || !validation.decode_replay_required || !validation.materialization_required { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_memo_post_validation_required", "SPL Memo execution requires canonical insertion, core extraction, decode replay and materialization validation", )); @@ -129,16 +129,16 @@ fn validate_policy(intent: &crate::ExSplMemoExecutionIntent) -> kb_core::Result< return std::result::Result::Ok(()); } -fn parse_pubkey(pubkey: &crate::MdPubkey, field: &str) -> kb_core::Result { +fn parse_pubkey(pubkey: &crate::MdPubkey, field: &str) -> ks_core::Result { if pubkey.0.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_memo_pubkey_empty", format!("SPL Memo {field} public key must not be empty"), )); } return match solana_pubkey::Pubkey::from_str(pubkey.0.as_str()) { std::result::Result::Ok(parsed) => std::result::Result::Ok(parsed), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_spl_memo_pubkey_invalid", format!("invalid SPL Memo {field} public key: {error}"), )), @@ -201,7 +201,7 @@ pub(crate) mod tests { signers: &[&str], dry_run: bool, ) -> crate::ExSplMemoExecutionIntent { - let fee_payer = kb_program_ids::SYSTEM_PROGRAM_ID; + let fee_payer = ks_program_ids::SYSTEM_PROGRAM_ID; let mut authorized_signers = vec![pubkey(fee_payer)]; for signer in signers { let candidate = pubkey(signer); @@ -279,13 +279,13 @@ pub(crate) mod tests { #[test] fn current_generation_matches_the_official_explicit_program_builder() { let generation = crate::ExSplMemoGeneration::V4; - let intent = intent(generation, "memo 🐆", &[kb_program_ids::VOTE_PROGRAM_ID], true); + let intent = intent(generation, "memo 🐆", &[ks_program_ids::VOTE_PROGRAM_ID], true); let plan = crate::ExApiTypedInstructionExecutor::build_prepared_plan( &crate::ExSplMemoExecutor, &intent, ) .unwrap_or_else(|error| panic!("Memo plan failed: {error}")); - assert_matches_official(&plan, generation, "memo 🐆", &[kb_program_ids::VOTE_PROGRAM_ID]); + assert_matches_official(&plan, generation, "memo 🐆", &[ks_program_ids::VOTE_PROGRAM_ID]); } #[test] @@ -304,8 +304,8 @@ pub(crate) mod tests { #[test] fn duplicate_signers_remain_ordered_readonly_accounts_but_required_signers_are_unique() { - let first = kb_program_ids::VOTE_PROGRAM_ID; - let second = kb_program_ids::STAKE_PROGRAM_ID; + let first = ks_program_ids::VOTE_PROGRAM_ID; + let second = ks_program_ids::STAKE_PROGRAM_ID; let intent = intent(crate::ExSplMemoGeneration::V4, "ordered", &[first, second, first], false); let plan = crate::ExApiTypedInstructionExecutor::build_prepared_plan( @@ -328,7 +328,7 @@ pub(crate) mod tests { let intent = intent( crate::ExSplMemoGeneration::V4, "safe plan", - &[kb_program_ids::VOTE_PROGRAM_ID], + &[ks_program_ids::VOTE_PROGRAM_ID], true, ); let plan = crate::ExApiTypedInstructionExecutor::build_prepared_plan( @@ -451,7 +451,7 @@ pub(crate) mod tests { signers: (0..=crate::EX_SPL_MEMO_MAX_SIGNERS) .map(|_| { return crate::ExSplMemoSigner { - pubkey: pubkey(kb_program_ids::VOTE_PROGRAM_ID), + pubkey: pubkey(ks_program_ids::VOTE_PROGRAM_ID), }; }) .collect(), diff --git a/kb-lib/src/executor/spl/memo/constants.rs b/ks-lib/src/executor/spl/memo/constants.rs similarity index 64% rename from kb-lib/src/executor/spl/memo/constants.rs rename to ks-lib/src/executor/spl/memo/constants.rs index e4bcc3f..5eb8fc0 100644 --- a/kb-lib/src/executor/spl/memo/constants.rs +++ b/ks-lib/src/executor/spl/memo/constants.rs @@ -1,7 +1,7 @@ -// file: kb-lib/src/executor/spl/memo/constants.rs -// version: 3 +// file: ks-lib/src/executor/spl/memo/constants.rs +// version: 4 -//! Local constants for the `kb-lib.executor.spl.memo` crate. Program identifiers live in `kb_program_ids`. +//! Local constants for the `kb-lib.executor.spl.memo` crate. Program identifiers live in `ks_program_ids`. /// Canonical tracing target for this crate. pub(crate) const TRACING_TARGET_EXECUTOR_SPL_MEMO: &str = "kb-lib.executor.spl.memo"; diff --git a/kb-lib/src/executor/spl/memo/executor.rs b/ks-lib/src/executor/spl/memo/executor.rs similarity index 91% rename from kb-lib/src/executor/spl/memo/executor.rs rename to ks-lib/src/executor/spl/memo/executor.rs index 8dfb3cf..8f3ab8f 100644 --- a/kb-lib/src/executor/spl/memo/executor.rs +++ b/ks-lib/src/executor/spl/memo/executor.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/memo/executor.rs -// version: 3 +// file: ks-lib/src/executor/spl/memo/executor.rs +// version: 4 //! Exact capability dispatch and typed plan construction for SPL Memo. @@ -54,7 +54,7 @@ impl crate::ExApiTypedInstructionExecutor for crate::ExSplMemoExecutor { fn build_prepared_plan( &self, intent: &Self::Intent, - ) -> kb_core::Result { + ) -> ks_core::Result { let program_id = crate::MdProgramId(std::string::String::from( intent.operation.generation().program_id(), )); @@ -63,7 +63,7 @@ impl crate::ExApiTypedInstructionExecutor for crate::ExSplMemoExecutor { crate::executor_spl_memo_build_prepared_plan(intent) }, crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => { - std::result::Result::Err(kb_core::Error::new(reason_code, reason)) + std::result::Result::Err(ks_core::Error::new(reason_code, reason)) }, }; } @@ -80,9 +80,9 @@ impl crate::ExApiInstructionExecutor for crate::ExSplMemoExecutor { fn program_ids(&self) -> &'static [&'static str] { return &[ - kb_program_ids::SPL_MEMO_V1_PROGRAM_ID, - kb_program_ids::SPL_MEMO_V3_PROGRAM_ID, - kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V1_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V3_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, ]; } @@ -103,25 +103,25 @@ impl crate::ExApiInstructionExecutor for crate::ExSplMemoExecutor { fn build_plan( &self, request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { match self.exact_capability(&request.program_id, &request.operation_code) { crate::ExApiExecutionCapability::Supported { operation_code: _ } => {}, crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => { - return std::result::Result::Err(kb_core::Error::new(reason_code, reason)); + return std::result::Result::Err(ks_core::Error::new(reason_code, reason)); }, } let intent = match serde_json::from_str::(&request.payload_json) { std::result::Result::Ok(intent) => intent, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_memo_intent_deserialize_failed", error.to_string(), )); }, }; if intent.operation.operation_code() != request.operation_code.as_str() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_operation_code_mismatch", format!( "request operation {} does not match typed intent operation {}", @@ -131,7 +131,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplMemoExecutor { )); } if intent.operation.generation().program_id() != request.program_id.0.as_str() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_program_id_mismatch", format!( "request program {} does not match typed intent program {}", @@ -148,7 +148,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplMemoExecutor { let payload_value = match serde_json::to_value(&prepared) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_memo_plan_serialize_failed", error.to_string(), )); @@ -190,7 +190,7 @@ mod tests { signers: &[&str], dry_run: bool, ) -> crate::ExSplMemoExecutionIntent { - let fee_payer = kb_program_ids::SYSTEM_PROGRAM_ID; + let fee_payer = ks_program_ids::SYSTEM_PROGRAM_ID; let mut authorized_signers = vec![pubkey(fee_payer)]; for signer in signers { let candidate = pubkey(signer); @@ -234,7 +234,7 @@ mod tests { fn exact_capabilities_support_only_current_v4_add_memo() { let executor = crate::ExSplMemoExecutor; for program_id in - [kb_program_ids::SPL_MEMO_V1_PROGRAM_ID, kb_program_ids::SPL_MEMO_V3_PROGRAM_ID] + [ks_program_ids::SPL_MEMO_V1_PROGRAM_ID, ks_program_ids::SPL_MEMO_V3_PROGRAM_ID] { let request = request( program_id, @@ -247,7 +247,7 @@ mod tests { ); } let current = request( - kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, crate::EX_SPL_MEMO_ADD_MEMO_OPERATION, std::string::String::from("{}"), ); @@ -256,7 +256,7 @@ mod tests { crate::ExApiExecutionSupport::Yes ); let unsupported_operation = request( - kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, "spl.memo.remove_memo", std::string::String::from("{}"), ); @@ -265,7 +265,7 @@ mod tests { crate::ExApiExecutionSupport::No ); let foreign = request( - kb_program_ids::SYSTEM_PROGRAM_ID, + ks_program_ids::SYSTEM_PROGRAM_ID, crate::EX_SPL_MEMO_ADD_MEMO_OPERATION, std::string::String::from("{}"), ); @@ -280,13 +280,13 @@ mod tests { let intent = intent( crate::ExSplMemoGeneration::V4, "generic", - &[kb_program_ids::VOTE_PROGRAM_ID], + &[ks_program_ids::VOTE_PROGRAM_ID], false, ); let payload_json = serde_json::to_string(&intent) .unwrap_or_else(|error| panic!("intent serialization failed: {error}")); let request = request( - kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, crate::EX_SPL_MEMO_ADD_MEMO_OPERATION, payload_json, ); diff --git a/kb-lib/src/executor/spl/memo/intent.rs b/ks-lib/src/executor/spl/memo/intent.rs similarity index 83% rename from kb-lib/src/executor/spl/memo/intent.rs rename to ks-lib/src/executor/spl/memo/intent.rs index a928b48..ff5bb09 100644 --- a/kb-lib/src/executor/spl/memo/intent.rs +++ b/ks-lib/src/executor/spl/memo/intent.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/memo/intent.rs -// version: 2 +// file: ks-lib/src/executor/spl/memo/intent.rs +// version: 3 //! Typed SPL Memo execution intents. @@ -17,7 +17,7 @@ pub const EX_SPL_MEMO_MAX_SIGNERS: usize = 32; #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/memo/intent/ExSplMemoGeneration.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/memo/intent/ExSplMemoGeneration.ts" )] pub enum ExSplMemoGeneration { /// Historical v1 program, whose runtime ignores supplied accounts. @@ -32,17 +32,17 @@ impl crate::ExSplMemoGeneration { /// Returns the exact Program ID for this generation. pub fn program_id(&self) -> &'static str { return match self { - Self::V1 => kb_program_ids::SPL_MEMO_V1_PROGRAM_ID, - Self::V3 => kb_program_ids::SPL_MEMO_V3_PROGRAM_ID, - Self::V4 => kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + Self::V1 => ks_program_ids::SPL_MEMO_V1_PROGRAM_ID, + Self::V3 => ks_program_ids::SPL_MEMO_V3_PROGRAM_ID, + Self::V4 => ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, }; } pub(crate) fn from_program_id(program_id: &str) -> std::option::Option { return match program_id { - kb_program_ids::SPL_MEMO_V1_PROGRAM_ID => std::option::Option::Some(Self::V1), - kb_program_ids::SPL_MEMO_V3_PROGRAM_ID => std::option::Option::Some(Self::V3), - kb_program_ids::SPL_MEMO_V4_PROGRAM_ID => std::option::Option::Some(Self::V4), + ks_program_ids::SPL_MEMO_V1_PROGRAM_ID => std::option::Option::Some(Self::V1), + ks_program_ids::SPL_MEMO_V3_PROGRAM_ID => std::option::Option::Some(Self::V3), + ks_program_ids::SPL_MEMO_V4_PROGRAM_ID => std::option::Option::Some(Self::V4), _ => std::option::Option::None, }; } @@ -52,7 +52,7 @@ impl crate::ExSplMemoGeneration { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/memo/intent/ExSplMemoSigner.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/memo/intent/ExSplMemoSigner.ts" )] pub struct ExSplMemoSigner { /// Signer public key; duplicates are preserved in instruction order. @@ -64,7 +64,7 @@ pub struct ExSplMemoSigner { #[serde(tag = "operation", rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/memo/intent/ExSplMemoOperation.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/memo/intent/ExSplMemoOperation.ts" )] pub enum ExSplMemoOperation { /// Add one exact UTF-8 Memo payload with ordered readonly signer accounts. @@ -98,7 +98,7 @@ impl crate::ExSplMemoOperation { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/memo/intent/ExSplMemoExecutionIntent.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/memo/intent/ExSplMemoExecutionIntent.ts" )] pub struct ExSplMemoExecutionIntent { /// Stable caller-provided identifier used for logs and replay correlation. diff --git a/kb-lib/src/executor/spl/noop.rs b/ks-lib/src/executor/spl/noop.rs similarity index 89% rename from kb-lib/src/executor/spl/noop.rs rename to ks-lib/src/executor/spl/noop.rs index 5820435..a2c4a00 100644 --- a/kb-lib/src/executor/spl/noop.rs +++ b/ks-lib/src/executor/spl/noop.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/noop.rs -// version: 3 +// file: ks-lib/src/executor/spl/noop.rs +// version: 4 //! Reserved executor for `spl_noop`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplNoopExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::SPL_NOOP_PROGRAM_ID]; + return &[ks_program_ids::SPL_NOOP_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplNoopExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"spl_noop"}), ) { diff --git a/kb-lib/src/executor/spl/single_pool.rs b/ks-lib/src/executor/spl/single_pool.rs similarity index 89% rename from kb-lib/src/executor/spl/single_pool.rs rename to ks-lib/src/executor/spl/single_pool.rs index d5601ae..779df67 100644 --- a/kb-lib/src/executor/spl/single_pool.rs +++ b/ks-lib/src/executor/spl/single_pool.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/single_pool.rs -// version: 3 +// file: ks-lib/src/executor/spl/single_pool.rs +// version: 4 //! Reserved executor for `spl_single_pool`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplSinglePoolExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::SPL_SINGLE_POOL_PROGRAM_ID]; + return &[ks_program_ids::SPL_SINGLE_POOL_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplSinglePoolExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"spl_single_pool"}), ) { diff --git a/kb-lib/src/executor/spl/stake_pool.rs b/ks-lib/src/executor/spl/stake_pool.rs similarity index 89% rename from kb-lib/src/executor/spl/stake_pool.rs rename to ks-lib/src/executor/spl/stake_pool.rs index 97de612..22cb0c9 100644 --- a/kb-lib/src/executor/spl/stake_pool.rs +++ b/ks-lib/src/executor/spl/stake_pool.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/stake_pool.rs -// version: 3 +// file: ks-lib/src/executor/spl/stake_pool.rs +// version: 4 //! Reserved executor for `spl_stake_pool`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplStakePoolExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::SPL_STAKE_POOL_PROGRAM_ID]; + return &[ks_program_ids::SPL_STAKE_POOL_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplStakePoolExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"spl_stake_pool"}), ) { diff --git a/kb-lib/src/executor/spl/token.rs b/ks-lib/src/executor/spl/token.rs similarity index 98% rename from kb-lib/src/executor/spl/token.rs rename to ks-lib/src/executor/spl/token.rs index d947684..c6a4908 100644 --- a/kb-lib/src/executor/spl/token.rs +++ b/ks-lib/src/executor/spl/token.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/token.rs -// version: 3 +// file: ks-lib/src/executor/spl/token.rs +// version: 4 //! SPL Token classic executor. diff --git a/kb-lib/src/executor/spl/token/builder.rs b/ks-lib/src/executor/spl/token/builder.rs similarity index 94% rename from kb-lib/src/executor/spl/token/builder.rs rename to ks-lib/src/executor/spl/token/builder.rs index 9179f58..4c0a4aa 100644 --- a/kb-lib/src/executor/spl/token/builder.rs +++ b/ks-lib/src/executor/spl/token/builder.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/token/builder.rs -// version: 9 +// file: ks-lib/src/executor/spl/token/builder.rs +// version: 10 //! Official classic SPL Token builders and conservative plan validation. @@ -12,9 +12,9 @@ struct ParsedAuthority { pub(crate) fn executor_spl_token_build_prepared_plan( intent: &crate::ExSplClassicTokenExecutionIntent, -) -> kb_core::Result { +) -> ks_core::Result { if intent.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_intent_id_empty", "SPL Token execution intent id must not be empty", )); @@ -27,10 +27,10 @@ pub(crate) fn executor_spl_token_build_prepared_plan( std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), } - let program_id = match solana_pubkey::Pubkey::from_str(kb_program_ids::SPL_TOKEN_PROGRAM_ID) { + let program_id = match solana_pubkey::Pubkey::from_str(ks_program_ids::SPL_TOKEN_PROGRAM_ID) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_program_id_invalid", error.to_string(), )); @@ -61,7 +61,7 @@ pub(crate) fn executor_spl_token_build_prepared_plan( action = "executor_spl_token_build_prepared_plan", intent_id = %intent.intent_id, operation_code = intent.operation.operation_code(), - program_id = kb_program_ids::SPL_TOKEN_PROGRAM_ID, + program_id = ks_program_ids::SPL_TOKEN_PROGRAM_ID, account_occurrence_count = instruction.accounts.len(), required_signer_count = required_signers.len(), requested_spend_lamports, @@ -82,9 +82,9 @@ pub(crate) fn executor_spl_token_build_prepared_plan( }); } -fn validate_policy(intent: &crate::ExSplClassicTokenExecutionIntent) -> kb_core::Result<()> { +fn validate_policy(intent: &crate::ExSplClassicTokenExecutionIntent) -> ks_core::Result<()> { if intent.policy.simulation != crate::ExApiExecutionSimulationPolicy::Required { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_simulation_required", "SPL Token execution requires simulation before signing or sending", )); @@ -92,7 +92,7 @@ fn validate_policy(intent: &crate::ExSplClassicTokenExecutionIntent) -> kb_core: match intent.policy.cost_limit.max_fee_lamports { std::option::Option::Some(limit) if limit > 0 => {}, std::option::Option::Some(_) | std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_fee_limit_missing", "SPL Token execution requires a positive transaction fee ceiling", )); @@ -103,19 +103,19 @@ fn validate_policy(intent: &crate::ExSplClassicTokenExecutionIntent) -> kb_core: || !validation.core_extraction_required || !validation.decode_replay_required { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_post_validation_required", "SPL Token execution requires canonical insertion, core extraction and decode replay validation", )); } if intent.operation.requires_materialization() && !validation.materialization_required { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_materialization_validation_required", "Mutating SPL Token execution requires materialization validation", )); } if has_unbounded_lamport_movement(&intent.operation) && !intent.policy.dry_run { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_stateful_lamport_preflight_required", "WithdrawExcessLamports and full-balance UnwrapLamports remain simulation-only until a stateful preflight bounds the movable lamports", )); @@ -153,7 +153,7 @@ macro_rules! parse_token_authority { fn build_single( program_id: &solana_pubkey::Pubkey, operation: &crate::ExSplClassicTokenSingleOperation, -) -> kb_core::Result { +) -> ks_core::Result { return match operation { crate::ExSplClassicTokenSingleOperation::InitializeMint { mint, @@ -195,7 +195,7 @@ fn build_single( || *threshold == 0 || usize::from(*threshold) > members.len() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_multisig_threshold_invalid", format!( "SPL Token multisig requires 1..={} members and threshold 1..=N; received M={} N={}", @@ -514,7 +514,7 @@ fn build_single( }, crate::ExSplClassicTokenSingleOperation::UiAmountToAmount { mint, ui_amount } => { if ui_amount.len() > crate::EX_SPL_TOKEN_MAX_UI_AMOUNT_BYTES { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_ui_amount_too_large", format!( "SPL Token UI amount length {} exceeds {} bytes", @@ -578,9 +578,9 @@ fn build_single( fn build_batch( program_id: &solana_pubkey::Pubkey, operations: &[crate::ExSplClassicTokenSingleOperation], -) -> kb_core::Result { +) -> ks_core::Result { if operations.len() > crate::EX_SPL_TOKEN_MAX_BATCH_INSTRUCTIONS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_batch_instruction_limit_exceeded", format!( "SPL Token Batch child count {} exceeds {}", @@ -597,7 +597,7 @@ fn build_batch( std::result::Result::Err(error) => return std::result::Result::Err(error), }; if instruction.data.len() > usize::from(u8::MAX) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_batch_child_data_too_large", format!( "SPL Token Batch child {} has {} data bytes; maximum is {}", @@ -610,14 +610,14 @@ fn build_batch( account_count = match account_count.checked_add(instruction.accounts.len()) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_batch_account_count_overflow", "SPL Token Batch aggregate account count overflowed usize", )); }, }; if account_count > crate::EX_SPL_TOKEN_MAX_BATCH_ACCOUNTS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_batch_account_limit_exceeded", format!( "SPL Token Batch account occurrence count {account_count} exceeds {}", @@ -635,45 +635,45 @@ fn build_batch( fn official_instruction( result: std::result::Result, -) -> kb_core::Result +) -> ks_core::Result where BuilderError: std::fmt::Display, { return match result { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_spl_token_official_builder_failed", error.to_string(), )), }; } -fn parse_pubkey(pubkey: &crate::MdPubkey, field: &str) -> kb_core::Result { +fn parse_pubkey(pubkey: &crate::MdPubkey, field: &str) -> ks_core::Result { if pubkey.0.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_pubkey_empty", format!("SPL Token {field} public key must not be empty"), )); } return match solana_pubkey::Pubkey::from_str(pubkey.0.as_str()) { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_spl_token_pubkey_invalid", format!("invalid SPL Token {field} public key: {error}"), )), }; } -fn parse_amount(amount: &crate::ExSplClassicTokenAmount, field: &str) -> kb_core::Result { +fn parse_amount(amount: &crate::ExSplClassicTokenAmount, field: &str) -> ks_core::Result { if amount.0.is_empty() || !amount.0.bytes().all(|value| return value.is_ascii_digit()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_amount_invalid", format!("SPL Token {field} must be an unsigned decimal u64 string"), )); } return match amount.0.parse::() { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_spl_token_amount_invalid", format!("invalid SPL Token {field}: {error}"), )), @@ -682,9 +682,9 @@ fn parse_amount(amount: &crate::ExSplClassicTokenAmount, field: &str) -> kb_core fn parse_authority( authority: &crate::ExSplClassicTokenAuthority, -) -> kb_core::Result { +) -> ks_core::Result { if authority.multisig_signers.len() > crate::EX_SPL_TOKEN_MAX_MULTISIG_SIGNERS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_multisig_signer_limit_exceeded", format!( "SPL Token multisig signer occurrence count {} exceeds {}", @@ -708,7 +708,7 @@ fn parse_authority( return std::result::Result::Ok(ParsedAuthority { authority: parsed_authority, signers }); } -fn declared_spend_lamports(operation: &crate::ExSplClassicTokenOperation) -> kb_core::Result { +fn declared_spend_lamports(operation: &crate::ExSplClassicTokenOperation) -> ks_core::Result { return match operation { crate::ExSplClassicTokenOperation::Instruction { value } => single_spend_lamports(value), crate::ExSplClassicTokenOperation::Batch { instructions } => { @@ -721,7 +721,7 @@ fn declared_spend_lamports(operation: &crate::ExSplClassicTokenOperation) -> kb_ total = match total.checked_add(amount) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lamport_spend_overflow", "SPL Token Batch declared lamport spend exceeds u64", )); @@ -735,7 +735,7 @@ fn declared_spend_lamports(operation: &crate::ExSplClassicTokenOperation) -> kb_ fn single_spend_lamports( operation: &crate::ExSplClassicTokenSingleOperation, -) -> kb_core::Result { +) -> ks_core::Result { return match operation { crate::ExSplClassicTokenSingleOperation::UnwrapLamports { amount_lamports: std::option::Option::Some(value), @@ -842,12 +842,12 @@ pub(crate) mod tests { pub(crate) fn intent( operation: crate::ExSplClassicTokenOperation, ) -> crate::ExSplClassicTokenExecutionIntent { - let fee_payer = kb_program_ids::SYSTEM_PROGRAM_ID; + let fee_payer = ks_program_ids::SYSTEM_PROGRAM_ID; return crate::ExSplClassicTokenExecutionIntent { intent_id: std::string::String::from("token-intent-1"), fee_payer: pubkey(fee_payer), policy: policy( - &[fee_payer, kb_program_ids::VOTE_PROGRAM_ID, kb_program_ids::STAKE_PROGRAM_ID], + &[fee_payer, ks_program_ids::VOTE_PROGRAM_ID, ks_program_ids::STAKE_PROGRAM_ID], operation.requires_materialization(), ), operation, @@ -856,17 +856,17 @@ pub(crate) mod tests { fn authority(signers: &[&str]) -> crate::ExSplClassicTokenAuthority { return crate::ExSplClassicTokenAuthority { - authority: pubkey(kb_program_ids::CONFIG_PROGRAM_ID), + authority: pubkey(ks_program_ids::CONFIG_PROGRAM_ID), multisig_signers: signers.iter().map(|value| return pubkey(value)).collect(), }; } fn transfer_checked() -> crate::ExSplClassicTokenSingleOperation { return crate::ExSplClassicTokenSingleOperation::TransferChecked { - source: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), - mint: pubkey(kb_program_ids::CONFIG_PROGRAM_ID), - destination: pubkey(kb_program_ids::STAKE_PROGRAM_ID), - authority: authority(&[kb_program_ids::VOTE_PROGRAM_ID]), + source: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), + mint: pubkey(ks_program_ids::CONFIG_PROGRAM_ID), + destination: pubkey(ks_program_ids::STAKE_PROGRAM_ID), + authority: authority(&[ks_program_ids::VOTE_PROGRAM_ID]), amount: crate::ExSplClassicTokenAmount(std::string::String::from( "18446744073709551615", )), @@ -875,9 +875,9 @@ pub(crate) mod tests { } fn all_single_operations() -> std::vec::Vec<(u8, crate::ExSplClassicTokenSingleOperation)> { - let first = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); - let second = pubkey(kb_program_ids::CONFIG_PROGRAM_ID); - let third = pubkey(kb_program_ids::STAKE_PROGRAM_ID); + let first = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); + let second = pubkey(ks_program_ids::CONFIG_PROGRAM_ID); + let third = pubkey(ks_program_ids::STAKE_PROGRAM_ID); let authority = authority(&[]); let amount = crate::ExSplClassicTokenAmount(std::string::String::from("42")); return vec![ @@ -1099,11 +1099,11 @@ pub(crate) mod tests { #[test] fn multisig_meta_order_is_preserved_while_transaction_signers_are_unique() { - let first = kb_program_ids::VOTE_PROGRAM_ID; - let second = kb_program_ids::STAKE_PROGRAM_ID; + let first = ks_program_ids::VOTE_PROGRAM_ID; + let second = ks_program_ids::STAKE_PROGRAM_ID; let operation = crate::ExSplClassicTokenSingleOperation::Transfer { - source: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), - destination: pubkey(kb_program_ids::CONFIG_PROGRAM_ID), + source: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), + destination: pubkey(ks_program_ids::CONFIG_PROGRAM_ID), authority: authority(&[first, second, first]), amount: crate::ExSplClassicTokenAmount(std::string::String::from("1")), }; @@ -1123,8 +1123,8 @@ pub(crate) mod tests { #[test] fn recent_unwrap_and_batch_match_published_wire() { let unwrap = crate::ExSplClassicTokenSingleOperation::UnwrapLamports { - account: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), - destination: pubkey(kb_program_ids::STAKE_PROGRAM_ID), + account: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), + destination: pubkey(ks_program_ids::STAKE_PROGRAM_ID), authority: authority(&[]), amount_lamports: std::option::Option::Some(crate::ExSplClassicTokenAmount( std::string::String::from("42"), diff --git a/kb-lib/src/executor/spl/token/constants.rs b/ks-lib/src/executor/spl/token/constants.rs similarity index 87% rename from kb-lib/src/executor/spl/token/constants.rs rename to ks-lib/src/executor/spl/token/constants.rs index a40b298..71db4b6 100644 --- a/kb-lib/src/executor/spl/token/constants.rs +++ b/ks-lib/src/executor/spl/token/constants.rs @@ -1,7 +1,7 @@ -// file: kb-lib/src/executor/spl/token/constants.rs -// version: 3 +// file: ks-lib/src/executor/spl/token/constants.rs +// version: 4 -//! Local constants for the SPL Token classic executor. Program identifiers live in `kb_program_ids`. +//! Local constants for the SPL Token classic executor. Program identifiers live in `ks_program_ids`. /// Maximum number of children accepted by one Batch plan. pub(crate) const EX_SPL_TOKEN_MAX_BATCH_INSTRUCTIONS: usize = 64; diff --git a/kb-lib/src/executor/spl/token/executor.rs b/ks-lib/src/executor/spl/token/executor.rs similarity index 91% rename from kb-lib/src/executor/spl/token/executor.rs rename to ks-lib/src/executor/spl/token/executor.rs index 71f2bb4..1aa477b 100644 --- a/kb-lib/src/executor/spl/token/executor.rs +++ b/ks-lib/src/executor/spl/token/executor.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/token/executor.rs -// version: 9 +// file: ks-lib/src/executor/spl/token/executor.rs +// version: 10 //! Exact classic SPL Token capability dispatch and typed plan construction. @@ -13,7 +13,7 @@ impl crate::ExSplTokenExecutor { program_id: &crate::MdProgramId, operation_code: &str, ) -> crate::ExApiExecutionCapability { - if program_id.0 != kb_program_ids::SPL_TOKEN_PROGRAM_ID { + if program_id.0 != ks_program_ids::SPL_TOKEN_PROGRAM_ID { return crate::ExApiExecutionCapability::unsupported( "execution_spl_token_program_not_owned", format!("program {} is not owned by kb-lib.executor.spl.token", program_id.0), @@ -57,15 +57,15 @@ impl crate::ExApiTypedInstructionExecutor for crate::ExSplTokenExecutor { fn build_prepared_plan( &self, intent: &Self::Intent, - ) -> kb_core::Result { + ) -> ks_core::Result { let program_id = - crate::MdProgramId(std::string::String::from(kb_program_ids::SPL_TOKEN_PROGRAM_ID)); + crate::MdProgramId(std::string::String::from(ks_program_ids::SPL_TOKEN_PROGRAM_ID)); return match self.exact_capability(&program_id, intent.operation.operation_code()) { crate::ExApiExecutionCapability::Supported { operation_code: _ } => { crate::executor_spl_token_build_prepared_plan(intent) }, crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => { - std::result::Result::Err(kb_core::Error::new(reason_code, reason)) + std::result::Result::Err(ks_core::Error::new(reason_code, reason)) }, }; } @@ -81,7 +81,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplTokenExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::SPL_TOKEN_PROGRAM_ID]; + return &[ks_program_ids::SPL_TOKEN_PROGRAM_ID]; } fn supports_request( @@ -101,11 +101,11 @@ impl crate::ExApiInstructionExecutor for crate::ExSplTokenExecutor { fn build_plan( &self, request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { match self.exact_capability(&request.program_id, &request.operation_code) { crate::ExApiExecutionCapability::Supported { operation_code: _ } => {}, crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => { - return std::result::Result::Err(kb_core::Error::new(reason_code, reason)); + return std::result::Result::Err(ks_core::Error::new(reason_code, reason)); }, } let intent = match serde_json::from_str::( @@ -113,14 +113,14 @@ impl crate::ExApiInstructionExecutor for crate::ExSplTokenExecutor { ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_intent_deserialize_failed", error.to_string(), )); }, }; if intent.operation.operation_code() != request.operation_code.as_str() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_operation_code_mismatch", format!( "request operation {} does not match typed intent operation {}", @@ -137,7 +137,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplTokenExecutor { let payload_value = match serde_json::to_value(&prepared) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_plan_serialize_failed", error.to_string(), )); @@ -169,7 +169,7 @@ mod tests { fn exact_capabilities_cover_current_and_recent_operations_only() { let executor = crate::ExSplTokenExecutor; for operation_code in crate::EX_SPL_TOKEN_SUPPORTED_OPERATION_CODES { - let request = request(kb_program_ids::SPL_TOKEN_PROGRAM_ID, operation_code); + let request = request(ks_program_ids::SPL_TOKEN_PROGRAM_ID, operation_code); assert_eq!( crate::ExApiInstructionExecutor::supports_request(&executor, &request), crate::ExApiExecutionSupport::Yes @@ -183,7 +183,7 @@ mod tests { ] { let capability = crate::ExApiTypedInstructionExecutor::capability( &executor, - &crate::MdProgramId(kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), + &crate::MdProgramId(ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), operation_code, ); match capability { @@ -201,7 +201,7 @@ mod tests { fn program_dispatch_is_exact() { let executor = crate::ExSplTokenExecutor; let foreign = request( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, crate::EX_SPL_TOKEN_TRANSFER_CHECKED_OPERATION, ); assert_eq!( diff --git a/kb-lib/src/executor/spl/token/intent.rs b/ks-lib/src/executor/spl/token/intent.rs similarity index 97% rename from kb-lib/src/executor/spl/token/intent.rs rename to ks-lib/src/executor/spl/token/intent.rs index e78ff41..6b6d14f 100644 --- a/kb-lib/src/executor/spl/token/intent.rs +++ b/ks-lib/src/executor/spl/token/intent.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/token/intent.rs -// version: 5 +// file: ks-lib/src/executor/spl/token/intent.rs +// version: 6 //! Typed classic SPL Token execution intents. @@ -88,7 +88,7 @@ pub const EX_SPL_TOKEN_SUPPORTED_OPERATION_CODES: &[&str] = &[ #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token/intent/ExSplClassicTokenAmount.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token/intent/ExSplClassicTokenAmount.ts" )] pub struct ExSplClassicTokenAmount( /// Canonical unsigned decimal representation. @@ -99,7 +99,7 @@ pub struct ExSplClassicTokenAmount( #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token/intent/ExSplClassicTokenAuthority.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token/intent/ExSplClassicTokenAuthority.ts" )] pub struct ExSplClassicTokenAuthority { /// Authority account. It signs only when `multisig_signers` is empty. @@ -113,7 +113,7 @@ pub struct ExSplClassicTokenAuthority { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token/intent/ExSplClassicTokenAuthorityType.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token/intent/ExSplClassicTokenAuthorityType.ts" )] pub enum ExSplClassicTokenAuthorityType { /// Mint authority. @@ -131,7 +131,7 @@ pub enum ExSplClassicTokenAuthorityType { #[serde(tag = "instruction", rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token/intent/ExSplClassicTokenSingleOperation.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token/intent/ExSplClassicTokenSingleOperation.ts" )] pub enum ExSplClassicTokenSingleOperation { /// Initialize a mint with the current no-Rent builder. @@ -411,7 +411,7 @@ impl crate::ExSplClassicTokenSingleOperation { #[serde(tag = "operation", rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token/intent/ExSplClassicTokenOperation.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token/intent/ExSplClassicTokenOperation.ts" )] pub enum ExSplClassicTokenOperation { /// Build one non-batch instruction. @@ -449,7 +449,7 @@ impl crate::ExSplClassicTokenOperation { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token/intent/ExSplClassicTokenExecutionIntent.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token/intent/ExSplClassicTokenExecutionIntent.ts" )] pub struct ExSplClassicTokenExecutionIntent { /// Stable caller-provided identifier used for logs and replay correlation. diff --git a/kb-lib/src/executor/spl/token_2022.rs b/ks-lib/src/executor/spl/token_2022.rs similarity index 99% rename from kb-lib/src/executor/spl/token_2022.rs rename to ks-lib/src/executor/spl/token_2022.rs index 24ac91a..43836f2 100644 --- a/kb-lib/src/executor/spl/token_2022.rs +++ b/ks-lib/src/executor/spl/token_2022.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/token_2022.rs -// version: 6 +// file: ks-lib/src/executor/spl/token_2022.rs +// version: 7 //! SPL Token-2022 executor. diff --git a/kb-lib/src/executor/spl/token_2022/builder.rs b/ks-lib/src/executor/spl/token_2022/builder.rs similarity index 95% rename from kb-lib/src/executor/spl/token_2022/builder.rs rename to ks-lib/src/executor/spl/token_2022/builder.rs index 4c8fdb6..bc228d6 100644 --- a/kb-lib/src/executor/spl/token_2022/builder.rs +++ b/ks-lib/src/executor/spl/token_2022/builder.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/token_2022/builder.rs -// version: 34 +// file: ks-lib/src/executor/spl/token_2022/builder.rs +// version: 35 //! Official Token-2022 builders and conservative plan validation. @@ -12,9 +12,9 @@ struct ParsedAuthority { pub(crate) fn executor_spl_token_2022_build_prepared_plan( intent: &crate::ExSplToken2022ExecutionIntent, -) -> kb_core::Result { +) -> ks_core::Result { if intent.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_intent_id_empty", "SPL Token execution intent id must not be empty", )); @@ -28,10 +28,10 @@ pub(crate) fn executor_spl_token_2022_build_prepared_plan( std::result::Result::Err(error) => return std::result::Result::Err(error), } let program_id = - match solana_pubkey::Pubkey::from_str(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID) { + match solana_pubkey::Pubkey::from_str(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_program_id_invalid", error.to_string(), )); @@ -62,7 +62,7 @@ pub(crate) fn executor_spl_token_2022_build_prepared_plan( action = "executor_spl_token_2022_build_prepared_plan", intent_id = %intent.intent_id, operation_code = intent.operation.operation_code(), - program_id = kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + program_id = ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, account_occurrence_count = instruction.accounts.len(), required_signer_count = required_signers.len(), requested_spend_lamports, @@ -83,9 +83,9 @@ pub(crate) fn executor_spl_token_2022_build_prepared_plan( }); } -fn validate_policy(intent: &crate::ExSplToken2022ExecutionIntent) -> kb_core::Result<()> { +fn validate_policy(intent: &crate::ExSplToken2022ExecutionIntent) -> ks_core::Result<()> { if intent.policy.simulation != crate::ExApiExecutionSimulationPolicy::Required { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_simulation_required", "SPL Token execution requires simulation before signing or sending", )); @@ -93,7 +93,7 @@ fn validate_policy(intent: &crate::ExSplToken2022ExecutionIntent) -> kb_core::Re match intent.policy.cost_limit.max_fee_lamports { std::option::Option::Some(limit) if limit > 0 => {}, std::option::Option::Some(_) | std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_fee_limit_missing", "SPL Token execution requires a positive transaction fee ceiling", )); @@ -104,19 +104,19 @@ fn validate_policy(intent: &crate::ExSplToken2022ExecutionIntent) -> kb_core::Re || !validation.core_extraction_required || !validation.decode_replay_required { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_post_validation_required", "SPL Token execution requires canonical insertion, core extraction and decode replay validation", )); } if intent.operation.requires_materialization() && !validation.materialization_required { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_materialization_validation_required", "Mutating SPL Token execution requires materialization validation", )); } if has_unbounded_lamport_movement(&intent.operation) && !intent.policy.dry_run { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_stateful_lamport_preflight_required", "WithdrawExcessLamports and full-balance UnwrapLamports remain simulation-only until a stateful preflight bounds the movable lamports", )); @@ -162,9 +162,9 @@ macro_rules! parse_optional_key { }; } -fn validate_metadata_string(value: &str, field: &str) -> kb_core::Result<()> { +fn validate_metadata_string(value: &str, field: &str) -> ks_core::Result<()> { if value.len() > 1_024 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_metadata_string_too_long", format!("Token metadata {field} exceeds the 1024-byte executor bound"), )); @@ -175,16 +175,16 @@ fn validate_metadata_string(value: &str, field: &str) -> kb_core::Result<()> { fn validate_token_metadata_emit_range( start: std::option::Option, end: std::option::Option, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if let (std::option::Option::Some(start), std::option::Option::Some(end)) = (start, end) { if start > end { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_metadata_emit_range_invalid", format!("Token metadata Emit start {start} exceeds end {end}"), )); } if end - start > 1_024 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_metadata_emit_range_too_large", "Token metadata Emit range exceeds the 1024-byte Solana return-data bound", )); @@ -192,14 +192,14 @@ fn validate_token_metadata_emit_range( } if let (std::option::Option::None, std::option::Option::Some(end)) = (start, end) { if end > 1_024 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_metadata_emit_range_too_large", "Token metadata Emit range from zero exceeds the 1024-byte Solana return-data bound", )); } } if let (std::option::Option::Some(_), std::option::Option::None) = (start, end) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_metadata_emit_range_end_required", "Token metadata Emit with a start offset requires an explicit end to remain bounded", )); @@ -221,18 +221,18 @@ fn default_account_state( } #[allow(deprecated)] -fn parse_multiplier(value: &crate::ExSplTokenMultiplier, field: &str) -> kb_core::Result { +fn parse_multiplier(value: &crate::ExSplTokenMultiplier, field: &str) -> ks_core::Result { let parsed = match value.0.parse::() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_multiplier_invalid", format!("{field} must be a decimal f64: {error}"), )); }, }; if !parsed.is_finite() || !parsed.is_normal() || parsed <= 0.0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_multiplier_invalid", format!("{field} must be positive, finite and normal"), )); @@ -244,7 +244,7 @@ fn parse_multiplier(value: &crate::ExSplTokenMultiplier, field: &str) -> kb_core fn build_single( program_id: &solana_pubkey::Pubkey, operation: &crate::ExSplTokenSingleOperation, -) -> kb_core::Result { +) -> ks_core::Result { return match operation { crate::ExSplTokenSingleOperation::InitializeMint { mint, @@ -282,7 +282,7 @@ fn build_single( || *threshold == 0 || usize::from(*threshold) > members.len() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_multisig_threshold_invalid", format!( "SPL Token multisig requires 1..={} members and threshold 1..=N; received M={} N={}", @@ -584,7 +584,7 @@ fn build_single( }, crate::ExSplTokenSingleOperation::UiAmountToAmount { mint, ui_amount } => { if ui_amount.len() > crate::EX_SPL_TOKEN_2022_MAX_UI_AMOUNT_BYTES { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_ui_amount_too_large", format!( "SPL Token UI amount length {} exceeds {} bytes", @@ -634,7 +634,7 @@ fn build_single( ) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_extension_type_unknown", format!("unknown Token-2022 extension type {extension_type}"), )); @@ -717,7 +717,7 @@ fn build_single( if *transfer_fee_basis_points > spl_token_2022_interface::extension::transfer_fee::MAX_FEE_BASIS_POINTS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_transfer_fee_basis_points_invalid", format!( "transfer fee basis points {} exceed {}", @@ -760,7 +760,7 @@ fn build_single( if *transfer_fee_basis_points > spl_token_2022_interface::extension::transfer_fee::MAX_FEE_BASIS_POINTS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_transfer_fee_basis_points_invalid", "transfer fee basis points exceed the official maximum", )); @@ -1208,7 +1208,7 @@ fn build_single( let nullable_authority = match new_authority.try_into() { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_metadata_authority_invalid", "Token metadata authority cannot be encoded as a nullable address", )); @@ -1439,7 +1439,7 @@ fn build_single( Some(value) => match value.parse() { Ok(parsed) => Some(parsed), Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_invalid_elgamal_pubkey", error, )); @@ -1466,7 +1466,7 @@ fn build_single( Some(value) => match value.parse() { Ok(parsed) => Some(parsed), Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_invalid_elgamal_pubkey", error, )); @@ -1493,7 +1493,7 @@ fn build_single( let balance = match new_decryptable_available_balance.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_invalid_decryptable_balance", error, )); @@ -1594,7 +1594,7 @@ fn build_single( proof, } => { if proof.kind != crate::ExSplTokenConfidentialProofKind::PubkeyValidity { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_kind_invalid", "ConfigureAccount requires exactly one PubkeyValidity proof reference", )); @@ -1602,7 +1602,7 @@ fn build_single( match proof.location.validate() { Ok(()) => {}, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_location_invalid", error, )); @@ -1615,7 +1615,7 @@ fn build_single( let decryptable_zero_balance = match decryptable_zero_balance.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_invalid_decryptable_balance", error, )); @@ -1628,7 +1628,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "ConfigureAccount inline proof offset must be non-zero", )); @@ -1683,7 +1683,7 @@ fn build_single( proof, } => { if proof.kind != crate::ExSplTokenConfidentialProofKind::ZeroCiphertext { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_kind_invalid", "EmptyAccount requires exactly one ZeroCiphertext proof reference", )); @@ -1691,7 +1691,7 @@ fn build_single( match proof.location.validate() { Ok(()) => {}, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_location_invalid", error, )); @@ -1707,7 +1707,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "EmptyAccount inline proof offset must be non-zero", )); @@ -1744,7 +1744,7 @@ fn build_single( != crate::ExSplTokenConfidentialProofKind::CiphertextCommitmentEquality || range_proof.kind != crate::ExSplTokenConfidentialProofKind::BatchedRangeProofU64 { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_kind_invalid", "Withdraw requires CiphertextCommitmentEquality then BatchedRangeProofU64 proof references", )); @@ -1753,7 +1753,7 @@ fn build_single( match proof.location.validate() { Ok(()) => {}, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_location_invalid", error, )); @@ -1766,7 +1766,7 @@ fn build_single( let new_balance = match new_decryptable_available_balance.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_decryptable_balance_invalid", error, )); @@ -1783,7 +1783,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "Withdraw equality proof offset must be non-zero", )); @@ -1801,7 +1801,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "Withdraw range proof offset must be non-zero", )); @@ -1845,7 +1845,7 @@ fn build_single( || ciphertext_validity_proof.kind != crate::ExSplTokenConfidentialProofKind::BatchedGroupedCiphertext3HandlesValidity || range_proof.kind != crate::ExSplTokenConfidentialProofKind::BatchedRangeProofU128 { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_kind_invalid", "Transfer requires CiphertextCommitmentEquality, BatchedGroupedCiphertext3HandlesValidity, then BatchedRangeProofU128 proof references", )); @@ -1854,7 +1854,7 @@ fn build_single( match proof.location.validate() { Ok(()) => {}, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_location_invalid", error, )); @@ -1867,7 +1867,7 @@ fn build_single( let new_balance = match new_source_decryptable_available_balance.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_decryptable_balance_invalid", error, )); @@ -1876,7 +1876,7 @@ fn build_single( let auditor_ciphertext_lo = match transfer_amount_auditor_ciphertext_lo.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_ciphertext_invalid", error, )); @@ -1885,7 +1885,7 @@ fn build_single( let auditor_ciphertext_hi = match transfer_amount_auditor_ciphertext_hi.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_ciphertext_invalid", error, )); @@ -1904,7 +1904,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "Transfer equality proof offset must be non-zero", )); @@ -1922,7 +1922,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "Transfer ciphertext-validity proof offset must be non-zero", )); @@ -1941,7 +1941,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "Transfer range proof offset must be non-zero", )); @@ -2001,7 +2001,7 @@ fn build_single( ]; for (proof, kind) in proofs.iter().zip(expected.iter()) { if proof.kind != *kind { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_kind_invalid", "TransferWithFee requires Equality, 3-handles validity, PercentageWithFee, 2-handles validity, then U256 range proof references", )); @@ -2009,7 +2009,7 @@ fn build_single( match proof.location.validate() { Ok(()) => {}, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_location_invalid", error, )); @@ -2022,7 +2022,7 @@ fn build_single( let new_balance = match new_source_decryptable_available_balance.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_decryptable_balance_invalid", error, )); @@ -2031,7 +2031,7 @@ fn build_single( let auditor_ciphertext_lo = match transfer_amount_auditor_ciphertext_lo.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_ciphertext_invalid", error, )); @@ -2040,7 +2040,7 @@ fn build_single( let auditor_ciphertext_hi = match transfer_amount_auditor_ciphertext_hi.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_ciphertext_invalid", error, )); @@ -2064,7 +2064,7 @@ fn build_single( crate::ExSplTokenConfidentialProofLocation::InstructionOffset { offset } => { let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, - None => return Err(kb_core::Error::new("execution_spl_token_2022_confidential_proof_offset_invalid", concat!($field, " offset must be non-zero"))), + None => return Err(ks_core::Error::new("execution_spl_token_2022_confidential_proof_offset_invalid", concat!($field, " offset must be non-zero"))), }; spl_token_confidential_transfer_proof_extraction::instruction::ProofLocation::InstructionOffset(offset, $data) }, @@ -2119,7 +2119,7 @@ fn build_single( let withdraw_key = match withdraw_withheld_authority_elgamal_pubkey.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_invalid_elgamal_pubkey", error, )); @@ -2192,7 +2192,7 @@ fn build_single( proof, } => { if proof.kind != crate::ExSplTokenConfidentialProofKind::CiphertextCiphertextEquality { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_kind_invalid", "confidential fee withdraw from mint requires exactly one CiphertextCiphertextEquality proof reference", )); @@ -2200,7 +2200,7 @@ fn build_single( match proof.location.validate() { Ok(()) => {}, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_location_invalid", error, )); @@ -2211,7 +2211,7 @@ fn build_single( let new_balance = match new_decryptable_available_balance.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_invalid_decryptable_balance", error, )); @@ -2226,7 +2226,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "confidential fee withdraw from mint inline proof offset must be non-zero", )); @@ -2260,7 +2260,7 @@ fn build_single( proof, } => { if proof.kind != crate::ExSplTokenConfidentialProofKind::CiphertextCiphertextEquality { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_kind_invalid", "confidential fee withdraw from accounts requires exactly one CiphertextCiphertextEquality proof reference", )); @@ -2268,7 +2268,7 @@ fn build_single( match proof.location.validate() { Ok(()) => {}, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_location_invalid", error, )); @@ -2284,7 +2284,7 @@ fn build_single( let new_balance = match new_decryptable_available_balance.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_invalid_decryptable_balance", error, )); @@ -2299,7 +2299,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "confidential fee withdraw from accounts inline proof offset must be non-zero", )); @@ -2334,7 +2334,7 @@ fn build_single( let supply_key = match supply_elgamal_pubkey.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_invalid_elgamal_pubkey", error, )); @@ -2343,7 +2343,7 @@ fn build_single( let decryptable_supply = match decryptable_supply.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_invalid_decryptable_balance", error, )); @@ -2365,7 +2365,7 @@ fn build_single( proof, } => { if proof.kind != crate::ExSplTokenConfidentialProofKind::CiphertextCiphertextEquality { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_kind_invalid", "confidential supply-key rotation requires exactly one CiphertextCiphertextEquality proof reference", )); @@ -2373,7 +2373,7 @@ fn build_single( match proof.location.validate() { Ok(()) => {}, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_location_invalid", error, )); @@ -2383,7 +2383,7 @@ fn build_single( let new_supply_key = match new_supply_elgamal_pubkey.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_invalid_elgamal_pubkey", error, )); @@ -2398,7 +2398,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "confidential supply-key rotation inline proof offset must be non-zero", )); @@ -2420,14 +2420,14 @@ fn build_single( proof_location, ) { Ok(value) => value, - Err(error) => return Err(kb_core::Error::new( + Err(error) => return Err(ks_core::Error::new( "execution_spl_token_2022_official_builder_failed", error.to_string(), )), }; match instructions.into_iter().next() { Some(value) => Ok(value), - None => Err(kb_core::Error::new( + None => Err(ks_core::Error::new( "execution_spl_token_2022_official_builder_empty", "official confidential supply-key rotation builder returned no instruction", )), @@ -2442,7 +2442,7 @@ fn build_single( let new_supply = match new_decryptable_supply.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_invalid_decryptable_balance", error, )); @@ -2488,7 +2488,7 @@ fn build_single( || ciphertext_validity_proof.kind != crate::ExSplTokenConfidentialProofKind::BatchedGroupedCiphertext3HandlesValidity || range_proof.kind != crate::ExSplTokenConfidentialProofKind::BatchedRangeProofU128 { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_kind_invalid", "Confidential Mint requires CiphertextCommitmentEquality, BatchedGroupedCiphertext3HandlesValidity, then BatchedRangeProofU128 proof references", )); @@ -2497,7 +2497,7 @@ fn build_single( match proof.location.validate() { Ok(()) => {}, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_location_invalid", error, )); @@ -2509,7 +2509,7 @@ fn build_single( let new_supply = match new_decryptable_supply.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_invalid_decryptable_balance", error, )); @@ -2518,7 +2518,7 @@ fn build_single( let auditor_ciphertext_lo = match mint_amount_auditor_ciphertext_lo.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_ciphertext_invalid", error, )); @@ -2527,7 +2527,7 @@ fn build_single( let auditor_ciphertext_hi = match mint_amount_auditor_ciphertext_hi.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_ciphertext_invalid", error, )); @@ -2546,7 +2546,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "Confidential Mint equality proof offset must be non-zero", )); @@ -2564,7 +2564,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "Confidential Mint ciphertext-validity proof offset must be non-zero", )); @@ -2583,7 +2583,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "Confidential Mint range proof offset must be non-zero", )); @@ -2627,7 +2627,7 @@ fn build_single( || ciphertext_validity_proof.kind != crate::ExSplTokenConfidentialProofKind::BatchedGroupedCiphertext3HandlesValidity || range_proof.kind != crate::ExSplTokenConfidentialProofKind::BatchedRangeProofU128 { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_kind_invalid", "Confidential Burn requires CiphertextCommitmentEquality, BatchedGroupedCiphertext3HandlesValidity, then BatchedRangeProofU128 proof references", )); @@ -2636,7 +2636,7 @@ fn build_single( match proof.location.validate() { Ok(()) => {}, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_location_invalid", error, )); @@ -2648,7 +2648,7 @@ fn build_single( let new_balance = match new_decryptable_available_balance.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_invalid_decryptable_balance", error, )); @@ -2657,7 +2657,7 @@ fn build_single( let auditor_ciphertext_lo = match burn_amount_auditor_ciphertext_lo.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_ciphertext_invalid", error, )); @@ -2666,7 +2666,7 @@ fn build_single( let auditor_ciphertext_hi = match burn_amount_auditor_ciphertext_hi.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_ciphertext_invalid", error, )); @@ -2685,7 +2685,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "Confidential Burn equality proof offset must be non-zero", )); @@ -2703,7 +2703,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "Confidential Burn ciphertext-validity proof offset must be non-zero", )); @@ -2722,7 +2722,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "Confidential Burn range proof offset must be non-zero", )); @@ -2767,7 +2767,7 @@ fn build_single( || ciphertext_validity_proof.kind != crate::ExSplTokenConfidentialProofKind::BatchedGroupedCiphertext3HandlesValidity || range_proof.kind != crate::ExSplTokenConfidentialProofKind::BatchedRangeProofU128 { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_kind_invalid", "Permissioned Confidential Burn requires CiphertextCommitmentEquality, BatchedGroupedCiphertext3HandlesValidity, then BatchedRangeProofU128 proof references", )); @@ -2776,7 +2776,7 @@ fn build_single( match proof.location.validate() { Ok(()) => {}, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_location_invalid", error, )); @@ -2790,7 +2790,7 @@ fn build_single( let new_balance = match new_decryptable_available_balance.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_invalid_decryptable_balance", error, )); @@ -2799,7 +2799,7 @@ fn build_single( let auditor_ciphertext_lo = match burn_amount_auditor_ciphertext_lo.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_ciphertext_invalid", error, )); @@ -2808,7 +2808,7 @@ fn build_single( let auditor_ciphertext_hi = match burn_amount_auditor_ciphertext_hi.parse() { Ok(value) => value, Err(error) => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_ciphertext_invalid", error, )); @@ -2827,7 +2827,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "Permissioned Confidential Burn equality proof offset must be non-zero", )); @@ -2845,7 +2845,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "Permissioned Confidential Burn validity proof offset must be non-zero", )); @@ -2864,7 +2864,7 @@ fn build_single( let offset = match std::num::NonZeroI8::new(*offset) { Some(value) => value, None => { - return Err(kb_core::Error::new( + return Err(ks_core::Error::new( "execution_spl_token_2022_confidential_proof_offset_invalid", "Permissioned Confidential Burn range proof offset must be non-zero", )); @@ -2892,14 +2892,14 @@ fn build_single( range_location, ) { Ok(value) => value, - Err(error) => return Err(kb_core::Error::new( + Err(error) => return Err(ks_core::Error::new( "execution_spl_token_2022_official_builder_failed", error.to_string(), )), }; match instructions.into_iter().next() { Some(value) => Ok(value), - None => Err(kb_core::Error::new( + None => Err(ks_core::Error::new( "execution_spl_token_2022_official_builder_empty", "official permissioned confidential burn builder returned no instruction", )), @@ -2936,8 +2936,8 @@ fn build_single( fn build_batch( _program_id: &solana_pubkey::Pubkey, _instructions: &[crate::ExSplTokenSingleOperation], -) -> kb_core::Result { - return std::result::Result::Err(kb_core::Error::new( +) -> ks_core::Result { + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_batch_builder_unavailable", "Token-2022 Batch is decode-only because spl-token-2022-interface 3.1.1 publishes no official Batch builder", )); @@ -2945,54 +2945,54 @@ fn build_batch( fn official_instruction( result: std::result::Result, -) -> kb_core::Result +) -> ks_core::Result where BuilderError: std::fmt::Display, { return match result { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_official_builder_failed", error.to_string(), )), }; } -fn parse_pubkey(pubkey: &crate::MdPubkey, field: &str) -> kb_core::Result { +fn parse_pubkey(pubkey: &crate::MdPubkey, field: &str) -> ks_core::Result { if pubkey.0.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_pubkey_empty", format!("SPL Token {field} public key must not be empty"), )); } return match solana_pubkey::Pubkey::from_str(pubkey.0.as_str()) { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_pubkey_invalid", format!("invalid SPL Token {field} public key: {error}"), )), }; } -fn parse_amount(amount: &crate::ExSplTokenAmount, field: &str) -> kb_core::Result { +fn parse_amount(amount: &crate::ExSplTokenAmount, field: &str) -> ks_core::Result { if amount.0.is_empty() || !amount.0.bytes().all(|value| return value.is_ascii_digit()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_amount_invalid", format!("SPL Token {field} must be an unsigned decimal u64 string"), )); } return match amount.0.parse::() { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_amount_invalid", format!("invalid SPL Token {field}: {error}"), )), }; } -fn parse_authority(authority: &crate::ExSplTokenAuthority) -> kb_core::Result { +fn parse_authority(authority: &crate::ExSplTokenAuthority) -> ks_core::Result { if authority.multisig_signers.len() > crate::EX_SPL_TOKEN_2022_MAX_MULTISIG_SIGNERS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_multisig_signer_limit_exceeded", format!( "SPL Token multisig signer occurrence count {} exceeds {}", @@ -3018,15 +3018,15 @@ fn parse_authority(authority: &crate::ExSplTokenAuthority) -> kb_core::Result kb_core::Result> { +) -> ks_core::Result> { if sources.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_transfer_fee_sources_empty", "transfer-fee source account list must not be empty", )); } if sources.len() > crate::EX_SPL_TOKEN_2022_MAX_TRANSFER_FEE_SOURCE_ACCOUNTS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_transfer_fee_source_limit_exceeded", format!( "transfer-fee source account count {} exceeds {}", @@ -3043,7 +3043,7 @@ fn parse_transfer_fee_sources( std::result::Result::Err(error) => return std::result::Result::Err(error), }; if !unique.insert(source) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_transfer_fee_source_duplicate", "transfer-fee source accounts must be unique", )); @@ -3053,7 +3053,7 @@ fn parse_transfer_fee_sources( return std::result::Result::Ok(parsed); } -fn declared_spend_lamports(operation: &crate::ExSplToken2022Operation) -> kb_core::Result { +fn declared_spend_lamports(operation: &crate::ExSplToken2022Operation) -> ks_core::Result { return match operation { crate::ExSplToken2022Operation::Instruction { value } => single_spend_lamports(value), crate::ExSplToken2022Operation::Batch { instructions } => { @@ -3066,7 +3066,7 @@ fn declared_spend_lamports(operation: &crate::ExSplToken2022Operation) -> kb_cor total = match total.checked_add(amount) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_lamport_spend_overflow", "SPL Token Batch declared lamport spend exceeds u64", )); @@ -3078,7 +3078,7 @@ fn declared_spend_lamports(operation: &crate::ExSplToken2022Operation) -> kb_cor }; } -fn single_spend_lamports(operation: &crate::ExSplTokenSingleOperation) -> kb_core::Result { +fn single_spend_lamports(operation: &crate::ExSplTokenSingleOperation) -> ks_core::Result { return match operation { crate::ExSplTokenSingleOperation::UnwrapLamports { amount_lamports: std::option::Option::Some(value), @@ -3183,12 +3183,12 @@ pub(crate) mod tests { pub(crate) fn intent( operation: crate::ExSplToken2022Operation, ) -> crate::ExSplToken2022ExecutionIntent { - let fee_payer = kb_program_ids::SYSTEM_PROGRAM_ID; + let fee_payer = ks_program_ids::SYSTEM_PROGRAM_ID; return crate::ExSplToken2022ExecutionIntent { intent_id: std::string::String::from("token-intent-1"), fee_payer: pubkey(fee_payer), policy: policy( - &[fee_payer, kb_program_ids::VOTE_PROGRAM_ID, kb_program_ids::STAKE_PROGRAM_ID], + &[fee_payer, ks_program_ids::VOTE_PROGRAM_ID, ks_program_ids::STAKE_PROGRAM_ID], operation.requires_materialization(), ), operation, @@ -3197,7 +3197,7 @@ pub(crate) mod tests { fn authority(signers: &[&str]) -> crate::ExSplTokenAuthority { return crate::ExSplTokenAuthority { - authority: pubkey(kb_program_ids::CONFIG_PROGRAM_ID), + authority: pubkey(ks_program_ids::CONFIG_PROGRAM_ID), multisig_signers: signers.iter().map(|value| return pubkey(value)).collect(), }; } @@ -3222,19 +3222,19 @@ pub(crate) mod tests { fn transfer_checked() -> crate::ExSplTokenSingleOperation { return crate::ExSplTokenSingleOperation::TransferChecked { - source: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), - mint: pubkey(kb_program_ids::CONFIG_PROGRAM_ID), - destination: pubkey(kb_program_ids::STAKE_PROGRAM_ID), - authority: authority(&[kb_program_ids::VOTE_PROGRAM_ID]), + source: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), + mint: pubkey(ks_program_ids::CONFIG_PROGRAM_ID), + destination: pubkey(ks_program_ids::STAKE_PROGRAM_ID), + authority: authority(&[ks_program_ids::VOTE_PROGRAM_ID]), amount: crate::ExSplTokenAmount(std::string::String::from("18446744073709551615")), decimals: 9, }; } fn all_single_operations() -> std::vec::Vec<(u8, crate::ExSplTokenSingleOperation)> { - let first = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); - let second = pubkey(kb_program_ids::CONFIG_PROGRAM_ID); - let third = pubkey(kb_program_ids::STAKE_PROGRAM_ID); + let first = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); + let second = pubkey(ks_program_ids::CONFIG_PROGRAM_ID); + let third = pubkey(ks_program_ids::STAKE_PROGRAM_ID); let sauthority = authority(&[]); let amount = crate::ExSplTokenAmount(std::string::String::from("42")); return vec![ @@ -3934,37 +3934,37 @@ pub(crate) mod tests { ( 37, crate::ExSplTokenSingleOperation::InitializeConfidentialTransferFeeConfig { - mint: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), - authority: Some(pubkey(kb_program_ids::CONFIG_PROGRAM_ID)), + mint: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), + authority: Some(pubkey(ks_program_ids::CONFIG_PROGRAM_ID)), withdraw_withheld_authority_elgamal_pubkey: crate::ExSplTokenElGamalPubkey("11".repeat(32)), }, ), ( 37, crate::ExSplTokenSingleOperation::EnableConfidentialTransferFeeHarvest { - mint: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), + mint: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), authority: authority(&[]), }, ), ( 37, crate::ExSplTokenSingleOperation::DisableConfidentialTransferFeeHarvest { - mint: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), + mint: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), authority: authority(&[]), }, ), ( 37, crate::ExSplTokenSingleOperation::HarvestConfidentialWithheldTokensToMint { - mint: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), - sources: vec![pubkey(kb_program_ids::CONFIG_PROGRAM_ID)], + mint: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), + sources: vec![pubkey(ks_program_ids::CONFIG_PROGRAM_ID)], }, ), ( 37, crate::ExSplTokenSingleOperation::WithdrawConfidentialWithheldTokensFromMint { - mint: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), - destination: pubkey(kb_program_ids::CONFIG_PROGRAM_ID), + mint: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), + destination: pubkey(ks_program_ids::CONFIG_PROGRAM_ID), new_decryptable_available_balance: crate::ExSplTokenDecryptableBalance("22".repeat(36)), authority: authority(&[]), proof: crate::ExSplTokenConfidentialProofReference { @@ -3976,11 +3976,11 @@ pub(crate) mod tests { ( 37, crate::ExSplTokenSingleOperation::WithdrawConfidentialWithheldTokensFromAccounts { - mint: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), - destination: pubkey(kb_program_ids::CONFIG_PROGRAM_ID), + mint: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), + destination: pubkey(ks_program_ids::CONFIG_PROGRAM_ID), new_decryptable_available_balance: crate::ExSplTokenDecryptableBalance("33".repeat(36)), authority: authority(&[]), - sources: vec![pubkey(kb_program_ids::STAKE_PROGRAM_ID)], + sources: vec![pubkey(ks_program_ids::STAKE_PROGRAM_ID)], proof: crate::ExSplTokenConfidentialProofReference { kind: crate::ExSplTokenConfidentialProofKind::CiphertextCiphertextEquality, location: crate::ExSplTokenConfidentialProofLocation::InstructionOffset { offset: -1 }, @@ -4108,10 +4108,10 @@ pub(crate) mod tests { #[test] fn empty_confidential_account_preserves_zero_ciphertext_proof_modes_and_authority_metas() { - let account = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); - let authority_key = pubkey(kb_program_ids::CONFIG_PROGRAM_ID); - let signer = pubkey(kb_program_ids::STAKE_PROGRAM_ID); - let context = pubkey(kb_program_ids::VOTE_PROGRAM_ID); + let account = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); + let authority_key = pubkey(ks_program_ids::CONFIG_PROGRAM_ID); + let signer = pubkey(ks_program_ids::STAKE_PROGRAM_ID); + let context = pubkey(ks_program_ids::VOTE_PROGRAM_ID); for proof in [ crate::ExSplTokenConfidentialProofReference { kind: crate::ExSplTokenConfidentialProofKind::ZeroCiphertext, @@ -4177,11 +4177,11 @@ pub(crate) mod tests { #[test] fn withdraw_confidential_tokens_preserves_two_proof_modes_wire_and_authority_metas() { - let account = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); - let mint = pubkey(kb_program_ids::CONFIG_PROGRAM_ID); - let sauthority = pubkey(kb_program_ids::STAKE_PROGRAM_ID); - let signer = pubkey(kb_program_ids::VOTE_PROGRAM_ID); - let context = pubkey(kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID); + let account = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); + let mint = pubkey(ks_program_ids::CONFIG_PROGRAM_ID); + let sauthority = pubkey(ks_program_ids::STAKE_PROGRAM_ID); + let signer = pubkey(ks_program_ids::VOTE_PROGRAM_ID); + let context = pubkey(ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID); let operation = crate::ExSplTokenSingleOperation::WithdrawConfidentialTokens { account: account.clone(), mint: mint.clone(), @@ -4228,13 +4228,13 @@ pub(crate) mod tests { #[test] fn transfer_confidential_tokens_preserves_three_proof_modes_ciphertexts_and_authority_metas() { - let source = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); - let mint = pubkey(kb_program_ids::CONFIG_PROGRAM_ID); - let destination = pubkey(kb_program_ids::STAKE_PROGRAM_ID); - let sauthority = pubkey(kb_program_ids::VOTE_PROGRAM_ID); - let signer = pubkey(kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID); - let equality_context = pubkey(kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID); - let range_context = pubkey(kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID); + let source = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); + let mint = pubkey(ks_program_ids::CONFIG_PROGRAM_ID); + let destination = pubkey(ks_program_ids::STAKE_PROGRAM_ID); + let sauthority = pubkey(ks_program_ids::VOTE_PROGRAM_ID); + let signer = pubkey(ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID); + let equality_context = pubkey(ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID); + let range_context = pubkey(ks_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID); let operation = crate::ExSplTokenSingleOperation::TransferConfidentialTokens { source: source.clone(), mint: mint.clone(), @@ -4335,10 +4335,10 @@ pub(crate) mod tests { #[test] fn confidential_transfer_fee_public_builders_preserve_wire_accounts_and_authorities() { - let mint = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); - let authority_key = pubkey(kb_program_ids::CONFIG_PROGRAM_ID); - let signer = pubkey(kb_program_ids::STAKE_PROGRAM_ID); - let source = pubkey(kb_program_ids::VOTE_PROGRAM_ID); + let mint = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); + let authority_key = pubkey(ks_program_ids::CONFIG_PROGRAM_ID); + let signer = pubkey(ks_program_ids::STAKE_PROGRAM_ID); + let source = pubkey(ks_program_ids::VOTE_PROGRAM_ID); let initialize = planned_single_instruction( crate::ExSplTokenSingleOperation::InitializeConfidentialTransferFeeConfig { mint: mint.clone(), @@ -4386,11 +4386,11 @@ pub(crate) mod tests { #[test] fn confidential_fee_withdraw_from_mint_preserves_equality_proof_modes_and_authority_metas() { - let mint = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); - let destination = pubkey(kb_program_ids::CONFIG_PROGRAM_ID); - let sauthority = pubkey(kb_program_ids::STAKE_PROGRAM_ID); - let signer = pubkey(kb_program_ids::VOTE_PROGRAM_ID); - let context = pubkey(kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID); + let mint = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); + let destination = pubkey(ks_program_ids::CONFIG_PROGRAM_ID); + let sauthority = pubkey(ks_program_ids::STAKE_PROGRAM_ID); + let signer = pubkey(ks_program_ids::VOTE_PROGRAM_ID); + let context = pubkey(ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID); for proof in [ crate::ExSplTokenConfidentialProofReference { kind: crate::ExSplTokenConfidentialProofKind::CiphertextCiphertextEquality, @@ -4459,12 +4459,12 @@ pub(crate) mod tests { #[test] fn confidential_fee_withdraw_from_accounts_preserves_sources_proof_and_multisig_order() { - let mint = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); - let destination = pubkey(kb_program_ids::CONFIG_PROGRAM_ID); - let sauthority = pubkey(kb_program_ids::STAKE_PROGRAM_ID); - let signer = pubkey(kb_program_ids::VOTE_PROGRAM_ID); - let first_source = pubkey(kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID); - let second_source = pubkey(kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID); + let mint = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); + let destination = pubkey(ks_program_ids::CONFIG_PROGRAM_ID); + let sauthority = pubkey(ks_program_ids::STAKE_PROGRAM_ID); + let signer = pubkey(ks_program_ids::VOTE_PROGRAM_ID); + let first_source = pubkey(ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID); + let second_source = pubkey(ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID); let instruction = planned_single_instruction( crate::ExSplTokenSingleOperation::WithdrawConfidentialWithheldTokensFromAccounts { mint: mint.clone(), @@ -4569,11 +4569,11 @@ pub(crate) mod tests { #[test] fn multisig_meta_order_is_preserved_while_transaction_signers_are_unique() { - let first = kb_program_ids::VOTE_PROGRAM_ID; - let second = kb_program_ids::STAKE_PROGRAM_ID; + let first = ks_program_ids::VOTE_PROGRAM_ID; + let second = ks_program_ids::STAKE_PROGRAM_ID; let operation = crate::ExSplTokenSingleOperation::Transfer { - source: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), - destination: pubkey(kb_program_ids::CONFIG_PROGRAM_ID), + source: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), + destination: pubkey(ks_program_ids::CONFIG_PROGRAM_ID), authority: authority(&[first, second, first]), amount: crate::ExSplTokenAmount(std::string::String::from("1")), }; @@ -4594,9 +4594,9 @@ pub(crate) mod tests { #[test] fn default_state_memo_and_cpi_guard_builders_preserve_exact_wire_and_authority_metas() { - let first = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); + let first = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); let sauthority = - authority(&[kb_program_ids::VOTE_PROGRAM_ID, kb_program_ids::STAKE_PROGRAM_ID]); + authority(&[ks_program_ids::VOTE_PROGRAM_ID, ks_program_ids::STAKE_PROGRAM_ID]); let cases = [ ( crate::ExSplTokenSingleOperation::InitializeDefaultAccountState { @@ -4672,10 +4672,10 @@ pub(crate) mod tests { #[test] fn hook_and_pointer_builders_preserve_exact_wire_optional_values_and_authority_metas() { - let mint = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); - let target = pubkey(kb_program_ids::CONFIG_PROGRAM_ID); + let mint = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); + let target = pubkey(ks_program_ids::CONFIG_PROGRAM_ID); let sauthority = - authority(&[kb_program_ids::VOTE_PROGRAM_ID, kb_program_ids::STAKE_PROGRAM_ID]); + authority(&[ks_program_ids::VOTE_PROGRAM_ID, ks_program_ids::STAKE_PROGRAM_ID]); let cases = [ ( crate::ExSplTokenSingleOperation::InitializeTransferHook { @@ -4776,9 +4776,9 @@ pub(crate) mod tests { #[test] fn metadata_and_group_interface_builders_preserve_discriminated_wire_and_accounts() { - let first = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); - let second = pubkey(kb_program_ids::CONFIG_PROGRAM_ID); - let third = pubkey(kb_program_ids::STAKE_PROGRAM_ID); + let first = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); + let second = pubkey(ks_program_ids::CONFIG_PROGRAM_ID); + let third = pubkey(ks_program_ids::STAKE_PROGRAM_ID); let cases = [ ( crate::ExSplTokenSingleOperation::InitializeTokenMetadata { @@ -4884,8 +4884,8 @@ pub(crate) mod tests { fn metadata_update_authority_accepts_nullable_none() { let planned = planned_single_instruction( crate::ExSplTokenSingleOperation::UpdateTokenMetadataAuthority { - metadata: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), - current_authority: pubkey(kb_program_ids::CONFIG_PROGRAM_ID), + metadata: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), + current_authority: pubkey(ks_program_ids::CONFIG_PROGRAM_ID), new_authority: std::option::Option::None, }, ); @@ -4903,7 +4903,7 @@ pub(crate) mod tests { ] { let planned = planned_single_instruction(crate::ExSplTokenSingleOperation::EmitTokenMetadata { - metadata: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), + metadata: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), start, end, }); @@ -4915,7 +4915,7 @@ pub(crate) mod tests { #[test] fn metadata_emit_rejects_reversed_oversized_and_open_ended_ranges() { - let metadata = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); + let metadata = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); for (start, end) in [ (std::option::Option::Some(9), std::option::Option::Some(8)), (std::option::Option::Some(0), std::option::Option::Some(1_025)), @@ -4939,8 +4939,8 @@ pub(crate) mod tests { #[test] fn recent_unwrap_is_constructible_and_batch_is_explicitly_decode_only() { let unwrap = crate::ExSplTokenSingleOperation::UnwrapLamports { - account: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), - destination: pubkey(kb_program_ids::STAKE_PROGRAM_ID), + account: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), + destination: pubkey(ks_program_ids::STAKE_PROGRAM_ID), authority: authority(&[]), amount_lamports: std::option::Option::Some(crate::ExSplTokenAmount( std::string::String::from("42"), @@ -5039,16 +5039,16 @@ pub(crate) mod tests { #[test] fn transfer_fee_builders_preserve_exact_wire_accounts_and_bounds() { - let source = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); - let mint = pubkey(kb_program_ids::CONFIG_PROGRAM_ID); - let destination = pubkey(kb_program_ids::STAKE_PROGRAM_ID); - let signer = pubkey(kb_program_ids::VOTE_PROGRAM_ID); + let source = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); + let mint = pubkey(ks_program_ids::CONFIG_PROGRAM_ID); + let destination = pubkey(ks_program_ids::STAKE_PROGRAM_ID); + let signer = pubkey(ks_program_ids::VOTE_PROGRAM_ID); let operation = crate::ExSplTokenSingleOperation::TransferCheckedWithFee { source: source.clone(), mint: mint.clone(), destination: destination.clone(), authority: crate::ExSplTokenAuthority { - authority: pubkey(kb_program_ids::FEATURE_PROGRAM_ID), + authority: pubkey(ks_program_ids::FEATURE_PROGRAM_ID), multisig_signers: vec![signer.clone()], }, amount: crate::ExSplTokenAmount(std::string::String::from("42")), @@ -5081,7 +5081,7 @@ pub(crate) mod tests { assert!(instruction.accounts[4].is_signer); let invalid = crate::ExSplTokenSingleOperation::InitializeTransferFeeConfig { - mint: pubkey(kb_program_ids::SYSTEM_PROGRAM_ID), + mint: pubkey(ks_program_ids::SYSTEM_PROGRAM_ID), transfer_fee_config_authority: std::option::Option::None, withdraw_withheld_authority: std::option::Option::None, transfer_fee_basis_points: 10_001, diff --git a/kb-lib/src/executor/spl/token_2022/confidential.rs b/ks-lib/src/executor/spl/token_2022/confidential.rs similarity index 97% rename from kb-lib/src/executor/spl/token_2022/confidential.rs rename to ks-lib/src/executor/spl/token_2022/confidential.rs index 2927a54..dfcfb35 100644 --- a/kb-lib/src/executor/spl/token_2022/confidential.rs +++ b/ks-lib/src/executor/spl/token_2022/confidential.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/token_2022/confidential.rs -// version: 9 +// file: ks-lib/src/executor/spl/token_2022/confidential.rs +// version: 10 //! Audited Confidential Transfer execution contracts. @@ -30,7 +30,7 @@ pub const EX_SPL_TOKEN_2022_CONFIDENTIAL_TRANSFER_WITH_FEE_INSTRUCTION_DATA_BYTE #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/confidential/ExSplTokenElGamalPubkey.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/confidential/ExSplTokenElGamalPubkey.ts" )] pub struct ExSplTokenElGamalPubkey(pub std::string::String); @@ -59,7 +59,7 @@ impl ExSplTokenElGamalPubkey { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/confidential/ExSplTokenDecryptableBalance.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/confidential/ExSplTokenDecryptableBalance.ts" )] pub struct ExSplTokenDecryptableBalance(pub std::string::String); @@ -89,7 +89,7 @@ impl ExSplTokenDecryptableBalance { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/confidential/ExSplTokenElGamalCiphertext.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/confidential/ExSplTokenElGamalCiphertext.ts" )] pub struct ExSplTokenElGamalCiphertext(pub std::string::String); @@ -157,7 +157,7 @@ fn decode_hex_nibble(value: u8) -> Option { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/confidential/ExSplTokenConfidentialProofKind.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/confidential/ExSplTokenConfidentialProofKind.ts" )] pub enum ExSplTokenConfidentialProofKind { /// ElGamal public-key validity. @@ -187,7 +187,7 @@ pub enum ExSplTokenConfidentialProofKind { #[serde(rename_all = "snake_case", tag = "mode")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/confidential/ExSplTokenConfidentialProofLocation.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/confidential/ExSplTokenConfidentialProofLocation.ts" )] pub enum ExSplTokenConfidentialProofLocation { /// Relative transaction offset of a separate ZK proof-program instruction. @@ -220,7 +220,7 @@ impl ExSplTokenConfidentialProofLocation { #[serde(rename_all = "camelCase")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/confidential/ExSplTokenConfidentialProofReference.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/confidential/ExSplTokenConfidentialProofReference.ts" )] pub struct ExSplTokenConfidentialProofReference { /// Exact proof statement required by the Token-2022 builder. @@ -234,7 +234,7 @@ pub struct ExSplTokenConfidentialProofReference { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/confidential/ExSplTokenConfidentialOperation.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/confidential/ExSplTokenConfidentialOperation.ts" )] pub enum ExSplTokenConfidentialOperation { /// Initialize confidential-transfer mint configuration. @@ -336,7 +336,7 @@ impl ExSplTokenConfidentialOperation { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/confidential/ExSplTokenConfidentialMintBurnOperation.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/confidential/ExSplTokenConfidentialMintBurnOperation.ts" )] pub enum ExSplTokenConfidentialMintBurnOperation { /// Initialize the mint extension with supply encryption material. @@ -399,7 +399,7 @@ impl ExSplTokenConfidentialMintBurnOperation { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/confidential/ExSplTokenConfidentialExecutorSupport.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/confidential/ExSplTokenConfidentialExecutorSupport.ts" )] pub enum ExSplTokenConfidentialExecutorSupport { /// The builder needs only public fields and ordinary authorities. diff --git a/kb-lib/src/executor/spl/token_2022/constants.rs b/ks-lib/src/executor/spl/token_2022/constants.rs similarity index 84% rename from kb-lib/src/executor/spl/token_2022/constants.rs rename to ks-lib/src/executor/spl/token_2022/constants.rs index 6e612e5..78a3905 100644 --- a/kb-lib/src/executor/spl/token_2022/constants.rs +++ b/ks-lib/src/executor/spl/token_2022/constants.rs @@ -1,7 +1,7 @@ -// file: kb-lib/src/executor/spl/token_2022/constants.rs -// version: 8 +// file: ks-lib/src/executor/spl/token_2022/constants.rs +// version: 9 -//! Local constants for the `kb-lib.executor.spl.token_2022` crate. Program identifiers live in `kb_program_ids`. +//! Local constants for the `kb-lib.executor.spl.token_2022` crate. Program identifiers live in `ks_program_ids`. /// Maximum number of ordered multisig signer occurrences. pub(crate) const EX_SPL_TOKEN_2022_MAX_MULTISIG_SIGNERS: usize = 11; diff --git a/kb-lib/src/executor/spl/token_2022/executor.rs b/ks-lib/src/executor/spl/token_2022/executor.rs similarity index 93% rename from kb-lib/src/executor/spl/token_2022/executor.rs rename to ks-lib/src/executor/spl/token_2022/executor.rs index 2421973..579fd25 100644 --- a/kb-lib/src/executor/spl/token_2022/executor.rs +++ b/ks-lib/src/executor/spl/token_2022/executor.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/token_2022/executor.rs -// version: 25 +// file: ks-lib/src/executor/spl/token_2022/executor.rs +// version: 26 //! Exact Token-2022 capability dispatch and typed plan construction. @@ -13,7 +13,7 @@ impl crate::ExSplToken2022Executor { program_id: &crate::MdProgramId, operation_code: &str, ) -> crate::ExApiExecutionCapability { - if program_id.0 != kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID { + if program_id.0 != ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID { return crate::ExApiExecutionCapability::unsupported( "execution_spl_token_2022_program_not_owned", format!("program {} is not owned by kb-lib.executor.spl.token_2022", program_id.0), @@ -63,16 +63,16 @@ impl crate::ExApiTypedInstructionExecutor for crate::ExSplToken2022Executor { fn build_prepared_plan( &self, intent: &Self::Intent, - ) -> kb_core::Result { + ) -> ks_core::Result { let program_id = crate::MdProgramId(std::string::String::from( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, )); return match self.exact_capability(&program_id, intent.operation.operation_code()) { crate::ExApiExecutionCapability::Supported { operation_code: _ } => { crate::executor_spl_token_2022_build_prepared_plan(intent) }, crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => { - std::result::Result::Err(kb_core::Error::new(reason_code, reason)) + std::result::Result::Err(ks_core::Error::new(reason_code, reason)) }, }; } @@ -88,7 +88,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplToken2022Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID]; + return &[ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID]; } fn supports_request( @@ -108,11 +108,11 @@ impl crate::ExApiInstructionExecutor for crate::ExSplToken2022Executor { fn build_plan( &self, request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { match self.exact_capability(&request.program_id, &request.operation_code) { crate::ExApiExecutionCapability::Supported { operation_code: _ } => {}, crate::ExApiExecutionCapability::Unsupported { reason_code, reason } => { - return std::result::Result::Err(kb_core::Error::new(reason_code, reason)); + return std::result::Result::Err(ks_core::Error::new(reason_code, reason)); }, } let intent = match serde_json::from_str::( @@ -120,14 +120,14 @@ impl crate::ExApiInstructionExecutor for crate::ExSplToken2022Executor { ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_intent_deserialize_failed", error.to_string(), )); }, }; if intent.operation.operation_code() != request.operation_code.as_str() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_operation_code_mismatch", format!( "request operation {} does not match typed intent operation {}", @@ -144,7 +144,7 @@ impl crate::ExApiInstructionExecutor for crate::ExSplToken2022Executor { let payload_value = match serde_json::to_value(&prepared) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_plan_serialize_failed", error.to_string(), )); @@ -176,7 +176,7 @@ mod tests { fn exact_capabilities_cover_current_and_recent_operations_only() { let executor = crate::ExSplToken2022Executor; for operation_code in crate::EX_SPL_TOKEN_2022_SUPPORTED_OPERATION_CODES { - let request = request(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, operation_code); + let request = request(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, operation_code); assert_eq!( crate::ExApiInstructionExecutor::supports_request(&executor, &request), crate::ExApiExecutionSupport::Yes @@ -190,7 +190,7 @@ mod tests { ] { let capability = crate::ExApiTypedInstructionExecutor::capability( &executor, - &crate::MdProgramId(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()), + &crate::MdProgramId(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()), operation_code, ); match capability { @@ -211,7 +211,7 @@ mod tests { fn program_dispatch_is_exact() { let executor = crate::ExSplToken2022Executor; let foreign = request( - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, crate::EX_SPL_TOKEN_2022_TRANSFER_CHECKED_OPERATION, ); assert_eq!( @@ -331,7 +331,7 @@ mod tests { assert!(matrix_names.contains("batch")); let batch = crate::ExApiTypedInstructionExecutor::capability( &crate::ExSplToken2022Executor, - &crate::MdProgramId(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()), + &crate::MdProgramId(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()), crate::EX_SPL_TOKEN_2022_BATCH_OPERATION, ); match batch { diff --git a/kb-lib/src/executor/spl/token_2022/intent.rs b/ks-lib/src/executor/spl/token_2022/intent.rs similarity index 99% rename from kb-lib/src/executor/spl/token_2022/intent.rs rename to ks-lib/src/executor/spl/token_2022/intent.rs index ffb4032..040fa70 100644 --- a/kb-lib/src/executor/spl/token_2022/intent.rs +++ b/ks-lib/src/executor/spl/token_2022/intent.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/spl/token_2022/intent.rs -// version: 27 +// file: ks-lib/src/executor/spl/token_2022/intent.rs +// version: 28 //! Typed Token-2022 execution intents. @@ -360,7 +360,7 @@ pub const EX_SPL_TOKEN_2022_SUPPORTED_OPERATION_CODES: &[&str] = &[ #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/intent/ExSplTokenAmount.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/intent/ExSplTokenAmount.ts" )] pub struct ExSplTokenAmount( /// Canonical unsigned decimal representation. @@ -371,7 +371,7 @@ pub struct ExSplTokenAmount( #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/intent/ExSplTokenMultiplier.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/intent/ExSplTokenMultiplier.ts" )] pub struct ExSplTokenMultiplier( /// Decimal representation parsed to the official `f64` wire contract. @@ -382,7 +382,7 @@ pub struct ExSplTokenMultiplier( #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/intent/ExSplTokenAuthority.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/intent/ExSplTokenAuthority.ts" )] pub struct ExSplTokenAuthority { /// Authority account. It signs only when `multisig_signers` is empty. @@ -396,7 +396,7 @@ pub struct ExSplTokenAuthority { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/intent/ExSplTokenAuthorityType.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/intent/ExSplTokenAuthorityType.ts" )] pub enum ExSplTokenAuthorityType { /// Mint authority. @@ -414,7 +414,7 @@ pub enum ExSplTokenAuthorityType { #[serde(rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/intent/ExSplTokenDefaultAccountState.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/intent/ExSplTokenDefaultAccountState.ts" )] pub enum ExSplTokenDefaultAccountState { /// Newly initialized accounts remain usable. @@ -428,7 +428,7 @@ pub enum ExSplTokenDefaultAccountState { #[serde(rename_all = "snake_case", tag = "kind", content = "key")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/intent/ExSplTokenMetadataField.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/intent/ExSplTokenMetadataField.ts" )] pub enum ExSplTokenMetadataField { /// Update the required name field. @@ -446,7 +446,7 @@ pub enum ExSplTokenMetadataField { #[serde(tag = "instruction", rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/intent/ExSplTokenSingleOperation.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/intent/ExSplTokenSingleOperation.ts" )] pub enum ExSplTokenSingleOperation { /// Initialize a mint with the current no-Rent builder. @@ -1609,7 +1609,7 @@ impl crate::ExSplTokenSingleOperation { #[serde(tag = "operation", rename_all = "snake_case")] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/intent/ExSplToken2022Operation.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/intent/ExSplToken2022Operation.ts" )] pub enum ExSplToken2022Operation { /// Build one non-batch instruction. @@ -1647,7 +1647,7 @@ impl crate::ExSplToken2022Operation { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/executor/spl/token_2022/intent/ExSplToken2022ExecutionIntent.ts" + export_to = "../frontend/ts/bindings/ks_lib/executor/spl/token_2022/intent/ExSplToken2022ExecutionIntent.ts" )] pub struct ExSplToken2022ExecutionIntent { /// Stable caller-provided identifier used for logs and replay correlation. diff --git a/kb-lib/src/executor/stable.rs b/ks-lib/src/executor/stable.rs similarity index 92% rename from kb-lib/src/executor/stable.rs rename to ks-lib/src/executor/stable.rs index a192c0e..4a2bb1a 100644 --- a/kb-lib/src/executor/stable.rs +++ b/ks-lib/src/executor/stable.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/stable.rs -// version: 2 +// file: ks-lib/src/executor/stable.rs +// version: 3 //! `stable` executor family. diff --git a/kb-lib/src/executor/stable/swap_hylo_exchange.rs b/ks-lib/src/executor/stable/swap_hylo_exchange.rs similarity index 89% rename from kb-lib/src/executor/stable/swap_hylo_exchange.rs rename to ks-lib/src/executor/stable/swap_hylo_exchange.rs index cc7e18b..dcfd01b 100644 --- a/kb-lib/src/executor/stable/swap_hylo_exchange.rs +++ b/ks-lib/src/executor/stable/swap_hylo_exchange.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/stable/swap_hylo_exchange.rs -// version: 3 +// file: ks-lib/src/executor/stable/swap_hylo_exchange.rs +// version: 4 //! Reserved executor for `stable_swap_hylo_exchange`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStableSwapHyloExchangeExecutor } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STABLE_SWAP_HYLO_EXCHANGE_PROGRAM_ID]; + return &[ks_program_ids::STABLE_SWAP_HYLO_EXCHANGE_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStableSwapHyloExchangeExecutor fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"stable_swap_hylo_exchange"}), ) { diff --git a/kb-lib/src/executor/stable/swap_jupiter_stable.rs b/ks-lib/src/executor/stable/swap_jupiter_stable.rs similarity index 89% rename from kb-lib/src/executor/stable/swap_jupiter_stable.rs rename to ks-lib/src/executor/stable/swap_jupiter_stable.rs index f0d0123..219159f 100644 --- a/kb-lib/src/executor/stable/swap_jupiter_stable.rs +++ b/ks-lib/src/executor/stable/swap_jupiter_stable.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/stable/swap_jupiter_stable.rs -// version: 3 +// file: ks-lib/src/executor/stable/swap_jupiter_stable.rs +// version: 4 //! Reserved executor for `stable_swap_jupiter_stable`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStableSwapJupiterStableExecuto } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STABLE_SWAP_JUPITER_STABLE_PROGRAM_ID]; + return &[ks_program_ids::STABLE_SWAP_JUPITER_STABLE_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStableSwapJupiterStableExecuto fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"stable_swap_jupiter_stable"}), ) { diff --git a/kb-lib/src/executor/stable/swap_numeraire.rs b/ks-lib/src/executor/stable/swap_numeraire.rs similarity index 89% rename from kb-lib/src/executor/stable/swap_numeraire.rs rename to ks-lib/src/executor/stable/swap_numeraire.rs index 295f5ea..1976d1e 100644 --- a/kb-lib/src/executor/stable/swap_numeraire.rs +++ b/ks-lib/src/executor/stable/swap_numeraire.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/stable/swap_numeraire.rs -// version: 3 +// file: ks-lib/src/executor/stable/swap_numeraire.rs +// version: 4 //! Reserved executor for `stable_swap_numeraire`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStableSwapNumeraireExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STABLE_SWAP_NUMERAIRE_PROGRAM_ID]; + return &[ks_program_ids::STABLE_SWAP_NUMERAIRE_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStableSwapNumeraireExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"stable_swap_numeraire"}), ) { diff --git a/kb-lib/src/executor/stable/swap_stabble.rs b/ks-lib/src/executor/stable/swap_stabble.rs similarity index 89% rename from kb-lib/src/executor/stable/swap_stabble.rs rename to ks-lib/src/executor/stable/swap_stabble.rs index 0d8bf33..5e2a88b 100644 --- a/kb-lib/src/executor/stable/swap_stabble.rs +++ b/ks-lib/src/executor/stable/swap_stabble.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/stable/swap_stabble.rs -// version: 3 +// file: ks-lib/src/executor/stable/swap_stabble.rs +// version: 4 //! Reserved executor for `stable_swap_stabble`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStableSwapStabbleExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STABLE_SWAP_STABBLE_PROGRAM_ID]; + return &[ks_program_ids::STABLE_SWAP_STABBLE_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStableSwapStabbleExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"stable_swap_stabble"}), ) { diff --git a/kb-lib/src/executor/staking.rs b/ks-lib/src/executor/staking.rs similarity index 91% rename from kb-lib/src/executor/staking.rs rename to ks-lib/src/executor/staking.rs index a7549a6..f885572 100644 --- a/kb-lib/src/executor/staking.rs +++ b/ks-lib/src/executor/staking.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/staking.rs -// version: 3 +// file: ks-lib/src/executor/staking.rs +// version: 4 //! `staking` executor family. diff --git a/kb-lib/src/executor/staking/jito_tip_distribution.rs b/ks-lib/src/executor/staking/jito_tip_distribution.rs similarity index 89% rename from kb-lib/src/executor/staking/jito_tip_distribution.rs rename to ks-lib/src/executor/staking/jito_tip_distribution.rs index b3cc31a..dbc5d1c 100644 --- a/kb-lib/src/executor/staking/jito_tip_distribution.rs +++ b/ks-lib/src/executor/staking/jito_tip_distribution.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/staking/jito_tip_distribution.rs -// version: 1 +// file: ks-lib/src/executor/staking/jito_tip_distribution.rs +// version: 2 //! Reserved executor for `staking_jito_tip_distribution`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStakingJitoTipDistributionExec } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STAKING_JITO_TIP_DISTRIBUTION_PROGRAM_ID]; + return &[ks_program_ids::STAKING_JITO_TIP_DISTRIBUTION_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStakingJitoTipDistributionExec fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"staking_jito_tip_distribution"}), ) { diff --git a/kb-lib/src/executor/staking/kamino_farm.rs b/ks-lib/src/executor/staking/kamino_farm.rs similarity index 89% rename from kb-lib/src/executor/staking/kamino_farm.rs rename to ks-lib/src/executor/staking/kamino_farm.rs index 9547ec6..da22040 100644 --- a/kb-lib/src/executor/staking/kamino_farm.rs +++ b/ks-lib/src/executor/staking/kamino_farm.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/staking/kamino_farm.rs -// version: 3 +// file: ks-lib/src/executor/staking/kamino_farm.rs +// version: 4 //! Reserved executor for `staking_kamino_farm`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStakingKaminoFarmExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STAKING_KAMINO_FARM_PROGRAM_ID]; + return &[ks_program_ids::STAKING_KAMINO_FARM_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStakingKaminoFarmExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"staking_kamino_farm"}), ) { diff --git a/kb-lib/src/executor/staking/marinade_finance.rs b/ks-lib/src/executor/staking/marinade_finance.rs similarity index 89% rename from kb-lib/src/executor/staking/marinade_finance.rs rename to ks-lib/src/executor/staking/marinade_finance.rs index d652616..751856d 100644 --- a/kb-lib/src/executor/staking/marinade_finance.rs +++ b/ks-lib/src/executor/staking/marinade_finance.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/staking/marinade_finance.rs -// version: 3 +// file: ks-lib/src/executor/staking/marinade_finance.rs +// version: 4 //! Reserved executor for `staking_marinade_finance`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStakingMarinadeFinanceExecutor } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STAKING_MARINADE_FINANCE_PROGRAM_ID]; + return &[ks_program_ids::STAKING_MARINADE_FINANCE_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStakingMarinadeFinanceExecutor fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"staking_marinade_finance"}), ) { diff --git a/kb-lib/src/executor/staking/solayer.rs b/ks-lib/src/executor/staking/solayer.rs similarity index 89% rename from kb-lib/src/executor/staking/solayer.rs rename to ks-lib/src/executor/staking/solayer.rs index 084d84b..74ec772 100644 --- a/kb-lib/src/executor/staking/solayer.rs +++ b/ks-lib/src/executor/staking/solayer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/staking/solayer.rs -// version: 3 +// file: ks-lib/src/executor/staking/solayer.rs +// version: 4 //! Reserved executor for `staking_solayer`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStakingSolayerExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STAKING_SOLAYER_PROGRAM_ID]; + return &[ks_program_ids::STAKING_SOLAYER_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStakingSolayerExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"staking_solayer"}), ) { diff --git a/kb-lib/src/executor/storage.rs b/ks-lib/src/executor/storage.rs similarity index 76% rename from kb-lib/src/executor/storage.rs rename to ks-lib/src/executor/storage.rs index 2157247..477a9b3 100644 --- a/kb-lib/src/executor/storage.rs +++ b/ks-lib/src/executor/storage.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/storage.rs -// version: 3 +// file: ks-lib/src/executor/storage.rs +// version: 4 //! `storage` executor family. diff --git a/kb-lib/src/executor/storage/solana_record.rs b/ks-lib/src/executor/storage/solana_record.rs similarity index 89% rename from kb-lib/src/executor/storage/solana_record.rs rename to ks-lib/src/executor/storage/solana_record.rs index 22d5b7d..59aa31c 100644 --- a/kb-lib/src/executor/storage/solana_record.rs +++ b/ks-lib/src/executor/storage/solana_record.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/storage/solana_record.rs -// version: 1 +// file: ks-lib/src/executor/storage/solana_record.rs +// version: 2 //! Reserved executor for `storage_solana_record`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStorageSolanaRecordExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STORAGE_SOLANA_RECORD_PROGRAM_ID]; + return &[ks_program_ids::STORAGE_SOLANA_RECORD_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStorageSolanaRecordExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"storage_solana_record"}), ) { diff --git a/kb-lib/src/executor/strategy.rs b/ks-lib/src/executor/strategy.rs similarity index 75% rename from kb-lib/src/executor/strategy.rs rename to ks-lib/src/executor/strategy.rs index f6427ec..cee9822 100644 --- a/kb-lib/src/executor/strategy.rs +++ b/ks-lib/src/executor/strategy.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/strategy.rs -// version: 3 +// file: ks-lib/src/executor/strategy.rs +// version: 4 //! `strategy` executor family. diff --git a/kb-lib/src/executor/strategy/jupiter_dca.rs b/ks-lib/src/executor/strategy/jupiter_dca.rs similarity index 89% rename from kb-lib/src/executor/strategy/jupiter_dca.rs rename to ks-lib/src/executor/strategy/jupiter_dca.rs index 6ca6e28..9c39bea 100644 --- a/kb-lib/src/executor/strategy/jupiter_dca.rs +++ b/ks-lib/src/executor/strategy/jupiter_dca.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/strategy/jupiter_dca.rs -// version: 3 +// file: ks-lib/src/executor/strategy/jupiter_dca.rs +// version: 4 //! Reserved executor for `strategy_jupiter_dca`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStrategyJupiterDcaExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::STRATEGY_JUPITER_DCA_PROGRAM_ID]; + return &[ks_program_ids::STRATEGY_JUPITER_DCA_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExStrategyJupiterDcaExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"strategy_jupiter_dca"}), ) { diff --git a/kb-lib/src/executor/treasury.rs b/ks-lib/src/executor/treasury.rs similarity index 80% rename from kb-lib/src/executor/treasury.rs rename to ks-lib/src/executor/treasury.rs index 083f517..17b5d94 100644 --- a/kb-lib/src/executor/treasury.rs +++ b/ks-lib/src/executor/treasury.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/treasury.rs -// version: 2 +// file: ks-lib/src/executor/treasury.rs +// version: 3 //! `treasury` executor family. diff --git a/kb-lib/src/executor/treasury/helium_treasury_management.rs b/ks-lib/src/executor/treasury/helium_treasury_management.rs similarity index 89% rename from kb-lib/src/executor/treasury/helium_treasury_management.rs rename to ks-lib/src/executor/treasury/helium_treasury_management.rs index 93f9659..f04549f 100644 --- a/kb-lib/src/executor/treasury/helium_treasury_management.rs +++ b/ks-lib/src/executor/treasury/helium_treasury_management.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/treasury/helium_treasury_management.rs -// version: 3 +// file: ks-lib/src/executor/treasury/helium_treasury_management.rs +// version: 4 //! Reserved executor for `treasury_helium_treasury_management`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExTreasuryHeliumTreasuryManageme } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::TREASURY_HELIUM_TREASURY_MANAGEMENT_PROGRAM_ID]; + return &[ks_program_ids::TREASURY_HELIUM_TREASURY_MANAGEMENT_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExTreasuryHeliumTreasuryManageme fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"treasury_helium_treasury_management"}), ) { diff --git a/kb-lib/src/executor/vault.rs b/ks-lib/src/executor/vault.rs similarity index 93% rename from kb-lib/src/executor/vault.rs rename to ks-lib/src/executor/vault.rs index 4bd0cec..7bf0435 100644 --- a/kb-lib/src/executor/vault.rs +++ b/ks-lib/src/executor/vault.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/vault.rs -// version: 2 +// file: ks-lib/src/executor/vault.rs +// version: 3 //! `vault` executor family. diff --git a/kb-lib/src/executor/vault/carrot_defi.rs b/ks-lib/src/executor/vault/carrot_defi.rs similarity index 89% rename from kb-lib/src/executor/vault/carrot_defi.rs rename to ks-lib/src/executor/vault/carrot_defi.rs index 61ae377..fdd16ee 100644 --- a/kb-lib/src/executor/vault/carrot_defi.rs +++ b/ks-lib/src/executor/vault/carrot_defi.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/vault/carrot_defi.rs -// version: 3 +// file: ks-lib/src/executor/vault/carrot_defi.rs +// version: 4 //! Reserved executor for `vault_carrot_defi`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExVaultCarrotDefiExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::VAULT_CARROT_DEFI_PROGRAM_ID]; + return &[ks_program_ids::VAULT_CARROT_DEFI_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExVaultCarrotDefiExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"vault_carrot_defi"}), ) { diff --git a/kb-lib/src/executor/vault/hylo_stability_pool.rs b/ks-lib/src/executor/vault/hylo_stability_pool.rs similarity index 89% rename from kb-lib/src/executor/vault/hylo_stability_pool.rs rename to ks-lib/src/executor/vault/hylo_stability_pool.rs index c7b7e91..7c68ae7 100644 --- a/kb-lib/src/executor/vault/hylo_stability_pool.rs +++ b/ks-lib/src/executor/vault/hylo_stability_pool.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/vault/hylo_stability_pool.rs -// version: 3 +// file: ks-lib/src/executor/vault/hylo_stability_pool.rs +// version: 4 //! Reserved executor for `vault_hylo_stability_pool`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExVaultHyloStabilityPoolExecutor } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::VAULT_HYLO_STABILITY_POOL_PROGRAM_ID]; + return &[ks_program_ids::VAULT_HYLO_STABILITY_POOL_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExVaultHyloStabilityPoolExecutor fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"vault_hylo_stability_pool"}), ) { diff --git a/kb-lib/src/executor/vault/kamino.rs b/ks-lib/src/executor/vault/kamino.rs similarity index 89% rename from kb-lib/src/executor/vault/kamino.rs rename to ks-lib/src/executor/vault/kamino.rs index ab6b55c..7956d56 100644 --- a/kb-lib/src/executor/vault/kamino.rs +++ b/ks-lib/src/executor/vault/kamino.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/vault/kamino.rs -// version: 3 +// file: ks-lib/src/executor/vault/kamino.rs +// version: 4 //! Reserved executor for `vault_kamino`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExVaultKaminoExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::VAULT_KAMINO_PROGRAM_ID]; + return &[ks_program_ids::VAULT_KAMINO_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExVaultKaminoExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"vault_kamino"}), ) { diff --git a/kb-lib/src/executor/vault/kamino_v2.rs b/ks-lib/src/executor/vault/kamino_v2.rs similarity index 89% rename from kb-lib/src/executor/vault/kamino_v2.rs rename to ks-lib/src/executor/vault/kamino_v2.rs index cb8eb46..d35a9a0 100644 --- a/kb-lib/src/executor/vault/kamino_v2.rs +++ b/ks-lib/src/executor/vault/kamino_v2.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/vault/kamino_v2.rs -// version: 3 +// file: ks-lib/src/executor/vault/kamino_v2.rs +// version: 4 //! Reserved executor for `vault_kamino_v2`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExVaultKaminoV2Executor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::VAULT_KAMINO_V2_PROGRAM_ID]; + return &[ks_program_ids::VAULT_KAMINO_V2_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExVaultKaminoV2Executor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"vault_kamino_v2"}), ) { diff --git a/kb-lib/src/executor/vault/kamino_yvaults.rs b/ks-lib/src/executor/vault/kamino_yvaults.rs similarity index 89% rename from kb-lib/src/executor/vault/kamino_yvaults.rs rename to ks-lib/src/executor/vault/kamino_yvaults.rs index ec252d0..ba638ef 100644 --- a/kb-lib/src/executor/vault/kamino_yvaults.rs +++ b/ks-lib/src/executor/vault/kamino_yvaults.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/vault/kamino_yvaults.rs -// version: 3 +// file: ks-lib/src/executor/vault/kamino_yvaults.rs +// version: 4 //! Reserved executor for `vault_kamino_yvaults`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExVaultKaminoYvaultsExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::VAULT_KAMINO_YVAULTS_PROGRAM_ID]; + return &[ks_program_ids::VAULT_KAMINO_YVAULTS_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExVaultKaminoYvaultsExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"vault_kamino_yvaults"}), ) { diff --git a/kb-lib/src/executor/vault/meteora.rs b/ks-lib/src/executor/vault/meteora.rs similarity index 89% rename from kb-lib/src/executor/vault/meteora.rs rename to ks-lib/src/executor/vault/meteora.rs index c8f6339..8d4c69b 100644 --- a/kb-lib/src/executor/vault/meteora.rs +++ b/ks-lib/src/executor/vault/meteora.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/vault/meteora.rs -// version: 3 +// file: ks-lib/src/executor/vault/meteora.rs +// version: 4 //! Reserved executor for `vault_meteora`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExVaultMeteoraExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::VAULT_METEORA_PROGRAM_ID]; + return &[ks_program_ids::VAULT_METEORA_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExVaultMeteoraExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"vault_meteora"}), ) { diff --git a/kb-lib/src/executor/vesting.rs b/ks-lib/src/executor/vesting.rs similarity index 84% rename from kb-lib/src/executor/vesting.rs rename to ks-lib/src/executor/vesting.rs index d3d2034..3557e00 100644 --- a/kb-lib/src/executor/vesting.rs +++ b/ks-lib/src/executor/vesting.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/vesting.rs -// version: 3 +// file: ks-lib/src/executor/vesting.rs +// version: 4 //! `vesting` executor family. diff --git a/kb-lib/src/executor/vesting/jupiter_lock.rs b/ks-lib/src/executor/vesting/jupiter_lock.rs similarity index 89% rename from kb-lib/src/executor/vesting/jupiter_lock.rs rename to ks-lib/src/executor/vesting/jupiter_lock.rs index b588608..f3d5ecb 100644 --- a/kb-lib/src/executor/vesting/jupiter_lock.rs +++ b/ks-lib/src/executor/vesting/jupiter_lock.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/vesting/jupiter_lock.rs -// version: 3 +// file: ks-lib/src/executor/vesting/jupiter_lock.rs +// version: 4 //! Reserved executor for `vesting_jupiter_lock`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExVestingJupiterLockExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::VESTING_JUPITER_LOCK_PROGRAM_ID]; + return &[ks_program_ids::VESTING_JUPITER_LOCK_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExVestingJupiterLockExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"vesting_jupiter_lock"}), ) { diff --git a/kb-lib/src/executor/vesting/streamflow.rs b/ks-lib/src/executor/vesting/streamflow.rs similarity index 89% rename from kb-lib/src/executor/vesting/streamflow.rs rename to ks-lib/src/executor/vesting/streamflow.rs index dbd339a..fc1aec9 100644 --- a/kb-lib/src/executor/vesting/streamflow.rs +++ b/ks-lib/src/executor/vesting/streamflow.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/vesting/streamflow.rs -// version: 3 +// file: ks-lib/src/executor/vesting/streamflow.rs +// version: 4 //! Reserved executor for `vesting_streamflow`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExVestingStreamflowExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::VESTING_STREAMFLOW_PROGRAM_ID]; + return &[ks_program_ids::VESTING_STREAMFLOW_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExVestingStreamflowExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"vesting_streamflow"}), ) { diff --git a/kb-lib/src/executor/wallet.rs b/ks-lib/src/executor/wallet.rs similarity index 80% rename from kb-lib/src/executor/wallet.rs rename to ks-lib/src/executor/wallet.rs index be412cc..ae8bb22 100644 --- a/kb-lib/src/executor/wallet.rs +++ b/ks-lib/src/executor/wallet.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/wallet.rs -// version: 2 +// file: ks-lib/src/executor/wallet.rs +// version: 3 //! `wallet` executor family. diff --git a/kb-lib/src/executor/wallet/jupiter_apepro_smart_wallet.rs b/ks-lib/src/executor/wallet/jupiter_apepro_smart_wallet.rs similarity index 89% rename from kb-lib/src/executor/wallet/jupiter_apepro_smart_wallet.rs rename to ks-lib/src/executor/wallet/jupiter_apepro_smart_wallet.rs index 073ba55..40ace3a 100644 --- a/kb-lib/src/executor/wallet/jupiter_apepro_smart_wallet.rs +++ b/ks-lib/src/executor/wallet/jupiter_apepro_smart_wallet.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/wallet/jupiter_apepro_smart_wallet.rs -// version: 3 +// file: ks-lib/src/executor/wallet/jupiter_apepro_smart_wallet.rs +// version: 4 //! Reserved executor for `wallet_jupiter_apepro_smart_wallet`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExWalletJupiterApeproSmartWallet } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::WALLET_JUPITER_APEPRO_SMART_WALLET_PROGRAM_ID]; + return &[ks_program_ids::WALLET_JUPITER_APEPRO_SMART_WALLET_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExWalletJupiterApeproSmartWallet fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"wallet_jupiter_apepro_smart_wallet"}), ) { diff --git a/kb-lib/src/executor/weighted.rs b/ks-lib/src/executor/weighted.rs similarity index 75% rename from kb-lib/src/executor/weighted.rs rename to ks-lib/src/executor/weighted.rs index 4d9eb36..dabf139 100644 --- a/kb-lib/src/executor/weighted.rs +++ b/ks-lib/src/executor/weighted.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/weighted.rs -// version: 2 +// file: ks-lib/src/executor/weighted.rs +// version: 3 //! `weighted` executor family. diff --git a/kb-lib/src/executor/weighted/swap_stabble.rs b/ks-lib/src/executor/weighted/swap_stabble.rs similarity index 89% rename from kb-lib/src/executor/weighted/swap_stabble.rs rename to ks-lib/src/executor/weighted/swap_stabble.rs index f7aa285..e9bc693 100644 --- a/kb-lib/src/executor/weighted/swap_stabble.rs +++ b/ks-lib/src/executor/weighted/swap_stabble.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/executor/weighted/swap_stabble.rs -// version: 3 +// file: ks-lib/src/executor/weighted/swap_stabble.rs +// version: 4 //! Reserved executor for `weighted_swap_stabble`. @@ -17,7 +17,7 @@ impl crate::ExApiInstructionExecutor for crate::ExWeightedSwapStabbleExecutor { } fn program_ids(&self) -> &'static [&'static str] { - return &[kb_program_ids::WEIGHTED_SWAP_STABBLE_PROGRAM_ID]; + return &[ks_program_ids::WEIGHTED_SWAP_STABBLE_PROGRAM_ID]; } fn supports_request( @@ -33,7 +33,7 @@ impl crate::ExApiInstructionExecutor for crate::ExWeightedSwapStabbleExecutor { fn build_plan( &self, _request: &crate::ExApiExecutionRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let payload_json = match crate::executor_api_serialize_payload_json( &serde_json::json!({"status":"reserved_executor","surface":"weighted_swap_stabble"}), ) { diff --git a/kb-lib/src/lib.rs b/ks-lib/src/lib.rs similarity index 99% rename from kb-lib/src/lib.rs rename to ks-lib/src/lib.rs index 68891c3..2564c21 100644 --- a/kb-lib/src/lib.rs +++ b/ks-lib/src/lib.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/lib.rs -// version: 38 +// file: ks-lib/src/lib.rs +// version: 39 //! Consolidated decoder, executor, materializer and shared model library. #![warn(missing_docs)] diff --git a/kb-lib/src/materializer.rs b/ks-lib/src/materializer.rs similarity index 99% rename from kb-lib/src/materializer.rs rename to ks-lib/src/materializer.rs index d4837cf..cac532b 100644 --- a/kb-lib/src/materializer.rs +++ b/ks-lib/src/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer.rs -// version: 15 +// file: ks-lib/src/materializer.rs +// version: 16 //! Consolidated materializer modules. diff --git a/kb-lib/src/materializer/admin.rs b/ks-lib/src/materializer/admin.rs similarity index 98% rename from kb-lib/src/materializer/admin.rs rename to ks-lib/src/materializer/admin.rs index 2f570c4..bec6c70 100644 --- a/kb-lib/src/materializer/admin.rs +++ b/ks-lib/src/materializer/admin.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/admin.rs -// version: 8 +// file: ks-lib/src/materializer/admin.rs +// version: 9 //! `admin` materializer family. diff --git a/kb-lib/src/materializer/admin/constants.rs b/ks-lib/src/materializer/admin/constants.rs similarity index 98% rename from kb-lib/src/materializer/admin/constants.rs rename to ks-lib/src/materializer/admin/constants.rs index 164184d..fd42b4c 100644 --- a/kb-lib/src/materializer/admin/constants.rs +++ b/ks-lib/src/materializer/admin/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/admin/constants.rs -// version: 5 +// file: ks-lib/src/materializer/admin/constants.rs +// version: 6 //! Local constants for the admin materializer. diff --git a/kb-lib/src/materializer/admin/materializer.rs b/ks-lib/src/materializer/admin/materializer.rs similarity index 97% rename from kb-lib/src/materializer/admin/materializer.rs rename to ks-lib/src/materializer/admin/materializer.rs index 1d59a5a..9ba6a89 100644 --- a/kb-lib/src/materializer/admin/materializer.rs +++ b/ks-lib/src/materializer/admin/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/admin/materializer.rs -// version: 22 +// file: ks-lib/src/materializer/admin/materializer.rs +// version: 23 //! Stable administrative projections derived from exact committed observations. @@ -73,7 +73,7 @@ impl crate::MtMaterializer for crate::MtAdminMaterializer { fn materialize_event( &self, event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { if !crate::MtMaterializer::accepts_event(self, event) { return std::result::Result::Ok(std::vec::Vec::new()); } @@ -263,13 +263,13 @@ fn projection(surface_code: &str, entry_code: &str) -> std::option::Option bool { if event.surface_code.0 == crate::MT_ADMIN_SPL_TOKEN_SURFACE { - return event.program_id.0 == kb_program_ids::SPL_TOKEN_PROGRAM_ID; + return event.program_id.0 == ks_program_ids::SPL_TOKEN_PROGRAM_ID; } if event.surface_code.0 == crate::MT_ADMIN_SPL_TOKEN_2022_SURFACE { - return event.program_id.0 == kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID; + return event.program_id.0 == ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID; } if event.surface_code.0 == crate::MT_ADMIN_SPL_ELGAMAL_REGISTRY_SURFACE { - return event.program_id.0 == kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID; + return event.program_id.0 == ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID; } return true; } @@ -623,7 +623,7 @@ mod tests { serde_json::json!({"authorityType":"mint_tokens","newAuthority":null}), ); authority.event.program_id = - crate::MdProgramId(kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()); + crate::MdProgramId(ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()); let authority_result = crate::MtApiEventMaterializer::materialize(&crate::MtAdminMaterializer, &authority); assert_eq!(authority_result.outputs[0].output_key, "spl_token_authority:set_authority:0"); @@ -644,7 +644,7 @@ mod tests { serde_json::json!({"m":2}), ); multisig.event.program_id = - crate::MdProgramId(kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()); + crate::MdProgramId(ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()); let multisig_result = crate::MtApiEventMaterializer::materialize(&crate::MtAdminMaterializer, &multisig); assert_eq!( @@ -672,14 +672,14 @@ mod tests { serde_json::json!({"authorityType":"mint_tokens","newAuthority":null}), ); observation.event.program_id = - crate::MdProgramId(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); + crate::MdProgramId(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); let result = crate::MtApiEventMaterializer::materialize(&crate::MtAdminMaterializer, &observation); assert_eq!(result.status, crate::MtApiMaterializerOutcomeStatus::Inserted); assert_eq!(result.outputs.len(), 1); assert_eq!( result.outputs[0].payload_json["programId"], - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID ); } @@ -708,7 +708,7 @@ mod tests { serde_json::json!({}), ); observation.event.program_id = - crate::MdProgramId(kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string()); + crate::MdProgramId(ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string()); observation.event.event_family = crate::MdEventFamily::Lifecycle; assert!(!crate::MtApiEventMaterializer::accepts_observation( &crate::MtAdminMaterializer, @@ -784,7 +784,7 @@ mod tests { serde_json::json!({}), ); observation.event.program_id = crate::MdProgramId( - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID.to_string(), + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID.to_string(), ); observation.payload_json = serde_json::json!({ "accounts": observation.payload_json["accounts"].clone(), @@ -821,11 +821,11 @@ mod tests { serde_json::json!({}), ); foreign.event.program_id = - crate::MdProgramId(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); + crate::MdProgramId(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); assert!(!crate::MtApiEventMaterializer::accepts_observation(&materializer, &foreign,)); let mut failed = foreign.clone(); failed.event.program_id = crate::MdProgramId( - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID.to_string(), + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID.to_string(), ); failed.transaction_failed = true; failed.observation_committed = false; @@ -850,7 +850,7 @@ mod tests { ); observation.event.event_family = crate::MdEventFamily::TokenAccount; observation.event.program_id = - crate::MdProgramId(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); + crate::MdProgramId(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); let result = crate::MtApiEventMaterializer::materialize( &crate::MtAdminMaterializer, &observation, @@ -873,13 +873,13 @@ mod tests { ); observation.event.event_family = crate::MdEventFamily::TokenAccount; observation.event.program_id = - crate::MdProgramId(kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()); + crate::MdProgramId(ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()); assert!(!crate::MtApiEventMaterializer::accepts_observation( &crate::MtAdminMaterializer, &observation, )); observation.event.program_id = - crate::MdProgramId(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); + crate::MdProgramId(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); observation.transaction_failed = true; observation.observation_committed = false; let result = @@ -927,7 +927,7 @@ pub fn materializer_admin_materialize_token_2022_state_snapshots( "idempotenceKey": output_key, "accountKey": account_key, "slot": slot, - "programId": kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + "programId": ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, "stateKind": "mint", "extensionType": entry.extension_type, "extensionName": entry.extension_name, @@ -1062,7 +1062,7 @@ pub fn materializer_admin_materialize_elgamal_registry_state_snapshot( "idempotenceKey": format!("spl_elgamal_registry:{registry_account_key}:{slot}"), "registryAccountKey": registry_account_key, "slot": slot, - "programId": kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, + "programId": ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, "owner": state.owner, "elgamalPubkeyBase64": state.elgamal_pubkey_base64, "wireHex": state.wire_hex, diff --git a/kb-lib/src/materializer/api.rs b/ks-lib/src/materializer/api.rs similarity index 96% rename from kb-lib/src/materializer/api.rs rename to ks-lib/src/materializer/api.rs index 4df5f4e..49501b2 100644 --- a/kb-lib/src/materializer/api.rs +++ b/ks-lib/src/materializer/api.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/api.rs -// version: 4 +// file: ks-lib/src/materializer/api.rs +// version: 5 //! Materializer contracts. diff --git a/kb-lib/src/materializer/api/contracts.rs b/ks-lib/src/materializer/api/contracts.rs similarity index 96% rename from kb-lib/src/materializer/api/contracts.rs rename to ks-lib/src/materializer/api/contracts.rs index 502dab5..49d498d 100644 --- a/kb-lib/src/materializer/api/contracts.rs +++ b/ks-lib/src/materializer/api/contracts.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/api/contracts.rs -// version: 8 +// file: ks-lib/src/materializer/api/contracts.rs +// version: 9 //! Backend-neutral decoded observation materialization contracts. @@ -17,13 +17,13 @@ impl MtApiMaterializerIdentity { pub fn new( name: impl std::convert::Into, version: impl std::convert::Into, - ) -> kb_core::Result { + ) -> ks_core::Result { let value = Self { name: name.into(), version: version.into(), }; if value.name.trim().is_empty() || value.version.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "materializer identity fields must not be empty", )); } @@ -74,14 +74,14 @@ impl MtApiMaterializerDiagnostic { code: impl std::convert::Into, message: impl std::convert::Into, retriable: bool, - ) -> kb_core::Result { + ) -> ks_core::Result { let value = Self { code: code.into(), message: message.into(), retriable, }; if value.code.trim().is_empty() || value.message.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "materializer diagnostic code and message must not be empty", )); } @@ -102,9 +102,9 @@ pub struct MtApiMaterializedOutput { impl MtApiMaterializedOutput { /// Validates stable output identity. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.output_key.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "materialized output key must not be empty", )); } @@ -147,21 +147,21 @@ impl MtApiMaterializerExecutionResult { } /// Validates status and output consistency. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { let output_status = self.status == MtApiMaterializerOutcomeStatus::Inserted || self.status == MtApiMaterializerOutcomeStatus::Replaced; if output_status && self.outputs.is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "inserted or replaced materializer status requires outputs", )); } if !output_status && !self.outputs.is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "ignored, refused or failed materializer status must not contain outputs", )); } if self.status == MtApiMaterializerOutcomeStatus::Failed && self.diagnostics.is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "failed materializer status requires at least one diagnostic", )); } diff --git a/kb-lib/src/materializer/api/materializer.rs b/ks-lib/src/materializer/api/materializer.rs similarity index 84% rename from kb-lib/src/materializer/api/materializer.rs rename to ks-lib/src/materializer/api/materializer.rs index 0293972..e41606c 100644 --- a/kb-lib/src/materializer/api/materializer.rs +++ b/ks-lib/src/materializer/api/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/api/materializer.rs -// version: 3 +// file: ks-lib/src/materializer/api/materializer.rs +// version: 4 //! Legacy materializer API contract used by business materializer modules. @@ -18,5 +18,5 @@ pub trait MtMaterializer { fn materialize_event( &self, event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result>; + ) -> ks_core::Result>; } diff --git a/kb-lib/src/materializer/bridge.rs b/ks-lib/src/materializer/bridge.rs similarity index 90% rename from kb-lib/src/materializer/bridge.rs rename to ks-lib/src/materializer/bridge.rs index d37e523..0a7778d 100644 --- a/kb-lib/src/materializer/bridge.rs +++ b/ks-lib/src/materializer/bridge.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/bridge.rs -// version: 4 +// file: ks-lib/src/materializer/bridge.rs +// version: 5 //! `bridge` materializer family. diff --git a/kb-lib/src/materializer/bridge/constants.rs b/ks-lib/src/materializer/bridge/constants.rs similarity index 87% rename from kb-lib/src/materializer/bridge/constants.rs rename to ks-lib/src/materializer/bridge/constants.rs index 097aab2..b651e7d 100644 --- a/kb-lib/src/materializer/bridge/constants.rs +++ b/ks-lib/src/materializer/bridge/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/bridge/constants.rs -// version: 1 +// file: ks-lib/src/materializer/bridge/constants.rs +// version: 2 //! Local constants for the bridge materializer. diff --git a/kb-lib/src/materializer/bridge/materializer.rs b/ks-lib/src/materializer/bridge/materializer.rs similarity index 92% rename from kb-lib/src/materializer/bridge/materializer.rs rename to ks-lib/src/materializer/bridge/materializer.rs index 06e0bb7..e645873 100644 --- a/kb-lib/src/materializer/bridge/materializer.rs +++ b/ks-lib/src/materializer/bridge/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/bridge/materializer.rs -// version: 4 +// file: ks-lib/src/materializer/bridge/materializer.rs +// version: 5 //! Reserved bridge materializer. @@ -23,7 +23,7 @@ impl crate::MtMaterializer for crate::MtBridgeMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/materializer/compliance.rs b/ks-lib/src/materializer/compliance.rs similarity index 97% rename from kb-lib/src/materializer/compliance.rs rename to ks-lib/src/materializer/compliance.rs index 882691e..2c296b1 100644 --- a/kb-lib/src/materializer/compliance.rs +++ b/ks-lib/src/materializer/compliance.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/compliance.rs -// version: 5 +// file: ks-lib/src/materializer/compliance.rs +// version: 6 //! `compliance` materializer family. diff --git a/kb-lib/src/materializer/compliance/audit.rs b/ks-lib/src/materializer/compliance/audit.rs similarity index 96% rename from kb-lib/src/materializer/compliance/audit.rs rename to ks-lib/src/materializer/compliance/audit.rs index 5e5cbf3..39fa90a 100644 --- a/kb-lib/src/materializer/compliance/audit.rs +++ b/ks-lib/src/materializer/compliance/audit.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/compliance/audit.rs -// version: 11 +// file: ks-lib/src/materializer/compliance/audit.rs +// version: 12 //! Native compliance-audit materializer component. diff --git a/kb-lib/src/materializer/compliance/audit/constants.rs b/ks-lib/src/materializer/compliance/audit/constants.rs similarity index 96% rename from kb-lib/src/materializer/compliance/audit/constants.rs rename to ks-lib/src/materializer/compliance/audit/constants.rs index 0815c03..cf75eae 100644 --- a/kb-lib/src/materializer/compliance/audit/constants.rs +++ b/ks-lib/src/materializer/compliance/audit/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/compliance/audit/constants.rs -// version: 4 +// file: ks-lib/src/materializer/compliance/audit/constants.rs +// version: 5 //! Local constants for the compliance audit materializer. diff --git a/kb-lib/src/materializer/compliance/audit/materializer.rs b/ks-lib/src/materializer/compliance/audit/materializer.rs similarity index 99% rename from kb-lib/src/materializer/compliance/audit/materializer.rs rename to ks-lib/src/materializer/compliance/audit/materializer.rs index fe39869..3853f5d 100644 --- a/kb-lib/src/materializer/compliance/audit/materializer.rs +++ b/ks-lib/src/materializer/compliance/audit/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/compliance/audit/materializer.rs -// version: 12 +// file: ks-lib/src/materializer/compliance/audit/materializer.rs +// version: 13 //! Stable compliance-audit projections for committed native bytecode mutations and execution profiles. @@ -50,7 +50,7 @@ impl crate::MtMaterializer for crate::MtComplianceAuditMaterializer { fn materialize_event( &self, event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { if !crate::MtMaterializer::accepts_event(self, event) { return std::result::Result::Ok(std::vec::Vec::new()); } diff --git a/kb-lib/src/materializer/fees.rs b/ks-lib/src/materializer/fees.rs similarity index 95% rename from kb-lib/src/materializer/fees.rs rename to ks-lib/src/materializer/fees.rs index 2578a3d..44cac0e 100644 --- a/kb-lib/src/materializer/fees.rs +++ b/ks-lib/src/materializer/fees.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/fees.rs -// version: 5 +// file: ks-lib/src/materializer/fees.rs +// version: 6 //! `fees` materializer family. diff --git a/kb-lib/src/materializer/fees/constants.rs b/ks-lib/src/materializer/fees/constants.rs similarity index 95% rename from kb-lib/src/materializer/fees/constants.rs rename to ks-lib/src/materializer/fees/constants.rs index 11dfc74..e500e76 100644 --- a/kb-lib/src/materializer/fees/constants.rs +++ b/ks-lib/src/materializer/fees/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/fees/constants.rs -// version: 2 +// file: ks-lib/src/materializer/fees/constants.rs +// version: 3 //! Local constants for the fees materializer. diff --git a/kb-lib/src/materializer/fees/materializer.rs b/ks-lib/src/materializer/fees/materializer.rs similarity index 97% rename from kb-lib/src/materializer/fees/materializer.rs rename to ks-lib/src/materializer/fees/materializer.rs index ec5d523..efa825b 100644 --- a/kb-lib/src/materializer/fees/materializer.rs +++ b/ks-lib/src/materializer/fees/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/fees/materializer.rs -// version: 8 +// file: ks-lib/src/materializer/fees/materializer.rs +// version: 9 //! Stable fee projections derived from exact committed Token-2022 observations. @@ -20,7 +20,7 @@ impl crate::MtMaterializer for crate::MtFeesMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -145,7 +145,7 @@ impl crate::MtApiEventMaterializer for crate::MtFeesMaterializer { fn accepts_event(event: &crate::MdDecodedProtocolEvent) -> bool { return event.event_family == crate::MdEventFamily::Fee && event.surface_code.0 == crate::MT_FEES_SPL_TOKEN_2022_SURFACE - && event.program_id.0 == kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID + && event.program_id.0 == ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID && contains(crate::MT_FEES_TOKEN_2022_FEE_ENTRIES, event.event_name.0.as_str()); } @@ -235,7 +235,7 @@ pub fn materializer_fees_materialize_token_2022_state_snapshots( ), "accountKey": account_key, "slot": slot, - "programId": kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + "programId": ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, "stateKind": state_kind, "extensionType": entry.extension_type, "extensionName": entry.extension_name, @@ -315,7 +315,7 @@ mod tests { fn committed_token_2022_fee_instruction_creates_one_stable_output() { let observation = observation( crate::MT_FEES_SPL_TOKEN_2022_SURFACE, - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, "set_transfer_fee", false, ); @@ -332,7 +332,7 @@ mod tests { fn failed_token_2022_fee_instruction_is_refused() { let observation = observation( crate::MT_FEES_SPL_TOKEN_2022_SURFACE, - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, "harvest_withheld_tokens_to_mint", true, ); @@ -346,13 +346,13 @@ mod tests { fn classic_token_and_program_surface_mismatches_are_ignored() { let classic = observation( "spl.token", - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, "set_transfer_fee", false, ); let wrong_program = observation( crate::MT_FEES_SPL_TOKEN_2022_SURFACE, - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, "set_transfer_fee", false, ); @@ -376,7 +376,7 @@ mod tests { fn committed_confidential_fee_instruction_is_projected_without_decryption() { let observation = observation( crate::MT_FEES_SPL_TOKEN_2022_SURFACE, - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, "initialize_confidential_transfer_fee_config", false, ); diff --git a/kb-lib/src/materializer/governance.rs b/ks-lib/src/materializer/governance.rs similarity index 90% rename from kb-lib/src/materializer/governance.rs rename to ks-lib/src/materializer/governance.rs index 6619f41..30d7c5f 100644 --- a/kb-lib/src/materializer/governance.rs +++ b/ks-lib/src/materializer/governance.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/governance.rs -// version: 4 +// file: ks-lib/src/materializer/governance.rs +// version: 5 //! `governance` materializer family. diff --git a/kb-lib/src/materializer/governance/constants.rs b/ks-lib/src/materializer/governance/constants.rs similarity index 87% rename from kb-lib/src/materializer/governance/constants.rs rename to ks-lib/src/materializer/governance/constants.rs index fcd74e4..a88d8d2 100644 --- a/kb-lib/src/materializer/governance/constants.rs +++ b/ks-lib/src/materializer/governance/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/governance/constants.rs -// version: 1 +// file: ks-lib/src/materializer/governance/constants.rs +// version: 2 //! Local constants for the governance materializer. diff --git a/kb-lib/src/materializer/governance/materializer.rs b/ks-lib/src/materializer/governance/materializer.rs similarity index 92% rename from kb-lib/src/materializer/governance/materializer.rs rename to ks-lib/src/materializer/governance/materializer.rs index a17178e..cf41a67 100644 --- a/kb-lib/src/materializer/governance/materializer.rs +++ b/ks-lib/src/materializer/governance/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/governance/materializer.rs -// version: 5 +// file: ks-lib/src/materializer/governance/materializer.rs +// version: 6 //! Reserved governance materializer. @@ -23,7 +23,7 @@ impl crate::MtMaterializer for crate::MtGovernanceMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/materializer/lending.rs b/ks-lib/src/materializer/lending.rs similarity index 90% rename from kb-lib/src/materializer/lending.rs rename to ks-lib/src/materializer/lending.rs index 506dd3f..abf0e28 100644 --- a/kb-lib/src/materializer/lending.rs +++ b/ks-lib/src/materializer/lending.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/lending.rs -// version: 4 +// file: ks-lib/src/materializer/lending.rs +// version: 5 //! `lending` materializer family. diff --git a/kb-lib/src/materializer/lending/constants.rs b/ks-lib/src/materializer/lending/constants.rs similarity index 87% rename from kb-lib/src/materializer/lending/constants.rs rename to ks-lib/src/materializer/lending/constants.rs index 03af06e..65b3657 100644 --- a/kb-lib/src/materializer/lending/constants.rs +++ b/ks-lib/src/materializer/lending/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/lending/constants.rs -// version: 1 +// file: ks-lib/src/materializer/lending/constants.rs +// version: 2 //! Local constants for the lending materializer. diff --git a/kb-lib/src/materializer/lending/materializer.rs b/ks-lib/src/materializer/lending/materializer.rs similarity index 92% rename from kb-lib/src/materializer/lending/materializer.rs rename to ks-lib/src/materializer/lending/materializer.rs index 1efe8d5..b4aa4d1 100644 --- a/kb-lib/src/materializer/lending/materializer.rs +++ b/ks-lib/src/materializer/lending/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/lending/materializer.rs -// version: 5 +// file: ks-lib/src/materializer/lending/materializer.rs +// version: 6 //! Reserved lending materializer. @@ -23,7 +23,7 @@ impl crate::MtMaterializer for crate::MtLendingMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/materializer/lifecycle.rs b/ks-lib/src/materializer/lifecycle.rs similarity index 98% rename from kb-lib/src/materializer/lifecycle.rs rename to ks-lib/src/materializer/lifecycle.rs index d0b9655..2474e0b 100644 --- a/kb-lib/src/materializer/lifecycle.rs +++ b/ks-lib/src/materializer/lifecycle.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/lifecycle.rs -// version: 5 +// file: ks-lib/src/materializer/lifecycle.rs +// version: 6 //! `lifecycle` materializer family. diff --git a/kb-lib/src/materializer/lifecycle/constants.rs b/ks-lib/src/materializer/lifecycle/constants.rs similarity index 98% rename from kb-lib/src/materializer/lifecycle/constants.rs rename to ks-lib/src/materializer/lifecycle/constants.rs index 1ee82cb..42b4fed 100644 --- a/kb-lib/src/materializer/lifecycle/constants.rs +++ b/ks-lib/src/materializer/lifecycle/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/lifecycle/constants.rs -// version: 4 +// file: ks-lib/src/materializer/lifecycle/constants.rs +// version: 5 //! Local constants for the lifecycle materializer. diff --git a/kb-lib/src/materializer/lifecycle/materializer.rs b/ks-lib/src/materializer/lifecycle/materializer.rs similarity index 99% rename from kb-lib/src/materializer/lifecycle/materializer.rs rename to ks-lib/src/materializer/lifecycle/materializer.rs index 20e217b..5357514 100644 --- a/kb-lib/src/materializer/lifecycle/materializer.rs +++ b/ks-lib/src/materializer/lifecycle/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/lifecycle/materializer.rs -// version: 18 +// file: ks-lib/src/materializer/lifecycle/materializer.rs +// version: 19 //! Stable lifecycle projections derived from exact decoded observations. @@ -79,7 +79,7 @@ impl crate::MtMaterializer for crate::MtLifecycleMaterializer { fn materialize_event( &self, event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { if !crate::MtMaterializer::accepts_event(self, event) { return std::result::Result::Ok(std::vec::Vec::new()); } @@ -524,8 +524,8 @@ mod tests { serde_json::json!([ {"role": "proof_account", "accountKey": "proof111"}, {"role": "violation_report", "accountKey": "report111"}, - {"role": "instructions_sysvar", "accountKey": kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID}, - {"role": "system_program", "accountKey": kb_program_ids::SYSTEM_PROGRAM_ID} + {"role": "instructions_sysvar", "accountKey": ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID}, + {"role": "system_program", "accountKey": ks_program_ids::SYSTEM_PROGRAM_ID} ]), ) } else { @@ -885,7 +885,7 @@ mod tests { fn ata_lifecycle_is_owned_by_token_accounts_materializer_only() { let mut observation = observation("spl.associated_token_account", "create", false); observation.event.program_id = - crate::MdProgramId(kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string()); + crate::MdProgramId(ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string()); assert!(!crate::MtApiEventMaterializer::accepts_observation( &crate::MtLifecycleMaterializer, &observation, diff --git a/kb-lib/src/materializer/liquidity.rs b/ks-lib/src/materializer/liquidity.rs similarity index 90% rename from kb-lib/src/materializer/liquidity.rs rename to ks-lib/src/materializer/liquidity.rs index fd972a1..2985d4e 100644 --- a/kb-lib/src/materializer/liquidity.rs +++ b/ks-lib/src/materializer/liquidity.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/liquidity.rs -// version: 4 +// file: ks-lib/src/materializer/liquidity.rs +// version: 5 //! `liquidity` materializer family. diff --git a/kb-lib/src/materializer/liquidity/constants.rs b/ks-lib/src/materializer/liquidity/constants.rs similarity index 87% rename from kb-lib/src/materializer/liquidity/constants.rs rename to ks-lib/src/materializer/liquidity/constants.rs index 9060e8a..00d2c1d 100644 --- a/kb-lib/src/materializer/liquidity/constants.rs +++ b/ks-lib/src/materializer/liquidity/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/liquidity/constants.rs -// version: 1 +// file: ks-lib/src/materializer/liquidity/constants.rs +// version: 2 //! Local constants for the liquidity materializer. diff --git a/kb-lib/src/materializer/liquidity/materializer.rs b/ks-lib/src/materializer/liquidity/materializer.rs similarity index 92% rename from kb-lib/src/materializer/liquidity/materializer.rs rename to ks-lib/src/materializer/liquidity/materializer.rs index a739baf..8fc6b29 100644 --- a/kb-lib/src/materializer/liquidity/materializer.rs +++ b/ks-lib/src/materializer/liquidity/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/liquidity/materializer.rs -// version: 5 +// file: ks-lib/src/materializer/liquidity/materializer.rs +// version: 6 //! Reserved liquidity materializer. @@ -23,7 +23,7 @@ impl crate::MtMaterializer for crate::MtLiquidityMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/materializer/metadata.rs b/ks-lib/src/materializer/metadata.rs similarity index 98% rename from kb-lib/src/materializer/metadata.rs rename to ks-lib/src/materializer/metadata.rs index dc9952c..339dcce 100644 --- a/kb-lib/src/materializer/metadata.rs +++ b/ks-lib/src/materializer/metadata.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/metadata.rs -// version: 9 +// file: ks-lib/src/materializer/metadata.rs +// version: 10 //! `metadata` materializer family. diff --git a/kb-lib/src/materializer/metadata/metaplex_token_metadata.rs b/ks-lib/src/materializer/metadata/metaplex_token_metadata.rs similarity index 94% rename from kb-lib/src/materializer/metadata/metaplex_token_metadata.rs rename to ks-lib/src/materializer/metadata/metaplex_token_metadata.rs index 09471d5..6d1fe6c 100644 --- a/kb-lib/src/materializer/metadata/metaplex_token_metadata.rs +++ b/ks-lib/src/materializer/metadata/metaplex_token_metadata.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/metadata/metaplex_token_metadata.rs -// version: 3 +// file: ks-lib/src/materializer/metadata/metaplex_token_metadata.rs +// version: 4 //! Metaplex Token Metadata account-state materializer. diff --git a/kb-lib/src/materializer/metadata/metaplex_token_metadata/account.rs b/ks-lib/src/materializer/metadata/metaplex_token_metadata/account.rs similarity index 99% rename from kb-lib/src/materializer/metadata/metaplex_token_metadata/account.rs rename to ks-lib/src/materializer/metadata/metaplex_token_metadata/account.rs index f368a31..0baa472 100644 --- a/kb-lib/src/materializer/metadata/metaplex_token_metadata/account.rs +++ b/ks-lib/src/materializer/metadata/metaplex_token_metadata/account.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/metadata/metaplex_token_metadata/account.rs -// version: 5 +// file: ks-lib/src/materializer/metadata/metaplex_token_metadata/account.rs +// version: 6 //! Authoritative non-Metadata Metaplex account-state materialization. diff --git a/kb-lib/src/materializer/metadata/metaplex_token_metadata/constants.rs b/ks-lib/src/materializer/metadata/metaplex_token_metadata/constants.rs similarity index 93% rename from kb-lib/src/materializer/metadata/metaplex_token_metadata/constants.rs rename to ks-lib/src/materializer/metadata/metaplex_token_metadata/constants.rs index c0f1a1f..04b696b 100644 --- a/kb-lib/src/materializer/metadata/metaplex_token_metadata/constants.rs +++ b/ks-lib/src/materializer/metadata/metaplex_token_metadata/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/metadata/metaplex_token_metadata/constants.rs -// version: 6 +// file: ks-lib/src/materializer/metadata/metaplex_token_metadata/constants.rs +// version: 7 //! Local constants for the metadata metaplex_token_metadata materializer. diff --git a/kb-lib/src/materializer/metadata/metaplex_token_metadata/materializer.rs b/ks-lib/src/materializer/metadata/metaplex_token_metadata/materializer.rs similarity index 95% rename from kb-lib/src/materializer/metadata/metaplex_token_metadata/materializer.rs rename to ks-lib/src/materializer/metadata/metaplex_token_metadata/materializer.rs index d4e4aff..b56fc88 100644 --- a/kb-lib/src/materializer/metadata/metaplex_token_metadata/materializer.rs +++ b/ks-lib/src/materializer/metadata/metaplex_token_metadata/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/metadata/metaplex_token_metadata/materializer.rs -// version: 1 +// file: ks-lib/src/materializer/metadata/metaplex_token_metadata/materializer.rs +// version: 2 //! Metaplex Token Metadata instruction materialization. @@ -18,7 +18,7 @@ impl crate::MtMaterializer for crate::MtMetadataMetaplexTokenMetadataMaterialize fn accepts_event(&self, event: &crate::MdDecodedProtocolEvent) -> bool { return event.event_family == crate::MdEventFamily::Metadata - && event.program_id.0 == kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID + && event.program_id.0 == ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID && event.surface_code.0 == crate::DC_METADATA_MTM_SURFACE_CODE && instruction_contract(event.event_name.0.as_str()).is_some(); } @@ -26,7 +26,7 @@ impl crate::MtMaterializer for crate::MtMetadataMetaplexTokenMetadataMaterialize fn materialize_event( &self, event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { if !crate::MtMaterializer::accepts_event(self, event) { return std::result::Result::Ok(std::vec::Vec::new()); } @@ -54,7 +54,7 @@ impl crate::MtApiEventMaterializer for crate::MtMetadataMetaplexTokenMetadataMat fn accepts_observation(&self, observation: &crate::DcApiDecodedObservation) -> bool { return observation.event.event_family == crate::MdEventFamily::Metadata && observation.event.program_id.0 - == kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID + == ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID && observation.event.surface_code.0 == crate::DC_METADATA_MTM_SURFACE_CODE && instruction_contract(observation.event.event_name.0.as_str()).is_some() && payload_contract_matches(observation); @@ -153,7 +153,7 @@ fn payload_contract_matches(observation: &crate::DcApiDecodedObservation) -> boo return instruction == std::option::Option::Some(observation.event.event_name.0.as_str()) && program_id == std::option::Option::Some( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ); } @@ -167,7 +167,7 @@ mod tests { slot: crate::MdSlot(42), instruction_path: crate::MdInstructionPath("0".to_string()), program_id: crate::MdProgramId( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(), + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(), ), protocol_code: crate::MdProtocolCode( crate::DC_METADATA_MTM_SURFACE_CODE.to_string(), @@ -184,7 +184,7 @@ mod tests { confidence: crate::MdDecoderConfidence::ManualExact, }, payload_json: serde_json::json!({ - "programId": kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + "programId": ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, "instruction": operation, "parameters": {}, "accounts": [] @@ -227,7 +227,7 @@ mod tests { assert_eq!(refused.status, crate::MtApiMaterializerOutcomeStatus::Refused); let mut foreign = observation("create_metadata_account_v3", true); foreign.event.program_id = - crate::MdProgramId(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); + crate::MdProgramId(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); let ignored = crate::MtApiEventMaterializer::materialize(&materializer, &foreign); assert_eq!(ignored.status, crate::MtApiMaterializerOutcomeStatus::Ignored); } diff --git a/kb-lib/src/materializer/metadata/metaplex_token_metadata/state.rs b/ks-lib/src/materializer/metadata/metaplex_token_metadata/state.rs similarity index 99% rename from kb-lib/src/materializer/metadata/metaplex_token_metadata/state.rs rename to ks-lib/src/materializer/metadata/metaplex_token_metadata/state.rs index 61f0573..122ded1 100644 --- a/kb-lib/src/materializer/metadata/metaplex_token_metadata/state.rs +++ b/ks-lib/src/materializer/metadata/metaplex_token_metadata/state.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/metadata/metaplex_token_metadata/state.rs -// version: 5 +// file: ks-lib/src/materializer/metadata/metaplex_token_metadata/state.rs +// version: 6 //! Authoritative Metaplex MetadataV1 state materialization. diff --git a/kb-lib/src/materializer/metadata/solana_program_metadata.rs b/ks-lib/src/materializer/metadata/solana_program_metadata.rs similarity index 95% rename from kb-lib/src/materializer/metadata/solana_program_metadata.rs rename to ks-lib/src/materializer/metadata/solana_program_metadata.rs index 9033a90..0e18519 100644 --- a/kb-lib/src/materializer/metadata/solana_program_metadata.rs +++ b/ks-lib/src/materializer/metadata/solana_program_metadata.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/metadata/solana_program_metadata.rs -// version: 3 +// file: ks-lib/src/materializer/metadata/solana_program_metadata.rs +// version: 4 //! Solana Program Metadata materialization surface. diff --git a/kb-lib/src/materializer/metadata/solana_program_metadata/constants.rs b/ks-lib/src/materializer/metadata/solana_program_metadata/constants.rs similarity index 92% rename from kb-lib/src/materializer/metadata/solana_program_metadata/constants.rs rename to ks-lib/src/materializer/metadata/solana_program_metadata/constants.rs index 9119b46..84c4628 100644 --- a/kb-lib/src/materializer/metadata/solana_program_metadata/constants.rs +++ b/ks-lib/src/materializer/metadata/solana_program_metadata/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/metadata/solana_program_metadata/constants.rs -// version: 4 +// file: ks-lib/src/materializer/metadata/solana_program_metadata/constants.rs +// version: 5 //! Local constants for the Solana Program Metadata materializer. diff --git a/kb-lib/src/materializer/metadata/solana_program_metadata/materializer.rs b/ks-lib/src/materializer/metadata/solana_program_metadata/materializer.rs similarity index 96% rename from kb-lib/src/materializer/metadata/solana_program_metadata/materializer.rs rename to ks-lib/src/materializer/metadata/solana_program_metadata/materializer.rs index bbf0b52..7153fec 100644 --- a/kb-lib/src/materializer/metadata/solana_program_metadata/materializer.rs +++ b/ks-lib/src/materializer/metadata/solana_program_metadata/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/metadata/solana_program_metadata/materializer.rs -// version: 5 +// file: ks-lib/src/materializer/metadata/solana_program_metadata/materializer.rs +// version: 6 //! Committed Solana Program Metadata instruction projections. @@ -18,7 +18,7 @@ impl crate::MtMaterializer for crate::MtMetadataSolanaProgramMaterializer { fn accepts_event(&self, event: &crate::MdDecodedProtocolEvent) -> bool { return event.event_family == crate::MdEventFamily::Metadata - && event.program_id.0 == kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID + && event.program_id.0 == ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID && event.surface_code.0 == crate::DC_METADATA_SPM_SURFACE_CODE && crate::DC_METADATA_SPM_INSTRUCTION_ENTRIES .iter() @@ -28,7 +28,7 @@ impl crate::MtMaterializer for crate::MtMetadataSolanaProgramMaterializer { fn materialize_event( &self, event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { if !crate::MtMaterializer::accepts_event(self, event) { return std::result::Result::Ok(std::vec::Vec::new()); } @@ -56,7 +56,7 @@ impl crate::MtApiEventMaterializer for crate::MtMetadataSolanaProgramMaterialize fn accepts_observation(&self, observation: &crate::DcApiDecodedObservation) -> bool { return observation.event.event_family == crate::MdEventFamily::Metadata && observation.event.program_id.0 - == kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID + == ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID && observation.event.surface_code.0 == crate::DC_METADATA_SPM_SURFACE_CODE && payload_contract_matches(observation) && crate::DC_METADATA_SPM_INSTRUCTION_ENTRIES @@ -141,7 +141,7 @@ fn payload_contract_matches(observation: &crate::DcApiDecodedObservation) -> boo return instruction == std::option::Option::Some(observation.event.event_name.0.as_str()) && program_id == std::option::Option::Some( - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, ); } @@ -240,7 +240,7 @@ mod tests { slot: crate::MdSlot(42), instruction_path: crate::MdInstructionPath("0".to_string()), program_id: crate::MdProgramId( - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), ), protocol_code: crate::MdProtocolCode( crate::DC_METADATA_SPM_SURFACE_CODE.to_string(), @@ -257,7 +257,7 @@ mod tests { confidence: crate::MdDecoderConfidence::ManualExact, }, payload_json: serde_json::json!({ - "programId": kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + "programId": ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, "instruction": operation, "parameters": {"length": 8}, "accounts": [ @@ -310,7 +310,7 @@ mod tests { assert_eq!(failure.status, crate::MtApiMaterializerOutcomeStatus::Refused); let mut foreign = observation("set_data", true); foreign.event.program_id = - crate::MdProgramId(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); + crate::MdProgramId(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); let ignored = crate::MtApiEventMaterializer::materialize(&materializer, &foreign); assert_eq!(ignored.status, crate::MtApiMaterializerOutcomeStatus::Ignored); } diff --git a/kb-lib/src/materializer/metadata/solana_program_metadata/state.rs b/ks-lib/src/materializer/metadata/solana_program_metadata/state.rs similarity index 98% rename from kb-lib/src/materializer/metadata/solana_program_metadata/state.rs rename to ks-lib/src/materializer/metadata/solana_program_metadata/state.rs index 7f5dc06..57f3db0 100644 --- a/kb-lib/src/materializer/metadata/solana_program_metadata/state.rs +++ b/ks-lib/src/materializer/metadata/solana_program_metadata/state.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/metadata/solana_program_metadata/state.rs -// version: 4 +// file: ks-lib/src/materializer/metadata/solana_program_metadata/state.rs +// version: 5 //! Authoritative Solana Program Metadata account-state projections. @@ -69,7 +69,7 @@ pub fn materializer_metadata_materialize_solana_program_metadata_buffer_snapshot "projectionSemantics": "authoritative_bounded_owned_account_snapshot", "account": snapshot.account, "slot": slot, - "programId": kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + "programId": ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, "accountDiscriminator": "buffer", "metadataProgram": snapshot.program, "authority": snapshot.authority, @@ -156,7 +156,7 @@ pub fn materializer_metadata_materialize_solana_program_metadata_metadata_snapsh "projectionSemantics": "authoritative_bounded_owned_account_snapshot", "account": snapshot.account, "slot": slot, - "programId": kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + "programId": ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, "accountDiscriminator": "metadata", "bump": snapshot.bump, "metadataProgram": snapshot.program, diff --git a/kb-lib/src/materializer/metadata/token_2022.rs b/ks-lib/src/materializer/metadata/token_2022.rs similarity index 94% rename from kb-lib/src/materializer/metadata/token_2022.rs rename to ks-lib/src/materializer/metadata/token_2022.rs index 445f7e7..6c53844 100644 --- a/kb-lib/src/materializer/metadata/token_2022.rs +++ b/ks-lib/src/materializer/metadata/token_2022.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/metadata/token_2022.rs -// version: 3 +// file: ks-lib/src/materializer/metadata/token_2022.rs +// version: 4 //! Embedded SPL Token-2022 metadata materialization surface. diff --git a/kb-lib/src/materializer/metadata/token_2022/constants.rs b/ks-lib/src/materializer/metadata/token_2022/constants.rs similarity index 94% rename from kb-lib/src/materializer/metadata/token_2022/constants.rs rename to ks-lib/src/materializer/metadata/token_2022/constants.rs index f453887..b3099d5 100644 --- a/kb-lib/src/materializer/metadata/token_2022/constants.rs +++ b/ks-lib/src/materializer/metadata/token_2022/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/metadata/token_2022/constants.rs -// version: 4 +// file: ks-lib/src/materializer/metadata/token_2022/constants.rs +// version: 5 //! Local constants for the metadata token_2022 materializer. diff --git a/kb-lib/src/materializer/metadata/token_2022/materializer.rs b/ks-lib/src/materializer/metadata/token_2022/materializer.rs similarity index 95% rename from kb-lib/src/materializer/metadata/token_2022/materializer.rs rename to ks-lib/src/materializer/metadata/token_2022/materializer.rs index 493fd4c..4e64098 100644 --- a/kb-lib/src/materializer/metadata/token_2022/materializer.rs +++ b/ks-lib/src/materializer/metadata/token_2022/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/metadata/token_2022/materializer.rs -// version: 1 +// file: ks-lib/src/materializer/metadata/token_2022/materializer.rs +// version: 2 //! SPL Token-2022 embedded metadata and group instruction materialization. @@ -18,7 +18,7 @@ impl crate::MtMaterializer for crate::MtMetadataToken2022Materializer { fn accepts_event(&self, event: &crate::MdDecodedProtocolEvent) -> bool { return event.event_family == crate::MdEventFamily::Metadata - && event.program_id.0 == kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID + && event.program_id.0 == ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID && event.surface_code.0 == crate::DC_SPL_TOKEN_2022_SURFACE_CODE && crate::MT_METADATA_TOKEN_2022_INSTRUCTION_ENTRIES .iter() @@ -28,7 +28,7 @@ impl crate::MtMaterializer for crate::MtMetadataToken2022Materializer { fn materialize_event( &self, event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { if !crate::MtMaterializer::accepts_event(self, event) { return std::result::Result::Ok(std::vec::Vec::new()); } @@ -55,7 +55,7 @@ impl crate::MtApiEventMaterializer for crate::MtMetadataToken2022Materializer { fn accepts_observation(&self, observation: &crate::DcApiDecodedObservation) -> bool { return observation.event.event_family == crate::MdEventFamily::Metadata - && observation.event.program_id.0 == kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID + && observation.event.program_id.0 == ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID && observation.event.surface_code.0 == crate::DC_SPL_TOKEN_2022_SURFACE_CODE && crate::MT_METADATA_TOKEN_2022_INSTRUCTION_ENTRIES .iter() @@ -139,7 +139,7 @@ fn payload_contract_matches(observation: &crate::DcApiDecodedObservation) -> boo observation.payload_json.get("instruction").and_then(serde_json::Value::as_str); let program_id = observation.payload_json.get("programId").and_then(serde_json::Value::as_str); return instruction == std::option::Option::Some(observation.event.event_name.0.as_str()) - && program_id == std::option::Option::Some(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID); + && program_id == std::option::Option::Some(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID); } fn projection_kind(operation: &str) -> &'static str { @@ -167,7 +167,7 @@ mod tests { slot: crate::MdSlot(42), instruction_path: crate::MdInstructionPath("0".to_string()), program_id: crate::MdProgramId( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string(), + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string(), ), protocol_code: crate::MdProtocolCode( crate::DC_SPL_TOKEN_2022_SURFACE_CODE.to_string(), @@ -186,7 +186,7 @@ mod tests { confidence: crate::MdDecoderConfidence::ManualExact, }, payload_json: serde_json::json!({ - "programId": kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + "programId": ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, "instruction": operation, "parameters": {}, "accounts": [], diff --git a/kb-lib/src/materializer/metadata/token_2022/state.rs b/ks-lib/src/materializer/metadata/token_2022/state.rs similarity index 98% rename from kb-lib/src/materializer/metadata/token_2022/state.rs rename to ks-lib/src/materializer/metadata/token_2022/state.rs index 34c7b3a..8ec9c68 100644 --- a/kb-lib/src/materializer/metadata/token_2022/state.rs +++ b/ks-lib/src/materializer/metadata/token_2022/state.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/metadata/token_2022/state.rs -// version: 4 +// file: ks-lib/src/materializer/metadata/token_2022/state.rs +// version: 5 //! Authoritative embedded SPL Token-2022 metadata state materialization. @@ -66,7 +66,7 @@ pub fn materializer_metadata_materialize_token_2022_snapshot( "idempotenceKey": format!("token_2022_metadata:{account_key}:{slot}:{kind}"), "accountKey": account_key, "slot": slot, - "programId": kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + "programId": ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, "metadataSource": "token_2022_embedded_tlv", "projectionKind": kind, "extensionType": entry.extension_type, diff --git a/kb-lib/src/materializer/nft.rs b/ks-lib/src/materializer/nft.rs similarity index 90% rename from kb-lib/src/materializer/nft.rs rename to ks-lib/src/materializer/nft.rs index 526bc77..23ff15b 100644 --- a/kb-lib/src/materializer/nft.rs +++ b/ks-lib/src/materializer/nft.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/nft.rs -// version: 4 +// file: ks-lib/src/materializer/nft.rs +// version: 5 //! `nft` materializer family. diff --git a/kb-lib/src/materializer/nft/constants.rs b/ks-lib/src/materializer/nft/constants.rs similarity index 87% rename from kb-lib/src/materializer/nft/constants.rs rename to ks-lib/src/materializer/nft/constants.rs index 6f08bd3..a77ce54 100644 --- a/kb-lib/src/materializer/nft/constants.rs +++ b/ks-lib/src/materializer/nft/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/nft/constants.rs -// version: 1 +// file: ks-lib/src/materializer/nft/constants.rs +// version: 2 //! Local constants for the nft materializer. diff --git a/kb-lib/src/materializer/nft/materializer.rs b/ks-lib/src/materializer/nft/materializer.rs similarity index 92% rename from kb-lib/src/materializer/nft/materializer.rs rename to ks-lib/src/materializer/nft/materializer.rs index 4b311f4..6e6a47f 100644 --- a/kb-lib/src/materializer/nft/materializer.rs +++ b/ks-lib/src/materializer/nft/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/nft/materializer.rs -// version: 5 +// file: ks-lib/src/materializer/nft/materializer.rs +// version: 6 //! Reserved NFT materializer. @@ -23,7 +23,7 @@ impl crate::MtMaterializer for crate::MtNftMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/materializer/oracle.rs b/ks-lib/src/materializer/oracle.rs similarity index 90% rename from kb-lib/src/materializer/oracle.rs rename to ks-lib/src/materializer/oracle.rs index 50e5a44..3852af5 100644 --- a/kb-lib/src/materializer/oracle.rs +++ b/ks-lib/src/materializer/oracle.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/oracle.rs -// version: 4 +// file: ks-lib/src/materializer/oracle.rs +// version: 5 //! `oracle` materializer family. diff --git a/kb-lib/src/materializer/oracle/constants.rs b/ks-lib/src/materializer/oracle/constants.rs similarity index 87% rename from kb-lib/src/materializer/oracle/constants.rs rename to ks-lib/src/materializer/oracle/constants.rs index dd1b542..e2f2968 100644 --- a/kb-lib/src/materializer/oracle/constants.rs +++ b/ks-lib/src/materializer/oracle/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/oracle/constants.rs -// version: 1 +// file: ks-lib/src/materializer/oracle/constants.rs +// version: 2 //! Local constants for the oracle materializer. diff --git a/kb-lib/src/materializer/oracle/materializer.rs b/ks-lib/src/materializer/oracle/materializer.rs similarity index 92% rename from kb-lib/src/materializer/oracle/materializer.rs rename to ks-lib/src/materializer/oracle/materializer.rs index 9070d49..9aad40b 100644 --- a/kb-lib/src/materializer/oracle/materializer.rs +++ b/ks-lib/src/materializer/oracle/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/oracle/materializer.rs -// version: 5 +// file: ks-lib/src/materializer/oracle/materializer.rs +// version: 6 //! Reserved oracle materializer. @@ -23,7 +23,7 @@ impl crate::MtMaterializer for crate::MtOracleMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/materializer/orderbook.rs b/ks-lib/src/materializer/orderbook.rs similarity index 90% rename from kb-lib/src/materializer/orderbook.rs rename to ks-lib/src/materializer/orderbook.rs index 07a8a9a..1e8c903 100644 --- a/kb-lib/src/materializer/orderbook.rs +++ b/ks-lib/src/materializer/orderbook.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/orderbook.rs -// version: 4 +// file: ks-lib/src/materializer/orderbook.rs +// version: 5 //! `orderbook` materializer family. diff --git a/kb-lib/src/materializer/orderbook/constants.rs b/ks-lib/src/materializer/orderbook/constants.rs similarity index 87% rename from kb-lib/src/materializer/orderbook/constants.rs rename to ks-lib/src/materializer/orderbook/constants.rs index d2157bd..42477c2 100644 --- a/kb-lib/src/materializer/orderbook/constants.rs +++ b/ks-lib/src/materializer/orderbook/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/orderbook/constants.rs -// version: 1 +// file: ks-lib/src/materializer/orderbook/constants.rs +// version: 2 //! Local constants for the orderbook materializer. diff --git a/kb-lib/src/materializer/orderbook/materializer.rs b/ks-lib/src/materializer/orderbook/materializer.rs similarity index 92% rename from kb-lib/src/materializer/orderbook/materializer.rs rename to ks-lib/src/materializer/orderbook/materializer.rs index f0d1036..31963dc 100644 --- a/kb-lib/src/materializer/orderbook/materializer.rs +++ b/ks-lib/src/materializer/orderbook/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/orderbook/materializer.rs -// version: 5 +// file: ks-lib/src/materializer/orderbook/materializer.rs +// version: 6 //! Reserved orderbook materializer. @@ -23,7 +23,7 @@ impl crate::MtMaterializer for crate::MtOrderbookMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/materializer/perpetuals.rs b/ks-lib/src/materializer/perpetuals.rs similarity index 90% rename from kb-lib/src/materializer/perpetuals.rs rename to ks-lib/src/materializer/perpetuals.rs index d129c1d..9c02333 100644 --- a/kb-lib/src/materializer/perpetuals.rs +++ b/ks-lib/src/materializer/perpetuals.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/perpetuals.rs -// version: 4 +// file: ks-lib/src/materializer/perpetuals.rs +// version: 5 //! `perpetuals` materializer family. diff --git a/kb-lib/src/materializer/perpetuals/constants.rs b/ks-lib/src/materializer/perpetuals/constants.rs similarity index 87% rename from kb-lib/src/materializer/perpetuals/constants.rs rename to ks-lib/src/materializer/perpetuals/constants.rs index 6878af8..2e2eac4 100644 --- a/kb-lib/src/materializer/perpetuals/constants.rs +++ b/ks-lib/src/materializer/perpetuals/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/perpetuals/constants.rs -// version: 1 +// file: ks-lib/src/materializer/perpetuals/constants.rs +// version: 2 //! Local constants for the perpetuals materializer. diff --git a/kb-lib/src/materializer/perpetuals/materializer.rs b/ks-lib/src/materializer/perpetuals/materializer.rs similarity index 92% rename from kb-lib/src/materializer/perpetuals/materializer.rs rename to ks-lib/src/materializer/perpetuals/materializer.rs index 6ce0869..6e02193 100644 --- a/kb-lib/src/materializer/perpetuals/materializer.rs +++ b/ks-lib/src/materializer/perpetuals/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/perpetuals/materializer.rs -// version: 4 +// file: ks-lib/src/materializer/perpetuals/materializer.rs +// version: 5 //! Reserved perpetuals materializer. @@ -23,7 +23,7 @@ impl crate::MtMaterializer for crate::MtPerpetualsMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/materializer/pool.rs b/ks-lib/src/materializer/pool.rs similarity index 90% rename from kb-lib/src/materializer/pool.rs rename to ks-lib/src/materializer/pool.rs index 232ff2e..4e7059d 100644 --- a/kb-lib/src/materializer/pool.rs +++ b/ks-lib/src/materializer/pool.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/pool.rs -// version: 4 +// file: ks-lib/src/materializer/pool.rs +// version: 5 //! `pool` materializer family. diff --git a/kb-lib/src/materializer/pool/state.rs b/ks-lib/src/materializer/pool/state.rs similarity index 90% rename from kb-lib/src/materializer/pool/state.rs rename to ks-lib/src/materializer/pool/state.rs index 17a1c69..8c83017 100644 --- a/kb-lib/src/materializer/pool/state.rs +++ b/ks-lib/src/materializer/pool/state.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/pool/state.rs -// version: 5 +// file: ks-lib/src/materializer/pool/state.rs +// version: 6 //! Pool-state materializer component facade. diff --git a/kb-lib/src/materializer/pool/state/constants.rs b/ks-lib/src/materializer/pool/state/constants.rs similarity index 87% rename from kb-lib/src/materializer/pool/state/constants.rs rename to ks-lib/src/materializer/pool/state/constants.rs index e566166..efa01fb 100644 --- a/kb-lib/src/materializer/pool/state/constants.rs +++ b/ks-lib/src/materializer/pool/state/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/pool/state/constants.rs -// version: 1 +// file: ks-lib/src/materializer/pool/state/constants.rs +// version: 2 //! Local constants for the pool state materializer. diff --git a/kb-lib/src/materializer/pool/state/materializer.rs b/ks-lib/src/materializer/pool/state/materializer.rs similarity index 92% rename from kb-lib/src/materializer/pool/state/materializer.rs rename to ks-lib/src/materializer/pool/state/materializer.rs index b8f06d0..d26a0eb 100644 --- a/kb-lib/src/materializer/pool/state/materializer.rs +++ b/ks-lib/src/materializer/pool/state/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/pool/state/materializer.rs -// version: 5 +// file: ks-lib/src/materializer/pool/state/materializer.rs +// version: 6 //! Reserved pool-state materializer. @@ -23,7 +23,7 @@ impl crate::MtMaterializer for crate::MtPoolStateMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/materializer/rewards.rs b/ks-lib/src/materializer/rewards.rs similarity index 90% rename from kb-lib/src/materializer/rewards.rs rename to ks-lib/src/materializer/rewards.rs index 69fb7dc..4ececaf 100644 --- a/kb-lib/src/materializer/rewards.rs +++ b/ks-lib/src/materializer/rewards.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/rewards.rs -// version: 4 +// file: ks-lib/src/materializer/rewards.rs +// version: 5 //! `rewards` materializer family. diff --git a/kb-lib/src/materializer/rewards/constants.rs b/ks-lib/src/materializer/rewards/constants.rs similarity index 87% rename from kb-lib/src/materializer/rewards/constants.rs rename to ks-lib/src/materializer/rewards/constants.rs index 07a6314..c3cfe07 100644 --- a/kb-lib/src/materializer/rewards/constants.rs +++ b/ks-lib/src/materializer/rewards/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/rewards/constants.rs -// version: 1 +// file: ks-lib/src/materializer/rewards/constants.rs +// version: 2 //! Local constants for the rewards materializer. diff --git a/kb-lib/src/materializer/rewards/materializer.rs b/ks-lib/src/materializer/rewards/materializer.rs similarity index 92% rename from kb-lib/src/materializer/rewards/materializer.rs rename to ks-lib/src/materializer/rewards/materializer.rs index fe8eb1a..913c121 100644 --- a/kb-lib/src/materializer/rewards/materializer.rs +++ b/ks-lib/src/materializer/rewards/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/rewards/materializer.rs -// version: 5 +// file: ks-lib/src/materializer/rewards/materializer.rs +// version: 6 //! Reserved rewards materializer. @@ -23,7 +23,7 @@ impl crate::MtMaterializer for crate::MtRewardsMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/materializer/risk.rs b/ks-lib/src/materializer/risk.rs similarity index 94% rename from kb-lib/src/materializer/risk.rs rename to ks-lib/src/materializer/risk.rs index 8baf6d6..fdbe128 100644 --- a/kb-lib/src/materializer/risk.rs +++ b/ks-lib/src/materializer/risk.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/risk.rs -// version: 4 +// file: ks-lib/src/materializer/risk.rs +// version: 5 //! `risk` materializer family. diff --git a/kb-lib/src/materializer/risk/constants.rs b/ks-lib/src/materializer/risk/constants.rs similarity index 96% rename from kb-lib/src/materializer/risk/constants.rs rename to ks-lib/src/materializer/risk/constants.rs index 9ba590f..3750eb9 100644 --- a/kb-lib/src/materializer/risk/constants.rs +++ b/ks-lib/src/materializer/risk/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/risk/constants.rs -// version: 5 +// file: ks-lib/src/materializer/risk/constants.rs +// version: 6 //! Local constants for the risk materializer. diff --git a/kb-lib/src/materializer/risk/materializer.rs b/ks-lib/src/materializer/risk/materializer.rs similarity index 97% rename from kb-lib/src/materializer/risk/materializer.rs rename to ks-lib/src/materializer/risk/materializer.rs index 166850c..440b582 100644 --- a/kb-lib/src/materializer/risk/materializer.rs +++ b/ks-lib/src/materializer/risk/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/risk/materializer.rs -// version: 8 +// file: ks-lib/src/materializer/risk/materializer.rs +// version: 9 //! Stable fact-only risk projections for committed SPL Token and ATA observations. @@ -20,7 +20,7 @@ impl crate::MtMaterializer for crate::MtRiskMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -134,9 +134,9 @@ impl crate::MtApiEventMaterializer for crate::MtRiskMaterializer { } fn accepts_event(event: &crate::MdDecodedProtocolEvent) -> bool { - let token_program = (event.program_id.0 == kb_program_ids::SPL_TOKEN_PROGRAM_ID + let token_program = (event.program_id.0 == ks_program_ids::SPL_TOKEN_PROGRAM_ID && event.surface_code.0 == "spl.token") - || (event.program_id.0 == kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID + || (event.program_id.0 == ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID && event.surface_code.0 == "spl.token_2022"); let token_risk = token_program && crate::MT_RISK_RISK_ENTRIES.contains(&event.event_name.0.as_str()); @@ -145,7 +145,7 @@ fn accepts_event(event: &crate::MdDecodedProtocolEvent) -> bool { } fn is_ata_recovery(event: &crate::MdDecodedProtocolEvent) -> bool { - return event.program_id.0 == kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID + return event.program_id.0 == ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID && event.surface_code.0 == "spl.associated_token_account" && event.event_family == crate::MdEventFamily::Lifecycle && event.event_name.0 == "recover_nested"; @@ -167,8 +167,8 @@ fn ata_addresses_valid(payload: &serde_json::Value) -> bool { .and_then(serde_json::Value::as_str); let token_program_exact = matches!( token_program_id, - std::option::Option::Some(kb_program_ids::SPL_TOKEN_PROGRAM_ID) - | std::option::Option::Some(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID) + std::option::Option::Some(ks_program_ids::SPL_TOKEN_PROGRAM_ID) + | std::option::Option::Some(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID) ); return token_supported && token_program_exact @@ -279,7 +279,7 @@ mod tests { signature: crate::MdSignature("signature".to_string()), slot: crate::MdSlot(1), instruction_path: crate::MdInstructionPath("0".to_string()), - program_id: crate::MdProgramId(kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), + program_id: crate::MdProgramId(ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), protocol_code: crate::MdProtocolCode("spl.token".to_string()), surface_code: crate::MdSurfaceCode("spl.token".to_string()), event_code: crate::MdEventCode(format!("spl.token.{entry}")), @@ -308,7 +308,7 @@ mod tests { ) -> crate::DcApiDecodedObservation { let mut observation = observation(entry, family, parameters, failed); observation.event.program_id = - crate::MdProgramId(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); + crate::MdProgramId(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); observation.event.protocol_code = crate::MdProtocolCode("spl.token_2022".to_string()); observation.event.surface_code = crate::MdSurfaceCode("spl.token_2022".to_string()); observation.event.event_code = crate::MdEventCode(format!("spl.token_2022.{entry}")); @@ -324,7 +324,7 @@ mod tests { slot: crate::MdSlot(2), instruction_path: crate::MdInstructionPath("1/0".to_string()), program_id: crate::MdProgramId( - kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string(), + ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string(), ), protocol_code: crate::MdProtocolCode("spl.associated_token_account".to_string()), surface_code: crate::MdSurfaceCode("spl.associated_token_account".to_string()), @@ -339,7 +339,7 @@ mod tests { payload_json: serde_json::json!({ "addresses": { "tokenProgram": { - "programId": kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + "programId": ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, "kind": "token_2022", "supported": true }, diff --git a/kb-lib/src/materializer/routing.rs b/ks-lib/src/materializer/routing.rs similarity index 90% rename from kb-lib/src/materializer/routing.rs rename to ks-lib/src/materializer/routing.rs index fb1d3ee..70bb150 100644 --- a/kb-lib/src/materializer/routing.rs +++ b/ks-lib/src/materializer/routing.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/routing.rs -// version: 4 +// file: ks-lib/src/materializer/routing.rs +// version: 5 //! `routing` materializer family. diff --git a/kb-lib/src/materializer/routing/constants.rs b/ks-lib/src/materializer/routing/constants.rs similarity index 87% rename from kb-lib/src/materializer/routing/constants.rs rename to ks-lib/src/materializer/routing/constants.rs index 158345f..8d716e6 100644 --- a/kb-lib/src/materializer/routing/constants.rs +++ b/ks-lib/src/materializer/routing/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/routing/constants.rs -// version: 1 +// file: ks-lib/src/materializer/routing/constants.rs +// version: 2 //! Local constants for the routing materializer. diff --git a/kb-lib/src/materializer/routing/materializer.rs b/ks-lib/src/materializer/routing/materializer.rs similarity index 92% rename from kb-lib/src/materializer/routing/materializer.rs rename to ks-lib/src/materializer/routing/materializer.rs index acfabcc..21b3b90 100644 --- a/kb-lib/src/materializer/routing/materializer.rs +++ b/ks-lib/src/materializer/routing/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/routing/materializer.rs -// version: 5 +// file: ks-lib/src/materializer/routing/materializer.rs +// version: 6 //! Reserved routing materializer. @@ -23,7 +23,7 @@ impl crate::MtMaterializer for crate::MtRoutingMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/materializer/staking.rs b/ks-lib/src/materializer/staking.rs similarity index 97% rename from kb-lib/src/materializer/staking.rs rename to ks-lib/src/materializer/staking.rs index 3cf1cfb..ffa8ea8 100644 --- a/kb-lib/src/materializer/staking.rs +++ b/ks-lib/src/materializer/staking.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/staking.rs -// version: 5 +// file: ks-lib/src/materializer/staking.rs +// version: 6 //! `staking` materializer family. diff --git a/kb-lib/src/materializer/staking/constants.rs b/ks-lib/src/materializer/staking/constants.rs similarity index 97% rename from kb-lib/src/materializer/staking/constants.rs rename to ks-lib/src/materializer/staking/constants.rs index b625d75..b550a11 100644 --- a/kb-lib/src/materializer/staking/constants.rs +++ b/ks-lib/src/materializer/staking/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/staking/constants.rs -// version: 4 +// file: ks-lib/src/materializer/staking/constants.rs +// version: 5 //! Local constants for the staking materializer. diff --git a/kb-lib/src/materializer/staking/materializer.rs b/ks-lib/src/materializer/staking/materializer.rs similarity index 99% rename from kb-lib/src/materializer/staking/materializer.rs rename to ks-lib/src/materializer/staking/materializer.rs index ed71b39..5adbbd4 100644 --- a/kb-lib/src/materializer/staking/materializer.rs +++ b/ks-lib/src/materializer/staking/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/staking/materializer.rs -// version: 12 +// file: ks-lib/src/materializer/staking/materializer.rs +// version: 13 //! Instruction-level staking projections for native Stake and Vote observations. @@ -66,7 +66,7 @@ impl crate::MtMaterializer for crate::MtStakingMaterializer { fn materialize_event( &self, event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { if !crate::MtMaterializer::accepts_event(self, event) { return std::result::Result::Ok(std::vec::Vec::new()); } diff --git a/kb-lib/src/materializer/token.rs b/ks-lib/src/materializer/token.rs similarity index 97% rename from kb-lib/src/materializer/token.rs rename to ks-lib/src/materializer/token.rs index 720326c..26a9683 100644 --- a/kb-lib/src/materializer/token.rs +++ b/ks-lib/src/materializer/token.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/token.rs -// version: 7 +// file: ks-lib/src/materializer/token.rs +// version: 8 //! `token` materializer family. diff --git a/kb-lib/src/materializer/token/accounts.rs b/ks-lib/src/materializer/token/accounts.rs similarity index 95% rename from kb-lib/src/materializer/token/accounts.rs rename to ks-lib/src/materializer/token/accounts.rs index 8957352..d45a2c9 100644 --- a/kb-lib/src/materializer/token/accounts.rs +++ b/ks-lib/src/materializer/token/accounts.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/token/accounts.rs -// version: 8 +// file: ks-lib/src/materializer/token/accounts.rs +// version: 9 //! Token, ATA and Token-2022 account materializer component. diff --git a/kb-lib/src/materializer/token/accounts/constants.rs b/ks-lib/src/materializer/token/accounts/constants.rs similarity index 96% rename from kb-lib/src/materializer/token/accounts/constants.rs rename to ks-lib/src/materializer/token/accounts/constants.rs index a7f7f6c..649d93a 100644 --- a/kb-lib/src/materializer/token/accounts/constants.rs +++ b/ks-lib/src/materializer/token/accounts/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/token/accounts/constants.rs -// version: 4 +// file: ks-lib/src/materializer/token/accounts/constants.rs +// version: 5 //! Local constants for the token accounts materializer. diff --git a/kb-lib/src/materializer/token/accounts/materializer.rs b/ks-lib/src/materializer/token/accounts/materializer.rs similarity index 97% rename from kb-lib/src/materializer/token/accounts/materializer.rs rename to ks-lib/src/materializer/token/accounts/materializer.rs index 6deec46..0dc6361 100644 --- a/kb-lib/src/materializer/token/accounts/materializer.rs +++ b/ks-lib/src/materializer/token/accounts/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/token/accounts/materializer.rs -// version: 9 +// file: ks-lib/src/materializer/token/accounts/materializer.rs +// version: 10 //! Stable committed SPL Token mutation and ATA lifecycle projections. @@ -23,7 +23,7 @@ impl crate::MtMaterializer for crate::MtTokenAccountsMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -136,9 +136,9 @@ impl crate::MtApiEventMaterializer for crate::MtTokenAccountsMaterializer { } fn accepts_event(event: &crate::MdDecodedProtocolEvent) -> bool { - let token_program = (event.program_id.0 == kb_program_ids::SPL_TOKEN_PROGRAM_ID + let token_program = (event.program_id.0 == ks_program_ids::SPL_TOKEN_PROGRAM_ID && event.surface_code.0 == "spl.token") - || (event.program_id.0 == kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID + || (event.program_id.0 == ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID && event.surface_code.0 == "spl.token_2022"); let token_mutation = token_program && crate::MT_TOKEN_ACCOUNTS_MUTATION_ENTRIES.contains(&event.event_name.0.as_str()); @@ -148,7 +148,7 @@ fn accepts_event(event: &crate::MdDecodedProtocolEvent) -> bool { } fn is_ata_event(event: &crate::MdDecodedProtocolEvent) -> bool { - return event.program_id.0 == kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID + return event.program_id.0 == ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID && event.surface_code.0 == "spl.associated_token_account" && event.event_family == crate::MdEventFamily::Lifecycle && crate::MT_TOKEN_ACCOUNTS_ATA_LIFECYCLE_ENTRIES @@ -282,8 +282,8 @@ fn validate_ata_addresses( .and_then(serde_json::Value::as_str); let token_program_exact = matches!( token_program_id, - std::option::Option::Some(kb_program_ids::SPL_TOKEN_PROGRAM_ID) - | std::option::Option::Some(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID) + std::option::Option::Some(ks_program_ids::SPL_TOKEN_PROGRAM_ID) + | std::option::Option::Some(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID) ); if !token_supported || !token_program_exact { return std::result::Result::Err(( @@ -407,7 +407,7 @@ pub fn materializer_token_materialize_token_2022_state_snapshot( "idempotenceKey": format!("token_2022_state:{account_key}:{slot}"), "accountKey": account_key, "slot": slot, - "programId": kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + "programId": ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, "stateKind": kind, "baseFields": state.base_fields, "baseHex": state.base_hex, @@ -440,7 +440,7 @@ mod tests { signature: crate::MdSignature("signature".to_string()), slot: crate::MdSlot(42), instruction_path: crate::MdInstructionPath("1/0".to_string()), - program_id: crate::MdProgramId(kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), + program_id: crate::MdProgramId(ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), protocol_code: crate::MdProtocolCode("spl.token".to_string()), surface_code: crate::MdSurfaceCode("spl.token".to_string()), event_code: crate::MdEventCode(format!("spl.token.{entry}")), @@ -476,7 +476,7 @@ mod tests { ) -> crate::DcApiDecodedObservation { let mut observation = observation(entry, family, failed); observation.event.program_id = - crate::MdProgramId(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); + crate::MdProgramId(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); observation.event.protocol_code = crate::MdProtocolCode("spl.token_2022".to_string()); observation.event.surface_code = crate::MdSurfaceCode("spl.token_2022".to_string()); observation.event.event_code = crate::MdEventCode(format!("spl.token_2022.{entry}")); @@ -488,7 +488,7 @@ mod tests { let addresses = if entry == "recover_nested" { serde_json::json!({ "tokenProgram": { - "programId": kb_program_ids::SPL_TOKEN_PROGRAM_ID, + "programId": ks_program_ids::SPL_TOKEN_PROGRAM_ID, "kind": "spl_token_classic", "supported": true }, @@ -502,7 +502,7 @@ mod tests { } else { serde_json::json!({ "tokenProgram": { - "programId": kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + "programId": ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, "kind": "token_2022", "supported": true }, @@ -519,7 +519,7 @@ mod tests { slot: crate::MdSlot(42), instruction_path: crate::MdInstructionPath("0".to_string()), program_id: crate::MdProgramId( - kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string(), + ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string(), ), protocol_code: crate::MdProtocolCode("spl.associated_token_account".to_string()), surface_code: crate::MdSurfaceCode("spl.associated_token_account".to_string()), @@ -569,7 +569,7 @@ mod tests { assert_eq!(result.outputs[0].payload_json["operation"], "transfer_checked"); assert_eq!( result.outputs[0].payload_json["programId"], - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID ); } @@ -603,18 +603,18 @@ mod tests { #[test] fn every_ata_variant_has_one_exact_lifecycle_projection() { for (entry, expected_kind, expected_ata, expected_token_program) in [ - ("create", "ata_created", "ata111", kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID), + ("create", "ata_created", "ata111", ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID), ( "create_idempotent", "ata_created_or_reused_idempotently", "ata111", - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, ), ( "recover_nested", "nested_ata_recovered", "nestedAta", - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, ), ] { let result = crate::MtApiEventMaterializer::materialize( diff --git a/kb-lib/src/materializer/token/metadata_risk.rs b/ks-lib/src/materializer/token/metadata_risk.rs similarity index 90% rename from kb-lib/src/materializer/token/metadata_risk.rs rename to ks-lib/src/materializer/token/metadata_risk.rs index b1c128b..82026a6 100644 --- a/kb-lib/src/materializer/token/metadata_risk.rs +++ b/ks-lib/src/materializer/token/metadata_risk.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/token/metadata_risk.rs -// version: 5 +// file: ks-lib/src/materializer/token/metadata_risk.rs +// version: 6 //! Token-metadata risk materializer component facade. diff --git a/kb-lib/src/materializer/token/metadata_risk/constants.rs b/ks-lib/src/materializer/token/metadata_risk/constants.rs similarity index 87% rename from kb-lib/src/materializer/token/metadata_risk/constants.rs rename to ks-lib/src/materializer/token/metadata_risk/constants.rs index e9edafc..4e93c94 100644 --- a/kb-lib/src/materializer/token/metadata_risk/constants.rs +++ b/ks-lib/src/materializer/token/metadata_risk/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/token/metadata_risk/constants.rs -// version: 2 +// file: ks-lib/src/materializer/token/metadata_risk/constants.rs +// version: 3 //! Local constants for the token metadata_risk materializer. diff --git a/kb-lib/src/materializer/token/metadata_risk/materializer.rs b/ks-lib/src/materializer/token/metadata_risk/materializer.rs similarity index 92% rename from kb-lib/src/materializer/token/metadata_risk/materializer.rs rename to ks-lib/src/materializer/token/metadata_risk/materializer.rs index f4219b1..d94527f 100644 --- a/kb-lib/src/materializer/token/metadata_risk/materializer.rs +++ b/ks-lib/src/materializer/token/metadata_risk/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/token/metadata_risk/materializer.rs -// version: 5 +// file: ks-lib/src/materializer/token/metadata_risk/materializer.rs +// version: 6 //! Reserved token-metadata risk materializer. @@ -23,7 +23,7 @@ impl crate::MtMaterializer for crate::MtTokenMetadataRiskMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/materializer/trades.rs b/ks-lib/src/materializer/trades.rs similarity index 90% rename from kb-lib/src/materializer/trades.rs rename to ks-lib/src/materializer/trades.rs index b581959..3e6a567 100644 --- a/kb-lib/src/materializer/trades.rs +++ b/ks-lib/src/materializer/trades.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/trades.rs -// version: 4 +// file: ks-lib/src/materializer/trades.rs +// version: 5 //! `trades` materializer family. diff --git a/kb-lib/src/materializer/trades/constants.rs b/ks-lib/src/materializer/trades/constants.rs similarity index 87% rename from kb-lib/src/materializer/trades/constants.rs rename to ks-lib/src/materializer/trades/constants.rs index fbf196c..152ebfc 100644 --- a/kb-lib/src/materializer/trades/constants.rs +++ b/ks-lib/src/materializer/trades/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/trades/constants.rs -// version: 1 +// file: ks-lib/src/materializer/trades/constants.rs +// version: 2 //! Local constants for the trades materializer. diff --git a/kb-lib/src/materializer/trades/materializer.rs b/ks-lib/src/materializer/trades/materializer.rs similarity index 92% rename from kb-lib/src/materializer/trades/materializer.rs rename to ks-lib/src/materializer/trades/materializer.rs index af87efc..cae4aed 100644 --- a/kb-lib/src/materializer/trades/materializer.rs +++ b/ks-lib/src/materializer/trades/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/trades/materializer.rs -// version: 5 +// file: ks-lib/src/materializer/trades/materializer.rs +// version: 6 //! Reserved trades materializer. @@ -23,7 +23,7 @@ impl crate::MtMaterializer for crate::MtTradesMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/materializer/transaction.rs b/ks-lib/src/materializer/transaction.rs similarity index 95% rename from kb-lib/src/materializer/transaction.rs rename to ks-lib/src/materializer/transaction.rs index 22c2c09..600377b 100644 --- a/kb-lib/src/materializer/transaction.rs +++ b/ks-lib/src/materializer/transaction.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/transaction.rs -// version: 4 +// file: ks-lib/src/materializer/transaction.rs +// version: 5 //! `transaction` materializer family. diff --git a/kb-lib/src/materializer/transaction/annotations.rs b/ks-lib/src/materializer/transaction/annotations.rs similarity index 94% rename from kb-lib/src/materializer/transaction/annotations.rs rename to ks-lib/src/materializer/transaction/annotations.rs index 5a140fa..d2c7d3e 100644 --- a/kb-lib/src/materializer/transaction/annotations.rs +++ b/ks-lib/src/materializer/transaction/annotations.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/transaction/annotations.rs -// version: 6 +// file: ks-lib/src/materializer/transaction/annotations.rs +// version: 7 //! Committed Memo transaction annotation materializer component. diff --git a/kb-lib/src/materializer/transaction/annotations/constants.rs b/ks-lib/src/materializer/transaction/annotations/constants.rs similarity index 94% rename from kb-lib/src/materializer/transaction/annotations/constants.rs rename to ks-lib/src/materializer/transaction/annotations/constants.rs index cb0ea73..6f784e6 100644 --- a/kb-lib/src/materializer/transaction/annotations/constants.rs +++ b/ks-lib/src/materializer/transaction/annotations/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/transaction/annotations/constants.rs -// version: 5 +// file: ks-lib/src/materializer/transaction/annotations/constants.rs +// version: 6 //! Local constants for the transaction annotations materializer. diff --git a/kb-lib/src/materializer/transaction/annotations/materializer.rs b/ks-lib/src/materializer/transaction/annotations/materializer.rs similarity index 97% rename from kb-lib/src/materializer/transaction/annotations/materializer.rs rename to ks-lib/src/materializer/transaction/annotations/materializer.rs index bf48632..780f9dd 100644 --- a/kb-lib/src/materializer/transaction/annotations/materializer.rs +++ b/ks-lib/src/materializer/transaction/annotations/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/transaction/annotations/materializer.rs -// version: 7 +// file: ks-lib/src/materializer/transaction/annotations/materializer.rs +// version: 8 //! Exact committed SPL Memo transaction annotation projection. @@ -12,17 +12,17 @@ enum MemoGeneration { impl MemoGeneration { fn from_event(event: &crate::MdDecodedProtocolEvent) -> std::option::Option { - if event.program_id.0 == kb_program_ids::SPL_MEMO_V1_PROGRAM_ID + if event.program_id.0 == ks_program_ids::SPL_MEMO_V1_PROGRAM_ID && event.surface_code.0 == "spl.memo.v1" { return std::option::Option::Some(Self::V1); } - if event.program_id.0 == kb_program_ids::SPL_MEMO_V3_PROGRAM_ID + if event.program_id.0 == ks_program_ids::SPL_MEMO_V3_PROGRAM_ID && event.surface_code.0 == "spl.memo.v3" { return std::option::Option::Some(Self::V3); } - if event.program_id.0 == kb_program_ids::SPL_MEMO_V4_PROGRAM_ID + if event.program_id.0 == ks_program_ids::SPL_MEMO_V4_PROGRAM_ID && event.surface_code.0 == "spl.memo.v4" { return std::option::Option::Some(Self::V4); @@ -77,7 +77,7 @@ impl crate::MtMaterializer for crate::MtTransactionAnnotationMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -462,7 +462,7 @@ mod tests { fn v4() -> crate::DcApiDecodedObservation { return observation( - kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, "spl.memo.v4", "v4", "add_memo", @@ -496,9 +496,9 @@ mod tests { #[test] fn exact_v1_v3_and_v4_surfaces_are_accepted() { for (program_id, surface, generation) in [ - (kb_program_ids::SPL_MEMO_V1_PROGRAM_ID, "spl.memo.v1", "v1"), - (kb_program_ids::SPL_MEMO_V3_PROGRAM_ID, "spl.memo.v3", "v3"), - (kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, "spl.memo.v4", "v4"), + (ks_program_ids::SPL_MEMO_V1_PROGRAM_ID, "spl.memo.v1", "v1"), + (ks_program_ids::SPL_MEMO_V3_PROGRAM_ID, "spl.memo.v3", "v3"), + (ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, "spl.memo.v4", "v4"), ] { let observation = observation( program_id, @@ -520,7 +520,7 @@ mod tests { #[test] fn v1_observed_accounts_are_not_claimed_as_runtime_verified() { let observation = observation( - kb_program_ids::SPL_MEMO_V1_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V1_PROGRAM_ID, "spl.memo.v1", "v1", "add_memo", @@ -543,7 +543,7 @@ mod tests { #[test] fn failed_or_uncommitted_memo_is_refused_without_output() { let observation = observation( - kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, "spl.memo.v4", "v4", "memo_intent", @@ -599,7 +599,7 @@ mod tests { std::result::Result::Err(error) => panic!("memo matrix is invalid JSON: {error}"), }; assert_eq!(matrix["matrixVersion"], 4); - assert_eq!(matrix["materializationContract"]["crate"], "kb-lib"); + assert_eq!(matrix["materializationContract"]["crate"], "ks-lib"); assert_eq!( matrix["materializationContract"]["transactionPolicy"], "SuccessfulCommittedOnly" diff --git a/kb-lib/src/materializer/vault.rs b/ks-lib/src/materializer/vault.rs similarity index 90% rename from kb-lib/src/materializer/vault.rs rename to ks-lib/src/materializer/vault.rs index 4630cd7..b64f251 100644 --- a/kb-lib/src/materializer/vault.rs +++ b/ks-lib/src/materializer/vault.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/vault.rs -// version: 4 +// file: ks-lib/src/materializer/vault.rs +// version: 5 //! `vault` materializer family. diff --git a/kb-lib/src/materializer/vault/constants.rs b/ks-lib/src/materializer/vault/constants.rs similarity index 87% rename from kb-lib/src/materializer/vault/constants.rs rename to ks-lib/src/materializer/vault/constants.rs index 44dbbb7..a2dd279 100644 --- a/kb-lib/src/materializer/vault/constants.rs +++ b/ks-lib/src/materializer/vault/constants.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/vault/constants.rs -// version: 1 +// file: ks-lib/src/materializer/vault/constants.rs +// version: 2 //! Local constants for the vault materializer. diff --git a/kb-lib/src/materializer/vault/materializer.rs b/ks-lib/src/materializer/vault/materializer.rs similarity index 92% rename from kb-lib/src/materializer/vault/materializer.rs rename to ks-lib/src/materializer/vault/materializer.rs index 05421be..f16fc1a 100644 --- a/kb-lib/src/materializer/vault/materializer.rs +++ b/ks-lib/src/materializer/vault/materializer.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/materializer/vault/materializer.rs -// version: 5 +// file: ks-lib/src/materializer/vault/materializer.rs +// version: 6 //! Reserved vault materializer. @@ -23,7 +23,7 @@ impl crate::MtMaterializer for crate::MtVaultMaterializer { fn materialize_event( &self, _event: &crate::MdDecodedProtocolEvent, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-lib/src/model.rs b/ks-lib/src/model.rs similarity index 98% rename from kb-lib/src/model.rs rename to ks-lib/src/model.rs index 549436f..914342b 100644 --- a/kb-lib/src/model.rs +++ b/ks-lib/src/model.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/model.rs -// version: 3 +// file: ks-lib/src/model.rs +// version: 4 //! Shared canonical models. diff --git a/kb-lib/src/model/canonical_transaction.rs b/ks-lib/src/model/canonical_transaction.rs similarity index 92% rename from kb-lib/src/model/canonical_transaction.rs rename to ks-lib/src/model/canonical_transaction.rs index 3f10d93..d16e184 100644 --- a/kb-lib/src/model/canonical_transaction.rs +++ b/ks-lib/src/model/canonical_transaction.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/model/canonical_transaction.rs -// version: 7 +// file: ks-lib/src/model/canonical_transaction.rs +// version: 8 //! Source-independent canonical Solana transaction contract. @@ -33,9 +33,9 @@ pub struct MdCanonicalTransaction { impl MdCanonicalTransaction { /// Validates the canonical transaction invariants. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.format_version != crate::MD_CANONICAL_TRANSACTION_FORMAT_VERSION { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "unsupported canonical transaction format version: {}", self.format_version ))); @@ -48,17 +48,17 @@ impl MdCanonicalTransaction { return std::result::Result::Err(error); } if self.signatures.is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical transaction must contain at least one signature", )); } if self.signatures[0] != self.primary_signature { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "primary transaction signature must equal the first signature", )); } if self.signatures.len() != usize::from(self.message.header.num_required_signatures) { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical signature count must match the message header", )); } @@ -78,7 +78,7 @@ impl MdCanonicalTransaction { || !self.message.loaded_addresses.writable.is_empty() || !self.message.loaded_addresses.readonly.is_empty()) { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "legacy canonical transaction must not contain lookup table data", )); } @@ -93,7 +93,7 @@ impl MdCanonicalTransaction { } /// Serializes the transaction into the canonical JSON value. - pub fn to_canonical_json(&self) -> kb_core::Result { + pub fn to_canonical_json(&self) -> ks_core::Result { let validation_result = self.validate(); if let std::result::Result::Err(error) = validation_result { return std::result::Result::Err(error); @@ -102,7 +102,7 @@ impl MdCanonicalTransaction { let mut value = match serialization_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot serialize canonical transaction: {error}" ))); }, @@ -112,7 +112,7 @@ impl MdCanonicalTransaction { } /// Serializes the transaction into deterministic compact canonical JSON bytes. - pub fn to_canonical_json_bytes(&self) -> kb_core::Result> { + pub fn to_canonical_json_bytes(&self) -> ks_core::Result> { let json_result = self.to_canonical_json(); let json = match json_result { std::result::Result::Ok(value) => value, @@ -121,14 +121,14 @@ impl MdCanonicalTransaction { let serialization_result = serde_json::to_vec(&json); return match serialization_result { std::result::Result::Ok(bytes) => std::result::Result::Ok(bytes), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::json( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::json( format!("cannot serialize canonical transaction bytes: {error}"), )), }; } /// Calculates the lowercase SHA-256 digest of the canonical JSON bytes. - pub fn canonical_json_hash(&self) -> kb_core::Result { + pub fn canonical_json_hash(&self) -> ks_core::Result { let bytes_result = self.to_canonical_json_bytes(); let bytes = match bytes_result { std::result::Result::Ok(bytes) => bytes, @@ -191,9 +191,9 @@ impl MdCanonicalTransactionMessage { + self.loaded_addresses.readonly.len(); } - fn validate(&self) -> kb_core::Result<()> { + fn validate(&self) -> ks_core::Result<()> { if self.static_account_keys.is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical transaction message must contain static account keys", )); } @@ -212,18 +212,18 @@ impl MdCanonicalTransactionMessage { if required_signature_count == 0 || required_signature_count > self.static_account_keys.len() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical message required signature count is invalid", )); } if usize::from(self.header.num_readonly_signed_accounts) > required_signature_count { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical readonly signed account count is invalid", )); } let unsigned_account_count = self.static_account_keys.len() - required_signature_count; if usize::from(self.header.num_readonly_unsigned_accounts) > unsigned_account_count { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical readonly unsigned account count is invalid", )); } @@ -274,15 +274,15 @@ pub struct MdCanonicalCompiledInstruction { } impl MdCanonicalCompiledInstruction { - fn validate(&self, resolved_account_count: usize) -> kb_core::Result<()> { + fn validate(&self, resolved_account_count: usize) -> ks_core::Result<()> { if usize::from(self.program_id_index) >= resolved_account_count { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical instruction program id index is outside resolved accounts", )); } for account_index in &self.account_indexes { if usize::from(*account_index) >= resolved_account_count { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical instruction account index is outside resolved accounts", )); } @@ -290,7 +290,7 @@ impl MdCanonicalCompiledInstruction { let decode_result = base64::engine::general_purpose::STANDARD.decode(self.data_base64.as_bytes()); if let std::result::Result::Err(error) = decode_result { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "canonical instruction data is not valid base64: {error}" ))); } @@ -367,28 +367,28 @@ impl MdCanonicalTransactionMetadata { &self, resolved_account_count: usize, top_level_instruction_count: usize, - ) -> kb_core::Result<()> { + ) -> ks_core::Result<()> { if self.pre_balances.len() != self.post_balances.len() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical pre and post balance arrays must have the same length", )); } if self.pre_balances.len() != resolved_account_count { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical balance arrays must match the resolved account count", )); } match self.status { MdCanonicalTransactionStatus::Success => { if self.error.is_some() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "successful canonical transaction must not contain an error", )); } }, MdCanonicalTransactionStatus::Failed => { if self.error.is_none() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "failed canonical transaction must contain an error", )); } @@ -396,7 +396,7 @@ impl MdCanonicalTransactionMetadata { } for inner_group in &self.inner_instructions { if usize::from(inner_group.parent_instruction_index) >= top_level_instruction_count { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical inner instruction parent index is outside top-level instructions", )); } @@ -426,7 +426,7 @@ impl MdCanonicalTransactionMetadata { } if let std::option::Option::Some(commission) = reward.commission { if commission > 100 { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical reward commission must not exceed 100 percent", )); } @@ -441,7 +441,7 @@ impl MdCanonicalTransactionMetadata { let decode_result = base64::engine::general_purpose::STANDARD .decode(return_data.data_base64.as_bytes()); if let std::result::Result::Err(error) = decode_result { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "canonical return data is not valid base64: {error}" ))); } @@ -489,7 +489,7 @@ impl MdCanonicalTokenBalance { program_id: std::option::Option, amount: impl std::convert::Into, decimals: u8, - ) -> kb_core::Result { + ) -> ks_core::Result { let amount_value = amount.into(); let normalized_result = normalize_unsigned_decimal(amount_value.as_str()); let normalized_amount = match normalized_result { @@ -512,9 +512,9 @@ impl MdCanonicalTokenBalance { }); } - fn validate(&self, resolved_account_count: usize) -> kb_core::Result<()> { + fn validate(&self, resolved_account_count: usize) -> ks_core::Result<()> { if usize::from(self.account_index) >= resolved_account_count { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical token balance account index is outside resolved accounts", )); } @@ -541,7 +541,7 @@ impl MdCanonicalTokenBalance { std::result::Result::Err(error) => return std::result::Result::Err(error), }; if self.decimal_amount != expected_decimal_amount { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical token balance decimal amount does not match amount and decimals", )); } @@ -575,9 +575,9 @@ pub struct MdCanonicalReturnData { pub data_base64: std::string::String, } -fn normalize_unsigned_decimal(amount: &str) -> kb_core::Result { +fn normalize_unsigned_decimal(amount: &str) -> ks_core::Result { if amount.is_empty() || !amount.chars().all(|character| return character.is_ascii_digit()) { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical token balance amount must be an unsigned decimal string", )); } @@ -588,7 +588,7 @@ fn normalize_unsigned_decimal(amount: &str) -> kb_core::Result kb_core::Result { +fn exact_decimal_amount(amount: &str, decimals: u8) -> ks_core::Result { let normalized_result = normalize_unsigned_decimal(amount); let normalized = match normalized_result { std::result::Result::Ok(value) => value, @@ -634,11 +634,11 @@ fn sort_json_value(value: &mut serde_json::Value) { } } -fn validate_signature_text(value: &str, field_name: &str) -> kb_core::Result<()> { +fn validate_signature_text(value: &str, field_name: &str) -> ks_core::Result<()> { return validate_base58_length(value, field_name, 64); } -fn validate_pubkey_text(value: &str, field_name: &str) -> kb_core::Result<()> { +fn validate_pubkey_text(value: &str, field_name: &str) -> ks_core::Result<()> { return validate_base58_length(value, field_name, 32); } @@ -646,9 +646,9 @@ fn validate_base58_length( value: &str, field_name: &str, expected_length: usize, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "{field_name} must not be empty" ))); } @@ -656,13 +656,13 @@ fn validate_base58_length( let decoded = match decode_result { std::result::Result::Ok(bytes) => bytes, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "{field_name} is not valid base58: {error}" ))); }, }; if decoded.len() != expected_length { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "{field_name} must decode to {expected_length} bytes" ))); } diff --git a/kb-lib/src/model/decoded.rs b/ks-lib/src/model/decoded.rs similarity index 89% rename from kb-lib/src/model/decoded.rs rename to ks-lib/src/model/decoded.rs index d4106dd..89f6f99 100644 --- a/kb-lib/src/model/decoded.rs +++ b/ks-lib/src/model/decoded.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/model/decoded.rs -// version: 5 +// file: ks-lib/src/model/decoded.rs +// version: 6 //! Shared decoded protocol event model. @@ -9,7 +9,7 @@ use ts_rs::TS; // rust-rules: derive-import #[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/model/decoded/EventSourceKind.ts" + export_to = "../frontend/ts/bindings/ks_lib/model/decoded/EventSourceKind.ts" )] pub enum MdEventSourceKind { /// Top-level instruction. @@ -36,7 +36,7 @@ pub enum MdEventSourceKind { #[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/model/decoded/DecoderConfidence.ts" + export_to = "../frontend/ts/bindings/ks_lib/model/decoded/DecoderConfidence.ts" )] pub enum MdDecoderConfidence { /// Exact manual decode. @@ -59,7 +59,7 @@ pub enum MdDecoderConfidence { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/model/decoded/DecodedProtocolEvent.ts" + export_to = "../frontend/ts/bindings/ks_lib/model/decoded/DecodedProtocolEvent.ts" )] pub struct MdDecodedProtocolEvent { /// Transaction signature. diff --git a/kb-lib/src/model/materialized.rs b/ks-lib/src/model/materialized.rs similarity index 91% rename from kb-lib/src/model/materialized.rs rename to ks-lib/src/model/materialized.rs index d891de0..9ffa6d3 100644 --- a/kb-lib/src/model/materialized.rs +++ b/ks-lib/src/model/materialized.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/model/materialized.rs -// version: 6 +// file: ks-lib/src/model/materialized.rs +// version: 7 //! Shared materialized business event model. @@ -9,7 +9,7 @@ use ts_rs::TS; // rust-rules: derive-import #[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/model/materialized/MaterializedEventFamily.ts" + export_to = "../frontend/ts/bindings/ks_lib/model/materialized/MaterializedEventFamily.ts" )] pub enum MdMaterializedEventFamily { /// Trade materialization. @@ -66,7 +66,7 @@ pub enum MdMaterializedEventFamily { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/model/materialized/MaterializedEvent.ts" + export_to = "../frontend/ts/bindings/ks_lib/model/materialized/MaterializedEvent.ts" )] pub struct MdMaterializedEvent { /// Source transaction signature. diff --git a/kb-lib/src/model/nomenclature.rs b/ks-lib/src/model/nomenclature.rs similarity index 85% rename from kb-lib/src/model/nomenclature.rs rename to ks-lib/src/model/nomenclature.rs index 505865c..2934e85 100644 --- a/kb-lib/src/model/nomenclature.rs +++ b/ks-lib/src/model/nomenclature.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/model/nomenclature.rs -// version: 5 +// file: ks-lib/src/model/nomenclature.rs +// version: 6 //! Shared protocol, surface, and event nomenclature types. @@ -9,7 +9,7 @@ use ts_rs::TS; // rust-rules: derive-import #[derive(Clone, Debug, Eq, PartialEq, Hash, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/model/nomenclature/ProgramCode.ts" + export_to = "../frontend/ts/bindings/ks_lib/model/nomenclature/ProgramCode.ts" )] pub struct MdProgramCode(pub std::string::String); @@ -17,7 +17,7 @@ pub struct MdProgramCode(pub std::string::String); #[derive(Clone, Debug, Eq, PartialEq, Hash, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/model/nomenclature/ProtocolCode.ts" + export_to = "../frontend/ts/bindings/ks_lib/model/nomenclature/ProtocolCode.ts" )] pub struct MdProtocolCode(pub std::string::String); @@ -25,7 +25,7 @@ pub struct MdProtocolCode(pub std::string::String); #[derive(Clone, Debug, Eq, PartialEq, Hash, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/model/nomenclature/SurfaceCode.ts" + export_to = "../frontend/ts/bindings/ks_lib/model/nomenclature/SurfaceCode.ts" )] pub struct MdSurfaceCode(pub std::string::String); @@ -33,7 +33,7 @@ pub struct MdSurfaceCode(pub std::string::String); #[derive(Clone, Debug, Eq, PartialEq, Hash, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/model/nomenclature/EventName.ts" + export_to = "../frontend/ts/bindings/ks_lib/model/nomenclature/EventName.ts" )] pub struct MdEventName(pub std::string::String); @@ -41,7 +41,7 @@ pub struct MdEventName(pub std::string::String); #[derive(Clone, Debug, Eq, PartialEq, Hash, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/model/nomenclature/EventCode.ts" + export_to = "../frontend/ts/bindings/ks_lib/model/nomenclature/EventCode.ts" )] pub struct MdEventCode(pub std::string::String); @@ -49,7 +49,7 @@ pub struct MdEventCode(pub std::string::String); #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/model/nomenclature/EventFamily.ts" + export_to = "../frontend/ts/bindings/ks_lib/model/nomenclature/EventFamily.ts" )] pub enum MdEventFamily { /// Swap or buy/sell event. diff --git a/kb-lib/src/model/observation.rs b/ks-lib/src/model/observation.rs similarity index 88% rename from kb-lib/src/model/observation.rs rename to ks-lib/src/model/observation.rs index 84c4c6a..97f5f4d 100644 --- a/kb-lib/src/model/observation.rs +++ b/ks-lib/src/model/observation.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/model/observation.rs -// version: 5 +// file: ks-lib/src/model/observation.rs +// version: 6 //! Shared program observation model. @@ -9,7 +9,7 @@ use ts_rs::TS; // rust-rules: derive-import #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/model/observation/ProgramObservation.ts" + export_to = "../frontend/ts/bindings/ks_lib/model/observation/ProgramObservation.ts" )] pub struct MdProgramObservation { /// Transaction signature. diff --git a/kb-lib/src/model/replay.rs b/ks-lib/src/model/replay.rs similarity index 92% rename from kb-lib/src/model/replay.rs rename to ks-lib/src/model/replay.rs index 1e18fc8..68c3679 100644 --- a/kb-lib/src/model/replay.rs +++ b/ks-lib/src/model/replay.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/model/replay.rs -// version: 3 +// file: ks-lib/src/model/replay.rs +// version: 4 //! Source-neutral instruction replay input shared by decoders and stores. @@ -64,9 +64,9 @@ impl MdCoreInstructionReplayInput { inner_instructions_json: serde_json::Value, logs_json: serde_json::Value, balance_changes_json: serde_json::Value, - ) -> kb_core::Result { + ) -> ks_core::Result { if !outer_instructions_json.is_array() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "core replay input outer instructions must be a JSON array", )); } @@ -97,9 +97,9 @@ impl MdCoreInstructionReplayInput { } /// Validates the stable replay identity and contract version. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.core_contract_version != crate::MD_CORE_REPLAY_INPUT_CONTRACT_VERSION { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "unsupported core replay input contract version", )); } @@ -108,7 +108,7 @@ impl MdCoreInstructionReplayInput { || self.instruction_path.trim().is_empty() || self.program_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "core replay identity fields must not be empty", )); } @@ -117,7 +117,7 @@ impl MdCoreInstructionReplayInput { .as_deref() .is_some_and(|value| return value.trim().is_empty()) { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "core replay payload hash must not be empty when present", )); } @@ -128,12 +128,12 @@ impl MdCoreInstructionReplayInput { pub fn with_surface_code_hint( mut self, surface_code_hint: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { if surface_code_hint .as_deref() .is_some_and(|surface| return surface.trim().is_empty()) { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "core replay input surface hint must not be empty when present", )); } diff --git a/kb-lib/src/model/solana.rs b/ks-lib/src/model/solana.rs similarity index 74% rename from kb-lib/src/model/solana.rs rename to ks-lib/src/model/solana.rs index f22917c..068950d 100644 --- a/kb-lib/src/model/solana.rs +++ b/ks-lib/src/model/solana.rs @@ -1,5 +1,5 @@ -// file: kb-lib/src/model/solana.rs -// version: 5 +// file: ks-lib/src/model/solana.rs +// version: 6 //! Shared Solana primitive wrapper types. @@ -7,7 +7,7 @@ use ts_rs::TS; // rust-rules: derive-import /// Solana transaction signature. #[derive(Clone, Debug, Eq, PartialEq, Hash, serde::Deserialize, serde::Serialize, TS)] -#[ts(export, export_to = "../frontend/ts/bindings/kb_lib/model/solana/MdSignature.ts")] +#[ts(export, export_to = "../frontend/ts/bindings/ks_lib/model/solana/MdSignature.ts")] pub struct MdSignature(pub std::string::String); /// Solana slot. @@ -24,23 +24,23 @@ pub struct MdSignature(pub std::string::String); serde::Serialize, TS, )] -#[ts(export, export_to = "../frontend/ts/bindings/kb_lib/model/solana/MdSlot.ts")] +#[ts(export, export_to = "../frontend/ts/bindings/ks_lib/model/solana/MdSlot.ts")] pub struct MdSlot(pub u64); /// Solana program id. #[derive(Clone, Debug, Eq, PartialEq, Hash, serde::Deserialize, serde::Serialize, TS)] -#[ts(export, export_to = "../frontend/ts/bindings/kb_lib/model/solana/MdProgramId.ts")] +#[ts(export, export_to = "../frontend/ts/bindings/ks_lib/model/solana/MdProgramId.ts")] pub struct MdProgramId(pub std::string::String); /// Solana public key. #[derive(Clone, Debug, Eq, PartialEq, Hash, serde::Deserialize, serde::Serialize, TS)] -#[ts(export, export_to = "../frontend/ts/bindings/kb_lib/model/solana/MdPubkey.ts")] +#[ts(export, export_to = "../frontend/ts/bindings/ks_lib/model/solana/MdPubkey.ts")] pub struct MdPubkey(pub std::string::String); /// Stable top-level or inner instruction path. #[derive(Clone, Debug, Eq, PartialEq, Hash, serde::Deserialize, serde::Serialize, TS)] #[ts( export, - export_to = "../frontend/ts/bindings/kb_lib/model/solana/MdInstructionPath.ts" + export_to = "../frontend/ts/bindings/ks_lib/model/solana/MdInstructionPath.ts" )] pub struct MdInstructionPath(pub std::string::String); diff --git a/kb-lib/tests/external_decoder_api.rs b/ks-lib/tests/external_decoder_api.rs similarity index 58% rename from kb-lib/tests/external_decoder_api.rs rename to ks-lib/tests/external_decoder_api.rs index 6da1411..87a12c2 100644 --- a/kb-lib/tests/external_decoder_api.rs +++ b/ks-lib/tests/external_decoder_api.rs @@ -1,11 +1,11 @@ -// file: kb-lib/tests/external_decoder_api.rs -// version: 1 +// file: ks-lib/tests/external_decoder_api.rs +// version: 2 //! Downstream-style compilation contract for externally implemented decoders. struct ExternalDecoder; -impl kb_lib::DcApiProtocolDecoder for ExternalDecoder { +impl ks_lib::DcApiProtocolDecoder for ExternalDecoder { fn decoder_name(&self) -> &'static str { return "external_decoder"; } @@ -20,22 +20,22 @@ impl kb_lib::DcApiProtocolDecoder for ExternalDecoder { fn supports_observation( &self, - _observation: &kb_lib::MdProgramObservation, - ) -> kb_lib::DcApiDecoderSupport { - return kb_lib::DcApiDecoderSupport::No; + _observation: &ks_lib::MdProgramObservation, + ) -> ks_lib::DcApiDecoderSupport { + return ks_lib::DcApiDecoderSupport::No; } fn decode_observation( &self, - _observation: &kb_lib::MdProgramObservation, - ) -> kb_core::Result> { + _observation: &ks_lib::MdProgramObservation, + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } #[test] -fn external_decoder_uses_only_the_public_kb_lib_contract() { - let decoder: &dyn kb_lib::DcApiProtocolDecoder = &ExternalDecoder; +fn external_decoder_uses_only_the_public_ks_lib_contract() { + let decoder: &dyn ks_lib::DcApiProtocolDecoder = &ExternalDecoder; assert_eq!(decoder.decoder_name(), "external_decoder"); assert_eq!(decoder.decoder_version(), "1"); assert!(decoder.program_ids().is_empty()); diff --git a/kb-lib/tests/external_executor_api.rs b/ks-lib/tests/external_executor_api.rs similarity index 57% rename from kb-lib/tests/external_executor_api.rs rename to ks-lib/tests/external_executor_api.rs index d655ecb..9b6b35b 100644 --- a/kb-lib/tests/external_executor_api.rs +++ b/ks-lib/tests/external_executor_api.rs @@ -1,5 +1,5 @@ -// file: kb-lib/tests/external_executor_api.rs -// version: 4 +// file: ks-lib/tests/external_executor_api.rs +// version: 5 //! Downstream-style compilation contract for externally implemented executors. @@ -7,7 +7,7 @@ struct ExternalExecutor; struct ExternalTypedExecutor; -impl kb_lib::ExApiInstructionExecutor for ExternalExecutor { +impl ks_lib::ExApiInstructionExecutor for ExternalExecutor { fn executor_name(&self) -> &'static str { return "external_executor"; } @@ -22,16 +22,16 @@ impl kb_lib::ExApiInstructionExecutor for ExternalExecutor { fn supports_request( &self, - _request: &kb_lib::ExApiExecutionRequest, - ) -> kb_lib::ExApiExecutionSupport { - return kb_lib::ExApiExecutionSupport::No; + _request: &ks_lib::ExApiExecutionRequest, + ) -> ks_lib::ExApiExecutionSupport { + return ks_lib::ExApiExecutionSupport::No; } fn build_plan( &self, - request: &kb_lib::ExApiExecutionRequest, - ) -> kb_core::Result { - return std::result::Result::Ok(kb_lib::ExApiExecutionPlan { + request: &ks_lib::ExApiExecutionRequest, + ) -> ks_core::Result { + return std::result::Result::Ok(ks_lib::ExApiExecutionPlan { executor_name: self.executor_name().to_string(), instruction_count: 0, payload_json: request.payload_json.clone(), @@ -39,22 +39,22 @@ impl kb_lib::ExApiInstructionExecutor for ExternalExecutor { } } -impl kb_lib::ExApiTypedInstructionExecutor for ExternalTypedExecutor { - type Intent = kb_lib::MdPubkey; +impl ks_lib::ExApiTypedInstructionExecutor for ExternalTypedExecutor { + type Intent = ks_lib::MdPubkey; fn capability( &self, - _program_id: &kb_lib::MdProgramId, + _program_id: &ks_lib::MdProgramId, operation_code: &str, - ) -> kb_lib::ExApiExecutionCapability { - return kb_lib::ExApiExecutionCapability::unsupported("external_executor", operation_code); + ) -> ks_lib::ExApiExecutionCapability { + return ks_lib::ExApiExecutionCapability::unsupported("external_executor", operation_code); } fn build_prepared_plan( &self, intent: &Self::Intent, - ) -> kb_core::Result { - return std::result::Result::Ok(kb_lib::ExApiPreparedExecutionPlan { + ) -> ks_core::Result { + return std::result::Result::Ok(ks_lib::ExApiPreparedExecutionPlan { executor_name: "external_typed_executor".to_string(), executor_version: "1".to_string(), intent_id: "external-intent".to_string(), @@ -62,7 +62,7 @@ impl kb_lib::ExApiTypedInstructionExecutor for ExternalTypedExecutor { fee_payer: intent.clone(), instructions: std::vec::Vec::new(), required_signers: std::vec::Vec::new(), - policy: kb_lib::ExApiExecutionPolicy::default(), + policy: ks_lib::ExApiExecutionPolicy::default(), requested_spend_lamports: 0, requested_compute_unit_price_micro_lamports: std::option::Option::None, }); @@ -70,44 +70,44 @@ impl kb_lib::ExApiTypedInstructionExecutor for ExternalTypedExecutor { } #[test] -fn external_executor_uses_only_the_public_kb_lib_contract() { - let executor: &dyn kb_lib::ExApiInstructionExecutor = &ExternalExecutor; +fn external_executor_uses_only_the_public_ks_lib_contract() { + let executor: &dyn ks_lib::ExApiInstructionExecutor = &ExternalExecutor; assert_eq!(executor.executor_name(), "external_executor"); assert_eq!(executor.executor_version(), "1"); assert!(executor.program_ids().is_empty()); let typed_executor = ExternalTypedExecutor; - let program_id = kb_lib::MdProgramId("external-program".to_string()); - let capability = kb_lib::ExApiTypedInstructionExecutor::capability( + let program_id = ks_lib::MdProgramId("external-program".to_string()); + let capability = ks_lib::ExApiTypedInstructionExecutor::capability( &typed_executor, &program_id, "external-operation", ); assert!(!capability.is_supported()); - let fee_payer = kb_lib::MdPubkey("external-fee-payer".to_string()); + let fee_payer = ks_lib::MdPubkey("external-fee-payer".to_string()); let plan = - kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan(&typed_executor, &fee_payer) + ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan(&typed_executor, &fee_payer) .unwrap_or_else(|error| panic!("external typed executor failed: {error}")); assert_eq!(plan.fee_payer, fee_payer); assert!(plan.instructions.is_empty()); assert!(plan.required_signers.is_empty()); - assert_eq!(plan.policy.simulation, kb_lib::ExApiExecutionSimulationPolicy::Required); + assert_eq!(plan.policy.simulation, ks_lib::ExApiExecutionSimulationPolicy::Required); assert!(plan.policy.dry_run); - let solana_core_executor = kb_lib::ExSolanaCoreExecutor; + let solana_core_executor = ks_lib::ExSolanaCoreExecutor; let solana_core_program_id = - kb_lib::MdProgramId(kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID.to_string()); - let solana_core_capability = kb_lib::ExApiTypedInstructionExecutor::capability( + ks_lib::MdProgramId(ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID.to_string()); + let solana_core_capability = ks_lib::ExApiTypedInstructionExecutor::capability( &solana_core_executor, &solana_core_program_id, - kb_lib::EX_SOLANA_CORE_COMPUTE_BUDGET_SET_UNIT_LIMIT_OPERATION, + ks_lib::EX_SOLANA_CORE_COMPUTE_BUDGET_SET_UNIT_LIMIT_OPERATION, ); assert!(solana_core_capability.is_supported()); - let solana_core_intent = kb_lib::ExSolanaCoreExecutionIntent { + let solana_core_intent = ks_lib::ExSolanaCoreExecutionIntent { intent_id: "external-solana-core".to_string(), - fee_payer: kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), - policy: kb_lib::ExApiExecutionPolicy::default(), - operation: kb_lib::ExSolanaCoreOperation::ComputeBudgetSetUnitLimit { units: 500_000 }, + fee_payer: ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), + policy: ks_lib::ExApiExecutionPolicy::default(), + operation: ks_lib::ExSolanaCoreOperation::ComputeBudgetSetUnitLimit { units: 500_000 }, }; - let solana_core_plan = kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan( + let solana_core_plan = ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan( &solana_core_executor, &solana_core_intent, ) @@ -115,51 +115,51 @@ fn external_executor_uses_only_the_public_kb_lib_contract() { assert_eq!(solana_core_plan.instructions.len(), 1); assert_eq!( solana_core_plan.operation_code, - kb_lib::EX_SOLANA_CORE_COMPUTE_BUDGET_SET_UNIT_LIMIT_OPERATION + ks_lib::EX_SOLANA_CORE_COMPUTE_BUDGET_SET_UNIT_LIMIT_OPERATION ); - let memo_executor = kb_lib::ExSplMemoExecutor; - let memo_program_id = kb_lib::MdProgramId(kb_program_ids::SPL_MEMO_V4_PROGRAM_ID.to_string()); - let memo_capability = kb_lib::ExApiTypedInstructionExecutor::capability( + let memo_executor = ks_lib::ExSplMemoExecutor; + let memo_program_id = ks_lib::MdProgramId(ks_program_ids::SPL_MEMO_V4_PROGRAM_ID.to_string()); + let memo_capability = ks_lib::ExApiTypedInstructionExecutor::capability( &memo_executor, &memo_program_id, - kb_lib::EX_SPL_MEMO_ADD_MEMO_OPERATION, + ks_lib::EX_SPL_MEMO_ADD_MEMO_OPERATION, ); assert!(memo_capability.is_supported()); - let memo_intent = kb_lib::ExSplMemoExecutionIntent { + let memo_intent = ks_lib::ExSplMemoExecutionIntent { intent_id: "external-spl-memo".to_string(), - fee_payer: kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), - policy: kb_lib::ExApiExecutionPolicy { - cost_limit: kb_lib::ExApiExecutionCostLimit { + fee_payer: ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), + policy: ks_lib::ExApiExecutionPolicy { + cost_limit: ks_lib::ExApiExecutionCostLimit { max_spend_lamports: std::option::Option::Some(0), max_fee_lamports: std::option::Option::Some(10_000), max_compute_unit_price_micro_lamports: std::option::Option::None, }, - authorized_signers: vec![kb_lib::MdPubkey( - kb_program_ids::SYSTEM_PROGRAM_ID.to_string(), + authorized_signers: vec![ks_lib::MdPubkey( + ks_program_ids::SYSTEM_PROGRAM_ID.to_string(), )], - post_execution_validation: kb_lib::ExApiPostExecutionValidationPolicy { + post_execution_validation: ks_lib::ExApiPostExecutionValidationPolicy { canonical_insert_required: true, core_extraction_required: true, decode_replay_required: true, materialization_required: true, }, - ..kb_lib::ExApiExecutionPolicy::default() + ..ks_lib::ExApiExecutionPolicy::default() }, - operation: kb_lib::ExSplMemoOperation::AddMemo { - generation: kb_lib::ExSplMemoGeneration::V4, + operation: ks_lib::ExSplMemoOperation::AddMemo { + generation: ks_lib::ExSplMemoGeneration::V4, message: "external memo".to_string(), signers: std::vec::Vec::new(), }, }; let memo_plan = - kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan(&memo_executor, &memo_intent) + ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan(&memo_executor, &memo_intent) .unwrap_or_else(|error| panic!("SPL Memo executor failed: {error}")); assert_eq!(memo_plan.instructions.len(), 1); assert_eq!( - kb_lib::ExSafetyChecker + ks_lib::ExSafetyChecker .evaluate_prepared_plan(&memo_plan) .unwrap_or_else(|error| panic!("safety evaluation failed: {error}")) .decision, - kb_lib::ExSafetyDecision::Allow + ks_lib::ExSafetyDecision::Allow ); } diff --git a/ks-lib/tests/external_materializer_api.rs b/ks-lib/tests/external_materializer_api.rs new file mode 100644 index 0000000..b62f995 --- /dev/null +++ b/ks-lib/tests/external_materializer_api.rs @@ -0,0 +1,98 @@ +// file: ks-lib/tests/external_materializer_api.rs +// version: 9 + +//! Downstream-style compilation contract for externally implemented materializers. + +const ACCEPTED_FAMILIES: &[ks_lib::MdEventFamily] = &[ks_lib::MdEventFamily::Audit]; + +struct ExternalAuditMaterializer; + +fn assert_event_materializer() {} + +fn assert_legacy_materializer() {} + +impl ks_lib::MtApiEventMaterializer for ExternalAuditMaterializer { + fn identity(&self) -> ks_lib::MtApiMaterializerIdentity { + return ks_lib::MtApiMaterializerIdentity { + name: "materializer.external.audit".to_string(), + version: "1".to_string(), + }; + } + + fn accepted_families(&self) -> &'static [ks_lib::MdEventFamily] { + return ACCEPTED_FAMILIES; + } + + fn transaction_policy( + &self, + _family: ks_lib::MdEventFamily, + ) -> ks_lib::MtApiMaterializationTransactionPolicy { + return ks_lib::MtApiMaterializationTransactionPolicy::SuccessfulOrFailedAudit; + } + + fn materialize( + &self, + _observation: &ks_lib::DcApiDecodedObservation, + ) -> ks_lib::MtApiMaterializerExecutionResult { + return ks_lib::MtApiMaterializerExecutionResult::ignored(); + } +} + +#[test] +fn external_materializer_uses_only_the_public_ks_lib_contract() { + let materializer: &dyn ks_lib::MtApiEventMaterializer = &ExternalAuditMaterializer; + assert_eq!(materializer.identity().name, "materializer.external.audit"); + assert_eq!(materializer.accepted_families(), ACCEPTED_FAMILIES); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_event_materializer::(); + assert_legacy_materializer::(); + assert_legacy_materializer::(); + assert_legacy_materializer::(); + assert_legacy_materializer::(); + assert_legacy_materializer::(); + assert_legacy_materializer::(); + assert_legacy_materializer::(); + assert_legacy_materializer::(); + assert_legacy_materializer::(); + assert_legacy_materializer::(); + assert_legacy_materializer::(); + assert_legacy_materializer::(); + assert_legacy_materializer::(); + assert_legacy_materializer::(); + assert_legacy_materializer::(); + assert_legacy_materializer::(); + assert_legacy_materializer::(); + let _ = ks_lib::materializer_admin_materialize_elgamal_registry_state_snapshot; + let _ = ks_lib::materializer_metadata_materialize_metaplex_account_snapshot; + let _ = ks_lib::materializer_metadata_materialize_metaplex_metadata_snapshot; + let _ = ks_lib::materializer_metadata_materialize_solana_program_metadata_account_snapshot; + let _ = ks_lib::materializer_metadata_materialize_solana_program_metadata_buffer_snapshot; + let _ = ks_lib::materializer_metadata_materialize_solana_program_metadata_metadata_snapshot; + let _ = ks_lib::materializer_admin_materialize_token_2022_state_snapshots; + let _ = ks_lib::materializer_fees_materialize_token_2022_state_snapshots; + let _ = ks_lib::materializer_metadata_materialize_token_2022_snapshot; + let _ = ks_lib::materializer_token_materialize_token_2022_state_snapshot; +} diff --git a/ks-lib/tests/external_metaplex_token_metadata_executor_api.rs b/ks-lib/tests/external_metaplex_token_metadata_executor_api.rs new file mode 100644 index 0000000..ce8b54d --- /dev/null +++ b/ks-lib/tests/external_metaplex_token_metadata_executor_api.rs @@ -0,0 +1,34 @@ +// file: ks-lib/tests/external_metaplex_token_metadata_executor_api.rs +// version: 2 + +//! Downstream-style compilation contract for the Metaplex Token Metadata executor. + +#[test] +fn external_consumers_inspect_metaplex_executor_capabilities_only_through_crate_root_exports() { + let executor = ks_lib::ExMetadataMetaplexTokenMetadataExecutor; + let program_id = ks_lib::MdProgramId( + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(), + ); + assert_eq!(ks_lib::EX_METAPLEX_TOKEN_METADATA_SUPPORTED_OPERATION_CODES.len(), 35); + assert_eq!(ks_lib::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_OPERATION_CODES.len(), 15); + for operation_code in ks_lib::EX_METAPLEX_TOKEN_METADATA_SUPPORTED_OPERATION_CODES { + let capability = ks_lib::ExApiTypedInstructionExecutor::capability( + &executor, + &program_id, + operation_code, + ); + assert!(capability.is_supported()); + } + for operation_code in ks_lib::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_OPERATION_CODES { + assert!( + ks_lib::EX_METAPLEX_TOKEN_METADATA_SUPPORTED_OPERATION_CODES.contains(operation_code) + ); + } + let foreign_program_id = ks_lib::MdProgramId(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()); + let foreign_capability = ks_lib::ExApiTypedInstructionExecutor::capability( + &executor, + &foreign_program_id, + ks_lib::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION, + ); + assert!(!foreign_capability.is_supported()); +} diff --git a/kb-lib/tests/external_solana_program_metadata_account_api.rs b/ks-lib/tests/external_solana_program_metadata_account_api.rs similarity index 68% rename from kb-lib/tests/external_solana_program_metadata_account_api.rs rename to ks-lib/tests/external_solana_program_metadata_account_api.rs index 3ad3caa..24204b6 100644 --- a/kb-lib/tests/external_solana_program_metadata_account_api.rs +++ b/ks-lib/tests/external_solana_program_metadata_account_api.rs @@ -1,5 +1,5 @@ -// file: kb-lib/tests/external_solana_program_metadata_account_api.rs -// version: 1 +// file: ks-lib/tests/external_solana_program_metadata_account_api.rs +// version: 2 //! Downstream-style compilation contract for Solana Program Metadata account decoders. @@ -8,21 +8,21 @@ fn external_consumers_decode_accounts_only_through_crate_root_exports() { let account = solana_pubkey::Pubkey::new_from_array([17_u8; 32]); let program = solana_pubkey::Pubkey::new_from_array([18_u8; 32]); let authority = solana_pubkey::Pubkey::new_from_array([19_u8; 32]); - let seed = kb_lib::DcMetadataSpmSeed::from_bytes([20_u8; 16]); - let mut data = vec![0_u8; kb_lib::DC_METADATA_SPM_BUFFER_HEADER_BYTES]; - data[0] = kb_lib::DcMetadataSpmAccountDiscriminator::Buffer.wire_value(); + let seed = ks_lib::DcMetadataSpmSeed::from_bytes([20_u8; 16]); + let mut data = vec![0_u8; ks_lib::DC_METADATA_SPM_BUFFER_HEADER_BYTES]; + data[0] = ks_lib::DcMetadataSpmAccountDiscriminator::Buffer.wire_value(); data[1..33].copy_from_slice(&program.to_bytes()); data[33..65].copy_from_slice(&authority.to_bytes()); data[65] = 1; data[66..82].copy_from_slice(seed.as_bytes()); data.extend_from_slice(&[21_u8, 22_u8]); - let result = kb_lib::decoder_metadata_solana_program_metadata_decode_account( + let result = ks_lib::decoder_metadata_solana_program_metadata_decode_account( account.to_string().as_str(), - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID, &data, ); assert!(result.is_ok()); - if let std::result::Result::Ok(kb_lib::DcMetadataSpmAccountSnapshot::Buffer(snapshot)) = result + if let std::result::Result::Ok(ks_lib::DcMetadataSpmAccountSnapshot::Buffer(snapshot)) = result { assert_eq!(snapshot.account, account.to_string()); assert_eq!(snapshot.program, std::option::Option::Some(program.to_string())); @@ -31,5 +31,5 @@ fn external_consumers_decode_accounts_only_through_crate_root_exports() { } else { return; } - assert_eq!(kb_lib::DC_METADATA_SPM_MAX_ACCOUNT_BYTES, 10_485_760); + assert_eq!(ks_lib::DC_METADATA_SPM_MAX_ACCOUNT_BYTES, 10_485_760); } diff --git a/kb-lib/tests/external_solana_program_metadata_executor_api.rs b/ks-lib/tests/external_solana_program_metadata_executor_api.rs similarity index 60% rename from kb-lib/tests/external_solana_program_metadata_executor_api.rs rename to ks-lib/tests/external_solana_program_metadata_executor_api.rs index 871bf1b..ed5d28d 100644 --- a/kb-lib/tests/external_solana_program_metadata_executor_api.rs +++ b/ks-lib/tests/external_solana_program_metadata_executor_api.rs @@ -1,63 +1,63 @@ -// file: kb-lib/tests/external_solana_program_metadata_executor_api.rs -// version: 1 +// file: ks-lib/tests/external_solana_program_metadata_executor_api.rs +// version: 2 //! Downstream-style compilation contract for the Solana Program Metadata executor. #[test] fn external_consumers_build_solana_program_metadata_plans_only_through_crate_root_exports() { - let authority = kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()); - let account = kb_lib::MdPubkey(kb_program_ids::VOTE_PROGRAM_ID.to_string()); - let policy = kb_lib::ExApiExecutionPolicy { - cost_limit: kb_lib::ExApiExecutionCostLimit { + let authority = ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()); + let account = ks_lib::MdPubkey(ks_program_ids::VOTE_PROGRAM_ID.to_string()); + let policy = ks_lib::ExApiExecutionPolicy { + cost_limit: ks_lib::ExApiExecutionCostLimit { max_spend_lamports: std::option::Option::Some(0), max_fee_lamports: std::option::Option::Some(20_000), max_compute_unit_price_micro_lamports: std::option::Option::None, }, authorized_signers: std::vec![authority.clone()], - post_execution_validation: kb_lib::ExApiPostExecutionValidationPolicy { + post_execution_validation: ks_lib::ExApiPostExecutionValidationPolicy { canonical_insert_required: true, core_extraction_required: true, decode_replay_required: true, materialization_required: true, }, - ..kb_lib::ExApiExecutionPolicy::default() + ..ks_lib::ExApiExecutionPolicy::default() }; - let intent = kb_lib::ExMetadataSpmExecutionIntent { + let intent = ks_lib::ExMetadataSpmExecutionIntent { intent_id: "external-spm-extend".to_string(), fee_payer: authority.clone(), policy, allow_destructive_operation: false, - operation: kb_lib::ExMetadataSpmOperation::Extend { + operation: ks_lib::ExMetadataSpmOperation::Extend { account, authority, length: 64, program_context: std::option::Option::None, }, }; - let executor = kb_lib::ExMetadataSolanaProgramMetadataExecutor; - let program_id = kb_lib::MdProgramId( - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), + let executor = ks_lib::ExMetadataSolanaProgramMetadataExecutor; + let program_id = ks_lib::MdProgramId( + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), ); - let capability = kb_lib::ExApiTypedInstructionExecutor::capability( + let capability = ks_lib::ExApiTypedInstructionExecutor::capability( &executor, &program_id, - kb_lib::EX_METADATA_SPM_EXTEND_OPERATION, + ks_lib::EX_METADATA_SPM_EXTEND_OPERATION, ); assert!(capability.is_supported()); - let plan = kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan(&executor, &intent); + let plan = ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan(&executor, &intent); assert!(plan.is_ok()); let plan = match plan { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => return, }; - assert_eq!(plan.operation_code, kb_lib::EX_METADATA_SPM_EXTEND_OPERATION); + assert_eq!(plan.operation_code, ks_lib::EX_METADATA_SPM_EXTEND_OPERATION); assert_eq!(plan.instructions.len(), 1); assert_eq!(plan.instructions[0].data, std::vec![8, 64, 0]); assert_eq!(plan.instructions[0].accounts.len(), 4); - let evaluation = kb_lib::ExSafetyChecker.evaluate_prepared_plan(&plan); + let evaluation = ks_lib::ExSafetyChecker.evaluate_prepared_plan(&plan); assert!(evaluation.is_ok()); assert_eq!( evaluation.as_ref().map(|value| return value.decision), - std::result::Result::Ok(kb_lib::ExSafetyDecision::Allow) + std::result::Result::Ok(ks_lib::ExSafetyDecision::Allow) ); } diff --git a/kb-lib/tests/external_solana_program_metadata_instruction_api.rs b/ks-lib/tests/external_solana_program_metadata_instruction_api.rs similarity index 82% rename from kb-lib/tests/external_solana_program_metadata_instruction_api.rs rename to ks-lib/tests/external_solana_program_metadata_instruction_api.rs index 42d0b9d..c30bb26 100644 --- a/kb-lib/tests/external_solana_program_metadata_instruction_api.rs +++ b/ks-lib/tests/external_solana_program_metadata_instruction_api.rs @@ -1,5 +1,5 @@ -// file: kb-lib/tests/external_solana_program_metadata_instruction_api.rs -// version: 1 +// file: ks-lib/tests/external_solana_program_metadata_instruction_api.rs +// version: 2 //! Downstream-style compilation contract for the Solana Program Metadata instruction decoder. @@ -7,7 +7,7 @@ fn external_consumers_decode_instructions_only_through_crate_root_exports() { let account = solana_pubkey::Pubkey::new_from_array([31_u8; 32]).to_string(); let authority = solana_pubkey::Pubkey::new_from_array([32_u8; 32]).to_string(); - let placeholder = kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID; + let placeholder = ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID; let account_keys = serde_json::json!([ { "accountIndex": 0, @@ -44,7 +44,7 @@ fn external_consumers_decode_instructions_only_through_crate_root_exports() { {"accountIndex": 2, "accountKey": placeholder}, {"accountIndex": 3, "accountKey": placeholder} ]); - let input_result = kb_lib::MdCoreInstructionReplayInput::new( + let input_result = ks_lib::MdCoreInstructionReplayInput::new( "spm:external:extend", "signature", 42, @@ -62,19 +62,19 @@ fn external_consumers_decode_instructions_only_through_crate_root_exports() { serde_json::json!([]), ); assert!(input_result.is_ok()); - let input: kb_lib::MdCoreInstructionReplayInput; + let input: ks_lib::MdCoreInstructionReplayInput; if let std::result::Result::Ok(value) = input_result { input = value; } else { return; } - let decoder = kb_lib::DcMetadataSolanaProgramMetadataDecoder; - let recognition = kb_lib::DcApiInstructionDecoder::recognize(&decoder, &input); + let decoder = ks_lib::DcMetadataSolanaProgramMetadataDecoder; + let recognition = ks_lib::DcApiInstructionDecoder::recognize(&decoder, &input); assert!(recognition.compatible); assert!(recognition.exact); assert_eq!(recognition.entry_code.as_deref(), std::option::Option::Some("extend")); - let result = kb_lib::DcApiInstructionDecoder::decode(&decoder, &input); - assert_eq!(result.status, kb_lib::DcApiDecoderOutcomeStatus::Decoded); + let result = ks_lib::DcApiInstructionDecoder::decode(&decoder, &input); + assert_eq!(result.status, ks_lib::DcApiDecoderOutcomeStatus::Decoded); assert_eq!(result.recognized_entry_code.as_deref(), std::option::Option::Some("extend")); assert_eq!(result.observations.len(), 1); assert_eq!(result.observations[0].payload_json["parameters"]["length"], 1); diff --git a/ks-lib/tests/external_solana_program_metadata_model_api.rs b/ks-lib/tests/external_solana_program_metadata_model_api.rs new file mode 100644 index 0000000..bb7720f --- /dev/null +++ b/ks-lib/tests/external_solana_program_metadata_model_api.rs @@ -0,0 +1,30 @@ +// file: ks-lib/tests/external_solana_program_metadata_model_api.rs +// version: 2 + +//! Downstream-style compilation contract for Solana Program Metadata models. + +#[test] +fn external_consumers_use_only_crate_root_model_exports() { + let seed_result = ks_lib::DcMetadataSpmSeed::from_utf8("idl"); + assert!(seed_result.is_ok()); + let seed; + if let std::result::Result::Ok(value) = seed_result { + seed = value; + } else { + return; + } + assert_eq!(seed.trimmed_utf8(), std::result::Result::Ok("idl")); + assert_eq!(seed.as_bytes().len(), ks_lib::DC_METADATA_SPM_SEED_BYTES); + let external = ks_lib::DcMetadataSpmExternalData::from_zeroable_length( + solana_pubkey::Pubkey::new_from_array([9_u8; 32]), + 4, + 8, + ); + let data = ks_lib::DcMetadataSpmData::External(external); + assert_eq!(data.source(), ks_lib::DcMetadataSpmDataSource::External); + assert_eq!(data.wire_length_u32(), std::result::Result::Ok(40),); + assert_eq!(ks_lib::DcMetadataSpmProgramError::InvalidDataLength.code(), 4); + assert_eq!(ks_lib::DC_METADATA_SPM_BUFFER_HEADER_BYTES, 96); + assert_eq!(ks_lib::DC_METADATA_SPM_METADATA_HEADER_BYTES, 96); + assert_eq!(ks_lib::DC_METADATA_SPM_EXTERNAL_DATA_BYTES, 40); +} diff --git a/kb-lib/tests/operation_naming_matrix.rs b/ks-lib/tests/operation_naming_matrix.rs similarity index 97% rename from kb-lib/tests/operation_naming_matrix.rs rename to ks-lib/tests/operation_naming_matrix.rs index ed2f3bf..a223f3b 100644 --- a/kb-lib/tests/operation_naming_matrix.rs +++ b/ks-lib/tests/operation_naming_matrix.rs @@ -1,5 +1,5 @@ -// file: kb-lib/tests/operation_naming_matrix.rs -// version: 2 +// file: ks-lib/tests/operation_naming_matrix.rs +// version: 3 //! Integration guard for the persisted operation naming contract. diff --git a/kb-logging/CHANGELOG.md b/ks-logging/CHANGELOG.md similarity index 79% rename from kb-logging/CHANGELOG.md rename to ks-logging/CHANGELOG.md index c9e24f9..3bfd375 100644 --- a/kb-logging/CHANGELOG.md +++ b/ks-logging/CHANGELOG.md @@ -1,12 +1,18 @@ - - + + -# CHANGELOG — kb-logging +# CHANGELOG — ks-logging + +## `0.5.1-pre.002` + +- renomme `kb-logging` en `ks-logging` et `kb_logging` en `ks_logging` ; +- aligne le target racine obligatoire sur `ks-logging` et adapte les tests/routes liés au nom de package ; +- reporte les identités hiérarchiques `kb-lib.*` à `pre.003`. ## `0.5.0-pre.002` - confirme le futur document et schéma logging indépendants de la configuration généraliste ; -- identifie la duplication `LoggingConfig`/`LogTargetConfig`/`LogTargetFilterConfig` avec `kb-config` et la conversion manuelle du desktop comme dette à supprimer en `0.5.1` ; +- identifie la duplication `LoggingConfig`/`LogTargetConfig`/`LogTargetFilterConfig` avec `ks-config` et la conversion manuelle du desktop comme dette à supprimer en `0.5.1` ; - classe `LogFileRoute` comme contrat legacy sans consommateur actif à réévaluer avant restructuration. ## 0.4.6 @@ -47,7 +53,7 @@ ### Modifié - adoption des règles Rust 2024 et Khadhroony ; -- erreurs structurées via `kb_core::Error` ; +- erreurs structurées via `ks_core::Error` ; - conservation explicite des guards non bloquants. ### Validation diff --git a/kb-logging/Cargo.toml b/ks-logging/Cargo.toml similarity index 71% rename from kb-logging/Cargo.toml rename to ks-logging/Cargo.toml index 0413564..1f5661a 100644 --- a/kb-logging/Cargo.toml +++ b/ks-logging/Cargo.toml @@ -1,15 +1,15 @@ -# file: kb-logging/Cargo.toml -# version: 2 +# file: ks-logging/Cargo.toml +# version: 3 [package] -name = "kb-logging" +name = "ks-logging" version.workspace = true edition.workspace = true license.workspace = true publish.workspace = true [dependencies] -kb-core = { path = "../kb-core" } +ks-core = { path = "../ks-core" } tracing.workspace = true tracing-appender.workspace = true tracing-subscriber.workspace = true diff --git a/kb-logging/README.md b/ks-logging/README.md similarity index 88% rename from kb-logging/README.md rename to ks-logging/README.md index 5bebe1d..f663937 100644 --- a/kb-logging/README.md +++ b/ks-logging/README.md @@ -1,9 +1,9 @@ - - + + -# kb-logging +# ks-logging -`kb-logging` initialise le subscriber global `tracing` à partir d’une configuration de routes explicites vers la console ou des fichiers. +`ks-logging` initialise le subscriber global `tracing` à partir d’une configuration de routes explicites vers la console ou des fichiers. ## Responsabilités @@ -35,4 +35,4 @@ L’initialisation multi-routes est fonctionnelle. Elle échoue explicitement si - [Utilisation](USAGE.md) - [Travaux restants](TODO.md) - [Historique](CHANGELOG.md) -- [Guide de configuration](../kb-config/USAGE.md) +- [Guide de configuration](../ks-config/USAGE.md) diff --git a/kb-logging/TODO.md b/ks-logging/TODO.md similarity index 75% rename from kb-logging/TODO.md rename to ks-logging/TODO.md index 4475499..25c9b2f 100644 --- a/kb-logging/TODO.md +++ b/ks-logging/TODO.md @@ -1,12 +1,12 @@ - - + + -# TODO — kb-logging +# TODO — ks-logging ## Série `0.5.x` - [ ] `0.5.1` - consommer un document logging et un schéma distincts de la configuration généraliste. -- [ ] `0.5.1` - définir avec `kb-config` un propriétaire unique du DTO source logging sans coupler `kb-config` au runtime tracing. +- [ ] `0.5.1` - définir avec `ks-config` un propriétaire unique du DTO source logging sans coupler `ks-config` au runtime tracing. - [ ] `0.5.1` - supprimer la conversion champ par champ actuellement portée par le desktop. - [ ] Compatibilité - préserver targets, niveaux, filtres, formats, routes et sémantique wildcard pendant la migration. - [ ] Contrat - réévaluer `LogFileRoute`, actuellement sans consommateur actif hors de la crate. diff --git a/kb-logging/USAGE.md b/ks-logging/USAGE.md similarity index 80% rename from kb-logging/USAGE.md rename to ks-logging/USAGE.md index dc5a7f0..ff252f9 100644 --- a/kb-logging/USAGE.md +++ b/ks-logging/USAGE.md @@ -1,14 +1,14 @@ - - + + -# Utilisation de kb-logging +# Utilisation de ks-logging ## Initialisation ```rust -let config = kb_logging::LoggingConfig { +let config = ks_logging::LoggingConfig { default_level: "info".to_string(), - targets: vec![kb_logging::LogTargetConfig { + targets: vec![ks_logging::LogTargetConfig { name: "console".to_string(), enabled: true, sink: "console".to_string(), @@ -21,7 +21,7 @@ let config = kb_logging::LoggingConfig { }], target_filters: Vec::new(), }; -let guard = match kb_logging::init_logging(&config) { +let guard = match ks_logging::init_logging(&config) { Ok(value) => value, Err(error) => return Err(error), }; @@ -40,7 +40,7 @@ assert_eq!(guard.route_names(), &["console".to_string()]); ## Route fichier JSON ```rust -let file_route = kb_logging::LogTargetConfig { +let file_route = ks_logging::LogTargetConfig { name: "operations-json".to_string(), enabled: true, sink: "file".to_string(), @@ -50,18 +50,18 @@ let file_route = kb_logging::LogTargetConfig { format: "json".to_string(), ansi: false, targets: vec![ - "kb-pipeline*".to_string(), - "kb-onchain-transport*".to_string(), + "ks-pipeline*".to_string(), + "ks-onchain-transport*".to_string(), ], }; -let config = kb_logging::LoggingConfig { +let config = ks_logging::LoggingConfig { default_level: "info".to_string(), targets: vec![file_route], target_filters: Vec::new(), }; -let guard = match kb_logging::init_logging(&config) { +let guard = match ks_logging::init_logging(&config) { Ok(value) => value, Err(error) => return Err(error), }; @@ -72,9 +72,9 @@ Pour une route `file`, `path` doit désigner le fichier cible et `rotation` doit ## Filtres de targets ```rust -let config = kb_logging::LoggingConfig { +let config = ks_logging::LoggingConfig { default_level: "warn".to_string(), - targets: vec![kb_logging::LogTargetConfig { + targets: vec![ks_logging::LogTargetConfig { name: "console".to_string(), enabled: true, sink: "console".to_string(), @@ -86,12 +86,12 @@ let config = kb_logging::LoggingConfig { targets: vec!["kb-*".to_string()], }], target_filters: vec![ - kb_logging::LogTargetFilterConfig { - target: "kb-pipeline".to_string(), + ks_logging::LogTargetFilterConfig { + target: "ks-pipeline".to_string(), level: "debug".to_string(), }, - kb_logging::LogTargetFilterConfig { - target: "kb-store".to_string(), + ks_logging::LogTargetFilterConfig { + target: "ks-store".to_string(), level: "info".to_string(), }, ], @@ -104,13 +104,13 @@ Les routes acceptent des targets exactes et des préfixes wildcard. Les `target_ ```rust tracing::info!( - target: kb_logging::tracing_target(), + target: ks_logging::tracing_target(), action = "startup", "logging runtime initialized" ); tracing::debug!( - target: "kb-pipeline.demo", + target: "ks-pipeline.demo", scenario = "token_2022", "scenario preparation started" ); @@ -130,7 +130,7 @@ assert_eq!(guard.route_count(), guard.route_names().len()); ## Erreurs -Les erreurs utilisent `kb_core::Error`. Les cas principaux sont : +Les erreurs utilisent `ks_core::Error`. Les cas principaux sont : - aucune route activée ; - sink, format, rotation ou niveau inconnu ; diff --git a/kb-logging/src/config.rs b/ks-logging/src/config.rs similarity index 94% rename from kb-logging/src/config.rs rename to ks-logging/src/config.rs index fc68d21..a4ae01e 100644 --- a/kb-logging/src/config.rs +++ b/ks-logging/src/config.rs @@ -1,5 +1,5 @@ -// file: kb-logging/src/config.rs -// version: 4 +// file: ks-logging/src/config.rs +// version: 5 //! Logging configuration data structures consumed by the tracing runtime. @@ -46,7 +46,7 @@ pub struct LogTargetConfig { pub targets: std::vec::Vec, } -/// Logging configuration consumed by `kb-logging` before profile binding exists. +/// Logging configuration consumed by `ks-logging` before profile binding exists. #[derive(Clone, Debug, Eq, PartialEq)] pub struct LoggingConfig { /// Default log level used when a route does not provide target directives. diff --git a/ks-logging/src/constants.rs b/ks-logging/src/constants.rs new file mode 100644 index 0000000..7f6af54 --- /dev/null +++ b/ks-logging/src/constants.rs @@ -0,0 +1,5 @@ +// file: ks-logging/src/constants.rs +// version: 3 + +/// Canonical tracing target for this crate. +pub(crate) const TRACING_TARGET: &str = "ks-logging"; diff --git a/kb-logging/src/lib.rs b/ks-logging/src/lib.rs similarity index 95% rename from kb-logging/src/lib.rs rename to ks-logging/src/lib.rs index 8fba06c..be0c0df 100644 --- a/kb-logging/src/lib.rs +++ b/ks-logging/src/lib.rs @@ -1,5 +1,5 @@ -// file: kb-logging/src/lib.rs -// version: 6 +// file: ks-logging/src/lib.rs +// version: 7 //! Logging and tracing initialization for applications and workers. #![warn(missing_docs)] diff --git a/kb-logging/src/tracing_runtime.rs b/ks-logging/src/tracing_runtime.rs similarity index 95% rename from kb-logging/src/tracing_runtime.rs rename to ks-logging/src/tracing_runtime.rs index f7efacd..74d762c 100644 --- a/kb-logging/src/tracing_runtime.rs +++ b/ks-logging/src/tracing_runtime.rs @@ -1,5 +1,5 @@ -// file: kb-logging/src/tracing_runtime.rs -// version: 16 +// file: ks-logging/src/tracing_runtime.rs +// version: 17 //! Runtime initialization helpers for `tracing_subscriber`. @@ -38,7 +38,7 @@ type BoxedLayer = std::boxed::Box< >; /// Initializes global tracing from a logging configuration. -pub fn init_logging(config: &crate::LoggingConfig) -> kb_core::Result { +pub fn init_logging(config: &crate::LoggingConfig) -> ks_core::Result { let mut guards = std::vec::Vec::::new(); let mut route_names = std::vec::Vec::::new(); let layers_result = build_enabled_layers(config, &mut guards, &mut route_names); @@ -47,7 +47,7 @@ pub fn init_logging(config: &crate::LoggingConfig) -> kb_core::Result return std::result::Result::Err(error), }; if layers.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "logging_no_enabled_routes", "at least one logging target must be enabled", )); @@ -74,7 +74,7 @@ pub fn init_logging(config: &crate::LoggingConfig) -> kb_core::Result std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "logging_subscriber_init_failed", format!("cannot initialize tracing subscriber: {error}"), )), @@ -85,7 +85,7 @@ fn build_enabled_layers( config: &crate::LoggingConfig, guards: &mut std::vec::Vec, route_names: &mut std::vec::Vec, -) -> kb_core::Result> { +) -> ks_core::Result> { let mut layers = std::vec::Vec::::new(); let enabled_routes = enabled_routes(config); for route in enabled_routes { @@ -121,7 +121,7 @@ fn build_enabled_layers( layers.push(layer); continue; } - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "logging_unknown_sink", format!("unknown logging sink '{}' for route '{}'", route.sink, route.name), )); @@ -141,7 +141,7 @@ fn enabled_routes(config: &crate::LoggingConfig) -> std::vec::Vec<&crate::LogTar fn build_enabled_route_writer_filters( config: &crate::LoggingConfig, -) -> kb_core::Result> { +) -> ks_core::Result> { let mut filters = std::vec::Vec::new(); for route in enabled_routes(config) { let result = build_route_writer_filter(route, config); @@ -157,7 +157,7 @@ fn build_console_layer( route: &crate::LogTargetConfig, filter: RouteWriterFilter, writer: tracing_appender::non_blocking::NonBlocking, -) -> kb_core::Result { +) -> ks_core::Result { let route_writer = RouteMakeWriter::new(writer, filter); return match route.format.as_str() { "compact" => std::result::Result::Ok( @@ -203,7 +203,7 @@ fn build_console_layer( .with_writer(route_writer) .boxed(), ), - _ => std::result::Result::Err(kb_core::Error::new( + _ => std::result::Result::Err(ks_core::Error::new( "logging_unknown_format", format!("unknown logging format '{}' for route '{}'", route.format, route.name), )), @@ -214,7 +214,7 @@ fn build_file_layer( route: &crate::LogTargetConfig, filter: RouteWriterFilter, writer: StripAnsiMakeWriter, -) -> kb_core::Result { +) -> ks_core::Result { let route_writer = RouteMakeWriter::new(writer, filter); return match route.format.as_str() { "compact" => std::result::Result::Ok( @@ -260,7 +260,7 @@ fn build_file_layer( .with_writer(route_writer) .boxed(), ), - _ => std::result::Result::Err(kb_core::Error::new( + _ => std::result::Result::Err(ks_core::Error::new( "logging_unknown_format", format!("unknown logging format '{}' for route '{}'", route.format, route.name), )), @@ -308,7 +308,7 @@ impl RouteWriterFilter { fn build_route_writer_filter( route: &crate::LogTargetConfig, config: &crate::LoggingConfig, -) -> kb_core::Result { +) -> ks_core::Result { let route_level_text = if is_error_route(route) { "error" } else { route.level.as_str() }; let route_level_result = parse_level_rank(route_level_text); let route_level = match route_level_result { @@ -345,14 +345,14 @@ fn build_route_writer_filter( return std::result::Result::Ok(RouteWriterFilter { default_level, target_levels }); } -fn parse_level_rank(level: &str) -> kb_core::Result { +fn parse_level_rank(level: &str) -> ks_core::Result { return match level.trim().to_ascii_lowercase().as_str() { "error" => std::result::Result::Ok(1), "warn" => std::result::Result::Ok(2), "info" => std::result::Result::Ok(3), "debug" => std::result::Result::Ok(4), "trace" => std::result::Result::Ok(5), - _ => std::result::Result::Err(kb_core::Error::new( + _ => std::result::Result::Err(ks_core::Error::new( "logging_filter_build_failed", format!("unsupported tracing level '{level}'"), )), @@ -440,7 +440,7 @@ fn normalize_target_filter(target: &str) -> std::option::Option kb_core::Result<( +) -> ks_core::Result<( StripAnsiMakeWriter, tracing_appender::non_blocking::WorkerGuard, )> { @@ -451,7 +451,7 @@ fn build_file_writer( }; let create_result = std::fs::create_dir_all(&parent); if let std::result::Result::Err(error) = create_result { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "logging_directory_create_failed", format!("cannot create logging directory '{}': {error}", parent.display()), )); @@ -479,7 +479,7 @@ fn build_file_writer( let appender = match appender_result { std::result::Result::Ok(appender) => appender, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "logging_appender_build_failed", format!("cannot build rolling logging appender in '{}': {error}", parent.display()), )); @@ -714,7 +714,7 @@ mod tests { "debug", "human", true, - std::vec!["kb-onchain-transport.*".to_string()] + std::vec!["ks-onchain-transport.*".to_string()] )], target_filters: std::vec![crate::LogTargetFilterConfig { target: "hyper".to_string(), @@ -854,23 +854,23 @@ mod tests { fn route_filter_converts_wildcard_prefix() { let config = sample_logging_config(); let expression = super::build_route_filter_expression(&config.targets[0], &config); - assert_eq!(expression, "kb-onchain-transport=debug"); + assert_eq!(expression, "ks-onchain-transport=debug"); } #[test] fn route_filter_converts_rust_wildcard_prefix() { let mut config = sample_logging_config(); - config.targets[0].targets = std::vec!["kb-onchain-transport::*".to_string()]; + config.targets[0].targets = std::vec!["ks-onchain-transport::*".to_string()]; let expression = super::build_route_filter_expression(&config.targets[0], &config); - assert_eq!(expression, "kb-onchain-transport=debug"); + assert_eq!(expression, "ks-onchain-transport=debug"); } #[test] fn route_filter_keeps_exact_target() { let mut config = sample_logging_config(); - config.targets[0].targets = std::vec!["kb-onchain-transport::client".to_string()]; + config.targets[0].targets = std::vec!["ks-onchain-transport::client".to_string()]; let expression = super::build_route_filter_expression(&config.targets[0], &config); - assert_eq!(expression, "kb-onchain-transport::client=debug"); + assert_eq!(expression, "ks-onchain-transport::client=debug"); } #[test] @@ -894,11 +894,11 @@ mod tests { let mut config = sample_logging_config(); config.targets[0].targets = std::vec!["*".to_string()]; config.target_filters = std::vec![crate::LogTargetFilterConfig { - target: "kb_lib::executor::spl::token_2022::*".to_string(), + target: "ks_lib::executor::spl::token_2022::*".to_string(), level: "trace".to_string(), }]; let expression = super::build_route_filter_expression(&config.targets[0], &config); - assert_eq!(expression, "debug,kb_lib::executor::spl::token_2022=trace"); + assert_eq!(expression, "debug,ks_lib::executor::spl::token_2022=trace"); } #[test] @@ -910,8 +910,8 @@ mod tests { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("route writer filter failed: {error}"), }; - assert!(filter.allows_target_level("kb-onchain-transport", &tracing::Level::DEBUG)); - assert!(!filter.allows_target_level("kb-onchain-transport", &tracing::Level::TRACE)); + assert!(filter.allows_target_level("ks-onchain-transport", &tracing::Level::DEBUG)); + assert!(!filter.allows_target_level("ks-onchain-transport", &tracing::Level::TRACE)); assert!(filter.allows_target_level("hyper", &tracing::Level::WARN)); assert!(!filter.allows_target_level("hyper", &tracing::Level::INFO)); } @@ -1036,20 +1036,20 @@ mod tests { std::vec!["*".to_string()] ), test_route( - "file_kb_core", + "file_ks_core", "file", "debug", "human", true, - std::vec!["kb_core::*".to_string()] + std::vec!["ks_core::*".to_string()] ), test_route( - "file_kb_config", + "file_ks_config", "file", "debug", "human", true, - std::vec!["kb_config::*".to_string()] + std::vec!["ks_config::*".to_string()] ), test_route( "file_errors", @@ -1069,7 +1069,7 @@ mod tests { .collect::>(); assert_eq!( route_names, - std::vec!["console_main", "file_kb_core", "file_kb_config", "file_errors"] + std::vec!["console_main", "file_ks_core", "file_ks_config", "file_errors"] ); } diff --git a/kb-onchain-transport/CHANGELOG.md b/ks-onchain-transport/CHANGELOG.md similarity index 88% rename from kb-onchain-transport/CHANGELOG.md rename to ks-onchain-transport/CHANGELOG.md index ad74ab6..8a364c0 100644 --- a/kb-onchain-transport/CHANGELOG.md +++ b/ks-onchain-transport/CHANGELOG.md @@ -1,7 +1,12 @@ - - + + -# CHANGELOG — kb-onchain-transport +# CHANGELOG — ks-onchain-transport + +## `0.5.1-pre.002` + +- renomme `kb-onchain-transport` en `ks-onchain-transport` et `kb_onchain_transport` en `ks_onchain_transport` ; +- aligne le target racine de tracing et les consommateurs sans modifier les contrats HTTP/WS/RPC. ## `0.4.8-pre.011` @@ -50,6 +55,6 @@ ## 0.1.0-pre.062 - migration et consolidation des anciennes crates RPC de bot2 ; -- renommage en `kb-onchain-transport` ; +- renommage en `ks-onchain-transport` ; - conservation des transports HTTP, WebSocket, acquisition canonique, simulation, soumission et confirmation ; - adaptation aux normes Rust 2024 et Khadhroony bot3. diff --git a/kb-onchain-transport/Cargo.toml b/ks-onchain-transport/Cargo.toml similarity index 67% rename from kb-onchain-transport/Cargo.toml rename to ks-onchain-transport/Cargo.toml index f437b40..edef198 100644 --- a/kb-onchain-transport/Cargo.toml +++ b/ks-onchain-transport/Cargo.toml @@ -1,8 +1,8 @@ -# file: kb-onchain-transport/Cargo.toml -# version: 4 +# file: ks-onchain-transport/Cargo.toml +# version: 5 [package] -name = "kb-onchain-transport" +name = "ks-onchain-transport" version.workspace = true edition.workspace = true license.workspace = true @@ -12,9 +12,9 @@ publish.workspace = true futures-util.workspace = true base64.workspace = true bs58.workspace = true -kb-config = { path = "../kb-config" } -kb-core = { path = "../kb-core" } -kb-lib = { path = "../kb-lib" } +ks-config = { path = "../ks-config" } +ks-core = { path = "../ks-core" } +ks-lib = { path = "../ks-lib" } reqwest.workspace = true serde.workspace = true serde_json.workspace = true diff --git a/kb-onchain-transport/README.md b/ks-onchain-transport/README.md similarity index 82% rename from kb-onchain-transport/README.md rename to ks-onchain-transport/README.md index 51fa8aa..2f227df 100644 --- a/kb-onchain-transport/README.md +++ b/ks-onchain-transport/README.md @@ -1,9 +1,9 @@ - - + + -# kb-onchain-transport +# ks-onchain-transport -`kb-onchain-transport` fournit les transports Solana on-chain de `khadhroony-bot3`. +`ks-onchain-transport` fournit les transports Solana on-chain de `khadhroony-bot3`. ## Responsabilités @@ -15,7 +15,7 @@ - acquisition de signatures et transactions pour le backfill ; - validation bornée des paramètres et réponses réseau. -La crate ne décode pas les programmes Solana et ne persiste pas directement les données. Elle alimente `kb-pipeline`, qui orchestre l’acquisition, l’extraction et le replay, et utilise les contrats de `kb-core` et `kb-lib`. +La crate ne décode pas les programmes Solana et ne persiste pas directement les données. Elle alimente `ks-pipeline`, qui orchestre l’acquisition, l’extraction et le replay, et utilise les contrats de `ks-core` et `ks-lib`. ## Surfaces publiques principales diff --git a/kb-onchain-transport/TODO.md b/ks-onchain-transport/TODO.md similarity index 83% rename from kb-onchain-transport/TODO.md rename to ks-onchain-transport/TODO.md index 1aceedc..f1c741d 100644 --- a/kb-onchain-transport/TODO.md +++ b/ks-onchain-transport/TODO.md @@ -1,7 +1,7 @@ - - + + -# TODO — kb-onchain-transport +# TODO — ks-onchain-transport ## Série `0.13.x` diff --git a/kb-onchain-transport/USAGE.md b/ks-onchain-transport/USAGE.md similarity index 85% rename from kb-onchain-transport/USAGE.md rename to ks-onchain-transport/USAGE.md index 57719e3..be5e504 100644 --- a/kb-onchain-transport/USAGE.md +++ b/ks-onchain-transport/USAGE.md @@ -1,7 +1,7 @@ - - + + -# Utilisation de kb-onchain-transport +# Utilisation de ks-onchain-transport ## Objectif @@ -9,7 +9,7 @@ La crate expose les contrats publics nécessaires aux communications RPC HTTP et ## Prérequis -- une configuration `kb-config` contenant au moins un endpoint compatible ; +- une configuration `ks-config` contenant au moins un endpoint compatible ; - un runtime Tokio pour les opérations asynchrones ; - des limites et engagements adaptés à l’opération demandée. @@ -17,9 +17,9 @@ La crate expose les contrats publics nécessaires aux communications RPC HTTP et ```rust fn build_http_client( - endpoint: kb_config::HttpEndpointConfig, -) -> kb_core::Result { - let result = kb_onchain_transport::HttpClient::new(endpoint); + endpoint: ks_config::HttpEndpointConfig, +) -> ks_core::Result { + let result = ks_onchain_transport::HttpClient::new(endpoint); match result { Ok(client) => Ok(client), @@ -32,9 +32,9 @@ fn build_http_client( ```rust fn select_query_client( - profile: &kb_config::ProfileConfig, -) -> kb_core::Result { - let pool_result = kb_onchain_transport::HttpEndpointPool::from_profile(profile); + profile: &ks_config::ProfileConfig, +) -> ks_core::Result { + let pool_result = ks_onchain_transport::HttpEndpointPool::from_profile(profile); let pool = match pool_result { Ok(pool) => pool, Err(error) => return Err(error), @@ -50,7 +50,7 @@ fn select_query_client( ```rust fn classify_method(method: &str) -> String { - kb_onchain_transport::request_kind_from_method(method) + ks_onchain_transport::request_kind_from_method(method) } assert_eq!(classify_method("getTransaction"), "transaction_read"); @@ -63,8 +63,8 @@ La valeur retournée sert au routage par rôle. Elle ne remplace pas le nom RPC ```rust fn parse_response( text: &str, -) -> kb_core::Result { - let result = kb_onchain_transport::parse_json_rpc_text(text); +) -> ks_core::Result { + let result = ks_onchain_transport::parse_json_rpc_text(text); match result { Ok(response) => Ok(response), @@ -79,13 +79,13 @@ Le parseur distingue les réponses de succès, les erreurs JSON-RPC et les notif ```rust async fn load_balance( - client: &kb_onchain_transport::HttpClient, + client: &ks_onchain_transport::HttpClient, address: &str, -) -> kb_core::Result { +) -> ks_core::Result { let result = client .get_balance( address, - kb_onchain_transport::GetBalanceConfig::default(), + ks_onchain_transport::GetBalanceConfig::default(), ) .await; @@ -103,9 +103,9 @@ async fn load_balance( ```rust fn adapt_transaction( raw: serde_json::Value, - config: &kb_onchain_transport::GetTransactionConfig, -) -> kb_core::Result { - let result = kb_onchain_transport::adapt_get_transaction_result(raw, config); + config: &ks_onchain_transport::GetTransactionConfig, +) -> ks_core::Result { + let result = ks_onchain_transport::adapt_get_transaction_result(raw, config); match result { Ok(acquisition) => Ok(acquisition), diff --git a/kb-onchain-transport/src/client.rs b/ks-onchain-transport/src/client.rs similarity index 74% rename from kb-onchain-transport/src/client.rs rename to ks-onchain-transport/src/client.rs index 120e589..5f7ee07 100644 --- a/kb-onchain-transport/src/client.rs +++ b/ks-onchain-transport/src/client.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/client.rs -// version: 3 +// file: ks-onchain-transport/src/client.rs +// version: 4 //! RPC client scaffold for Solana ingestion. @@ -17,6 +17,6 @@ pub trait SolanaRpcClient { /// Fetches a raw transaction payload by signature. fn get_transaction_raw_json( &self, - signature: &kb_lib::MdSignature, - ) -> kb_core::Result>; + signature: &ks_lib::MdSignature, + ) -> ks_core::Result>; } diff --git a/kb-onchain-transport/src/constants.rs b/ks-onchain-transport/src/constants.rs similarity index 93% rename from kb-onchain-transport/src/constants.rs rename to ks-onchain-transport/src/constants.rs index e374d00..c32cd44 100644 --- a/kb-onchain-transport/src/constants.rs +++ b/ks-onchain-transport/src/constants.rs @@ -1,10 +1,10 @@ -// file: kb-onchain-transport/src/constants.rs -// version: 8 +// file: ks-onchain-transport/src/constants.rs +// version: 9 -//! Local constants for the `kb-onchain-transport` crate. +//! Local constants for the `ks-onchain-transport` crate. /// Canonical tracing target for this crate. -pub(crate) const TRACING_TARGET: &str = "kb-onchain-transport"; +pub(crate) const TRACING_TARGET: &str = "ks-onchain-transport"; /// Official Devnet genesis hash. pub(crate) const DEVNET_GENESIS_HASH: &str = "EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG"; /// Official Testnet genesis hash. diff --git a/kb-onchain-transport/src/endpoint_role.rs b/ks-onchain-transport/src/endpoint_role.rs similarity index 96% rename from kb-onchain-transport/src/endpoint_role.rs rename to ks-onchain-transport/src/endpoint_role.rs index 8b8cd14..f5dbf6f 100644 --- a/kb-onchain-transport/src/endpoint_role.rs +++ b/ks-onchain-transport/src/endpoint_role.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/endpoint_role.rs -// version: 4 +// file: ks-onchain-transport/src/endpoint_role.rs +// version: 5 //! Endpoint role helpers shared by HTTP and WebSocket pools. @@ -29,7 +29,7 @@ pub struct EndpointRoleSnapshot { impl crate::EndpointRoleSnapshot { /// Builds a serializable snapshot from configuration. - pub fn from_config(config: &kb_config::EndpointRoleConfig) -> Self { + pub fn from_config(config: &ks_config::EndpointRoleConfig) -> Self { return Self { role: config.role.clone(), enabled: config.enabled, @@ -55,7 +55,7 @@ pub fn request_kind_from_method(method: &str) -> std::string::String { /// Returns true when one endpoint role can handle the requested role and kind. pub(crate) fn role_matches( - role_config: &kb_config::EndpointRoleConfig, + role_config: &ks_config::EndpointRoleConfig, required_role: &str, request_kind: &str, ) -> bool { @@ -114,8 +114,8 @@ mod tests { role: &str, enabled: bool, request_kinds: std::vec::Vec, - ) -> kb_config::EndpointRoleConfig { - return kb_config::EndpointRoleConfig { + ) -> ks_config::EndpointRoleConfig { + return ks_config::EndpointRoleConfig { role: role.to_string(), enabled, request_kinds, diff --git a/kb-onchain-transport/src/execution_rpc.rs b/ks-onchain-transport/src/execution_rpc.rs similarity index 91% rename from kb-onchain-transport/src/execution_rpc.rs rename to ks-onchain-transport/src/execution_rpc.rs index f6fe851..f9ba253 100644 --- a/kb-onchain-transport/src/execution_rpc.rs +++ b/ks-onchain-transport/src/execution_rpc.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/execution_rpc.rs -// version: 10 +// file: ks-onchain-transport/src/execution_rpc.rs +// version: 11 //! Typed Solana JSON-RPC adapters used by execution orchestration. @@ -45,7 +45,7 @@ pub struct GenesisHashResult { /// Base58 genesis hash returned by the endpoint. pub genesis_hash: std::string::String, /// Known public cluster when the hash matches an official public cluster. - pub classified_cluster: std::option::Option, + pub classified_cluster: std::option::Option, } /// Configuration for `getEpochInfo` used by stateful execution readiness checks. @@ -181,7 +181,7 @@ impl crate::GetFeeForMessageConfig { fn request_params( &self, encoded_message: &str, - ) -> kb_core::Result> { + ) -> ks_core::Result> { let validation_result = validate_base64_payload(encoded_message, "getFeeForMessage message"); if let std::result::Result::Err(error) = validation_result { @@ -218,19 +218,19 @@ pub struct FeeForMessageResult { #[derive(Clone, Debug, Eq, PartialEq)] pub struct SimulationAccountsConfig { /// Account addresses returned after simulation. - pub addresses: std::vec::Vec, + pub addresses: std::vec::Vec, } impl crate::SimulationAccountsConfig { /// Creates a bounded account-return request using base64 account data. - pub fn new(addresses: std::vec::Vec) -> kb_core::Result { + pub fn new(addresses: std::vec::Vec) -> ks_core::Result { if addresses.is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "simulateTransaction accounts must not be empty", )); } if addresses.len() > crate::MAX_SIMULATION_ACCOUNT_COUNT { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "simulateTransaction accounts must not exceed {} entries", crate::MAX_SIMULATION_ACCOUNT_COUNT ))); @@ -286,9 +286,9 @@ impl crate::SimulateTransactionConfig { min_context_slot: std::option::Option, inner_instructions: bool, accounts: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { if signature_verification && replace_recent_blockhash { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "simulateTransaction cannot verify signatures while replacing the recent blockhash", )); } @@ -331,7 +331,7 @@ impl crate::SimulateTransactionConfig { fn request_params( &self, encoded_transaction: &str, - ) -> kb_core::Result> { + ) -> ks_core::Result> { let validation_result = validate_base64_payload(encoded_transaction, "simulateTransaction transaction"); if let std::result::Result::Err(error) = validation_result { @@ -410,13 +410,13 @@ impl crate::SimulateTransactionResult { /// Converts this RPC result into the common execution simulation contract. pub fn to_execution_result( &self, - cluster: kb_lib::ExApiExecutionCluster, - blockhash_kind: kb_lib::ExApiExecutionBlockhashKind, + cluster: ks_lib::ExApiExecutionCluster, + blockhash_kind: ks_lib::ExApiExecutionBlockhashKind, blockhash_age_slots: std::option::Option, - nonce_account: std::option::Option, - nonce_authority: std::option::Option, + nonce_account: std::option::Option, + nonce_authority: std::option::Option, fee_fallback: std::option::Option<&crate::FeeForMessageResult>, - ) -> kb_lib::ExApiExecutionSimulationResult { + ) -> ks_lib::ExApiExecutionSimulationResult { let estimated_fee_lamports = match self.fee_lamports { std::option::Option::Some(fee) => std::option::Option::Some(fee), std::option::Option::None => fee_fallback.and_then(|result| return result.fee_lamports), @@ -430,7 +430,7 @@ impl crate::SimulateTransactionResult { .replacement_blockhash .as_ref() .map(|replacement| return replacement.last_valid_block_height); - return kb_lib::ExApiExecutionSimulationResult { + return ks_lib::ExApiExecutionSimulationResult { simulated: true, success: self.success, cluster, @@ -474,8 +474,8 @@ impl crate::GetBalanceConfig { fn request_params( &self, - pubkey: &kb_lib::MdPubkey, - ) -> kb_core::Result> { + pubkey: &ks_lib::MdPubkey, + ) -> ks_core::Result> { let validation_result = crate::validate_solana_pubkey_text(pubkey.0.as_str(), "getBalance account"); if let std::result::Result::Err(error) = validation_result { @@ -537,9 +537,9 @@ impl crate::GetAccountInfoConfig { commitment: crate::RpcCommitmentLevel, min_context_slot: std::option::Option, max_data_bytes: usize, - ) -> kb_core::Result { + ) -> ks_core::Result { if max_data_bytes == 0 || max_data_bytes > crate::MAX_COMPLETE_ACCOUNT_DATA_BYTES { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "getAccountInfo complete data limit must be between 1 and {} bytes", crate::MAX_COMPLETE_ACCOUNT_DATA_BYTES ))); @@ -557,7 +557,7 @@ impl crate::GetAccountInfoConfig { } /// Creates a confirmed complete account-data request bounded by the decoded byte limit. - pub fn confirmed_with_data(max_data_bytes: usize) -> kb_core::Result { + pub fn confirmed_with_data(max_data_bytes: usize) -> ks_core::Result { return Self::new_with_data( crate::RpcCommitmentLevel::Confirmed, std::option::Option::None, @@ -567,11 +567,11 @@ impl crate::GetAccountInfoConfig { fn request_params( &self, - pubkey: &kb_lib::MdPubkey, - ) -> kb_core::Result> { + pubkey: &ks_lib::MdPubkey, + ) -> ks_core::Result> { if let std::option::Option::Some(max_data_bytes) = self.max_data_bytes { if max_data_bytes == 0 || max_data_bytes > crate::MAX_COMPLETE_ACCOUNT_DATA_BYTES { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "getAccountInfo complete data limit must be between 1 and {} bytes", crate::MAX_COMPLETE_ACCOUNT_DATA_BYTES ))); @@ -610,7 +610,7 @@ pub struct AccountInfoValue { /// Account balance in lamports. pub lamports: u64, /// Program that owns the account. - pub owner: kb_lib::MdProgramId, + pub owner: ks_lib::MdProgramId, /// Whether the account contains executable program code. pub executable: bool, /// Rent epoch reported by the node. @@ -679,7 +679,7 @@ impl crate::RequestAirdropConfig { pub fn new( commitment: crate::RpcCommitmentLevel, recent_blockhash: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { if let std::option::Option::Some(blockhash) = &recent_blockhash { let validation_result = crate::validate_solana_hash_text( blockhash.as_str(), @@ -702,16 +702,16 @@ impl crate::RequestAirdropConfig { fn request_params( &self, - pubkey: &kb_lib::MdPubkey, + pubkey: &ks_lib::MdPubkey, lamports: u64, - ) -> kb_core::Result> { + ) -> ks_core::Result> { let validation_result = crate::validate_solana_pubkey_text(pubkey.0.as_str(), "requestAirdrop recipient"); if let std::result::Result::Err(error) = validation_result { return std::result::Result::Err(error); } if lamports == 0 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "requestAirdrop lamports must be greater than zero", )); } @@ -738,7 +738,7 @@ impl crate::RequestAirdropConfig { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] pub struct AirdropResult { /// Faucet transaction signature. - pub signature: kb_lib::MdSignature, + pub signature: ks_lib::MdSignature, } /// Configuration for `sendTransaction`. @@ -761,9 +761,9 @@ impl crate::SendTransactionConfig { preflight_commitment: crate::RpcCommitmentLevel, max_retries: std::option::Option, min_context_slot: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { if skip_preflight { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "sendTransaction preflight cannot be skipped by execution orchestration", )); } @@ -787,9 +787,9 @@ impl crate::SendTransactionConfig { /// Creates a confirmed submission configuration from the active execution settings. pub fn from_execution_config( - config: &kb_config::ExecutionConfig, + config: &ks_config::ExecutionConfig, min_context_slot: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { return Self::new( false, crate::RpcCommitmentLevel::Confirmed, @@ -801,7 +801,7 @@ impl crate::SendTransactionConfig { fn request_params( &self, encoded_transaction: &str, - ) -> kb_core::Result> { + ) -> ks_core::Result> { let validation_result = validate_base64_payload(encoded_transaction, "sendTransaction signed transaction"); if let std::result::Result::Err(error) = validation_result { @@ -837,16 +837,16 @@ impl crate::SendTransactionConfig { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] pub struct SendTransactionResult { /// First signature embedded in the submitted transaction. - pub signature: kb_lib::MdSignature, + pub signature: ks_lib::MdSignature, } impl crate::SendTransactionResult { /// Converts the RPC result into the common execution send contract. pub fn to_execution_result( &self, - cluster: kb_lib::ExApiExecutionCluster, - ) -> kb_lib::ExApiExecutionSendResult { - return kb_lib::ExApiExecutionSendResult { + cluster: ks_lib::ExApiExecutionCluster, + ) -> ks_lib::ExApiExecutionSendResult { + return ks_lib::ExApiExecutionSendResult { cluster, signature: self.signature.clone(), submitted: true, @@ -869,15 +869,15 @@ impl crate::GetSignatureStatusesConfig { fn request_params( &self, - signatures: &[kb_lib::MdSignature], - ) -> kb_core::Result> { + signatures: &[ks_lib::MdSignature], + ) -> ks_core::Result> { if signatures.is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "getSignatureStatuses requires at least one signature", )); } if signatures.len() > crate::MAX_SIGNATURE_STATUS_COUNT { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "getSignatureStatuses supports at most {} signatures", crate::MAX_SIGNATURE_STATUS_COUNT ))); @@ -991,15 +991,15 @@ impl crate::ConfirmTransactionConfig { max_attempts: u32, last_valid_block_height: std::option::Option, min_context_slot: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { if poll_interval_ms == 0 || poll_interval_ms > crate::MAX_CONFIRMATION_POLL_INTERVAL_MS { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "confirmation poll interval must be between 1 and {} milliseconds", crate::MAX_CONFIRMATION_POLL_INTERVAL_MS ))); } if max_attempts == 0 || max_attempts > crate::MAX_CONFIRMATION_ATTEMPTS { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "confirmation attempts must be between 1 and {}", crate::MAX_CONFIRMATION_ATTEMPTS ))); @@ -1019,7 +1019,7 @@ impl crate::ConfirmTransactionConfig { last_valid_block_height: u64, poll_interval_ms: u64, max_attempts: u32, - ) -> kb_core::Result { + ) -> ks_core::Result { return Self::new( crate::RpcCommitmentLevel::Confirmed, false, @@ -1032,10 +1032,10 @@ impl crate::ConfirmTransactionConfig { /// Creates a confirmed bounded policy from the active execution settings. pub fn from_execution_config( - config: &kb_config::ExecutionConfig, + config: &ks_config::ExecutionConfig, last_valid_block_height: std::option::Option, min_context_slot: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { return Self::new( crate::RpcCommitmentLevel::Confirmed, false, @@ -1050,16 +1050,16 @@ impl crate::ConfirmTransactionConfig { /// Classifies a genesis hash as one of the three official public clusters. pub fn classify_genesis_hash( genesis_hash: &str, -) -> std::option::Option { +) -> std::option::Option { return match genesis_hash { crate::DEVNET_GENESIS_HASH => { - std::option::Option::Some(kb_lib::ExApiExecutionCluster::Devnet) + std::option::Option::Some(ks_lib::ExApiExecutionCluster::Devnet) }, crate::TESTNET_GENESIS_HASH => { - std::option::Option::Some(kb_lib::ExApiExecutionCluster::Testnet) + std::option::Option::Some(ks_lib::ExApiExecutionCluster::Testnet) }, crate::MAINNET_GENESIS_HASH => { - std::option::Option::Some(kb_lib::ExApiExecutionCluster::Mainnet) + std::option::Option::Some(ks_lib::ExApiExecutionCluster::Mainnet) }, _ => std::option::Option::None, }; @@ -1068,11 +1068,11 @@ pub fn classify_genesis_hash( /// Adapts a raw `getGenesisHash` result. pub fn adapt_get_genesis_hash_result( source: &serde_json::Value, -) -> kb_core::Result { +) -> ks_core::Result { let genesis_hash = match source.as_str() { std::option::Option::Some(value) => value.to_string(), std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "getGenesisHash result must be a string", )); }, @@ -1091,13 +1091,13 @@ pub fn adapt_get_genesis_hash_result( /// Adapts a raw `getLatestBlockhash` result. pub fn adapt_get_latest_blockhash_result( source: &serde_json::Value, -) -> kb_core::Result { +) -> ks_core::Result { let parse_result = serde_json::from_value::>(source.clone()); let parsed = match parse_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot parse getLatestBlockhash result: {error}" ))); }, @@ -1119,13 +1119,13 @@ pub fn adapt_get_latest_blockhash_result( /// Adapts a raw `getFeeForMessage` result. pub fn adapt_get_fee_for_message_result( source: &serde_json::Value, -) -> kb_core::Result { +) -> ks_core::Result { let parse_result = serde_json::from_value::>>(source.clone()); let parsed = match parse_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot parse getFeeForMessage result: {error}" ))); }, @@ -1139,13 +1139,13 @@ pub fn adapt_get_fee_for_message_result( /// Adapts a raw `simulateTransaction` result. pub fn adapt_simulate_transaction_result( source: &serde_json::Value, -) -> kb_core::Result { +) -> ks_core::Result { let parse_result = serde_json::from_value::>(source.clone()); let parsed = match parse_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot parse simulateTransaction result: {error}" ))); }, @@ -1181,12 +1181,12 @@ pub fn adapt_simulate_transaction_result( /// Adapts a raw `getBalance` result. pub fn adapt_get_balance_result( source: &serde_json::Value, -) -> kb_core::Result { +) -> ks_core::Result { let parse_result = serde_json::from_value::>(source.clone()); let parsed = match parse_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot parse getBalance result: {error}" ))); }, @@ -1200,28 +1200,28 @@ pub fn adapt_get_balance_result( /// Adapts a raw metadata-only `getAccountInfo` result. pub fn adapt_get_account_info_result( source: &serde_json::Value, -) -> kb_core::Result { +) -> ks_core::Result { return crate::adapt_get_account_info_result_with_data_limit(source, std::option::Option::None); } pub(crate) fn adapt_get_account_info_result_with_data_limit( source: &serde_json::Value, max_data_bytes: std::option::Option, -) -> kb_core::Result { +) -> ks_core::Result { let context = match source.get("context") { std::option::Option::Some(value) => { let parse_result = serde_json::from_value::(value.clone()); match parse_result { std::result::Result::Ok(context) => context, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot parse getAccountInfo context: {error}" ))); }, } }, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "getAccountInfo result is missing context", )); }, @@ -1229,7 +1229,7 @@ pub(crate) fn adapt_get_account_info_result_with_data_limit( let value = match source.get("value") { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "getAccountInfo result is missing value", )); }, @@ -1243,7 +1243,7 @@ pub(crate) fn adapt_get_account_info_result_with_data_limit( let lamports = match value.get("lamports").and_then(serde_json::Value::as_u64) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "getAccountInfo account lamports must be an unsigned integer", )); }, @@ -1251,7 +1251,7 @@ pub(crate) fn adapt_get_account_info_result_with_data_limit( let owner_text = match value.get("owner").and_then(serde_json::Value::as_str) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "getAccountInfo account owner must be a string", )); }, @@ -1264,7 +1264,7 @@ pub(crate) fn adapt_get_account_info_result_with_data_limit( let executable = match value.get("executable").and_then(serde_json::Value::as_bool) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "getAccountInfo account executable must be a boolean", )); }, @@ -1272,7 +1272,7 @@ pub(crate) fn adapt_get_account_info_result_with_data_limit( let rent_epoch = match value.get("rentEpoch").and_then(serde_json::Value::as_u64) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "getAccountInfo account rentEpoch must be an unsigned integer", )); }, @@ -1280,7 +1280,7 @@ pub(crate) fn adapt_get_account_info_result_with_data_limit( let space = match value.get("space").and_then(serde_json::Value::as_u64) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "getAccountInfo account space must be an unsigned integer", )); }, @@ -1293,7 +1293,7 @@ pub(crate) fn adapt_get_account_info_result_with_data_limit( context, account: std::option::Option::Some(crate::AccountInfoValue { lamports, - owner: kb_lib::MdProgramId(owner_text.to_string()), + owner: ks_lib::MdProgramId(owner_text.to_string()), executable, rent_epoch, space, @@ -1306,11 +1306,11 @@ fn decode_account_data( value: &serde_json::Value, space: u64, max_data_bytes: std::option::Option, -) -> kb_core::Result> { +) -> ks_core::Result> { let tuple = match value.get("data").and_then(serde_json::Value::as_array) { std::option::Option::Some(tuple) if tuple.len() == 2 => tuple, _ => { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "getAccountInfo account data must be a two-element encoded tuple", )); }, @@ -1318,7 +1318,7 @@ fn decode_account_data( let encoded = match tuple.first().and_then(serde_json::Value::as_str) { std::option::Option::Some(encoded) => encoded, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "getAccountInfo account data payload must be a string", )); }, @@ -1326,39 +1326,39 @@ fn decode_account_data( let encoding = match tuple.get(1).and_then(serde_json::Value::as_str) { std::option::Option::Some(encoding) => encoding, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "getAccountInfo account data encoding must be a string", )); }, }; if encoding != "base64" { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "getAccountInfo account data encoding {encoding} is unsupported" ))); } match max_data_bytes { std::option::Option::None => { if !encoded.is_empty() { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "metadata-only getAccountInfo returned non-empty account data", )); } }, std::option::Option::Some(max_data_bytes) => { if max_data_bytes == 0 || max_data_bytes > crate::MAX_COMPLETE_ACCOUNT_DATA_BYTES { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "getAccountInfo complete data limit must be between 1 and {} bytes", crate::MAX_COMPLETE_ACCOUNT_DATA_BYTES ))); } if space > max_data_bytes as u64 { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "getAccountInfo account space {space} exceeds the requested complete-data limit {max_data_bytes}" ))); } let maximum_encoded_length = max_data_bytes.div_ceil(3) * 4; if encoded.len() > maximum_encoded_length { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "getAccountInfo encoded account data length {} exceeds the limit {maximum_encoded_length}", encoded.len() ))); @@ -1368,20 +1368,20 @@ fn decode_account_data( let decoded = match base64::engine::general_purpose::STANDARD.decode(encoded) { std::result::Result::Ok(decoded) => decoded, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot decode getAccountInfo base64 account data: {error}" ))); }, }; if let std::option::Option::Some(max_data_bytes) = max_data_bytes { if decoded.len() > max_data_bytes { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "getAccountInfo decoded account data length {} exceeds the requested limit {max_data_bytes}", decoded.len() ))); } if decoded.len() as u64 != space { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "getAccountInfo returned {} decoded bytes for an account reporting {space} bytes", decoded.len() ))); @@ -1394,11 +1394,11 @@ fn decode_account_data( pub fn adapt_get_minimum_balance_for_rent_exemption_result( source: &serde_json::Value, data_length: u64, -) -> kb_core::Result { +) -> ks_core::Result { let minimum_balance_lamports = match source.as_u64() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "getMinimumBalanceForRentExemption result must be an unsigned integer", )); }, @@ -1412,7 +1412,7 @@ pub fn adapt_get_minimum_balance_for_rent_exemption_result( /// Adapts a raw `requestAirdrop` result. pub fn adapt_request_airdrop_result( source: &serde_json::Value, -) -> kb_core::Result { +) -> ks_core::Result { let signature = match adapt_signature_result(source, "requestAirdrop result") { std::result::Result::Ok(signature) => signature, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1423,8 +1423,8 @@ pub fn adapt_request_airdrop_result( /// Adapts a raw `sendTransaction` result and verifies the returned primary signature. pub fn adapt_send_transaction_result( source: &serde_json::Value, - expected_signature: &kb_lib::MdSignature, -) -> kb_core::Result { + expected_signature: &ks_lib::MdSignature, +) -> ks_core::Result { let expected_validation = crate::validate_transaction_signature_text( expected_signature.0.as_str(), "sendTransaction expected signature", @@ -1437,7 +1437,7 @@ pub fn adapt_send_transaction_result( std::result::Result::Err(error) => return std::result::Result::Err(error), }; if signature != *expected_signature { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_send_signature_mismatch", format!( "sendTransaction returned signature '{}' but the signed transaction primary signature is '{}'", @@ -1451,14 +1451,14 @@ pub fn adapt_send_transaction_result( /// Adapts a raw `getSignatureStatuses` result. pub fn adapt_get_signature_statuses_result( source: &serde_json::Value, -) -> kb_core::Result { +) -> ks_core::Result { let parse_result = serde_json::from_value::< RpcContextValue>>, >(source.clone()); let parsed = match parse_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot parse getSignatureStatuses result: {error}" ))); }, @@ -1484,11 +1484,11 @@ pub fn adapt_get_signature_statuses_result( /// Adapts a raw `getEpochInfo` result. pub fn adapt_get_epoch_info_result( source: &serde_json::Value, -) -> kb_core::Result { +) -> ks_core::Result { let parse_result = serde_json::from_value::(source.clone()); return match parse_result { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::json(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::json(format!( "cannot parse getEpochInfo result: {error}" ))), }; @@ -1497,11 +1497,11 @@ pub fn adapt_get_epoch_info_result( /// Adapts a raw `getBlockHeight` result. pub fn adapt_get_block_height_result( source: &serde_json::Value, -) -> kb_core::Result { +) -> ks_core::Result { let block_height = match source.as_u64() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "getBlockHeight result must be an unsigned integer", )); }, @@ -1511,7 +1511,7 @@ pub fn adapt_get_block_height_result( impl crate::HttpClient { /// Returns the connected cluster genesis hash and known public-cluster classification. - pub async fn get_genesis_hash(&self) -> kb_core::Result { + pub async fn get_genesis_hash(&self) -> ks_core::Result { let result = self .execute_json_rpc_result_raw("getGenesisHash".to_string(), std::vec::Vec::new()) .await; @@ -1526,7 +1526,7 @@ impl crate::HttpClient { pub async fn get_epoch_info( &self, config: &crate::GetEpochInfoConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let result = self .execute_json_rpc_result_raw("getEpochInfo".to_string(), config.request_params()) .await; @@ -1541,7 +1541,7 @@ impl crate::HttpClient { pub async fn get_latest_blockhash( &self, config: &crate::GetLatestBlockhashConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let result = self .execute_json_rpc_result_raw("getLatestBlockhash".to_string(), config.request_params()) .await; @@ -1557,7 +1557,7 @@ impl crate::HttpClient { &self, encoded_message: &str, config: &crate::GetFeeForMessageConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let params_result = config.request_params(encoded_message); let params = match params_result { std::result::Result::Ok(params) => params, @@ -1576,7 +1576,7 @@ impl crate::HttpClient { &self, encoded_transaction: &str, config: &crate::SimulateTransactionConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let params_result = config.request_params(encoded_transaction); let params = match params_result { std::result::Result::Ok(params) => params, @@ -1595,9 +1595,9 @@ impl crate::HttpClient { /// Returns the lamport balance for one account. pub async fn get_balance( &self, - pubkey: &kb_lib::MdPubkey, + pubkey: &ks_lib::MdPubkey, config: &crate::GetBalanceConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let params = match config.request_params(pubkey) { std::result::Result::Ok(params) => params, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1613,9 +1613,9 @@ impl crate::HttpClient { /// Returns minimal account metadata or `None` when the address does not exist. pub async fn get_account_info( &self, - pubkey: &kb_lib::MdPubkey, + pubkey: &ks_lib::MdPubkey, config: &crate::GetAccountInfoConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let params = match config.request_params(pubkey) { std::result::Result::Ok(params) => params, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1633,7 +1633,7 @@ impl crate::HttpClient { &self, data_length: u64, config: &crate::GetMinimumBalanceForRentExemptionConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let result = self .execute_json_rpc_result_raw( "getMinimumBalanceForRentExemption".to_string(), @@ -1650,10 +1650,10 @@ impl crate::HttpClient { /// Requests a faucet airdrop to one account. pub async fn request_airdrop( &self, - pubkey: &kb_lib::MdPubkey, + pubkey: &ks_lib::MdPubkey, lamports: u64, config: &crate::RequestAirdropConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let params = match config.request_params(pubkey, lamports) { std::result::Result::Ok(params) => params, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1670,9 +1670,9 @@ impl crate::HttpClient { pub async fn send_transaction( &self, encoded_transaction: &str, - expected_signature: &kb_lib::MdSignature, + expected_signature: &ks_lib::MdSignature, config: &crate::SendTransactionConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let params = match config.request_params(encoded_transaction) { std::result::Result::Ok(params) => params, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1701,9 +1701,9 @@ impl crate::HttpClient { /// Returns current statuses for a bounded signature list. pub async fn get_signature_statuses( &self, - signatures: &[kb_lib::MdSignature], + signatures: &[ks_lib::MdSignature], config: &crate::GetSignatureStatusesConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let params = match config.request_params(signatures) { std::result::Result::Ok(params) => params, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1722,7 +1722,7 @@ impl crate::HttpClient { pub async fn get_block_height( &self, config: &crate::GetBlockHeightConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let result = self .execute_json_rpc_result_raw("getBlockHeight".to_string(), config.request_params()) .await; @@ -1739,7 +1739,7 @@ impl crate::HttpEndpointPool { pub async fn get_genesis_hash_for_role( &self, required_role: &str, - ) -> kb_core::Result { + ) -> ks_core::Result { let client_result = self.select_client_for_role_and_method(required_role, "getGenesisHash"); let client = match client_result { std::result::Result::Ok(client) => client, @@ -1753,7 +1753,7 @@ impl crate::HttpEndpointPool { &self, required_role: &str, config: &crate::GetEpochInfoConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let client_result = self.select_client_for_role_and_method(required_role, "getEpochInfo"); let client = match client_result { std::result::Result::Ok(client) => client, @@ -1767,7 +1767,7 @@ impl crate::HttpEndpointPool { &self, required_role: &str, config: &crate::GetLatestBlockhashConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let client_result = self.select_client_for_role_and_method(required_role, "getLatestBlockhash"); let client = match client_result { @@ -1783,7 +1783,7 @@ impl crate::HttpEndpointPool { required_role: &str, encoded_message: &str, config: &crate::GetFeeForMessageConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let client_result = self.select_client_for_role_and_method(required_role, "getFeeForMessage"); let client = match client_result { @@ -1799,7 +1799,7 @@ impl crate::HttpEndpointPool { required_role: &str, encoded_transaction: &str, config: &crate::SimulateTransactionConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let client_result = self.select_client_for_role_and_method(required_role, "simulateTransaction"); let client = match client_result { @@ -1813,9 +1813,9 @@ impl crate::HttpEndpointPool { pub async fn get_balance_for_role( &self, required_role: &str, - pubkey: &kb_lib::MdPubkey, + pubkey: &ks_lib::MdPubkey, config: &crate::GetBalanceConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let client_result = self.select_client_for_role_and_method(required_role, "getBalance"); let client = match client_result { std::result::Result::Ok(client) => client, @@ -1828,9 +1828,9 @@ impl crate::HttpEndpointPool { pub async fn get_account_info_for_role( &self, required_role: &str, - pubkey: &kb_lib::MdPubkey, + pubkey: &ks_lib::MdPubkey, config: &crate::GetAccountInfoConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let client_result = self.select_client_for_role_and_method(required_role, "getAccountInfo"); let client = match client_result { std::result::Result::Ok(client) => client, @@ -1845,7 +1845,7 @@ impl crate::HttpEndpointPool { required_role: &str, data_length: u64, config: &crate::GetMinimumBalanceForRentExemptionConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let client_result = self .select_client_for_role_and_method(required_role, "getMinimumBalanceForRentExemption"); let client = match client_result { @@ -1859,10 +1859,10 @@ impl crate::HttpEndpointPool { pub async fn request_airdrop_for_role( &self, required_role: &str, - pubkey: &kb_lib::MdPubkey, + pubkey: &ks_lib::MdPubkey, lamports: u64, config: &crate::RequestAirdropConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let client_result = self.select_client_for_role_and_method(required_role, "requestAirdrop"); let client = match client_result { std::result::Result::Ok(client) => client, @@ -1876,9 +1876,9 @@ impl crate::HttpEndpointPool { &self, required_role: &str, encoded_transaction: &str, - expected_signature: &kb_lib::MdSignature, + expected_signature: &ks_lib::MdSignature, config: &crate::SendTransactionConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let client_result = self.select_client_for_role_and_method(required_role, "sendTransaction"); let client = match client_result { @@ -1892,9 +1892,9 @@ impl crate::HttpEndpointPool { pub async fn get_signature_statuses_for_role( &self, required_role: &str, - signatures: &[kb_lib::MdSignature], + signatures: &[ks_lib::MdSignature], config: &crate::GetSignatureStatusesConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let client_result = self.select_client_for_role_and_method(required_role, "getSignatureStatuses"); let client = match client_result { @@ -1909,7 +1909,7 @@ impl crate::HttpEndpointPool { &self, required_role: &str, config: &crate::GetBlockHeightConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let client_result = self.select_client_for_role_and_method(required_role, "getBlockHeight"); let client = match client_result { std::result::Result::Ok(client) => client, @@ -1923,10 +1923,10 @@ impl crate::HttpEndpointPool { &self, status_role: &str, block_height_role: &str, - cluster: kb_lib::ExApiExecutionCluster, - signature: &kb_lib::MdSignature, + cluster: ks_lib::ExApiExecutionCluster, + signature: &ks_lib::MdSignature, config: &crate::ConfirmTransactionConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let status_config = crate::GetSignatureStatusesConfig::new(config.search_transaction_history); let block_height_config = @@ -1948,7 +1948,7 @@ impl crate::HttpEndpointPool { std::result::Result::Err(error) => return std::result::Result::Err(error), }; if statuses.statuses.len() != 1 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_confirmation_status_count_mismatch", format!( "getSignatureStatuses returned {} entries for one requested signature", @@ -1966,7 +1966,7 @@ impl crate::HttpEndpointPool { return std::result::Result::Ok(confirmation_result( cluster, signature, - kb_lib::ExApiExecutionConfirmationStatus::Failed, + ks_lib::ExApiExecutionConfirmationStatus::Failed, last_slot, attempts, last_observed_block_height, @@ -2013,7 +2013,7 @@ impl crate::HttpEndpointPool { return std::result::Result::Ok(confirmation_result( cluster, signature, - kb_lib::ExApiExecutionConfirmationStatus::Expired, + ks_lib::ExApiExecutionConfirmationStatus::Expired, last_slot, attempts, last_observed_block_height, @@ -2031,7 +2031,7 @@ impl crate::HttpEndpointPool { return std::result::Result::Ok(confirmation_result( cluster, signature, - kb_lib::ExApiExecutionConfirmationStatus::TimedOut, + ks_lib::ExApiExecutionConfirmationStatus::TimedOut, last_slot, attempts, last_observed_block_height, @@ -2044,14 +2044,14 @@ impl crate::HttpEndpointPool { } } -fn validate_base64_payload(value: &str, field_name: &str) -> kb_core::Result<()> { +fn validate_base64_payload(value: &str, field_name: &str) -> ks_core::Result<()> { if value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "{field_name} must not be empty" ))); } if value.len() > crate::MAX_EXECUTION_RPC_BASE64_LENGTH { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "{field_name} exceeds the local encoded length limit of {} bytes", crate::MAX_EXECUTION_RPC_BASE64_LENGTH ))); @@ -2060,13 +2060,13 @@ fn validate_base64_payload(value: &str, field_name: &str) -> kb_core::Result<()> let decoded = match decode_result { std::result::Result::Ok(decoded) => decoded, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "{field_name} is not valid base64: {error}" ))); }, }; if decoded.is_empty() { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "{field_name} must decode to at least one byte" ))); } @@ -2112,11 +2112,11 @@ struct RpcSimulationValue { fn adapt_signature_result( source: &serde_json::Value, field_name: &str, -) -> kb_core::Result { +) -> ks_core::Result { let signature = match source.as_str() { std::option::Option::Some(signature) => signature.to_string(), std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "{field_name} must be a base58 signature string" ))); }, @@ -2126,7 +2126,7 @@ fn adapt_signature_result( if let std::result::Result::Err(error) = validation_result { return std::result::Result::Err(error); } - return std::result::Result::Ok(kb_lib::MdSignature(signature)); + return std::result::Result::Ok(ks_lib::MdSignature(signature)); } fn commitment_rank(commitment: crate::RpcCommitmentLevel) -> u8 { @@ -2146,24 +2146,24 @@ fn commitment_reached( fn execution_confirmation_status( commitment: crate::RpcCommitmentLevel, -) -> kb_lib::ExApiExecutionConfirmationStatus { +) -> ks_lib::ExApiExecutionConfirmationStatus { return match commitment { - crate::RpcCommitmentLevel::Processed => kb_lib::ExApiExecutionConfirmationStatus::Processed, - crate::RpcCommitmentLevel::Confirmed => kb_lib::ExApiExecutionConfirmationStatus::Confirmed, - crate::RpcCommitmentLevel::Finalized => kb_lib::ExApiExecutionConfirmationStatus::Finalized, + crate::RpcCommitmentLevel::Processed => ks_lib::ExApiExecutionConfirmationStatus::Processed, + crate::RpcCommitmentLevel::Confirmed => ks_lib::ExApiExecutionConfirmationStatus::Confirmed, + crate::RpcCommitmentLevel::Finalized => ks_lib::ExApiExecutionConfirmationStatus::Finalized, }; } fn confirmation_result( - cluster: kb_lib::ExApiExecutionCluster, - signature: &kb_lib::MdSignature, - status: kb_lib::ExApiExecutionConfirmationStatus, + cluster: ks_lib::ExApiExecutionCluster, + signature: &ks_lib::MdSignature, + status: ks_lib::ExApiExecutionConfirmationStatus, slot: std::option::Option, attempts: u32, last_observed_block_height: std::option::Option, error: std::option::Option, -) -> kb_lib::ExApiExecutionConfirmationResult { - return kb_lib::ExApiExecutionConfirmationResult { +) -> ks_lib::ExApiExecutionConfirmationResult { + return ks_lib::ExApiExecutionConfirmationResult { cluster, signature: signature.clone(), status, @@ -2206,7 +2206,7 @@ mod tests { .unwrap_or_else(|error| panic!("unexpected error: {error}")); assert_eq!( devnet.classified_cluster, - std::option::Option::Some(kb_lib::ExApiExecutionCluster::Devnet) + std::option::Option::Some(ks_lib::ExApiExecutionCluster::Devnet) ); let mainnet = crate::adapt_get_genesis_hash_result(&serde_json::Value::String( crate::MAINNET_GENESIS_HASH.to_string(), @@ -2214,7 +2214,7 @@ mod tests { .unwrap_or_else(|error| panic!("unexpected error: {error}")); assert_eq!( mainnet.classified_cluster, - std::option::Option::Some(kb_lib::ExApiExecutionCluster::Mainnet) + std::option::Option::Some(ks_lib::ExApiExecutionCluster::Mainnet) ); let local = crate::adapt_get_genesis_hash_result(&serde_json::Value::String(valid_hash(7))) .unwrap_or_else(|error| panic!("unexpected error: {error}")); @@ -2261,7 +2261,7 @@ mod tests { let exact = crate::SimulateTransactionConfig::unsigned_exact(); assert!(!exact.signature_verification); assert!(!exact.replace_recent_blockhash); - let account = kb_lib::MdPubkey(valid_hash(11)); + let account = ks_lib::MdPubkey(valid_hash(11)); let accounts = crate::SimulationAccountsConfig::new(std::vec![account]) .unwrap_or_else(|error| panic!("unexpected error: {error}")); let config = crate::SimulateTransactionConfig::new( @@ -2362,8 +2362,8 @@ mod tests { fee_lamports: std::option::Option::Some(5000), }; let execution = rpc.to_execution_result( - kb_lib::ExApiExecutionCluster::Devnet, - kb_lib::ExApiExecutionBlockhashKind::Latest, + ks_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionBlockhashKind::Latest, std::option::Option::Some(3), std::option::Option::None, std::option::Option::None, @@ -2398,8 +2398,8 @@ mod tests { return bs58::encode([byte; 64]).into_string(); } - fn execution_config() -> kb_config::ExecutionConfig { - return kb_config::ExecutionConfig { + fn execution_config() -> ks_config::ExecutionConfig { + return ks_config::ExecutionConfig { dry_run_default: true, require_simulation: true, require_operator_confirmation: true, @@ -2448,7 +2448,7 @@ mod tests { #[test] fn balance_and_airdrop_requests_are_typed() { - let pubkey = kb_lib::MdPubkey(valid_hash(20)); + let pubkey = ks_lib::MdPubkey(valid_hash(20)); let balance_config = crate::GetBalanceConfig::confirmed(); let balance_params = balance_config .request_params(&pubkey) @@ -2475,7 +2475,7 @@ mod tests { #[test] fn account_existence_and_rent_requests_are_typed() { - let pubkey = kb_lib::MdPubkey(valid_hash(22)); + let pubkey = ks_lib::MdPubkey(valid_hash(22)); let account_config = crate::GetAccountInfoConfig::confirmed(); let account_params = account_config .request_params(&pubkey) @@ -2618,7 +2618,7 @@ mod tests { assert_eq!(params[1]["skipPreflight"], false); assert_eq!(params[1]["preflightCommitment"], "confirmed"); assert_eq!(params[1]["maxRetries"], 3); - let expected = kb_lib::MdSignature(valid_signature(22)); + let expected = ks_lib::MdSignature(valid_signature(22)); let accepted = crate::adapt_send_transaction_result(&serde_json::json!(expected.0.clone()), &expected) .unwrap_or_else(|error| panic!("unexpected error: {error}")); @@ -2629,7 +2629,7 @@ mod tests { #[test] fn signature_statuses_preserve_order_and_runtime_errors() { - let signature = kb_lib::MdSignature(valid_signature(24)); + let signature = ks_lib::MdSignature(valid_signature(24)); let config = crate::GetSignatureStatusesConfig::new(true); let params = config .request_params(std::slice::from_ref(&signature)) @@ -2676,7 +2676,7 @@ mod tests { assert!(config.request_params(&[]).is_err()); let signatures = (0..=crate::MAX_SIGNATURE_STATUS_COUNT) .map(|index| { - return kb_lib::MdSignature(valid_signature((index % 251) as u8)); + return ks_lib::MdSignature(valid_signature((index % 251) as u8)); }) .collect::>(); assert!(config.request_params(signatures.as_slice()).is_err()); diff --git a/kb-onchain-transport/src/get_signatures_for_address.rs b/ks-onchain-transport/src/get_signatures_for_address.rs similarity index 94% rename from kb-onchain-transport/src/get_signatures_for_address.rs rename to ks-onchain-transport/src/get_signatures_for_address.rs index 9dc20a9..3b01767 100644 --- a/kb-onchain-transport/src/get_signatures_for_address.rs +++ b/ks-onchain-transport/src/get_signatures_for_address.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/get_signatures_for_address.rs -// version: 2 +// file: ks-onchain-transport/src/get_signatures_for_address.rs +// version: 3 //! Standard Solana `getSignaturesForAddress` request and response contracts. @@ -44,15 +44,15 @@ impl GetSignaturesForAddressConfig { before: std::option::Option, until: std::option::Option, min_context_slot: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { let commitment_value = commitment.into(); if commitment_value != "confirmed" && commitment_value != "finalized" { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "getSignaturesForAddress commitment must be 'confirmed' or 'finalized'", )); } if limit == 0 || limit > 1000 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "getSignaturesForAddress limit must be between 1 and 1000", )); } @@ -77,7 +77,7 @@ impl GetSignaturesForAddressConfig { }); } - fn request_params(&self, address: &str) -> kb_core::Result> { + fn request_params(&self, address: &str) -> ks_core::Result> { let address_result = crate::validate_solana_pubkey_text(address, "getSignaturesForAddress address"); if let std::result::Result::Err(error) = address_result { @@ -114,7 +114,7 @@ impl crate::HttpClient { &self, address: &str, config: &crate::GetSignaturesForAddressConfig, - ) -> kb_core::Result> { + ) -> ks_core::Result> { let params_result = config.request_params(address); let params = match params_result { std::result::Result::Ok(value) => value, @@ -134,13 +134,13 @@ impl crate::HttpClient { /// Adapts a raw standard Solana `getSignaturesForAddress` result value. pub fn adapt_get_signatures_for_address_result( source: &serde_json::Value, -) -> kb_core::Result> { +) -> ks_core::Result> { let parse_result = serde_json::from_value::>(source.clone()); let parsed = match parse_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot parse getSignaturesForAddress result: {error}" ))); }, @@ -160,7 +160,7 @@ pub fn adapt_get_signatures_for_address_result( fn validate_optional_signature( value: std::option::Option<&std::string::String>, field_name: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if let std::option::Option::Some(signature) = value { return crate::validate_transaction_signature_text(signature.as_str(), field_name); } diff --git a/kb-onchain-transport/src/get_transaction.rs b/ks-onchain-transport/src/get_transaction.rs similarity index 89% rename from kb-onchain-transport/src/get_transaction.rs rename to ks-onchain-transport/src/get_transaction.rs index 046041e..d45e781 100644 --- a/kb-onchain-transport/src/get_transaction.rs +++ b/ks-onchain-transport/src/get_transaction.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/get_transaction.rs -// version: 10 +// file: ks-onchain-transport/src/get_transaction.rs +// version: 11 //! Standard Solana `getTransaction` adapter for the canonical transaction contract. @@ -14,7 +14,7 @@ pub trait CanonicalTransactionAdapter { fn adapt( &self, source: &Self::Source, - ) -> kb_core::Result>; + ) -> ks_core::Result>; } /// Configuration for a standard Solana `getTransaction` request. @@ -31,10 +31,10 @@ impl GetTransactionConfig { pub fn new( commitment: impl std::convert::Into, max_supported_transaction_version: u8, - ) -> kb_core::Result { + ) -> ks_core::Result { let commitment_value = commitment.into(); if commitment_value != "confirmed" && commitment_value != "finalized" { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "getTransaction commitment must be 'confirmed' or 'finalized'", )); } @@ -52,7 +52,7 @@ impl GetTransactionConfig { }; } - fn request_params(&self, signature: &str) -> kb_core::Result> { + fn request_params(&self, signature: &str) -> ks_core::Result> { let signature_result = crate::validate_transaction_signature_text(signature, "getTransaction signature"); if let std::result::Result::Err(error) = signature_result { @@ -75,7 +75,7 @@ pub struct GetTransactionAcquisition { /// Source-specific JSON result retained only for immediate metrics and hashing. pub source_json: serde_json::Value, /// Canonical source-independent transaction when the RPC result is not null. - pub canonical_transaction: std::option::Option, + pub canonical_transaction: std::option::Option, } /// Adapter from the standard Solana `getTransaction` JSON result to the canonical model. @@ -88,7 +88,7 @@ impl crate::CanonicalTransactionAdapter for crate::GetTransactionAdapter { fn adapt( &self, source: &Self::Source, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return adapt_get_transaction_result(source); } } @@ -99,7 +99,7 @@ impl crate::HttpClient { &self, signature: &str, config: &crate::GetTransactionConfig, - ) -> kb_core::Result { + ) -> ks_core::Result { let params_result = config.request_params(signature); let params = match params_result { std::result::Result::Ok(value) => value, @@ -127,7 +127,7 @@ impl crate::HttpClient { &self, signature: &str, config: &crate::GetTransactionConfig, - ) -> kb_core::Result> { + ) -> ks_core::Result> { let acquisition_result = self.get_transaction_acquisition(signature, config).await; let acquisition = match acquisition_result { std::result::Result::Ok(value) => value, @@ -140,7 +140,7 @@ impl crate::HttpClient { /// Adapts a raw standard Solana `getTransaction` result value. pub fn adapt_get_transaction_result( source: &serde_json::Value, -) -> kb_core::Result> { +) -> ks_core::Result> { if source.is_null() { return std::result::Result::Ok(std::option::Option::None); } @@ -148,7 +148,7 @@ pub fn adapt_get_transaction_result( let parsed = match parse_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot parse getTransaction result: {error}" ))); }, @@ -307,11 +307,11 @@ struct RpcReturnData { fn adapt_parsed_transaction( parsed: RpcGetTransactionResult, -) -> kb_core::Result { +) -> ks_core::Result { let primary_signature = match parsed.transaction.signatures.first() { std::option::Option::Some(value) => value.clone(), std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "getTransaction result contains no signatures", )); }, @@ -325,7 +325,7 @@ fn adapt_parsed_transaction( std::option::Option::Some(metadata) => { adapt_loaded_addresses(metadata.loaded_addresses.clone()) }, - std::option::Option::None => kb_lib::MdCanonicalLoadedAddresses::default(), + std::option::Option::None => ks_lib::MdCanonicalLoadedAddresses::default(), }; let instructions_result = adapt_instructions(parsed.transaction.message.instructions); let instructions = match instructions_result { @@ -337,15 +337,15 @@ fn adapt_parsed_transaction( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let transaction = kb_lib::MdCanonicalTransaction { - format_version: kb_lib::MD_CANONICAL_TRANSACTION_FORMAT_VERSION, + let transaction = ks_lib::MdCanonicalTransaction { + format_version: ks_lib::MD_CANONICAL_TRANSACTION_FORMAT_VERSION, primary_signature, slot: parsed.slot, block_time: parsed.block_time, version, signatures: parsed.transaction.signatures, - message: kb_lib::MdCanonicalTransactionMessage { - header: kb_lib::MdCanonicalMessageHeader { + message: ks_lib::MdCanonicalTransactionMessage { + header: ks_lib::MdCanonicalMessageHeader { num_required_signatures: parsed.transaction.message.header.num_required_signatures, num_readonly_signed_accounts: parsed .transaction @@ -367,7 +367,7 @@ fn adapt_parsed_transaction( .address_table_lookups .into_iter() .map(|lookup| { - return kb_lib::MdCanonicalAddressTableLookup { + return ks_lib::MdCanonicalAddressTableLookup { account_key: lookup.account_key, writable_indexes: lookup.writable_indexes, readonly_indexes: lookup.readonly_indexes, @@ -387,28 +387,28 @@ fn adapt_parsed_transaction( fn adapt_version( version: std::option::Option, -) -> kb_core::Result { +) -> ks_core::Result { return match version { std::option::Option::Some(RpcTransactionVersion::Legacy(value)) => { if value != "legacy" { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "unsupported textual transaction version: {value}" ))); } - std::result::Result::Ok(kb_lib::MdCanonicalTransactionVersion::Legacy) + std::result::Result::Ok(ks_lib::MdCanonicalTransactionVersion::Legacy) }, std::option::Option::Some(RpcTransactionVersion::Number(value)) => { - std::result::Result::Ok(kb_lib::MdCanonicalTransactionVersion::Number(value)) + std::result::Result::Ok(ks_lib::MdCanonicalTransactionVersion::Number(value)) }, std::option::Option::None => { - std::result::Result::Ok(kb_lib::MdCanonicalTransactionVersion::Legacy) + std::result::Result::Ok(ks_lib::MdCanonicalTransactionVersion::Legacy) }, }; } fn adapt_instructions( instructions: std::vec::Vec, -) -> kb_core::Result> { +) -> ks_core::Result> { let mut adapted = std::vec::Vec::with_capacity(instructions.len()); for instruction in instructions { let instruction_result = adapt_instruction(instruction); @@ -423,18 +423,18 @@ fn adapt_instructions( fn adapt_instruction( instruction: RpcCompiledInstruction, -) -> kb_core::Result { +) -> ks_core::Result { let decode_result = bs58::decode(instruction.data.as_str()).into_vec(); let bytes = match decode_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "getTransaction instruction data is not valid base58: {error}" ))); }, }; let data_base64 = base64::engine::general_purpose::STANDARD.encode(bytes); - return std::result::Result::Ok(kb_lib::MdCanonicalCompiledInstruction { + return std::result::Result::Ok(ks_lib::MdCanonicalCompiledInstruction { program_id_index: instruction.program_id_index, account_indexes: instruction.accounts, data_base64, @@ -444,19 +444,19 @@ fn adapt_instruction( fn adapt_loaded_addresses( loaded_addresses: std::option::Option, -) -> kb_lib::MdCanonicalLoadedAddresses { +) -> ks_lib::MdCanonicalLoadedAddresses { return match loaded_addresses { - std::option::Option::Some(value) => kb_lib::MdCanonicalLoadedAddresses { + std::option::Option::Some(value) => ks_lib::MdCanonicalLoadedAddresses { writable: value.writable, readonly: value.readonly, }, - std::option::Option::None => kb_lib::MdCanonicalLoadedAddresses::default(), + std::option::Option::None => ks_lib::MdCanonicalLoadedAddresses::default(), }; } fn adapt_metadata( metadata: std::option::Option, -) -> kb_core::Result> { +) -> ks_core::Result> { let source = match metadata { std::option::Option::Some(value) => value, std::option::Option::None => return std::result::Result::Ok(std::option::Option::None), @@ -482,12 +482,12 @@ fn adapt_metadata( std::result::Result::Err(error) => return std::result::Result::Err(error), }; let status = if source.err.is_some() { - kb_lib::MdCanonicalTransactionStatus::Failed + ks_lib::MdCanonicalTransactionStatus::Failed } else { - kb_lib::MdCanonicalTransactionStatus::Success + ks_lib::MdCanonicalTransactionStatus::Success }; return std::result::Result::Ok(std::option::Option::Some( - kb_lib::MdCanonicalTransactionMetadata { + ks_lib::MdCanonicalTransactionMetadata { status, error: source.err, fee: source.fee, @@ -502,7 +502,7 @@ fn adapt_metadata( .unwrap_or_default() .into_iter() .map(|reward| { - return kb_lib::MdCanonicalReward { + return ks_lib::MdCanonicalReward { pubkey: reward.pubkey, lamports: reward.lamports, post_balance: reward.post_balance, @@ -520,7 +520,7 @@ fn adapt_metadata( fn adapt_inner_instructions( groups: std::vec::Vec, -) -> kb_core::Result> { +) -> ks_core::Result> { let mut adapted = std::vec::Vec::with_capacity(groups.len()); for group in groups { let instructions_result = adapt_instructions(group.instructions); @@ -528,7 +528,7 @@ fn adapt_inner_instructions( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - adapted.push(kb_lib::MdCanonicalInnerInstructionGroup { + adapted.push(ks_lib::MdCanonicalInnerInstructionGroup { parent_instruction_index: group.index, instructions, }); @@ -538,10 +538,10 @@ fn adapt_inner_instructions( fn adapt_token_balances( balances: std::vec::Vec, -) -> kb_core::Result> { +) -> ks_core::Result> { let mut adapted = std::vec::Vec::with_capacity(balances.len()); for balance in balances { - let balance_result = kb_lib::MdCanonicalTokenBalance::new( + let balance_result = ks_lib::MdCanonicalTokenBalance::new( balance.account_index, balance.mint, balance.owner, @@ -560,23 +560,23 @@ fn adapt_token_balances( fn adapt_return_data( return_data: std::option::Option, -) -> kb_core::Result> { +) -> ks_core::Result> { let source = match return_data { std::option::Option::Some(value) => value, std::option::Option::None => return std::result::Result::Ok(std::option::Option::None), }; if source.data.len() != 2 { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "getTransaction return data must contain payload and encoding", )); } if source.data[1] != "base64" { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "unsupported getTransaction return data encoding: {}", source.data[1] ))); } - return std::result::Result::Ok(std::option::Option::Some(kb_lib::MdCanonicalReturnData { + return std::result::Result::Ok(std::option::Option::Some(ks_lib::MdCanonicalReturnData { program_id: source.program_id, data_base64: source.data[0].clone(), })); @@ -609,7 +609,7 @@ mod tests { } } - fn adapt_fixture(name: &str) -> kb_lib::MdCanonicalTransaction { + fn adapt_fixture(name: &str) -> ks_lib::MdCanonicalTransaction { let value = fixture(name); let result = crate::adapt_get_transaction_result(&value); match result { @@ -630,13 +630,13 @@ mod tests { #[test] fn legacy_success_preserves_token_balances_and_return_data() { let transaction = adapt_fixture("legacy_success"); - assert_eq!(transaction.version, kb_lib::MdCanonicalTransactionVersion::Legacy); + assert_eq!(transaction.version, ks_lib::MdCanonicalTransactionVersion::Legacy); assert_eq!(transaction.block_time, std::option::Option::Some(1_700_000_001)); let metadata = match transaction.metadata { std::option::Option::Some(value) => value, std::option::Option::None => panic!("metadata missing"), }; - assert_eq!(metadata.status, kb_lib::MdCanonicalTransactionStatus::Success); + assert_eq!(metadata.status, ks_lib::MdCanonicalTransactionStatus::Success); assert_eq!(transaction.message.instructions[0].data_base64, "AQ=="); assert_eq!(metadata.post_token_balances.len(), 1); assert_eq!(metadata.post_token_balances[0].amount, "12345678901234567890"); @@ -652,14 +652,14 @@ mod tests { std::option::Option::Some(value) => value, std::option::Option::None => panic!("metadata missing"), }; - assert_eq!(metadata.status, kb_lib::MdCanonicalTransactionStatus::Failed); + assert_eq!(metadata.status, ks_lib::MdCanonicalTransactionStatus::Failed); assert!(metadata.error.is_some()); } #[test] fn version_zero_preserves_alt_cpi_and_token_2022() { let transaction = adapt_fixture("v0_alt"); - assert_eq!(transaction.version, kb_lib::MdCanonicalTransactionVersion::Number(0)); + assert_eq!(transaction.version, ks_lib::MdCanonicalTransactionVersion::Number(0)); assert_eq!(transaction.message.address_table_lookups.len(), 1); assert_eq!(transaction.message.loaded_addresses.writable.len(), 1); let metadata = match transaction.metadata { diff --git a/kb-onchain-transport/src/http_client.rs b/ks-onchain-transport/src/http_client.rs similarity index 95% rename from kb-onchain-transport/src/http_client.rs rename to ks-onchain-transport/src/http_client.rs index 00b7a17..079f8d1 100644 --- a/kb-onchain-transport/src/http_client.rs +++ b/ks-onchain-transport/src/http_client.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/http_client.rs -// version: 13 +// file: ks-onchain-transport/src/http_client.rs +// version: 14 //! HTTP JSON-RPC client for standard Solana RPC endpoints. @@ -50,7 +50,7 @@ struct HttpRequestLimiter { } impl HttpRequestLimiter { - fn new(config: &kb_config::EndpointRoleConfig) -> Self { + fn new(config: &ks_config::EndpointRoleConfig) -> Self { let now = std::time::Instant::now(); let burst_capacity = config.burst_capacity.max(1); let max_concurrent_requests = config.max_concurrent_requests.max(1); @@ -81,7 +81,7 @@ impl HttpRequestLimiter { return false; } - async fn acquire(&self) -> kb_core::Result { + async fn acquire(&self) -> ks_core::Result { loop { let wait_duration = { let mut state = self.state.lock().await; @@ -114,7 +114,7 @@ impl HttpRequestLimiter { return match permit_result { std::result::Result::Ok(permit) => std::result::Result::Ok(permit), std::result::Result::Err(error) => { - std::result::Result::Err(kb_core::Error::invalid_state(format!( + std::result::Result::Err(ks_core::Error::invalid_state(format!( "http request limiter '{}' is closed: {error}", self.role ))) @@ -140,7 +140,7 @@ impl HttpRequestLimiter { /// HTTP JSON-RPC client bound to one configured endpoint. #[derive(Clone, Debug)] pub struct HttpClient { - endpoint: kb_config::HttpEndpointConfig, + endpoint: ks_config::HttpEndpointConfig, client: reqwest::Client, next_request_id: std::sync::Arc, request_limiters: std::sync::Arc>>, @@ -149,10 +149,10 @@ pub struct HttpClient { impl crate::HttpClient { /// Creates a new HTTP client bound to one endpoint. - pub fn new(endpoint: kb_config::HttpEndpointConfig) -> kb_core::Result { + pub fn new(endpoint: ks_config::HttpEndpointConfig) -> ks_core::Result { if !endpoint.enabled { tracing::error!(target: crate::TRACING_TARGET, action = "create_http_client", endpoint_name = %endpoint.name, provider = %endpoint.provider, error_code = "http_endpoint_disabled", "cannot create HTTP client for disabled endpoint"); - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "http endpoint '{}' is disabled", endpoint.name ))); @@ -168,7 +168,7 @@ impl crate::HttpClient { std::result::Result::Ok(client) => client, std::result::Result::Err(error) => { tracing::error!(target: crate::TRACING_TARGET, action = "create_http_client", endpoint_name = %endpoint.name, provider = %endpoint.provider, error = %error, "HTTP client construction failed"); - return std::result::Result::Err(kb_core::Error::http(format!( + return std::result::Result::Err(ks_core::Error::http(format!( "cannot build http client for endpoint '{}': {error}", endpoint.name ))); @@ -213,7 +213,7 @@ impl crate::HttpClient { } /// Returns the endpoint configuration. - pub fn endpoint_config(&self) -> &kb_config::HttpEndpointConfig { + pub fn endpoint_config(&self) -> &ks_config::HttpEndpointConfig { return &self.endpoint; } @@ -258,7 +258,7 @@ impl crate::HttpClient { pub async fn execute_standard_request( &self, request: &Request, - ) -> kb_core::Result<::Response> + ) -> ks_core::Result<::Response> where Request: crate::StandardHttpRequest, { @@ -266,14 +266,14 @@ impl crate::HttpClient { match crate::standard_http_method(::METHOD) { std::option::Option::Some(specification) => specification, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "typed standard request '{}' is absent from the canonical registry", ::METHOD ))); }, }; if specification.contract != crate::StandardRpcContract::TypedAdapter { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "standard request '{}' is not declared as a typed adapter", ::METHOD ))); @@ -297,7 +297,7 @@ impl crate::HttpClient { ) { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(error) => { - std::result::Result::Err(kb_core::Error::json(format!( + std::result::Result::Err(ks_core::Error::json(format!( "cannot decode standard JSON-RPC result for '{}': {error}", ::METHOD ))) @@ -310,7 +310,7 @@ impl crate::HttpClient { &self, method: &crate::StandardHttpMethodSpec, params: std::vec::Vec, - ) -> kb_core::Result { + ) -> ks_core::Result { return self.execute_json_rpc_result_raw(method.method.to_string(), params).await; } @@ -319,7 +319,7 @@ impl crate::HttpClient { &self, method: std::string::String, params: std::vec::Vec, - ) -> kb_core::Result { + ) -> ks_core::Result { let request_id = self.next_request_id.fetch_add(1, std::sync::atomic::Ordering::Relaxed); let parameter_count = params.len(); let method_class = crate::HttpClient::classify_method(method.as_str()); @@ -343,7 +343,7 @@ impl crate::HttpClient { std::result::Result::Ok(response) => response, std::result::Result::Err(error) => { tracing::error!(target: crate::TRACING_TARGET, action = "execute_http_json_rpc", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id, method = %method, retry_index, error = %error, "HTTP JSON-RPC transport failed"); - return std::result::Result::Err(kb_core::Error::http(format!( + return std::result::Result::Err(ks_core::Error::http(format!( "http json-rpc request '{}' failed on endpoint '{}': {error}", method, self.endpoint.name ))); @@ -356,7 +356,7 @@ impl crate::HttpClient { std::result::Result::Ok(text) => text, std::result::Result::Err(error) => { tracing::error!(target: crate::TRACING_TARGET, action = "execute_http_json_rpc", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id, method = %method, http_status = %status, retry_index, error = %error, "HTTP JSON-RPC response body read failed"); - return std::result::Result::Err(kb_core::Error::http(format!( + return std::result::Result::Err(ks_core::Error::http(format!( "cannot read http json-rpc response '{}' from endpoint '{}': {error}", method, self.endpoint.name ))); @@ -382,7 +382,7 @@ impl crate::HttpClient { } if !status.is_success() { tracing::error!(target: crate::TRACING_TARGET, action = "execute_http_json_rpc", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id, method = %method, http_status = %status, retry_index, response_byte_length = text.len(), "HTTP JSON-RPC endpoint returned non-success status"); - return std::result::Result::Err(kb_core::Error::http(format!( + return std::result::Result::Err(ks_core::Error::http(format!( "http json-rpc endpoint '{}' returned status {} after {} retries: {}", self.endpoint.name, status, retry_index, text ))); @@ -421,7 +421,7 @@ impl crate::HttpClient { }, crate::JsonRpcResponse::Error(error_response) => { tracing::error!(target: crate::TRACING_TARGET, action = "execute_http_json_rpc", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id, method = %method, retry_index, rpc_error_code = error_response.error.code, rpc_error_message = %error_response.error.message, "HTTP JSON-RPC endpoint returned an RPC error"); - return std::result::Result::Err(kb_core::Error::http(format!( + return std::result::Result::Err(ks_core::Error::http(format!( "json-rpc error {} from '{}' after {} retries: {}", error_response.error.code, self.endpoint.name, @@ -431,7 +431,7 @@ impl crate::HttpClient { }, crate::JsonRpcResponse::Notification(_) => { tracing::error!(target: crate::TRACING_TARGET, action = "execute_http_json_rpc", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id, method = %method, retry_index, "HTTP JSON-RPC response was an unexpected notification"); - return std::result::Result::Err(kb_core::Error::http( + return std::result::Result::Err(ks_core::Error::http( "http json-rpc response cannot be a notification".to_string(), )); }, @@ -520,8 +520,8 @@ mod tests { fn role_config( role: &str, request_kinds: std::vec::Vec, - ) -> kb_config::EndpointRoleConfig { - return kb_config::EndpointRoleConfig { + ) -> ks_config::EndpointRoleConfig { + return ks_config::EndpointRoleConfig { role: role.to_string(), enabled: true, request_kinds, @@ -534,8 +534,8 @@ mod tests { }; } - fn endpoint(enabled: bool) -> kb_config::HttpEndpointConfig { - return kb_config::HttpEndpointConfig { + fn endpoint(enabled: bool) -> ks_config::HttpEndpointConfig { + return ks_config::HttpEndpointConfig { name: "http_a".to_string(), enabled, provider: "test".to_string(), diff --git a/kb-onchain-transport/src/http_pool.rs b/ks-onchain-transport/src/http_pool.rs similarity index 92% rename from kb-onchain-transport/src/http_pool.rs rename to ks-onchain-transport/src/http_pool.rs index 74e9f93..9a1db7a 100644 --- a/kb-onchain-transport/src/http_pool.rs +++ b/ks-onchain-transport/src/http_pool.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/http_pool.rs -// version: 8 +// file: ks-onchain-transport/src/http_pool.rs +// version: 9 //! HTTP endpoint pool and role-based routing. @@ -12,7 +12,7 @@ pub struct HttpEndpointPool { impl crate::HttpEndpointPool { /// Builds a pool from the active profile HTTP endpoint list. - pub fn from_profile(profile: &kb_config::ProfileConfig) -> kb_core::Result { + pub fn from_profile(profile: &ks_config::ProfileConfig) -> ks_core::Result { let mut clients = std::vec::Vec::new(); for endpoint in &profile.solana.http_endpoints { if !endpoint.enabled { @@ -28,10 +28,10 @@ impl crate::HttpEndpointPool { } /// Creates a pool from already constructed clients. - pub fn new(clients: std::vec::Vec) -> kb_core::Result { + pub fn new(clients: std::vec::Vec) -> ks_core::Result { if clients.is_empty() { tracing::error!(target: crate::TRACING_TARGET, action = "create_http_pool", error_code = "http_pool_empty", "HTTP endpoint pool has no enabled endpoint"); - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "http endpoint pool requires at least one enabled endpoint".to_string(), )); } @@ -56,7 +56,7 @@ impl crate::HttpEndpointPool { &self, required_role: &str, method: &str, - ) -> kb_core::Result { + ) -> ks_core::Result { let request_kind = crate::request_kind_from_method(method); return self.select_client_for_role_and_kind(required_role, &request_kind); } @@ -66,9 +66,9 @@ impl crate::HttpEndpointPool { &self, required_role: &str, request_kind: &str, - ) -> kb_core::Result { + ) -> ks_core::Result { if self.clients.is_empty() { - return std::result::Result::Err(kb_core::Error::not_connected( + return std::result::Result::Err(ks_core::Error::not_connected( "http endpoint pool has no clients".to_string(), )); } @@ -86,7 +86,7 @@ impl crate::HttpEndpointPool { offset += 1; } tracing::error!(target: crate::TRACING_TARGET, action = "select_http_endpoint", required_role, request_kind, endpoint_count = self.clients.len(), error_code = "http_endpoint_not_found", "no HTTP endpoint supports requested role and kind"); - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "no http endpoint supports role '{}' and request kind '{}'", required_role, request_kind ))); @@ -97,7 +97,7 @@ impl crate::HttpEndpointPool { &self, required_role: &str, request: &Request, - ) -> kb_core::Result<::Response> + ) -> ks_core::Result<::Response> where Request: crate::StandardHttpRequest, { @@ -117,7 +117,7 @@ impl crate::HttpEndpointPool { required_role: &str, method: &crate::StandardHttpMethodSpec, params: std::vec::Vec, - ) -> kb_core::Result { + ) -> ks_core::Result { let client = match self.select_client_for_role_and_method(required_role, method.method) { std::result::Result::Ok(client) => client, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -131,7 +131,7 @@ impl crate::HttpEndpointPool { required_role: &str, method: std::string::String, params: std::vec::Vec, - ) -> kb_core::Result { + ) -> ks_core::Result { let client = match self.select_client_for_role_and_method(required_role, &method) { std::result::Result::Ok(client) => client, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -145,8 +145,8 @@ mod tests { fn role_config( role: &str, request_kinds: std::vec::Vec, - ) -> kb_config::EndpointRoleConfig { - return kb_config::EndpointRoleConfig { + ) -> ks_config::EndpointRoleConfig { + return ks_config::EndpointRoleConfig { role: role.to_string(), enabled: true, request_kinds, @@ -163,8 +163,8 @@ mod tests { name: &str, role: &str, request_kinds: std::vec::Vec, - ) -> kb_config::HttpEndpointConfig { - return kb_config::HttpEndpointConfig { + ) -> ks_config::HttpEndpointConfig { + return ks_config::HttpEndpointConfig { name: name.to_string(), enabled: true, provider: "test".to_string(), @@ -177,7 +177,7 @@ mod tests { }; } - fn client(endpoint: kb_config::HttpEndpointConfig) -> crate::HttpClient { + fn client(endpoint: ks_config::HttpEndpointConfig) -> crate::HttpClient { match crate::HttpClient::new(endpoint) { std::result::Result::Ok(client) => return client, std::result::Result::Err(error) => panic!("client creation failed: {error}"), diff --git a/kb-onchain-transport/src/json_rpc.rs b/ks-onchain-transport/src/json_rpc.rs similarity index 93% rename from kb-onchain-transport/src/json_rpc.rs rename to ks-onchain-transport/src/json_rpc.rs index d90c6fd..aa9d5ed 100644 --- a/kb-onchain-transport/src/json_rpc.rs +++ b/ks-onchain-transport/src/json_rpc.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/json_rpc.rs -// version: 4 +// file: ks-onchain-transport/src/json_rpc.rs +// version: 5 //! JSON-RPC 2.0 envelopes used by Solana HTTP and WebSocket transports. @@ -32,11 +32,11 @@ impl crate::JsonRpcRequest { } /// Serializes the request into a compact JSON string. - pub fn to_json_string(&self) -> kb_core::Result { + pub fn to_json_string(&self) -> ks_core::Result { let serialization_result = serde_json::to_string(self); return match serialization_result { std::result::Result::Ok(text) => std::result::Result::Ok(text), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::json( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::json( format!("cannot serialize json-rpc request '{}': {error}", self.method), )), }; @@ -118,14 +118,14 @@ impl crate::JsonRpcResponse { } /// Converts the parsed response into a JSON value for UI display. - pub fn to_value(&self) -> kb_core::Result { + pub fn to_value(&self) -> ks_core::Result { return match self { Self::Success(response) => { let value_result = serde_json::to_value(response); match value_result { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(error) => { - std::result::Result::Err(kb_core::Error::json(error.to_string())) + std::result::Result::Err(ks_core::Error::json(error.to_string())) }, } }, @@ -134,7 +134,7 @@ impl crate::JsonRpcResponse { match value_result { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(error) => { - std::result::Result::Err(kb_core::Error::json(error.to_string())) + std::result::Result::Err(ks_core::Error::json(error.to_string())) }, } }, @@ -143,7 +143,7 @@ impl crate::JsonRpcResponse { match value_result { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(error) => { - std::result::Result::Err(kb_core::Error::json(error.to_string())) + std::result::Result::Err(ks_core::Error::json(error.to_string())) }, } }, @@ -152,11 +152,11 @@ impl crate::JsonRpcResponse { } /// Parses an incoming JSON-RPC text payload. -pub fn parse_json_rpc_text(text: &str) -> kb_core::Result { +pub fn parse_json_rpc_text(text: &str) -> ks_core::Result { let value = match serde_json::from_str::(text) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot parse json-rpc text: {error}" ))); }, @@ -164,7 +164,7 @@ pub fn parse_json_rpc_text(text: &str) -> kb_core::Result object, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "json-rpc payload must be an object".to_string(), )); }, @@ -180,7 +180,7 @@ pub fn parse_json_rpc_text(text: &str) -> kb_core::Result { std::result::Result::Ok(crate::JsonRpcResponse::Notification(notification)) }, - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::json( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::json( format!("cannot parse json-rpc notification: {error}"), )), }; @@ -191,7 +191,7 @@ pub fn parse_json_rpc_text(text: &str) -> kb_core::Result { std::result::Result::Ok(crate::JsonRpcResponse::Success(response)) }, - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::json( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::json( format!("cannot parse json-rpc success response: {error}"), )), }; @@ -202,12 +202,12 @@ pub fn parse_json_rpc_text(text: &str) -> kb_core::Result { std::result::Result::Ok(crate::JsonRpcResponse::Error(response)) }, - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::json( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::json( format!("cannot parse json-rpc error response: {error}"), )), }; } - return std::result::Result::Err(kb_core::Error::json( + return std::result::Result::Err(ks_core::Error::json( "unsupported json-rpc response shape".to_string(), )); } diff --git a/kb-onchain-transport/src/lib.rs b/ks-onchain-transport/src/lib.rs similarity index 99% rename from kb-onchain-transport/src/lib.rs rename to ks-onchain-transport/src/lib.rs index 0bcf4cf..06d18c5 100644 --- a/kb-onchain-transport/src/lib.rs +++ b/ks-onchain-transport/src/lib.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/lib.rs -// version: 8 +// file: ks-onchain-transport/src/lib.rs +// version: 9 #![forbid(unsafe_code)] #![deny(unreachable_pub)] diff --git a/kb-onchain-transport/src/standard_http.rs b/ks-onchain-transport/src/standard_http.rs similarity index 94% rename from kb-onchain-transport/src/standard_http.rs rename to ks-onchain-transport/src/standard_http.rs index 34d059f..d84b187 100644 --- a/kb-onchain-transport/src/standard_http.rs +++ b/ks-onchain-transport/src/standard_http.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/standard_http.rs -// version: 3 +// file: ks-onchain-transport/src/standard_http.rs +// version: 4 //! Shared contracts for configurable standard Solana HTTP JSON-RPC requests. @@ -14,7 +14,7 @@ pub trait StandardHttpRequest { const METHOD: &'static str; /// Builds the exact positional JSON-RPC parameter array. - fn params(&self) -> kb_core::Result>; + fn params(&self) -> ks_core::Result>; } /// Standard contextual Solana RPC response. @@ -122,9 +122,9 @@ pub struct RpcDataSlice { } impl crate::RpcDataSlice { - fn validate(&self) -> kb_core::Result<()> { + fn validate(&self) -> ks_core::Result<()> { if self.offset.checked_add(self.length).is_none() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "account data slice offset and length overflow usize", )); } @@ -152,14 +152,14 @@ pub struct RpcAccountInfoConfig { impl crate::RpcAccountInfoConfig { /// Validates combinations that the standard account RPC contract cannot represent. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if let std::option::Option::Some(data_slice) = self.data_slice { let slice_result = data_slice.validate(); if let std::result::Result::Err(error) = slice_result { return std::result::Result::Err(error); } if self.encoding == std::option::Option::Some(crate::RpcAccountEncoding::JsonParsed) { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "jsonParsed account encoding cannot be combined with dataSlice", )); } @@ -181,11 +181,11 @@ pub enum RpcMemcmpEncodedBytes { } impl crate::RpcMemcmpEncodedBytes { - fn validate(&self) -> kb_core::Result<()> { + fn validate(&self) -> ks_core::Result<()> { let decoded_length = match self { Self::Base58(value) => { if value.len() > crate::MAX_MEMCMP_BASE58_LENGTH { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "memcmp base58 value must not exceed {} characters", crate::MAX_MEMCMP_BASE58_LENGTH ))); @@ -193,7 +193,7 @@ impl crate::RpcMemcmpEncodedBytes { let decoded = match bs58::decode(value).into_vec() { std::result::Result::Ok(decoded) => decoded, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "memcmp base58 value is invalid: {error}" ))); }, @@ -202,7 +202,7 @@ impl crate::RpcMemcmpEncodedBytes { }, Self::Base64(value) => { if value.len() > crate::MAX_MEMCMP_BASE64_LENGTH { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "memcmp base64 value must not exceed {} characters", crate::MAX_MEMCMP_BASE64_LENGTH ))); @@ -210,7 +210,7 @@ impl crate::RpcMemcmpEncodedBytes { let decoded = match base64::prelude::BASE64_STANDARD.decode(value) { std::result::Result::Ok(decoded) => decoded, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "memcmp base64 value is invalid: {error}" ))); }, @@ -220,7 +220,7 @@ impl crate::RpcMemcmpEncodedBytes { Self::Bytes(value) => value.len(), }; if decoded_length > crate::MAX_MEMCMP_DECODED_BYTES { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "memcmp value must not exceed {} decoded bytes", crate::MAX_MEMCMP_DECODED_BYTES ))); @@ -252,7 +252,7 @@ pub enum RpcProgramAccountFilter { } impl crate::RpcProgramAccountFilter { - fn validate(&self) -> kb_core::Result<()> { + fn validate(&self) -> ks_core::Result<()> { if let Self::Memcmp(memcmp) = self { return memcmp.bytes.validate(); } @@ -289,7 +289,7 @@ pub struct RpcProgramAccountsConfig { impl crate::RpcProgramAccountsConfig { /// Validates account encoding, data slicing and every filter. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { let account_config = crate::RpcAccountInfoConfig { encoding: self.encoding, data_slice: self.data_slice, @@ -324,7 +324,7 @@ pub enum RpcTokenAccountsFilter { impl crate::RpcTokenAccountsFilter { /// Validates the public key embedded in the selected filter. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { let value = match self { Self::Mint(value) | Self::ProgramId(value) => value, }; @@ -404,10 +404,10 @@ pub struct RpcAccountBalance { pub(crate) fn serialize_parameter( method: &str, value: &T, -) -> kb_core::Result { +) -> ks_core::Result { return match serde_json::to_value(value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::json(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::json(format!( "cannot serialize {method} parameter: {error}" ))), }; @@ -417,9 +417,9 @@ pub(crate) fn validate_pubkey_list( values: &[std::string::String], field: &str, maximum: usize, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if values.len() > maximum { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "{field} must not exceed {maximum} entries" ))); } diff --git a/kb-onchain-transport/src/standard_http_accounts.rs b/ks-onchain-transport/src/standard_http_accounts.rs similarity index 97% rename from kb-onchain-transport/src/standard_http_accounts.rs rename to ks-onchain-transport/src/standard_http_accounts.rs index 67e6a56..3725bf1 100644 --- a/kb-onchain-transport/src/standard_http_accounts.rs +++ b/ks-onchain-transport/src/standard_http_accounts.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/standard_http_accounts.rs -// version: 2 +// file: ks-onchain-transport/src/standard_http_accounts.rs +// version: 3 //! Configurable standard account-oriented Solana HTTP JSON-RPC requests. @@ -40,7 +40,7 @@ impl crate::StandardHttpRequest for crate::GetLargestAccountsRequest { const METHOD: &'static str = "getLargestAccounts"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { if let std::option::Option::Some(config) = &self.config { let value = match crate::serialize_parameter(Self::METHOD, config) { std::result::Result::Ok(value) => value, @@ -66,7 +66,7 @@ impl crate::StandardHttpRequest for crate::GetMultipleAccountsRequest { const METHOD: &'static str = "getMultipleAccounts"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { let validation_result = crate::validate_pubkey_list( &self.addresses, "getMultipleAccounts address", @@ -111,7 +111,7 @@ impl crate::StandardHttpRequest for crate::GetProgramAccountsRequest { const METHOD: &'static str = "getProgramAccounts"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { let validation_result = crate::validate_solana_pubkey_text(&self.program_id, "getProgramAccounts program id"); if let std::result::Result::Err(error) = validation_result { diff --git a/kb-onchain-transport/src/standard_http_blocks.rs b/ks-onchain-transport/src/standard_http_blocks.rs similarity index 94% rename from kb-onchain-transport/src/standard_http_blocks.rs rename to ks-onchain-transport/src/standard_http_blocks.rs index da67b16..add0b9c 100644 --- a/kb-onchain-transport/src/standard_http_blocks.rs +++ b/ks-onchain-transport/src/standard_http_blocks.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/standard_http_blocks.rs -// version: 2 +// file: ks-onchain-transport/src/standard_http_blocks.rs +// version: 3 //! Configurable standard block and ledger Solana HTTP JSON-RPC requests. @@ -26,9 +26,9 @@ pub struct RpcBlockConfig { impl crate::RpcBlockConfig { /// Rejects the processed commitment unsupported by block-history methods. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.commitment == std::option::Option::Some(crate::RpcCommitmentLevel::Processed) { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "getBlock does not support processed commitment", )); } @@ -64,7 +64,7 @@ pub struct RpcBlockProductionConfig { impl crate::RpcBlockProductionConfig { /// Validates identity and range ordering. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if let std::option::Option::Some(identity) = &self.identity { let identity_result = crate::validate_solana_pubkey_text(identity, "getBlockProduction identity"); @@ -75,7 +75,7 @@ impl crate::RpcBlockProductionConfig { if let std::option::Option::Some(range) = self.range { if let std::option::Option::Some(last_slot) = range.last_slot { if last_slot < range.first_slot { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "getBlockProduction last slot must not precede first slot", )); } @@ -209,7 +209,7 @@ impl crate::StandardHttpRequest for crate::GetBlockRequest { const METHOD: &'static str = "getBlock"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { let mut params = std::vec![serde_json::Value::from(self.slot)]; if let std::option::Option::Some(config) = &self.config { let config_result = config.validate(); @@ -238,7 +238,7 @@ impl crate::StandardHttpRequest for crate::GetBlockCommitmentRequest { const METHOD: &'static str = "getBlockCommitment"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return std::result::Result::Ok(std::vec![serde_json::Value::from(self.slot)]); } } @@ -255,7 +255,7 @@ impl crate::StandardHttpRequest for crate::GetBlockProductionRequest { const METHOD: &'static str = "getBlockProduction"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { if let std::option::Option::Some(config) = &self.config { let validation_result = config.validate(); if let std::result::Result::Err(error) = validation_result { @@ -287,12 +287,12 @@ impl crate::StandardHttpRequest for crate::GetBlocksRequest { const METHOD: &'static str = "getBlocks"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { if let std::option::Option::Some(end_slot) = self.end_slot { if end_slot >= self.start_slot && end_slot.saturating_sub(self.start_slot) > crate::MAX_BLOCK_RANGE { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "getBlocks range must not exceed {} slots", crate::MAX_BLOCK_RANGE ))); @@ -301,7 +301,7 @@ impl crate::StandardHttpRequest for crate::GetBlocksRequest { if let std::option::Option::Some(config) = &self.config { if config.commitment == std::option::Option::Some(crate::RpcCommitmentLevel::Processed) { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "getBlocks does not support processed commitment", )); } @@ -337,9 +337,9 @@ impl crate::StandardHttpRequest for crate::GetBlocksWithLimitRequest { const METHOD: &'static str = "getBlocksWithLimit"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { if self.limit > crate::MAX_BLOCK_RANGE { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "getBlocksWithLimit limit must not exceed {}", crate::MAX_BLOCK_RANGE ))); @@ -347,7 +347,7 @@ impl crate::StandardHttpRequest for crate::GetBlocksWithLimitRequest { if let std::option::Option::Some(config) = &self.config { if config.commitment == std::option::Option::Some(crate::RpcCommitmentLevel::Processed) { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "getBlocksWithLimit does not support processed commitment", )); } @@ -379,7 +379,7 @@ impl crate::StandardHttpRequest for crate::GetBlockTimeRequest { const METHOD: &'static str = "getBlockTime"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return std::result::Result::Ok(std::vec![serde_json::Value::from(self.slot)]); } } @@ -393,7 +393,7 @@ impl crate::StandardHttpRequest for crate::GetFirstAvailableBlockRequest { const METHOD: &'static str = "getFirstAvailableBlock"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -410,10 +410,10 @@ impl crate::StandardHttpRequest for crate::GetRecentPerformanceSamplesRequest { const METHOD: &'static str = "getRecentPerformanceSamples"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { if let std::option::Option::Some(limit) = self.limit { if limit > crate::MAX_PERFORMANCE_SAMPLE_COUNT { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "getRecentPerformanceSamples limit must not exceed {}", crate::MAX_PERFORMANCE_SAMPLE_COUNT ))); @@ -433,7 +433,7 @@ impl crate::StandardHttpRequest for crate::MinimumLedgerSlotRequest { const METHOD: &'static str = "minimumLedgerSlot"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } diff --git a/kb-onchain-transport/src/standard_http_cluster.rs b/ks-onchain-transport/src/standard_http_cluster.rs similarity index 94% rename from kb-onchain-transport/src/standard_http_cluster.rs rename to ks-onchain-transport/src/standard_http_cluster.rs index 55e24eb..9fa6f6c 100644 --- a/kb-onchain-transport/src/standard_http_cluster.rs +++ b/ks-onchain-transport/src/standard_http_cluster.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/standard_http_cluster.rs -// version: 2 +// file: ks-onchain-transport/src/standard_http_cluster.rs +// version: 3 //! Configurable standard cluster-oriented Solana HTTP JSON-RPC requests. @@ -85,7 +85,7 @@ pub struct RpcLeaderScheduleConfig { impl crate::RpcLeaderScheduleConfig { /// Validates the optional identity public key. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if let std::option::Option::Some(identity) = &self.identity { return crate::validate_solana_pubkey_text(identity, "getLeaderSchedule identity"); } @@ -126,7 +126,7 @@ pub struct RpcGetVoteAccountsConfig { impl crate::RpcGetVoteAccountsConfig { /// Validates the optional vote account public key. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if let std::option::Option::Some(vote_pubkey) = &self.vote_pubkey { return crate::validate_solana_pubkey_text(vote_pubkey, "getVoteAccounts vote account"); } @@ -177,7 +177,7 @@ impl crate::StandardHttpRequest for crate::GetClusterNodesRequest { const METHOD: &'static str = "getClusterNodes"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -191,7 +191,7 @@ impl crate::StandardHttpRequest for crate::GetEpochScheduleRequest { const METHOD: &'static str = "getEpochSchedule"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -205,7 +205,7 @@ impl crate::StandardHttpRequest for crate::GetHealthRequest { const METHOD: &'static str = "getHealth"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -219,7 +219,7 @@ impl crate::StandardHttpRequest for crate::GetHighestSnapshotSlotRequest { const METHOD: &'static str = "getHighestSnapshotSlot"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -233,7 +233,7 @@ impl crate::StandardHttpRequest for crate::GetIdentityRequest { const METHOD: &'static str = "getIdentity"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -252,7 +252,7 @@ impl crate::StandardHttpRequest for crate::GetLeaderScheduleRequest { const METHOD: &'static str = "getLeaderSchedule"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { if let std::option::Option::Some(config) = &self.config { let validation_result = config.validate(); if let std::result::Result::Err(error) = validation_result { @@ -285,7 +285,7 @@ impl crate::StandardHttpRequest for crate::GetMaxRetransmitSlotRequest { const METHOD: &'static str = "getMaxRetransmitSlot"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -299,7 +299,7 @@ impl crate::StandardHttpRequest for crate::GetMaxShredInsertSlotRequest { const METHOD: &'static str = "getMaxShredInsertSlot"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -316,7 +316,7 @@ impl crate::StandardHttpRequest for crate::GetSlotRequest { const METHOD: &'static str = "getSlot"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { if let std::option::Option::Some(config) = &self.config { let value = match crate::serialize_parameter(Self::METHOD, config) { std::result::Result::Ok(value) => value, @@ -340,7 +340,7 @@ impl crate::StandardHttpRequest for crate::GetSlotLeaderRequest { const METHOD: &'static str = "getSlotLeader"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { if let std::option::Option::Some(config) = &self.config { let value = match crate::serialize_parameter(Self::METHOD, config) { std::result::Result::Ok(value) => value, @@ -366,9 +366,9 @@ impl crate::StandardHttpRequest for crate::GetSlotLeadersRequest { const METHOD: &'static str = "getSlotLeaders"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { if self.limit == 0 || self.limit > crate::MAX_SLOT_LEADER_COUNT { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "getSlotLeaders limit must be between 1 and {}", crate::MAX_SLOT_LEADER_COUNT ))); @@ -389,7 +389,7 @@ impl crate::StandardHttpRequest for crate::GetVersionRequest { const METHOD: &'static str = "getVersion"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -406,7 +406,7 @@ impl crate::StandardHttpRequest for crate::GetVoteAccountsRequest { const METHOD: &'static str = "getVoteAccounts"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { if let std::option::Option::Some(config) = &self.config { let validation_result = config.validate(); if let std::result::Result::Err(error) = validation_result { diff --git a/kb-onchain-transport/src/standard_http_economics.rs b/ks-onchain-transport/src/standard_http_economics.rs similarity index 96% rename from kb-onchain-transport/src/standard_http_economics.rs rename to ks-onchain-transport/src/standard_http_economics.rs index 1fce624..17049bd 100644 --- a/kb-onchain-transport/src/standard_http_economics.rs +++ b/ks-onchain-transport/src/standard_http_economics.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/standard_http_economics.rs -// version: 2 +// file: ks-onchain-transport/src/standard_http_economics.rs +// version: 3 //! Configurable standard inflation, supply and stake-economics HTTP requests. @@ -115,7 +115,7 @@ impl crate::StandardHttpRequest for crate::GetInflationGovernorRequest { const METHOD: &'static str = "getInflationGovernor"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { if let std::option::Option::Some(config) = &self.config { let value = match crate::serialize_parameter(Self::METHOD, config) { std::result::Result::Ok(value) => value, @@ -136,7 +136,7 @@ impl crate::StandardHttpRequest for crate::GetInflationRateRequest { const METHOD: &'static str = "getInflationRate"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } @@ -155,7 +155,7 @@ impl crate::StandardHttpRequest for crate::GetInflationRewardRequest { const METHOD: &'static str = "getInflationReward"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { let validation_result = crate::validate_pubkey_list(&self.addresses, "getInflationReward address", usize::MAX); if let std::result::Result::Err(error) = validation_result { @@ -189,7 +189,7 @@ impl crate::StandardHttpRequest for crate::GetStakeMinimumDelegationRequest { const METHOD: &'static str = "getStakeMinimumDelegation"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { if let std::option::Option::Some(config) = &self.config { let value = match crate::serialize_parameter(Self::METHOD, config) { std::result::Result::Ok(value) => value, @@ -213,7 +213,7 @@ impl crate::StandardHttpRequest for crate::GetSupplyRequest { const METHOD: &'static str = "getSupply"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { if let std::option::Option::Some(config) = &self.config { let value = match crate::serialize_parameter(Self::METHOD, config) { std::result::Result::Ok(value) => value, diff --git a/kb-onchain-transport/src/standard_http_tokens.rs b/ks-onchain-transport/src/standard_http_tokens.rs similarity index 94% rename from kb-onchain-transport/src/standard_http_tokens.rs rename to ks-onchain-transport/src/standard_http_tokens.rs index 68dd708..9cfee0b 100644 --- a/kb-onchain-transport/src/standard_http_tokens.rs +++ b/ks-onchain-transport/src/standard_http_tokens.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/standard_http_tokens.rs -// version: 3 +// file: ks-onchain-transport/src/standard_http_tokens.rs +// version: 4 //! Configurable standard SPL Token-oriented Solana HTTP JSON-RPC requests. @@ -8,7 +8,7 @@ fn pubkey_with_optional_commitment_params( address: &str, field: &str, config: &std::option::Option, -) -> kb_core::Result> { +) -> ks_core::Result> { let validation_result = crate::validate_solana_pubkey_text(address, field); if let std::result::Result::Err(error) = validation_result { return std::result::Result::Err(error); @@ -30,7 +30,7 @@ fn token_accounts_query_params( field: &str, filter: &crate::RpcTokenAccountsFilter, config: &std::option::Option, -) -> kb_core::Result> { +) -> ks_core::Result> { let authority_result = crate::validate_solana_pubkey_text(authority, field); if let std::result::Result::Err(error) = authority_result { return std::result::Result::Err(error); @@ -74,7 +74,7 @@ impl crate::StandardHttpRequest for crate::GetTokenAccountBalanceRequest { const METHOD: &'static str = "getTokenAccountBalance"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return pubkey_with_optional_commitment_params( Self::METHOD, &self.address, @@ -100,7 +100,7 @@ impl crate::StandardHttpRequest for crate::GetTokenAccountsByDelegateRequest { const METHOD: &'static str = "getTokenAccountsByDelegate"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return token_accounts_query_params( Self::METHOD, &self.delegate, @@ -127,7 +127,7 @@ impl crate::StandardHttpRequest for crate::GetTokenAccountsByOwnerRequest { const METHOD: &'static str = "getTokenAccountsByOwner"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return token_accounts_query_params( Self::METHOD, &self.owner, @@ -152,7 +152,7 @@ impl crate::StandardHttpRequest for crate::GetTokenLargestAccountsRequest { const METHOD: &'static str = "getTokenLargestAccounts"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return pubkey_with_optional_commitment_params( Self::METHOD, &self.mint, @@ -176,7 +176,7 @@ impl crate::StandardHttpRequest for crate::GetTokenSupplyRequest { const METHOD: &'static str = "getTokenSupply"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { return pubkey_with_optional_commitment_params( Self::METHOD, &self.mint, diff --git a/kb-onchain-transport/src/standard_http_transactions.rs b/ks-onchain-transport/src/standard_http_transactions.rs similarity index 95% rename from kb-onchain-transport/src/standard_http_transactions.rs rename to ks-onchain-transport/src/standard_http_transactions.rs index 69719a5..f514898 100644 --- a/kb-onchain-transport/src/standard_http_transactions.rs +++ b/ks-onchain-transport/src/standard_http_transactions.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/standard_http_transactions.rs -// version: 3 +// file: ks-onchain-transport/src/standard_http_transactions.rs +// version: 4 //! Configurable standard transaction-oriented Solana HTTP JSON-RPC requests. @@ -25,7 +25,7 @@ impl crate::StandardHttpRequest for crate::GetRecentPrioritizationFeesRequest { const METHOD: &'static str = "getRecentPrioritizationFees"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { if let std::option::Option::Some(accounts) = &self.locked_writable_accounts { let validation_result = crate::validate_pubkey_list( accounts, @@ -57,7 +57,7 @@ impl crate::StandardHttpRequest for crate::GetTransactionCountRequest { const METHOD: &'static str = "getTransactionCount"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { if let std::option::Option::Some(config) = &self.config { let value = match crate::serialize_parameter(Self::METHOD, config) { std::result::Result::Ok(value) => value, @@ -83,7 +83,7 @@ impl crate::StandardHttpRequest for crate::IsBlockhashValidRequest { const METHOD: &'static str = "isBlockhashValid"; - fn params(&self) -> kb_core::Result> { + fn params(&self) -> ks_core::Result> { let validation_result = crate::validate_solana_hash_text(&self.blockhash, "isBlockhashValid blockhash"); if let std::result::Result::Err(error) = validation_result { diff --git a/kb-onchain-transport/src/standard_methods.rs b/ks-onchain-transport/src/standard_methods.rs similarity index 99% rename from kb-onchain-transport/src/standard_methods.rs rename to ks-onchain-transport/src/standard_methods.rs index 8b7b475..14e0577 100644 --- a/kb-onchain-transport/src/standard_methods.rs +++ b/ks-onchain-transport/src/standard_methods.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/standard_methods.rs -// version: 4 +// file: ks-onchain-transport/src/standard_methods.rs +// version: 5 //! Canonical inventory of standard Solana HTTP and WebSocket JSON-RPC methods. @@ -63,7 +63,7 @@ pub struct StandardHttpMethodSpec { pub method: &'static str, /// Local inventory category. pub category: crate::StandardHttpCategory, - /// Strongest contract currently exposed by `kb-onchain-transport`. + /// Strongest contract currently exposed by `ks-onchain-transport`. pub contract: crate::StandardRpcContract, } @@ -387,9 +387,9 @@ pub struct StandardWsSubscriptionSpec { pub notification_method: &'static str, /// Stability declared by the canonical Solana RPC documentation. pub stability: crate::StandardWsStability, - /// Strongest typed request contract exposed by `kb-onchain-transport`. + /// Strongest typed request contract exposed by `ks-onchain-transport`. pub request_contract: crate::StandardRpcContract, - /// Strongest typed notification contract exposed by `kb-onchain-transport`. + /// Strongest typed notification contract exposed by `ks-onchain-transport`. pub notification_contract: crate::StandardRpcContract, /// Whether the pair is supported by the reusable persistent session runtime. pub persistent_runtime: bool, diff --git a/kb-onchain-transport/src/standard_ws.rs b/ks-onchain-transport/src/standard_ws.rs similarity index 97% rename from kb-onchain-transport/src/standard_ws.rs rename to ks-onchain-transport/src/standard_ws.rs index 6ceb83d..527fd89 100644 --- a/kb-onchain-transport/src/standard_ws.rs +++ b/ks-onchain-transport/src/standard_ws.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/standard_ws.rs -// version: 4 +// file: ks-onchain-transport/src/standard_ws.rs +// version: 5 //! Typed contracts for every standard Solana WebSocket subscription. @@ -20,7 +20,7 @@ pub struct StandardWsCapabilities { impl crate::StandardWsCapabilities { /// Builds initial capabilities from request kinds explicitly advertised by an endpoint. - pub fn from_endpoint(endpoint: &kb_config::WsEndpointConfig) -> Self { + pub fn from_endpoint(endpoint: &ks_config::WsEndpointConfig) -> Self { return Self { block_subscribe: endpoint_declares_method(endpoint, "blockSubscribe"), slots_updates_subscribe: endpoint_declares_method(endpoint, "slotsUpdatesSubscribe"), @@ -72,7 +72,7 @@ pub struct WsAccountSubscribeConfig { } impl crate::WsAccountSubscribeConfig { - fn validate(&self) -> kb_core::Result<()> { + fn validate(&self) -> ks_core::Result<()> { return crate::RpcAccountInfoConfig { encoding: self.encoding, data_slice: self.data_slice, @@ -164,9 +164,9 @@ pub struct WsBlockSubscribeConfig { } impl crate::WsBlockSubscribeConfig { - fn validate(&self) -> kb_core::Result<()> { + fn validate(&self) -> ks_core::Result<()> { if self.commitment == std::option::Option::Some(crate::RpcCommitmentLevel::Processed) { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "blockSubscribe does not accept processed commitment", )); } @@ -278,7 +278,7 @@ pub struct WsProgramSubscribeConfig { } impl crate::WsProgramSubscribeConfig { - fn validate(&self) -> kb_core::Result<()> { + fn validate(&self) -> ks_core::Result<()> { return crate::RpcProgramAccountsConfig { filters: self.filters.clone(), encoding: self.encoding, @@ -423,9 +423,9 @@ impl crate::StandardWsRequest { pub fn params( &self, capabilities: crate::StandardWsCapabilities, - ) -> kb_core::Result> { + ) -> ks_core::Result> { if !capabilities.allows(self.subscribe_method()) { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "unstable WebSocket method '{}' is not enabled by the endpoint capability set", self.subscribe_method() ))); @@ -709,7 +709,7 @@ impl crate::StandardWsNotification { /// Parses and validates one standard WebSocket notification. pub fn adapt_standard_ws_notification( notification: &crate::JsonRpcNotification, -) -> kb_core::Result { +) -> ks_core::Result { let subscription = notification.params.subscription; let result = ¬ification.params.result; return match notification.method.as_str() { @@ -743,7 +743,7 @@ pub fn adapt_standard_ws_notification( std::result::Result::Ok(notification) => { if let crate::WsSignatureValue::Received(marker) = ¬ification.result.value { if marker != "receivedSignature" { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "unknown signature notification marker '{marker}'" ))); } @@ -765,7 +765,7 @@ pub fn adapt_standard_ws_notification( adapt_notification_result(subscription, result, crate::WsVoteNotification::new) .map(crate::StandardWsNotification::Vote) }, - method => std::result::Result::Err(kb_core::Error::json(format!( + method => std::result::Result::Err(ks_core::Error::json(format!( "unsupported standard WebSocket notification method '{method}'" ))), }; @@ -825,7 +825,7 @@ impl crate::WsVoteNotification { } } -fn endpoint_declares_method(endpoint: &kb_config::WsEndpointConfig, method: &str) -> bool { +fn endpoint_declares_method(endpoint: &ks_config::WsEndpointConfig, method: &str) -> bool { let request_kind = crate::request_kind_from_method(method); for role in &endpoint.roles { if !role.enabled { @@ -842,7 +842,7 @@ fn endpoint_declares_method(endpoint: &kb_config::WsEndpointConfig, method: &str fn account_params( request: &crate::AccountSubscribeRequest, -) -> kb_core::Result> { +) -> ks_core::Result> { let validation_result = crate::validate_solana_pubkey_text(&request.pubkey, "account pubkey"); if let std::result::Result::Err(error) = validation_result { return std::result::Result::Err(error); @@ -864,7 +864,7 @@ fn account_params( fn block_params( request: &crate::BlockSubscribeRequest, -) -> kb_core::Result> { +) -> ks_core::Result> { if let crate::WsBlockFilter::MentionsAccountOrProgram(pubkey) = &request.filter { let validation_result = crate::validate_solana_pubkey_text(pubkey, "block mentions account or program"); @@ -893,7 +893,7 @@ fn block_params( fn logs_params( request: &crate::LogsSubscribeRequest, -) -> kb_core::Result> { +) -> ks_core::Result> { if let crate::WsLogsFilter::Mentions(pubkey) = &request.filter { let validation_result = crate::validate_solana_pubkey_text(pubkey, "logs mention"); if let std::result::Result::Err(error) = validation_result { @@ -917,7 +917,7 @@ fn logs_params( fn program_params( request: &crate::ProgramSubscribeRequest, -) -> kb_core::Result> { +) -> ks_core::Result> { let validation_result = crate::validate_solana_pubkey_text(&request.program_id, "program id"); if let std::result::Result::Err(error) = validation_result { return std::result::Result::Err(error); @@ -939,7 +939,7 @@ fn program_params( fn signature_params( request: &crate::SignatureSubscribeRequest, -) -> kb_core::Result> { +) -> ks_core::Result> { let validation_result = crate::validate_transaction_signature_text(&request.signature, "transaction signature"); if let std::result::Result::Err(error) = validation_result { @@ -960,7 +960,7 @@ fn adapt_notification_result( subscription: u64, value: &serde_json::Value, constructor: Constructor, -) -> kb_core::Result +) -> ks_core::Result where ResultType: serde::de::DeserializeOwned, Constructor: FnOnce(u64, ResultType) -> NotificationType, @@ -968,7 +968,7 @@ where let result = match serde_json::from_value::(value.clone()) { std::result::Result::Ok(result) => result, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot decode standard WebSocket notification result: {error}" ))); }, diff --git a/kb-onchain-transport/src/validation.rs b/ks-onchain-transport/src/validation.rs similarity index 86% rename from kb-onchain-transport/src/validation.rs rename to ks-onchain-transport/src/validation.rs index b317c8c..ccad39f 100644 --- a/kb-onchain-transport/src/validation.rs +++ b/ks-onchain-transport/src/validation.rs @@ -1,20 +1,20 @@ -// file: kb-onchain-transport/src/validation.rs -// version: 4 +// file: ks-onchain-transport/src/validation.rs +// version: 5 //! Shared validation helpers for Solana RPC addresses, hashes and signatures. /// Validates one base58 Solana transaction signature. -pub fn validate_transaction_signature_text(value: &str, field_name: &str) -> kb_core::Result<()> { +pub fn validate_transaction_signature_text(value: &str, field_name: &str) -> ks_core::Result<()> { return validate_base58_length(value, field_name, 64); } /// Validates one base58 Solana public key or account address. -pub fn validate_solana_pubkey_text(value: &str, field_name: &str) -> kb_core::Result<()> { +pub fn validate_solana_pubkey_text(value: &str, field_name: &str) -> ks_core::Result<()> { return validate_base58_length(value, field_name, 32); } /// Validates one base58 Solana blockhash or genesis hash. -pub fn validate_solana_hash_text(value: &str, field_name: &str) -> kb_core::Result<()> { +pub fn validate_solana_hash_text(value: &str, field_name: &str) -> ks_core::Result<()> { return validate_base58_length(value, field_name, 32); } @@ -22,9 +22,9 @@ fn validate_base58_length( value: &str, field_name: &str, expected_length: usize, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "{field_name} must not be empty" ))); } @@ -32,13 +32,13 @@ fn validate_base58_length( let decoded = match decode_result { std::result::Result::Ok(bytes) => bytes, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "{field_name} is not valid base58: {error}" ))); }, }; if decoded.len() != expected_length { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "{field_name} must decode to {expected_length} bytes" ))); } diff --git a/kb-onchain-transport/src/ws_client.rs b/ks-onchain-transport/src/ws_client.rs similarity index 93% rename from kb-onchain-transport/src/ws_client.rs rename to ks-onchain-transport/src/ws_client.rs index ff3dcf4..e76e016 100644 --- a/kb-onchain-transport/src/ws_client.rs +++ b/ks-onchain-transport/src/ws_client.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/ws_client.rs -// version: 8 +// file: ks-onchain-transport/src/ws_client.rs +// version: 9 //! Standard Solana WebSocket client helpers. @@ -25,16 +25,16 @@ pub struct WsPoolClientSnapshot { /// Standard Solana WebSocket client bound to one configured endpoint. #[derive(Clone, Debug)] pub struct WsClient { - endpoint: kb_config::WsEndpointConfig, + endpoint: ks_config::WsEndpointConfig, next_request_id: std::sync::Arc, } impl crate::WsClient { /// Creates a new WebSocket client bound to one endpoint. - pub fn new(endpoint: kb_config::WsEndpointConfig) -> kb_core::Result { + pub fn new(endpoint: ks_config::WsEndpointConfig) -> ks_core::Result { if !endpoint.enabled { tracing::error!(target: crate::TRACING_TARGET, action = "create_ws_client", endpoint_name = %endpoint.name, provider = %endpoint.provider, error_code = "ws_endpoint_disabled", "cannot create WebSocket client for disabled endpoint"); - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "ws endpoint '{}' is disabled", endpoint.name ))); @@ -62,7 +62,7 @@ impl crate::WsClient { } /// Returns the endpoint configuration. - pub fn endpoint_config(&self) -> &kb_config::WsEndpointConfig { + pub fn endpoint_config(&self) -> &ks_config::WsEndpointConfig { return &self.endpoint; } @@ -130,7 +130,7 @@ impl crate::WsClient { &self, method: std::string::String, params: std::vec::Vec, - ) -> kb_core::Result { + ) -> ks_core::Result { let parameter_count = params.len(); let request = self.build_json_rpc_request(method.clone(), params); tracing::debug!(target: crate::TRACING_TARGET, action = "execute_ws_json_rpc_once", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id = ?request.id, method = %method, parameter_count, "start one-shot WebSocket JSON-RPC request"); @@ -148,7 +148,7 @@ impl crate::WsClient { std::result::Result::Ok(result) => result, std::result::Result::Err(_) => { tracing::error!(target: crate::TRACING_TARGET, action = "connect_ws_endpoint", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id = ?request.id, method = %method, timeout_ms = self.endpoint.connect_timeout_ms, error_code = "ws_connect_timeout", "WebSocket endpoint connection timed out"); - return std::result::Result::Err(kb_core::Error::ws(format!( + return std::result::Result::Err(ks_core::Error::ws(format!( "websocket connect timed out for endpoint '{}'", self.endpoint.name ))); @@ -158,7 +158,7 @@ impl crate::WsClient { std::result::Result::Ok(pair) => pair, std::result::Result::Err(error) => { tracing::error!(target: crate::TRACING_TARGET, action = "connect_ws_endpoint", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id = ?request.id, method = %method, error = %error, "WebSocket endpoint connection failed"); - return std::result::Result::Err(kb_core::Error::ws(format!( + return std::result::Result::Err(ks_core::Error::ws(format!( "cannot connect websocket endpoint '{}': {error}", self.endpoint.name ))); @@ -169,7 +169,7 @@ impl crate::WsClient { .await; if let std::result::Result::Err(error) = send_result { tracing::error!(target: crate::TRACING_TARGET, action = "send_ws_json_rpc_request", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id = ?request.id, method = %method, error = %error, "WebSocket JSON-RPC request send failed"); - return std::result::Result::Err(kb_core::Error::ws(format!( + return std::result::Result::Err(ks_core::Error::ws(format!( "cannot send websocket request '{}' to endpoint '{}': {error}", method, self.endpoint.name ))); @@ -180,7 +180,7 @@ impl crate::WsClient { std::result::Result::Ok(result) => result, std::result::Result::Err(_) => { tracing::error!(target: crate::TRACING_TARGET, action = "read_ws_json_rpc_response", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id = ?request.id, method = %method, timeout_ms = self.endpoint.request_timeout_ms, error_code = "ws_response_timeout", "WebSocket JSON-RPC response timed out"); - return std::result::Result::Err(kb_core::Error::ws(format!( + return std::result::Result::Err(ks_core::Error::ws(format!( "websocket response timed out for endpoint '{}'", self.endpoint.name ))); @@ -191,7 +191,7 @@ impl crate::WsClient { std::result::Result::Ok(message) => message, std::result::Result::Err(error) => { tracing::error!(target: crate::TRACING_TARGET, action = "read_ws_json_rpc_response", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id = ?request.id, method = %method, error = %error, "WebSocket JSON-RPC response read failed"); - return std::result::Result::Err(kb_core::Error::ws(format!( + return std::result::Result::Err(ks_core::Error::ws(format!( "websocket read failed for endpoint '{}': {error}", self.endpoint.name ))); @@ -199,7 +199,7 @@ impl crate::WsClient { }, std::option::Option::None => { tracing::error!(target: crate::TRACING_TARGET, action = "read_ws_json_rpc_response", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id = ?request.id, method = %method, error_code = "ws_closed_before_response", "WebSocket endpoint closed before response"); - return std::result::Result::Err(kb_core::Error::ws(format!( + return std::result::Result::Err(ks_core::Error::ws(format!( "websocket endpoint '{}' closed before response", self.endpoint.name ))); @@ -231,7 +231,7 @@ impl crate::WsClient { }, tokio_tungstenite::tungstenite::Message::Binary(binary) => { tracing::error!(target: crate::TRACING_TARGET, action = "read_ws_json_rpc_response", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id = ?request.id, method = %method, message_kind = "binary", response_byte_length = binary.len(), "WebSocket endpoint returned binary data before JSON response"); - std::result::Result::Err(kb_core::Error::ws(format!( + std::result::Result::Err(ks_core::Error::ws(format!( "websocket endpoint '{}' returned binary message with {} bytes", self.endpoint.name, binary.len() @@ -239,28 +239,28 @@ impl crate::WsClient { }, tokio_tungstenite::tungstenite::Message::Ping(_) => { tracing::error!(target: crate::TRACING_TARGET, action = "read_ws_json_rpc_response", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id = ?request.id, method = %method, message_kind = "ping", "WebSocket endpoint returned ping before JSON response"); - std::result::Result::Err(kb_core::Error::ws(format!( + std::result::Result::Err(ks_core::Error::ws(format!( "websocket endpoint '{}' returned ping before json response", self.endpoint.name ))) }, tokio_tungstenite::tungstenite::Message::Pong(_) => { tracing::error!(target: crate::TRACING_TARGET, action = "read_ws_json_rpc_response", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id = ?request.id, method = %method, message_kind = "pong", "WebSocket endpoint returned pong before JSON response"); - std::result::Result::Err(kb_core::Error::ws(format!( + std::result::Result::Err(ks_core::Error::ws(format!( "websocket endpoint '{}' returned pong before json response", self.endpoint.name ))) }, tokio_tungstenite::tungstenite::Message::Close(_) => { tracing::error!(target: crate::TRACING_TARGET, action = "read_ws_json_rpc_response", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id = ?request.id, method = %method, message_kind = "close", "WebSocket endpoint closed before JSON response"); - std::result::Result::Err(kb_core::Error::ws(format!( + std::result::Result::Err(ks_core::Error::ws(format!( "websocket endpoint '{}' closed before json response", self.endpoint.name ))) }, tokio_tungstenite::tungstenite::Message::Frame(_) => { tracing::error!(target: crate::TRACING_TARGET, action = "read_ws_json_rpc_response", endpoint_name = %self.endpoint.name, provider = %self.endpoint.provider, request_id = ?request.id, method = %method, message_kind = "frame", "WebSocket endpoint returned raw frame before JSON response"); - std::result::Result::Err(kb_core::Error::ws(format!( + std::result::Result::Err(ks_core::Error::ws(format!( "websocket endpoint '{}' returned raw frame before json response", self.endpoint.name ))) @@ -274,8 +274,8 @@ mod tests { fn role_config( role: &str, request_kinds: std::vec::Vec, - ) -> kb_config::EndpointRoleConfig { - return kb_config::EndpointRoleConfig { + ) -> ks_config::EndpointRoleConfig { + return ks_config::EndpointRoleConfig { role: role.to_string(), enabled: true, request_kinds, @@ -288,8 +288,8 @@ mod tests { }; } - fn endpoint(enabled: bool) -> kb_config::WsEndpointConfig { - return kb_config::WsEndpointConfig { + fn endpoint(enabled: bool) -> ks_config::WsEndpointConfig { + return ks_config::WsEndpointConfig { name: "ws_a".to_string(), enabled, provider: "test".to_string(), diff --git a/kb-onchain-transport/src/ws_pool.rs b/ks-onchain-transport/src/ws_pool.rs similarity index 92% rename from kb-onchain-transport/src/ws_pool.rs rename to ks-onchain-transport/src/ws_pool.rs index f512ffe..fc87f72 100644 --- a/kb-onchain-transport/src/ws_pool.rs +++ b/ks-onchain-transport/src/ws_pool.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/ws_pool.rs -// version: 6 +// file: ks-onchain-transport/src/ws_pool.rs +// version: 7 //! WebSocket endpoint pool and role-based routing. @@ -12,7 +12,7 @@ pub struct WsEndpointPool { impl crate::WsEndpointPool { /// Builds a pool from the active profile WebSocket endpoint list. - pub fn from_profile(profile: &kb_config::ProfileConfig) -> kb_core::Result { + pub fn from_profile(profile: &ks_config::ProfileConfig) -> ks_core::Result { let mut clients = std::vec::Vec::new(); for endpoint in &profile.solana.ws_endpoints { if !endpoint.enabled { @@ -28,10 +28,10 @@ impl crate::WsEndpointPool { } /// Creates a pool from already constructed clients. - pub fn new(clients: std::vec::Vec) -> kb_core::Result { + pub fn new(clients: std::vec::Vec) -> ks_core::Result { if clients.is_empty() { tracing::error!(target: crate::TRACING_TARGET, action = "create_ws_pool", error_code = "ws_pool_empty", "WebSocket endpoint pool has no enabled endpoint"); - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "ws endpoint pool requires at least one enabled endpoint".to_string(), )); } @@ -56,7 +56,7 @@ impl crate::WsEndpointPool { &self, required_role: &str, method: &str, - ) -> kb_core::Result { + ) -> ks_core::Result { let request_kind = crate::request_kind_from_method(method); return self.select_client_for_role_and_kind(required_role, &request_kind); } @@ -66,10 +66,10 @@ impl crate::WsEndpointPool { &self, required_role: &str, request_kind: &str, - ) -> kb_core::Result { + ) -> ks_core::Result { if self.clients.is_empty() { tracing::error!(target: crate::TRACING_TARGET, action = "select_ws_endpoint", required_role, request_kind, error_code = "ws_pool_empty", "WebSocket endpoint pool has no clients"); - return std::result::Result::Err(kb_core::Error::not_connected( + return std::result::Result::Err(ks_core::Error::not_connected( "ws endpoint pool has no clients".to_string(), )); } @@ -86,7 +86,7 @@ impl crate::WsEndpointPool { offset += 1; } tracing::error!(target: crate::TRACING_TARGET, action = "select_ws_endpoint", required_role, request_kind, endpoint_count = self.clients.len(), error_code = "ws_endpoint_not_found", "no WebSocket endpoint supports requested role and kind"); - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "no ws endpoint supports role '{}' and request kind '{}'", required_role, request_kind ))); @@ -97,7 +97,7 @@ impl crate::WsEndpointPool { &self, required_role: &str, subscription: &crate::StandardWsSubscriptionSpec, - ) -> kb_core::Result { + ) -> ks_core::Result { return self .select_client_for_role_and_method(required_role, subscription.subscribe_method); } @@ -108,7 +108,7 @@ impl crate::WsEndpointPool { required_role: &str, method: std::string::String, params: std::vec::Vec, - ) -> kb_core::Result { + ) -> ks_core::Result { let client = match self.select_client_for_role_and_method(required_role, &method) { std::result::Result::Ok(client) => client, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -122,8 +122,8 @@ mod tests { fn role_config( role: &str, request_kinds: std::vec::Vec, - ) -> kb_config::EndpointRoleConfig { - return kb_config::EndpointRoleConfig { + ) -> ks_config::EndpointRoleConfig { + return ks_config::EndpointRoleConfig { role: role.to_string(), enabled: true, request_kinds, @@ -140,8 +140,8 @@ mod tests { name: &str, role: &str, request_kinds: std::vec::Vec, - ) -> kb_config::WsEndpointConfig { - return kb_config::WsEndpointConfig { + ) -> ks_config::WsEndpointConfig { + return ks_config::WsEndpointConfig { name: name.to_string(), enabled: true, provider: "test".to_string(), @@ -157,7 +157,7 @@ mod tests { }; } - fn client(endpoint: kb_config::WsEndpointConfig) -> crate::WsClient { + fn client(endpoint: ks_config::WsEndpointConfig) -> crate::WsClient { match crate::WsClient::new(endpoint) { std::result::Result::Ok(client) => return client, std::result::Result::Err(error) => panic!("client creation failed: {error}"), diff --git a/kb-onchain-transport/src/ws_session.rs b/ks-onchain-transport/src/ws_session.rs similarity index 96% rename from kb-onchain-transport/src/ws_session.rs rename to ks-onchain-transport/src/ws_session.rs index a2d13bb..58ab05e 100644 --- a/kb-onchain-transport/src/ws_session.rs +++ b/ks-onchain-transport/src/ws_session.rs @@ -1,5 +1,5 @@ -// file: kb-onchain-transport/src/ws_session.rs -// version: 5 +// file: ks-onchain-transport/src/ws_session.rs +// version: 6 //! Persistent multiplexed WebSocket session with bounded reconnect and resubscription. @@ -36,19 +36,19 @@ impl crate::WsReconnectPolicy { max_attempts: u32, initial_delay_ms: u64, max_delay_ms: u64, - ) -> kb_core::Result { + ) -> ks_core::Result { if max_attempts == 0 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "WebSocket reconnect max attempts must be greater than zero", )); } if initial_delay_ms == 0 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "WebSocket reconnect initial delay must be greater than zero", )); } if max_delay_ms < initial_delay_ms { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "WebSocket reconnect maximum delay must not be smaller than the initial delay", )); } @@ -189,7 +189,7 @@ pub enum WsSessionEvent { /// Persistent multiplexed standard Solana WebSocket session. pub struct WsSession { - endpoint: kb_config::WsEndpointConfig, + endpoint: ks_config::WsEndpointConfig, capabilities: std::sync::Arc>, control_sender: tokio::sync::mpsc::Sender, event_sender: tokio::sync::broadcast::Sender, @@ -217,7 +217,7 @@ impl crate::WsSession { client: crate::WsClient, capabilities: crate::StandardWsCapabilities, reconnect_policy: crate::WsReconnectPolicy, - ) -> kb_core::Result { + ) -> ks_core::Result { let stream = match connect_stream(&client).await { std::result::Result::Ok(stream) => stream, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -287,7 +287,7 @@ impl crate::WsSession { pub async fn subscribe( &self, request: crate::StandardWsRequest, - ) -> kb_core::Result { + ) -> ks_core::Result { let capabilities = *self.capabilities.read().await; let params = match request.params(capabilities) { std::result::Result::Ok(params) => params, @@ -297,7 +297,7 @@ impl crate::WsSession { let command = WsSessionCommand::Subscribe { request, params, response_sender }; let send_result = self.control_sender.send(command).await; if send_result.is_err() { - return std::result::Result::Err(kb_core::Error::not_connected(format!( + return std::result::Result::Err(ks_core::Error::not_connected(format!( "WebSocket session '{}' is not accepting subscriptions", self.endpoint.name ))); @@ -305,7 +305,7 @@ impl crate::WsSession { return match response_receiver.await { std::result::Result::Ok(result) => result, std::result::Result::Err(error) => { - std::result::Result::Err(kb_core::Error::not_connected(format!( + std::result::Result::Err(ks_core::Error::not_connected(format!( "WebSocket subscription response channel closed for endpoint '{}': {error}", self.endpoint.name ))) @@ -317,12 +317,12 @@ impl crate::WsSession { pub async fn unsubscribe( &self, remote_subscription_id: u64, - ) -> kb_core::Result { + ) -> ks_core::Result { let (response_sender, response_receiver) = tokio::sync::oneshot::channel(); let command = WsSessionCommand::Unsubscribe { remote_subscription_id, response_sender }; let send_result = self.control_sender.send(command).await; if send_result.is_err() { - return std::result::Result::Err(kb_core::Error::not_connected(format!( + return std::result::Result::Err(ks_core::Error::not_connected(format!( "WebSocket session '{}' is not accepting unsubscribe commands", self.endpoint.name ))); @@ -330,7 +330,7 @@ impl crate::WsSession { return match response_receiver.await { std::result::Result::Ok(result) => result, std::result::Result::Err(error) => { - std::result::Result::Err(kb_core::Error::not_connected(format!( + std::result::Result::Err(ks_core::Error::not_connected(format!( "WebSocket unsubscribe response channel closed for endpoint '{}': {error}", self.endpoint.name ))) @@ -339,7 +339,7 @@ impl crate::WsSession { } /// Unsubscribes active subscriptions, closes the socket and stops the session task. - pub async fn disconnect(&self) -> kb_core::Result<()> { + pub async fn disconnect(&self) -> ks_core::Result<()> { let (response_sender, response_receiver) = tokio::sync::oneshot::channel(); let send_result = self.control_sender.send(WsSessionCommand::Disconnect { response_sender }).await; @@ -360,14 +360,14 @@ enum WsSessionCommand { Subscribe { request: crate::StandardWsRequest, params: std::vec::Vec, - response_sender: tokio::sync::oneshot::Sender>, + response_sender: tokio::sync::oneshot::Sender>, }, Unsubscribe { remote_subscription_id: u64, - response_sender: tokio::sync::oneshot::Sender>, + response_sender: tokio::sync::oneshot::Sender>, }, Disconnect { - response_sender: tokio::sync::oneshot::Sender>, + response_sender: tokio::sync::oneshot::Sender>, }, } @@ -383,13 +383,13 @@ enum PendingWsRequest { request: crate::StandardWsRequest, params: std::vec::Vec, deadline: tokio::time::Instant, - response_sender: tokio::sync::oneshot::Sender>, + response_sender: tokio::sync::oneshot::Sender>, }, Unsubscribe { local_subscription_id: u64, remote_subscription_id: u64, deadline: tokio::time::Instant, - response_sender: tokio::sync::oneshot::Sender>, + response_sender: tokio::sync::oneshot::Sender>, }, Resubscribe { local_subscription_id: u64, @@ -470,7 +470,7 @@ impl WsSessionRuntime { stream: &mut WsStream, request: crate::StandardWsRequest, params: std::vec::Vec, - response_sender: tokio::sync::oneshot::Sender>, + response_sender: tokio::sync::oneshot::Sender>, ) { let local_subscription_id = self.next_local_subscription_id; self.next_local_subscription_id = self.next_local_subscription_id.saturating_add(1); @@ -481,7 +481,7 @@ impl WsSessionRuntime { std::option::Option::Some(request_id) => request_id, std::option::Option::None => { let _send_result = response_sender.send(std::result::Result::Err( - kb_core::Error::invalid_state("numeric WebSocket request id is required"), + ks_core::Error::invalid_state("numeric WebSocket request id is required"), )); return; }, @@ -496,7 +496,7 @@ impl WsSessionRuntime { let send_result = stream.send(tokio_tungstenite::tungstenite::Message::Text(text.into())).await; if let std::result::Result::Err(error) = send_result { - let _send_result = response_sender.send(std::result::Result::Err(kb_core::Error::ws( + let _send_result = response_sender.send(std::result::Result::Err(ks_core::Error::ws( format!("cannot send WebSocket subscribe request: {error}"), ))); return; @@ -520,13 +520,13 @@ impl WsSessionRuntime { &mut self, stream: &mut WsStream, remote_subscription_id: u64, - response_sender: tokio::sync::oneshot::Sender>, + response_sender: tokio::sync::oneshot::Sender>, ) { let local_subscription_id = match self.remote_to_local.get(&remote_subscription_id) { std::option::Option::Some(local_subscription_id) => *local_subscription_id, std::option::Option::None => { let _send_result = response_sender.send(std::result::Result::Err( - kb_core::Error::invalid_state(format!( + ks_core::Error::invalid_state(format!( "unknown remote WebSocket subscription id {remote_subscription_id}" )), )); @@ -537,7 +537,7 @@ impl WsSessionRuntime { std::option::Option::Some(subscription) => subscription, std::option::Option::None => { let _send_result = - response_sender.send(std::result::Result::Err(kb_core::Error::invalid_state( + response_sender.send(std::result::Result::Err(ks_core::Error::invalid_state( format!("missing local WebSocket subscription id {local_subscription_id}"), ))); return; @@ -551,7 +551,7 @@ impl WsSessionRuntime { std::option::Option::Some(request_id) => request_id, std::option::Option::None => { let _send_result = response_sender.send(std::result::Result::Err( - kb_core::Error::invalid_state("numeric WebSocket request id is required"), + ks_core::Error::invalid_state("numeric WebSocket request id is required"), )); return; }, @@ -566,7 +566,7 @@ impl WsSessionRuntime { let send_result = stream.send(tokio_tungstenite::tungstenite::Message::Text(text.into())).await; if let std::result::Result::Err(error) = send_result { - let _send_result = response_sender.send(std::result::Result::Err(kb_core::Error::ws( + let _send_result = response_sender.send(std::result::Result::Err(ks_core::Error::ws( format!("cannot send WebSocket unsubscribe request: {error}"), ))); return; @@ -682,7 +682,7 @@ impl WsSessionRuntime { std::option::Option::Some(value) => value, std::option::Option::None => { let _send_result = response_sender.send(std::result::Result::Err( - kb_core::Error::json("subscribe result must be a numeric id"), + ks_core::Error::json("subscribe result must be a numeric id"), )); return; }, @@ -722,7 +722,7 @@ impl WsSessionRuntime { } => { if success.result.as_bool() != std::option::Option::Some(true) { let _send_result = response_sender.send(std::result::Result::Err( - kb_core::Error::json("unsubscribe result must be true"), + ks_core::Error::json("unsubscribe result must be true"), )); return; } @@ -732,7 +732,7 @@ impl WsSessionRuntime { std::option::Option::Some(subscription) => subscription.snapshot, std::option::Option::None => { let _send_result = response_sender.send(std::result::Result::Err( - kb_core::Error::invalid_state( + ks_core::Error::invalid_state( "acknowledged subscription disappeared before removal", ), )); @@ -788,7 +788,7 @@ impl WsSessionRuntime { async fn handle_error_response(&mut self, error_response: crate::JsonRpcErrorResponse) { let request_id = error_response.id.as_u64(); - let error = kb_core::Error::ws(format!( + let error = ks_core::Error::ws(format!( "WebSocket JSON-RPC error {}: {}", error_response.error.code, error_response.error.message )); @@ -938,7 +938,7 @@ impl WsSessionRuntime { let pending = self.pending.remove(&request_id); if let std::option::Option::Some(pending) = pending { let error = - kb_core::Error::ws(format!("WebSocket request id {request_id} timed out")); + ks_core::Error::ws(format!("WebSocket request id {request_id} timed out")); match pending { PendingWsRequest::Subscribe { response_sender, .. } => { let _send_result = response_sender.send(std::result::Result::Err(error)); @@ -955,7 +955,7 @@ impl WsSessionRuntime { } async fn reconnect(&mut self) -> std::option::Option { - self.fail_pending(kb_core::Error::ws( + self.fail_pending(ks_core::Error::ws( "WebSocket transport failed before request completion", )); if !self.reconnect_policy.enabled { @@ -1005,7 +1005,7 @@ impl WsSessionRuntime { &mut self, stream: &mut WsStream, previous_remote_ids: &std::collections::BTreeMap>, - ) -> kb_core::Result<()> { + ) -> ks_core::Result<()> { let local_ids = self.active.keys().copied().collect::>(); for local_subscription_id in local_ids { let (subscribe_method, params, previous_remote_subscription_id) = @@ -1021,7 +1021,7 @@ impl WsSessionRuntime { let request_id = match json_request.id.as_u64() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "numeric WebSocket request id is required", )); }, @@ -1033,7 +1033,7 @@ impl WsSessionRuntime { let send_result = stream.send(tokio_tungstenite::tungstenite::Message::Text(text.into())).await; if let std::result::Result::Err(error) = send_result { - return std::result::Result::Err(kb_core::Error::ws(format!( + return std::result::Result::Err(ks_core::Error::ws(format!( "cannot restore WebSocket subscription: {error}" ))); } @@ -1052,7 +1052,7 @@ impl WsSessionRuntime { return std::result::Result::Ok(()); } - fn fail_pending(&mut self, error: kb_core::Error) { + fn fail_pending(&mut self, error: ks_core::Error) { let pending = std::mem::take(&mut self.pending); for (_request_id, request) in pending { match request { @@ -1069,7 +1069,7 @@ impl WsSessionRuntime { } } - async fn close_stream(&mut self, stream: &mut WsStream) -> kb_core::Result<()> { + async fn close_stream(&mut self, stream: &mut WsStream) -> ks_core::Result<()> { let subscriptions = self .active .values() @@ -1105,7 +1105,7 @@ impl WsSessionRuntime { .await; return match close_result { std::result::Result::Ok(()) => std::result::Result::Ok(()), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::ws( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::ws( format!("cannot close WebSocket session: {error}"), )), }; @@ -1131,7 +1131,7 @@ impl WsSessionRuntime { } async fn finish_disconnected(&mut self) { - self.fail_pending(kb_core::Error::not_connected( + self.fail_pending(ks_core::Error::not_connected( "persistent WebSocket session disconnected", )); self.set_state(crate::WsSessionState::Disconnected).await; @@ -1139,7 +1139,7 @@ impl WsSessionRuntime { tracing::info!(target: crate::TRACING_TARGET, action = "disconnect_ws_session", endpoint_name = %self.client.endpoint_name(), provider = %self.client.provider(), "persistent WebSocket session disconnected"); } - fn emit_error(&self, error: kb_core::Error) { + fn emit_error(&self, error: ks_core::Error) { self.emit_diagnostic(error.code(), error.message().to_string()); } @@ -1165,14 +1165,14 @@ fn is_method_unavailable_error(error_response: &crate::JsonRpcErrorResponse) -> || message.contains("unstable method"); } -async fn connect_stream(client: &crate::WsClient) -> kb_core::Result { +async fn connect_stream(client: &crate::WsClient) -> ks_core::Result { let connect_future = tokio_tungstenite::connect_async(client.endpoint_url()); let timeout = std::time::Duration::from_millis(client.endpoint_config().connect_timeout_ms); let timeout_result = tokio::time::timeout(timeout, connect_future).await; let connect_result = match timeout_result { std::result::Result::Ok(connect_result) => connect_result, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::ws(format!( + return std::result::Result::Err(ks_core::Error::ws(format!( "WebSocket connect timed out for endpoint '{}'", client.endpoint_name() ))); @@ -1180,7 +1180,7 @@ async fn connect_stream(client: &crate::WsClient) -> kb_core::Result { }; return match connect_result { std::result::Result::Ok((stream, _response)) => std::result::Result::Ok(stream), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::ws(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::ws(format!( "cannot connect WebSocket endpoint '{}': {error}", client.endpoint_name() ))), @@ -1192,8 +1192,8 @@ mod tests { use futures_util::SinkExt; // rust-rules: trait-import use futures_util::StreamExt; // rust-rules: trait-import - fn endpoint(url: std::string::String) -> kb_config::WsEndpointConfig { - return kb_config::WsEndpointConfig { + fn endpoint(url: std::string::String) -> ks_config::WsEndpointConfig { + return ks_config::WsEndpointConfig { name: "local-test".to_string(), enabled: true, provider: "offline".to_string(), @@ -1205,7 +1205,7 @@ mod tests { write_channel_capacity: 16, event_channel_capacity: 32, auto_reconnect: true, - roles: std::vec![kb_config::EndpointRoleConfig { + roles: std::vec![ks_config::EndpointRoleConfig { role: "slot_notifications".to_string(), enabled: true, request_kinds: std::vec!["slot_subscribe".to_string()], diff --git a/kb-onchain-transport/tests/fixtures/get_transaction_equivalent_a.json b/ks-onchain-transport/tests/fixtures/get_transaction_equivalent_a.json similarity index 100% rename from kb-onchain-transport/tests/fixtures/get_transaction_equivalent_a.json rename to ks-onchain-transport/tests/fixtures/get_transaction_equivalent_a.json diff --git a/kb-onchain-transport/tests/fixtures/get_transaction_equivalent_b.json b/ks-onchain-transport/tests/fixtures/get_transaction_equivalent_b.json similarity index 100% rename from kb-onchain-transport/tests/fixtures/get_transaction_equivalent_b.json rename to ks-onchain-transport/tests/fixtures/get_transaction_equivalent_b.json diff --git a/kb-onchain-transport/tests/fixtures/get_transaction_legacy_failure.json b/ks-onchain-transport/tests/fixtures/get_transaction_legacy_failure.json similarity index 100% rename from kb-onchain-transport/tests/fixtures/get_transaction_legacy_failure.json rename to ks-onchain-transport/tests/fixtures/get_transaction_legacy_failure.json diff --git a/kb-onchain-transport/tests/fixtures/get_transaction_legacy_success.json b/ks-onchain-transport/tests/fixtures/get_transaction_legacy_success.json similarity index 100% rename from kb-onchain-transport/tests/fixtures/get_transaction_legacy_success.json rename to ks-onchain-transport/tests/fixtures/get_transaction_legacy_success.json diff --git a/kb-onchain-transport/tests/fixtures/get_transaction_optional_absent.json b/ks-onchain-transport/tests/fixtures/get_transaction_optional_absent.json similarity index 100% rename from kb-onchain-transport/tests/fixtures/get_transaction_optional_absent.json rename to ks-onchain-transport/tests/fixtures/get_transaction_optional_absent.json diff --git a/kb-onchain-transport/tests/fixtures/get_transaction_v0_alt_cpi_token_2022.json b/ks-onchain-transport/tests/fixtures/get_transaction_v0_alt_cpi_token_2022.json similarity index 100% rename from kb-onchain-transport/tests/fixtures/get_transaction_v0_alt_cpi_token_2022.json rename to ks-onchain-transport/tests/fixtures/get_transaction_v0_alt_cpi_token_2022.json diff --git a/kb-pipeline-demo-scenarios/CHANGELOG.md b/ks-pipeline-demo-scenarios/CHANGELOG.md similarity index 97% rename from kb-pipeline-demo-scenarios/CHANGELOG.md rename to ks-pipeline-demo-scenarios/CHANGELOG.md index 471c2c6..cd949fb 100644 --- a/kb-pipeline-demo-scenarios/CHANGELOG.md +++ b/ks-pipeline-demo-scenarios/CHANGELOG.md @@ -1,7 +1,13 @@ - - + + -# CHANGELOG — kb-pipeline-demo-scenarios +# CHANGELOG — ks-pipeline-demo-scenarios + +## `0.5.1-pre.002` + +- renomme `kb-pipeline-demo-scenarios` en `ks-pipeline-demo-scenarios`, sa bibliothèque en `ks_pipeline_demo_scenarios` et son CLI en `ks-pipeline-demo-scenarios-cli` ; +- renomme le fichier source du CLI et les adaptateurs desktop qui consomment les scénarios ; +- aligne le target racine et les targets de fixtures propres à cette crate sans changer les scénarios qualifiés. ## `0.5.0-pre.003` @@ -33,15 +39,15 @@ - prépare un probe Devnet borné pour `Use` sur un NFT classique frais avec `Uses::Multiple { remaining: 2, total: 2 }` : le probe simule d’abord l’instruction courante et distingue explicitement succès confirmé et indisponibilité runtime ; aucune promotion n’est faite tant que la réponse Devnet n’est pas observée. - `pre.013-delta-fix-028` enregistre le rerun `fix-027` : la campagne pNFT franchit désormais `Delegate(Staking) -> Lock -> Unlock -> Revoke(Staking) -> Delegate(Transfer) -> Transfer` jusqu’à la postcondition finale du token account source ; le transfert est confirmé et son TokenRecord destination est `Unlocked` sans delegate, mais la campagne exigeait à tort que l’ATA source vide reste `Frozen` alors que le handler Metaplex courant thaw la source, transfère, puis freeze uniquement la destination ; - corrige la postcondition finale en exigeant source `amount=0, state=Initialized` et destination `amount=1, state=Frozen`, et ajoute ces états à `METAPLEX_PNFT_LIFECYCLE_STATE` ; aucune opération lifecycle n’est encore promue avant un rerun complet émettant les six signatures/slots et le bundle evidence final. -- `pre.013-delta-fix-027` enregistre le rerun `fix-026` : le workspace est entièrement propre (`kb-lib` 706/706, `kb-pipeline` 107/107, scénarios 96/96, desktop 135/135) et `Delegate(StakingV1)` franchit désormais confirmation, hydratation canonique, extraction Core, replay, matérialisation et idempotence avant qu’une postcondition de campagne ne lise à tort `delegate=None` dans la projection JSON brute du `TokenRecord` ; la campagne reste non qualifiée jusqu’au rerun avec projection canonique. +- `pre.013-delta-fix-027` enregistre le rerun `fix-026` : le workspace est entièrement propre (`ks-lib` 706/706, `ks-pipeline` 107/107, scénarios 96/96, desktop 135/135) et `Delegate(StakingV1)` franchit désormais confirmation, hydratation canonique, extraction Core, replay, matérialisation et idempotence avant qu’une postcondition de campagne ne lise à tort `delegate=None` dans la projection JSON brute du `TokenRecord` ; la campagne reste non qualifiée jusqu’au rerun avec projection canonique. - `pre.013-delta-fix-026` enregistre le rerun `fix-025` : `Create -> Mint` franchit désormais entièrement sa préparation pNFT, puis `Delegate(StakingV1)` est réellement confirmé par `4S2uDrVU6ci59eKeGtGeXoUCbsUr4WxzSa7uYhmBxLtjKfNwpBkZRqm59V9cfbD99oE9AugMYppiQqnMbV2Hy1p7` au slot `482106293` avec hydratation canonique et extraction Core réussies ; -- le replay échoue ensuite dans `kb-lib` avant matérialisation parce que `Delegate.authority` et le fee payer sont le même wallet : Core replay expose donc le privilège writable global sur la position authority, alors que l’AccountMeta officiel de cette position est seulement signer ; +- le replay échoue ensuite dans `ks-lib` avant matérialisation parce que `Delegate.authority` et le fee payer sont le même wallet : Core replay expose donc le privilège writable global sur la position authority, alors que l’AccountMeta officiel de cette position est seulement signer ; - prépare le correctif de la même frontière pour `Delegate/Revoke` et pour `Lock/Unlock`, où `token_owner` est également le fee payer dans la campagne ; les cinq opérations lifecycle restent `not_run` jusqu’à un rerun complet. - `pre.013-delta-fix-025` enregistre la première tentative réseau du cycle pNFT après correction du harness : `Create` est réellement confirmé par `PNkQAnykFoHVsREkhDbTW9eccyJoQvQbRZ2MJ4FsFRXyXint9fj6FT9PW45W5R3yi9HJ2aiSZXssH6B6pmyCcEz` au slot `482096529`, puis la campagne s’arrête pendant sa post-validation stateful sur la Master Edition `HmCuW752ukBChVTbXtKJphUwJTJDdSycrgs6SrU2nT4B` du mint `DtBji9AYCqLRB48LFEFir427Kwy4Ehie6Pc8S87aQ6Rb` ; -- le défaut est dans `kb-lib` : le trailer officiel de 2 octets d’une Master Edition compacte avait été introduit par `fix-021` comme padding nul, ce qui rejetait précisément le byte `ProgrammableNonFungible(4)` écrit par le programme courant ; aucune des cinq opérations lifecycle n’a encore été atteinte ni promue. +- le défaut est dans `ks-lib` : le trailer officiel de 2 octets d’une Master Edition compacte avait été introduit par `fix-021` comme padding nul, ce qui rejetait précisément le byte `ProgrammableNonFungible(4)` écrit par le programme courant ; aucune des cinq opérations lifecycle n’a encore été atteinte ni promue. - `pre.013-delta-fix-024` corrige uniquement le harness `#[cfg(test)]` de la campagne pNFT préparée par `fix-023` : il réutilise le chargement de configuration, la surcharge PostgreSQL, la construction `PostgresStoreOptions`, le pool HTTP et le wallet directory déjà éprouvés par les autres campagnes Metaplex ; - aligne l'émission `METAPLEX_PNFT_LIFECYCLE_EVIDENCE` sur les champs réels de `DevnetMetaplexTokenMetadataExecutionSummary` (`genesis_hash`, `simulation_context_slot`, `readiness.message_hash`, `fee.fee_lamports`) au lieu de champs inexistants du résultat brut de simulation ; -- enregistre que `cargo check --workspace` de `fix-023` était vert parce que le défaut restait sous `#[cfg(test)]`, tandis que `clippy --all-targets` et `cargo test -p kb-pipeline-demo-scenarios` compilaient ce harness et échouaient avant toute transaction pNFT ; la matrice reste à 6 opérations `confirmed` et 14 `not_run`. +- enregistre que `cargo check --workspace` de `fix-023` était vert parce que le défaut restait sous `#[cfg(test)]`, tandis que `clippy --all-targets` et `cargo test -p ks-pipeline-demo-scenarios` compilaient ce harness et échouaient avant toute transaction pNFT ; la matrice reste à 6 opérations `confirmed` et 14 `not_run`. - `pre.013-delta-fix-023` qualifie définitivement `Print` et `Burn` sur Devnet : `Print` est confirmé par `REHAxUZrSdKDj8F8k27Amrg7hwuJFhVfstjc9xjn2XGfTX38fH4tFwPeNrF5zeMN5pc21PpUPSgaKXMMfTFd7TE` au slot `482087799`, puis `Burn` par `4cNUxGGSWifuAtqdPJAtM3Cjpi4JATitRDqrvEAe85NLpMWcgWmC27bsfjNUmK6sEBDovNPtkPV3wDH1LpfGbhd1` au slot `482087818`; les deux étapes terminent hydratation canonique, extraction Core, replay, matérialisation et idempotence ; - promeut `Print` et `Burn` à `confirmed` sur la famille NFT dans la matrice Devnet v3, qui passe à 6 opérations `confirmed` et 14 `not_run` ; - prépare la campagne spécialisée pNFT `Delegate(Staking) -> Lock -> Unlock -> Revoke(Staking) -> Delegate(Transfer) -> Transfer` sur une fixture `programmable_nft` fraîche, avec signataire delegate supplémentaire, propriétaire destination frais, Token Records source/destination et ATA gelées validés à chaque transition ; @@ -143,7 +149,7 @@ - réconcilie l’ordre des neuf étapes, la fixture, la matrice Devnet et les tests de campagne ; - ajoute une régression garantissant que `SetAuthority` ne cible jamais le compte Metadata non canonique de la fixture ; -- réutilise l’unique cible canonique `kb-pipeline-demo-scenarios` pour les logs de fixture et supprime la seconde constante incompatible avec la convention de logging de la crate ; +- réutilise l’unique cible canonique `ks-pipeline-demo-scenarios` pour les logs de fixture et supprime la seconde constante incompatible avec la convention de logging de la crate ; - corrige les derniers diagnostics Clippy des tests : `str::len()` direct pour les seeds UTF-8 et `return` explicite dans la closure de statut de validation ; - corrige les tests de réconciliation des opérations : comparaison de références `&str` et durée de vie de l’inventaire de scénarios ; - documente la crate du test d’API publique externe afin de conserver `missing_docs` propre ; @@ -153,7 +159,7 @@ - ajoute une campagne confirmée réutilisable qui exécute les neuf étapes sans déplacer l’orchestration dans le desktop ; - distingue la preuve `materialized_snapshot` de la preuve terminale `account_absence` après `Close` ; - ajoute une matrice conservative dont tous les statuts réseau restent `not_run` avant exécution réelle ; -- conserve `kb-pipeline` indépendant de cette crate et ne modifie pas encore `demo_execution_metadata`. +- conserve `ks-pipeline` indépendant de cette crate et ne modifie pas encore `demo_execution_metadata`. ## 0.4.7-pre.016 @@ -198,7 +204,7 @@ - remplace la préparation Metaplex fondée sur `solana-keygen`, `solana` et `spl-token` par une transaction Rust native ; - crée le mint par `SystemCreateAccount` puis `SPL Token InitializeMint2` dans un même message simulé, signé et confirmé ; - utilise explicitement le wallet du profil comme mint authority et freeze authority ; -- conserve le keypair du mint dans `kb-wallet` sans exposer ni déléguer ses secrets à une CLI externe. +- conserve le keypair du mint dans `ks-wallet` sans exposer ni déléguer ses secrets à une CLI externe. ## 0.4.7-pre.013-fix-010 @@ -232,7 +238,7 @@ ## 0.4.7-pre.012-fix-003 - ajout explicite de la dépendance workspace `mpl-token-metadata` requise par les modèles et constructeurs de scénarios ; -- alignement du test de placeholder sur le code stable `config` réellement exposé par `kb_core::Error::config` ; +- alignement du test de placeholder sur le code stable `config` réellement exposé par `ks_core::Error::config` ; - validation locale : formatage, workspace check, clippy et audits propres ; 53 tests de bibliothèque réussis avant correction de l’assertion, un seul test échouant sur le code attendu. ## 0.4.7-pre.012-fix-002 @@ -312,7 +318,7 @@ ## 0.1.0-pre.062 - extraction des scénarios de démonstration hors du desktop ; -- conservation du nom de bibliothèque `kb_pipeline_demo_scenarios` ; -- création du binaire explicite `kb-pipeline-demo-scenarios-cli` avec `autobins = false` ; +- conservation du nom de bibliothèque `ks_pipeline_demo_scenarios` ; +- création du binaire explicite `ks-pipeline-demo-scenarios-cli` avec `autobins = false` ; - migration des scénarios System Transfer, Memo v4, ATA, SPL Token et Token-2022 ; - validation connue de 39 tests de bibliothèque et 1 test de binaire. diff --git a/kb-pipeline-demo-scenarios/Cargo.toml b/ks-pipeline-demo-scenarios/Cargo.toml similarity index 55% rename from kb-pipeline-demo-scenarios/Cargo.toml rename to ks-pipeline-demo-scenarios/Cargo.toml index 5c4f98d..769c0e6 100644 --- a/kb-pipeline-demo-scenarios/Cargo.toml +++ b/ks-pipeline-demo-scenarios/Cargo.toml @@ -1,8 +1,8 @@ -# file: kb-pipeline-demo-scenarios/Cargo.toml -# version: 11 +# file: ks-pipeline-demo-scenarios/Cargo.toml +# version: 12 [package] -name = "kb-pipeline-demo-scenarios" +name = "ks-pipeline-demo-scenarios" version.workspace = true edition.workspace = true license.workspace = true @@ -10,25 +10,25 @@ publish.workspace = true autobins = false [lib] -name = "kb_pipeline_demo_scenarios" +name = "ks_pipeline_demo_scenarios" path = "src/lib.rs" [[bin]] -name = "kb-pipeline-demo-scenarios-cli" -path = "src/bin/kb_pipeline_demo_scenarios_cli.rs" +name = "ks-pipeline-demo-scenarios-cli" +path = "src/bin/ks_pipeline_demo_scenarios_cli.rs" [dependencies] base64.workspace = true bs58.workspace = true chrono.workspace = true -kb-core = { path = "../kb-core" } -kb-config = { path = "../kb-config" } -kb-lib = { path = "../kb-lib" } -kb-onchain-transport = { path = "../kb-onchain-transport" } -kb-pipeline = { path = "../kb-pipeline" } -kb-program-ids = { path = "../kb-program-ids" } -kb-store = { path = "../kb-store" } -kb-wallet = { path = "../kb-wallet" } +ks-core = { path = "../ks-core" } +ks-config = { path = "../ks-config" } +ks-lib = { path = "../ks-lib" } +ks-onchain-transport = { path = "../ks-onchain-transport" } +ks-pipeline = { path = "../ks-pipeline" } +ks-program-ids = { path = "../ks-program-ids" } +ks-store = { path = "../ks-store" } +ks-wallet = { path = "../ks-wallet" } mpl-token-metadata.workspace = true solana-instruction.workspace = true solana-keypair.workspace = true diff --git a/kb-pipeline-demo-scenarios/README.md b/ks-pipeline-demo-scenarios/README.md similarity index 96% rename from kb-pipeline-demo-scenarios/README.md rename to ks-pipeline-demo-scenarios/README.md index 7418ccd..54c2fde 100644 --- a/kb-pipeline-demo-scenarios/README.md +++ b/ks-pipeline-demo-scenarios/README.md @@ -1,14 +1,14 @@ - - + + -# kb-pipeline-demo-scenarios +# ks-pipeline-demo-scenarios -`kb-pipeline-demo-scenarios` fournit des scénarios synthétiques et des campagnes Devnet/Testnet automatisables au-dessus de `kb-pipeline`. +`ks-pipeline-demo-scenarios` fournit des scénarios synthétiques et des campagnes Devnet/Testnet automatisables au-dessus de `ks-pipeline`. La crate contient : -- la bibliothèque Rust `kb_pipeline_demo_scenarios` ; -- le binaire ciblé `kb-pipeline-demo-scenarios-cli`. +- la bibliothèque Rust `ks_pipeline_demo_scenarios` ; +- le binaire ciblé `ks-pipeline-demo-scenarios-cli`. ## Responsabilités @@ -57,7 +57,7 @@ Le CLI a été introduit pour les préparations de fixtures qui nécessitent une ## Relations avec le workspace -La crate dépend du pipeline généraliste. `kb-pipeline` ne dépend jamais d’elle. Le desktop réutilise déjà ses campagnes ; `0.5.4` doit déplacer ici les dispatchs et critères de campagne encore réutilisables afin de ne laisser localement que l'adaptation UI/Tauri, les presets strictement visuels et la présentation opérateur. +La crate dépend du pipeline généraliste. `ks-pipeline` ne dépend jamais d’elle. Le desktop réutilise déjà ses campagnes ; `0.5.4` doit déplacer ici les dispatchs et critères de campagne encore réutilisables afin de ne laisser localement que l'adaptation UI/Tauri, les presets strictement visuels et la présentation opérateur. ## Documentation diff --git a/kb-pipeline-demo-scenarios/TODO.md b/ks-pipeline-demo-scenarios/TODO.md similarity index 86% rename from kb-pipeline-demo-scenarios/TODO.md rename to ks-pipeline-demo-scenarios/TODO.md index 310d4a8..5faf022 100644 --- a/kb-pipeline-demo-scenarios/TODO.md +++ b/ks-pipeline-demo-scenarios/TODO.md @@ -1,7 +1,7 @@ - - + + -# TODO — kb-pipeline-demo-scenarios +# TODO — ks-pipeline-demo-scenarios ## Évolutions générales diff --git a/kb-pipeline-demo-scenarios/USAGE.md b/ks-pipeline-demo-scenarios/USAGE.md similarity index 85% rename from kb-pipeline-demo-scenarios/USAGE.md rename to ks-pipeline-demo-scenarios/USAGE.md index 06db964..98bc9db 100644 --- a/kb-pipeline-demo-scenarios/USAGE.md +++ b/ks-pipeline-demo-scenarios/USAGE.md @@ -1,7 +1,7 @@ - - + + -# Utilisation de kb-pipeline-demo-scenarios +# Utilisation de ks-pipeline-demo-scenarios ## Objectif @@ -10,8 +10,8 @@ La bibliothèque expose des scénarios Devnet contrôlés. Le binaire permet leu ## Initialiser l’environnement ```rust -fn initialize_environment() -> kb_core::Result<()> { - kb_pipeline_demo_scenarios::initialize_demo_scenario_environment() +fn initialize_environment() -> ks_core::Result<()> { + ks_pipeline_demo_scenarios::initialize_demo_scenario_environment() } ``` @@ -22,8 +22,8 @@ fn initialize_environment() -> kb_core::Result<()> { `NoopSolanaExecutionObserver` convient aux appels sans progression personnalisée. ```rust -fn observer() -> kb_pipeline_demo_scenarios::NoopSolanaExecutionObserver { - kb_pipeline_demo_scenarios::NoopSolanaExecutionObserver +fn observer() -> ks_pipeline_demo_scenarios::NoopSolanaExecutionObserver { + ks_pipeline_demo_scenarios::NoopSolanaExecutionObserver } ``` @@ -33,9 +33,9 @@ Une application peut implémenter `SolanaExecutionObserver` pour recevoir les é ```rust fn system_transfer_request( - recipient: kb_lib::MdPubkey, -) -> kb_pipeline_demo_scenarios::DevnetSystemTransferRequest { - kb_pipeline_demo_scenarios::DevnetSystemTransferRequest::new( + recipient: ks_lib::MdPubkey, +) -> ks_pipeline_demo_scenarios::DevnetSystemTransferRequest { + ks_pipeline_demo_scenarios::DevnetSystemTransferRequest::new( "system-transfer-001", recipient, 1_000, @@ -48,8 +48,8 @@ Le constructeur crée une requête conservative : `submit` et `operator_confirme ## Préparer et exécuter un Memo v4 ```rust -fn memo_request() -> kb_pipeline_demo_scenarios::DevnetMemoExecutionRequest { - kb_pipeline_demo_scenarios::DevnetMemoExecutionRequest::new( +fn memo_request() -> ks_pipeline_demo_scenarios::DevnetMemoExecutionRequest { + ks_pipeline_demo_scenarios::DevnetMemoExecutionRequest::new( "memo-001", "khadhroony-bot3 Devnet validation", ) @@ -60,13 +60,13 @@ fn memo_request() -> kb_pipeline_demo_scenarios::DevnetMemoExecutionRequest { async fn run_memo( store: &S, observer: &O, - request: kb_pipeline_demo_scenarios::DevnetMemoExecutionRequest, -) -> kb_core::Result + request: ks_pipeline_demo_scenarios::DevnetMemoExecutionRequest, +) -> ks_core::Result where - S: kb_store::Store + Sync, - O: kb_pipeline_demo_scenarios::SolanaExecutionObserver, + S: ks_store::Store + Sync, + O: ks_pipeline_demo_scenarios::SolanaExecutionObserver, { - let result = kb_pipeline_demo_scenarios::execute_devnet_memo( + let result = ks_pipeline_demo_scenarios::execute_devnet_memo( store, observer, request, @@ -84,14 +84,14 @@ where ```rust async fn simulate_token_2022( - request: kb_pipeline_demo_scenarios::DevnetSplToken2022ExecutionRequest, + request: ks_pipeline_demo_scenarios::DevnetSplToken2022ExecutionRequest, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - O: kb_pipeline_demo_scenarios::SolanaExecutionObserver, + O: ks_pipeline_demo_scenarios::SolanaExecutionObserver, { let result = - kb_pipeline_demo_scenarios::simulate_devnet_spl_token_2022(request, observer).await; + ks_pipeline_demo_scenarios::simulate_devnet_spl_token_2022(request, observer).await; match result { Ok(summary) => Ok(summary), @@ -110,7 +110,7 @@ Le test opt-in est le chemin opérateur recommandé : KB_DEVNET_TOKEN_2022_METADATA_CAMPAIGN_TEST=1 \ KB_DEVNET_TOKEN_2022_METADATA_OPERATOR_CONFIRMED=1 \ KB_POSTGRES_TEST_URL='postgresql://…' \ -cargo test -p kb-pipeline-demo-scenarios optional_devnet_token_2022_metadata_campaign_from_env -- --nocapture +cargo test -p ks-pipeline-demo-scenarios optional_devnet_token_2022_metadata_campaign_from_env -- --nocapture ``` `KB_DEVNET_PROFILE` peut sélectionner explicitement le profil Devnet et `KB_DEVNET_CONFIG_PATH` peut remplacer `config/example.config.json`. Le profil doit utiliser un wallet persistant, autoriser les soumissions Devnet et respecter les plafonds de dépense et de frais. @@ -121,8 +121,8 @@ La sortie `TOKEN_2022_METADATA_FIXTURE` conserve le mint et la signature de pré ```rust fn load_validation_matrix( -) -> kb_core::Result { - let result = kb_pipeline_demo_scenarios::load_token_2022_validation_matrix(); +) -> ks_core::Result { + let result = ks_pipeline_demo_scenarios::load_token_2022_validation_matrix(); match result { Ok(matrix) => Ok(matrix), @@ -137,7 +137,7 @@ La matrice provient de `test-fixtures/contract-matrices/SPL_TOKEN_2022_VALIDATIO ```rust fn scenario_ids() -> Vec { - kb_pipeline_demo_scenarios::devnet_spl_validation_scenarios() + ks_pipeline_demo_scenarios::devnet_spl_validation_scenarios() .iter() .map(|scenario| scenario.id.clone()) .collect() @@ -152,14 +152,14 @@ Cette liste permet au CLI ou au desktop de présenter l’inventaire sans dupliq async fn prepare_fixture( wallet_path: std::path::PathBuf, wallet_dir: std::path::PathBuf, -) -> kb_core::Result { - let options = kb_pipeline_demo_scenarios::Token2022FixturePreparationOptions { +) -> ks_core::Result { + let options = ks_pipeline_demo_scenarios::Token2022FixturePreparationOptions { rpc_url: "https://api.devnet.solana.com".to_string(), wallet_path, wallet_dir, decimals: 9, }; - let result = kb_pipeline_demo_scenarios::prepare_token_2022_fixture(&options).await; + let result = ks_pipeline_demo_scenarios::prepare_token_2022_fixture(&options).await; match result { Ok(summary) => Ok(summary), @@ -179,7 +179,7 @@ Les tests de cette crate sont particulièrement utiles pour comprendre l’orche - simulation et exécution des scénarios ; - hydratation canonique, extraction Core, replay et matérialisation ; - idempotence et confirmation des états finaux ; -- test du binaire `kb-pipeline-demo-scenarios-cli`. +- test du binaire `ks-pipeline-demo-scenarios-cli`. Les tests Devnet restent opt-in et peuvent produire des transactions réelles lorsque la soumission est explicitement activée. @@ -187,7 +187,7 @@ Les tests Devnet restent opt-in et peuvent produire des transactions réelles lo - aucun envoi ne doit résulter d’une simple demande de simulation ; - le profil doit cibler Devnet pour les scénarios Devnet ; -- les secrets restent gérés par `kb-wallet` ; +- les secrets restent gérés par `ks-wallet` ; - les résumés ne doivent pas déclarer une validation non observée ; - ElGamal ne doit pas être présenté comme validé sur réseau. @@ -201,7 +201,7 @@ Les tests Devnet restent opt-in et peuvent produire des transactions réelles lo ```rust fn metaplex_scenario_ids() -> Vec { - kb_pipeline_demo_scenarios::metaplex_token_metadata_synthetic_scenarios() + ks_pipeline_demo_scenarios::metaplex_token_metadata_synthetic_scenarios() .iter() .map(|scenario| scenario.id.clone()) .collect() @@ -214,8 +214,8 @@ L’inventaire couvre NFT, SFT, token fongible, collection et pNFT. Ces scénari ```rust fn load_metaplex_matrix( -) -> kb_core::Result { - let result = kb_pipeline_demo_scenarios::load_metaplex_token_metadata_validation_matrix(); +) -> ks_core::Result { + let result = ks_pipeline_demo_scenarios::load_metaplex_token_metadata_validation_matrix(); match result { Ok(matrix) => Ok(matrix), @@ -229,9 +229,9 @@ Une validation réseau ne peut passer à `confirmed` que lorsque toutes les preu ## Inventaire Metaplex Devnet ```rust -let scenarios = kb_pipeline_demo_scenarios::metaplex_token_metadata_devnet_scenarios(); +let scenarios = ks_pipeline_demo_scenarios::metaplex_token_metadata_devnet_scenarios(); assert!(scenarios.iter().all(|scenario| { - scenario.mode == kb_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode::NetworkSimulation + scenario.mode == ks_pipeline_demo_scenarios::MetaplexTokenMetadataScenarioMode::NetworkSimulation })); ``` @@ -240,8 +240,8 @@ Cet inventaire prépare les tests et campagnes Devnet simulation-first. Il ne co ## Charger le corpus de validation croisée Metaplex ```rust -fn load_metaplex_cross_validation() -> kb_core::Result { - let matrix = kb_pipeline_demo_scenarios::load_metaplex_token_metadata_cross_validation_matrix(); +fn load_metaplex_cross_validation() -> ks_core::Result { + let matrix = ks_pipeline_demo_scenarios::load_metaplex_token_metadata_cross_validation_matrix(); return match matrix { Ok(value) => Ok(value.cases.len()), Err(error) => Err(error), @@ -257,20 +257,20 @@ L’API réseau prend un intent Metaplex typé déjà lié aux comptes et autori ```rust async fn simulate_metaplex_operation( - pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, - operation: kb_lib::ExMetaplexTokenMetadataOperation, + operation: ks_lib::ExMetaplexTokenMetadataOperation, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - O: kb_pipeline_demo_scenarios::SolanaExecutionObserver, + O: ks_pipeline_demo_scenarios::SolanaExecutionObserver, { - let request = kb_pipeline_demo_scenarios::DevnetMetaplexTokenMetadataExecutionRequest::new( + let request = ks_pipeline_demo_scenarios::DevnetMetaplexTokenMetadataExecutionRequest::new( "metaplex-devnet-simulation", operation, ); - return kb_pipeline_demo_scenarios::simulate_devnet_metaplex_token_metadata( + return ks_pipeline_demo_scenarios::simulate_devnet_metaplex_token_metadata( pool, profile, workspace_root, @@ -287,8 +287,8 @@ Pour une soumission, l’appelant doit définir `submit = true` et `operator_con ```rust fn load_metaplex_devnet_contract( -) -> kb_core::Result { - return kb_pipeline_demo_scenarios::load_metaplex_token_metadata_devnet_execution_matrix(); +) -> ks_core::Result { + return ks_pipeline_demo_scenarios::load_metaplex_token_metadata_devnet_execution_matrix(); } ``` @@ -301,7 +301,7 @@ Le runner Devnet commun accepte toute variante non dépréciée de `ExMetaplexTo ```bash KB_DEVNET_METAPLEX_EXECUTION_TEST=1 \ KB_DEVNET_METAPLEX_OPERATION_JSON='{"operation":"..."}' \ -cargo test -p kb-pipeline-demo-scenarios optional_devnet_current_operation_from_env -- --nocapture +cargo test -p ks-pipeline-demo-scenarios optional_devnet_current_operation_from_env -- --nocapture ``` Variables optionnelles : @@ -322,14 +322,14 @@ Les exemples contenant `...` ne sont jamais exécutables. Pour connaître les op ```rust let operations = - kb_pipeline_demo_scenarios::metaplex_token_metadata_current_operation_names(); + ks_pipeline_demo_scenarios::metaplex_token_metadata_current_operation_names(); ``` Les opérations disposant d’un modèle générique peuvent être inspectées ainsi : ```rust -fn verify_template() -> kb_core::Result { - kb_pipeline_demo_scenarios::metaplex_token_metadata_current_operation_json_template( +fn verify_template() -> ks_core::Result { + ks_pipeline_demo_scenarios::metaplex_token_metadata_current_operation_json_template( "verify", ) } @@ -341,10 +341,10 @@ Pour les parcours créateur, il est préférable de ne pas écrire de JSON manue ```rust fn creator_verify_request( - authority: kb_lib::MdPubkey, - metadata: kb_lib::MdPubkey, -) -> kb_pipeline_demo_scenarios::DevnetMetaplexTokenMetadataExecutionRequest { - kb_pipeline_demo_scenarios::devnet_metaplex_creator_verify_request( + authority: ks_lib::MdPubkey, + metadata: ks_lib::MdPubkey, +) -> ks_pipeline_demo_scenarios::DevnetMetaplexTokenMetadataExecutionRequest { + ks_pipeline_demo_scenarios::devnet_metaplex_creator_verify_request( "metaplex-verify-creator", authority, metadata, @@ -381,7 +381,7 @@ KB_DEVNET_METAPLEX_CREATE_MINT_CAMPAIGN_TEST=1 \ KB_DEVNET_METAPLEX_OPERATOR_CONFIRMED=1 \ KB_DEVNET_METAPLEX_CREATE_MINT_FAMILY=nft \ KB_POSTGRES_TEST_URL='postgresql://…' \ -cargo test -p kb-pipeline-demo-scenarios \ +cargo test -p ks-pipeline-demo-scenarios \ optional_devnet_metaplex_create_mint_campaign_from_env \ -- --nocapture ``` @@ -406,7 +406,7 @@ Le parcours ne soumet pas `SetCollectionSize` : cette opération est obsolète e KB_DEVNET_METAPLEX_COLLECTION_VERIFY_CAMPAIGN_TEST=1 \ KB_DEVNET_METAPLEX_OPERATOR_CONFIRMED=1 \ KB_POSTGRES_TEST_URL='postgres://solana:solana@localhost:5432/solana_test' \ -cargo test -p kb-pipeline-demo-scenarios \ +cargo test -p ks-pipeline-demo-scenarios \ optional_devnet_metaplex_collection_verify_campaign_from_env \ -- --nocapture ``` @@ -429,7 +429,7 @@ Le runner exige que le Token Record source passe `Unlocked/Staking -> Locked/Sta KB_DEVNET_METAPLEX_PNFT_LIFECYCLE_CAMPAIGN_TEST=1 \ KB_DEVNET_METAPLEX_OPERATOR_CONFIRMED=1 \ KB_POSTGRES_TEST_URL='postgres://solana:solana@localhost:5432/solana_test' \ -cargo test -p kb-pipeline-demo-scenarios \ +cargo test -p ks-pipeline-demo-scenarios \ optional_devnet_metaplex_pnft_lifecycle_campaign_from_env \ -- --nocapture ``` @@ -444,7 +444,7 @@ La campagne escrow prépare un NFT classique parent et un token fungible attribu KB_DEVNET_METAPLEX_ESCROW_CAMPAIGN_TEST=1 \ KB_DEVNET_METAPLEX_OPERATOR_CONFIRMED=1 \ KB_POSTGRES_TEST_URL='postgres://solana:solana@localhost:5432/solana_test' \ -cargo test -p kb-pipeline-demo-scenarios \ +cargo test -p ks-pipeline-demo-scenarios \ optional_devnet_metaplex_escrow_campaign_from_env \ -- --nocapture ``` @@ -459,7 +459,7 @@ La campagne `maintenance_campaign` ferme les opérations courantes qui ne relèv KB_DEVNET_METAPLEX_MAINTENANCE_CAMPAIGN_TEST=1 \ KB_DEVNET_METAPLEX_OPERATOR_CONFIRMED=1 \ KB_POSTGRES_TEST_URL='postgres://solana:solana@localhost:5432/solana_test' \ -cargo test -p kb-pipeline-demo-scenarios \ +cargo test -p ks-pipeline-demo-scenarios \ optional_devnet_metaplex_maintenance_campaign_from_env \ -- --nocapture ``` @@ -487,7 +487,7 @@ La surface courante `Use` est classée `unavailable` sur Devnet : la simulation KB_DEVNET_METAPLEX_USE_PROBE_TEST=1 \ KB_DEVNET_METAPLEX_OPERATOR_CONFIRMED=1 \ KB_POSTGRES_TEST_URL='postgres://solana:solana@localhost:5432/solana_test' \ -cargo test -p kb-pipeline-demo-scenarios \ +cargo test -p ks-pipeline-demo-scenarios \ optional_devnet_metaplex_use_probe_from_env \ -- --nocapture ``` @@ -500,8 +500,8 @@ L’inventaire fermé est exposé par : ```rust fn program_metadata_scenarios( -) -> Vec { - kb_pipeline_demo_scenarios::solana_program_metadata_devnet_scenarios() +) -> Vec { + ks_pipeline_demo_scenarios::solana_program_metadata_devnet_scenarios() } ``` @@ -516,20 +516,20 @@ La préparation crée deux PDA non canoniques, les préfinance avec deux transfe ```rust async fn run_program_metadata_campaign( - pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - O: kb_pipeline_demo_scenarios::SolanaExecutionObserver, + O: ks_pipeline_demo_scenarios::SolanaExecutionObserver, { - let options = kb_pipeline_demo_scenarios::SolanaProgramMetadataFixturePreparationOptions { + let options = ks_pipeline_demo_scenarios::SolanaProgramMetadataFixturePreparationOptions { query_role: "http_queries".to_string(), transaction_role: "http_transactions".to_string(), operator_confirmed: true, }; - kb_pipeline_demo_scenarios::execute_devnet_solana_program_metadata_campaign( + ks_pipeline_demo_scenarios::execute_devnet_solana_program_metadata_campaign( pool, profile, workspace_root, diff --git a/kb-pipeline-demo-scenarios/src/bin/kb_pipeline_demo_scenarios_cli.rs b/ks-pipeline-demo-scenarios/src/bin/ks_pipeline_demo_scenarios_cli.rs similarity index 84% rename from kb-pipeline-demo-scenarios/src/bin/kb_pipeline_demo_scenarios_cli.rs rename to ks-pipeline-demo-scenarios/src/bin/ks_pipeline_demo_scenarios_cli.rs index 0adf38d..d19a336 100644 --- a/kb-pipeline-demo-scenarios/src/bin/kb_pipeline_demo_scenarios_cli.rs +++ b/ks-pipeline-demo-scenarios/src/bin/ks_pipeline_demo_scenarios_cli.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/bin/kb_pipeline_demo_scenarios_cli.rs -// version: 1 +// file: ks-pipeline-demo-scenarios/src/bin/ks_pipeline_demo_scenarios_cli.rs +// version: 2 #![forbid(unsafe_code)] #![deny(unreachable_pub)] @@ -7,7 +7,7 @@ //! Command-line entry point for reusable Devnet fixture preparation. -macro_rules! kb_try { +macro_rules! ks_try { ($expression:expr) => { match $expression { std::result::Result::Ok(value) => value, @@ -25,7 +25,7 @@ async fn main() { } } -async fn run() -> kb_core::Result<()> { +async fn run() -> ks_core::Result<()> { let arguments = std::env::args().skip(1).collect::>(); let command = match arguments.first() { std::option::Option::Some(value) => value.as_str(), @@ -34,12 +34,12 @@ async fn run() -> kb_core::Result<()> { if command != "prepare-token-2022-fixture" { return usage_error(format!("unknown command {command}").as_str()); } - let options = kb_try!(parse_prepare_options(arguments.as_slice())); - let summary = kb_try!(kb_pipeline_demo_scenarios::prepare_token_2022_fixture(&options).await); + let options = ks_try!(parse_prepare_options(arguments.as_slice())); + let summary = ks_try!(ks_pipeline_demo_scenarios::prepare_token_2022_fixture(&options).await); let output = match serde_json::to_string_pretty(&summary) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "unable to serialize Token-2022 fixture summary: {error}" ))); }, @@ -50,7 +50,7 @@ async fn run() -> kb_core::Result<()> { fn parse_prepare_options( arguments: &[std::string::String], -) -> kb_core::Result { +) -> ks_core::Result { let mut rpc_url = std::option::Option::None; let mut wallet_path = std::option::Option::None; let mut wallet_dir = std::option::Option::None; @@ -74,7 +74,7 @@ fn parse_prepare_options( decimals = match value.parse::() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid --decimals value {value}: {error}" ))); }, @@ -87,7 +87,7 @@ fn parse_prepare_options( let rpc_url = match rpc_url.or_else(|| return std::env::var("KB_DEVNET_RPC_URL").ok()) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "missing --rpc-url or KB_DEVNET_RPC_URL", )); }, @@ -97,7 +97,7 @@ fn parse_prepare_options( { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "missing --wallet or KB_DEVNET_WALLET", )); }, @@ -110,7 +110,7 @@ fn parse_prepare_options( }, }; return std::result::Result::Ok( - kb_pipeline_demo_scenarios::Token2022FixturePreparationOptions { + ks_pipeline_demo_scenarios::Token2022FixturePreparationOptions { rpc_url, wallet_path, wallet_dir, @@ -119,9 +119,9 @@ fn parse_prepare_options( ); } -fn usage_error(message: &str) -> kb_core::Result { - return std::result::Result::Err(kb_core::Error::config(format!( - "{message}. Usage: cargo run -p kb-pipeline-demo-scenarios --bin kb-pipeline-demo-scenarios-cli -- prepare-token-2022-fixture --rpc-url URL --wallet PATH [--wallet-dir PATH] [--decimals 9]" +fn usage_error(message: &str) -> ks_core::Result { + return std::result::Result::Err(ks_core::Error::config(format!( + "{message}. Usage: cargo run -p ks-pipeline-demo-scenarios --bin ks-pipeline-demo-scenarios-cli -- prepare-token-2022-fixture --rpc-url URL --wallet PATH [--wallet-dir PATH] [--decimals 9]" ))); } diff --git a/kb-pipeline-demo-scenarios/src/constants.rs b/ks-pipeline-demo-scenarios/src/constants.rs similarity index 66% rename from kb-pipeline-demo-scenarios/src/constants.rs rename to ks-pipeline-demo-scenarios/src/constants.rs index d326185..b657852 100644 --- a/kb-pipeline-demo-scenarios/src/constants.rs +++ b/ks-pipeline-demo-scenarios/src/constants.rs @@ -1,10 +1,10 @@ -// file: kb-pipeline-demo-scenarios/src/constants.rs -// version: 3 +// file: ks-pipeline-demo-scenarios/src/constants.rs +// version: 4 //! Demo scenario constants. /// Canonical tracing target for demo pipeline scenarios. -pub(crate) const TRACING_TARGET: &str = "kb-pipeline-demo-scenarios"; +pub(crate) const TRACING_TARGET: &str = "ks-pipeline-demo-scenarios"; /// Total transactions reserved by one complete Solana Program Metadata campaign. pub(crate) const SOLANA_PROGRAM_METADATA_CAMPAIGN_TRANSACTION_COUNT: u64 = 11; diff --git a/kb-pipeline-demo-scenarios/src/environment.rs b/ks-pipeline-demo-scenarios/src/environment.rs similarity index 86% rename from kb-pipeline-demo-scenarios/src/environment.rs rename to ks-pipeline-demo-scenarios/src/environment.rs index 5beb3b5..60c4bf3 100644 --- a/kb-pipeline-demo-scenarios/src/environment.rs +++ b/ks-pipeline-demo-scenarios/src/environment.rs @@ -1,13 +1,13 @@ -// file: kb-pipeline-demo-scenarios/src/environment.rs -// version: 2 +// file: ks-pipeline-demo-scenarios/src/environment.rs +// version: 3 //! Environment initialization for opt-in demonstration scenarios. -/// Loads the workspace `.env` selected by `kb-config`. +/// Loads the workspace `.env` selected by `ks-config`. pub fn initialize_demo_scenario_environment( workspace_root: &std::path::Path, -) -> kb_core::Result { - return kb_config::load_workspace_environment(workspace_root); +) -> ks_core::Result { + return ks_config::load_workspace_environment(workspace_root); } /// Resolves one compatible Devnet profile for demo scenarios. @@ -15,9 +15,9 @@ pub fn initialize_demo_scenario_environment( /// An explicit name has priority, followed by `KB_DEVNET_PROFILE`, then the /// first compatible Devnet profile declared by the configuration. pub fn resolve_demo_devnet_profile( - config: &kb_config::AppConfig, + config: &ks_config::AppConfig, requested_profile_name: std::option::Option<&str>, -) -> kb_core::Result { +) -> ks_core::Result { let explicit = requested_profile_name .map(str::trim) .filter(|value| return !value.is_empty()) @@ -44,10 +44,10 @@ pub fn resolve_demo_devnet_profile( return std::result::Result::Ok(profile.clone()); } return match selected_name { - std::option::Option::Some(name) => std::result::Result::Err(kb_core::Error::config( + std::option::Option::Some(name) => std::result::Result::Err(ks_core::Error::config( format!("compatible Devnet profile '{name}' is unavailable"), )), - std::option::Option::None => std::result::Result::Err(kb_core::Error::config( + std::option::Option::None => std::result::Result::Err(ks_core::Error::config( "no compatible Devnet profile is configured", )), }; @@ -73,27 +73,27 @@ pub struct DevnetProfileStoreReadiness { /// Verifies or initializes the PostgreSQL schema selected by one Devnet profile. pub async fn prepare_demo_devnet_profile_store( - profile: &kb_config::ProfileConfig, -) -> kb_core::Result { + profile: &ks_config::ProfileConfig, +) -> ks_core::Result { if profile.wallet.cluster != "devnet" { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "profile '{}' is not configured for Devnet", profile.name ))); } if !profile.database.enabled { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Devnet profile '{}' has database storage disabled", profile.name ))); } if profile.database.backend != "postgres" { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Devnet profile '{}' must use the PostgreSQL backend", profile.name ))); } - let options = match kb_store::PostgresStoreOptions::new( + let options = match ks_store::PostgresStoreOptions::new( profile.database.postgres.url.clone(), profile.database.postgres.max_connections, profile.database.postgres.connect_timeout_ms, @@ -102,7 +102,7 @@ pub async fn prepare_demo_devnet_profile_store( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let store = match kb_store::PostgresStore::connect(options).await { + let store = match ks_store::PostgresStore::connect(options).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -127,7 +127,7 @@ pub async fn prepare_demo_devnet_profile_store( .filter(|table| return !table.exists) .map(|table| return table.table_name.clone()) .collect::>(); - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Devnet profile '{}' PostgreSQL schema is incomplete and auto initialization is {}: missing {}", profile.name, if profile.database.postgres.auto_initialize_schema { @@ -150,8 +150,8 @@ pub async fn prepare_demo_devnet_profile_store( #[cfg(test)] mod tests { - fn example_config() -> kb_config::AppConfig { - return match kb_config::parse_config_json(include_str!("../../config/example.config.json")) + fn example_config() -> ks_config::AppConfig { + return match ks_config::parse_config_json(include_str!("../../config/example.config.json")) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("example config parse failed: {error}"), diff --git a/kb-pipeline-demo-scenarios/src/lib.rs b/ks-pipeline-demo-scenarios/src/lib.rs similarity index 99% rename from kb-pipeline-demo-scenarios/src/lib.rs rename to ks-pipeline-demo-scenarios/src/lib.rs index f165fbc..b651a16 100644 --- a/kb-pipeline-demo-scenarios/src/lib.rs +++ b/ks-pipeline-demo-scenarios/src/lib.rs @@ -1,11 +1,11 @@ -// file: kb-pipeline-demo-scenarios/src/lib.rs -// version: 27 +// file: ks-pipeline-demo-scenarios/src/lib.rs +// version: 28 #![forbid(unsafe_code)] #![deny(unreachable_pub)] #![warn(missing_docs)] -//! Reusable demonstration and Devnet validation scenarios built on `kb-pipeline`. +//! Reusable demonstration and Devnet validation scenarios built on `ks-pipeline`. mod constants; mod environment; diff --git a/kb-pipeline-demo-scenarios/src/metadata.rs b/ks-pipeline-demo-scenarios/src/metadata.rs similarity index 68% rename from kb-pipeline-demo-scenarios/src/metadata.rs rename to ks-pipeline-demo-scenarios/src/metadata.rs index 7e23a4e..d878b56 100644 --- a/kb-pipeline-demo-scenarios/src/metadata.rs +++ b/ks-pipeline-demo-scenarios/src/metadata.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata.rs -// version: 1 +// file: ks-pipeline-demo-scenarios/src/metadata.rs +// version: 2 //! Metadata-oriented reusable demo and Devnet validation scenarios. diff --git a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata.rs b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata.rs similarity index 85% rename from kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata.rs rename to ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata.rs index 98da486..aeccae2 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata.rs -// version: 7 +// file: ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata.rs +// version: 8 //! Metaplex Token Metadata demo and Devnet validation scenarios. diff --git a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/collection_verify_campaign.rs b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/collection_verify_campaign.rs similarity index 87% rename from kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/collection_verify_campaign.rs rename to ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/collection_verify_campaign.rs index 343f57d..91fb421 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/collection_verify_campaign.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/collection_verify_campaign.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/collection_verify_campaign.rs -// version: 1 +// file: ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/collection_verify_campaign.rs +// version: 2 //! Confirmed Devnet collection parent/member `Verify -> Unverify` campaign. @@ -43,22 +43,22 @@ pub fn metaplex_collection_verify_campaign_operation_names() -> &'static [&'stat /// Executes one fresh collection parent/member `Verify -> Unverify` campaign on Devnet. #[allow(clippy::too_many_arguments)] pub async fn execute_devnet_metaplex_collection_verify_campaign( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::MetaplexCreateFixturePreparationOptions, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { if options.collection_mint.is_some() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "collection verification campaign base options must not preselect a collection mint", )); } @@ -108,7 +108,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if verified_before || collection_size_before != 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_collection_verify_initial_state_invalid", format!( "fresh collection member must start unverified with parent size 0; verified={verified_before}, size={collection_size_before}" @@ -124,24 +124,24 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let fixture_slot = std::cmp::max(parent_mint_slot, member_mint_slot); - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcMetadataMetaplexTokenMetadataDecoder)]; - let materializers: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::MtAdminMaterializer), - std::sync::Arc::new(kb_lib::MtComplianceAuditMaterializer), - std::sync::Arc::new(kb_lib::MtLifecycleMaterializer), - std::sync::Arc::new(kb_lib::MtMetadataMetaplexTokenMetadataMaterializer), - std::sync::Arc::new(kb_lib::MtRiskMaterializer), + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcMetadataMetaplexTokenMetadataDecoder)]; + let materializers: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::MtAdminMaterializer), + std::sync::Arc::new(ks_lib::MtComplianceAuditMaterializer), + std::sync::Arc::new(ks_lib::MtLifecycleMaterializer), + std::sync::Arc::new(ks_lib::MtMetadataMetaplexTokenMetadataMaterializer), + std::sync::Arc::new(ks_lib::MtRiskMaterializer), ]; - let verify_operation = kb_lib::ExMetaplexTokenMetadataOperation::Verify { - authority: kb_lib::MdPubkey(parent.fixture.authority.clone()), + let verify_operation = ks_lib::ExMetaplexTokenMetadataOperation::Verify { + authority: ks_lib::MdPubkey(parent.fixture.authority.clone()), delegate_record: std::option::Option::None, - metadata: kb_lib::MdPubkey(member.fixture.metadata.clone()), - collection_mint: std::option::Option::Some(kb_lib::MdPubkey(parent.fixture.mint.clone())), - collection_metadata: std::option::Option::Some(kb_lib::MdPubkey( + metadata: ks_lib::MdPubkey(member.fixture.metadata.clone()), + collection_mint: std::option::Option::Some(ks_lib::MdPubkey(parent.fixture.mint.clone())), + collection_metadata: std::option::Option::Some(ks_lib::MdPubkey( parent.fixture.metadata.clone(), )), - collection_master_edition: std::option::Option::Some(kb_lib::MdPubkey( + collection_master_edition: std::option::Option::Some(ks_lib::MdPubkey( parent.fixture.master_edition.clone(), )), verification_args: mpl_token_metadata::types::VerificationArgs::CollectionV1, @@ -201,19 +201,19 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if !verified_after_verify || collection_size_after_verify != 1 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_collection_verify_postcondition_failed", format!( "confirmed collection Verify must set member verified=true and parent size=1; verified={verified_after_verify}, size={collection_size_after_verify}" ), )); } - let unverify_operation = kb_lib::ExMetaplexTokenMetadataOperation::Unverify { - authority: kb_lib::MdPubkey(parent.fixture.authority.clone()), + let unverify_operation = ks_lib::ExMetaplexTokenMetadataOperation::Unverify { + authority: ks_lib::MdPubkey(parent.fixture.authority.clone()), delegate_record: std::option::Option::None, - metadata: kb_lib::MdPubkey(member.fixture.metadata.clone()), - collection_mint: std::option::Option::Some(kb_lib::MdPubkey(parent.fixture.mint.clone())), - collection_metadata: std::option::Option::Some(kb_lib::MdPubkey( + metadata: ks_lib::MdPubkey(member.fixture.metadata.clone()), + collection_mint: std::option::Option::Some(ks_lib::MdPubkey(parent.fixture.mint.clone())), + collection_metadata: std::option::Option::Some(ks_lib::MdPubkey( parent.fixture.metadata.clone(), )), verification_args: mpl_token_metadata::types::VerificationArgs::CollectionV1, @@ -273,7 +273,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if verified_after_unverify || collection_size_after_unverify != 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_collection_unverify_postcondition_failed", format!( "confirmed collection Unverify at slot {unverify_slot} must restore verified=false and parent size=0; verified={verified_after_unverify}, size={collection_size_after_unverify}" @@ -301,30 +301,30 @@ fn collection_reads( member: &crate::MetaplexCreateFixturePreparationSummary, query_role: &str, min_context_slot: std::option::Option, -) -> std::vec::Vec { +) -> std::vec::Vec { return vec![ - kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { + ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: query_role.to_string(), - account: kb_lib::MdPubkey(member.metadata.clone()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::Metadata, + account: ks_lib::MdPubkey(member.metadata.clone()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::Metadata, min_context_slot, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }, - kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { + ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: query_role.to_string(), - account: kb_lib::MdPubkey(parent.metadata.clone()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::Metadata, + account: ks_lib::MdPubkey(parent.metadata.clone()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::Metadata, min_context_slot, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }, - kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { + ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: query_role.to_string(), - account: kb_lib::MdPubkey(parent.master_edition.clone()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::Edition { - mint: kb_lib::MdPubkey(parent.mint.clone()), + account: ks_lib::MdPubkey(parent.master_edition.clone()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::Edition { + mint: ks_lib::MdPubkey(parent.mint.clone()), }, min_context_slot, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }, ]; } @@ -332,10 +332,10 @@ fn collection_reads( fn confirmed_slot( step: &str, execution: &crate::DevnetMetaplexTokenMetadataExecutionSummary, -) -> kb_core::Result { +) -> ks_core::Result { return match execution.confirmation.as_ref().and_then(|value| return value.slot) { std::option::Option::Some(value) => std::result::Result::Ok(value), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_collection_fixture_confirmation_slot_missing", format!("Metaplex {step} has no confirmed slot"), )), @@ -345,9 +345,9 @@ fn confirmed_slot( fn validate_confirmed_execution( step: &str, execution: &crate::DevnetMetaplexTokenMetadataExecutionSummary, -) -> kb_core::Result { +) -> ks_core::Result { if !execution.simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_collection_simulation_failed", format!("Metaplex collection {step} simulation failed"), )); @@ -356,20 +356,20 @@ fn validate_confirmed_execution( std::option::Option::Some(value) if matches!( value.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) => { value }, std::option::Option::Some(value) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_collection_confirmation_incomplete", format!("Metaplex collection {step} stopped at {:?}", value.status), )); }, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_collection_confirmation_missing", format!("Metaplex collection {step} has no confirmation evidence"), )); @@ -378,7 +378,7 @@ fn validate_confirmed_execution( let diagnostic = match execution.post_execution.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_collection_post_execution_missing", format!("Metaplex collection {step} has no post-execution diagnostic"), )); @@ -391,7 +391,7 @@ fn validate_confirmed_execution( || execution.materializations.is_empty() || execution.materialized_snapshots.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_collection_post_execution_incomplete", format!( "Metaplex collection {step} post-execution incomplete: signature={}, slot={:?}, canonical_inserted={}, core_extracted={}, decode_replayed={}, materialized={}, materialization_rows={}, materialized_snapshots={}, diagnostics={:?}", @@ -410,7 +410,7 @@ fn validate_confirmed_execution( let second_replay = match execution.idempotence_replay.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_collection_idempotence_missing", format!("Metaplex collection {step} has no idempotence replay evidence"), )); @@ -425,14 +425,14 @@ fn validate_confirmed_execution( || processor.materialization_refused != 0; }) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_collection_idempotence_failed", format!("Metaplex collection {step} second replay is not idempotent"), )); } return match confirmation.slot { std::option::Option::Some(value) => std::result::Result::Ok(value), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_collection_confirmation_slot_missing", format!("Metaplex collection {step} confirmation has no slot"), )), @@ -440,16 +440,16 @@ fn validate_confirmed_execution( } fn metadata_payload<'a>( - snapshots: &'a [kb_pipeline::MetaplexTokenMetadataStatefulReadResult], + snapshots: &'a [ks_pipeline::MetaplexTokenMetadataStatefulReadResult], metadata: &str, -) -> kb_core::Result<&'a serde_json::Value> { +) -> ks_core::Result<&'a serde_json::Value> { let snapshot = snapshots.iter().find(|value| { return value.snapshot.account.0.as_str() == metadata && value.snapshot.account_kind == "metadata"; }); return match snapshot { std::option::Option::Some(value) => std::result::Result::Ok(&value.snapshot.payload_json), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_collection_metadata_snapshot_missing", format!("Metaplex metadata snapshot {metadata} is missing"), )), @@ -457,10 +457,10 @@ fn metadata_payload<'a>( } fn collection_member_verified( - snapshots: &[kb_pipeline::MetaplexTokenMetadataStatefulReadResult], + snapshots: &[ks_pipeline::MetaplexTokenMetadataStatefulReadResult], member_metadata: &str, expected_collection_mint: &str, -) -> kb_core::Result { +) -> ks_core::Result { let payload = match metadata_payload(snapshots, member_metadata) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -468,7 +468,7 @@ fn collection_member_verified( let collection = match payload.get("collection") { std::option::Option::Some(value) if value.is_object() => value, _ => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_collection_relation_missing", "member metadata does not contain a collection relation", )); @@ -477,7 +477,7 @@ fn collection_member_verified( let key = collection.get("key").and_then(serde_json::Value::as_str); let verified = collection.get("verified").and_then(serde_json::Value::as_bool); if key != std::option::Option::Some(expected_collection_mint) || verified.is_none() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_collection_relation_invalid", format!( "member collection relation mismatch: expected key={expected_collection_mint}, got key={key:?}, verified={verified:?}" @@ -486,7 +486,7 @@ fn collection_member_verified( } return match verified { std::option::Option::Some(value) => std::result::Result::Ok(value), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_collection_verified_flag_missing", "member collection relation does not expose a verified flag", )), @@ -494,9 +494,9 @@ fn collection_member_verified( } fn collection_size( - snapshots: &[kb_pipeline::MetaplexTokenMetadataStatefulReadResult], + snapshots: &[ks_pipeline::MetaplexTokenMetadataStatefulReadResult], collection_metadata: &str, -) -> kb_core::Result { +) -> ks_core::Result { let payload = match metadata_payload(snapshots, collection_metadata) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -508,7 +508,7 @@ fn collection_size( .and_then(serde_json::Value::as_u64); return match size { std::option::Option::Some(value) => std::result::Result::Ok(value), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_collection_size_missing", "collection metadata does not expose CollectionDetails::V1 size", )), @@ -650,7 +650,7 @@ mod tests { }, std::result::Result::Err(_) => workspace_root.join("config/example.config.json"), }; - let config = kb_config::read_config_json_file_with_environment( + let config = ks_config::read_config_json_file_with_environment( config_path.as_path(), workspace_root, ) @@ -662,16 +662,16 @@ mod tests { .unwrap_or_else(|error| panic!("KB_POSTGRES_TEST_URL is required: {error}")); profile.database.backend = "postgres".to_string(); profile.database.postgres.url = database_url; - let pool = kb_onchain_transport::HttpEndpointPool::from_profile(&profile) + let pool = ks_onchain_transport::HttpEndpointPool::from_profile(&profile) .unwrap_or_else(|error| panic!("HTTP pool creation failed: {error}")); - let store_options = kb_store::PostgresStoreOptions::new( + let store_options = ks_store::PostgresStoreOptions::new( profile.database.postgres.url.clone(), profile.database.postgres.max_connections, profile.database.postgres.connect_timeout_ms, false, ) .unwrap_or_else(|error| panic!("PostgreSQL options failed: {error}")); - let store = kb_store::PostgresStore::connect(store_options) + let store = ks_store::PostgresStore::connect(store_options) .await .unwrap_or_else(|error| panic!("PostgreSQL connection failed: {error}")); if let std::result::Result::Err(error) = store.initialize_store_schema().await { diff --git a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/create_mint_campaign.rs b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/create_mint_campaign.rs similarity index 91% rename from kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/create_mint_campaign.rs rename to ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/create_mint_campaign.rs index cbace15..217ea53 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/create_mint_campaign.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/create_mint_campaign.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/create_mint_campaign.rs -// version: 9 +// file: ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/create_mint_campaign.rs +// version: 10 //! Confirmed Devnet `Create -> Mint` campaign for one Metaplex asset family. @@ -45,22 +45,22 @@ pub fn metaplex_create_mint_campaign_operation_names() -> &'static [&'static str /// Executes one fresh family-specific `Create -> Mint` campaign on Devnet. #[allow(clippy::too_many_arguments)] pub async fn execute_devnet_metaplex_create_mint_campaign( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::MetaplexCreateFixturePreparationOptions, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { if !profile.wallet.devnet_send_enabled { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex Create -> Mint Devnet campaign requires devnet_send_enabled=true", )); } @@ -71,14 +71,14 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcMetadataMetaplexTokenMetadataDecoder)]; - let materializers: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::MtAdminMaterializer), - std::sync::Arc::new(kb_lib::MtComplianceAuditMaterializer), - std::sync::Arc::new(kb_lib::MtLifecycleMaterializer), - std::sync::Arc::new(kb_lib::MtMetadataMetaplexTokenMetadataMaterializer), - std::sync::Arc::new(kb_lib::MtRiskMaterializer), + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcMetadataMetaplexTokenMetadataDecoder)]; + let materializers: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::MtAdminMaterializer), + std::sync::Arc::new(ks_lib::MtComplianceAuditMaterializer), + std::sync::Arc::new(ks_lib::MtLifecycleMaterializer), + std::sync::Arc::new(ks_lib::MtMetadataMetaplexTokenMetadataMaterializer), + std::sync::Arc::new(ks_lib::MtRiskMaterializer), ]; let mut create_request = match crate::DevnetMetaplexTokenMetadataExecutionRequest::from_operation_json( @@ -126,7 +126,7 @@ where if let std::result::Result::Err(error) = validate_expected_stateful_accounts(&fixture, &create.after, false) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_post_create_stateful_invalid", format!( "confirmed Metaplex Create {create_signature} at slot {create_slot} left invalid expected stateful accounts: {error}" @@ -143,7 +143,7 @@ where { std::result::Result::Ok(std::option::Option::Some(value)) => value, std::result::Result::Ok(std::option::Option::None) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_mint_missing_before_mint", format!( "classic SPL mint is unavailable after confirmed Metaplex Create {create_signature} at slot {create_slot}" @@ -159,7 +159,7 @@ where fixture.mint_decimals, 0, ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_post_create_spl_state_invalid", format!( "confirmed Metaplex Create {} at slot {} left an invalid classic mint state; expected mint/freeze authority {}; {error}", @@ -177,7 +177,7 @@ where { std::result::Result::Ok(std::option::Option::Some(value)) => value, std::result::Result::Ok(std::option::Option::None) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_token_missing_before_mint", format!( "classic SPL token account is unavailable after confirmed Metaplex Create {create_signature} at slot {create_slot}" @@ -193,7 +193,7 @@ where 0, spl_token_interface::state::AccountState::Initialized, ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_post_create_token_state_invalid", format!( "confirmed Metaplex Create {create_signature} at slot {create_slot} left an invalid classic token-account state: {error}" @@ -265,7 +265,7 @@ where if let std::result::Result::Err(error) = validate_expected_stateful_accounts(&fixture, &mint.after, true) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_post_mint_stateful_invalid", format!( "confirmed Metaplex Mint {mint_signature} at slot {mint_slot} left invalid expected stateful accounts: {error}" @@ -282,7 +282,7 @@ where { std::result::Result::Ok(std::option::Option::Some(value)) => value, std::result::Result::Ok(std::option::Option::None) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_mint_missing_after_mint", format!( "classic SPL mint is unavailable after confirmed Metaplex Mint {mint_signature} at slot {mint_slot}" @@ -297,7 +297,7 @@ where fixture.mint_decimals, fixture.mint_amount_raw, ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_post_mint_spl_state_invalid", format!( "confirmed Metaplex Mint {} at slot {} left an invalid classic mint state; expected mint/freeze authority {}; {error}", @@ -315,7 +315,7 @@ where { std::result::Result::Ok(std::option::Option::Some(value)) => value, std::result::Result::Ok(std::option::Option::None) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_token_missing_after_mint", format!( "classic SPL token account is unavailable after confirmed Metaplex Mint {mint_signature} at slot {mint_slot}" @@ -333,7 +333,7 @@ where fixture.mint_amount_raw, expected_token_account_state_after_mint, ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_post_mint_token_state_invalid", format!( "confirmed Metaplex Mint {mint_signature} at slot {mint_slot} left an invalid classic token-account state: {error}" @@ -393,35 +393,35 @@ fn postcondition_reads( query_role: &str, min_context_slot: std::option::Option, include_token_record: bool, -) -> std::vec::Vec { - let mint = kb_lib::MdPubkey(fixture.mint.clone()); - let mut reads = vec![kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { +) -> std::vec::Vec { + let mint = ks_lib::MdPubkey(fixture.mint.clone()); + let mut reads = vec![ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: query_role.to_string(), - account: kb_lib::MdPubkey(fixture.metadata.clone()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::Metadata, + account: ks_lib::MdPubkey(fixture.metadata.clone()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::Metadata, min_context_slot, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }]; if fixture.master_edition_requested { - reads.push(kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { + reads.push(ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: query_role.to_string(), - account: kb_lib::MdPubkey(fixture.master_edition.clone()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::Edition { mint: mint.clone() }, + account: ks_lib::MdPubkey(fixture.master_edition.clone()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::Edition { mint: mint.clone() }, min_context_slot, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }); } if include_token_record { if let std::option::Option::Some(token_record) = fixture.token_record.as_ref() { - reads.push(kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { + reads.push(ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: query_role.to_string(), - account: kb_lib::MdPubkey(token_record.clone()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::TokenRecord { + account: ks_lib::MdPubkey(token_record.clone()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::TokenRecord { mint, - token: kb_lib::MdPubkey(fixture.token_account.clone()), + token: ks_lib::MdPubkey(fixture.token_account.clone()), }, min_context_slot, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }); } } @@ -431,9 +431,9 @@ fn postcondition_reads( fn validate_confirmed_execution( step: &str, execution: &crate::DevnetMetaplexTokenMetadataExecutionSummary, -) -> kb_core::Result { +) -> ks_core::Result { if !execution.simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_simulation_failed", format!("Metaplex {step} simulation failed"), )); @@ -442,20 +442,20 @@ fn validate_confirmed_execution( std::option::Option::Some(value) if matches!( value.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) => { value }, std::option::Option::Some(value) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_confirmation_incomplete", format!("Metaplex {step} stopped at {:?}", value.status), )); }, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_confirmation_missing", format!("Metaplex {step} has no confirmation evidence"), )); @@ -464,7 +464,7 @@ fn validate_confirmed_execution( let diagnostic = match execution.post_execution.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_post_execution_missing", format!("Metaplex {step} has no post-execution diagnostic"), )); @@ -477,7 +477,7 @@ fn validate_confirmed_execution( || execution.materializations.is_empty() || execution.materialized_snapshots.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_post_execution_incomplete", format!( "Metaplex {step} post-execution incomplete: signature={}, slot={:?}, canonical_inserted={}, core_extracted={}, decode_replayed={}, materialized={}, materialization_rows={}, materialized_snapshots={}, diagnostics={:?}", @@ -496,7 +496,7 @@ fn validate_confirmed_execution( let second_replay = match execution.idempotence_replay.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_idempotence_missing", format!("Metaplex {step} has no idempotence replay evidence"), )); @@ -511,14 +511,14 @@ fn validate_confirmed_execution( || processor.materialization_refused != 0; }) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_idempotence_failed", format!("Metaplex {step} second replay is not idempotent"), )); } return match confirmation.slot { std::option::Option::Some(value) => std::result::Result::Ok(value), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_confirmation_slot_missing", format!("Metaplex {step} confirmation has no slot"), )), @@ -527,9 +527,9 @@ fn validate_confirmed_execution( fn validate_expected_stateful_accounts( fixture: &crate::MetaplexCreateFixturePreparationSummary, - snapshots: &[kb_pipeline::MetaplexTokenMetadataStatefulReadResult], + snapshots: &[ks_pipeline::MetaplexTokenMetadataStatefulReadResult], include_token_record: bool, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let metadata = snapshots.iter().any(|value| { return value.snapshot.account.0.as_str() == fixture.metadata.as_str() && value.snapshot.account_kind == "metadata" @@ -564,7 +564,7 @@ fn validate_expected_stateful_accounts( || (include_token_record && fixture.token_record.is_some() && !token_record) || (!include_token_record && token_record) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_create_mint_stateful_postcondition_failed", format!( "Metaplex stateful accounts mismatch: metadata={metadata}, edition={edition}, token_record={token_record}, master_edition_requested={}, token_record_expected={}", @@ -629,7 +629,7 @@ mod tests { .all(|value| return value.min_context_slot == std::option::Option::Some(7)) ); assert!(nft_create.iter().all(|value| { - return value.max_data_bytes == kb_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES; + return value.max_data_bytes == ks_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES; })); let pnft = fixture( crate::MetaplexTokenMetadataAssetFamily::ProgrammableNft, @@ -641,7 +641,7 @@ mod tests { assert_eq!(pnft_mint.len(), 3); assert!(matches!( &pnft_mint[2].kind, - kb_pipeline::MetaplexTokenMetadataAccountKind::TokenRecord { .. } + ks_pipeline::MetaplexTokenMetadataAccountKind::TokenRecord { .. } )); } @@ -815,7 +815,7 @@ mod tests { }, std::result::Result::Err(_) => workspace_root.join("config/example.config.json"), }; - let config = kb_config::read_config_json_file_with_environment( + let config = ks_config::read_config_json_file_with_environment( config_path.as_path(), workspace_root, ) @@ -827,16 +827,16 @@ mod tests { .unwrap_or_else(|error| panic!("KB_POSTGRES_TEST_URL is required: {error}")); profile.database.backend = "postgres".to_string(); profile.database.postgres.url = database_url; - let pool = kb_onchain_transport::HttpEndpointPool::from_profile(&profile) + let pool = ks_onchain_transport::HttpEndpointPool::from_profile(&profile) .unwrap_or_else(|error| panic!("HTTP pool creation failed: {error}")); - let store_options = kb_store::PostgresStoreOptions::new( + let store_options = ks_store::PostgresStoreOptions::new( profile.database.postgres.url.clone(), profile.database.postgres.max_connections, profile.database.postgres.connect_timeout_ms, false, ) .unwrap_or_else(|error| panic!("PostgreSQL options failed: {error}")); - let store = kb_store::PostgresStore::connect(store_options) + let store = ks_store::PostgresStore::connect(store_options) .await .unwrap_or_else(|error| panic!("PostgreSQL connection failed: {error}")); if let std::result::Result::Err(error) = store.initialize_store_schema().await { diff --git a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/devnet_execution.rs b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/devnet_execution.rs similarity index 83% rename from kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/devnet_execution.rs rename to ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/devnet_execution.rs index 38bc63d..ac4aca4 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/devnet_execution.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/devnet_execution.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/devnet_execution.rs -// version: 17 +// file: ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/devnet_execution.rs +// version: 18 //! Real Devnet simulation and submission for current Metaplex Token Metadata operations. @@ -13,13 +13,13 @@ pub struct DevnetMetaplexTokenMetadataExecutionRequest { /// Endpoint role used for simulation, submission and confirmation. pub transaction_role: std::string::String, /// Exact current Metaplex operation. - pub operation: kb_lib::ExMetaplexTokenMetadataOperation, + pub operation: ks_lib::ExMetaplexTokenMetadataOperation, /// Additional non-profile signers explicitly authorized for this exact operation. - pub additional_authorized_signers: std::vec::Vec, + pub additional_authorized_signers: std::vec::Vec, /// Bounded state reads required before execution. - pub preflight_reads: std::vec::Vec, + pub preflight_reads: std::vec::Vec, /// Bounded state reads repeated after confirmed submission. - pub postcondition_reads: std::vec::Vec, + pub postcondition_reads: std::vec::Vec, /// Explicitly authorizes signing and submission after successful simulation. pub submit: bool, /// Explicit operator confirmation required for submission. @@ -36,7 +36,7 @@ impl crate::DevnetMetaplexTokenMetadataExecutionRequest { /// Creates a conservative simulation-only request. pub fn new( intent_id: impl std::convert::Into, - operation: kb_lib::ExMetaplexTokenMetadataOperation, + operation: ks_lib::ExMetaplexTokenMetadataOperation, ) -> Self { return Self { intent_id: intent_id.into(), @@ -62,21 +62,21 @@ impl crate::DevnetMetaplexTokenMetadataExecutionRequest { pub fn from_operation_json( intent_id: impl std::convert::Into, operation_json: &str, - ) -> kb_core::Result { + ) -> ks_core::Result { if operation_json.contains("\"operation\":\"...\"") || operation_json.contains("\"operation\": \"...\"") || operation_json.trim() == "..." { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex operation JSON still contains the documentation placeholder `...`; use metaplex_token_metadata_current_operation_json_template or one of the named request constructors", )); } - let operation = match serde_json::from_str::( + let operation = match serde_json::from_str::( operation_json, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid typed Metaplex operation JSON: {error}" ))); }, @@ -89,26 +89,26 @@ impl crate::DevnetMetaplexTokenMetadataExecutionRequest { } /// Validates request-local bounds and rejects deprecated operations. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet Metaplex execution intent id must not be empty", )); } if self.query_role.trim().is_empty() || self.transaction_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet Metaplex execution endpoint roles must not be empty", )); } if self.additional_authorized_signers.len() > 4 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet Metaplex execution supports at most four additional authorized signers", )); } let mut unique_authorized_signers = std::collections::BTreeSet::new(); for signer in &self.additional_authorized_signers { if let std::result::Result::Err(error) = - kb_onchain_transport::validate_solana_pubkey_text( + ks_onchain_transport::validate_solana_pubkey_text( signer.0.as_str(), "Metaplex additional authorized signer", ) @@ -116,33 +116,33 @@ impl crate::DevnetMetaplexTokenMetadataExecutionRequest { return std::result::Result::Err(error); } if !unique_authorized_signers.insert(signer.0.as_str()) { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet Metaplex additional authorized signers must be unique", )); } } - if self.preflight_reads.len() > kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_PREFLIGHT_ACCOUNTS + if self.preflight_reads.len() > ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_PREFLIGHT_ACCOUNTS || self.postcondition_reads.len() - > kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_PREFLIGHT_ACCOUNTS + > ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_PREFLIGHT_ACCOUNTS { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet Metaplex execution stateful read limit exceeded", )); } if self.post_validation_max_retries > 20 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "post-execution getTransaction retries must not exceed 20", )); } if self.submit && self.materialize_after_confirmation && self.postcondition_reads.is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex materialization requires at least one postcondition account read", )); } let operation_code = self.operation.operation_code(); - if kb_lib::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_OPERATION_CODES.contains(&operation_code) { - return std::result::Result::Err(kb_core::Error::new( + if ks_lib::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_OPERATION_CODES.contains(&operation_code) { + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_devnet_deprecated_operation_forbidden", "automatic Devnet campaigns do not execute deprecated Metaplex operations", )); @@ -182,7 +182,7 @@ pub fn metaplex_token_metadata_current_operation_names() -> &'static [&'static s /// Placeholders beginning with `<` must be replaced before parsing or execution. pub fn metaplex_token_metadata_current_operation_json_template( operation: &str, -) -> kb_core::Result { +) -> ks_core::Result { let value = match operation { "create" => serde_json::json!({ "operation": "create", @@ -256,7 +256,7 @@ pub fn metaplex_token_metadata_current_operation_json_template( "verification_args": "CreatorV1" }), _ => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "no named JSON template for `{operation}`; current operations: {}", metaplex_token_metadata_current_operation_names().join(", ") ))); @@ -264,7 +264,7 @@ pub fn metaplex_token_metadata_current_operation_json_template( }; return match serde_json::to_string_pretty(&value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::json(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::json(format!( "unable to serialize Metaplex operation template: {error}" ))), }; @@ -273,12 +273,12 @@ pub fn metaplex_token_metadata_current_operation_json_template( /// Creates one named creator verification request without handwritten operation JSON. pub fn devnet_metaplex_creator_verify_request( intent_id: impl std::convert::Into, - authority: kb_lib::MdPubkey, - metadata: kb_lib::MdPubkey, + authority: ks_lib::MdPubkey, + metadata: ks_lib::MdPubkey, ) -> crate::DevnetMetaplexTokenMetadataExecutionRequest { return crate::DevnetMetaplexTokenMetadataExecutionRequest::new( intent_id, - kb_lib::ExMetaplexTokenMetadataOperation::Verify { + ks_lib::ExMetaplexTokenMetadataOperation::Verify { authority, delegate_record: std::option::Option::None, metadata, @@ -293,12 +293,12 @@ pub fn devnet_metaplex_creator_verify_request( /// Creates one named creator unverification request without handwritten operation JSON. pub fn devnet_metaplex_creator_unverify_request( intent_id: impl std::convert::Into, - authority: kb_lib::MdPubkey, - metadata: kb_lib::MdPubkey, + authority: ks_lib::MdPubkey, + metadata: ks_lib::MdPubkey, ) -> crate::DevnetMetaplexTokenMetadataExecutionRequest { return crate::DevnetMetaplexTokenMetadataExecutionRequest::new( intent_id, - kb_lib::ExMetaplexTokenMetadataOperation::Unverify { + ks_lib::ExMetaplexTokenMetadataOperation::Unverify { authority, delegate_record: std::option::Option::None, metadata, @@ -315,73 +315,73 @@ pub struct DevnetMetaplexTokenMetadataExecutionSummary { /// Profile used by the orchestration. pub profile_name: std::string::String, /// Exact classified cluster. - pub cluster: kb_lib::ExApiExecutionCluster, + pub cluster: ks_lib::ExApiExecutionCluster, /// Genesis hash returned by the selected endpoint. pub genesis_hash: std::string::String, /// Non-secret persistent wallet description. - pub wallet: kb_wallet::WalletSummary, + pub wallet: ks_wallet::WalletSummary, /// Wallet balance observed before planning. pub balance_lamports: u64, /// Stateful snapshots observed before simulation. - pub before: std::vec::Vec, + pub before: std::vec::Vec, /// Stateful preflight report bound to the exact plan. - pub stateful_preflight: kb_pipeline::MetaplexTokenMetadataPreflightReport, + pub stateful_preflight: ks_pipeline::MetaplexTokenMetadataPreflightReport, /// Exact prepared Metaplex plan. - pub plan: kb_lib::ExApiPreparedExecutionPlan, + pub plan: ks_lib::ExApiPreparedExecutionPlan, /// Recent blockhash used by the exact transaction. - pub latest_blockhash: kb_onchain_transport::LatestBlockhashResult, + pub latest_blockhash: ks_onchain_transport::LatestBlockhashResult, /// Fee estimate for the exact compiled message. - pub fee: kb_onchain_transport::FeeForMessageResult, + pub fee: ks_onchain_transport::FeeForMessageResult, /// Exact real RPC simulation result. - pub simulation: kb_lib::ExApiExecutionSimulationResult, + pub simulation: ks_lib::ExApiExecutionSimulationResult, /// RPC context slot returned by the exact simulation call. pub simulation_context_slot: u64, /// Readiness report proving exact-message simulation and signer resolution. - pub readiness: kb_pipeline::MetaplexTokenMetadataExecutionReadinessReport, + pub readiness: ks_pipeline::MetaplexTokenMetadataExecutionReadinessReport, /// Submission result when explicitly authorized. - pub send_result: std::option::Option, + pub send_result: std::option::Option, /// Confirmation result when submitted. - pub confirmation: std::option::Option, + pub confirmation: std::option::Option, /// Stateful snapshots observed after confirmed submission. - pub after: std::vec::Vec, + pub after: std::vec::Vec, /// Whether canonical account materialization was requested. pub materialization_requested: bool, /// Canonical projections emitted from confirmed account snapshots. pub materialized_snapshots: std::vec::Vec, /// Canonical hydration result for the exact submitted signature. - pub backfill: std::option::Option, + pub backfill: std::option::Option, /// Core extraction result for the exact submitted signature. - pub core_extraction: std::option::Option, + pub core_extraction: std::option::Option, /// First Metaplex decode and materialization replay. - pub decode_replay: std::option::Option, + pub decode_replay: std::option::Option, /// Second replay proving idempotence for the exact same input. - pub idempotence_replay: std::option::Option, + pub idempotence_replay: std::option::Option, /// Exact materialized rows produced for the submitted Metaplex transaction. - pub materializations: std::vec::Vec, + pub materializations: std::vec::Vec, /// Aggregated canonical post-execution diagnostic. - pub post_execution: std::option::Option, + pub post_execution: std::option::Option, } struct PreparedMetaplexExecution { - wallet: kb_wallet::TemporaryWallet, - unsigned: kb_lib::ExSolanaUnsignedTransaction, - evidence: kb_lib::ExSolanaSimulationEvidence, + wallet: ks_wallet::TemporaryWallet, + unsigned: ks_lib::ExSolanaUnsignedTransaction, + evidence: ks_lib::ExSolanaSimulationEvidence, summary: crate::DevnetMetaplexTokenMetadataExecutionSummary, } /// Simulates one current Metaplex operation against a real Devnet endpoint. pub async fn simulate_devnet_metaplex_token_metadata( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetMetaplexTokenMetadataExecutionRequest, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where O: crate::SolanaExecutionObserver, { if request.submit { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "simulate_devnet_metaplex_token_metadata requires submit=false", )); } @@ -396,19 +396,19 @@ where /// Executes one real Devnet Metaplex simulation or explicitly authorized submission. #[allow(clippy::too_many_arguments)] pub async fn execute_devnet_metaplex_token_metadata( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetMetaplexTokenMetadataExecutionRequest, - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { @@ -429,20 +429,20 @@ where /// Executes one real Devnet Metaplex submission with explicitly authorized extra signers. #[allow(clippy::too_many_arguments)] pub async fn execute_devnet_metaplex_token_metadata_with_signers( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetMetaplexTokenMetadataExecutionRequest, - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], additional_signers: &[&(dyn solana_signer::Signer + std::marker::Sync)], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { @@ -463,19 +463,19 @@ where return std::result::Result::Ok(prepared.summary); } if !prepared.summary.simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_simulation_failed", crate::simulation_failure_message(&prepared.summary.simulation), )); } - let send_evaluation = match kb_lib::ExSafetyChecker + let send_evaluation = match ks_lib::ExSafetyChecker .evaluate_send(&prepared.summary.plan, &prepared.summary.simulation) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if send_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if send_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "execution_send_denied", crate::violation_message(send_evaluation.violations.as_slice()), )); @@ -494,7 +494,7 @@ where } let signature = signed.primary_signature().clone(); let mut summary = prepared.summary; - let mut diagnostic = kb_lib::ExApiPostExecutionDiagnostic { + let mut diagnostic = ks_lib::ExApiPostExecutionDiagnostic { signature: signature.clone(), canonical_inserted: false, core_extracted: false, @@ -502,7 +502,7 @@ where materialized: false, diagnostics: std::vec::Vec::new(), }; - let send_config = match kb_onchain_transport::SendTransactionConfig::from_execution_config( + let send_config = match ks_onchain_transport::SendTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(summary.latest_blockhash.context.slot), ) { @@ -526,9 +526,9 @@ where }, }; summary.send_result = - std::option::Option::Some(sent.to_execution_result(kb_lib::ExApiExecutionCluster::Devnet)); + std::option::Option::Some(sent.to_execution_result(ks_lib::ExApiExecutionCluster::Devnet)); let confirmation_config = - match kb_onchain_transport::ConfirmTransactionConfig::from_execution_config( + match ks_onchain_transport::ConfirmTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(summary.latest_blockhash.last_valid_block_height), std::option::Option::Some(summary.latest_blockhash.context.slot), @@ -540,7 +540,7 @@ where .confirm_transaction_for_roles( request.transaction_role.as_str(), request.query_role.as_str(), - kb_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionCluster::Devnet, &signature, &confirmation_config, ) @@ -557,8 +557,8 @@ where summary.confirmation = std::option::Option::Some(confirmation); if !matches!( confirmation_status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) { diagnostic.diagnostics.push(format!( "Metaplex post-validation stopped at confirmation status {confirmation_status:?}" @@ -610,10 +610,10 @@ where summary.post_execution = std::option::Option::Some(diagnostic); return std::result::Result::Ok(summary); } - let extraction = match kb_pipeline::execute_core_extraction( + let extraction = match ks_pipeline::execute_core_extraction( store, - &kb_pipeline::CoreExtractionRequest { - source: kb_pipeline::CoreExtractionSource::Signatures(std::vec![signature.0.clone()]), + &ks_pipeline::CoreExtractionRequest { + source: ks_pipeline::CoreExtractionSource::Signatures(std::vec![signature.0.clone()]), limit: 1, max_concurrent_extractions: 1, force_replay: request.force_post_validation_replay, @@ -646,7 +646,7 @@ where &signature, false, request.force_post_validation_replay, - &[kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID], + &[ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID], decoders, materializers, observer, @@ -667,7 +667,7 @@ where .push(replay_summary_diagnostic("first Metaplex replay", &first_replay)); } summary.decode_replay = std::option::Option::Some(first_replay); - let filter = match kb_store::MaterializedEventFilter::new( + let filter = match ks_store::MaterializedEventFilter::new( std::option::Option::None, std::option::Option::None, std::option::Option::Some(signature.0.clone()), @@ -676,7 +676,7 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let rows = match kb_store::DecodePipelineStore::list_materialized_events(store, &filter).await { + let rows = match ks_store::DecodePipelineStore::list_materialized_events(store, &filter).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { diagnostic @@ -687,8 +687,8 @@ where }, }; summary.materializations = metaplex_instruction_materializations(rows); - let metaplex_materializer_name = kb_lib::MtApiEventMaterializer::identity( - &kb_lib::MtMetadataMetaplexTokenMetadataMaterializer, + let metaplex_materializer_name = ks_lib::MtApiEventMaterializer::identity( + &ks_lib::MtMetadataMetaplexTokenMetadataMaterializer, ) .name; diagnostic.materialized = @@ -707,7 +707,7 @@ where &signature, true, request.force_post_validation_replay, - &[kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID], + &[ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID], decoders, materializers, observer, @@ -751,11 +751,11 @@ where } fn sign_prepared_transaction( - unsigned: kb_lib::ExSolanaUnsignedTransaction, - evidence: &kb_lib::ExSolanaSimulationEvidence, + unsigned: ks_lib::ExSolanaUnsignedTransaction, + evidence: &ks_lib::ExSolanaSimulationEvidence, wallet: &(dyn solana_signer::Signer + std::marker::Sync), additional_signers: &[&(dyn solana_signer::Signer + std::marker::Sync)], -) -> kb_core::Result { +) -> ks_core::Result { let mut signers: std::vec::Vec<&dyn solana_signer::Signer> = std::vec![wallet]; for signer in additional_signers { let signer: &dyn solana_signer::Signer = *signer; @@ -766,7 +766,7 @@ fn sign_prepared_transaction( fn replay_summary_diagnostic( label: &str, - summary: &kb_pipeline::DecodeReplaySummary, + summary: &ks_pipeline::DecodeReplaySummary, ) -> std::string::String { let processors = summary .processors @@ -803,13 +803,13 @@ fn replay_summary_diagnostic( } async fn prepare_execution( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetMetaplexTokenMetadataExecutionRequest, additional_signers: &[&(dyn solana_signer::Signer + std::marker::Sync)], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where O: crate::SolanaExecutionObserver, { @@ -829,9 +829,9 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if genesis.classified_cluster - != std::option::Option::Some(kb_lib::ExApiExecutionCluster::Devnet) + != std::option::Option::Some(ks_lib::ExApiExecutionCluster::Devnet) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_cluster_mismatch", format!( "expected Devnet genesis hash but endpoint returned {} classified as {:?}", @@ -844,12 +844,12 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let wallet_summary = wallet.summary(); - let fee_payer = kb_lib::MdPubkey(wallet_summary.public_key.clone()); + let fee_payer = ks_lib::MdPubkey(wallet_summary.public_key.clone()); let balance = match http_pool .get_balance_for_role( request.query_role.as_str(), &fee_payer, - &kb_onchain_transport::GetBalanceConfig::confirmed(), + &ks_onchain_transport::GetBalanceConfig::confirmed(), ) .await { @@ -857,7 +857,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if balance.lamports < profile.execution.max_fee_lamports { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_balance_insufficient", "Devnet wallet balance is below the configured fee ceiling", )); @@ -870,8 +870,8 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let stateful_preflight = match kb_pipeline::inspect_metaplex_token_metadata_preflight( - &kb_pipeline::MetaplexTokenMetadataPreflightRequest { + let stateful_preflight = match ks_pipeline::inspect_metaplex_token_metadata_preflight( + &ks_pipeline::MetaplexTokenMetadataPreflightRequest { plan: plan.clone(), snapshots: before.clone(), allow_deprecated_operation: false, @@ -880,12 +880,12 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let plan_evaluation = match kb_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { + let plan_evaluation = match ks_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if plan_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if plan_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "execution_plan_denied", crate::violation_message(plan_evaluation.violations.as_slice()), )); @@ -893,14 +893,14 @@ where let latest_blockhash = match http_pool .get_latest_blockhash_for_role( request.query_role.as_str(), - &kb_onchain_transport::GetLatestBlockhashConfig::confirmed(), + &ks_onchain_transport::GetLatestBlockhashConfig::confirmed(), ) .await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let unsigned = match kb_lib::executor_solana_build_legacy_transaction( + let unsigned = match ks_lib::executor_solana_build_legacy_transaction( &plan, latest_blockhash.blockhash.as_str(), ) { @@ -920,8 +920,8 @@ where .get_fee_for_message_for_role( request.query_role.as_str(), unsigned.message_base64().as_str(), - &kb_onchain_transport::GetFeeForMessageConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + &ks_onchain_transport::GetFeeForMessageConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, std::option::Option::Some(latest_blockhash.context.slot), ), ) @@ -934,8 +934,8 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let simulation_config = match kb_onchain_transport::SimulateTransactionConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let simulation_config = match ks_onchain_transport::SimulateTransactionConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, false, false, std::option::Option::Some(latest_blockhash.context.slot), @@ -964,8 +964,8 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let simulation = simulation_rpc.to_execution_result( - kb_lib::ExApiExecutionCluster::Devnet, - kb_lib::ExApiExecutionBlockhashKind::Latest, + ks_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionBlockhashKind::Latest, std::option::Option::Some( simulation_rpc.context.slot.saturating_sub(latest_blockhash.context.slot), ), @@ -973,8 +973,8 @@ where std::option::Option::None, std::option::Option::Some(&fee), ); - let readiness = match kb_pipeline::validate_metaplex_token_metadata_execution_readiness( - &kb_pipeline::MetaplexTokenMetadataExecutionReadinessRequest { + let readiness = match ks_pipeline::validate_metaplex_token_metadata_execution_readiness( + &ks_pipeline::MetaplexTokenMetadataExecutionReadinessRequest { plan: plan.clone(), preflight: stateful_preflight.clone(), message_hash: unsigned.message_hash().to_string(), @@ -992,7 +992,7 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(_) => "".to_string(), }; - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( error.code(), format!("{}; simulation={simulation_json}", error.message()), )); @@ -1005,7 +1005,7 @@ where evidence, summary: crate::DevnetMetaplexTokenMetadataExecutionSummary { profile_name: profile.name.clone(), - cluster: kb_lib::ExApiExecutionCluster::Devnet, + cluster: ks_lib::ExApiExecutionCluster::Devnet, genesis_hash: genesis.genesis_hash, wallet: wallet_summary, balance_lamports: balance.lamports, @@ -1033,10 +1033,10 @@ where } fn metaplex_instruction_materializations( - rows: std::vec::Vec, -) -> std::vec::Vec { - let materializer_name = kb_lib::MtApiEventMaterializer::identity( - &kb_lib::MtMetadataMetaplexTokenMetadataMaterializer, + rows: std::vec::Vec, +) -> std::vec::Vec { + let materializer_name = ks_lib::MtApiEventMaterializer::identity( + &ks_lib::MtMetadataMetaplexTokenMetadataMaterializer, ) .name; return rows @@ -1046,7 +1046,7 @@ fn metaplex_instruction_materializations( } fn materialize_confirmed_snapshots( - snapshots: &[kb_pipeline::MetaplexTokenMetadataStatefulReadResult], + snapshots: &[ks_pipeline::MetaplexTokenMetadataStatefulReadResult], ) -> std::vec::Vec { return snapshots .iter() @@ -1068,9 +1068,9 @@ fn materialize_confirmed_snapshots( } fn bind_postcondition_min_context_slot( - requests: &[kb_pipeline::MetaplexTokenMetadataStatefulReadRequest], + requests: &[ks_pipeline::MetaplexTokenMetadataStatefulReadRequest], confirmation_slot: std::option::Option, -) -> std::vec::Vec { +) -> std::vec::Vec { return requests .iter() .cloned() @@ -1090,13 +1090,13 @@ fn bind_postcondition_min_context_slot( } async fn read_snapshots( - http_pool: &kb_onchain_transport::HttpEndpointPool, - requests: &[kb_pipeline::MetaplexTokenMetadataStatefulReadRequest], -) -> kb_core::Result> { + http_pool: &ks_onchain_transport::HttpEndpointPool, + requests: &[ks_pipeline::MetaplexTokenMetadataStatefulReadRequest], +) -> ks_core::Result> { let mut results = std::vec::Vec::with_capacity(requests.len()); for request in requests { let value = - match kb_pipeline::read_metaplex_token_metadata_stateful_snapshot(http_pool, request) + match ks_pipeline::read_metaplex_token_metadata_stateful_snapshot(http_pool, request) .await { std::result::Result::Ok(value) => value, @@ -1108,30 +1108,30 @@ async fn read_snapshots( } fn build_plan( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, request: &crate::DevnetMetaplexTokenMetadataExecutionRequest, - fee_payer: kb_lib::MdPubkey, -) -> kb_core::Result { - let intent = kb_lib::ExMetaplexTokenMetadataExecutionIntent { + fee_payer: ks_lib::MdPubkey, +) -> ks_core::Result { + let intent = ks_lib::ExMetaplexTokenMetadataExecutionIntent { intent_id: request.intent_id.clone(), fee_payer: fee_payer.clone(), max_rent_lamports: profile.execution.devnet_max_spend_lamports, - policy: kb_lib::ExApiExecutionPolicy { - cluster: kb_lib::ExApiExecutionClusterPolicy { - expected_cluster: kb_lib::ExApiExecutionCluster::Devnet, + policy: ks_lib::ExApiExecutionPolicy { + cluster: ks_lib::ExApiExecutionClusterPolicy { + expected_cluster: ks_lib::ExApiExecutionCluster::Devnet, allow_mainnet: false, mainnet_confirmation: false, }, - simulation: kb_lib::ExApiExecutionSimulationPolicy::Required, - blockhash: kb_lib::ExApiExecutionBlockhashPolicy { - kind: kb_lib::ExApiExecutionBlockhashKind::Latest, + simulation: ks_lib::ExApiExecutionSimulationPolicy::Required, + blockhash: ks_lib::ExApiExecutionBlockhashPolicy { + kind: ks_lib::ExApiExecutionBlockhashKind::Latest, max_age_slots: std::option::Option::Some( profile.execution.recent_blockhash_max_age_slots, ), nonce_account: std::option::Option::None, nonce_authority: std::option::Option::None, }, - cost_limit: kb_lib::ExApiExecutionCostLimit { + cost_limit: ks_lib::ExApiExecutionCostLimit { max_spend_lamports: std::option::Option::Some( profile.execution.devnet_max_spend_lamports, ), @@ -1150,7 +1150,7 @@ fn build_plan( authorized_signers }, dry_run: !request.submit, - post_execution_validation: kb_lib::ExApiPostExecutionValidationPolicy { + post_execution_validation: ks_lib::ExApiPostExecutionValidationPolicy { canonical_insert_required: request.submit, core_extraction_required: request.submit, decode_replay_required: request.submit, @@ -1160,33 +1160,33 @@ fn build_plan( allow_deprecated_operation: false, operation: request.operation.clone(), }; - return kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan( - &kb_lib::ExMetadataMetaplexTokenMetadataExecutor, + return ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan( + &ks_lib::ExMetadataMetaplexTokenMetadataExecutor, &intent, ); } fn validate_profile( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, request: &crate::DevnetMetaplexTokenMetadataExecutionRequest, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if profile.wallet.cluster != "devnet" { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex Devnet orchestration requires a Devnet wallet profile", )); } if !profile.wallet.temporary_wallet_enabled || !profile.wallet.temporary_wallet_persist { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex Devnet orchestration requires an enabled persistent temporary wallet", )); } if !profile.execution.require_simulation { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex Devnet orchestration requires simulation", )); } if request.submit && !profile.wallet.devnet_send_enabled { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet transaction submission is disabled by the wallet profile", )); } @@ -1194,7 +1194,7 @@ fn validate_profile( && profile.execution.require_operator_confirmation && !request.operator_confirmed { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex Devnet submission requires explicit operator confirmation", )); } @@ -1204,19 +1204,19 @@ fn validate_profile( fn validate_available_signers( required_signers: &[std::string::String], wallet_pubkey: &str, - authorized_additional_signers: &[kb_lib::MdPubkey], + authorized_additional_signers: &[ks_lib::MdPubkey], additional_signers: &[&(dyn solana_signer::Signer + std::marker::Sync)], -) -> kb_core::Result> { +) -> ks_core::Result> { let authorized = authorized_additional_signers .iter() .map(|value| return value.0.as_str()) .collect::>(); let mut available = std::collections::BTreeSet::from([wallet_pubkey.to_string()]); - let mut resolved = std::vec![kb_lib::MdPubkey(wallet_pubkey.to_string())]; + let mut resolved = std::vec![ks_lib::MdPubkey(wallet_pubkey.to_string())]; for signer in additional_signers { let pubkey = signer.pubkey().to_string(); if !authorized.contains(pubkey.as_str()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_undeclared_signer", format!( "Metaplex signer {pubkey} was supplied without explicit request authorization" @@ -1224,12 +1224,12 @@ fn validate_available_signers( )); } if !available.insert(pubkey.clone()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_duplicate_signer", format!("Metaplex signer {pubkey} was supplied more than once"), )); } - resolved.push(kb_lib::MdPubkey(pubkey)); + resolved.push(ks_lib::MdPubkey(pubkey)); } let missing_authorized = authorized_additional_signers .iter() @@ -1237,7 +1237,7 @@ fn validate_available_signers( .map(|value| return value.0.clone()) .collect::>(); if !missing_authorized.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_authorized_signer_unavailable", format!( "explicitly authorized Metaplex signers were not supplied: {}", @@ -1251,7 +1251,7 @@ fn validate_available_signers( .cloned() .collect::>(); if !missing.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metaplex_external_signer_unavailable", format!( "the Devnet Metaplex orchestrator is missing required signers {}; available signers are {}", @@ -1265,8 +1265,8 @@ fn validate_available_signers( #[cfg(test)] mod tests { - fn example_devnet_profile() -> kb_config::ProfileConfig { - let config = match kb_config::parse_config_json(include_str!( + fn example_devnet_profile() -> ks_config::ProfileConfig { + let config = match ks_config::parse_config_json(include_str!( "../../../../config/example.config.json" )) { std::result::Result::Ok(value) => value, @@ -1280,13 +1280,13 @@ mod tests { fn optional_stateful_reads_from_env( variable: &str, - ) -> std::vec::Vec { + ) -> std::vec::Vec { let value = match std::env::var(variable) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => return std::vec::Vec::new(), }; return match serde_json::from_str::< - std::vec::Vec, + std::vec::Vec, >(value.as_str()) { std::result::Result::Ok(value) => value, @@ -1299,8 +1299,8 @@ mod tests { fn request_rejects_deprecated_operations_and_empty_ids() { let deprecated = crate::DevnetMetaplexTokenMetadataExecutionRequest::new( "deprecated", - kb_lib::ExMetaplexTokenMetadataOperation::PuffMetadata { - metadata: kb_lib::MdPubkey("11111111111111111111111111111111".to_string()), + ks_lib::ExMetaplexTokenMetadataOperation::PuffMetadata { + metadata: ks_lib::MdPubkey("11111111111111111111111111111111".to_string()), }, ); assert!(deprecated.validate().is_err()); @@ -1309,9 +1309,9 @@ mod tests { assert!(empty.validate().is_err()); let mut excessive_retries = crate::DevnetMetaplexTokenMetadataExecutionRequest::new( "excessive-retries", - kb_lib::ExMetaplexTokenMetadataOperation::Collect { - authority: kb_lib::MdPubkey("11111111111111111111111111111111".to_string()), - recipient: kb_lib::MdPubkey( + ks_lib::ExMetaplexTokenMetadataOperation::Collect { + authority: ks_lib::MdPubkey("11111111111111111111111111111111".to_string()), + recipient: ks_lib::MdPubkey( "SysvarC1ock11111111111111111111111111111111".to_string(), ), }, @@ -1376,15 +1376,15 @@ mod tests { r#"{"operation":"..."}"#, ); assert_eq!( - placeholder.as_ref().err().map(kb_core::Error::code), + placeholder.as_ref().err().map(ks_core::Error::code), std::option::Option::Some("config"), ); } #[test] fn named_creator_requests_are_conservative_and_current() { - let authority = kb_lib::MdPubkey("11111111111111111111111111111111".to_string()); - let metadata = kb_lib::MdPubkey("SysvarC1ock11111111111111111111111111111111".to_string()); + let authority = ks_lib::MdPubkey("11111111111111111111111111111111".to_string()); + let metadata = ks_lib::MdPubkey("SysvarC1ock11111111111111111111111111111111".to_string()); let verify = super::devnet_metaplex_creator_verify_request( "verify-creator", authority.clone(), @@ -1418,7 +1418,7 @@ mod tests { if let std::result::Result::Ok(directory) = std::env::var("KB_DEVNET_WALLET_DIR") { profile.wallet.wallet_dir = directory; } - let pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("HTTP pool creation failed: {error}"), }; @@ -1428,12 +1428,12 @@ mod tests { panic!("KB_POSTGRES_TEST_URL is required for Metaplex execution: {error}") }, }; - let store_options = match kb_store::PostgresStoreOptions::new(database_url, 5, 5_000, false) + let store_options = match ks_store::PostgresStoreOptions::new(database_url, 5, 5_000, false) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("Postgres options failed: {error}"), }; - let store = match kb_store::PostgresStore::connect(store_options).await { + let store = match ks_store::PostgresStore::connect(store_options).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("Postgres connection failed: {error}"), }; @@ -1469,14 +1469,14 @@ mod tests { .as_deref() == std::option::Option::Some("1"); request.post_validation_max_retries = 20; - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcMetadataMetaplexTokenMetadataDecoder)]; - let materializers: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::MtAdminMaterializer), - std::sync::Arc::new(kb_lib::MtComplianceAuditMaterializer), - std::sync::Arc::new(kb_lib::MtLifecycleMaterializer), - std::sync::Arc::new(kb_lib::MtMetadataMetaplexTokenMetadataMaterializer), - std::sync::Arc::new(kb_lib::MtRiskMaterializer), + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcMetadataMetaplexTokenMetadataDecoder)]; + let materializers: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::MtAdminMaterializer), + std::sync::Arc::new(ks_lib::MtComplianceAuditMaterializer), + std::sync::Arc::new(ks_lib::MtLifecycleMaterializer), + std::sync::Arc::new(ks_lib::MtMetadataMetaplexTokenMetadataMaterializer), + std::sync::Arc::new(ks_lib::MtRiskMaterializer), ]; let summary = match crate::execute_devnet_metaplex_token_metadata( &pool, @@ -1512,10 +1512,10 @@ mod tests { #[test] fn postcondition_reads_are_bound_to_the_confirmation_slot() { - let request = kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { + let request = ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: "rpc".to_string(), - account: kb_lib::MdPubkey("11111111111111111111111111111111".to_string()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::Metadata, + account: ks_lib::MdPubkey("11111111111111111111111111111111".to_string()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::Metadata, min_context_slot: std::option::Option::Some(7), max_data_bytes: 128, }; @@ -1533,8 +1533,8 @@ mod tests { #[test] fn materialization_evidence_is_owned_by_the_metaplex_materializer() { - fn row(processor_name: &str) -> kb_store::MaterializedEventQueryRow { - return kb_store::MaterializedEventQueryRow { + fn row(processor_name: &str) -> ks_store::MaterializedEventQueryRow { + return ks_store::MaterializedEventQueryRow { processor_name: processor_name.to_string(), processor_version: "0.4.8-pre.13".to_string(), input_key: "input".to_string(), @@ -1550,8 +1550,8 @@ mod tests { updated_at: "updated".to_string(), }; } - let metaplex_name = kb_lib::MtApiEventMaterializer::identity( - &kb_lib::MtMetadataMetaplexTokenMetadataMaterializer, + let metaplex_name = ks_lib::MtApiEventMaterializer::identity( + &ks_lib::MtMetadataMetaplexTokenMetadataMaterializer, ) .name; let rows = super::metaplex_instruction_materializations(vec![ @@ -1578,7 +1578,7 @@ mod tests { ) .is_err() ); - let authorized = vec![kb_lib::MdPubkey(external_pubkey.clone())]; + let authorized = vec![ks_lib::MdPubkey(external_pubkey.clone())]; let resolved = match super::validate_available_signers( &["wallet".to_string(), external_pubkey.clone()], "wallet", diff --git a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/escrow_campaign.rs b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/escrow_campaign.rs similarity index 83% rename from kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/escrow_campaign.rs rename to ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/escrow_campaign.rs index a1814b4..f76f01f 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/escrow_campaign.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/escrow_campaign.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/escrow_campaign.rs -// version: 1 +// file: ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/escrow_campaign.rs +// version: 2 //! Confirmed Devnet Token Owned Escrow campaign for current Metaplex escrow operations. @@ -57,22 +57,22 @@ pub fn metaplex_escrow_campaign_operation_names() -> &'static [&'static str; 3] /// Executes a fresh Token Owned Escrow lifecycle on Devnet. #[allow(clippy::too_many_arguments)] pub async fn execute_devnet_metaplex_escrow_campaign( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::MetaplexCreateFixturePreparationOptions, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { if !profile.wallet.devnet_send_enabled { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex escrow Devnet campaign requires devnet_send_enabled=true", )); } @@ -115,25 +115,25 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let metaplex_decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcMetadataMetaplexTokenMetadataDecoder)]; - let metaplex_materializers: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::MtAdminMaterializer), - std::sync::Arc::new(kb_lib::MtComplianceAuditMaterializer), - std::sync::Arc::new(kb_lib::MtLifecycleMaterializer), - std::sync::Arc::new(kb_lib::MtMetadataMetaplexTokenMetadataMaterializer), - std::sync::Arc::new(kb_lib::MtRiskMaterializer), + let metaplex_decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcMetadataMetaplexTokenMetadataDecoder)]; + let metaplex_materializers: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::MtAdminMaterializer), + std::sync::Arc::new(ks_lib::MtComplianceAuditMaterializer), + std::sync::Arc::new(ks_lib::MtLifecycleMaterializer), + std::sync::Arc::new(ks_lib::MtMetadataMetaplexTokenMetadataMaterializer), + std::sync::Arc::new(ks_lib::MtRiskMaterializer), ]; - let create_operation = kb_lib::ExMetaplexTokenMetadataOperation::CreateEscrowAccount { - escrow: kb_lib::MdPubkey(escrow.clone()), - metadata: kb_lib::MdPubkey(parent_fixture.fixture.metadata.clone()), - mint: kb_lib::MdPubkey(parent_fixture.fixture.mint.clone()), - token_account: kb_lib::MdPubkey(parent_fixture.fixture.token_account.clone()), - edition: kb_lib::MdPubkey(parent_fixture.fixture.master_edition.clone()), - payer: kb_lib::MdPubkey(parent_fixture.fixture.authority.clone()), - system_program: kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), - sysvar_instructions: kb_lib::MdPubkey( - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID.to_string(), + let create_operation = ks_lib::ExMetaplexTokenMetadataOperation::CreateEscrowAccount { + escrow: ks_lib::MdPubkey(escrow.clone()), + metadata: ks_lib::MdPubkey(parent_fixture.fixture.metadata.clone()), + mint: ks_lib::MdPubkey(parent_fixture.fixture.mint.clone()), + token_account: ks_lib::MdPubkey(parent_fixture.fixture.token_account.clone()), + edition: ks_lib::MdPubkey(parent_fixture.fixture.master_edition.clone()), + payer: ks_lib::MdPubkey(parent_fixture.fixture.authority.clone()), + system_program: ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), + sysvar_instructions: ks_lib::MdPubkey( + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID.to_string(), ), authority: std::option::Option::None, }; @@ -174,20 +174,20 @@ where ) { return std::result::Result::Err(error); } - let ata_decoders: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::DcSplAssociatedTokenAccountDecoder), - std::sync::Arc::new(kb_lib::DcSplTokenDecoder), + let ata_decoders: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::DcSplAssociatedTokenAccountDecoder), + std::sync::Arc::new(ks_lib::DcSplTokenDecoder), ]; - let ata_materializers: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::MtTokenAccountsMaterializer), - std::sync::Arc::new(kb_lib::MtRiskMaterializer), + let ata_materializers: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::MtTokenAccountsMaterializer), + std::sync::Arc::new(ks_lib::MtRiskMaterializer), ]; let mut ata_request = crate::DevnetSplAssociatedTokenAccountExecutionRequest::new( format!("metaplex-escrow-attribute-ata-{}", uuid::Uuid::new_v4()), - kb_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { - wallet_owner: kb_lib::MdPubkey(escrow.clone()), - mint: kb_lib::MdPubkey(attribute_fixture.fixture.mint.clone()), - token_program: kb_lib::ExSplAssociatedTokenProgram::Classic, + ks_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { + wallet_owner: ks_lib::MdPubkey(escrow.clone()), + mint: ks_lib::MdPubkey(attribute_fixture.fixture.mint.clone()), + token_program: ks_lib::ExSplAssociatedTokenProgram::Classic, }, ); ata_request.query_role = parent_options.query_role.clone(); @@ -224,7 +224,7 @@ where { std::result::Result::Ok(std::option::Option::Some(value)) => value, std::result::Result::Ok(std::option::Option::None) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_attribute_ata_missing", "escrow attribute ATA is missing after confirmed ATA creation", )); @@ -238,27 +238,27 @@ where 0, spl_token_interface::state::AccountState::Initialized, ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_attribute_ata_invalid", format!("fresh escrow attribute ATA is invalid: {error}"), )); } const DEPOSIT_AMOUNT_RAW: u64 = 1; let operator_attribute_amount_before_deposit = attribute_fixture.fixture.mint_amount_raw; - let token_decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcSplTokenDecoder)]; - let token_materializers: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::MtTokenAccountsMaterializer)]; - let deposit_operation = kb_lib::ExSplClassicTokenOperation::Instruction { - value: kb_lib::ExSplClassicTokenSingleOperation::TransferChecked { - source: kb_lib::MdPubkey(attribute_fixture.fixture.token_account.clone()), - mint: kb_lib::MdPubkey(attribute_fixture.fixture.mint.clone()), - destination: kb_lib::MdPubkey(escrow_attribute_token_account.clone()), - authority: kb_lib::ExSplClassicTokenAuthority { - authority: kb_lib::MdPubkey(attribute_fixture.fixture.authority.clone()), + let token_decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcSplTokenDecoder)]; + let token_materializers: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::MtTokenAccountsMaterializer)]; + let deposit_operation = ks_lib::ExSplClassicTokenOperation::Instruction { + value: ks_lib::ExSplClassicTokenSingleOperation::TransferChecked { + source: ks_lib::MdPubkey(attribute_fixture.fixture.token_account.clone()), + mint: ks_lib::MdPubkey(attribute_fixture.fixture.mint.clone()), + destination: ks_lib::MdPubkey(escrow_attribute_token_account.clone()), + authority: ks_lib::ExSplClassicTokenAuthority { + authority: ks_lib::MdPubkey(attribute_fixture.fixture.authority.clone()), multisig_signers: std::vec::Vec::new(), }, - amount: kb_lib::ExSplClassicTokenAmount(DEPOSIT_AMOUNT_RAW.to_string()), + amount: ks_lib::ExSplClassicTokenAmount(DEPOSIT_AMOUNT_RAW.to_string()), decimals: attribute_fixture.fixture.mint_decimals, }, }; @@ -320,20 +320,20 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let transfer_operation = kb_lib::ExMetaplexTokenMetadataOperation::TransferOutOfEscrow { - escrow: kb_lib::MdPubkey(escrow.clone()), - metadata: kb_lib::MdPubkey(parent_fixture.fixture.metadata.clone()), - payer: kb_lib::MdPubkey(parent_fixture.fixture.authority.clone()), - attribute_mint: kb_lib::MdPubkey(attribute_fixture.fixture.mint.clone()), - attribute_src: kb_lib::MdPubkey(escrow_attribute_token_account.clone()), - attribute_dst: kb_lib::MdPubkey(attribute_fixture.fixture.token_account.clone()), - escrow_mint: kb_lib::MdPubkey(parent_fixture.fixture.mint.clone()), - escrow_account: kb_lib::MdPubkey(parent_fixture.fixture.token_account.clone()), - system_program: kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), - ata_program: kb_lib::MdPubkey(kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string()), - token_program: kb_lib::MdPubkey(kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), - sysvar_instructions: kb_lib::MdPubkey( - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID.to_string(), + let transfer_operation = ks_lib::ExMetaplexTokenMetadataOperation::TransferOutOfEscrow { + escrow: ks_lib::MdPubkey(escrow.clone()), + metadata: ks_lib::MdPubkey(parent_fixture.fixture.metadata.clone()), + payer: ks_lib::MdPubkey(parent_fixture.fixture.authority.clone()), + attribute_mint: ks_lib::MdPubkey(attribute_fixture.fixture.mint.clone()), + attribute_src: ks_lib::MdPubkey(escrow_attribute_token_account.clone()), + attribute_dst: ks_lib::MdPubkey(attribute_fixture.fixture.token_account.clone()), + escrow_mint: ks_lib::MdPubkey(parent_fixture.fixture.mint.clone()), + escrow_account: ks_lib::MdPubkey(parent_fixture.fixture.token_account.clone()), + system_program: ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), + ata_program: ks_lib::MdPubkey(ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string()), + token_program: ks_lib::MdPubkey(ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), + sysvar_instructions: ks_lib::MdPubkey( + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID.to_string(), ), authority: std::option::Option::None, args: mpl_token_metadata::instructions::TransferOutOfEscrowInstructionArgs { @@ -410,21 +410,21 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if !escrow_attribute_account_closed { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_attribute_source_not_closed", "TransferOutOfEscrow must close the emptied escrow attribute ATA", )); } - let close_operation = kb_lib::ExMetaplexTokenMetadataOperation::CloseEscrowAccount { - escrow: kb_lib::MdPubkey(escrow.clone()), - metadata: kb_lib::MdPubkey(parent_fixture.fixture.metadata.clone()), - mint: kb_lib::MdPubkey(parent_fixture.fixture.mint.clone()), - token_account: kb_lib::MdPubkey(parent_fixture.fixture.token_account.clone()), - edition: kb_lib::MdPubkey(parent_fixture.fixture.master_edition.clone()), - payer: kb_lib::MdPubkey(parent_fixture.fixture.authority.clone()), - system_program: kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), - sysvar_instructions: kb_lib::MdPubkey( - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID.to_string(), + let close_operation = ks_lib::ExMetaplexTokenMetadataOperation::CloseEscrowAccount { + escrow: ks_lib::MdPubkey(escrow.clone()), + metadata: ks_lib::MdPubkey(parent_fixture.fixture.metadata.clone()), + mint: ks_lib::MdPubkey(parent_fixture.fixture.mint.clone()), + token_account: ks_lib::MdPubkey(parent_fixture.fixture.token_account.clone()), + edition: ks_lib::MdPubkey(parent_fixture.fixture.master_edition.clone()), + payer: ks_lib::MdPubkey(parent_fixture.fixture.authority.clone()), + system_program: ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), + sysvar_instructions: ks_lib::MdPubkey( + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID.to_string(), ), }; let mut close_request = crate::DevnetMetaplexTokenMetadataExecutionRequest::new( @@ -474,7 +474,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if !escrow_account_closed { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_account_not_closed", "CloseEscrowAccount left the Token Owned Escrow account present", )); @@ -543,13 +543,13 @@ fn configure_metaplex_submission( request.post_validation_max_retries = 20; } -fn derive_token_owner_escrow(mint: &str) -> kb_core::Result { - let program = match kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID +fn derive_token_owner_escrow(mint: &str) -> ks_core::Result { + let program = match ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID .parse::() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid Metaplex Program ID: {error}" ))); }, @@ -557,7 +557,7 @@ fn derive_token_owner_escrow(mint: &str) -> kb_core::Result let mint = match mint.parse::() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid escrow parent mint: {error}" ))); }, @@ -569,11 +569,11 @@ fn derive_token_owner_escrow(mint: &str) -> kb_core::Result return std::result::Result::Ok(escrow.to_string()); } -fn derive_classic_ata(owner: &str, mint: &str) -> kb_core::Result { +fn derive_classic_ata(owner: &str, mint: &str) -> ks_core::Result { let owner = match owner.parse::() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid escrow ATA owner: {error}" ))); }, @@ -581,16 +581,16 @@ fn derive_classic_ata(owner: &str, mint: &str) -> kb_core::Result() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid escrow attribute mint: {error}" ))); }, }; - let token_program = match kb_program_ids::SPL_TOKEN_PROGRAM_ID.parse::() + let token_program = match ks_program_ids::SPL_TOKEN_PROGRAM_ID.parse::() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid classic SPL Token Program ID: {error}" ))); }, @@ -610,14 +610,14 @@ fn escrow_reads( metadata: &str, query_role: &str, min_context_slot: std::option::Option, -) -> std::vec::Vec { +) -> std::vec::Vec { let mut reads = metadata_read(metadata, query_role, min_context_slot); - reads.push(kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { + reads.push(ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: query_role.to_string(), - account: kb_lib::MdPubkey(escrow.to_string()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::TokenOwnedEscrow, + account: ks_lib::MdPubkey(escrow.to_string()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::TokenOwnedEscrow, min_context_slot, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }); return reads; } @@ -626,25 +626,25 @@ fn metadata_read( metadata: &str, query_role: &str, min_context_slot: std::option::Option, -) -> std::vec::Vec { - return std::vec![kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { +) -> std::vec::Vec { + return std::vec![ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: query_role.to_string(), - account: kb_lib::MdPubkey(metadata.to_string()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::Metadata, + account: ks_lib::MdPubkey(metadata.to_string()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::Metadata, min_context_slot, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }]; } fn validate_token_owner_escrow_snapshot( - snapshots: &[kb_pipeline::MetaplexTokenMetadataStatefulReadResult], + snapshots: &[ks_pipeline::MetaplexTokenMetadataStatefulReadResult], escrow: &str, mint: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let snapshot = match snapshots.iter().find(|value| return value.snapshot.account.0 == escrow) { std::option::Option::Some(value) => &value.snapshot, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_stateful_snapshot_missing", "Token Owned Escrow stateful snapshot is missing", )); @@ -658,7 +658,7 @@ fn validate_token_owner_escrow_snapshot( != std::option::Option::Some("token_owner") || !snapshot.payload_json["creator"].is_null() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_stateful_snapshot_invalid", format!("Token Owned Escrow state mismatch: {}", snapshot.payload_json), )); @@ -667,14 +667,14 @@ fn validate_token_owner_escrow_snapshot( } async fn read_and_validate_token_amount( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, query_role: &str, account: &str, mint: &str, owner: &str, expected_amount: u64, min_context_slot: u64, -) -> kb_core::Result { +) -> ks_core::Result { let token = match crate::read_token_account_at_or_after( http_pool, query_role, @@ -685,7 +685,7 @@ async fn read_and_validate_token_amount( { std::result::Result::Ok(std::option::Option::Some(value)) => value, std::result::Result::Ok(std::option::Option::None) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_token_account_missing", format!("expected token account {account} is missing"), )); @@ -699,7 +699,7 @@ async fn read_and_validate_token_amount( expected_amount, spl_token_interface::state::AccountState::Initialized, ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_token_account_invalid", format!("token account {account} failed state validation: {error}"), )); @@ -708,26 +708,26 @@ async fn read_and_validate_token_amount( } async fn metaplex_account_is_absent( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, query_role: &str, account: &str, min_context_slot: u64, -) -> kb_core::Result { - let config = match kb_onchain_transport::GetAccountInfoConfig::new_with_data( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, +) -> ks_core::Result { + let config = match ks_onchain_transport::GetAccountInfoConfig::new_with_data( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, std::option::Option::Some(min_context_slot), 128, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let account = kb_lib::MdPubkey(account.to_string()); + let account = ks_lib::MdPubkey(account.to_string()); let result = match http_pool.get_account_info_for_role(query_role, &account, &config).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; if result.context.slot < min_context_slot { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_close_context_too_old", "escrow close account read returned a slot below confirmation", )); @@ -738,9 +738,9 @@ async fn metaplex_account_is_absent( fn validate_metaplex_execution( step: &str, execution: &crate::DevnetMetaplexTokenMetadataExecutionSummary, -) -> kb_core::Result { +) -> ks_core::Result { if !execution.simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_simulation_failed", format!("Metaplex escrow {step} simulation failed"), )); @@ -749,20 +749,20 @@ fn validate_metaplex_execution( std::option::Option::Some(value) if matches!( value.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) => { value }, std::option::Option::Some(value) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_confirmation_incomplete", format!("Metaplex escrow {step} stopped at {:?}", value.status), )); }, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_confirmation_missing", format!("Metaplex escrow {step} has no confirmation evidence"), )); @@ -771,7 +771,7 @@ fn validate_metaplex_execution( let diagnostic = match execution.post_execution.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_post_execution_missing", format!("Metaplex escrow {step} has no post-execution diagnostic"), )); @@ -784,7 +784,7 @@ fn validate_metaplex_execution( || execution.materializations.is_empty() || execution.materialized_snapshots.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_post_execution_incomplete", format!( "Metaplex escrow {step} post-execution incomplete: signature={}, slot={:?}, canonical_inserted={}, core_extracted={}, decode_replayed={}, materialized={}, materialization_rows={}, materialized_snapshots={}, diagnostics={:?}", @@ -801,14 +801,14 @@ fn validate_metaplex_execution( )); } if !idempotence_is_clean(execution.idempotence_replay.as_ref()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_idempotence_failed", format!("Metaplex escrow {step} second replay is not idempotent"), )); } return match confirmation.slot { std::option::Option::Some(value) => std::result::Result::Ok(value), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_confirmation_slot_missing", format!("Metaplex escrow {step} confirmation has no slot"), )), @@ -817,9 +817,9 @@ fn validate_metaplex_execution( fn validate_ata_setup( execution: &crate::DevnetSplAssociatedTokenAccountExecutionSummary, -) -> kb_core::Result { +) -> ks_core::Result { if !execution.simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_ata_simulation_failed", "escrow attribute ATA simulation failed", )); @@ -828,14 +828,14 @@ fn validate_ata_setup( std::option::Option::Some(value) if matches!( value.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) => { value }, _ => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_ata_confirmation_incomplete", "escrow attribute ATA was not confirmed", )); @@ -850,23 +850,23 @@ fn validate_ata_setup( }) || execution.materializations.is_empty() || !idempotence_is_clean(execution.idempotence_replay.as_ref()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_ata_post_execution_incomplete", "escrow attribute ATA setup lacks complete pipeline evidence", )); } return match confirmation.slot { std::option::Option::Some(value) => std::result::Result::Ok(value), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_ata_confirmation_slot_missing", "escrow attribute ATA confirmation has no slot", )), }; } -fn validate_token_setup(execution: &crate::DevnetSplTokenExecutionSummary) -> kb_core::Result { +fn validate_token_setup(execution: &crate::DevnetSplTokenExecutionSummary) -> ks_core::Result { if !execution.simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_deposit_simulation_failed", "escrow attribute deposit simulation failed", )); @@ -875,14 +875,14 @@ fn validate_token_setup(execution: &crate::DevnetSplTokenExecutionSummary) -> kb std::option::Option::Some(value) if matches!( value.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) => { value }, _ => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_deposit_confirmation_incomplete", "escrow attribute deposit was not confirmed", )); @@ -897,21 +897,21 @@ fn validate_token_setup(execution: &crate::DevnetSplTokenExecutionSummary) -> kb }) || execution.materializations.is_empty() || !idempotence_is_clean(execution.idempotence_replay.as_ref()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_deposit_post_execution_incomplete", "escrow attribute deposit lacks complete pipeline evidence", )); } return match confirmation.slot { std::option::Option::Some(value) => std::result::Result::Ok(value), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_escrow_deposit_confirmation_slot_missing", "escrow attribute deposit confirmation has no slot", )), }; } -fn idempotence_is_clean(replay: std::option::Option<&kb_pipeline::DecodeReplaySummary>) -> bool { +fn idempotence_is_clean(replay: std::option::Option<&ks_pipeline::DecodeReplaySummary>) -> bool { return replay.is_some_and(|value| { return value.failed_inputs == 0 && value.processing_error_inputs == 0 @@ -975,7 +975,7 @@ mod tests { }, std::result::Result::Err(_) => workspace_root.join("config/example.config.json"), }; - let config = kb_config::read_config_json_file_with_environment( + let config = ks_config::read_config_json_file_with_environment( config_path.as_path(), workspace_root, ) @@ -987,16 +987,16 @@ mod tests { .unwrap_or_else(|error| panic!("KB_POSTGRES_TEST_URL is required: {error}")); profile.database.backend = "postgres".to_string(); profile.database.postgres.url = database_url; - let http_pool = kb_onchain_transport::HttpEndpointPool::from_profile(&profile) + let http_pool = ks_onchain_transport::HttpEndpointPool::from_profile(&profile) .unwrap_or_else(|error| panic!("HTTP pool initialization failed: {error}")); - let store_options = kb_store::PostgresStoreOptions::new( + let store_options = ks_store::PostgresStoreOptions::new( profile.database.postgres.url.clone(), profile.database.postgres.max_connections, profile.database.postgres.connect_timeout_ms, false, ) .unwrap_or_else(|error| panic!("PostgreSQL options failed: {error}")); - let store = kb_store::PostgresStore::connect(store_options) + let store = ks_store::PostgresStore::connect(store_options) .await .unwrap_or_else(|error| panic!("PostgreSQL connection failed: {error}")); if let std::result::Result::Err(error) = store.initialize_store_schema().await { diff --git a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/fixture.rs b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/fixture.rs similarity index 86% rename from kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/fixture.rs rename to ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/fixture.rs index 02712f5..5ddf91a 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/fixture.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/fixture.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/fixture.rs -// version: 19 +// file: ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/fixture.rs +// version: 20 //! Native Metaplex Token Metadata fixture preparation for Devnet demos. @@ -110,36 +110,36 @@ pub struct MetaplexCreateFixturePreparationSummary { /// Creates one family-consistent classic SPL mint and derives its Metaplex PDAs. pub async fn prepare_metaplex_create_fixture( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::MetaplexCreateFixturePreparationOptions, -) -> kb_core::Result { +) -> ks_core::Result { if options.query_role.trim().is_empty() || options.transaction_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex fixture endpoint roles must not be empty", )); } if !profile.wallet.devnet_send_enabled { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex fixture preparation requires devnet_send_enabled=true", )); } if let std::option::Option::Some(limit) = options.print_supply_limit { if options.asset_family != crate::MetaplexTokenMetadataAssetFamily::Nft { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex limited print supply is supported only for the NFT fixture family", )); } if limit == 0 || limit > 100 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex limited print supply must be between 1 and 100", )); } } if let std::option::Option::Some(uses) = options.uses.as_ref() { if options.asset_family != crate::MetaplexTokenMetadataAssetFamily::Nft { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex Multiple-use fixture is supported only for the NFT family", )); } @@ -148,7 +148,7 @@ pub async fn prepare_metaplex_create_fixture( || uses.total > 100 || uses.remaining != uses.total { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex Multiple-use fixture requires 1..=100 total uses and remaining == total", )); } @@ -157,11 +157,11 @@ pub async fn prepare_metaplex_create_fixture( if options.asset_family == crate::MetaplexTokenMetadataAssetFamily::Collection || options.asset_family == crate::MetaplexTokenMetadataAssetFamily::Fungible { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex collection members must not use the Collection or Fungible asset family", )); } - if let std::result::Result::Err(error) = kb_onchain_transport::validate_solana_pubkey_text( + if let std::result::Result::Err(error) = ks_onchain_transport::validate_solana_pubkey_text( collection_mint.as_str(), "Metaplex collection parent mint", ) { @@ -173,20 +173,20 @@ pub async fn prepare_metaplex_create_fixture( std::result::Result::Err(error) => return std::result::Result::Err(error), }; let fixture_dir = options.wallet_dir.join("metaplex_token_metadata_validation"); - let fixture_store = match kb_wallet::TemporaryWalletStore::new(fixture_dir.clone()) { + let fixture_store = match ks_wallet::TemporaryWalletStore::new(fixture_dir.clone()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; let fixture_epoch = match std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH) { std::result::Result::Ok(value) => value.as_nanos(), std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "unable to create a unique Metaplex fixture identifier: {error}" ))); }, }; let fixture_alias = - match kb_wallet::WalletAlias::parse(format!("create-mint-native-{fixture_epoch}").as_str()) + match ks_wallet::WalletAlias::parse(format!("create-mint-native-{fixture_epoch}").as_str()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -205,7 +205,7 @@ pub async fn prepare_metaplex_create_fixture( std::result::Result::Err(error) => return std::result::Result::Err(error), }; if existing.is_some() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_fixture_fresh_mint_already_exists", format!( "fresh Metaplex fixture mint {mint} unexpectedly already exists on Devnet; refusing to reuse persisted fixture state" @@ -235,7 +235,7 @@ pub async fn prepare_metaplex_create_fixture( { std::result::Result::Ok(std::option::Option::Some(value)) => value, std::result::Result::Ok(std::option::Option::None) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_fixture_mint_missing_after_confirmation", format!( "native Metaplex fixture mint {mint} is unavailable at or after preparation slot {}", @@ -248,7 +248,7 @@ pub async fn prepare_metaplex_create_fixture( if let std::result::Result::Err(error) = validate_classic_fixture_mint(&created, authority.as_str(), mint_decimals) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_fixture_created_mint_state_mismatch", format!( "fresh fixture mint {mint} prepared by authority {authority} at slot {} failed immediate state validation: {error}", @@ -259,17 +259,17 @@ pub async fn prepare_metaplex_create_fixture( let mint_pubkey = match ::from_str(mint.as_str()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid generated mint public key: {error}" ))); }, }; let program_id = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid Metaplex Program ID: {error}" ))); }, @@ -284,11 +284,11 @@ pub async fn prepare_metaplex_create_fixture( ); let master_edition_requested = fixture_requires_master_edition(options.asset_family); let token_program = match ::from_str( - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid classic SPL Token Program ID: {error}" ))); }, @@ -297,7 +297,7 @@ pub async fn prepare_metaplex_create_fixture( match ::from_str(authority.as_str()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid Metaplex fixture authority public key: {error}" ))); }, @@ -319,7 +319,7 @@ pub async fn prepare_metaplex_create_fixture( { std::result::Result::Ok(std::option::Option::Some(value)) => value, std::result::Result::Ok(std::option::Option::None) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_fixture_token_account_missing_after_confirmation", "native Metaplex fixture ATA is unavailable after confirmation", )); @@ -359,7 +359,7 @@ pub async fn prepare_metaplex_create_fixture( let operation_json = match serde_json::to_string_pretty(&operation) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_fixture_serialization_failed", format!("unable to serialize Metaplex Create fixture: {error}"), )); @@ -368,7 +368,7 @@ pub async fn prepare_metaplex_create_fixture( let mint_operation_json = match serde_json::to_string_pretty(&mint_operation) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_fixture_serialization_failed", format!("unable to serialize Metaplex Mint fixture: {error}"), )); @@ -401,19 +401,19 @@ struct NativeFixturePreparationEvidence { } async fn create_native_classic_mint( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, options: &crate::MetaplexCreateFixturePreparationOptions, - operator: &kb_wallet::TemporaryWallet, - mint_wallet: &kb_wallet::TemporaryWallet, + operator: &ks_wallet::TemporaryWallet, + mint_wallet: &ks_wallet::TemporaryWallet, mint_decimals: u8, -) -> kb_core::Result { +) -> ks_core::Result { const MINT_SPACE: u64 = 82; let rent = match http_pool .get_minimum_balance_for_rent_exemption_for_role( options.query_role.as_str(), MINT_SPACE, - &kb_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), + &ks_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), ) .await { @@ -424,42 +424,42 @@ async fn create_native_classic_mint( .get_minimum_balance_for_rent_exemption_for_role( options.query_role.as_str(), 165, - &kb_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), + &ks_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), ) .await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let payer = kb_lib::MdPubkey(operator.public_key()); - let mint = kb_lib::MdPubkey(mint_wallet.public_key()); + let payer = ks_lib::MdPubkey(operator.public_key()); + let mint = ks_lib::MdPubkey(mint_wallet.public_key()); let policy = fixture_policy(profile, payer.clone(), mint.clone(), rent.minimum_balance_lamports); - let system_intent = kb_lib::ExSolanaCoreExecutionIntent { + let system_intent = ks_lib::ExSolanaCoreExecutionIntent { intent_id: format!("metaplex-fixture-create-account-{}", mint.0), fee_payer: payer.clone(), policy: policy.clone(), - operation: kb_lib::ExSolanaCoreOperation::SystemCreateAccount { + operation: ks_lib::ExSolanaCoreOperation::SystemCreateAccount { from: payer.clone(), new_account: mint.clone(), lamports: rent.minimum_balance_lamports, space: MINT_SPACE, - owner: kb_lib::MdPubkey(kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), + owner: ks_lib::MdPubkey(ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), }, }; - let system_plan = match kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan( - &kb_lib::ExSolanaCoreExecutor, + let system_plan = match ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan( + &ks_lib::ExSolanaCoreExecutor, &system_intent, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; let token_program = match ::from_str( - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid classic SPL Token Program ID: {error}" ))); }, @@ -468,7 +468,7 @@ async fn create_native_classic_mint( { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid native fixture mint public key: {error}" ))); }, @@ -477,7 +477,7 @@ async fn create_native_classic_mint( match ::from_str(payer.0.as_str()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid native fixture authority public key: {error}" ))); }, @@ -491,7 +491,7 @@ async fn create_native_classic_mint( ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_fixture_initialize_mint_build_failed", error.to_string(), )); @@ -516,12 +516,12 @@ async fn create_native_classic_mint( policy, requested_spend_lamports, ); - let plan_evaluation = match kb_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { + let plan_evaluation = match ks_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if plan_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if plan_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "metaplex_fixture_plan_denied", crate::violation_message(plan_evaluation.violations.as_slice()), )); @@ -529,14 +529,14 @@ async fn create_native_classic_mint( let latest_blockhash = match http_pool .get_latest_blockhash_for_role( options.query_role.as_str(), - &kb_onchain_transport::GetLatestBlockhashConfig::confirmed(), + &ks_onchain_transport::GetLatestBlockhashConfig::confirmed(), ) .await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let unsigned = match kb_lib::executor_solana_build_legacy_transaction( + let unsigned = match ks_lib::executor_solana_build_legacy_transaction( &plan, latest_blockhash.blockhash.as_str(), ) { @@ -547,8 +547,8 @@ async fn create_native_classic_mint( .get_fee_for_message_for_role( options.query_role.as_str(), unsigned.message_base64().as_str(), - &kb_onchain_transport::GetFeeForMessageConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + &ks_onchain_transport::GetFeeForMessageConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, std::option::Option::Some(latest_blockhash.context.slot), ), ) @@ -561,8 +561,8 @@ async fn create_native_classic_mint( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let simulation_config = match kb_onchain_transport::SimulateTransactionConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let simulation_config = match ks_onchain_transport::SimulateTransactionConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, false, false, std::option::Option::Some(latest_blockhash.context.slot), @@ -584,8 +584,8 @@ async fn create_native_classic_mint( std::result::Result::Err(error) => return std::result::Result::Err(error), }; let simulation = simulation_rpc.to_execution_result( - kb_lib::ExApiExecutionCluster::Devnet, - kb_lib::ExApiExecutionBlockhashKind::Latest, + ks_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionBlockhashKind::Latest, std::option::Option::Some( simulation_rpc.context.slot.saturating_sub(latest_blockhash.context.slot), ), @@ -594,17 +594,17 @@ async fn create_native_classic_mint( std::option::Option::Some(&fee), ); if !simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_fixture_simulation_failed", crate::simulation_failure_message(&simulation), )); } - let send_evaluation = match kb_lib::ExSafetyChecker.evaluate_send(&plan, &simulation) { + let send_evaluation = match ks_lib::ExSafetyChecker.evaluate_send(&plan, &simulation) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if send_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if send_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "metaplex_fixture_send_denied", crate::violation_message(send_evaluation.violations.as_slice()), )); @@ -620,7 +620,7 @@ async fn create_native_classic_mint( return std::result::Result::Err(error); } let signature = signed.primary_signature().clone(); - let send_config = match kb_onchain_transport::SendTransactionConfig::from_execution_config( + let send_config = match ks_onchain_transport::SendTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(latest_blockhash.context.slot), ) { @@ -639,7 +639,7 @@ async fn create_native_classic_mint( return std::result::Result::Err(error); } let confirmation_config = - match kb_onchain_transport::ConfirmTransactionConfig::from_execution_config( + match ks_onchain_transport::ConfirmTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(latest_blockhash.last_valid_block_height), std::option::Option::Some(latest_blockhash.context.slot), @@ -651,7 +651,7 @@ async fn create_native_classic_mint( .confirm_transaction_for_roles( options.transaction_role.as_str(), options.query_role.as_str(), - kb_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionCluster::Devnet, &signature, &confirmation_config, ) @@ -662,10 +662,10 @@ async fn create_native_classic_mint( }; if !matches!( confirmation.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_fixture_confirmation_failed", format!("native mint preparation stopped at {:?}", confirmation.status), )); @@ -673,7 +673,7 @@ async fn create_native_classic_mint( let confirmation_slot = match confirmation.slot { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_fixture_confirmation_slot_missing", format!( "native mint preparation {} was confirmed without a confirmation slot", @@ -683,7 +683,7 @@ async fn create_native_classic_mint( }, }; tracing::info!( - target: "kb-pipeline-demo-scenarios.metaplex_fixture", + target: "ks-pipeline-demo-scenarios.metaplex_fixture", action = "prepare_native_metaplex_mint", mint = mint_wallet.public_key(), authority = operator.public_key(), @@ -700,16 +700,16 @@ async fn create_native_classic_mint( fn planned_instruction( operation_code: &str, instruction: &solana_instruction::Instruction, -) -> kb_lib::ExApiPlannedInstruction { - return kb_lib::ExApiPlannedInstruction { - program_id: kb_lib::MdProgramId(instruction.program_id.to_string()), +) -> ks_lib::ExApiPlannedInstruction { + return ks_lib::ExApiPlannedInstruction { + program_id: ks_lib::MdProgramId(instruction.program_id.to_string()), operation_code: operation_code.to_string(), accounts: instruction .accounts .iter() .map(|account| { - return kb_lib::ExApiPlannedAccount { - pubkey: kb_lib::MdPubkey(account.pubkey.to_string()), + return ks_lib::ExApiPlannedAccount { + pubkey: ks_lib::MdPubkey(account.pubkey.to_string()), is_signer: account.is_signer, is_writable: account.is_writable, }; @@ -720,27 +720,27 @@ fn planned_instruction( } fn fixture_policy( - profile: &kb_config::ProfileConfig, - payer: kb_lib::MdPubkey, - mint: kb_lib::MdPubkey, + profile: &ks_config::ProfileConfig, + payer: ks_lib::MdPubkey, + mint: ks_lib::MdPubkey, _rent_lamports: u64, -) -> kb_lib::ExApiExecutionPolicy { - return kb_lib::ExApiExecutionPolicy { - cluster: kb_lib::ExApiExecutionClusterPolicy { - expected_cluster: kb_lib::ExApiExecutionCluster::Devnet, +) -> ks_lib::ExApiExecutionPolicy { + return ks_lib::ExApiExecutionPolicy { + cluster: ks_lib::ExApiExecutionClusterPolicy { + expected_cluster: ks_lib::ExApiExecutionCluster::Devnet, allow_mainnet: false, mainnet_confirmation: false, }, - simulation: kb_lib::ExApiExecutionSimulationPolicy::Required, - blockhash: kb_lib::ExApiExecutionBlockhashPolicy { - kind: kb_lib::ExApiExecutionBlockhashKind::Latest, + simulation: ks_lib::ExApiExecutionSimulationPolicy::Required, + blockhash: ks_lib::ExApiExecutionBlockhashPolicy { + kind: ks_lib::ExApiExecutionBlockhashKind::Latest, max_age_slots: std::option::Option::Some( profile.execution.recent_blockhash_max_age_slots, ), nonce_account: std::option::Option::None, nonce_authority: std::option::Option::None, }, - cost_limit: kb_lib::ExApiExecutionCostLimit { + cost_limit: ks_lib::ExApiExecutionCostLimit { max_spend_lamports: std::option::Option::Some( profile.execution.devnet_max_spend_lamports, ), @@ -751,7 +751,7 @@ fn fixture_policy( }, authorized_signers: std::vec![payer, mint], dry_run: false, - post_execution_validation: kb_lib::ExApiPostExecutionValidationPolicy { + post_execution_validation: ks_lib::ExApiPostExecutionValidationPolicy { canonical_insert_required: false, core_extraction_required: false, decode_replay_required: false, @@ -761,13 +761,13 @@ fn fixture_policy( } fn merge_fixture_instructions( - mut system_plan: kb_lib::ExApiPreparedExecutionPlan, - additional_instructions: &[kb_lib::ExApiPlannedInstruction], - policy: kb_lib::ExApiExecutionPolicy, + mut system_plan: ks_lib::ExApiPreparedExecutionPlan, + additional_instructions: &[ks_lib::ExApiPlannedInstruction], + policy: ks_lib::ExApiExecutionPolicy, requested_spend_lamports: u64, -) -> kb_lib::ExApiPreparedExecutionPlan { +) -> ks_lib::ExApiPreparedExecutionPlan { system_plan.instructions.extend_from_slice(additional_instructions); - system_plan.executor_name = "kb-pipeline-demo-scenarios.metaplex_fixture".to_string(); + system_plan.executor_name = "ks-pipeline-demo-scenarios.metaplex_fixture".to_string(); system_plan.operation_code = "metadata.metaplex_token_metadata.prepare_native_mint_and_ata".to_string(); system_plan.policy = policy; @@ -776,29 +776,29 @@ fn merge_fixture_instructions( } async fn read_mint_account( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, query_role: &str, mint: &str, -) -> kb_core::Result> { +) -> ks_core::Result> { return read_mint_account_at_or_after(http_pool, query_role, mint, std::option::Option::None) .await; } pub(crate) async fn read_mint_account_at_or_after( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, query_role: &str, mint: &str, min_context_slot: std::option::Option, -) -> kb_core::Result> { - let config = match kb_onchain_transport::GetAccountInfoConfig::new_with_data( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, +) -> ks_core::Result> { + let config = match ks_onchain_transport::GetAccountInfoConfig::new_with_data( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, min_context_slot, 82, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let mint_pubkey = kb_lib::MdPubkey(mint.to_string()); + let mint_pubkey = ks_lib::MdPubkey(mint.to_string()); let result = match http_pool.get_account_info_for_role(query_role, &mint_pubkey, &config).await { std::result::Result::Ok(value) => value, @@ -808,19 +808,19 @@ pub(crate) async fn read_mint_account_at_or_after( } fn validate_classic_fixture_mint( - account: &kb_onchain_transport::AccountInfoValue, + account: &ks_onchain_transport::AccountInfoValue, expected_authority: &str, expected_decimals: u8, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { return validate_classic_fixture_mint_state(account, expected_authority, expected_decimals, 0); } pub(crate) fn classic_fixture_mint_supply( - account: &kb_onchain_transport::AccountInfoValue, -) -> kb_core::Result { + account: &ks_onchain_transport::AccountInfoValue, +) -> ks_core::Result { let bytes = account.data.as_slice(); if bytes.len() != 82 { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Metaplex Create fixture mint must use the classic 82-byte layout, got {} bytes", bytes.len() ))); @@ -828,7 +828,7 @@ pub(crate) fn classic_fixture_mint_supply( let supply_bytes = match <[u8; 8]>::try_from(&bytes[36..44]) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "invalid fixture mint supply bytes", )); }, @@ -837,20 +837,20 @@ pub(crate) fn classic_fixture_mint_supply( } pub(crate) fn validate_classic_fixture_mint_state( - account: &kb_onchain_transport::AccountInfoValue, + account: &ks_onchain_transport::AccountInfoValue, expected_authority: &str, expected_decimals: u8, expected_supply: u64, -) -> kb_core::Result<()> { - if account.owner.0 != kb_program_ids::SPL_TOKEN_PROGRAM_ID || account.executable { - return std::result::Result::Err(kb_core::Error::config(format!( +) -> ks_core::Result<()> { + if account.owner.0 != ks_program_ids::SPL_TOKEN_PROGRAM_ID || account.executable { + return std::result::Result::Err(ks_core::Error::config(format!( "Metaplex Create fixture mint owner mismatch: expected classic SPL Token, got {}", account.owner.0 ))); } let bytes = account.data.as_slice(); if bytes.len() != 82 { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Metaplex Create fixture mint must use the classic 82-byte layout, got {} bytes", bytes.len() ))); @@ -870,14 +870,14 @@ pub(crate) fn validate_classic_fixture_mint_state( std::result::Result::Err(error) => return std::result::Result::Err(error), }; if decimals != expected_decimals || supply != expected_supply || !initialized { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Metaplex fixture mint requires initialized=true, decimals={expected_decimals} and supply={expected_supply}, got initialized={initialized}, decimals={decimals}, supply={supply}" ))); } if mint_authority.as_deref() != std::option::Option::Some(expected_authority) || freeze_authority.as_deref() != std::option::Option::Some(expected_authority) { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Metaplex fixture mint requires mint and freeze authorities to equal {expected_authority}; mint_authority={mint_authority:?}, freeze_authority={freeze_authority:?}" ))); } @@ -887,9 +887,9 @@ pub(crate) fn validate_classic_fixture_mint_state( fn decode_coption_pubkey( bytes: &[u8], label: &str, -) -> kb_core::Result> { +) -> ks_core::Result> { if bytes.len() != 36 { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid {label} field length: {}", bytes.len() ))); @@ -899,14 +899,14 @@ fn decode_coption_pubkey( return std::result::Result::Ok(std::option::Option::None); } if tag != 1 { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid {label} option tag: {tag}" ))); } let key = match <[u8; 32]>::try_from(&bytes[4..36]) { std::result::Result::Ok(value) => solana_pubkey::Pubkey::new_from_array(value), std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid {label} public key bytes" ))); }, @@ -915,20 +915,20 @@ fn decode_coption_pubkey( } pub(crate) async fn read_token_account_at_or_after( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, query_role: &str, token_account: &str, min_context_slot: std::option::Option, -) -> kb_core::Result> { - let config = match kb_onchain_transport::GetAccountInfoConfig::new_with_data( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, +) -> ks_core::Result> { + let config = match ks_onchain_transport::GetAccountInfoConfig::new_with_data( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, min_context_slot, 165, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let address = kb_lib::MdPubkey(token_account.to_string()); + let address = ks_lib::MdPubkey(token_account.to_string()); let result = match http_pool.get_account_info_for_role(query_role, &address, &config).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -937,10 +937,10 @@ pub(crate) async fn read_token_account_at_or_after( } fn validate_classic_fixture_token_account( - account: &kb_onchain_transport::AccountInfoValue, + account: &ks_onchain_transport::AccountInfoValue, expected_mint: &str, expected_owner: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { return validate_classic_fixture_token_account_state( account, expected_mint, @@ -951,11 +951,11 @@ fn validate_classic_fixture_token_account( } pub(crate) fn classic_fixture_token_account_state( - account: &kb_onchain_transport::AccountInfoValue, -) -> kb_core::Result { + account: &ks_onchain_transport::AccountInfoValue, +) -> ks_core::Result { let bytes = account.data.as_slice(); if account.space != 165 || bytes.len() != 165 { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Metaplex fixture token account must use the classic 165-byte layout, got space={} and {} decoded bytes", account.space, bytes.len() @@ -965,7 +965,7 @@ pub(crate) fn classic_fixture_token_account_state( if state != spl_token_interface::state::AccountState::Initialized as u8 && state != spl_token_interface::state::AccountState::Frozen as u8 { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Metaplex fixture token account must be initialized or frozen, got state={state}" ))); } @@ -973,11 +973,11 @@ pub(crate) fn classic_fixture_token_account_state( } pub(crate) fn classic_fixture_token_amount( - account: &kb_onchain_transport::AccountInfoValue, -) -> kb_core::Result { + account: &ks_onchain_transport::AccountInfoValue, +) -> ks_core::Result { let bytes = account.data.as_slice(); if account.space != 165 || bytes.len() != 165 { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Metaplex fixture token account must use the classic 165-byte layout, got space={} and {} decoded bytes", account.space, bytes.len() @@ -986,7 +986,7 @@ pub(crate) fn classic_fixture_token_amount( let amount_bytes = match <[u8; 8]>::try_from(&bytes[64..72]) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "invalid fixture token account amount bytes", )); }, @@ -995,21 +995,21 @@ pub(crate) fn classic_fixture_token_amount( } pub(crate) fn validate_classic_fixture_token_account_state( - account: &kb_onchain_transport::AccountInfoValue, + account: &ks_onchain_transport::AccountInfoValue, expected_mint: &str, expected_owner: &str, expected_amount: u64, expected_state: spl_token_interface::state::AccountState, -) -> kb_core::Result<()> { - if account.owner.0 != kb_program_ids::SPL_TOKEN_PROGRAM_ID || account.executable { - return std::result::Result::Err(kb_core::Error::config(format!( +) -> ks_core::Result<()> { + if account.owner.0 != ks_program_ids::SPL_TOKEN_PROGRAM_ID || account.executable { + return std::result::Result::Err(ks_core::Error::config(format!( "Metaplex fixture token account owner mismatch: expected classic SPL Token, got {}", account.owner.0 ))); } let bytes = account.data.as_slice(); if account.space != 165 || bytes.len() != 165 { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Metaplex fixture token account must use the classic 165-byte layout, got space={} and {} decoded bytes", account.space, bytes.len() @@ -1018,7 +1018,7 @@ pub(crate) fn validate_classic_fixture_token_account_state( let mint = solana_pubkey::Pubkey::new_from_array(match <[u8; 32]>::try_from(&bytes[0..32]) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "invalid fixture token account mint bytes", )); }, @@ -1026,7 +1026,7 @@ pub(crate) fn validate_classic_fixture_token_account_state( let owner = solana_pubkey::Pubkey::new_from_array(match <[u8; 32]>::try_from(&bytes[32..64]) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "invalid fixture token account owner bytes", )); }, @@ -1040,7 +1040,7 @@ pub(crate) fn validate_classic_fixture_token_account_state( || amount != expected_amount || bytes[108] != expected_state as u8 { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Metaplex fixture ATA requires mint={expected_mint}, owner={expected_owner}, amount={expected_amount} and state={expected_state:?}; got mint={mint}, owner={owner}, amount={amount}, state={}", bytes[108] ))); @@ -1165,7 +1165,7 @@ fn create_operation_json( "authority": authority, "update_authority": authority, "update_authority_as_signer": true, - "spl_token_program": kb_program_ids::SPL_TOKEN_PROGRAM_ID, + "spl_token_program": ks_program_ids::SPL_TOKEN_PROGRAM_ID, "create_args": {"V1": { "name": name, "symbol": symbol, @@ -1217,10 +1217,10 @@ fn mint_operation_json( "authority": authority, "delegate_record": null, "payer": authority, - "system_program": kb_program_ids::SYSTEM_PROGRAM_ID, - "sysvar_instructions": kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, - "spl_token_program": kb_program_ids::SPL_TOKEN_PROGRAM_ID, - "spl_ata_program": kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID, + "system_program": ks_program_ids::SYSTEM_PROGRAM_ID, + "sysvar_instructions": ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID, + "spl_token_program": ks_program_ids::SPL_TOKEN_PROGRAM_ID, + "spl_ata_program": ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID, "authorization_rules_program": null, "authorization_rules": null, "args": {"V1": { @@ -1309,11 +1309,11 @@ mod tests { expects_master_edition ); let parsed = - serde_json::from_value::(operation); + serde_json::from_value::(operation); assert!(parsed.is_ok()); assert_eq!( parsed.ok().map(|value| return value.operation_code()), - std::option::Option::Some(kb_lib::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION), + std::option::Option::Some(ks_lib::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION), ); } } @@ -1347,7 +1347,7 @@ mod tests { std::option::Option::Some(false), ); assert!( - serde_json::from_value::(operation).is_ok() + serde_json::from_value::(operation).is_ok() ); } @@ -1370,7 +1370,7 @@ mod tests { std::option::Option::Some(1), ); assert!( - serde_json::from_value::(operation).is_ok() + serde_json::from_value::(operation).is_ok() ); let invalid = crate::MetaplexCreateFixturePreparationOptions::new(std::path::PathBuf::new()) @@ -1415,7 +1415,7 @@ mod tests { std::option::Option::Some(2), ); assert!( - serde_json::from_value::(operation).is_ok() + serde_json::from_value::(operation).is_ok() ); let options = crate::MetaplexCreateFixturePreparationOptions::new( std::path::PathBuf::from("wallets"), @@ -1433,9 +1433,9 @@ mod tests { data[32..64].copy_from_slice(owner.as_ref()); data[64..72].copy_from_slice(&0_u64.to_le_bytes()); data[108] = 1; - let account = kb_onchain_transport::AccountInfoValue { + let account = ks_onchain_transport::AccountInfoValue { lamports: 0, - owner: kb_lib::MdProgramId(kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), + owner: ks_lib::MdProgramId(ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), executable: false, rent_epoch: 0, space: 165, @@ -1486,7 +1486,7 @@ mod tests { #[test] fn family_mint_contracts_keep_amount_master_edition_and_token_record_exact() { let program_id = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => return, @@ -1524,10 +1524,10 @@ mod tests { family, ); let parsed = - serde_json::from_value::(operation); + serde_json::from_value::(operation); assert!(matches!( parsed, - std::result::Result::Ok(kb_lib::ExMetaplexTokenMetadataOperation::Mint { + std::result::Result::Ok(ks_lib::ExMetaplexTokenMetadataOperation::Mint { token_owner: std::option::Option::Some(_), master_edition, token_record, diff --git a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/maintenance_campaign.rs b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/maintenance_campaign.rs similarity index 82% rename from kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/maintenance_campaign.rs rename to ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/maintenance_campaign.rs index 85af3df..3bb197a 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/maintenance_campaign.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/maintenance_campaign.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/maintenance_campaign.rs -// version: 3 +// file: ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/maintenance_campaign.rs +// version: 4 //! Final bounded Devnet qualification campaign for current Metaplex maintenance operations. @@ -35,22 +35,22 @@ pub fn metaplex_maintenance_campaign_operation_names() -> &'static [&'static str /// Executes the final bounded Metaplex maintenance qualification campaign on Devnet. #[allow(clippy::too_many_arguments)] pub async fn execute_devnet_metaplex_maintenance_campaign( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::MetaplexCreateFixturePreparationOptions, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { if options.asset_family != crate::MetaplexTokenMetadataAssetFamily::Nft { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex maintenance campaign requires the classic NFT fixture family", )); } @@ -75,7 +75,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if primary_sale_before_update { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_maintenance_initial_primary_sale_invalid", "fresh maintenance NFT already has primary_sale_happened=true", )); @@ -110,19 +110,19 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if !primary_sale_after_update { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_maintenance_update_state_invalid", "confirmed Update did not flip primary_sale_happened to true", )); } - let resize_operation = kb_lib::ExMetaplexTokenMetadataOperation::Resize { - metadata: kb_lib::MdPubkey(fixture.fixture.metadata.clone()), - edition: kb_lib::MdPubkey(fixture.fixture.master_edition.clone()), - mint: kb_lib::MdPubkey(fixture.fixture.mint.clone()), - payer: kb_lib::MdPubkey(fixture.fixture.authority.clone()), + let resize_operation = ks_lib::ExMetaplexTokenMetadataOperation::Resize { + metadata: ks_lib::MdPubkey(fixture.fixture.metadata.clone()), + edition: ks_lib::MdPubkey(fixture.fixture.master_edition.clone()), + mint: ks_lib::MdPubkey(fixture.fixture.mint.clone()), + payer: ks_lib::MdPubkey(fixture.fixture.authority.clone()), authority: std::option::Option::None, - token: std::option::Option::Some(kb_lib::MdPubkey(fixture.fixture.token_account.clone())), - system_program: kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), + token: std::option::Option::Some(ks_lib::MdPubkey(fixture.fixture.token_account.clone())), + system_program: ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), }; let resize_probe = match simulate_expected_unavailable( "resize", @@ -156,9 +156,9 @@ where }; let collect_probe = match simulate_expected_unavailable( "collect", - kb_lib::ExMetaplexTokenMetadataOperation::Collect { - authority: kb_lib::MdPubkey(fixture.fixture.authority.clone()), - recipient: kb_lib::MdPubkey(METAPLEX_FEE_DESTINATION.to_string()), + ks_lib::ExMetaplexTokenMetadataOperation::Collect { + authority: ks_lib::MdPubkey(fixture.fixture.authority.clone()), + recipient: ks_lib::MdPubkey(METAPLEX_FEE_DESTINATION.to_string()), }, 7, http_pool, @@ -174,12 +174,12 @@ where }; let close_accounts_probe = match simulate_expected_unavailable( "close_accounts", - kb_lib::ExMetaplexTokenMetadataOperation::CloseAccounts { - metadata: kb_lib::MdPubkey(fixture.fixture.metadata.clone()), - edition: kb_lib::MdPubkey(fixture.fixture.master_edition.clone()), - mint: kb_lib::MdPubkey(fixture.fixture.mint.clone()), - authority: kb_lib::MdPubkey(fixture.fixture.authority.clone()), - destination: kb_lib::MdPubkey(METAPLEX_OWNERLESS_CLOSE_DESTINATION.to_string()), + ks_lib::ExMetaplexTokenMetadataOperation::CloseAccounts { + metadata: ks_lib::MdPubkey(fixture.fixture.metadata.clone()), + edition: ks_lib::MdPubkey(fixture.fixture.master_edition.clone()), + mint: ks_lib::MdPubkey(fixture.fixture.mint.clone()), + authority: ks_lib::MdPubkey(fixture.fixture.authority.clone()), + destination: ks_lib::MdPubkey(METAPLEX_OWNERLESS_CLOSE_DESTINATION.to_string()), }, 188, http_pool, @@ -207,7 +207,7 @@ where fn update_operation( fixture: &crate::MetaplexCreateFixturePreparationSummary, -) -> kb_core::Result { +) -> ks_core::Result { let value = serde_json::json!({ "operation": "update_as_update_authority_v2", "authority": fixture.authority.as_str(), @@ -232,9 +232,9 @@ fn update_operation( } } }); - return match serde_json::from_value::(value) { + return match serde_json::from_value::(value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::config( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::config( format!("Metaplex maintenance Update operation is invalid: {error}"), )), }; @@ -242,23 +242,23 @@ fn update_operation( fn migrate_operation( fixture: &crate::MetaplexCreateFixturePreparationSummary, -) -> kb_lib::ExMetaplexTokenMetadataOperation { - return kb_lib::ExMetaplexTokenMetadataOperation::Migrate { - metadata: kb_lib::MdPubkey(fixture.metadata.clone()), - edition: kb_lib::MdPubkey(fixture.master_edition.clone()), - token: kb_lib::MdPubkey(fixture.token_account.clone()), - token_owner: kb_lib::MdPubkey(fixture.authority.clone()), - mint: kb_lib::MdPubkey(fixture.mint.clone()), - payer: kb_lib::MdPubkey(fixture.authority.clone()), - authority: kb_lib::MdPubkey(fixture.authority.clone()), - collection_metadata: kb_lib::MdPubkey(fixture.metadata.clone()), - delegate_record: kb_lib::MdPubkey(fixture.metadata.clone()), - token_record: kb_lib::MdPubkey(fixture.metadata.clone()), - system_program: kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), - sysvar_instructions: kb_lib::MdPubkey( - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID.to_string(), +) -> ks_lib::ExMetaplexTokenMetadataOperation { + return ks_lib::ExMetaplexTokenMetadataOperation::Migrate { + metadata: ks_lib::MdPubkey(fixture.metadata.clone()), + edition: ks_lib::MdPubkey(fixture.master_edition.clone()), + token: ks_lib::MdPubkey(fixture.token_account.clone()), + token_owner: ks_lib::MdPubkey(fixture.authority.clone()), + mint: ks_lib::MdPubkey(fixture.mint.clone()), + payer: ks_lib::MdPubkey(fixture.authority.clone()), + authority: ks_lib::MdPubkey(fixture.authority.clone()), + collection_metadata: ks_lib::MdPubkey(fixture.metadata.clone()), + delegate_record: ks_lib::MdPubkey(fixture.metadata.clone()), + token_record: ks_lib::MdPubkey(fixture.metadata.clone()), + system_program: ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), + sysvar_instructions: ks_lib::MdPubkey( + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID.to_string(), ), - spl_token_program: kb_lib::MdPubkey(kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), + spl_token_program: ks_lib::MdPubkey(ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), authorization_rules_program: std::option::Option::None, authorization_rules: std::option::Option::None, }; @@ -267,30 +267,30 @@ fn migrate_operation( #[allow(clippy::too_many_arguments)] async fn execute_confirmed_operation( label: &str, - operation: kb_lib::ExMetaplexTokenMetadataOperation, - reads: std::vec::Vec, - http_pool: &kb_onchain_transport::HttpEndpointPool, + operation: ks_lib::ExMetaplexTokenMetadataOperation, + reads: std::vec::Vec, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::MetaplexCreateFixturePreparationOptions, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcMetadataMetaplexTokenMetadataDecoder)]; - let materializers: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::MtAdminMaterializer), - std::sync::Arc::new(kb_lib::MtComplianceAuditMaterializer), - std::sync::Arc::new(kb_lib::MtLifecycleMaterializer), - std::sync::Arc::new(kb_lib::MtMetadataMetaplexTokenMetadataMaterializer), - std::sync::Arc::new(kb_lib::MtRiskMaterializer), + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcMetadataMetaplexTokenMetadataDecoder)]; + let materializers: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::MtAdminMaterializer), + std::sync::Arc::new(ks_lib::MtComplianceAuditMaterializer), + std::sync::Arc::new(ks_lib::MtLifecycleMaterializer), + std::sync::Arc::new(ks_lib::MtMetadataMetaplexTokenMetadataMaterializer), + std::sync::Arc::new(ks_lib::MtRiskMaterializer), ]; let mut request = crate::DevnetMetaplexTokenMetadataExecutionRequest::new( format!("metaplex-maintenance-{label}-{}", uuid::Uuid::new_v4()), @@ -320,14 +320,14 @@ where #[allow(clippy::too_many_arguments)] async fn simulate_expected_unavailable( label: &str, - operation: kb_lib::ExMetaplexTokenMetadataOperation, + operation: ks_lib::ExMetaplexTokenMetadataOperation, expected_custom_error: u64, - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::MetaplexCreateFixturePreparationOptions, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where O: crate::SolanaExecutionObserver, { @@ -351,14 +351,14 @@ where }; if summary.simulation.success || summary.send_result.is_some() || summary.confirmation.is_some() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_maintenance_unavailable_probe_unexpected_success", format!("Metaplex {label} probe unexpectedly became submit-capable or confirmed"), )); } let observed_custom_error = simulation_custom_error(summary.simulation.error.as_deref()); if observed_custom_error != std::option::Option::Some(expected_custom_error) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_maintenance_unavailable_probe_error_mismatch", format!( "Metaplex {label} probe expected custom error {expected_custom_error}; got custom_error={observed_custom_error:?}, error={:?}, logs={:?}", @@ -393,27 +393,27 @@ fn simulation_custom_error(error: std::option::Option<&str>) -> std::option::Opt fn metadata_reads( fixture: &crate::MetaplexCreateFixturePreparationSummary, query_role: &str, -) -> std::vec::Vec { - return std::vec![kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { +) -> std::vec::Vec { + return std::vec![ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: query_role.to_string(), - account: kb_lib::MdPubkey(fixture.metadata.clone()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::Metadata, + account: ks_lib::MdPubkey(fixture.metadata.clone()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::Metadata, min_context_slot: std::option::Option::None, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }]; } fn metadata_primary_sale( - snapshots: &[kb_pipeline::MetaplexTokenMetadataStatefulReadResult], + snapshots: &[ks_pipeline::MetaplexTokenMetadataStatefulReadResult], metadata: &str, -) -> kb_core::Result { +) -> ks_core::Result { let snapshot = match snapshots.iter().find(|value| { return value.snapshot.account.0.as_str() == metadata && value.snapshot.account_kind == "metadata"; }) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_maintenance_metadata_snapshot_missing", format!("metadata snapshot {metadata} is missing"), )); @@ -426,7 +426,7 @@ fn metadata_primary_sale( .or_else(|| return snapshot.snapshot.payload_json.get("primarySaleHappened")); return match value.and_then(serde_json::Value::as_bool) { std::option::Option::Some(value) => std::result::Result::Ok(value), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_maintenance_primary_sale_missing", "metadata snapshot has no boolean primary-sale field", )), @@ -436,25 +436,25 @@ fn metadata_primary_sale( fn validate_confirmed_execution( label: &str, execution: &crate::DevnetMetaplexTokenMetadataExecutionSummary, -) -> kb_core::Result { +) -> ks_core::Result { let confirmation = match execution.confirmation.as_ref() { std::option::Option::Some(value) if matches!( value.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) => { value }, std::option::Option::Some(value) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_maintenance_confirmation_incomplete", format!("Metaplex {label} stopped at {:?}", value.status), )); }, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_maintenance_confirmation_missing", format!("Metaplex {label} has no confirmation evidence"), )); @@ -463,7 +463,7 @@ fn validate_confirmed_execution( let diagnostic = match execution.post_execution.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_maintenance_post_execution_missing", format!("Metaplex {label} has no post-execution diagnostic"), )); @@ -476,7 +476,7 @@ fn validate_confirmed_execution( || execution.materializations.is_empty() || execution.materialized_snapshots.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_maintenance_post_execution_incomplete", format!( "Metaplex {label} post-execution incomplete: signature={}, slot={:?}, canonical_inserted={}, core_extracted={}, decode_replayed={}, materialized={}, materialization_rows={}, materialized_snapshots={}, diagnostics={:?}", @@ -495,7 +495,7 @@ fn validate_confirmed_execution( let idempotence = match execution.idempotence_replay.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_maintenance_idempotence_missing", format!("Metaplex {label} has no idempotence replay evidence"), )); @@ -510,14 +510,14 @@ fn validate_confirmed_execution( || processor.materialization_refused != 0; }) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_maintenance_idempotence_failed", format!("Metaplex {label} second replay is not idempotent"), )); } return match confirmation.slot { std::option::Option::Some(value) => std::result::Result::Ok(value), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_maintenance_confirmation_slot_missing", format!("Metaplex {label} confirmation has no slot"), )), @@ -579,7 +579,7 @@ mod tests { }, std::result::Result::Err(_) => workspace_root.join("config/example.config.json"), }; - let config = kb_config::read_config_json_file_with_environment( + let config = ks_config::read_config_json_file_with_environment( config_path.as_path(), workspace_root, ) @@ -591,16 +591,16 @@ mod tests { .unwrap_or_else(|error| panic!("KB_POSTGRES_TEST_URL is required: {error}")); profile.database.backend = "postgres".to_string(); profile.database.postgres.url = database_url; - let http_pool = kb_onchain_transport::HttpEndpointPool::from_profile(&profile) + let http_pool = ks_onchain_transport::HttpEndpointPool::from_profile(&profile) .unwrap_or_else(|error| panic!("HTTP pool initialization failed: {error}")); - let store_options = kb_store::PostgresStoreOptions::new( + let store_options = ks_store::PostgresStoreOptions::new( profile.database.postgres.url.clone(), profile.database.postgres.max_connections, profile.database.postgres.connect_timeout_ms, false, ) .unwrap_or_else(|error| panic!("PostgreSQL options failed: {error}")); - let store = kb_store::PostgresStore::connect(store_options) + let store = ks_store::PostgresStore::connect(store_options) .await .unwrap_or_else(|error| panic!("PostgreSQL connection failed: {error}")); if let std::result::Result::Err(error) = store.initialize_store_schema().await { diff --git a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/pnft_lifecycle_campaign.rs b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/pnft_lifecycle_campaign.rs similarity index 82% rename from kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/pnft_lifecycle_campaign.rs rename to ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/pnft_lifecycle_campaign.rs index 6b3a253..1b1aac6 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/pnft_lifecycle_campaign.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/pnft_lifecycle_campaign.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/pnft_lifecycle_campaign.rs -// version: 3 +// file: ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/pnft_lifecycle_campaign.rs +// version: 4 //! Confirmed Devnet pNFT delegate, lock, unlock, revoke and transfer campaign. @@ -69,22 +69,22 @@ pub fn metaplex_pnft_lifecycle_campaign_operation_names() -> &'static [&'static /// Executes one fresh pNFT delegate/lock/unlock/revoke/transfer campaign on Devnet. #[allow(clippy::too_many_arguments)] pub async fn execute_devnet_metaplex_pnft_lifecycle_campaign( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::MetaplexCreateFixturePreparationOptions, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { if options.asset_family != crate::MetaplexTokenMetadataAssetFamily::ProgrammableNft { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex pNFT lifecycle campaign requires asset_family=programmable_nft", )); } @@ -104,7 +104,7 @@ where let token_record = match pnft.fixture.token_record.as_ref() { std::option::Option::Some(value) => value.clone(), std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_token_record_missing", "fresh pNFT fixture did not expose its token-record PDA", )); @@ -130,23 +130,23 @@ where let fixture_epoch = match std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH) { std::result::Result::Ok(value) => value.as_nanos(), std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "unable to create a unique pNFT lifecycle fixture identifier: {error}" ))); }, }; let delegate_alias = - match kb_wallet::WalletAlias::parse(format!("pnft-delegate-{fixture_epoch}").as_str()) { + match ks_wallet::WalletAlias::parse(format!("pnft-delegate-{fixture_epoch}").as_str()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; let destination_alias = - match kb_wallet::WalletAlias::parse(format!("pnft-destination-{fixture_epoch}").as_str()) { + match ks_wallet::WalletAlias::parse(format!("pnft-destination-{fixture_epoch}").as_str()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let delegate_wallet = kb_wallet::TemporaryWallet::generate(delegate_alias); - let destination_wallet = kb_wallet::TemporaryWallet::generate(destination_alias); + let delegate_wallet = ks_wallet::TemporaryWallet::generate(delegate_alias); + let destination_wallet = ks_wallet::TemporaryWallet::generate(destination_alias); let delegate = delegate_wallet.public_key(); let destination_owner = destination_wallet.public_key(); let destination = @@ -166,33 +166,33 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if destination_before.is_some() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_destination_not_fresh", "fresh pNFT destination associated token account already exists", )); } - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcMetadataMetaplexTokenMetadataDecoder)]; - let materializers: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::MtAdminMaterializer), - std::sync::Arc::new(kb_lib::MtComplianceAuditMaterializer), - std::sync::Arc::new(kb_lib::MtLifecycleMaterializer), - std::sync::Arc::new(kb_lib::MtMetadataMetaplexTokenMetadataMaterializer), - std::sync::Arc::new(kb_lib::MtRiskMaterializer), + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcMetadataMetaplexTokenMetadataDecoder)]; + let materializers: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::MtAdminMaterializer), + std::sync::Arc::new(ks_lib::MtComplianceAuditMaterializer), + std::sync::Arc::new(ks_lib::MtLifecycleMaterializer), + std::sync::Arc::new(ks_lib::MtMetadataMetaplexTokenMetadataMaterializer), + std::sync::Arc::new(ks_lib::MtRiskMaterializer), ]; - let delegate_staking_operation = kb_lib::ExMetaplexTokenMetadataOperation::Delegate { + let delegate_staking_operation = ks_lib::ExMetaplexTokenMetadataOperation::Delegate { delegate_record: std::option::Option::None, - delegate: kb_lib::MdPubkey(delegate.clone()), - metadata: kb_lib::MdPubkey(pnft.fixture.metadata.clone()), - master_edition: std::option::Option::Some(kb_lib::MdPubkey( + delegate: ks_lib::MdPubkey(delegate.clone()), + metadata: ks_lib::MdPubkey(pnft.fixture.metadata.clone()), + master_edition: std::option::Option::Some(ks_lib::MdPubkey( pnft.fixture.master_edition.clone(), )), - token_record: std::option::Option::Some(kb_lib::MdPubkey(token_record.clone())), - mint: kb_lib::MdPubkey(pnft.fixture.mint.clone()), - token: std::option::Option::Some(kb_lib::MdPubkey(pnft.fixture.token_account.clone())), - authority: kb_lib::MdPubkey(pnft.fixture.authority.clone()), - spl_token_program: std::option::Option::Some(kb_lib::MdProgramId( - kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string(), + token_record: std::option::Option::Some(ks_lib::MdPubkey(token_record.clone())), + mint: ks_lib::MdPubkey(pnft.fixture.mint.clone()), + token: std::option::Option::Some(ks_lib::MdPubkey(pnft.fixture.token_account.clone())), + authority: ks_lib::MdPubkey(pnft.fixture.authority.clone()), + spl_token_program: std::option::Option::Some(ks_lib::MdProgramId( + ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string(), )), authorization_rules_program: std::option::Option::None, authorization_rules: std::option::Option::None, @@ -240,16 +240,16 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let lock_operation = kb_lib::ExMetaplexTokenMetadataOperation::Lock { - authority: kb_lib::MdPubkey(delegate.clone()), - token_owner: std::option::Option::Some(kb_lib::MdPubkey(pnft.fixture.authority.clone())), - token: kb_lib::MdPubkey(pnft.fixture.token_account.clone()), - mint: kb_lib::MdPubkey(pnft.fixture.mint.clone()), - metadata: kb_lib::MdPubkey(pnft.fixture.metadata.clone()), - edition: std::option::Option::Some(kb_lib::MdPubkey(pnft.fixture.master_edition.clone())), - token_record: std::option::Option::Some(kb_lib::MdPubkey(token_record.clone())), - spl_token_program: std::option::Option::Some(kb_lib::MdProgramId( - kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string(), + let lock_operation = ks_lib::ExMetaplexTokenMetadataOperation::Lock { + authority: ks_lib::MdPubkey(delegate.clone()), + token_owner: std::option::Option::Some(ks_lib::MdPubkey(pnft.fixture.authority.clone())), + token: ks_lib::MdPubkey(pnft.fixture.token_account.clone()), + mint: ks_lib::MdPubkey(pnft.fixture.mint.clone()), + metadata: ks_lib::MdPubkey(pnft.fixture.metadata.clone()), + edition: std::option::Option::Some(ks_lib::MdPubkey(pnft.fixture.master_edition.clone())), + token_record: std::option::Option::Some(ks_lib::MdPubkey(token_record.clone())), + spl_token_program: std::option::Option::Some(ks_lib::MdProgramId( + ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string(), )), authorization_rules_program: std::option::Option::None, authorization_rules: std::option::Option::None, @@ -283,7 +283,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if lock_slot < delegate_staking_slot { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_slot_regression", "Lock confirmation slot precedes Delegate confirmation", )); @@ -301,16 +301,16 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let unlock_operation = kb_lib::ExMetaplexTokenMetadataOperation::Unlock { - authority: kb_lib::MdPubkey(delegate.clone()), - token_owner: std::option::Option::Some(kb_lib::MdPubkey(pnft.fixture.authority.clone())), - token: kb_lib::MdPubkey(pnft.fixture.token_account.clone()), - mint: kb_lib::MdPubkey(pnft.fixture.mint.clone()), - metadata: kb_lib::MdPubkey(pnft.fixture.metadata.clone()), - edition: std::option::Option::Some(kb_lib::MdPubkey(pnft.fixture.master_edition.clone())), - token_record: std::option::Option::Some(kb_lib::MdPubkey(token_record.clone())), - spl_token_program: std::option::Option::Some(kb_lib::MdProgramId( - kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string(), + let unlock_operation = ks_lib::ExMetaplexTokenMetadataOperation::Unlock { + authority: ks_lib::MdPubkey(delegate.clone()), + token_owner: std::option::Option::Some(ks_lib::MdPubkey(pnft.fixture.authority.clone())), + token: ks_lib::MdPubkey(pnft.fixture.token_account.clone()), + mint: ks_lib::MdPubkey(pnft.fixture.mint.clone()), + metadata: ks_lib::MdPubkey(pnft.fixture.metadata.clone()), + edition: std::option::Option::Some(ks_lib::MdPubkey(pnft.fixture.master_edition.clone())), + token_record: std::option::Option::Some(ks_lib::MdPubkey(token_record.clone())), + spl_token_program: std::option::Option::Some(ks_lib::MdProgramId( + ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string(), )), authorization_rules_program: std::option::Option::None, authorization_rules: std::option::Option::None, @@ -356,19 +356,19 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let revoke_operation = kb_lib::ExMetaplexTokenMetadataOperation::Revoke { + let revoke_operation = ks_lib::ExMetaplexTokenMetadataOperation::Revoke { delegate_record: std::option::Option::None, - delegate: kb_lib::MdPubkey(delegate.clone()), - metadata: kb_lib::MdPubkey(pnft.fixture.metadata.clone()), - master_edition: std::option::Option::Some(kb_lib::MdPubkey( + delegate: ks_lib::MdPubkey(delegate.clone()), + metadata: ks_lib::MdPubkey(pnft.fixture.metadata.clone()), + master_edition: std::option::Option::Some(ks_lib::MdPubkey( pnft.fixture.master_edition.clone(), )), - token_record: std::option::Option::Some(kb_lib::MdPubkey(token_record.clone())), - mint: kb_lib::MdPubkey(pnft.fixture.mint.clone()), - token: std::option::Option::Some(kb_lib::MdPubkey(pnft.fixture.token_account.clone())), - authority: kb_lib::MdPubkey(pnft.fixture.authority.clone()), - spl_token_program: std::option::Option::Some(kb_lib::MdProgramId( - kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string(), + token_record: std::option::Option::Some(ks_lib::MdPubkey(token_record.clone())), + mint: ks_lib::MdPubkey(pnft.fixture.mint.clone()), + token: std::option::Option::Some(ks_lib::MdPubkey(pnft.fixture.token_account.clone())), + authority: ks_lib::MdPubkey(pnft.fixture.authority.clone()), + spl_token_program: std::option::Option::Some(ks_lib::MdProgramId( + ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string(), )), authorization_rules_program: std::option::Option::None, authorization_rules: std::option::Option::None, @@ -411,19 +411,19 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let delegate_transfer_operation = kb_lib::ExMetaplexTokenMetadataOperation::Delegate { + let delegate_transfer_operation = ks_lib::ExMetaplexTokenMetadataOperation::Delegate { delegate_record: std::option::Option::None, - delegate: kb_lib::MdPubkey(delegate.clone()), - metadata: kb_lib::MdPubkey(pnft.fixture.metadata.clone()), - master_edition: std::option::Option::Some(kb_lib::MdPubkey( + delegate: ks_lib::MdPubkey(delegate.clone()), + metadata: ks_lib::MdPubkey(pnft.fixture.metadata.clone()), + master_edition: std::option::Option::Some(ks_lib::MdPubkey( pnft.fixture.master_edition.clone(), )), - token_record: std::option::Option::Some(kb_lib::MdPubkey(token_record.clone())), - mint: kb_lib::MdPubkey(pnft.fixture.mint.clone()), - token: std::option::Option::Some(kb_lib::MdPubkey(pnft.fixture.token_account.clone())), - authority: kb_lib::MdPubkey(pnft.fixture.authority.clone()), - spl_token_program: std::option::Option::Some(kb_lib::MdProgramId( - kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string(), + token_record: std::option::Option::Some(ks_lib::MdPubkey(token_record.clone())), + mint: ks_lib::MdPubkey(pnft.fixture.mint.clone()), + token: std::option::Option::Some(ks_lib::MdPubkey(pnft.fixture.token_account.clone())), + authority: ks_lib::MdPubkey(pnft.fixture.authority.clone()), + spl_token_program: std::option::Option::Some(ks_lib::MdProgramId( + ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string(), )), authorization_rules_program: std::option::Option::None, authorization_rules: std::option::Option::None, @@ -471,19 +471,19 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let transfer_operation = kb_lib::ExMetaplexTokenMetadataOperation::Transfer { - token: kb_lib::MdPubkey(pnft.fixture.token_account.clone()), - token_owner: kb_lib::MdPubkey(pnft.fixture.authority.clone()), - destination_token: kb_lib::MdPubkey(destination.0.clone()), - destination_owner: kb_lib::MdPubkey(destination_owner.clone()), - mint: kb_lib::MdPubkey(pnft.fixture.mint.clone()), - metadata: kb_lib::MdPubkey(pnft.fixture.metadata.clone()), - edition: std::option::Option::Some(kb_lib::MdPubkey(pnft.fixture.master_edition.clone())), - token_record: std::option::Option::Some(kb_lib::MdPubkey(token_record.clone())), - destination_token_record: std::option::Option::Some(kb_lib::MdPubkey( + let transfer_operation = ks_lib::ExMetaplexTokenMetadataOperation::Transfer { + token: ks_lib::MdPubkey(pnft.fixture.token_account.clone()), + token_owner: ks_lib::MdPubkey(pnft.fixture.authority.clone()), + destination_token: ks_lib::MdPubkey(destination.0.clone()), + destination_owner: ks_lib::MdPubkey(destination_owner.clone()), + mint: ks_lib::MdPubkey(pnft.fixture.mint.clone()), + metadata: ks_lib::MdPubkey(pnft.fixture.metadata.clone()), + edition: std::option::Option::Some(ks_lib::MdPubkey(pnft.fixture.master_edition.clone())), + token_record: std::option::Option::Some(ks_lib::MdPubkey(token_record.clone())), + destination_token_record: std::option::Option::Some(ks_lib::MdPubkey( destination.1.clone(), )), - authority: kb_lib::MdPubkey(delegate.clone()), + authority: ks_lib::MdPubkey(delegate.clone()), authorization_rules_program: std::option::Option::None, authorization_rules: std::option::Option::None, transfer_args: mpl_token_metadata::types::TransferArgs::V1 { @@ -539,7 +539,7 @@ where { std::result::Result::Ok(std::option::Option::Some(value)) => value, std::result::Result::Ok(std::option::Option::None) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_source_token_missing", "source pNFT token account disappeared after Transfer", )); @@ -556,7 +556,7 @@ where { std::result::Result::Ok(std::option::Option::Some(value)) => value, std::result::Result::Ok(std::option::Option::None) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_destination_token_missing", "destination pNFT token account was not created by Transfer", )); @@ -570,7 +570,7 @@ where 0, spl_token_interface::state::AccountState::Initialized, ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_source_token_invalid", format!("source pNFT token account is invalid after Transfer: {error}"), )); @@ -582,7 +582,7 @@ where 1, spl_token_interface::state::AccountState::Frozen, ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_destination_token_invalid", format!("destination pNFT token account is invalid after Transfer: {error}"), )); @@ -628,24 +628,24 @@ where #[allow(clippy::too_many_arguments)] async fn execute_profile_step( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::MetaplexCreateFixturePreparationOptions, label: &str, - operation: kb_lib::ExMetaplexTokenMetadataOperation, + operation: ks_lib::ExMetaplexTokenMetadataOperation, token_record: &str, mint: &str, token: &str, - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { @@ -669,25 +669,25 @@ where #[allow(clippy::too_many_arguments)] async fn execute_delegate_step( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::MetaplexCreateFixturePreparationOptions, label: &str, - operation: kb_lib::ExMetaplexTokenMetadataOperation, + operation: ks_lib::ExMetaplexTokenMetadataOperation, token_record: &str, mint: &str, token: &str, - delegate_wallet: &kb_wallet::TemporaryWallet, - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + delegate_wallet: &ks_wallet::TemporaryWallet, + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { @@ -697,7 +697,7 @@ where request.materialize_after_confirmation = true; request.post_validation_max_retries = 20; request.additional_authorized_signers = - std::vec![kb_lib::MdPubkey(delegate_wallet.public_key())]; + std::vec![ks_lib::MdPubkey(delegate_wallet.public_key())]; return crate::execute_devnet_metaplex_token_metadata_with_signers( http_pool, store, @@ -714,24 +714,24 @@ where #[allow(clippy::too_many_arguments)] async fn execute_delegate_transfer_step( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::MetaplexCreateFixturePreparationOptions, - operation: kb_lib::ExMetaplexTokenMetadataOperation, + operation: ks_lib::ExMetaplexTokenMetadataOperation, destination_token_record: &str, mint: &str, destination_token: &str, - delegate_wallet: &kb_wallet::TemporaryWallet, - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + delegate_wallet: &ks_wallet::TemporaryWallet, + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { @@ -748,7 +748,7 @@ where request.materialize_after_confirmation = true; request.post_validation_max_retries = 20; request.additional_authorized_signers = - std::vec![kb_lib::MdPubkey(delegate_wallet.public_key())]; + std::vec![ks_lib::MdPubkey(delegate_wallet.public_key())]; return crate::execute_devnet_metaplex_token_metadata_with_signers( http_pool, store, @@ -765,7 +765,7 @@ where fn request( label: &str, - operation: kb_lib::ExMetaplexTokenMetadataOperation, + operation: ks_lib::ExMetaplexTokenMetadataOperation, options: &crate::MetaplexCreateFixturePreparationOptions, token_record: &str, mint: &str, @@ -778,15 +778,15 @@ fn request( request.query_role = options.query_role.clone(); request.transaction_role = options.transaction_role.clone(); request.postcondition_reads = - std::vec![kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { + std::vec![ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: options.query_role.clone(), - account: kb_lib::MdPubkey(token_record.to_string()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::TokenRecord { - mint: kb_lib::MdPubkey(mint.to_string()), - token: kb_lib::MdPubkey(token.to_string()), + account: ks_lib::MdPubkey(token_record.to_string()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::TokenRecord { + mint: ks_lib::MdPubkey(mint.to_string()), + token: ks_lib::MdPubkey(token.to_string()), }, min_context_slot: std::option::Option::None, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }]; return request; } @@ -794,11 +794,11 @@ fn request( fn derive_destination_accounts( mint: &str, owner: &str, -) -> kb_core::Result<(std::string::String, std::string::String)> { +) -> ks_core::Result<(std::string::String, std::string::String)> { let mint = match ::from_str(mint) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid pNFT lifecycle mint: {error}" ))); }, @@ -806,27 +806,27 @@ fn derive_destination_accounts( let owner = match ::from_str(owner) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid pNFT lifecycle destination owner: {error}" ))); }, }; let token_program = match ::from_str( - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid classic SPL token program id: {error}" ))); }, }; let metadata_program = match ::from_str( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid Metaplex Token Metadata program id: {error}" ))); }, @@ -850,16 +850,16 @@ fn derive_destination_accounts( } fn token_record_snapshot<'a>( - snapshots: &'a [kb_pipeline::MetaplexTokenMetadataStatefulReadResult], + snapshots: &'a [ks_pipeline::MetaplexTokenMetadataStatefulReadResult], account: &str, -) -> kb_core::Result<&'a kb_pipeline::MetaplexTokenMetadataStatefulSnapshot> { +) -> ks_core::Result<&'a ks_pipeline::MetaplexTokenMetadataStatefulSnapshot> { let snapshot = snapshots.iter().find(|value| { return value.snapshot.account.0.as_str() == account && value.snapshot.account_kind == "token_record"; }); return match snapshot { std::option::Option::Some(value) => std::result::Result::Ok(&value.snapshot), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_token_record_snapshot_missing", format!("token-record snapshot {account} is missing"), )), @@ -867,11 +867,11 @@ fn token_record_snapshot<'a>( } fn validate_token_record_state( - snapshot: &kb_pipeline::MetaplexTokenMetadataStatefulSnapshot, + snapshot: &ks_pipeline::MetaplexTokenMetadataStatefulSnapshot, expected_state: &str, expected_delegate: std::option::Option<&str>, expected_delegate_role: std::option::Option<&str>, -) -> kb_core::Result { +) -> ks_core::Result { let state = snapshot.payload_json.get("state").and_then(|value| return value.as_str()); let delegate = snapshot.payload_json.get("delegate").and_then(|value| return value.as_str()); let delegate_role = snapshot @@ -882,7 +882,7 @@ fn validate_token_record_state( || delegate != expected_delegate || delegate_role != expected_delegate_role { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_token_record_state_invalid", format!( "token-record state mismatch: expected state={expected_state}, delegate={expected_delegate:?}, role={expected_delegate_role:?}; observed state={state:?}, delegate={delegate:?}, role={delegate_role:?}" @@ -895,9 +895,9 @@ fn validate_token_record_state( fn validate_confirmed_execution( step: &str, execution: &crate::DevnetMetaplexTokenMetadataExecutionSummary, -) -> kb_core::Result { +) -> ks_core::Result { if !execution.simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_simulation_failed", format!("Metaplex pNFT {step} simulation failed"), )); @@ -906,20 +906,20 @@ fn validate_confirmed_execution( std::option::Option::Some(value) if matches!( value.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) => { value }, std::option::Option::Some(value) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_confirmation_incomplete", format!("Metaplex pNFT {step} stopped at {:?}", value.status), )); }, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_confirmation_missing", format!("Metaplex pNFT {step} has no confirmation evidence"), )); @@ -928,7 +928,7 @@ fn validate_confirmed_execution( let diagnostic = match execution.post_execution.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_post_execution_missing", format!("Metaplex pNFT {step} has no post-execution diagnostic"), )); @@ -941,7 +941,7 @@ fn validate_confirmed_execution( || execution.materializations.is_empty() || execution.materialized_snapshots.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_post_execution_incomplete", format!( "Metaplex pNFT {step} post-execution incomplete: signature={}, slot={:?}, canonical_inserted={}, core_extracted={}, decode_replayed={}, materialized={}, materialization_rows={}, materialized_snapshots={}, diagnostics={:?}", @@ -960,7 +960,7 @@ fn validate_confirmed_execution( let second_replay = match execution.idempotence_replay.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_idempotence_missing", format!("Metaplex pNFT {step} has no idempotence replay evidence"), )); @@ -975,14 +975,14 @@ fn validate_confirmed_execution( || processor.materialization_refused != 0; }) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_idempotence_failed", format!("Metaplex pNFT {step} second replay is not idempotent"), )); } return match confirmation.slot { std::option::Option::Some(value) => std::result::Result::Ok(value), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_pnft_lifecycle_confirmation_slot_missing", format!("Metaplex pNFT {step} confirmation has no slot"), )), @@ -1017,10 +1017,10 @@ mod tests { #[test] fn token_record_state_contract_is_exact() { - let snapshot = kb_pipeline::MetaplexTokenMetadataStatefulSnapshot { - account: kb_lib::MdPubkey("11111111111111111111111111111111".to_string()), + let snapshot = ks_pipeline::MetaplexTokenMetadataStatefulSnapshot { + account: ks_lib::MdPubkey("11111111111111111111111111111111".to_string()), account_kind: "token_record".to_string(), - mint: std::option::Option::Some(kb_lib::MdPubkey( + mint: std::option::Option::Some(ks_lib::MdPubkey( "SysvarC1ock11111111111111111111111111111111".to_string(), )), slot: 1, @@ -1073,7 +1073,7 @@ mod tests { }, std::result::Result::Err(_) => workspace_root.join("config/example.config.json"), }; - let config = kb_config::read_config_json_file_with_environment( + let config = ks_config::read_config_json_file_with_environment( config_path.as_path(), workspace_root, ) @@ -1085,16 +1085,16 @@ mod tests { .unwrap_or_else(|error| panic!("KB_POSTGRES_TEST_URL is required: {error}")); profile.database.backend = "postgres".to_string(); profile.database.postgres.url = database_url; - let http_pool = kb_onchain_transport::HttpEndpointPool::from_profile(&profile) + let http_pool = ks_onchain_transport::HttpEndpointPool::from_profile(&profile) .unwrap_or_else(|error| panic!("HTTP pool initialization failed: {error}")); - let store_options = kb_store::PostgresStoreOptions::new( + let store_options = ks_store::PostgresStoreOptions::new( profile.database.postgres.url.clone(), profile.database.postgres.max_connections, profile.database.postgres.connect_timeout_ms, false, ) .unwrap_or_else(|error| panic!("PostgreSQL options failed: {error}")); - let store = kb_store::PostgresStore::connect(store_options) + let store = ks_store::PostgresStore::connect(store_options) .await .unwrap_or_else(|error| panic!("PostgreSQL connection failed: {error}")); if let std::result::Result::Err(error) = store.initialize_store_schema().await { diff --git a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/print_burn_campaign.rs b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/print_burn_campaign.rs similarity index 85% rename from kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/print_burn_campaign.rs rename to ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/print_burn_campaign.rs index a37f994..1e95689 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/print_burn_campaign.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/print_burn_campaign.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/print_burn_campaign.rs -// version: 4 +// file: ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/print_burn_campaign.rs +// version: 5 //! Devnet printable master NFT `Print -> Burn` campaign. @@ -77,22 +77,22 @@ pub fn metaplex_print_burn_campaign_operation_names() -> &'static [&'static str; /// Executes one printable master NFT `Print -> Burn` campaign on Devnet. #[allow(clippy::too_many_arguments)] pub async fn execute_devnet_metaplex_print_burn_campaign( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::MetaplexCreateFixturePreparationOptions, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { if options.collection_mint.is_some() || options.print_supply_limit.is_some() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Print -> Burn campaign base options must not preselect collection or print-supply state", )); } @@ -125,7 +125,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if master_supply_before_print != 0 || master_max_supply != std::option::Option::Some(1) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_master_supply_invalid", format!( "printable master must start supply=0,max_supply=1; supply={master_supply_before_print}, max_supply={master_max_supply:?}" @@ -142,7 +142,7 @@ where { std::result::Result::Ok(std::option::Option::Some(value)) => value, std::result::Result::Ok(std::option::Option::None) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_master_token_missing", "printable master token account is unavailable before Print", )); @@ -156,7 +156,7 @@ where 1, spl_token_interface::state::AccountState::Initialized, ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_master_token_invalid", format!( "printable master token account must contain exactly one token before Print: {error}" @@ -164,20 +164,20 @@ where )); } let fixture_dir = options.wallet_dir.join("metaplex_token_metadata_validation"); - let fixture_store = match kb_wallet::TemporaryWalletStore::new(fixture_dir) { + let fixture_store = match ks_wallet::TemporaryWalletStore::new(fixture_dir) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; let fixture_epoch = match std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH) { std::result::Result::Ok(value) => value.as_nanos(), std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "unable to create a unique printed-edition fixture identifier: {error}" ))); }, }; let edition_alias = - match kb_wallet::WalletAlias::parse(format!("print-edition-{fixture_epoch}").as_str()) { + match ks_wallet::WalletAlias::parse(format!("print-edition-{fixture_epoch}").as_str()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -199,14 +199,14 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if existing_edition_mint.is_some() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_fresh_edition_mint_exists", "fresh printed-edition mint unexpectedly already exists", )); } let edition_number = 1_u64; let program_id = match parse_pubkey( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID, "Metaplex program", ) { std::result::Result::Ok(value) => value, @@ -245,7 +245,7 @@ where &program_id, ); let token_program = - match parse_pubkey(kb_program_ids::SPL_TOKEN_PROGRAM_ID, "classic SPL Token program") { + match parse_pubkey(ks_program_ids::SPL_TOKEN_PROGRAM_ID, "classic SPL Token program") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -266,41 +266,41 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if existing_edition_token.is_some() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_fresh_edition_token_exists", "fresh printed-edition ATA unexpectedly already exists", )); } - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcMetadataMetaplexTokenMetadataDecoder)]; - let materializers: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::MtAdminMaterializer), - std::sync::Arc::new(kb_lib::MtComplianceAuditMaterializer), - std::sync::Arc::new(kb_lib::MtLifecycleMaterializer), - std::sync::Arc::new(kb_lib::MtMetadataMetaplexTokenMetadataMaterializer), - std::sync::Arc::new(kb_lib::MtRiskMaterializer), + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcMetadataMetaplexTokenMetadataDecoder)]; + let materializers: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::MtAdminMaterializer), + std::sync::Arc::new(ks_lib::MtComplianceAuditMaterializer), + std::sync::Arc::new(ks_lib::MtLifecycleMaterializer), + std::sync::Arc::new(ks_lib::MtMetadataMetaplexTokenMetadataMaterializer), + std::sync::Arc::new(ks_lib::MtRiskMaterializer), ]; - let print_operation = kb_lib::ExMetaplexTokenMetadataOperation::Print { - edition_metadata: kb_lib::MdPubkey(edition_metadata.to_string()), - edition: kb_lib::MdPubkey(edition.to_string()), - edition_mint: kb_lib::MdPubkey(edition_mint.clone()), - edition_token_account_owner: kb_lib::MdPubkey(master.fixture.authority.clone()), - edition_token_account: kb_lib::MdPubkey(edition_token_account.to_string()), - edition_mint_authority: kb_lib::MdPubkey(master.fixture.authority.clone()), + let print_operation = ks_lib::ExMetaplexTokenMetadataOperation::Print { + edition_metadata: ks_lib::MdPubkey(edition_metadata.to_string()), + edition: ks_lib::MdPubkey(edition.to_string()), + edition_mint: ks_lib::MdPubkey(edition_mint.clone()), + edition_token_account_owner: ks_lib::MdPubkey(master.fixture.authority.clone()), + edition_token_account: ks_lib::MdPubkey(edition_token_account.to_string()), + edition_mint_authority: ks_lib::MdPubkey(master.fixture.authority.clone()), edition_token_record: std::option::Option::None, - master_edition: kb_lib::MdPubkey(master.fixture.master_edition.clone()), - edition_marker_pda: kb_lib::MdPubkey(edition_marker.to_string()), - payer: kb_lib::MdPubkey(master.fixture.authority.clone()), - master_token_account_owner: kb_lib::MdPubkey(master.fixture.authority.clone()), - master_token_account: kb_lib::MdPubkey(master.fixture.token_account.clone()), - master_metadata: kb_lib::MdPubkey(master.fixture.metadata.clone()), - update_authority: kb_lib::MdPubkey(master.fixture.authority.clone()), - spl_token_program: kb_lib::MdPubkey(kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), - spl_ata_program: kb_lib::MdPubkey(kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string()), - sysvar_instructions: kb_lib::MdPubkey( - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID.to_string(), + master_edition: ks_lib::MdPubkey(master.fixture.master_edition.clone()), + edition_marker_pda: ks_lib::MdPubkey(edition_marker.to_string()), + payer: ks_lib::MdPubkey(master.fixture.authority.clone()), + master_token_account_owner: ks_lib::MdPubkey(master.fixture.authority.clone()), + master_token_account: ks_lib::MdPubkey(master.fixture.token_account.clone()), + master_metadata: ks_lib::MdPubkey(master.fixture.metadata.clone()), + update_authority: ks_lib::MdPubkey(master.fixture.authority.clone()), + spl_token_program: ks_lib::MdPubkey(ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), + spl_ata_program: ks_lib::MdPubkey(ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string()), + sysvar_instructions: ks_lib::MdPubkey( + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID.to_string(), ), - system_program: kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), + system_program: ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), args: mpl_token_metadata::types::PrintArgs::V1 { edition: edition_number }, }; let mut print_request = crate::DevnetMetaplexTokenMetadataExecutionRequest::new( @@ -309,7 +309,7 @@ where ); print_request.query_role = options.query_role.clone(); print_request.transaction_role = options.transaction_role.clone(); - print_request.additional_authorized_signers = std::vec![kb_lib::MdPubkey(edition_mint.clone())]; + print_request.additional_authorized_signers = std::vec![ks_lib::MdPubkey(edition_mint.clone())]; print_request.submit = true; print_request.operator_confirmed = true; print_request.materialize_after_confirmation = true; @@ -359,7 +359,7 @@ where if master_supply_after_print != 1 || master_max_supply_after_print != std::option::Option::Some(1) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_master_post_print_invalid", format!( "confirmed Print must move master supply 0->1 while keeping max_supply=1; supply={master_supply_after_print}, max_supply={master_max_supply_after_print:?}" @@ -386,7 +386,7 @@ where { std::result::Result::Ok(std::option::Option::Some(value)) => value, std::result::Result::Ok(std::option::Option::None) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_edition_mint_missing_after_print", "printed mint is unavailable after confirmed Print", )); @@ -399,7 +399,7 @@ where 0, 1, ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_edition_mint_invalid_after_print", error.to_string(), )); @@ -414,7 +414,7 @@ where { std::result::Result::Ok(std::option::Option::Some(value)) => value, std::result::Result::Ok(std::option::Option::None) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_edition_token_missing_after_print", "printed token account is unavailable after confirmed Print", )); @@ -453,23 +453,23 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let burn_operation = kb_lib::ExMetaplexTokenMetadataOperation::Burn { - authority: kb_lib::MdPubkey(master.fixture.authority.clone()), + let burn_operation = ks_lib::ExMetaplexTokenMetadataOperation::Burn { + authority: ks_lib::MdPubkey(master.fixture.authority.clone()), collection_metadata: std::option::Option::None, - metadata: kb_lib::MdPubkey(edition_metadata.to_string()), - edition: std::option::Option::Some(kb_lib::MdPubkey(edition.to_string())), - mint: kb_lib::MdPubkey(edition_mint.clone()), - token: kb_lib::MdPubkey(edition_token_account.to_string()), - master_edition: std::option::Option::Some(kb_lib::MdPubkey( + metadata: ks_lib::MdPubkey(edition_metadata.to_string()), + edition: std::option::Option::Some(ks_lib::MdPubkey(edition.to_string())), + mint: ks_lib::MdPubkey(edition_mint.clone()), + token: ks_lib::MdPubkey(edition_token_account.to_string()), + master_edition: std::option::Option::Some(ks_lib::MdPubkey( master.fixture.master_edition.clone(), )), - master_edition_mint: std::option::Option::Some(kb_lib::MdPubkey( + master_edition_mint: std::option::Option::Some(ks_lib::MdPubkey( master.fixture.mint.clone(), )), - master_edition_token: std::option::Option::Some(kb_lib::MdPubkey( + master_edition_token: std::option::Option::Some(ks_lib::MdPubkey( master.fixture.token_account.clone(), )), - edition_marker: std::option::Option::Some(kb_lib::MdPubkey(edition_marker.to_string())), + edition_marker: std::option::Option::Some(ks_lib::MdPubkey(edition_marker.to_string())), token_record: std::option::Option::None, burn_args: mpl_token_metadata::types::BurnArgs::V1 { amount: 1 }, }; @@ -523,7 +523,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if master_max_supply_after_burn != std::option::Option::Some(1) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_master_max_supply_changed", format!( "Burn changed master max_supply unexpectedly to {master_max_supply_after_burn:?}" @@ -531,7 +531,7 @@ where )); } if master_supply_after_burn != 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_master_supply_not_decremented", format!( "confirmed Burn left master edition supply {master_supply_after_burn}, expected 0 after burning the only printed edition" @@ -548,7 +548,7 @@ where { std::result::Result::Ok(std::option::Option::Some(value)) => value, std::result::Result::Ok(std::option::Option::None) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_edition_mint_missing_after_burn", "classic printed-edition mint unexpectedly disappeared after Burn", )); @@ -561,7 +561,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if edition_supply_after_burn != 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_edition_supply_not_burned", format!( "confirmed Burn left printed mint supply {edition_supply_after_burn}, expected 0" @@ -620,7 +620,7 @@ where || edition_exists_after_burn || edition_marker_exists_after_burn { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_accounts_not_closed", format!( "confirmed Burn must close the printed token account, Edition and now-empty Edition Marker and must semantically close Metadata as absent or an exact one-byte uninitialized fee tombstone; token_exists={edition_token_exists_after_burn}, metadata_exists={edition_metadata_exists_after_burn}, metadata_fee_tombstone={edition_metadata_fee_tombstone_after_burn}, edition_exists={edition_exists_after_burn}, edition_marker_exists={edition_marker_exists_after_burn}" @@ -660,10 +660,10 @@ where }); } -fn parse_pubkey(value: &str, label: &str) -> kb_core::Result { +fn parse_pubkey(value: &str, label: &str) -> ks_core::Result { return match ::from_str(value) { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::config( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::config( format!("invalid {label} public key: {error}"), )), }; @@ -673,23 +673,23 @@ fn master_reads( fixture: &crate::MetaplexCreateFixturePreparationSummary, query_role: &str, min_context_slot: std::option::Option, -) -> std::vec::Vec { +) -> std::vec::Vec { return vec![ - kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { + ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: query_role.to_string(), - account: kb_lib::MdPubkey(fixture.metadata.clone()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::Metadata, + account: ks_lib::MdPubkey(fixture.metadata.clone()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::Metadata, min_context_slot, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }, - kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { + ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: query_role.to_string(), - account: kb_lib::MdPubkey(fixture.master_edition.clone()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::Edition { - mint: kb_lib::MdPubkey(fixture.mint.clone()), + account: ks_lib::MdPubkey(fixture.master_edition.clone()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::Edition { + mint: ks_lib::MdPubkey(fixture.mint.clone()), }, min_context_slot, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }, ]; } @@ -704,33 +704,33 @@ fn print_reads( edition_number: u64, query_role: &str, min_context_slot: std::option::Option, -) -> std::vec::Vec { +) -> std::vec::Vec { let mut reads = master_reads(master, query_role, min_context_slot); - reads.push(kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { + reads.push(ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: query_role.to_string(), - account: kb_lib::MdPubkey(edition_metadata.to_string()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::Metadata, + account: ks_lib::MdPubkey(edition_metadata.to_string()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::Metadata, min_context_slot, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }); - reads.push(kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { + reads.push(ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: query_role.to_string(), - account: kb_lib::MdPubkey(edition.to_string()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::Edition { - mint: kb_lib::MdPubkey(edition_mint.to_string()), + account: ks_lib::MdPubkey(edition.to_string()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::Edition { + mint: ks_lib::MdPubkey(edition_mint.to_string()), }, min_context_slot, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }); - reads.push(kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { + reads.push(ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: query_role.to_string(), - account: kb_lib::MdPubkey(edition_marker.to_string()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::EditionMarker { - mint: kb_lib::MdPubkey(master.mint.clone()), + account: ks_lib::MdPubkey(edition_marker.to_string()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::EditionMarker { + mint: ks_lib::MdPubkey(master.mint.clone()), edition: edition_number, }, min_context_slot, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }); return reads; } @@ -738,10 +738,10 @@ fn print_reads( fn confirmed_slot( step: &str, execution: &crate::DevnetMetaplexTokenMetadataExecutionSummary, -) -> kb_core::Result { +) -> ks_core::Result { return match execution.confirmation.as_ref().and_then(|value| return value.slot) { std::option::Option::Some(value) => std::result::Result::Ok(value), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_confirmation_slot_missing", format!("{step} has no confirmation slot"), )), @@ -751,9 +751,9 @@ fn confirmed_slot( fn validate_confirmed_execution( step: &str, execution: &crate::DevnetMetaplexTokenMetadataExecutionSummary, -) -> kb_core::Result { +) -> ks_core::Result { if !execution.simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_simulation_failed", format!("Metaplex {step} simulation failed"), )); @@ -762,20 +762,20 @@ fn validate_confirmed_execution( std::option::Option::Some(value) if matches!( value.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) => { value }, std::option::Option::Some(value) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_confirmation_incomplete", format!("Metaplex {step} stopped at {:?}", value.status), )); }, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_confirmation_missing", format!("Metaplex {step} has no confirmation evidence"), )); @@ -784,7 +784,7 @@ fn validate_confirmed_execution( let diagnostic = match execution.post_execution.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_post_execution_missing", format!("Metaplex {step} has no post-execution diagnostic"), )); @@ -808,7 +808,7 @@ fn validate_confirmed_execution( || execution.materialized_snapshots.is_empty() || !idempotence_clean { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_post_execution_incomplete", format!( "Metaplex {step} post-execution incomplete: signature={}, slot={:?}, canonical_inserted={}, core_extracted={}, decode_replayed={}, materialized={}, materialization_rows={}, materialized_snapshots={}, idempotence_clean={}, diagnostics={:?}", @@ -827,7 +827,7 @@ fn validate_confirmed_execution( } return match confirmation.slot { std::option::Option::Some(value) => std::result::Result::Ok(value), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_confirmation_slot_missing", format!("Metaplex {step} confirmation has no slot"), )), @@ -835,16 +835,16 @@ fn validate_confirmed_execution( } fn master_edition_state( - snapshots: &[kb_pipeline::MetaplexTokenMetadataStatefulReadResult], + snapshots: &[ks_pipeline::MetaplexTokenMetadataStatefulReadResult], master_edition: &str, -) -> kb_core::Result<(u64, std::option::Option)> { +) -> ks_core::Result<(u64, std::option::Option)> { let snapshot = match snapshots.iter().find(|value| { return value.snapshot.account.0.as_str() == master_edition && value.snapshot.account_kind == "edition"; }) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_master_edition_snapshot_missing", "master edition snapshot is missing", )); @@ -854,7 +854,7 @@ fn master_edition_state( match snapshot.snapshot.payload_json.get("supply").and_then(serde_json::Value::as_u64) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_master_supply_missing", "master edition payload has no numeric supply", )); @@ -869,13 +869,13 @@ fn master_edition_state( } fn validate_printed_stateful_accounts( - snapshots: &[kb_pipeline::MetaplexTokenMetadataStatefulReadResult], + snapshots: &[ks_pipeline::MetaplexTokenMetadataStatefulReadResult], edition_metadata: &str, edition: &str, edition_marker: &str, master_edition: &str, edition_number: u64, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let metadata = snapshots.iter().find(|value| { return value.snapshot.account.0.as_str() == edition_metadata && value.snapshot.account_kind == "metadata"; @@ -913,7 +913,7 @@ fn validate_printed_stateful_accounts( || observed_edition != std::option::Option::Some(edition_number) || edition_taken != std::option::Option::Some(true) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_printed_state_invalid", format!( "printed state mismatch: token_standard={token_standard:?}, parent={parent:?}, edition={observed_edition:?}, edition_taken={edition_taken:?}" @@ -924,17 +924,17 @@ fn validate_printed_stateful_accounts( } fn edition_taken( - snapshots: &[kb_pipeline::MetaplexTokenMetadataStatefulReadResult], + snapshots: &[ks_pipeline::MetaplexTokenMetadataStatefulReadResult], edition_marker: &str, edition_number: u64, -) -> kb_core::Result { +) -> ks_core::Result { let marker = match snapshots.iter().find(|value| { return value.snapshot.account.0.as_str() == edition_marker && value.snapshot.account_kind == "edition_marker"; }) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_edition_marker_missing", "edition marker snapshot is missing", )); @@ -943,7 +943,7 @@ fn edition_taken( if marker.snapshot.payload_json.get("edition").and_then(serde_json::Value::as_u64) != std::option::Option::Some(edition_number) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_edition_marker_number_mismatch", "edition marker snapshot targets another edition number", )); @@ -955,15 +955,15 @@ fn edition_taken( .and_then(serde_json::Value::as_bool) { std::option::Option::Some(value) => std::result::Result::Ok(value), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_print_burn_edition_marker_state_missing", "edition marker snapshot has no edition_taken flag", )), }; } -fn metadata_is_exact_fee_tombstone(account: &kb_onchain_transport::AccountInfoValue) -> bool { - return account.owner.0 == kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID +fn metadata_is_exact_fee_tombstone(account: &ks_onchain_transport::AccountInfoValue) -> bool { + return account.owner.0 == ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID && !account.executable && account.lamports > 0 && account.space == 1 @@ -971,21 +971,21 @@ fn metadata_is_exact_fee_tombstone(account: &kb_onchain_transport::AccountInfoVa } async fn metadata_closure_state_at_or_after( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, query_role: &str, account: &str, min_context_slot: u64, -) -> kb_core::Result<(bool, bool)> { - let config = match kb_onchain_transport::GetAccountInfoConfig::new_with_data( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, +) -> ks_core::Result<(bool, bool)> { + let config = match ks_onchain_transport::GetAccountInfoConfig::new_with_data( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, std::option::Option::Some(min_context_slot), - kb_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES, + ks_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; let result = match http_pool - .get_account_info_for_role(query_role, &kb_lib::MdPubkey(account.to_string()), &config) + .get_account_info_for_role(query_role, &ks_lib::MdPubkey(account.to_string()), &config) .await { std::result::Result::Ok(value) => value, @@ -1000,21 +1000,21 @@ async fn metadata_closure_state_at_or_after( } async fn account_exists_at_or_after( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, query_role: &str, account: &str, min_context_slot: u64, -) -> kb_core::Result { - let config = match kb_onchain_transport::GetAccountInfoConfig::new_with_data( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, +) -> ks_core::Result { + let config = match ks_onchain_transport::GetAccountInfoConfig::new_with_data( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, std::option::Option::Some(min_context_slot), - kb_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES, + ks_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; let result = match http_pool - .get_account_info_for_role(query_role, &kb_lib::MdPubkey(account.to_string()), &config) + .get_account_info_for_role(query_role, &ks_lib::MdPubkey(account.to_string()), &config) .await { std::result::Result::Ok(value) => value, @@ -1071,10 +1071,10 @@ mod tests { #[test] fn metadata_fee_tombstone_contract_is_exact() { - let mut account = kb_onchain_transport::AccountInfoValue { + let mut account = ks_onchain_transport::AccountInfoValue { lamports: 1, - owner: kb_lib::MdProgramId( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(), + owner: ks_lib::MdProgramId( + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(), ), executable: false, rent_epoch: 0, @@ -1091,7 +1091,7 @@ mod tests { account.lamports = 0; assert!(!super::metadata_is_exact_fee_tombstone(&account)); account.lamports = 1; - account.owner = kb_lib::MdProgramId(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()); + account.owner = ks_lib::MdProgramId(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()); assert!(!super::metadata_is_exact_fee_tombstone(&account)); } @@ -1099,12 +1099,12 @@ mod tests { account: std::string::String, kind: &str, payload_json: serde_json::Value, - ) -> kb_pipeline::MetaplexTokenMetadataStatefulReadResult { - return kb_pipeline::MetaplexTokenMetadataStatefulReadResult { + ) -> ks_pipeline::MetaplexTokenMetadataStatefulReadResult { + return ks_pipeline::MetaplexTokenMetadataStatefulReadResult { commitment: "confirmed".to_string(), context_slot: 1, - snapshot: kb_pipeline::MetaplexTokenMetadataStatefulSnapshot { - account: kb_lib::MdPubkey(account), + snapshot: ks_pipeline::MetaplexTokenMetadataStatefulSnapshot { + account: ks_lib::MdPubkey(account), account_kind: kind.to_string(), mint: std::option::Option::None, slot: 1, @@ -1182,7 +1182,7 @@ mod tests { }, std::result::Result::Err(_) => workspace_root.join("config/example.config.json"), }; - let config = kb_config::read_config_json_file_with_environment( + let config = ks_config::read_config_json_file_with_environment( config_path.as_path(), workspace_root, ) @@ -1194,16 +1194,16 @@ mod tests { .unwrap_or_else(|error| panic!("KB_POSTGRES_TEST_URL is required: {error}")); profile.database.backend = "postgres".to_string(); profile.database.postgres.url = database_url; - let pool = kb_onchain_transport::HttpEndpointPool::from_profile(&profile) + let pool = ks_onchain_transport::HttpEndpointPool::from_profile(&profile) .unwrap_or_else(|error| panic!("HTTP pool creation failed: {error}")); - let store_options = kb_store::PostgresStoreOptions::new( + let store_options = ks_store::PostgresStoreOptions::new( profile.database.postgres.url.clone(), profile.database.postgres.max_connections, profile.database.postgres.connect_timeout_ms, false, ) .unwrap_or_else(|error| panic!("PostgreSQL options failed: {error}")); - let store = kb_store::PostgresStore::connect(store_options) + let store = ks_store::PostgresStore::connect(store_options) .await .unwrap_or_else(|error| panic!("PostgreSQL connection failed: {error}")); if let std::result::Result::Err(error) = store.initialize_store_schema().await { diff --git a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/scenarios.rs b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/scenarios.rs similarity index 90% rename from kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/scenarios.rs rename to ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/scenarios.rs index 8a97ccb..c5e65fd 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/scenarios.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/scenarios.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/scenarios.rs -// version: 8 +// file: ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/scenarios.rs +// version: 9 //! Coherent Metaplex Token Metadata scenario journeys for tests and Devnet campaigns. @@ -147,9 +147,9 @@ pub fn metaplex_token_metadata_synthetic_scenarios() crate::MetaplexTokenMetadataFixtureState::MintPrepared, crate::MetaplexTokenMetadataFixtureState::MasterEditionCreated, vec![ - kb_lib::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION.to_string(), - kb_lib::EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION.to_string(), - kb_lib::EX_METAPLEX_TOKEN_METADATA_SET_TOKEN_STANDARD_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_SET_TOKEN_STANDARD_OPERATION.to_string(), ], false, false, @@ -163,9 +163,9 @@ pub fn metaplex_token_metadata_synthetic_scenarios() crate::MetaplexTokenMetadataFixtureState::MintPrepared, crate::MetaplexTokenMetadataFixtureState::Validated, vec![ - kb_lib::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION.to_string(), - kb_lib::EX_METAPLEX_TOKEN_METADATA_MINT_OPERATION.to_string(), - kb_lib::EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_MINT_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION.to_string(), ], false, false, @@ -179,8 +179,8 @@ pub fn metaplex_token_metadata_synthetic_scenarios() crate::MetaplexTokenMetadataFixtureState::MintPrepared, crate::MetaplexTokenMetadataFixtureState::Validated, vec![ - kb_lib::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION.to_string(), - kb_lib::EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION.to_string(), ], false, false, @@ -194,8 +194,8 @@ pub fn metaplex_token_metadata_synthetic_scenarios() crate::MetaplexTokenMetadataFixtureState::CollectionMemberUnverified, crate::MetaplexTokenMetadataFixtureState::CollectionMemberUnverified, vec![ - kb_lib::EX_METAPLEX_TOKEN_METADATA_VERIFY_OPERATION.to_string(), - kb_lib::EX_METAPLEX_TOKEN_METADATA_UNVERIFY_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_VERIFY_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_UNVERIFY_OPERATION.to_string(), ], true, false, @@ -209,11 +209,11 @@ pub fn metaplex_token_metadata_synthetic_scenarios() crate::MetaplexTokenMetadataFixtureState::ProgrammableTokenRecordCreated, crate::MetaplexTokenMetadataFixtureState::Validated, vec![ - kb_lib::EX_METAPLEX_TOKEN_METADATA_DELEGATE_OPERATION.to_string(), - kb_lib::EX_METAPLEX_TOKEN_METADATA_LOCK_OPERATION.to_string(), - kb_lib::EX_METAPLEX_TOKEN_METADATA_UNLOCK_OPERATION.to_string(), - kb_lib::EX_METAPLEX_TOKEN_METADATA_TRANSFER_OPERATION.to_string(), - kb_lib::EX_METAPLEX_TOKEN_METADATA_REVOKE_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_DELEGATE_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_LOCK_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_UNLOCK_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_TRANSFER_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_REVOKE_OPERATION.to_string(), ], false, true, @@ -297,14 +297,14 @@ pub fn metaplex_token_metadata_devnet_scenarios() }, if asset_family == crate::MetaplexTokenMetadataAssetFamily::Nft { vec![ - kb_lib::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION.to_string(), - kb_lib::EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION.to_string(), - kb_lib::EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION.to_string(), ] } else { vec![ - kb_lib::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION.to_string(), - kb_lib::EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION.to_string(), ] }, requires_collection, @@ -348,8 +348,8 @@ mod tests { assert_eq!( scenario.operation_codes, vec![ - kb_lib::EX_METAPLEX_TOKEN_METADATA_VERIFY_OPERATION.to_string(), - kb_lib::EX_METAPLEX_TOKEN_METADATA_UNVERIFY_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_VERIFY_OPERATION.to_string(), + ks_lib::EX_METAPLEX_TOKEN_METADATA_UNVERIFY_OPERATION.to_string(), ] ); assert_eq!( @@ -392,11 +392,11 @@ mod tests { assert_eq!(scenario.operation_codes.len(), expected_len); assert_eq!( scenario.operation_codes[0], - kb_lib::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION + ks_lib::EX_METAPLEX_TOKEN_METADATA_CREATE_OPERATION ); assert!( scenario.operation_codes[1..].iter().all(|operation| return operation - == kb_lib::EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION) + == ks_lib::EX_METAPLEX_TOKEN_METADATA_UPDATE_OPERATION) ); assert_eq!(scenario.mode, crate::MetaplexTokenMetadataScenarioMode::NetworkSimulation); } diff --git a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/use_campaign.rs b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/use_campaign.rs similarity index 86% rename from kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/use_campaign.rs rename to ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/use_campaign.rs index e5ee922..14aa8c3 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/use_campaign.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/use_campaign.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/use_campaign.rs -// version: 1 +// file: ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/use_campaign.rs +// version: 2 //! Bounded Devnet availability probe for the current Metaplex `Use` surface. @@ -39,22 +39,22 @@ pub fn metaplex_use_probe_operation_names() -> &'static [&'static str; 3] { /// Executes one fresh classic NFT `Use` availability probe on Devnet. #[allow(clippy::too_many_arguments)] pub async fn execute_devnet_metaplex_use_probe( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::MetaplexCreateFixturePreparationOptions, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { if options.asset_family != crate::MetaplexTokenMetadataAssetFamily::Nft { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex Use probe requires the classic NFT fixture family", )); } @@ -81,7 +81,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if uses_before != 2 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_use_probe_initial_uses_invalid", format!("Metaplex Use probe requires remaining=2 before execution; got {uses_before}"), )); @@ -118,14 +118,14 @@ where uses_after: std::option::Option::None, }); } - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcMetadataMetaplexTokenMetadataDecoder)]; - let materializers: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::MtAdminMaterializer), - std::sync::Arc::new(kb_lib::MtComplianceAuditMaterializer), - std::sync::Arc::new(kb_lib::MtLifecycleMaterializer), - std::sync::Arc::new(kb_lib::MtMetadataMetaplexTokenMetadataMaterializer), - std::sync::Arc::new(kb_lib::MtRiskMaterializer), + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcMetadataMetaplexTokenMetadataDecoder)]; + let materializers: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::MtAdminMaterializer), + std::sync::Arc::new(ks_lib::MtComplianceAuditMaterializer), + std::sync::Arc::new(ks_lib::MtLifecycleMaterializer), + std::sync::Arc::new(ks_lib::MtMetadataMetaplexTokenMetadataMaterializer), + std::sync::Arc::new(ks_lib::MtRiskMaterializer), ]; let mut execution_request = crate::DevnetMetaplexTokenMetadataExecutionRequest::new( format!("metaplex-use-probe-submit-{}", uuid::Uuid::new_v4()), @@ -167,7 +167,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if uses_after != 1 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_use_probe_remaining_uses_invalid", format!( "confirmed Metaplex Use must decrement remaining uses from 2 to 1; got {uses_after}" @@ -184,7 +184,7 @@ where { std::result::Result::Ok(std::option::Option::Some(value)) => value, std::result::Result::Ok(std::option::Option::None) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_use_probe_token_missing", "classic NFT token account disappeared after confirmed Use", )); @@ -198,7 +198,7 @@ where 1, spl_token_interface::state::AccountState::Initialized, ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_use_probe_token_state_invalid", format!("confirmed Metaplex Use left invalid NFT token state: {error}"), )); @@ -216,21 +216,21 @@ where fn use_operation( fixture: &crate::MetaplexCreateFixturePreparationSummary, -) -> kb_lib::ExMetaplexTokenMetadataOperation { - return kb_lib::ExMetaplexTokenMetadataOperation::Use { - authority: kb_lib::MdPubkey(fixture.authority.clone()), +) -> ks_lib::ExMetaplexTokenMetadataOperation { + return ks_lib::ExMetaplexTokenMetadataOperation::Use { + authority: ks_lib::MdPubkey(fixture.authority.clone()), delegate_record: std::option::Option::None, - token: std::option::Option::Some(kb_lib::MdPubkey(fixture.token_account.clone())), - mint: kb_lib::MdPubkey(fixture.mint.clone()), - metadata: kb_lib::MdPubkey(fixture.metadata.clone()), - edition: std::option::Option::Some(kb_lib::MdPubkey(fixture.master_edition.clone())), - payer: kb_lib::MdPubkey(fixture.authority.clone()), - system_program: kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), - sysvar_instructions: kb_lib::MdPubkey( - kb_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID.to_string(), + token: std::option::Option::Some(ks_lib::MdPubkey(fixture.token_account.clone())), + mint: ks_lib::MdPubkey(fixture.mint.clone()), + metadata: ks_lib::MdPubkey(fixture.metadata.clone()), + edition: std::option::Option::Some(ks_lib::MdPubkey(fixture.master_edition.clone())), + payer: ks_lib::MdPubkey(fixture.authority.clone()), + system_program: ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), + sysvar_instructions: ks_lib::MdPubkey( + ks_program_ids::SYSVAR_INSTRUCTIONS_PROGRAM_ID.to_string(), ), - spl_token_program: std::option::Option::Some(kb_lib::MdPubkey( - kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string(), + spl_token_program: std::option::Option::Some(ks_lib::MdPubkey( + ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string(), )), authorization_rules_program: std::option::Option::None, authorization_rules: std::option::Option::None, @@ -243,28 +243,28 @@ fn use_operation( fn metadata_read( metadata: &str, query_role: &str, -) -> std::vec::Vec { - return std::vec![kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { +) -> std::vec::Vec { + return std::vec![ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: query_role.to_string(), - account: kb_lib::MdPubkey(metadata.to_string()), - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::Metadata, + account: ks_lib::MdPubkey(metadata.to_string()), + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::Metadata, min_context_slot: std::option::Option::None, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }]; } fn metadata_remaining_multiple_uses( - snapshots: &[kb_pipeline::MetaplexTokenMetadataStatefulReadResult], + snapshots: &[ks_pipeline::MetaplexTokenMetadataStatefulReadResult], metadata: &str, expected_total: u64, -) -> kb_core::Result { +) -> ks_core::Result { let snapshot = match snapshots.iter().find(|value| { return value.snapshot.account.0.as_str() == metadata && value.snapshot.account_kind == "metadata"; }) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_use_probe_metadata_snapshot_missing", format!("metadata snapshot {metadata} is missing from the Use probe"), )); @@ -273,7 +273,7 @@ fn metadata_remaining_multiple_uses( let uses_value = match snapshot.snapshot.payload_json.get("uses") { std::option::Option::Some(value) if !value.is_null() => value.clone(), _ => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_use_probe_uses_missing", "metadata snapshot has no Uses state", )); @@ -282,7 +282,7 @@ fn metadata_remaining_multiple_uses( let uses = match serde_json::from_value::(uses_value) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_use_probe_uses_decode_failed", format!("metadata Uses projection is invalid: {error}"), )); @@ -292,7 +292,7 @@ fn metadata_remaining_multiple_uses( || uses.total != expected_total || uses.remaining > uses.total { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_use_probe_uses_state_invalid", format!( "metadata Uses state must remain Multiple with total={expected_total}; got method={:?}, remaining={}, total={}", @@ -305,25 +305,25 @@ fn metadata_remaining_multiple_uses( fn validate_confirmed_use_execution( execution: &crate::DevnetMetaplexTokenMetadataExecutionSummary, -) -> kb_core::Result { +) -> ks_core::Result { let confirmation = match execution.confirmation.as_ref() { std::option::Option::Some(value) if matches!( value.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) => { value }, std::option::Option::Some(value) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_use_probe_confirmation_incomplete", format!("Metaplex Use stopped at {:?}", value.status), )); }, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_use_probe_confirmation_missing", "Metaplex Use has no confirmation evidence", )); @@ -332,7 +332,7 @@ fn validate_confirmed_use_execution( let diagnostic = match execution.post_execution.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_use_probe_post_execution_missing", "Metaplex Use has no post-execution diagnostic", )); @@ -345,7 +345,7 @@ fn validate_confirmed_use_execution( || execution.materializations.is_empty() || execution.materialized_snapshots.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_use_probe_post_execution_incomplete", format!( "Metaplex Use post-execution incomplete: signature={}, slot={:?}, canonical_inserted={}, core_extracted={}, decode_replayed={}, materialized={}, materialization_rows={}, materialized_snapshots={}, diagnostics={:?}", @@ -364,7 +364,7 @@ fn validate_confirmed_use_execution( let idempotence = match execution.idempotence_replay.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_use_probe_idempotence_missing", "Metaplex Use has no idempotence replay evidence", )); @@ -379,14 +379,14 @@ fn validate_confirmed_use_execution( || processor.materialization_refused != 0; }) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_use_probe_idempotence_failed", "Metaplex Use second replay is not idempotent", )); } return match confirmation.slot { std::option::Option::Some(value) => std::result::Result::Ok(value), - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metaplex_use_probe_confirmation_slot_missing", "Metaplex Use confirmation has no slot", )), @@ -427,7 +427,7 @@ mod tests { }, std::result::Result::Err(_) => workspace_root.join("config/example.config.json"), }; - let config = kb_config::read_config_json_file_with_environment( + let config = ks_config::read_config_json_file_with_environment( config_path.as_path(), workspace_root, ) @@ -439,16 +439,16 @@ mod tests { .unwrap_or_else(|error| panic!("KB_POSTGRES_TEST_URL is required: {error}")); profile.database.backend = "postgres".to_string(); profile.database.postgres.url = database_url; - let http_pool = kb_onchain_transport::HttpEndpointPool::from_profile(&profile) + let http_pool = ks_onchain_transport::HttpEndpointPool::from_profile(&profile) .unwrap_or_else(|error| panic!("HTTP pool initialization failed: {error}")); - let store_options = kb_store::PostgresStoreOptions::new( + let store_options = ks_store::PostgresStoreOptions::new( profile.database.postgres.url.clone(), profile.database.postgres.max_connections, profile.database.postgres.connect_timeout_ms, false, ) .unwrap_or_else(|error| panic!("PostgreSQL options failed: {error}")); - let store = kb_store::PostgresStore::connect(store_options) + let store = ks_store::PostgresStore::connect(store_options) .await .unwrap_or_else(|error| panic!("PostgreSQL connection failed: {error}")); if let std::result::Result::Err(error) = store.initialize_store_schema().await { diff --git a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/validation.rs b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/validation.rs similarity index 94% rename from kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/validation.rs rename to ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/validation.rs index 061bba7..1701381 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/validation.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/validation.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/validation.rs -// version: 17 +// file: ks-pipeline-demo-scenarios/src/metadata/metaplex_token_metadata/validation.rs +// version: 18 //! Machine-readable Metaplex Token Metadata validation contract. @@ -151,7 +151,7 @@ pub struct MetaplexTokenMetadataCrossValidationMatrix { /// Loads and validates the closed Metaplex cross-validation corpus. pub fn load_metaplex_token_metadata_cross_validation_matrix() --> kb_core::Result { +-> ks_core::Result { let parsed = match serde_json::from_str::( include_str!( "../../../../test-fixtures/contract-matrices/METAPLEX_TOKEN_METADATA_CROSS_VALIDATION_MATRIX.json" @@ -159,7 +159,7 @@ pub fn load_metaplex_token_metadata_cross_validation_matrix() ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_token_metadata_cross_validation_matrix_invalid_json", format!("Metaplex cross-validation matrix JSON is invalid: {error}"), )); @@ -176,9 +176,9 @@ pub fn load_metaplex_token_metadata_cross_validation_matrix() /// Validates the closed Metaplex cross-validation corpus and evidence claims. pub fn validate_metaplex_token_metadata_cross_validation_matrix( matrix: &crate::MetaplexTokenMetadataCrossValidationMatrix, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if matrix.matrix_version != 1 || matrix.milestone != "0.4.7-pre.010" { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_token_metadata_cross_validation_matrix_contract_mismatch", "Metaplex cross-validation matrix must use version 1 for 0.4.7-pre.010", )); @@ -186,13 +186,13 @@ pub fn validate_metaplex_token_metadata_cross_validation_matrix( let mut ids = std::collections::BTreeSet::<&str>::new(); for case in &matrix.cases { if !ids.insert(case.id.as_str()) || case.required_evidence.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_token_metadata_cross_validation_case_invalid", "Metaplex cross-validation cases must be unique and declare evidence", )); } if case.evidence.len() > crate::MAX_METAPLEX_TOKEN_METADATA_VALIDATION_EVIDENCE { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_token_metadata_cross_validation_evidence_limit_exceeded", "Metaplex cross-validation evidence exceeds the compiled bound", )); @@ -200,7 +200,7 @@ pub fn validate_metaplex_token_metadata_cross_validation_matrix( if case.outcome == crate::MetaplexTokenMetadataTransactionOutcome::Success && case.asset_family.is_none() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_token_metadata_cross_validation_success_without_asset_family", "Successful Metaplex corpus cases must identify an asset family", )); @@ -208,7 +208,7 @@ pub fn validate_metaplex_token_metadata_cross_validation_matrix( if case.outcome == crate::MetaplexTokenMetadataTransactionOutcome::Failed && case.failure_class.is_none() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_token_metadata_cross_validation_failure_without_class", "Failed Metaplex corpus cases must identify a failure class", )); @@ -219,7 +219,7 @@ pub fn validate_metaplex_token_metadata_cross_validation_matrix( | crate::MetaplexTokenMetadataValidationStatus::Unavailable ) && !case.evidence.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_token_metadata_cross_validation_unobserved_with_evidence", "Not-run or unavailable cross-validation cases must not contain evidence", )); @@ -230,7 +230,7 @@ pub fn validate_metaplex_token_metadata_cross_validation_matrix( crate::MetaplexTokenMetadataValidationStatus::SyntheticValidated ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_token_metadata_cross_validation_network_overdeclared", "Network cases cannot be declared validated from synthetic evidence", )); @@ -251,7 +251,7 @@ pub fn validate_metaplex_token_metadata_cross_validation_matrix( .iter() .all(|kind| return observed.contains(kind.as_str())) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_token_metadata_cross_validation_status_without_required_evidence", "Observed Metaplex network status lacks required evidence", )); @@ -263,7 +263,7 @@ pub fn validate_metaplex_token_metadata_cross_validation_matrix( /// Loads and validates the canonical Metaplex validation matrix. pub fn load_metaplex_token_metadata_validation_matrix() --> kb_core::Result { +-> ks_core::Result { let parsed = match serde_json::from_str::( include_str!( "../../../../test-fixtures/contract-matrices/METAPLEX_TOKEN_METADATA_VALIDATION_MATRIX.json" @@ -271,7 +271,7 @@ pub fn load_metaplex_token_metadata_validation_matrix() ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_token_metadata_validation_matrix_invalid_json", format!("Metaplex validation matrix JSON is invalid: {error}"), )); @@ -288,9 +288,9 @@ pub fn load_metaplex_token_metadata_validation_matrix() /// Validates the canonical Metaplex validation matrix. pub fn validate_metaplex_token_metadata_validation_matrix( matrix: &crate::MetaplexTokenMetadataValidationMatrix, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if matrix.matrix_version != 1 || matrix.milestone != "0.4.7" { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_token_metadata_validation_matrix_contract_mismatch", "Metaplex validation matrix must use version 1 for milestone 0.4.7", )); @@ -305,7 +305,7 @@ pub fn validate_metaplex_token_metadata_validation_matrix( .map(|scenario| return scenario.id.clone()) .collect::>(); if actual != expected { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_token_metadata_validation_matrix_inventory_mismatch", "Metaplex validation matrix inventory differs from the compiled scenario inventory", )); @@ -313,13 +313,13 @@ pub fn validate_metaplex_token_metadata_validation_matrix( let mut ids = std::collections::BTreeSet::<&str>::new(); for scenario in &matrix.scenarios { if !ids.insert(scenario.id.as_str()) || scenario.required_evidence.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_token_metadata_validation_matrix_scenario_invalid", "Metaplex validation scenarios must be unique and declare required evidence", )); } if scenario.evidence.len() > crate::MAX_METAPLEX_TOKEN_METADATA_VALIDATION_EVIDENCE { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_token_metadata_validation_evidence_limit_exceeded", "Metaplex validation evidence exceeds the compiled bound", )); @@ -330,7 +330,7 @@ pub fn validate_metaplex_token_metadata_validation_matrix( | crate::MetaplexTokenMetadataValidationStatus::Unavailable ) && !scenario.evidence.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_token_metadata_validation_unobserved_with_evidence", "Not-run or unavailable Metaplex scenarios must not contain evidence", )); @@ -346,7 +346,7 @@ pub fn validate_metaplex_token_metadata_validation_matrix( .iter() .all(|kind| return observed.contains(kind.as_str())) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_token_metadata_validation_confirmed_without_required_evidence", "Confirmed Metaplex scenario lacks required evidence", )); @@ -499,7 +499,7 @@ pub struct MetaplexTokenMetadataDevnetExecutionMatrix { /// Loads and validates the closed Devnet execution matrix. pub fn load_metaplex_token_metadata_devnet_execution_matrix() --> kb_core::Result { +-> ks_core::Result { let matrix = match serde_json::from_str::( include_str!( "../../../../test-fixtures/contract-matrices/METAPLEX_TOKEN_METADATA_DEVNET_EXECUTION_MATRIX.json" @@ -507,7 +507,7 @@ pub fn load_metaplex_token_metadata_devnet_execution_matrix() ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_devnet_execution_matrix_invalid_json", format!("Metaplex Devnet execution matrix JSON is invalid: {error}"), )); @@ -524,13 +524,13 @@ pub fn load_metaplex_token_metadata_devnet_execution_matrix() /// Validates exact current-operation coverage and conservative network statuses. pub fn validate_metaplex_token_metadata_devnet_execution_matrix( matrix: &crate::MetaplexTokenMetadataDevnetExecutionMatrix, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if matrix.matrix_version != 3 || matrix.milestone != "0.4.8-pre.013" - || matrix.program_id != kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID + || matrix.program_id != ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID || matrix.operations.len() != 20 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_devnet_execution_matrix_contract_mismatch", "Metaplex Devnet matrix must use version 3 and declare exactly 20 current operations for 0.4.8-pre.013", )); @@ -565,7 +565,7 @@ pub fn validate_metaplex_token_metadata_devnet_execution_matrix( .map(|operation| return operation.operation_code.as_str()) .collect::>(); if observed != expected { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_devnet_execution_matrix_operation_mismatch", "Metaplex Devnet matrix must cover the exact 20 current operation codes", )); @@ -616,7 +616,7 @@ pub fn validate_metaplex_token_metadata_devnet_execution_matrix( ) || operation.evidence.len() > crate::MAX_METAPLEX_TOKEN_METADATA_VALIDATION_EVIDENCE { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_devnet_execution_matrix_entry_invalid", "Metaplex Devnet entries must be current, implemented, evidenced and conservatively classified", )); @@ -627,7 +627,7 @@ pub fn validate_metaplex_token_metadata_devnet_execution_matrix( .copied() .collect::>(); if observed_families.len() != operation.observed_families.len() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_devnet_execution_matrix_duplicate_family", "Metaplex Devnet observed families must be unique", )); @@ -638,7 +638,7 @@ pub fn validate_metaplex_token_metadata_devnet_execution_matrix( || evidence.value.trim().is_empty() || !observed_evidence.insert(evidence.kind.as_str()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_devnet_execution_matrix_evidence_invalid", "Metaplex Devnet operation-level evidence kinds and values must be non-empty and unique", )); @@ -651,7 +651,7 @@ pub fn validate_metaplex_token_metadata_devnet_execution_matrix( || family_evidence.evidence.len() > crate::MAX_METAPLEX_TOKEN_METADATA_VALIDATION_EVIDENCE { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_devnet_execution_matrix_family_evidence_invalid", "Metaplex Devnet family evidence bundles must be unique and bounded", )); @@ -662,7 +662,7 @@ pub fn validate_metaplex_token_metadata_devnet_execution_matrix( || evidence.value.trim().is_empty() || !family_kinds.insert(evidence.kind.as_str()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_devnet_execution_matrix_family_evidence_entry_invalid", "Metaplex Devnet family evidence kinds and values must be non-empty and unique", )); @@ -674,7 +674,7 @@ pub fn validate_metaplex_token_metadata_devnet_execution_matrix( .iter() .any(|kind| return !family_kinds.contains(kind.as_str())) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_devnet_execution_matrix_family_simulation_evidence_incomplete", "Simulated Metaplex Devnet family evidence must contain every required simulation evidence kind", )); @@ -686,7 +686,7 @@ pub fn validate_metaplex_token_metadata_devnet_execution_matrix( .chain(operation.submission_evidence.iter()) .any(|kind| return !family_kinds.contains(kind.as_str())) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_devnet_execution_matrix_family_confirmation_evidence_incomplete", "Confirmed Metaplex Devnet family evidence must contain every simulation and submission evidence kind", )); @@ -698,7 +698,7 @@ pub fn validate_metaplex_token_metadata_devnet_execution_matrix( || !operation.evidence.is_empty() || !operation.family_evidence.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_devnet_execution_matrix_not_run_with_evidence", "Not-run Metaplex Devnet operations cannot claim families or evidence", )); @@ -709,7 +709,7 @@ pub fn validate_metaplex_token_metadata_devnet_execution_matrix( || !operation.evidence.is_empty() || observed_family_evidence != observed_families { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_devnet_execution_matrix_family_evidence_mismatch", "Simulated or confirmed Metaplex Devnet operations require exactly one complete evidence bundle per observed family and no aggregate operation evidence", )); @@ -720,7 +720,7 @@ pub fn validate_metaplex_token_metadata_devnet_execution_matrix( || !operation.family_evidence.is_empty() || !observed_evidence.contains("unavailable_reason") { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_devnet_execution_matrix_unavailable_without_reason", "Unavailable Metaplex Devnet operations require an unavailable_reason and no observed family evidence", )); diff --git a/kb-pipeline-demo-scenarios/src/metadata/solana_program.rs b/ks-pipeline-demo-scenarios/src/metadata/solana_program.rs similarity index 72% rename from kb-pipeline-demo-scenarios/src/metadata/solana_program.rs rename to ks-pipeline-demo-scenarios/src/metadata/solana_program.rs index f6bcefc..16b8303 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/solana_program.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/solana_program.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/solana_program.rs -// version: 1 +// file: ks-pipeline-demo-scenarios/src/metadata/solana_program.rs +// version: 2 //! Solana Program Metadata demo and Devnet validation scenarios. diff --git a/kb-pipeline-demo-scenarios/src/metadata/solana_program/campaign.rs b/ks-pipeline-demo-scenarios/src/metadata/solana_program/campaign.rs similarity index 88% rename from kb-pipeline-demo-scenarios/src/metadata/solana_program/campaign.rs rename to ks-pipeline-demo-scenarios/src/metadata/solana_program/campaign.rs index 2f710a4..209c377 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/solana_program/campaign.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/solana_program/campaign.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/solana_program/campaign.rs -// version: 3 +// file: ks-pipeline-demo-scenarios/src/metadata/solana_program/campaign.rs +// version: 4 //! Ordered confirmed Devnet campaign for all Solana Program Metadata operations. @@ -30,17 +30,17 @@ pub struct DevnetSolanaProgramMetadataCampaignSummary { /// The campaign always submits transactions. The caller must explicitly confirm /// both fixture prefunding and all subsequent state mutations. pub async fn execute_devnet_solana_program_metadata_campaign( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::SolanaProgramMetadataFixturePreparationOptions, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where O: crate::SolanaExecutionObserver, { if !options.operator_confirmed { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Solana Program Metadata Devnet campaign requires explicit operator confirmation", )); } @@ -78,13 +78,13 @@ where let confirmed = match execution.confirmation.as_ref() { std::option::Option::Some(value) => matches!( value.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ), std::option::Option::None => false, }; if !confirmed || execution.post_execution.is_none() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_campaign_step_not_confirmed", format!( "campaign step {} did not reach confirmed stateful completion", @@ -92,10 +92,10 @@ where ), )); } - if prepared.operation.operation_code() != kb_lib::EX_METADATA_SPM_CLOSE_OPERATION + if prepared.operation.operation_code() != ks_lib::EX_METADATA_SPM_CLOSE_OPERATION && execution.materialized_snapshots.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_campaign_snapshot_missing", format!( "campaign step {} did not produce its required materialized snapshot", diff --git a/kb-pipeline-demo-scenarios/src/metadata/solana_program/devnet_execution.rs b/ks-pipeline-demo-scenarios/src/metadata/solana_program/devnet_execution.rs similarity index 76% rename from kb-pipeline-demo-scenarios/src/metadata/solana_program/devnet_execution.rs rename to ks-pipeline-demo-scenarios/src/metadata/solana_program/devnet_execution.rs index 3fb6a0c..8a83fa6 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/solana_program/devnet_execution.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/solana_program/devnet_execution.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/solana_program/devnet_execution.rs -// version: 2 +// file: ks-pipeline-demo-scenarios/src/metadata/solana_program/devnet_execution.rs +// version: 3 //! Real Devnet simulation and controlled submission for Solana Program Metadata. @@ -13,13 +13,13 @@ pub struct DevnetSolanaProgramMetadataExecutionRequest { /// Endpoint role used for simulation, submission and confirmation. pub transaction_role: std::string::String, /// Exact stable Solana Program Metadata operation. - pub operation: kb_lib::ExMetadataSpmOperation, + pub operation: ks_lib::ExMetadataSpmOperation, /// Bounded state reads required before execution. - pub preflight_reads: std::vec::Vec, + pub preflight_reads: std::vec::Vec, /// Explicit rent observations required by allocation and growth operations. - pub rent_observations: std::vec::Vec, + pub rent_observations: std::vec::Vec, /// Bounded state reads repeated after confirmed submission. - pub postcondition_reads: std::vec::Vec, + pub postcondition_reads: std::vec::Vec, /// Explicit approval for overwrite, destructive or irreversible operations. pub allow_destructive_operation: bool, /// Explicitly authorizes signing and submission after successful simulation. @@ -34,7 +34,7 @@ impl crate::DevnetSolanaProgramMetadataExecutionRequest { /// Creates a conservative simulation-only request. pub fn new( intent_id: impl std::convert::Into, - operation: kb_lib::ExMetadataSpmOperation, + operation: ks_lib::ExMetadataSpmOperation, ) -> Self { return Self { intent_id: intent_id.into(), @@ -55,17 +55,17 @@ impl crate::DevnetSolanaProgramMetadataExecutionRequest { pub fn from_operation_json( intent_id: impl std::convert::Into, operation_json: &str, - ) -> kb_core::Result { + ) -> ks_core::Result { if operation_json.contains('<') || operation_json.trim() == "..." { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Solana Program Metadata operation JSON still contains a placeholder", )); } - let operation = match serde_json::from_str::(operation_json) + let operation = match serde_json::from_str::(operation_json) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid typed Solana Program Metadata operation JSON: {error}" ))); }, @@ -74,40 +74,40 @@ impl crate::DevnetSolanaProgramMetadataExecutionRequest { } /// Validates request-local bounds independently from one profile. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Solana Program Metadata Devnet intent id must not be empty", )); } if self.query_role.trim().is_empty() || self.transaction_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Solana Program Metadata endpoint roles must not be empty", )); } if self.preflight_reads.is_empty() || self.preflight_reads.len() - > kb_pipeline::MAX_SOLANA_PROGRAM_METADATA_PREFLIGHT_ACCOUNTS + > ks_pipeline::MAX_SOLANA_PROGRAM_METADATA_PREFLIGHT_ACCOUNTS || self.postcondition_reads.len() - > kb_pipeline::MAX_SOLANA_PROGRAM_METADATA_PREFLIGHT_ACCOUNTS + > ks_pipeline::MAX_SOLANA_PROGRAM_METADATA_PREFLIGHT_ACCOUNTS { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Solana Program Metadata stateful read inventory is empty or above the compiled bound", )); } if self.operation.requires_explicit_approval() && !self.allow_destructive_operation { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_destructive_approval_required", "destructive Solana Program Metadata execution requires explicit approval", )); } if self.submit && self.postcondition_reads.is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "submitted Solana Program Metadata execution requires postcondition reads", )); } if self.materialize_after_confirmation && self.postcondition_reads.is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Solana Program Metadata materialization requires postcondition reads", )); } @@ -121,59 +121,59 @@ pub struct DevnetSolanaProgramMetadataExecutionSummary { /// Profile used by the orchestration. pub profile_name: std::string::String, /// Exact classified cluster. - pub cluster: kb_lib::ExApiExecutionCluster, + pub cluster: ks_lib::ExApiExecutionCluster, /// Genesis hash returned by the selected endpoint. pub genesis_hash: std::string::String, /// Non-secret persistent wallet description. - pub wallet: kb_wallet::WalletSummary, + pub wallet: ks_wallet::WalletSummary, /// Wallet balance observed before planning. pub balance_lamports: u64, /// Stateful snapshots observed before simulation. - pub before: std::vec::Vec, + pub before: std::vec::Vec, /// Stateful preflight report bound to the exact plan. - pub stateful_preflight: kb_pipeline::SolanaProgramMetadataPreflightReport, + pub stateful_preflight: ks_pipeline::SolanaProgramMetadataPreflightReport, /// Exact prepared plan. - pub plan: kb_lib::ExApiPreparedExecutionPlan, + pub plan: ks_lib::ExApiPreparedExecutionPlan, /// Recent blockhash used by the exact transaction. - pub latest_blockhash: kb_onchain_transport::LatestBlockhashResult, + pub latest_blockhash: ks_onchain_transport::LatestBlockhashResult, /// Fee estimate for the exact compiled message. - pub fee: kb_onchain_transport::FeeForMessageResult, + pub fee: ks_onchain_transport::FeeForMessageResult, /// Exact real RPC simulation result. - pub simulation: kb_lib::ExApiExecutionSimulationResult, + pub simulation: ks_lib::ExApiExecutionSimulationResult, /// Readiness report proving exact-message simulation and signer resolution. - pub readiness: kb_pipeline::SolanaProgramMetadataExecutionReadinessReport, + pub readiness: ks_pipeline::SolanaProgramMetadataExecutionReadinessReport, /// Submission result when explicitly authorized. - pub send_result: std::option::Option, + pub send_result: std::option::Option, /// Confirmation result when submitted. - pub confirmation: std::option::Option, + pub confirmation: std::option::Option, /// Stateful snapshots observed after confirmed submission. - pub after: std::vec::Vec, + pub after: std::vec::Vec, /// Stateful postcondition report after confirmed submission. - pub post_execution: std::option::Option, + pub post_execution: std::option::Option, /// Canonical projections emitted from confirmed account snapshots. - pub materialized_snapshots: std::vec::Vec, + pub materialized_snapshots: std::vec::Vec, } struct PreparedSolanaProgramMetadataExecution { - wallet: kb_wallet::TemporaryWallet, - unsigned: kb_lib::ExSolanaUnsignedTransaction, - evidence: kb_lib::ExSolanaSimulationEvidence, + wallet: ks_wallet::TemporaryWallet, + unsigned: ks_lib::ExSolanaUnsignedTransaction, + evidence: ks_lib::ExSolanaSimulationEvidence, summary: crate::DevnetSolanaProgramMetadataExecutionSummary, } /// Simulates one stable Solana Program Metadata operation against Devnet. pub async fn simulate_devnet_solana_program_metadata( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetSolanaProgramMetadataExecutionRequest, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where O: crate::SolanaExecutionObserver, { if request.submit { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "simulate_devnet_solana_program_metadata requires submit=false", )); } @@ -187,12 +187,12 @@ where /// Executes one Solana Program Metadata simulation or authorized submission. pub async fn execute_devnet_solana_program_metadata( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetSolanaProgramMetadataExecutionRequest, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where O: crate::SolanaExecutionObserver, { @@ -205,7 +205,7 @@ where return std::result::Result::Ok(prepared.summary); } if !prepared.summary.simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_simulation_failed", crate::simulation_failure_message(&prepared.summary.simulation), )); @@ -216,14 +216,14 @@ where ) { return std::result::Result::Err(error); } - let send_evaluation = match kb_lib::ExSafetyChecker + let send_evaluation = match ks_lib::ExSafetyChecker .evaluate_send(&prepared.summary.plan, &prepared.summary.simulation) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if send_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if send_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "execution_send_denied", crate::violation_message(send_evaluation.violations.as_slice()), )); @@ -240,7 +240,7 @@ where } let signature = signed.primary_signature().clone(); let mut summary = prepared.summary; - let send_config = match kb_onchain_transport::SendTransactionConfig::from_execution_config( + let send_config = match ks_onchain_transport::SendTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(summary.latest_blockhash.context.slot), ) { @@ -260,9 +260,9 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; summary.send_result = - std::option::Option::Some(sent.to_execution_result(kb_lib::ExApiExecutionCluster::Devnet)); + std::option::Option::Some(sent.to_execution_result(ks_lib::ExApiExecutionCluster::Devnet)); let confirmation_config = - match kb_onchain_transport::ConfirmTransactionConfig::from_execution_config( + match ks_onchain_transport::ConfirmTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(summary.latest_blockhash.last_valid_block_height), std::option::Option::Some(summary.latest_blockhash.context.slot), @@ -274,7 +274,7 @@ where .confirm_transaction_for_roles( request.transaction_role.as_str(), request.query_role.as_str(), - kb_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionCluster::Devnet, &signature, &confirmation_config, ) @@ -285,8 +285,8 @@ where }; let confirmed = matches!( confirmation.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ); summary.confirmation = std::option::Option::Some(confirmation); if confirmed { @@ -294,8 +294,8 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let report = match kb_pipeline::inspect_solana_program_metadata_post_execution( - &kb_pipeline::SolanaProgramMetadataPostExecutionRequest { + let report = match ks_pipeline::inspect_solana_program_metadata_post_execution( + &ks_pipeline::SolanaProgramMetadataPostExecutionRequest { operation: request.operation.clone(), before: summary.before.clone(), after: summary.after.clone(), @@ -304,8 +304,8 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if report.status == kb_pipeline::SolanaProgramMetadataPostconditionStatus::Contradicted { - return std::result::Result::Err(kb_core::Error::new( + if report.status == ks_pipeline::SolanaProgramMetadataPostconditionStatus::Contradicted { + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_postcondition_contradicted", "confirmed Solana Program Metadata transaction contradicted its stateful postcondition", )); @@ -320,12 +320,12 @@ where } async fn prepare_execution( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetSolanaProgramMetadataExecutionRequest, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where O: crate::SolanaExecutionObserver, { @@ -345,9 +345,9 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if genesis.classified_cluster - != std::option::Option::Some(kb_lib::ExApiExecutionCluster::Devnet) + != std::option::Option::Some(ks_lib::ExApiExecutionCluster::Devnet) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_cluster_mismatch", format!( "expected Devnet genesis hash but endpoint returned {} classified as {:?}", @@ -360,12 +360,12 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let wallet_summary = wallet.summary(); - let fee_payer = kb_lib::MdPubkey(wallet_summary.public_key.clone()); + let fee_payer = ks_lib::MdPubkey(wallet_summary.public_key.clone()); let balance = match http_pool .get_balance_for_role( request.query_role.as_str(), &fee_payer, - &kb_onchain_transport::GetBalanceConfig::confirmed(), + &ks_onchain_transport::GetBalanceConfig::confirmed(), ) .await { @@ -373,25 +373,25 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if balance.lamports < profile.execution.max_fee_lamports { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_balance_insufficient", "Devnet wallet balance is below the configured fee ceiling", )); } let intent = build_intent(profile, request, fee_payer.clone()); - let plan = match kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan( - &kb_lib::ExMetadataSolanaProgramMetadataExecutor, + let plan = match ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan( + &ks_lib::ExMetadataSolanaProgramMetadataExecutor, &intent, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let plan_evaluation = match kb_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { + let plan_evaluation = match ks_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if plan_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if plan_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_plan_denied", crate::violation_message(plan_evaluation.violations.as_slice()), )); @@ -400,8 +400,8 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let stateful_preflight = match kb_pipeline::inspect_solana_program_metadata_preflight( - &kb_pipeline::SolanaProgramMetadataPreflightRequest { + let stateful_preflight = match ks_pipeline::inspect_solana_program_metadata_preflight( + &ks_pipeline::SolanaProgramMetadataPreflightRequest { intent: intent.clone(), plan: plan.clone(), before: before.clone(), @@ -414,14 +414,14 @@ where let latest_blockhash = match http_pool .get_latest_blockhash_for_role( request.query_role.as_str(), - &kb_onchain_transport::GetLatestBlockhashConfig::confirmed(), + &ks_onchain_transport::GetLatestBlockhashConfig::confirmed(), ) .await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let unsigned = match kb_lib::executor_solana_build_legacy_transaction( + let unsigned = match ks_lib::executor_solana_build_legacy_transaction( &plan, latest_blockhash.blockhash.as_str(), ) { @@ -438,8 +438,8 @@ where .get_fee_for_message_for_role( request.query_role.as_str(), unsigned.message_base64().as_str(), - &kb_onchain_transport::GetFeeForMessageConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + &ks_onchain_transport::GetFeeForMessageConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, std::option::Option::Some(latest_blockhash.context.slot), ), ) @@ -452,8 +452,8 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let simulation_config = match kb_onchain_transport::SimulateTransactionConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let simulation_config = match ks_onchain_transport::SimulateTransactionConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, false, false, std::option::Option::Some(latest_blockhash.context.slot), @@ -482,8 +482,8 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let simulation = simulation_rpc.to_execution_result( - kb_lib::ExApiExecutionCluster::Devnet, - kb_lib::ExApiExecutionBlockhashKind::Latest, + ks_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionBlockhashKind::Latest, std::option::Option::Some( simulation_rpc.context.slot.saturating_sub(latest_blockhash.context.slot), ), @@ -491,8 +491,8 @@ where std::option::Option::None, std::option::Option::Some(&fee), ); - let readiness = match kb_pipeline::validate_solana_program_metadata_execution_readiness( - &kb_pipeline::SolanaProgramMetadataExecutionReadinessRequest { + let readiness = match ks_pipeline::validate_solana_program_metadata_execution_readiness( + &ks_pipeline::SolanaProgramMetadataExecutionReadinessRequest { plan: plan.clone(), preflight: stateful_preflight.clone(), message_hash: unsigned.message_hash().to_string(), @@ -510,7 +510,7 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(_) => "".to_string(), }; - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( error.code(), format!("{}; simulation={simulation_json}", error.message()), )); @@ -523,7 +523,7 @@ where evidence, summary: crate::DevnetSolanaProgramMetadataExecutionSummary { profile_name: profile.name.clone(), - cluster: kb_lib::ExApiExecutionCluster::Devnet, + cluster: ks_lib::ExApiExecutionCluster::Devnet, genesis_hash: genesis.genesis_hash, wallet: wallet_summary, balance_lamports: balance.lamports, @@ -544,29 +544,29 @@ where } fn build_intent( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, request: &crate::DevnetSolanaProgramMetadataExecutionRequest, - fee_payer: kb_lib::MdPubkey, -) -> kb_lib::ExMetadataSpmExecutionIntent { - return kb_lib::ExMetadataSpmExecutionIntent { + fee_payer: ks_lib::MdPubkey, +) -> ks_lib::ExMetadataSpmExecutionIntent { + return ks_lib::ExMetadataSpmExecutionIntent { intent_id: request.intent_id.clone(), fee_payer: fee_payer.clone(), - policy: kb_lib::ExApiExecutionPolicy { - cluster: kb_lib::ExApiExecutionClusterPolicy { - expected_cluster: kb_lib::ExApiExecutionCluster::Devnet, + policy: ks_lib::ExApiExecutionPolicy { + cluster: ks_lib::ExApiExecutionClusterPolicy { + expected_cluster: ks_lib::ExApiExecutionCluster::Devnet, allow_mainnet: false, mainnet_confirmation: false, }, - simulation: kb_lib::ExApiExecutionSimulationPolicy::Required, - blockhash: kb_lib::ExApiExecutionBlockhashPolicy { - kind: kb_lib::ExApiExecutionBlockhashKind::Latest, + simulation: ks_lib::ExApiExecutionSimulationPolicy::Required, + blockhash: ks_lib::ExApiExecutionBlockhashPolicy { + kind: ks_lib::ExApiExecutionBlockhashKind::Latest, max_age_slots: std::option::Option::Some( profile.execution.recent_blockhash_max_age_slots, ), nonce_account: std::option::Option::None, nonce_authority: std::option::Option::None, }, - cost_limit: kb_lib::ExApiExecutionCostLimit { + cost_limit: ks_lib::ExApiExecutionCostLimit { max_spend_lamports: std::option::Option::Some( profile.execution.devnet_max_spend_lamports, ), @@ -577,7 +577,7 @@ fn build_intent( }, authorized_signers: vec![fee_payer], dry_run: !request.submit, - post_execution_validation: kb_lib::ExApiPostExecutionValidationPolicy { + post_execution_validation: ks_lib::ExApiPostExecutionValidationPolicy { canonical_insert_required: true, core_extraction_required: true, decode_replay_required: true, @@ -590,13 +590,13 @@ fn build_intent( } async fn read_snapshots( - http_pool: &kb_onchain_transport::HttpEndpointPool, - requests: &[kb_pipeline::SolanaProgramMetadataStatefulReadRequest], -) -> kb_core::Result> { + http_pool: &ks_onchain_transport::HttpEndpointPool, + requests: &[ks_pipeline::SolanaProgramMetadataStatefulReadRequest], +) -> ks_core::Result> { let mut results = std::vec::Vec::with_capacity(requests.len()); for request in requests { let value = - match kb_pipeline::read_solana_program_metadata_stateful_snapshot(http_pool, request) + match ks_pipeline::read_solana_program_metadata_stateful_snapshot(http_pool, request) .await { std::result::Result::Ok(value) => value, @@ -608,8 +608,8 @@ async fn read_snapshots( } fn materialize_confirmed_snapshots( - snapshots: &[kb_pipeline::SolanaProgramMetadataStatefulReadResult], -) -> std::vec::Vec { + snapshots: &[ks_pipeline::SolanaProgramMetadataStatefulReadResult], +) -> std::vec::Vec { return snapshots .iter() .filter_map(|result| return result.materialized_output.clone()) @@ -617,26 +617,26 @@ fn materialize_confirmed_snapshots( } fn validate_profile( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, request: &crate::DevnetSolanaProgramMetadataExecutionRequest, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if profile.wallet.cluster != "devnet" { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Solana Program Metadata orchestration requires a Devnet wallet profile", )); } if !profile.wallet.temporary_wallet_enabled || !profile.wallet.temporary_wallet_persist { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Solana Program Metadata orchestration requires an enabled persistent temporary wallet", )); } if !profile.execution.require_simulation { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Solana Program Metadata orchestration requires simulation", )); } if request.submit && !profile.wallet.devnet_send_enabled { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet transaction submission is disabled by the wallet profile", )); } @@ -644,7 +644,7 @@ fn validate_profile( && profile.execution.require_operator_confirmation && !request.operator_confirmed { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Solana Program Metadata submission requires explicit operator confirmation", )); } @@ -654,9 +654,9 @@ fn validate_profile( fn validate_profile_wallet_signers( required_signers: &[std::string::String], wallet_pubkey: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if required_signers.iter().any(|value| return value.as_str() != wallet_pubkey) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_metadata_spm_external_signer_unavailable", format!( "the Devnet Solana Program Metadata orchestrator can sign only with profile wallet {}; required signers are {}", @@ -670,8 +670,8 @@ fn validate_profile_wallet_signers( #[cfg(test)] mod tests { - fn wallet() -> kb_lib::MdPubkey { - return kb_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([7_u8; 32]).to_string()); + fn wallet() -> ks_lib::MdPubkey { + return ks_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([7_u8; 32]).to_string()); } #[test] @@ -679,21 +679,21 @@ mod tests { let wallet = wallet(); let mut request = crate::DevnetSolanaProgramMetadataExecutionRequest::new( "write", - kb_lib::ExMetadataSpmOperation::Write { + ks_lib::ExMetadataSpmOperation::Write { buffer: wallet.clone(), authority: wallet, offset: 0, - source: kb_lib::ExMetadataSpmWriteSource::Inline { data: vec![1] }, + source: ks_lib::ExMetadataSpmWriteSource::Inline { data: vec![1] }, }, ); request .preflight_reads - .push(kb_pipeline::SolanaProgramMetadataStatefulReadRequest { + .push(ks_pipeline::SolanaProgramMetadataStatefulReadRequest { query_role: "http_queries".to_string(), account: request.operation_target_for_test(), - expected_state: kb_pipeline::SolanaProgramMetadataExpectedAccountState::Buffer, + expected_state: ks_pipeline::SolanaProgramMetadataExpectedAccountState::Buffer, min_context_slot: std::option::Option::None, - max_data_bytes: kb_pipeline::MAX_SOLANA_PROGRAM_METADATA_STATEFUL_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_SOLANA_PROGRAM_METADATA_STATEFUL_ACCOUNT_BYTES, }); assert!(request.validate().is_err()); request.allow_destructive_operation = true; @@ -701,14 +701,14 @@ mod tests { } trait OperationTargetForTest { - fn operation_target_for_test(&self) -> kb_lib::MdPubkey; + fn operation_target_for_test(&self) -> ks_lib::MdPubkey; } impl OperationTargetForTest for crate::DevnetSolanaProgramMetadataExecutionRequest { - fn operation_target_for_test(&self) -> kb_lib::MdPubkey { + fn operation_target_for_test(&self) -> ks_lib::MdPubkey { return match &self.operation { - kb_lib::ExMetadataSpmOperation::Write { buffer, .. } => buffer.clone(), - _ => kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), + ks_lib::ExMetadataSpmOperation::Write { buffer, .. } => buffer.clone(), + _ => ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), }; } } diff --git a/kb-pipeline-demo-scenarios/src/metadata/solana_program/fixture.rs b/ks-pipeline-demo-scenarios/src/metadata/solana_program/fixture.rs similarity index 80% rename from kb-pipeline-demo-scenarios/src/metadata/solana_program/fixture.rs rename to ks-pipeline-demo-scenarios/src/metadata/solana_program/fixture.rs index 3baa855..25b6733 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/solana_program/fixture.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/solana_program/fixture.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/solana_program/fixture.rs -// version: 6 +// file: ks-pipeline-demo-scenarios/src/metadata/solana_program/fixture.rs +// version: 7 //! Native Solana Program Metadata fixture preparation for Devnet journeys. @@ -45,13 +45,13 @@ pub struct SolanaProgramMetadataPreparedStep { /// Zero-based step position inside the scenario. pub step_index: usize, /// Exact typed operation. - pub operation: kb_lib::ExMetadataSpmOperation, + pub operation: ks_lib::ExMetadataSpmOperation, /// Bounded state reads required before execution. - pub preflight_reads: std::vec::Vec, + pub preflight_reads: std::vec::Vec, /// Explicit rent observations required by the operation. - pub rent_observations: std::vec::Vec, + pub rent_observations: std::vec::Vec, /// Bounded state reads required after confirmation. - pub postcondition_reads: std::vec::Vec, + pub postcondition_reads: std::vec::Vec, /// Whether explicit destructive approval is required. pub allow_destructive_operation: bool, } @@ -107,13 +107,13 @@ pub struct SolanaProgramMetadataFixturePreparationSummary { /// Creates two unique pre-funded PDAs and the nine typed journey steps. pub async fn prepare_solana_program_metadata_fixture( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::SolanaProgramMetadataFixturePreparationOptions, -) -> kb_core::Result { +) -> ks_core::Result { if options.query_role.trim().is_empty() || options.transaction_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Solana Program Metadata fixture endpoint roles must not be empty", )); } @@ -122,12 +122,12 @@ pub async fn prepare_solana_program_metadata_fixture( || !profile.wallet.temporary_wallet_enabled || !profile.wallet.temporary_wallet_persist { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Solana Program Metadata fixture requires one persistent send-enabled Devnet profile", )); } if !options.operator_confirmed { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Solana Program Metadata fixture prefunding requires explicit operator confirmation", )); } @@ -136,9 +136,9 @@ pub async fn prepare_solana_program_metadata_fixture( std::result::Result::Err(error) => return std::result::Result::Err(error), }; if genesis.classified_cluster - != std::option::Option::Some(kb_lib::ExApiExecutionCluster::Devnet) + != std::option::Option::Some(ks_lib::ExApiExecutionCluster::Devnet) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_cluster_mismatch", "Solana Program Metadata fixture preparation requires a Devnet endpoint", )); @@ -147,12 +147,12 @@ pub async fn prepare_solana_program_metadata_fixture( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let authority = kb_lib::MdPubkey(operator.public_key()); - let described_program = kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()); + let authority = ks_lib::MdPubkey(operator.public_key()); + let described_program = ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()); let unique = uuid::Uuid::new_v4().simple().to_string(); let buffer_seed = format!("buf{}", &unique[0..13]); let metadata_seed = format!("met{}", &unique[13..26]); - let buffer = match kb_lib::executor_metadata_solana_program_metadata_derive_non_canonical_pda( + let buffer = match ks_lib::executor_metadata_solana_program_metadata_derive_non_canonical_pda( &described_program, &authority, buffer_seed.as_bytes(), @@ -160,7 +160,7 @@ pub async fn prepare_solana_program_metadata_fixture( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let metadata = match kb_lib::executor_metadata_solana_program_metadata_derive_non_canonical_pda( + let metadata = match ks_lib::executor_metadata_solana_program_metadata_derive_non_canonical_pda( &described_program, &authority, metadata_seed.as_bytes(), @@ -177,16 +177,16 @@ pub async fn prepare_solana_program_metadata_fixture( { return std::result::Result::Err(error); } - let buffer_header = match u64::try_from(kb_lib::DC_METADATA_SPM_BUFFER_HEADER_BYTES) { + let buffer_header = match u64::try_from(ks_lib::DC_METADATA_SPM_BUFFER_HEADER_BYTES) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(error.to_string())); + return std::result::Result::Err(ks_core::Error::config(error.to_string())); }, }; - let metadata_header = match u64::try_from(kb_lib::DC_METADATA_SPM_METADATA_HEADER_BYTES) { + let metadata_header = match u64::try_from(ks_lib::DC_METADATA_SPM_METADATA_HEADER_BYTES) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(error.to_string())); + return std::result::Result::Err(ks_core::Error::config(error.to_string())); }, }; let buffer_target_space = buffer_header @@ -197,13 +197,13 @@ pub async fn prepare_solana_program_metadata_fixture( let initial_metadata_data_len = match u64::try_from(initial_metadata_bytes.len()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(error.to_string())); + return std::result::Result::Err(ks_core::Error::config(error.to_string())); }, }; let updated_metadata_data_len = match u64::try_from(updated_metadata_bytes.len()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(error.to_string())); + return std::result::Result::Err(ks_core::Error::config(error.to_string())); }, }; let initial_metadata_space = metadata_header.saturating_add(initial_metadata_data_len); @@ -253,7 +253,7 @@ pub async fn prepare_solana_program_metadata_fixture( }) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Solana Program Metadata fixture funding requirement overflowed u64", )); }, @@ -262,7 +262,7 @@ pub async fn prepare_solana_program_metadata_fixture( .get_balance_for_role( options.query_role.as_str(), &authority, - &kb_onchain_transport::GetBalanceConfig::confirmed(), + &ks_onchain_transport::GetBalanceConfig::confirmed(), ) .await { @@ -270,7 +270,7 @@ pub async fn prepare_solana_program_metadata_fixture( std::result::Result::Err(error) => return std::result::Result::Err(error), }; if balance.lamports < total { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_fixture_balance_insufficient", format!( "Devnet fixture wallet has {} lamports but requires at least {}; fund or airdrop the profile wallet first", @@ -355,11 +355,11 @@ pub async fn prepare_solana_program_metadata_fixture( #[allow(clippy::too_many_arguments)] fn prepared_steps( query_role: &str, - authority: kb_lib::MdPubkey, - described_program: kb_lib::MdPubkey, - buffer: kb_lib::MdPubkey, + authority: ks_lib::MdPubkey, + described_program: ks_lib::MdPubkey, + buffer: ks_lib::MdPubkey, buffer_seed: &[u8], - metadata: kb_lib::MdPubkey, + metadata: ks_lib::MdPubkey, metadata_seed: &[u8], initial_metadata_bytes: std::vec::Vec, updated_metadata_bytes: std::vec::Vec, @@ -374,41 +374,41 @@ fn prepared_steps( updated_metadata_space: u64, updated_metadata_rent: u64, ) -> std::vec::Vec { - let context = kb_lib::ExMetadataSpmProgramContext { + let context = ks_lib::ExMetadataSpmProgramContext { program: described_program.clone(), program_data: std::option::Option::None, }; let buffer_vacant = read( query_role, buffer.clone(), - kb_pipeline::SolanaProgramMetadataExpectedAccountState::Vacant, + ks_pipeline::SolanaProgramMetadataExpectedAccountState::Vacant, ); let buffer_state = read( query_role, buffer.clone(), - kb_pipeline::SolanaProgramMetadataExpectedAccountState::Buffer, + ks_pipeline::SolanaProgramMetadataExpectedAccountState::Buffer, ); let buffer_missing = read( query_role, buffer.clone(), - kb_pipeline::SolanaProgramMetadataExpectedAccountState::Missing, + ks_pipeline::SolanaProgramMetadataExpectedAccountState::Missing, ); let metadata_vacant = read( query_role, metadata.clone(), - kb_pipeline::SolanaProgramMetadataExpectedAccountState::Vacant, + ks_pipeline::SolanaProgramMetadataExpectedAccountState::Vacant, ); let metadata_state = read( query_role, metadata.clone(), - kb_pipeline::SolanaProgramMetadataExpectedAccountState::Metadata, + ks_pipeline::SolanaProgramMetadataExpectedAccountState::Metadata, ); return vec![ prepared_step( "spm_buffer_lifecycle", "spm_buffer_allocate", 0, - kb_lib::ExMetadataSpmOperation::Allocate { + ks_lib::ExMetadataSpmOperation::Allocate { buffer: buffer.clone(), authority: authority.clone(), seed: std::option::Option::Some(buffer_seed.to_vec()), @@ -430,7 +430,7 @@ fn prepared_steps( "spm_buffer_lifecycle", "spm_buffer_extend", 1, - kb_lib::ExMetadataSpmOperation::Extend { + ks_lib::ExMetadataSpmOperation::Extend { account: buffer.clone(), authority: authority.clone(), length: crate::SOLANA_PROGRAM_METADATA_FIXTURE_BUFFER_DATA_BYTES, @@ -450,11 +450,11 @@ fn prepared_steps( "spm_buffer_lifecycle", "spm_buffer_write", 2, - kb_lib::ExMetadataSpmOperation::Write { + ks_lib::ExMetadataSpmOperation::Write { buffer: buffer.clone(), authority: authority.clone(), offset: 0, - source: kb_lib::ExMetadataSpmWriteSource::Inline { + source: ks_lib::ExMetadataSpmWriteSource::Inline { data: b"Khadhroony Solana Program Metadata Buffer fixture".to_vec(), }, }, @@ -467,7 +467,7 @@ fn prepared_steps( "spm_buffer_lifecycle", "spm_buffer_set_authority", 3, - kb_lib::ExMetadataSpmOperation::SetAuthority { + ks_lib::ExMetadataSpmOperation::SetAuthority { account: buffer.clone(), authority: authority.clone(), new_authority: std::option::Option::Some(authority.clone()), @@ -482,7 +482,7 @@ fn prepared_steps( "spm_buffer_lifecycle", "spm_buffer_trim", 4, - kb_lib::ExMetadataSpmOperation::Trim { + ks_lib::ExMetadataSpmOperation::Trim { account: buffer.clone(), authority: authority.clone(), destination: authority.clone(), @@ -497,7 +497,7 @@ fn prepared_steps( "spm_buffer_lifecycle", "spm_buffer_close", 5, - kb_lib::ExMetadataSpmOperation::Close { + ks_lib::ExMetadataSpmOperation::Close { account: buffer.clone(), authority: authority.clone(), destination: authority.clone(), @@ -512,18 +512,18 @@ fn prepared_steps( "spm_metadata_lifecycle", "spm_metadata_initialize", 0, - kb_lib::ExMetadataSpmOperation::Initialize { + ks_lib::ExMetadataSpmOperation::Initialize { metadata: metadata.clone(), authority: authority.clone(), program: described_program, program_data: std::option::Option::None, canonical: false, seed: metadata_seed.to_vec(), - encoding: kb_lib::ExMetadataSpmEncoding::Utf8, - compression: kb_lib::ExMetadataSpmCompression::None, - format: kb_lib::ExMetadataSpmFormat::Json, - data_source: kb_lib::ExMetadataSpmDataSource::Direct, - data: std::option::Option::Some(kb_lib::ExMetadataSpmDataInput::Direct { + encoding: ks_lib::ExMetadataSpmEncoding::Utf8, + compression: ks_lib::ExMetadataSpmCompression::None, + format: ks_lib::ExMetadataSpmFormat::Json, + data_source: ks_lib::ExMetadataSpmDataSource::Direct, + data: std::option::Option::Some(ks_lib::ExMetadataSpmDataInput::Direct { bytes: initial_metadata_bytes, }), allocate_account: true, @@ -542,14 +542,14 @@ fn prepared_steps( "spm_metadata_lifecycle", "spm_metadata_set_data", 1, - kb_lib::ExMetadataSpmOperation::SetData { + ks_lib::ExMetadataSpmOperation::SetData { metadata: metadata.clone(), authority: authority.clone(), - encoding: kb_lib::ExMetadataSpmEncoding::Utf8, - compression: kb_lib::ExMetadataSpmCompression::None, - format: kb_lib::ExMetadataSpmFormat::Json, - source: kb_lib::ExMetadataSpmSetDataSource::Inline { - data: kb_lib::ExMetadataSpmDataInput::Direct { bytes: updated_metadata_bytes }, + encoding: ks_lib::ExMetadataSpmEncoding::Utf8, + compression: ks_lib::ExMetadataSpmCompression::None, + format: ks_lib::ExMetadataSpmFormat::Json, + source: ks_lib::ExMetadataSpmSetDataSource::Inline { + data: ks_lib::ExMetadataSpmDataInput::Direct { bytes: updated_metadata_bytes }, }, program_context: std::option::Option::None, }, @@ -567,7 +567,7 @@ fn prepared_steps( "spm_metadata_lifecycle", "spm_metadata_set_immutable", 2, - kb_lib::ExMetadataSpmOperation::SetImmutable { + ks_lib::ExMetadataSpmOperation::SetImmutable { metadata: metadata.clone(), authority, program_context: std::option::Option::None, @@ -584,10 +584,10 @@ fn prepared_step( scenario_id: &str, step_id: &str, step_index: usize, - operation: kb_lib::ExMetadataSpmOperation, - preflight_reads: std::vec::Vec, - rent_observations: std::vec::Vec, - postcondition_reads: std::vec::Vec, + operation: ks_lib::ExMetadataSpmOperation, + preflight_reads: std::vec::Vec, + rent_observations: std::vec::Vec, + postcondition_reads: std::vec::Vec, allow_destructive_operation: bool, ) -> crate::SolanaProgramMetadataPreparedStep { return crate::SolanaProgramMetadataPreparedStep { @@ -604,25 +604,25 @@ fn prepared_step( fn read( query_role: &str, - account: kb_lib::MdPubkey, - expected_state: kb_pipeline::SolanaProgramMetadataExpectedAccountState, -) -> kb_pipeline::SolanaProgramMetadataStatefulReadRequest { - return kb_pipeline::SolanaProgramMetadataStatefulReadRequest { + account: ks_lib::MdPubkey, + expected_state: ks_pipeline::SolanaProgramMetadataExpectedAccountState, +) -> ks_pipeline::SolanaProgramMetadataStatefulReadRequest { + return ks_pipeline::SolanaProgramMetadataStatefulReadRequest { query_role: query_role.to_string(), account, expected_state, min_context_slot: std::option::Option::None, - max_data_bytes: kb_pipeline::MAX_SOLANA_PROGRAM_METADATA_STATEFUL_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_SOLANA_PROGRAM_METADATA_STATEFUL_ACCOUNT_BYTES, }; } fn rent( - account: kb_lib::MdPubkey, + account: ks_lib::MdPubkey, target_space: u64, observed_lamports: u64, required_lamports: u64, -) -> kb_pipeline::SolanaProgramMetadataRentObservation { - return kb_pipeline::SolanaProgramMetadataRentObservation { +) -> ks_pipeline::SolanaProgramMetadataRentObservation { + return ks_pipeline::SolanaProgramMetadataRentObservation { account, target_space, observed_lamports, @@ -631,16 +631,16 @@ fn rent( } async fn ensure_fixture_addresses_are_missing( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, options: &crate::SolanaProgramMetadataFixturePreparationOptions, - accounts: &[kb_lib::MdPubkey], -) -> kb_core::Result<()> { + accounts: &[ks_lib::MdPubkey], +) -> ks_core::Result<()> { for account in accounts { let value = match http_pool .get_account_info_for_role( options.query_role.as_str(), account, - &kb_onchain_transport::GetAccountInfoConfig::confirmed(), + &ks_onchain_transport::GetAccountInfoConfig::confirmed(), ) .await { @@ -648,7 +648,7 @@ async fn ensure_fixture_addresses_are_missing( std::result::Result::Err(error) => return std::result::Result::Err(error), }; if value.account.is_some() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_fixture_address_collision", format!("generated fixture address {} already exists", account.0), )); @@ -658,15 +658,15 @@ async fn ensure_fixture_addresses_are_missing( } async fn rent_for_space( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, query_role: &str, space: u64, -) -> kb_core::Result { +) -> ks_core::Result { let result = match http_pool .get_minimum_balance_for_rent_exemption_for_role( query_role, space, - &kb_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), + &ks_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), ) .await { @@ -677,31 +677,31 @@ async fn rent_for_space( } async fn submit_prefund_transfer( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, options: &crate::SolanaProgramMetadataFixturePreparationOptions, - operator: &kb_wallet::TemporaryWallet, - recipient: kb_lib::MdPubkey, + operator: &ks_wallet::TemporaryWallet, + recipient: ks_lib::MdPubkey, lamports: u64, label: &str, -) -> kb_core::Result { - let payer = kb_lib::MdPubkey(operator.public_key()); - let policy = kb_lib::ExApiExecutionPolicy { - cluster: kb_lib::ExApiExecutionClusterPolicy { - expected_cluster: kb_lib::ExApiExecutionCluster::Devnet, +) -> ks_core::Result { + let payer = ks_lib::MdPubkey(operator.public_key()); + let policy = ks_lib::ExApiExecutionPolicy { + cluster: ks_lib::ExApiExecutionClusterPolicy { + expected_cluster: ks_lib::ExApiExecutionCluster::Devnet, allow_mainnet: false, mainnet_confirmation: false, }, - simulation: kb_lib::ExApiExecutionSimulationPolicy::Required, - blockhash: kb_lib::ExApiExecutionBlockhashPolicy { - kind: kb_lib::ExApiExecutionBlockhashKind::Latest, + simulation: ks_lib::ExApiExecutionSimulationPolicy::Required, + blockhash: ks_lib::ExApiExecutionBlockhashPolicy { + kind: ks_lib::ExApiExecutionBlockhashKind::Latest, max_age_slots: std::option::Option::Some( profile.execution.recent_blockhash_max_age_slots, ), nonce_account: std::option::Option::None, nonce_authority: std::option::Option::None, }, - cost_limit: kb_lib::ExApiExecutionCostLimit { + cost_limit: ks_lib::ExApiExecutionCostLimit { max_spend_lamports: std::option::Option::Some( profile.execution.devnet_max_spend_lamports, ), @@ -712,36 +712,36 @@ async fn submit_prefund_transfer( }, authorized_signers: vec![payer.clone()], dry_run: false, - post_execution_validation: kb_lib::ExApiPostExecutionValidationPolicy { + post_execution_validation: ks_lib::ExApiPostExecutionValidationPolicy { canonical_insert_required: false, core_extraction_required: false, decode_replay_required: false, materialization_required: false, }, }; - let intent = kb_lib::ExSolanaCoreExecutionIntent { + let intent = ks_lib::ExSolanaCoreExecutionIntent { intent_id: format!("spm-fixture-prefund-{label}-{}", recipient.0), fee_payer: payer.clone(), policy, - operation: kb_lib::ExSolanaCoreOperation::SystemTransfer { + operation: ks_lib::ExSolanaCoreOperation::SystemTransfer { from: payer, to: recipient, lamports, }, }; - let plan = match kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan( - &kb_lib::ExSolanaCoreExecutor, + let plan = match ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan( + &ks_lib::ExSolanaCoreExecutor, &intent, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let plan_evaluation = match kb_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { + let plan_evaluation = match ks_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if plan_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if plan_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_fixture_prefund_plan_denied", crate::violation_message(plan_evaluation.violations.as_slice()), )); @@ -749,14 +749,14 @@ async fn submit_prefund_transfer( let latest_blockhash = match http_pool .get_latest_blockhash_for_role( options.query_role.as_str(), - &kb_onchain_transport::GetLatestBlockhashConfig::confirmed(), + &ks_onchain_transport::GetLatestBlockhashConfig::confirmed(), ) .await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let unsigned = match kb_lib::executor_solana_build_legacy_transaction( + let unsigned = match ks_lib::executor_solana_build_legacy_transaction( &plan, latest_blockhash.blockhash.as_str(), ) { @@ -767,8 +767,8 @@ async fn submit_prefund_transfer( .get_fee_for_message_for_role( options.query_role.as_str(), unsigned.message_base64().as_str(), - &kb_onchain_transport::GetFeeForMessageConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + &ks_onchain_transport::GetFeeForMessageConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, std::option::Option::Some(latest_blockhash.context.slot), ), ) @@ -781,8 +781,8 @@ async fn submit_prefund_transfer( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let simulation_config = match kb_onchain_transport::SimulateTransactionConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let simulation_config = match ks_onchain_transport::SimulateTransactionConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, false, false, std::option::Option::Some(latest_blockhash.context.slot), @@ -804,8 +804,8 @@ async fn submit_prefund_transfer( std::result::Result::Err(error) => return std::result::Result::Err(error), }; let simulation = simulation_rpc.to_execution_result( - kb_lib::ExApiExecutionCluster::Devnet, - kb_lib::ExApiExecutionBlockhashKind::Latest, + ks_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionBlockhashKind::Latest, std::option::Option::Some( simulation_rpc.context.slot.saturating_sub(latest_blockhash.context.slot), ), @@ -814,17 +814,17 @@ async fn submit_prefund_transfer( std::option::Option::Some(&fee), ); if !simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_fixture_prefund_simulation_failed", crate::simulation_failure_message(&simulation), )); } - let send_evaluation = match kb_lib::ExSafetyChecker.evaluate_send(&plan, &simulation) { + let send_evaluation = match ks_lib::ExSafetyChecker.evaluate_send(&plan, &simulation) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if send_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if send_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_fixture_prefund_send_denied", crate::violation_message(send_evaluation.violations.as_slice()), )); @@ -838,7 +838,7 @@ async fn submit_prefund_transfer( return std::result::Result::Err(error); } let signature = signed.primary_signature().clone(); - let send_config = match kb_onchain_transport::SendTransactionConfig::from_execution_config( + let send_config = match ks_onchain_transport::SendTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(latest_blockhash.context.slot), ) { @@ -857,7 +857,7 @@ async fn submit_prefund_transfer( return std::result::Result::Err(error); } let confirmation_config = - match kb_onchain_transport::ConfirmTransactionConfig::from_execution_config( + match ks_onchain_transport::ConfirmTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(latest_blockhash.last_valid_block_height), std::option::Option::Some(latest_blockhash.context.slot), @@ -869,7 +869,7 @@ async fn submit_prefund_transfer( .confirm_transaction_for_roles( options.transaction_role.as_str(), options.query_role.as_str(), - kb_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionCluster::Devnet, &signature, &confirmation_config, ) @@ -880,10 +880,10 @@ async fn submit_prefund_transfer( }; if !matches!( confirmation.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_fixture_prefund_confirmation_failed", format!("prefunding transaction stopped at {:?}", confirmation.status), )); @@ -898,18 +898,18 @@ mod tests { let unique = uuid::Uuid::nil().simple().to_string(); let buffer_seed = format!("buf{}", &unique[0..13]); let metadata_seed = format!("met{}", &unique[13..26]); - assert_eq!(buffer_seed.len(), kb_lib::DC_METADATA_SPM_SEED_BYTES); - assert_eq!(metadata_seed.len(), kb_lib::DC_METADATA_SPM_SEED_BYTES); + assert_eq!(buffer_seed.len(), ks_lib::DC_METADATA_SPM_SEED_BYTES); + assert_eq!(metadata_seed.len(), ks_lib::DC_METADATA_SPM_SEED_BYTES); let authority = - kb_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([1_u8; 32]).to_string()); + ks_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([1_u8; 32]).to_string()); let buffer = - kb_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([2_u8; 32]).to_string()); + ks_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([2_u8; 32]).to_string()); let metadata = - kb_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([3_u8; 32]).to_string()); + ks_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([3_u8; 32]).to_string()); let steps = super::prepared_steps( "custom_queries", authority, - kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), + ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), buffer, buffer_seed.as_bytes(), metadata, @@ -939,14 +939,14 @@ mod tests { .collect::>(); assert_eq!(actual, expected); let expected_buffer = - kb_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([2_u8; 32]).to_string()); + ks_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([2_u8; 32]).to_string()); let set_authority = steps.iter().find(|step| { return step.operation.operation_code() - == kb_lib::EX_METADATA_SPM_SET_AUTHORITY_OPERATION; + == ks_lib::EX_METADATA_SPM_SET_AUTHORITY_OPERATION; }); assert!(matches!( set_authority.map(|step| return &step.operation), - std::option::Option::Some(kb_lib::ExMetadataSpmOperation::SetAuthority { + std::option::Option::Some(ks_lib::ExMetadataSpmOperation::SetAuthority { account, .. }) if account == &expected_buffer diff --git a/kb-pipeline-demo-scenarios/src/metadata/solana_program/scenarios.rs b/ks-pipeline-demo-scenarios/src/metadata/solana_program/scenarios.rs similarity index 90% rename from kb-pipeline-demo-scenarios/src/metadata/solana_program/scenarios.rs rename to ks-pipeline-demo-scenarios/src/metadata/solana_program/scenarios.rs index db0e1a9..9968ad4 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/solana_program/scenarios.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/solana_program/scenarios.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/solana_program/scenarios.rs -// version: 4 +// file: ks-pipeline-demo-scenarios/src/metadata/solana_program/scenarios.rs +// version: 5 //! Coherent Solana Program Metadata journeys for Devnet validation. @@ -66,7 +66,7 @@ pub fn solana_program_metadata_devnet_scenarios() step( "spm_buffer_allocate", "Allouer le Buffer préfinancé", - kb_lib::EX_METADATA_SPM_ALLOCATE_OPERATION, + ks_lib::EX_METADATA_SPM_ALLOCATE_OPERATION, crate::SolanaProgramMetadataFixtureState::Prefunded, crate::SolanaProgramMetadataFixtureState::Buffer, false, @@ -74,7 +74,7 @@ pub fn solana_program_metadata_devnet_scenarios() step( "spm_buffer_extend", "Étendre la capacité du Buffer", - kb_lib::EX_METADATA_SPM_EXTEND_OPERATION, + ks_lib::EX_METADATA_SPM_EXTEND_OPERATION, crate::SolanaProgramMetadataFixtureState::Buffer, crate::SolanaProgramMetadataFixtureState::Buffer, false, @@ -82,7 +82,7 @@ pub fn solana_program_metadata_devnet_scenarios() step( "spm_buffer_write", "Écrire les données inline", - kb_lib::EX_METADATA_SPM_WRITE_OPERATION, + ks_lib::EX_METADATA_SPM_WRITE_OPERATION, crate::SolanaProgramMetadataFixtureState::Buffer, crate::SolanaProgramMetadataFixtureState::Buffer, true, @@ -90,7 +90,7 @@ pub fn solana_program_metadata_devnet_scenarios() step( "spm_buffer_set_authority", "Réaffirmer l’autorité du Buffer non canonique", - kb_lib::EX_METADATA_SPM_SET_AUTHORITY_OPERATION, + ks_lib::EX_METADATA_SPM_SET_AUTHORITY_OPERATION, crate::SolanaProgramMetadataFixtureState::Buffer, crate::SolanaProgramMetadataFixtureState::Buffer, true, @@ -98,7 +98,7 @@ pub fn solana_program_metadata_devnet_scenarios() step( "spm_buffer_trim", "Réduire le Buffer et restituer l’excédent", - kb_lib::EX_METADATA_SPM_TRIM_OPERATION, + ks_lib::EX_METADATA_SPM_TRIM_OPERATION, crate::SolanaProgramMetadataFixtureState::Buffer, crate::SolanaProgramMetadataFixtureState::Buffer, true, @@ -106,7 +106,7 @@ pub fn solana_program_metadata_devnet_scenarios() step( "spm_buffer_close", "Fermer le Buffer", - kb_lib::EX_METADATA_SPM_CLOSE_OPERATION, + ks_lib::EX_METADATA_SPM_CLOSE_OPERATION, crate::SolanaProgramMetadataFixtureState::Buffer, crate::SolanaProgramMetadataFixtureState::Closed, true, @@ -121,7 +121,7 @@ pub fn solana_program_metadata_devnet_scenarios() step( "spm_metadata_initialize", "Initialiser les metadata non-canoniques", - kb_lib::EX_METADATA_SPM_INITIALIZE_OPERATION, + ks_lib::EX_METADATA_SPM_INITIALIZE_OPERATION, crate::SolanaProgramMetadataFixtureState::Prefunded, crate::SolanaProgramMetadataFixtureState::MutableMetadata, false, @@ -129,7 +129,7 @@ pub fn solana_program_metadata_devnet_scenarios() step( "spm_metadata_set_data", "Mettre à jour les données JSON", - kb_lib::EX_METADATA_SPM_SET_DATA_OPERATION, + ks_lib::EX_METADATA_SPM_SET_DATA_OPERATION, crate::SolanaProgramMetadataFixtureState::MutableMetadata, crate::SolanaProgramMetadataFixtureState::MutableMetadata, true, @@ -137,7 +137,7 @@ pub fn solana_program_metadata_devnet_scenarios() step( "spm_metadata_set_immutable", "Rendre les metadata immuables", - kb_lib::EX_METADATA_SPM_SET_IMMUTABLE_OPERATION, + ks_lib::EX_METADATA_SPM_SET_IMMUTABLE_OPERATION, crate::SolanaProgramMetadataFixtureState::MutableMetadata, crate::SolanaProgramMetadataFixtureState::ImmutableMetadata, true, @@ -193,8 +193,8 @@ mod tests { .flat_map(|scenario| return scenario.steps.iter()) .map(|step| return step.operation_code.as_str()) .collect::>(); - assert_eq!(operations.len(), kb_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.len()); - for operation in kb_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES { + assert_eq!(operations.len(), ks_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.len()); + for operation in ks_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES { assert_eq!( operations.iter().filter(|candidate| return **candidate == *operation).count(), 1 @@ -214,7 +214,7 @@ mod tests { .map(move |step| return (scenario.fixture_account.as_str(), step)); }) .filter(|(_, step)| { - return step.operation_code == kb_lib::EX_METADATA_SPM_SET_AUTHORITY_OPERATION; + return step.operation_code == ks_lib::EX_METADATA_SPM_SET_AUTHORITY_OPERATION; }) .collect::>(); assert_eq!(set_authority_steps.len(), 1); @@ -228,7 +228,7 @@ mod tests { for step in scenario.steps { assert_eq!( step.requires_explicit_approval, - kb_lib::EX_METADATA_SPM_DESTRUCTIVE_OPERATION_CODES + ks_lib::EX_METADATA_SPM_DESTRUCTIVE_OPERATION_CODES .contains(&step.operation_code.as_str()) ); } diff --git a/kb-pipeline-demo-scenarios/src/metadata/solana_program/validation.rs b/ks-pipeline-demo-scenarios/src/metadata/solana_program/validation.rs similarity index 92% rename from kb-pipeline-demo-scenarios/src/metadata/solana_program/validation.rs rename to ks-pipeline-demo-scenarios/src/metadata/solana_program/validation.rs index d13fe55..12d3ff0 100644 --- a/kb-pipeline-demo-scenarios/src/metadata/solana_program/validation.rs +++ b/ks-pipeline-demo-scenarios/src/metadata/solana_program/validation.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/metadata/solana_program/validation.rs -// version: 4 +// file: ks-pipeline-demo-scenarios/src/metadata/solana_program/validation.rs +// version: 5 //! Conservative Solana Program Metadata validation status and evidence contracts. @@ -67,7 +67,7 @@ pub struct SolanaProgramMetadataValidationMatrix { /// Loads and validates the canonical Solana Program Metadata Devnet matrix. pub fn load_solana_program_metadata_validation_matrix() --> kb_core::Result { +-> ks_core::Result { let parsed = match serde_json::from_str::( include_str!( "../../../../test-fixtures/contract-matrices/SOLANA_PROGRAM_METADATA_DEVNET_VALIDATION_MATRIX.json" @@ -75,7 +75,7 @@ pub fn load_solana_program_metadata_validation_matrix() ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_validation_matrix_invalid_json", format!("Solana Program Metadata validation matrix is invalid: {error}"), )); @@ -92,9 +92,9 @@ pub fn load_solana_program_metadata_validation_matrix() /// Validates exact inventory, order and conservative evidence claims. pub fn validate_solana_program_metadata_validation_matrix( matrix: &crate::SolanaProgramMetadataValidationMatrix, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if matrix.matrix_version != 1 || matrix.milestone != "0.4.8-pre.009" { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_validation_matrix_contract_mismatch", "Solana Program Metadata validation matrix must use version 1 for 0.4.8-pre.009", )); @@ -113,7 +113,7 @@ pub fn validate_solana_program_metadata_validation_matrix( .map(|operation| return operation.operation_code.as_str()) .collect::>(); if actual != expected { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_validation_matrix_inventory_mismatch", "Solana Program Metadata validation matrix differs from the compiled journey order", )); @@ -124,7 +124,7 @@ pub fn validate_solana_program_metadata_validation_matrix( || operation.required_evidence != step.required_evidence || operation.evidence.len() > crate::MAX_SOLANA_PROGRAM_METADATA_VALIDATION_EVIDENCE { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_validation_matrix_row_invalid", "Solana Program Metadata validation row differs from the compiled scenario contract", )); @@ -135,7 +135,7 @@ pub fn validate_solana_program_metadata_validation_matrix( | crate::SolanaProgramMetadataValidationStatus::Unavailable ) && !operation.evidence.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_validation_unobserved_with_evidence", "not-run or unavailable validation rows must not contain observed evidence", )); @@ -151,7 +151,7 @@ pub fn validate_solana_program_metadata_validation_matrix( .iter() .all(|kind| return observed.contains(kind.as_str())) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_validation_confirmed_without_evidence", "confirmed validation row lacks required evidence", )); diff --git a/kb-pipeline-demo-scenarios/src/solana.rs b/ks-pipeline-demo-scenarios/src/solana.rs similarity index 83% rename from kb-pipeline-demo-scenarios/src/solana.rs rename to ks-pipeline-demo-scenarios/src/solana.rs index 767a856..3678a0c 100644 --- a/kb-pipeline-demo-scenarios/src/solana.rs +++ b/ks-pipeline-demo-scenarios/src/solana.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/solana.rs -// version: 11 +// file: ks-pipeline-demo-scenarios/src/solana.rs +// version: 12 //! Devnet Solana execution orchestration with canonical post-validation. @@ -62,9 +62,9 @@ impl crate::SolanaExecutionProgressEvent { /// Composite observer used by execution, backfill, extraction and decode replay. pub trait SolanaExecutionObserver: - kb_pipeline::BackfillObserver - + kb_pipeline::CoreExtractionObserver - + kb_pipeline::DecodeReplayObserver + ks_pipeline::BackfillObserver + + ks_pipeline::CoreExtractionObserver + + ks_pipeline::DecodeReplayObserver + Sync { /// Receives one execution-specific progress event. @@ -77,8 +77,8 @@ pub trait SolanaExecutionObserver: #[derive(Clone, Copy, Debug, Default)] pub struct NoopSolanaExecutionObserver; -impl kb_pipeline::BackfillObserver for crate::NoopSolanaExecutionObserver { - fn on_progress(&self, _event: &kb_pipeline::BackfillProgressEvent) { +impl ks_pipeline::BackfillObserver for crate::NoopSolanaExecutionObserver { + fn on_progress(&self, _event: &ks_pipeline::BackfillProgressEvent) { return; } @@ -87,8 +87,8 @@ impl kb_pipeline::BackfillObserver for crate::NoopSolanaExecutionObserver { } } -impl kb_pipeline::CoreExtractionObserver for crate::NoopSolanaExecutionObserver { - fn on_progress(&self, _event: &kb_pipeline::CoreExtractionProgressEvent) { +impl ks_pipeline::CoreExtractionObserver for crate::NoopSolanaExecutionObserver { + fn on_progress(&self, _event: &ks_pipeline::CoreExtractionProgressEvent) { return; } @@ -97,8 +97,8 @@ impl kb_pipeline::CoreExtractionObserver for crate::NoopSolanaExecutionObserver } } -impl kb_pipeline::DecodeReplayObserver for crate::NoopSolanaExecutionObserver { - fn on_progress(&self, _event: &kb_pipeline::DecodeReplayProgressEvent) { +impl ks_pipeline::DecodeReplayObserver for crate::NoopSolanaExecutionObserver { + fn on_progress(&self, _event: &ks_pipeline::DecodeReplayProgressEvent) { return; } @@ -127,7 +127,7 @@ pub struct DevnetSystemTransferRequest { /// Endpoint role used for simulation, submission and signature status polling. pub transaction_role: std::string::String, /// Recipient public key. - pub recipient: kb_lib::MdPubkey, + pub recipient: ks_lib::MdPubkey, /// Lamports transferred by the System instruction. pub lamports: u64, /// Maximum faucet airdrop requested only when the source balance is insufficient. @@ -148,7 +148,7 @@ impl crate::DevnetSystemTransferRequest { /// Creates a conservative simulation-only request. pub fn new( intent_id: impl std::convert::Into, - recipient: kb_lib::MdPubkey, + recipient: ks_lib::MdPubkey, lamports: u64, ) -> Self { return Self { @@ -167,18 +167,18 @@ impl crate::DevnetSystemTransferRequest { } /// Validates request-local values independently from one profile. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "devnet execution intent id must not be empty", )); } if self.query_role.trim().is_empty() || self.transaction_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "devnet execution endpoint roles must not be empty", )); } - let recipient_result = kb_onchain_transport::validate_solana_pubkey_text( + let recipient_result = ks_onchain_transport::validate_solana_pubkey_text( self.recipient.0.as_str(), "devnet System transfer recipient", ); @@ -186,12 +186,12 @@ impl crate::DevnetSystemTransferRequest { return std::result::Result::Err(error); } if self.lamports == 0 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "devnet System transfer lamports must be greater than zero", )); } if self.post_validation_max_retries > 20 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "post-execution getTransaction retries must not exceed 20", )); } @@ -205,13 +205,13 @@ pub struct DevnetSystemTransferSummary { /// Profile used by the orchestration. pub profile_name: std::string::String, /// Classified cluster. - pub cluster: kb_lib::ExApiExecutionCluster, + pub cluster: ks_lib::ExApiExecutionCluster, /// Genesis hash returned by the selected endpoint. pub genesis_hash: std::string::String, /// Non-secret persistent wallet description. - pub wallet: kb_wallet::WalletSummary, + pub wallet: ks_wallet::WalletSummary, /// Transfer recipient. - pub recipient: kb_lib::MdPubkey, + pub recipient: ks_lib::MdPubkey, /// Whether the recipient account existed before execution. pub recipient_existed_before: bool, /// Recipient balance before execution when the account existed. @@ -223,47 +223,47 @@ pub struct DevnetSystemTransferSummary { /// Source wallet balance after optional funding. pub balance_after_funding_lamports: u64, /// Faucet signature when an airdrop was required. - pub airdrop_signature: std::option::Option, + pub airdrop_signature: std::option::Option, /// Airdrop confirmation when an airdrop was required. - pub airdrop_confirmation: std::option::Option, + pub airdrop_confirmation: std::option::Option, /// Exact prepared plan. - pub plan: kb_lib::ExApiPreparedExecutionPlan, + pub plan: ks_lib::ExApiPreparedExecutionPlan, /// Recent blockhash and expiration height used by the transaction. - pub latest_blockhash: kb_onchain_transport::LatestBlockhashResult, + pub latest_blockhash: ks_onchain_transport::LatestBlockhashResult, /// Fee estimate for the exact compiled message. - pub fee: kb_onchain_transport::FeeForMessageResult, + pub fee: ks_onchain_transport::FeeForMessageResult, /// Exact simulation result bound to the compiled message. - pub simulation: kb_lib::ExApiExecutionSimulationResult, + pub simulation: ks_lib::ExApiExecutionSimulationResult, /// Submission result when `submit` was enabled. - pub send_result: std::option::Option, + pub send_result: std::option::Option, /// Confirmation result when the transaction was submitted. - pub confirmation: std::option::Option, + pub confirmation: std::option::Option, /// Canonical hydration result after an observed transaction reached a terminal status. - pub backfill: std::option::Option, + pub backfill: std::option::Option, /// Core extraction result for the exact signature. - pub core_extraction: std::option::Option, + pub core_extraction: std::option::Option, /// Contextual decode result for the exact signature. - pub decode_replay: std::option::Option, + pub decode_replay: std::option::Option, /// Aggregated post-execution validation diagnostic. - pub post_execution: std::option::Option, + pub post_execution: std::option::Option, } /// Executes a bounded Devnet System transfer and its canonical replay validation. #[allow(clippy::too_many_arguments)] pub async fn execute_devnet_system_transfer( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetSystemTransferRequest, - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { @@ -291,9 +291,9 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if genesis.classified_cluster - != std::option::Option::Some(kb_lib::ExApiExecutionCluster::Devnet) + != std::option::Option::Some(ks_lib::ExApiExecutionCluster::Devnet) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_cluster_mismatch", format!( "expected Devnet genesis hash but endpoint returned {} classified as {:?}", @@ -310,13 +310,13 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let wallet_summary = wallet.summary(); - let source_pubkey = kb_lib::MdPubkey(wallet_summary.public_key.clone()); + let source_pubkey = ks_lib::MdPubkey(wallet_summary.public_key.clone()); if source_pubkey == request.recipient { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "devnet System transfer recipient must differ from the source wallet", )); } - let account_info_config = kb_onchain_transport::GetAccountInfoConfig::confirmed(); + let account_info_config = ks_onchain_transport::GetAccountInfoConfig::confirmed(); let recipient_account = match http_pool .get_account_info_for_role( request.query_role.as_str(), @@ -335,7 +335,7 @@ where 0 } else { let rent_config = - kb_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(); + ks_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(); let rent = match http_pool .get_minimum_balance_for_rent_exemption_for_role( request.query_role.as_str(), @@ -357,7 +357,7 @@ where if let std::result::Result::Err(error) = recipient_validation { return std::result::Result::Err(error); } - let balance_config = kb_onchain_transport::GetBalanceConfig::confirmed(); + let balance_config = ks_onchain_transport::GetBalanceConfig::confirmed(); let balance_before = match http_pool .get_balance_for_role(request.query_role.as_str(), &source_pubkey, &balance_config) .await @@ -368,7 +368,7 @@ where let required_balance = match request.lamports.checked_add(profile.execution.max_fee_lamports) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "devnet transfer amount plus fee ceiling overflows u64", )); }, @@ -395,17 +395,17 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let plan_evaluation = match kb_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { + let plan_evaluation = match ks_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if plan_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if plan_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "execution_plan_denied", violation_message(plan_evaluation.violations.as_slice()), )); } - let latest_config = kb_onchain_transport::GetLatestBlockhashConfig::confirmed(); + let latest_config = ks_onchain_transport::GetLatestBlockhashConfig::confirmed(); let latest_blockhash = match http_pool .get_latest_blockhash_for_role(request.query_role.as_str(), &latest_config) .await @@ -413,15 +413,15 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let unsigned = match kb_lib::executor_solana_build_legacy_transaction( + let unsigned = match ks_lib::executor_solana_build_legacy_transaction( &plan, latest_blockhash.blockhash.as_str(), ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let fee_config = kb_onchain_transport::GetFeeForMessageConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let fee_config = ks_onchain_transport::GetFeeForMessageConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, std::option::Option::Some(latest_blockhash.context.slot), ); let message_base64 = unsigned.message_base64(); @@ -437,7 +437,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if fee.fee_lamports.is_none() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_fee_unavailable", "getFeeForMessage returned null for the selected recent blockhash", )); @@ -446,8 +446,8 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let simulation_config = match kb_onchain_transport::SimulateTransactionConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let simulation_config = match ks_onchain_transport::SimulateTransactionConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, false, false, std::option::Option::Some(latest_blockhash.context.slot), @@ -478,8 +478,8 @@ where let blockhash_age_slots = simulation_rpc.context.slot.saturating_sub(latest_blockhash.context.slot); let simulation = simulation_rpc.to_execution_result( - kb_lib::ExApiExecutionCluster::Devnet, - kb_lib::ExApiExecutionBlockhashKind::Latest, + ks_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionBlockhashKind::Latest, std::option::Option::Some(blockhash_age_slots), std::option::Option::None, std::option::Option::None, @@ -488,7 +488,7 @@ where let evidence = unsigned.bind_simulation(simulation.clone()); let mut summary = crate::DevnetSystemTransferSummary { profile_name: profile.name.clone(), - cluster: kb_lib::ExApiExecutionCluster::Devnet, + cluster: ks_lib::ExApiExecutionCluster::Devnet, genesis_hash: genesis.genesis_hash, wallet: wallet_summary, recipient: request.recipient.clone(), @@ -514,7 +514,7 @@ where return std::result::Result::Ok(summary); } if !summary.simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_simulation_failed", simulation_failure_message(&summary.simulation), )); @@ -529,7 +529,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }, false => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_simulation_message_mismatch", "simulation evidence does not match the unsigned transaction", )); @@ -540,7 +540,7 @@ where return std::result::Result::Err(error); } let signature = signed.primary_signature().clone(); - let mut post_execution = kb_lib::ExApiPostExecutionDiagnostic { + let mut post_execution = ks_lib::ExApiPostExecutionDiagnostic { signature: signature.clone(), canonical_inserted: false, core_extracted: false, @@ -548,7 +548,7 @@ where materialized: false, diagnostics: std::vec::Vec::new(), }; - let send_config = match kb_onchain_transport::SendTransactionConfig::from_execution_config( + let send_config = match ks_onchain_transport::SendTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(summary.latest_blockhash.context.slot), ) { @@ -591,9 +591,9 @@ where }, }; summary.send_result = - std::option::Option::Some(sent.to_execution_result(kb_lib::ExApiExecutionCluster::Devnet)); + std::option::Option::Some(sent.to_execution_result(ks_lib::ExApiExecutionCluster::Devnet)); let confirmation_config = - match kb_onchain_transport::ConfirmTransactionConfig::from_execution_config( + match ks_onchain_transport::ConfirmTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(summary.latest_blockhash.last_valid_block_height), std::option::Option::Some(summary.latest_blockhash.context.slot), @@ -611,7 +611,7 @@ where .confirm_transaction_for_roles( request.transaction_role.as_str(), request.query_role.as_str(), - kb_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionCluster::Devnet, &signature, &confirmation_config, ) @@ -637,8 +637,8 @@ where }; let confirmation_status = confirmation.status; summary.confirmation = std::option::Option::Some(confirmation); - if confirmation_status == kb_lib::ExApiExecutionConfirmationStatus::Expired - || confirmation_status == kb_lib::ExApiExecutionConfirmationStatus::TimedOut + if confirmation_status == ks_lib::ExApiExecutionConfirmationStatus::Expired + || confirmation_status == ks_lib::ExApiExecutionConfirmationStatus::TimedOut { post_execution.diagnostics.push(format!( "transaction was submitted but post-validation stopped at confirmation status {:?}", @@ -679,14 +679,14 @@ where summary.post_execution = std::option::Option::Some(post_execution); return std::result::Result::Ok(summary); } - let extraction_request = kb_pipeline::CoreExtractionRequest { - source: kb_pipeline::CoreExtractionSource::Signatures(std::vec![signature.0.clone()]), + let extraction_request = ks_pipeline::CoreExtractionRequest { + source: ks_pipeline::CoreExtractionSource::Signatures(std::vec![signature.0.clone()]), limit: 1, max_concurrent_extractions: 1, force_replay: request.force_post_validation_replay, }; let extraction = - match kb_pipeline::execute_core_extraction(store, &extraction_request, observer).await { + match ks_pipeline::execute_core_extraction(store, &extraction_request, observer).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { post_execution @@ -715,12 +715,12 @@ where .iter() .map(|instruction| return instruction.program_id.0.clone()) .collect::>(); - let selection = match kb_store::DecodeSelectionFilter::new( + let selection = match ks_store::DecodeSelectionFilter::new( std::vec![signature.0.clone()], std::vec![ - kb_store::CoreInstructionProcessingState::Pending, - kb_store::CoreInstructionProcessingState::Failed, - kb_store::CoreInstructionProcessingState::ReplayRequested, + ks_store::CoreInstructionProcessingState::Pending, + ks_store::CoreInstructionProcessingState::Failed, + ks_store::CoreInstructionProcessingState::ReplayRequested, ], std::option::Option::None, std::option::Option::None, @@ -738,17 +738,17 @@ where return std::result::Result::Ok(summary); }, }; - let decode_request = kb_pipeline::DecodeReplayRequest { - campaign_id: kb_pipeline::new_decode_campaign_id(), + let decode_request = ks_pipeline::DecodeReplayRequest { + campaign_id: ks_pipeline::new_decode_campaign_id(), selection, decoder_names: std::vec::Vec::new(), - dispatch_policy: kb_pipeline::DecodeDispatchPolicy::HighestPriority, + dispatch_policy: ks_pipeline::DecodeDispatchPolicy::HighestPriority, max_concurrent_inputs: 1, force_replay: request.force_post_validation_replay, force_replay_all_matching: false, materialize_after_decode: request.materialize_after_decode, }; - let decode = match kb_pipeline::execute_decode_replay( + let decode = match ks_pipeline::execute_decode_replay( store, &decode_request, decoders, @@ -789,7 +789,7 @@ where post_execution.decode_replayed = decode_replayed; post_execution.materialized = materialized; summary.decode_replay = std::option::Option::Some(decode); - if confirmation_status == kb_lib::ExApiExecutionConfirmationStatus::Failed { + if confirmation_status == ks_lib::ExApiExecutionConfirmationStatus::Failed { post_execution.diagnostics.push( "transaction was committed with an on-chain error and replayed as a failed intent" .to_string(), @@ -831,30 +831,30 @@ where } async fn execute_post_validation_backfill( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, request: &crate::DevnetSystemTransferRequest, observer: &O, - signature: &kb_lib::MdSignature, -) -> kb_core::Result + signature: &ks_lib::MdSignature, +) -> ks_core::Result where - S: kb_store::RawTransactionStore + Sync, + S: ks_store::RawTransactionStore + Sync, O: crate::SolanaExecutionObserver, { let mut retry_index = 0_u32; loop { - let backfill_request = kb_pipeline::BackfillRequest { + let backfill_request = ks_pipeline::BackfillRequest { role: request.query_role.clone(), commitment: "confirmed".to_string(), - source: kb_pipeline::BackfillSource::ExplicitSignatures(std::vec![signature.0.clone()]), + source: ks_pipeline::BackfillSource::ExplicitSignatures(std::vec![signature.0.clone()]), page_size: 1, max_pages: 1, max_concurrent_requests: 1, max_retries: 0, }; let backfill = - match kb_pipeline::execute_http_backfill(http_pool, store, &backfill_request, observer) + match ks_pipeline::execute_http_backfill(http_pool, store, &backfill_request, observer) .await { std::result::Result::Ok(value) => value, @@ -882,7 +882,7 @@ where } } -fn canonical_backfill_available(summary: &kb_pipeline::BackfillSummary) -> bool { +fn canonical_backfill_available(summary: &ks_pipeline::BackfillSummary) -> bool { return summary.failed == 0 && summary.missing == 0 && summary.candidates_completed == 1 @@ -899,9 +899,9 @@ fn validate_recipient_transfer_amount( recipient_exists: bool, lamports: u64, minimum_balance_lamports: u64, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if !recipient_exists && lamports < minimum_balance_lamports { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_recipient_rent_exemption_required", format!( "recipient account does not exist: transfer requires at least {minimum_balance_lamports} lamports for a zero-data rent-exempt account, requested {lamports}" @@ -912,7 +912,7 @@ fn validate_recipient_transfer_amount( } pub(crate) fn simulation_failure_message( - simulation: &kb_lib::ExApiExecutionSimulationResult, + simulation: &ks_lib::ExApiExecutionSimulationResult, ) -> std::string::String { let error = match simulation.error.as_deref() { std::option::Option::Some(value) => value, @@ -931,44 +931,44 @@ pub(crate) fn simulation_failure_message( #[derive(Clone, Debug, Eq, PartialEq)] struct FundingResult { balance_after_lamports: u64, - airdrop_signature: std::option::Option, - airdrop_confirmation: std::option::Option, + airdrop_signature: std::option::Option, + airdrop_confirmation: std::option::Option, } fn validate_devnet_profile( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, request: &crate::DevnetSystemTransferRequest, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if profile.wallet.cluster != "devnet" { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "profile {} wallet cluster must be devnet for this orchestration", profile.name ))); } if !profile.wallet.temporary_wallet_enabled || !profile.wallet.temporary_wallet_persist { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet execution requires an enabled persistent temporary wallet", )); } if !profile.execution.require_simulation { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet execution requires simulation in the active profile", )); } if request.lamports > profile.execution.devnet_max_spend_lamports { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "requested transfer {} exceeds Devnet spend ceiling {}", request.lamports, profile.execution.devnet_max_spend_lamports ))); } if request.airdrop_lamports > profile.execution.devnet_airdrop_max_lamports { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "requested airdrop {} exceeds Devnet airdrop ceiling {}", request.airdrop_lamports, profile.execution.devnet_airdrop_max_lamports ))); } if request.submit && !profile.wallet.devnet_send_enabled { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet transaction submission is disabled by the wallet profile", )); } @@ -976,7 +976,7 @@ fn validate_devnet_profile( && profile.execution.require_operator_confirmation && !request.operator_confirmed { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet submission requires explicit operator confirmation", )); } @@ -984,20 +984,20 @@ fn validate_devnet_profile( } pub(crate) async fn load_profile_wallet( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, -) -> kb_core::Result { +) -> ks_core::Result { let configured = std::path::PathBuf::from(profile.wallet.wallet_dir.as_str()); let directory = if configured.is_absolute() { configured } else { workspace_root.join(configured) }; - let store = match kb_wallet::TemporaryWalletStore::new(directory) { + let store = match ks_wallet::TemporaryWalletStore::new(directory) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let alias = match kb_wallet::WalletAlias::parse(profile.wallet.temporary_wallet_alias.clone()) { + let alias = match ks_wallet::WalletAlias::parse(profile.wallet.temporary_wallet_alias.clone()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -1005,14 +1005,14 @@ pub(crate) async fn load_profile_wallet( } async fn ensure_devnet_funding( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, request: &crate::DevnetSystemTransferRequest, observer: &O, - source_pubkey: &kb_lib::MdPubkey, + source_pubkey: &ks_lib::MdPubkey, balance_before_lamports: u64, required_balance_lamports: u64, -) -> kb_core::Result +) -> ks_core::Result where O: crate::SolanaExecutionObserver, { @@ -1024,7 +1024,7 @@ where }); } if !request.submit { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_balance_insufficient", format!( "wallet balance {} is below required {} and simulation-only mode cannot request a funding transaction", @@ -1033,7 +1033,7 @@ where )); } if request.airdrop_lamports == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_airdrop_required", format!( "wallet balance {} is below required {}; configure a bounded Devnet airdrop", @@ -1044,13 +1044,13 @@ where let projected_balance = match balance_before_lamports.checked_add(request.airdrop_lamports) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet balance plus airdrop overflows u64", )); }, }; if projected_balance < required_balance_lamports { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "configured airdrop would raise balance only to {}, below required {}", projected_balance, required_balance_lamports ))); @@ -1067,7 +1067,7 @@ where request.query_role.as_str(), source_pubkey, request.airdrop_lamports, - &kb_onchain_transport::RequestAirdropConfig::confirmed(), + &ks_onchain_transport::RequestAirdropConfig::confirmed(), ) .await { @@ -1075,7 +1075,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let confirmation_config = - match kb_onchain_transport::ConfirmTransactionConfig::from_execution_config( + match ks_onchain_transport::ConfirmTransactionConfig::from_execution_config( &profile.execution, std::option::Option::None, std::option::Option::None, @@ -1087,7 +1087,7 @@ where .confirm_transaction_for_roles( request.transaction_role.as_str(), request.query_role.as_str(), - kb_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionCluster::Devnet, &airdrop.signature, &confirmation_config, ) @@ -1096,10 +1096,10 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if confirmation.status != kb_lib::ExApiExecutionConfirmationStatus::Confirmed - && confirmation.status != kb_lib::ExApiExecutionConfirmationStatus::Finalized + if confirmation.status != ks_lib::ExApiExecutionConfirmationStatus::Confirmed + && confirmation.status != ks_lib::ExApiExecutionConfirmationStatus::Finalized { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_airdrop_not_confirmed", format!("Devnet airdrop ended with confirmation status {:?}", confirmation.status), )); @@ -1108,7 +1108,7 @@ where .get_balance_for_role( request.query_role.as_str(), source_pubkey, - &kb_onchain_transport::GetBalanceConfig::confirmed(), + &ks_onchain_transport::GetBalanceConfig::confirmed(), ) .await { @@ -1116,7 +1116,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if balance.lamports < required_balance_lamports { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_balance_still_insufficient", format!( "confirmed airdrop left balance {} below required {}", @@ -1132,26 +1132,26 @@ where } fn build_transfer_plan( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, request: &crate::DevnetSystemTransferRequest, - source_pubkey: kb_lib::MdPubkey, -) -> kb_core::Result { - let policy = kb_lib::ExApiExecutionPolicy { - cluster: kb_lib::ExApiExecutionClusterPolicy { - expected_cluster: kb_lib::ExApiExecutionCluster::Devnet, + source_pubkey: ks_lib::MdPubkey, +) -> ks_core::Result { + let policy = ks_lib::ExApiExecutionPolicy { + cluster: ks_lib::ExApiExecutionClusterPolicy { + expected_cluster: ks_lib::ExApiExecutionCluster::Devnet, allow_mainnet: false, mainnet_confirmation: false, }, - simulation: kb_lib::ExApiExecutionSimulationPolicy::Required, - blockhash: kb_lib::ExApiExecutionBlockhashPolicy { - kind: kb_lib::ExApiExecutionBlockhashKind::Latest, + simulation: ks_lib::ExApiExecutionSimulationPolicy::Required, + blockhash: ks_lib::ExApiExecutionBlockhashPolicy { + kind: ks_lib::ExApiExecutionBlockhashKind::Latest, max_age_slots: std::option::Option::Some( profile.execution.recent_blockhash_max_age_slots, ), nonce_account: std::option::Option::None, nonce_authority: std::option::Option::None, }, - cost_limit: kb_lib::ExApiExecutionCostLimit { + cost_limit: ks_lib::ExApiExecutionCostLimit { max_spend_lamports: std::option::Option::Some( profile.execution.devnet_max_spend_lamports, ), @@ -1162,28 +1162,28 @@ fn build_transfer_plan( }, authorized_signers: std::vec![source_pubkey.clone()], dry_run: !request.submit, - post_execution_validation: kb_lib::ExApiPostExecutionValidationPolicy { + post_execution_validation: ks_lib::ExApiPostExecutionValidationPolicy { canonical_insert_required: request.submit, core_extraction_required: request.submit, decode_replay_required: request.submit, materialization_required: request.submit && request.materialize_after_decode, }, }; - let intent = kb_lib::ExSolanaCoreExecutionIntent { + let intent = ks_lib::ExSolanaCoreExecutionIntent { intent_id: request.intent_id.clone(), fee_payer: source_pubkey.clone(), policy, - operation: kb_lib::ExSolanaCoreOperation::SystemTransfer { + operation: ks_lib::ExSolanaCoreOperation::SystemTransfer { from: source_pubkey, to: request.recipient.clone(), lamports: request.lamports, }, }; - let executor = kb_lib::ExSolanaCoreExecutor; - return kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan(&executor, &intent); + let executor = ks_lib::ExSolanaCoreExecutor; + return ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan(&executor, &intent); } -pub(crate) fn violation_message(violations: &[kb_lib::ExSafetyViolation]) -> std::string::String { +pub(crate) fn violation_message(violations: &[ks_lib::ExSafetyViolation]) -> std::string::String { if violations.is_empty() { return "execution policy denied the plan without a diagnostic".to_string(); } @@ -1194,12 +1194,12 @@ pub(crate) fn violation_message(violations: &[kb_lib::ExSafetyViolation]) -> std .join("; "); } -pub(crate) fn ensure_not_cancelled(observer: &O, stage: &str) -> kb_core::Result<()> +pub(crate) fn ensure_not_cancelled(observer: &O, stage: &str) -> ks_core::Result<()> where O: crate::SolanaExecutionObserver, { if observer.is_execution_cancelled() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_cancelled", format!("execution was cancelled before stage {stage}"), )); @@ -1223,9 +1223,9 @@ pub(crate) fn emit( #[cfg(test)] mod tests { - fn example_devnet_profile() -> kb_config::ProfileConfig { + fn example_devnet_profile() -> ks_config::ProfileConfig { let config = - match kb_config::parse_config_json(include_str!("../../config/example.config.json")) { + match ks_config::parse_config_json(include_str!("../../config/example.config.json")) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("example config parse failed: {error}"), }; @@ -1235,8 +1235,8 @@ mod tests { }; } - fn recipient() -> kb_lib::MdPubkey { - return kb_lib::MdPubkey("Vote111111111111111111111111111111111111111".to_string()); + fn recipient() -> ks_lib::MdPubkey { + return ks_lib::MdPubkey("Vote111111111111111111111111111111111111111".to_string()); } #[test] @@ -1256,7 +1256,7 @@ mod tests { #[test] fn resolved_devnet_profile_routes_complete_execution_flow() { let profile = example_devnet_profile(); - let pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("HTTP pool creation failed: {error}"), }; @@ -1286,18 +1286,18 @@ mod tests { let mut request = crate::DevnetSystemTransferRequest::new("intent-2", recipient(), 5_000); request.submit = true; request.operator_confirmed = true; - let source = kb_lib::MdPubkey("11111111111111111111111111111111".to_string()); + let source = ks_lib::MdPubkey("11111111111111111111111111111111".to_string()); let plan = match super::build_transfer_plan(&profile, &request, source.clone()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("plan build failed: {error}"), }; assert_eq!(plan.fee_payer, source); assert_eq!(plan.requested_spend_lamports, 5_000); - assert_eq!(plan.policy.cluster.expected_cluster, kb_lib::ExApiExecutionCluster::Devnet); + assert_eq!(plan.policy.cluster.expected_cluster, ks_lib::ExApiExecutionCluster::Devnet); assert!(!plan.policy.dry_run); assert!(plan.policy.post_execution_validation.canonical_insert_required); assert_eq!(plan.instructions.len(), 1); - assert_eq!(plan.operation_code, kb_lib::EX_SOLANA_CORE_SYSTEM_TRANSFER_OPERATION); + assert_eq!(plan.operation_code, ks_lib::EX_SOLANA_CORE_SYSTEM_TRANSFER_OPERATION); } #[test] @@ -1309,11 +1309,11 @@ mod tests { #[test] fn simulation_failure_message_preserves_runtime_error_and_logs() { - let simulation = kb_lib::ExApiExecutionSimulationResult { + let simulation = ks_lib::ExApiExecutionSimulationResult { simulated: true, success: false, - cluster: kb_lib::ExApiExecutionCluster::Devnet, - blockhash_kind: kb_lib::ExApiExecutionBlockhashKind::Latest, + cluster: ks_lib::ExApiExecutionCluster::Devnet, + blockhash_kind: ks_lib::ExApiExecutionBlockhashKind::Latest, blockhash_age_slots: std::option::Option::Some(1), replacement_blockhash: std::option::Option::None, replacement_last_valid_block_height: std::option::Option::None, @@ -1349,11 +1349,11 @@ mod tests { if let std::result::Result::Ok(directory) = std::env::var("KB_DEVNET_WALLET_DIR") { profile.wallet.wallet_dir = directory; } - let pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("HTTP pool creation failed: {error}"), }; - let store_options = match kb_store::PostgresStoreOptions::new( + let store_options = match ks_store::PostgresStoreOptions::new( profile.database.postgres.url.clone(), profile.database.postgres.max_connections, profile.database.postgres.connect_timeout_ms, @@ -1362,18 +1362,18 @@ mod tests { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("PostgreSQL options failed: {error}"), }; - let store = match kb_store::PostgresStore::connect(store_options).await { + let store = match ks_store::PostgresStore::connect(store_options).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("PostgreSQL connection failed: {error}"), }; if let std::result::Result::Err(error) = store.initialize_store_schema().await { panic!("PostgreSQL schema initialization failed: {error}"); } - let recipient_alias = match kb_wallet::WalletAlias::parse("devnet-recipient") { + let recipient_alias = match ks_wallet::WalletAlias::parse("devnet-recipient") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("recipient alias failed: {error}"), }; - let recipient_wallet = kb_wallet::TemporaryWallet::generate(recipient_alias); + let recipient_wallet = ks_wallet::TemporaryWallet::generate(recipient_alias); let transfer_lamports = std::env::var("KB_DEVNET_TRANSFER_LAMPORTS") .ok() .and_then(|value| return value.parse::().ok()) @@ -1384,16 +1384,16 @@ mod tests { .unwrap_or(100_000_000); let mut request = crate::DevnetSystemTransferRequest::new( format!("devnet-test-{}", uuid::Uuid::new_v4()), - kb_lib::MdPubkey(recipient_wallet.public_key()), + ks_lib::MdPubkey(recipient_wallet.public_key()), transfer_lamports, ); request.airdrop_lamports = airdrop_lamports; request.post_validation_max_retries = 20; request.submit = true; request.operator_confirmed = true; - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcSolanaCoreDecoder,)]; - let materializers: std::vec::Vec> = + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcSolanaCoreDecoder,)]; + let materializers: std::vec::Vec> = std::vec::Vec::new(); let workspace_root = match std::path::Path::new(env!("CARGO_MANIFEST_DIR")).parent() { std::option::Option::Some(value) => value, @@ -1419,8 +1419,8 @@ mod tests { std::option::Option::None => panic!("transaction confirmation missing"), }; assert!( - confirmation.status == kb_lib::ExApiExecutionConfirmationStatus::Confirmed - || confirmation.status == kb_lib::ExApiExecutionConfirmationStatus::Finalized + confirmation.status == ks_lib::ExApiExecutionConfirmationStatus::Confirmed + || confirmation.status == ks_lib::ExApiExecutionConfirmationStatus::Finalized ); let post_execution = match summary.post_execution { std::option::Option::Some(value) => value, diff --git a/kb-pipeline-demo-scenarios/src/spl.rs b/ks-pipeline-demo-scenarios/src/spl.rs similarity index 74% rename from kb-pipeline-demo-scenarios/src/spl.rs rename to ks-pipeline-demo-scenarios/src/spl.rs index b78e859..7d24cb8 100644 --- a/kb-pipeline-demo-scenarios/src/spl.rs +++ b/ks-pipeline-demo-scenarios/src/spl.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/spl.rs -// version: 1 +// file: ks-pipeline-demo-scenarios/src/spl.rs +// version: 2 //! SPL-oriented reusable demo and Devnet validation scenarios. diff --git a/kb-pipeline-demo-scenarios/src/spl/associated_token_account.rs b/ks-pipeline-demo-scenarios/src/spl/associated_token_account.rs similarity index 79% rename from kb-pipeline-demo-scenarios/src/spl/associated_token_account.rs rename to ks-pipeline-demo-scenarios/src/spl/associated_token_account.rs index b923594..7fe3cd3 100644 --- a/kb-pipeline-demo-scenarios/src/spl/associated_token_account.rs +++ b/ks-pipeline-demo-scenarios/src/spl/associated_token_account.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/spl/associated_token_account.rs -// version: 10 +// file: ks-pipeline-demo-scenarios/src/spl/associated_token_account.rs +// version: 11 //! Devnet ATA execution with stateful and canonical post-validation. @@ -13,7 +13,7 @@ pub struct DevnetSplAssociatedTokenAccountExecutionRequest { /// Endpoint role used for simulation, submission and confirmation polling. pub transaction_role: std::string::String, /// Exact typed SPL Associated Token Account operation. - pub operation: kb_lib::ExSplAssociatedTokenAccountOperation, + pub operation: ks_lib::ExSplAssociatedTokenAccountOperation, /// Explicitly authorizes signing and submission after successful simulation. pub submit: bool, /// Explicit operator confirmation required by the active profile. @@ -28,7 +28,7 @@ impl DevnetSplAssociatedTokenAccountExecutionRequest { /// Creates a conservative simulation-only request. pub fn new( intent_id: impl std::convert::Into, - operation: kb_lib::ExSplAssociatedTokenAccountOperation, + operation: ks_lib::ExSplAssociatedTokenAccountOperation, ) -> Self { return Self { intent_id: intent_id.into(), @@ -43,19 +43,19 @@ impl DevnetSplAssociatedTokenAccountExecutionRequest { } /// Validates request-local bounds independently from one profile. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet SPL Associated Token Account execution intent id must not be empty", )); } if self.query_role.trim().is_empty() || self.transaction_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet SPL Associated Token Account execution endpoint roles must not be empty", )); } if self.post_validation_max_retries > 20 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "post-execution getTransaction retries must not exceed 20", )); } @@ -69,64 +69,64 @@ pub struct DevnetSplAssociatedTokenAccountExecutionSummary { /// Profile used by the orchestration. pub profile_name: std::string::String, /// Exact classified cluster. - pub cluster: kb_lib::ExApiExecutionCluster, + pub cluster: ks_lib::ExApiExecutionCluster, /// Genesis hash returned by the selected endpoint. pub genesis_hash: std::string::String, /// Non-secret persistent wallet description. - pub wallet: kb_wallet::WalletSummary, + pub wallet: ks_wallet::WalletSummary, /// Wallet balance observed before planning. pub balance_lamports: u64, /// Stateful readiness report produced before plan simulation. - pub stateful_readiness: kb_pipeline::SplAssociatedTokenAccountStatefulReadinessReport, + pub stateful_readiness: ks_pipeline::SplAssociatedTokenAccountStatefulReadinessReport, /// Exact prepared Token plan. - pub plan: kb_lib::ExApiPreparedExecutionPlan, + pub plan: ks_lib::ExApiPreparedExecutionPlan, /// Recent blockhash used by the exact transaction. - pub latest_blockhash: kb_onchain_transport::LatestBlockhashResult, + pub latest_blockhash: ks_onchain_transport::LatestBlockhashResult, /// Fee estimate for the exact compiled message. - pub fee: kb_onchain_transport::FeeForMessageResult, + pub fee: ks_onchain_transport::FeeForMessageResult, /// Exact simulation result bound to the compiled message. - pub simulation: kb_lib::ExApiExecutionSimulationResult, + pub simulation: ks_lib::ExApiExecutionSimulationResult, /// Submission result when explicitly authorized. - pub send_result: std::option::Option, + pub send_result: std::option::Option, /// Confirmation result when submitted. - pub confirmation: std::option::Option, + pub confirmation: std::option::Option, /// Stateful account relationships observed after confirmation. pub post_state_validation: - std::option::Option, + std::option::Option, /// Canonical hydration result for the exact signature. - pub backfill: std::option::Option, + pub backfill: std::option::Option, /// Core extraction result for the exact signature. - pub core_extraction: std::option::Option, + pub core_extraction: std::option::Option, /// First Token decode and materialization replay. - pub decode_replay: std::option::Option, + pub decode_replay: std::option::Option, /// Second replay proving idempotence for the same decoder version and input. - pub idempotence_replay: std::option::Option, + pub idempotence_replay: std::option::Option, /// Exact materialized rows produced for the submitted Token transaction. - pub materializations: std::vec::Vec, + pub materializations: std::vec::Vec, /// Aggregated post-execution validation diagnostic. - pub post_execution: std::option::Option, + pub post_execution: std::option::Option, } struct PreparedAtaExecution { - wallet: kb_wallet::TemporaryWallet, - unsigned: kb_lib::ExSolanaUnsignedTransaction, - evidence: kb_lib::ExSolanaSimulationEvidence, + wallet: ks_wallet::TemporaryWallet, + unsigned: ks_lib::ExSolanaUnsignedTransaction, + evidence: ks_lib::ExSolanaSimulationEvidence, summary: DevnetSplAssociatedTokenAccountExecutionSummary, } /// Simulates one Devnet SPL Associated Token Account operation after stateful preflight. pub async fn simulate_devnet_spl_associated_token_account( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &DevnetSplAssociatedTokenAccountExecutionRequest, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where O: crate::SolanaExecutionObserver, { if request.submit { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "simulate_devnet_spl_associated_token_account requires submit=false", )); } @@ -141,19 +141,19 @@ where /// Executes one Devnet SPL Associated Token Account simulation or authorized submission. #[allow(clippy::too_many_arguments)] pub async fn execute_devnet_spl_associated_token_account( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &DevnetSplAssociatedTokenAccountExecutionRequest, - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { @@ -166,7 +166,7 @@ where return std::result::Result::Ok(prepared.summary); } if !prepared.summary.simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_simulation_failed", crate::simulation_failure_message(&prepared.summary.simulation), )); @@ -177,14 +177,14 @@ where ) { return std::result::Result::Err(error); } - let send_evaluation = match kb_lib::ExSafetyChecker + let send_evaluation = match ks_lib::ExSafetyChecker .evaluate_send(&prepared.summary.plan, &prepared.summary.simulation) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if send_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if send_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "execution_send_denied", crate::violation_message(send_evaluation.violations.as_slice()), )); @@ -201,7 +201,7 @@ where } let signature = signed.primary_signature().clone(); let mut summary = prepared.summary; - let mut diagnostic = kb_lib::ExApiPostExecutionDiagnostic { + let mut diagnostic = ks_lib::ExApiPostExecutionDiagnostic { signature: signature.clone(), canonical_inserted: false, core_extracted: false, @@ -209,7 +209,7 @@ where materialized: false, diagnostics: std::vec::Vec::new(), }; - let send_config = match kb_onchain_transport::SendTransactionConfig::from_execution_config( + let send_config = match ks_onchain_transport::SendTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(summary.latest_blockhash.context.slot), ) { @@ -235,9 +235,9 @@ where }, }; summary.send_result = - std::option::Option::Some(sent.to_execution_result(kb_lib::ExApiExecutionCluster::Devnet)); + std::option::Option::Some(sent.to_execution_result(ks_lib::ExApiExecutionCluster::Devnet)); let confirmation_config = - match kb_onchain_transport::ConfirmTransactionConfig::from_execution_config( + match ks_onchain_transport::ConfirmTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(summary.latest_blockhash.last_valid_block_height), std::option::Option::Some(summary.latest_blockhash.context.slot), @@ -249,7 +249,7 @@ where .confirm_transaction_for_roles( request.transaction_role.as_str(), request.query_role.as_str(), - kb_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionCluster::Devnet, &signature, &confirmation_config, ) @@ -268,8 +268,8 @@ where summary.confirmation = std::option::Option::Some(confirmation); if !matches!( confirmation_status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) { diagnostic.diagnostics.push(format!("SPL Associated Token Account post-validation stopped at confirmation status {confirmation_status:?}")); summary.post_execution = std::option::Option::Some(diagnostic); @@ -294,7 +294,7 @@ where }, }; let post_state_ready = - post_state.status == kb_pipeline::SplAssociatedTokenAccountStatefulReadinessStatus::Ready; + post_state.status == ks_pipeline::SplAssociatedTokenAccountStatefulReadinessStatus::Ready; summary.post_state_validation = std::option::Option::Some(post_state); if !post_state_ready { diagnostic.diagnostics.push("confirmed SPL Associated Token Account execution did not satisfy final account relationships".to_string()); @@ -328,10 +328,10 @@ where summary.post_execution = std::option::Option::Some(diagnostic); return std::result::Result::Ok(summary); } - let extraction = match kb_pipeline::execute_core_extraction( + let extraction = match ks_pipeline::execute_core_extraction( store, - &kb_pipeline::CoreExtractionRequest { - source: kb_pipeline::CoreExtractionSource::Signatures(std::vec![signature.0.clone()]), + &ks_pipeline::CoreExtractionRequest { + source: ks_pipeline::CoreExtractionSource::Signatures(std::vec![signature.0.clone()]), limit: 1, max_concurrent_extractions: 1, force_replay: request.force_post_validation_replay, @@ -385,7 +385,7 @@ where }; diagnostic.decode_replayed = decode_completed(&first_replay); summary.decode_replay = std::option::Option::Some(first_replay); - let filter = match kb_store::MaterializedEventFilter::new( + let filter = match ks_store::MaterializedEventFilter::new( std::option::Option::None, std::option::Option::None, std::option::Option::Some(signature.0.clone()), @@ -394,7 +394,7 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let rows = match kb_store::DecodePipelineStore::list_materialized_events(store, &filter).await { + let rows = match ks_store::DecodePipelineStore::list_materialized_events(store, &filter).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { diagnostic.diagnostics.push(format!( @@ -458,12 +458,12 @@ where } async fn prepare_execution( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &DevnetSplAssociatedTokenAccountExecutionRequest, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where O: crate::SolanaExecutionObserver, { @@ -481,9 +481,9 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if genesis.classified_cluster - != std::option::Option::Some(kb_lib::ExApiExecutionCluster::Devnet) + != std::option::Option::Some(ks_lib::ExApiExecutionCluster::Devnet) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_cluster_mismatch", format!( "expected Devnet genesis hash but endpoint returned {} classified as {:?}", @@ -496,12 +496,12 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let wallet_summary = wallet.summary(); - let fee_payer = kb_lib::MdPubkey(wallet_summary.public_key.clone()); + let fee_payer = ks_lib::MdPubkey(wallet_summary.public_key.clone()); let balance = match http_pool .get_balance_for_role( request.query_role.as_str(), &fee_payer, - &kb_onchain_transport::GetBalanceConfig::confirmed(), + &ks_onchain_transport::GetBalanceConfig::confirmed(), ) .await { @@ -509,7 +509,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if balance.lamports < profile.execution.max_fee_lamports { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_balance_insufficient", format!( "Devnet wallet balance {} is below the configured fee ceiling {}", @@ -522,18 +522,18 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let plan = match kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan( - &kb_lib::ExSplAssociatedTokenAccountExecutor, + let plan = match ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan( + &ks_lib::ExSplAssociatedTokenAccountExecutor, &intent, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let readiness = match kb_pipeline::inspect_spl_associated_token_account_stateful_readiness( + let readiness = match ks_pipeline::inspect_spl_associated_token_account_stateful_readiness( http_pool, - &kb_pipeline::SplAssociatedTokenAccountStatefulReadinessRequest { + &ks_pipeline::SplAssociatedTokenAccountStatefulReadinessRequest { query_role: request.query_role.clone(), - cluster: kb_lib::ExApiExecutionCluster::Devnet, + cluster: ks_lib::ExApiExecutionCluster::Devnet, intent, available_signers: std::vec![fee_payer.clone()], }, @@ -543,18 +543,18 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if readiness.status != kb_pipeline::SplAssociatedTokenAccountStatefulReadinessStatus::Ready { - return std::result::Result::Err(kb_core::Error::new( + if readiness.status != ks_pipeline::SplAssociatedTokenAccountStatefulReadinessStatus::Ready { + return std::result::Result::Err(ks_core::Error::new( "execution_spl_associated_token_account_stateful_blocked", failed_readiness_message(&readiness), )); } - let plan_evaluation = match kb_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { + let plan_evaluation = match ks_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if plan_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if plan_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "execution_plan_denied", crate::violation_message(plan_evaluation.violations.as_slice()), )); @@ -562,14 +562,14 @@ where let latest_blockhash = match http_pool .get_latest_blockhash_for_role( request.query_role.as_str(), - &kb_onchain_transport::GetLatestBlockhashConfig::confirmed(), + &ks_onchain_transport::GetLatestBlockhashConfig::confirmed(), ) .await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let unsigned = match kb_lib::executor_solana_build_legacy_transaction( + let unsigned = match ks_lib::executor_solana_build_legacy_transaction( &plan, latest_blockhash.blockhash.as_str(), ) { @@ -580,8 +580,8 @@ where .get_fee_for_message_for_role( request.query_role.as_str(), unsigned.message_base64().as_str(), - &kb_onchain_transport::GetFeeForMessageConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + &ks_onchain_transport::GetFeeForMessageConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, std::option::Option::Some(latest_blockhash.context.slot), ), ) @@ -591,7 +591,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if fee.fee_lamports.is_none() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_fee_unavailable", "getFeeForMessage returned null for the selected recent blockhash", )); @@ -600,8 +600,8 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let simulation_config = match kb_onchain_transport::SimulateTransactionConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let simulation_config = match ks_onchain_transport::SimulateTransactionConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, false, false, std::option::Option::Some(latest_blockhash.context.slot), @@ -633,8 +633,8 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let simulation = simulation_rpc.to_execution_result( - kb_lib::ExApiExecutionCluster::Devnet, - kb_lib::ExApiExecutionBlockhashKind::Latest, + ks_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionBlockhashKind::Latest, std::option::Option::Some( simulation_rpc.context.slot.saturating_sub(latest_blockhash.context.slot), ), @@ -645,7 +645,7 @@ where let evidence = unsigned.bind_simulation(simulation.clone()); let summary = DevnetSplAssociatedTokenAccountExecutionSummary { profile_name: profile.name.clone(), - cluster: kb_lib::ExApiExecutionCluster::Devnet, + cluster: ks_lib::ExApiExecutionCluster::Devnet, genesis_hash: genesis.genesis_hash, wallet: wallet_summary, balance_lamports: balance.lamports, @@ -668,26 +668,26 @@ where } fn validate_profile( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, request: &DevnetSplAssociatedTokenAccountExecutionRequest, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if profile.wallet.cluster != "devnet" { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "SPL Associated Token Account Devnet orchestration requires a Devnet wallet profile", )); } if !profile.wallet.temporary_wallet_enabled || !profile.wallet.temporary_wallet_persist { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "SPL Associated Token Account Devnet orchestration requires an enabled persistent temporary wallet", )); } if !profile.execution.require_simulation { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "SPL Associated Token Account Devnet orchestration requires simulation", )); } if request.submit && !profile.wallet.devnet_send_enabled { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet transaction submission is disabled by the wallet profile", )); } @@ -695,7 +695,7 @@ fn validate_profile( && profile.execution.require_operator_confirmation && !request.operator_confirmed { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "SPL Associated Token Account Devnet submission requires explicit operator confirmation", )); } @@ -703,46 +703,46 @@ fn validate_profile( } fn build_intent( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, request: &DevnetSplAssociatedTokenAccountExecutionRequest, - fee_payer: kb_lib::MdPubkey, -) -> kb_core::Result { + fee_payer: ks_lib::MdPubkey, +) -> ks_core::Result { let max_rent_lamports = if matches!( &request.operation, - kb_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { .. } + ks_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { .. } ) { 0 } else { profile.execution.devnet_max_spend_lamports }; let mut authorized_signers = std::vec![fee_payer.clone()]; - if let kb_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { wallet_owner, .. } = + if let ks_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { wallet_owner, .. } = &request.operation { if !authorized_signers.contains(wallet_owner) { authorized_signers.push(wallet_owner.clone()); } } - let intent = kb_lib::ExSplAssociatedTokenAccountExecutionIntent { + let intent = ks_lib::ExSplAssociatedTokenAccountExecutionIntent { intent_id: request.intent_id.clone(), fee_payer, max_rent_lamports, - policy: kb_lib::ExApiExecutionPolicy { - cluster: kb_lib::ExApiExecutionClusterPolicy { - expected_cluster: kb_lib::ExApiExecutionCluster::Devnet, + policy: ks_lib::ExApiExecutionPolicy { + cluster: ks_lib::ExApiExecutionClusterPolicy { + expected_cluster: ks_lib::ExApiExecutionCluster::Devnet, allow_mainnet: false, mainnet_confirmation: false, }, - simulation: kb_lib::ExApiExecutionSimulationPolicy::Required, - blockhash: kb_lib::ExApiExecutionBlockhashPolicy { - kind: kb_lib::ExApiExecutionBlockhashKind::Latest, + simulation: ks_lib::ExApiExecutionSimulationPolicy::Required, + blockhash: ks_lib::ExApiExecutionBlockhashPolicy { + kind: ks_lib::ExApiExecutionBlockhashKind::Latest, max_age_slots: std::option::Option::Some( profile.execution.recent_blockhash_max_age_slots, ), nonce_account: std::option::Option::None, nonce_authority: std::option::Option::None, }, - cost_limit: kb_lib::ExApiExecutionCostLimit { + cost_limit: ks_lib::ExApiExecutionCostLimit { max_spend_lamports: std::option::Option::Some(max_rent_lamports), max_fee_lamports: std::option::Option::Some(profile.execution.max_fee_lamports), max_compute_unit_price_micro_lamports: std::option::Option::Some( @@ -751,7 +751,7 @@ fn build_intent( }, authorized_signers, dry_run: !request.submit, - post_execution_validation: kb_lib::ExApiPostExecutionValidationPolicy { + post_execution_validation: ks_lib::ExApiPostExecutionValidationPolicy { canonical_insert_required: true, core_extraction_required: true, decode_replay_required: true, @@ -764,7 +764,7 @@ fn build_intent( } fn failed_readiness_message( - readiness: &kb_pipeline::SplAssociatedTokenAccountStatefulReadinessReport, + readiness: &ks_pipeline::SplAssociatedTokenAccountStatefulReadinessReport, ) -> std::string::String { let failures = readiness .checks @@ -780,35 +780,35 @@ fn failed_readiness_message( } fn replay_program_ids( - operation: &kb_lib::ExSplAssociatedTokenAccountOperation, + operation: &ks_lib::ExSplAssociatedTokenAccountOperation, ) -> std::vec::Vec<&'static str> { - let mut output = std::vec![kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID]; - if operation.token_program() == kb_lib::ExSplAssociatedTokenProgram::Classic { - output.push(kb_program_ids::SPL_TOKEN_PROGRAM_ID); + let mut output = std::vec![ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID]; + if operation.token_program() == ks_lib::ExSplAssociatedTokenProgram::Classic { + output.push(ks_program_ids::SPL_TOKEN_PROGRAM_ID); } return output; } async fn validate_post_state_with_retries( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, query_role: &str, maximum_retries: u32, - operation: &kb_lib::ExSplAssociatedTokenAccountOperation, -) -> kb_core::Result { + operation: &ks_lib::ExSplAssociatedTokenAccountOperation, +) -> ks_core::Result { let mut retry = 0_u32; loop { - let result = kb_pipeline::inspect_spl_associated_token_account_post_execution( + let result = ks_pipeline::inspect_spl_associated_token_account_post_execution( http_pool, query_role, - kb_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionCluster::Devnet, operation, ) .await; match result { std::result::Result::Ok(report) if report.status - == kb_pipeline::SplAssociatedTokenAccountStatefulReadinessStatus::Ready + == ks_pipeline::SplAssociatedTokenAccountStatefulReadinessStatus::Ready || retry >= maximum_retries => { return std::result::Result::Ok(report); @@ -829,27 +829,27 @@ async fn validate_post_state_with_retries( async fn replay_program( store: &S, - signature: &kb_lib::MdSignature, + signature: &ks_lib::MdSignature, include_materialized_state: bool, force_post_validation_replay: bool, program_ids: &[&str], - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::DecodePipelineStore + Sync, + S: ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { let mut states = std::vec![ - kb_store::CoreInstructionProcessingState::Pending, - kb_store::CoreInstructionProcessingState::Failed, - kb_store::CoreInstructionProcessingState::ReplayRequested, + ks_store::CoreInstructionProcessingState::Pending, + ks_store::CoreInstructionProcessingState::Failed, + ks_store::CoreInstructionProcessingState::ReplayRequested, ]; if include_materialized_state { - states.push(kb_store::CoreInstructionProcessingState::Materialized); + states.push(ks_store::CoreInstructionProcessingState::Materialized); } - let selection = match kb_store::DecodeSelectionFilter::new( + let selection = match ks_store::DecodeSelectionFilter::new( std::vec![signature.0.clone()], states, std::option::Option::None, @@ -862,13 +862,13 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - return kb_pipeline::execute_decode_replay( + return ks_pipeline::execute_decode_replay( store, - &kb_pipeline::DecodeReplayRequest { - campaign_id: kb_pipeline::new_decode_campaign_id(), + &ks_pipeline::DecodeReplayRequest { + campaign_id: ks_pipeline::new_decode_campaign_id(), selection, decoder_names: std::vec::Vec::new(), - dispatch_policy: kb_pipeline::DecodeDispatchPolicy::HighestPriority, + dispatch_policy: ks_pipeline::DecodeDispatchPolicy::HighestPriority, max_concurrent_inputs: 1, force_replay: if include_materialized_state { false @@ -885,7 +885,7 @@ where .await; } -fn decode_completed(summary: &kb_pipeline::DecodeReplaySummary) -> bool { +fn decode_completed(summary: &ks_pipeline::DecodeReplaySummary) -> bool { return summary.failed_inputs == 0 && summary.processing_error_inputs == 0 && summary.unmatched == 0 @@ -901,27 +901,27 @@ fn decode_completed(summary: &kb_pipeline::DecodeReplaySummary) -> bool { } async fn hydrate_signature( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, query_role: &str, post_validation_max_retries: u32, observer: &O, - signature: &kb_lib::MdSignature, -) -> kb_core::Result + signature: &ks_lib::MdSignature, +) -> ks_core::Result where - S: kb_store::RawTransactionStore + Sync, + S: ks_store::RawTransactionStore + Sync, O: crate::SolanaExecutionObserver, { let mut retry = 0_u32; loop { - let result = match kb_pipeline::execute_http_backfill( + let result = match ks_pipeline::execute_http_backfill( http_pool, store, - &kb_pipeline::BackfillRequest { + &ks_pipeline::BackfillRequest { role: query_role.to_string(), commitment: "confirmed".to_string(), - source: kb_pipeline::BackfillSource::ExplicitSignatures(std::vec![ + source: ks_pipeline::BackfillSource::ExplicitSignatures(std::vec![ signature.0.clone() ]), page_size: 1, @@ -951,7 +951,7 @@ where } } -fn canonical_available(summary: &kb_pipeline::BackfillSummary) -> bool { +fn canonical_available(summary: &ks_pipeline::BackfillSummary) -> bool { return summary.failed == 0 && summary.missing == 0 && summary.candidates_completed == 1 @@ -967,9 +967,9 @@ fn canonical_available(summary: &kb_pipeline::BackfillSummary) -> bool { fn validate_profile_wallet_signers( required_signers: &[std::string::String], wallet_pubkey: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if required_signers.iter().any(|value| return value.as_str() != wallet_pubkey) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_associated_token_account_external_signer_unavailable", format!( "the Devnet ATA orchestrator can sign only with profile wallet {}; required signers are {}", @@ -992,9 +992,9 @@ mod tests { }; } - fn example_devnet_profile() -> kb_config::ProfileConfig { + fn example_devnet_profile() -> ks_config::ProfileConfig { let config = - match kb_config::parse_config_json(include_str!("../../../config/example.config.json")) + match ks_config::parse_config_json(include_str!("../../../config/example.config.json")) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("example config parse failed: {error}"), @@ -1005,11 +1005,11 @@ mod tests { }; } - fn create_operation(wallet: &str) -> kb_lib::ExSplAssociatedTokenAccountOperation { - return kb_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { - wallet_owner: kb_lib::MdPubkey(wallet.to_string()), - mint: kb_lib::MdPubkey(kb_program_ids::VOTE_PROGRAM_ID.to_string()), - token_program: kb_lib::ExSplAssociatedTokenProgram::Classic, + fn create_operation(wallet: &str) -> ks_lib::ExSplAssociatedTokenAccountOperation { + return ks_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { + wallet_owner: ks_lib::MdPubkey(wallet.to_string()), + mint: ks_lib::MdPubkey(ks_program_ids::VOTE_PROGRAM_ID.to_string()), + token_program: ks_lib::ExSplAssociatedTokenProgram::Classic, }; } @@ -1017,7 +1017,7 @@ mod tests { fn request_is_simulation_only_and_bounded_by_default() { let request = crate::DevnetSplAssociatedTokenAccountExecutionRequest::new( "ata-1", - create_operation(kb_program_ids::SYSTEM_PROGRAM_ID), + create_operation(ks_program_ids::SYSTEM_PROGRAM_ID), ); assert!(!request.submit); assert!(request.validate().is_ok()); @@ -1029,7 +1029,7 @@ mod tests { #[test] fn creation_and_recovery_intents_preserve_exact_spend_and_signers() { let profile = example_devnet_profile(); - let fee_payer = kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()); + let fee_payer = ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()); let create = crate::DevnetSplAssociatedTokenAccountExecutionRequest::new( "ata-2", create_operation(fee_payer.0.as_str()), @@ -1042,11 +1042,11 @@ mod tests { let recovery = crate::DevnetSplAssociatedTokenAccountExecutionRequest::new( "ata-3", - kb_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { - wallet_owner: kb_lib::MdPubkey(kb_program_ids::STAKE_PROGRAM_ID.to_string()), - owner_mint: kb_lib::MdPubkey(kb_program_ids::VOTE_PROGRAM_ID.to_string()), - nested_mint: kb_lib::MdPubkey(kb_program_ids::CONFIG_PROGRAM_ID.to_string()), - token_program: kb_lib::ExSplAssociatedTokenProgram::Token2022, + ks_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { + wallet_owner: ks_lib::MdPubkey(ks_program_ids::STAKE_PROGRAM_ID.to_string()), + owner_mint: ks_lib::MdPubkey(ks_program_ids::VOTE_PROGRAM_ID.to_string()), + nested_mint: ks_lib::MdPubkey(ks_program_ids::CONFIG_PROGRAM_ID.to_string()), + token_program: ks_lib::ExSplAssociatedTokenProgram::Token2022, }, ); let recovery_intent = super::build_intent(&profile, &recovery, fee_payer) @@ -1057,13 +1057,13 @@ mod tests { #[test] fn submission_signers_must_resolve_to_the_profile_wallet() { - let wallet = kb_program_ids::SYSTEM_PROGRAM_ID.to_string(); + let wallet = ks_program_ids::SYSTEM_PROGRAM_ID.to_string(); assert!( super::validate_profile_wallet_signers(std::slice::from_ref(&wallet), wallet.as_str(),) .is_ok() ); let error = super::validate_profile_wallet_signers( - &[wallet.clone(), kb_program_ids::VOTE_PROGRAM_ID.to_string()], + &[wallet.clone(), ks_program_ids::VOTE_PROGRAM_ID.to_string()], wallet.as_str(), ); assert!(error.is_err()); @@ -1080,10 +1080,10 @@ mod tests { .unwrap_or_else(|_| return "create_idempotent".to_string()); let token_program = match std::env::var("KB_DEVNET_SPL_ATA_TOKEN_PROGRAM").ok().as_deref() { std::option::Option::Some("token_2022") => { - kb_lib::ExSplAssociatedTokenProgram::Token2022 + ks_lib::ExSplAssociatedTokenProgram::Token2022 }, std::option::Option::Some("classic") | std::option::Option::None => { - kb_lib::ExSplAssociatedTokenProgram::Classic + ks_lib::ExSplAssociatedTokenProgram::Classic }, std::option::Option::Some(value) => panic!("unsupported Token Program {value}"), }; @@ -1099,17 +1099,17 @@ mod tests { .unwrap_or_else(|error| panic!("profile wallet failed: {error}")); let wallet_pubkey = wallet.public_key(); let operation = match operation_code.as_str() { - "create_idempotent" => kb_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { - wallet_owner: kb_lib::MdPubkey(wallet_pubkey), - mint: kb_lib::MdPubkey(required_environment_value("KB_DEVNET_SPL_ATA_MINT")), + "create_idempotent" => ks_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { + wallet_owner: ks_lib::MdPubkey(wallet_pubkey), + mint: ks_lib::MdPubkey(required_environment_value("KB_DEVNET_SPL_ATA_MINT")), token_program, }, - "recover_nested" => kb_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { - wallet_owner: kb_lib::MdPubkey(wallet_pubkey), - owner_mint: kb_lib::MdPubkey(required_environment_value( + "recover_nested" => ks_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { + wallet_owner: ks_lib::MdPubkey(wallet_pubkey), + owner_mint: ks_lib::MdPubkey(required_environment_value( "KB_DEVNET_SPL_ATA_OWNER_MINT", )), - nested_mint: kb_lib::MdPubkey(required_environment_value( + nested_mint: ks_lib::MdPubkey(required_environment_value( "KB_DEVNET_SPL_ATA_NESTED_MINT", )), token_program, @@ -1123,29 +1123,29 @@ mod tests { request.submit = submit; request.operator_confirmed = submit; request.post_validation_max_retries = 20; - let pool = kb_onchain_transport::HttpEndpointPool::from_profile(&profile) + let pool = ks_onchain_transport::HttpEndpointPool::from_profile(&profile) .unwrap_or_else(|error| panic!("HTTP pool failed: {error}")); - let store_options = kb_store::PostgresStoreOptions::new( + let store_options = ks_store::PostgresStoreOptions::new( profile.database.postgres.url.clone(), profile.database.postgres.max_connections, profile.database.postgres.connect_timeout_ms, false, ) .unwrap_or_else(|error| panic!("PostgreSQL options failed: {error}")); - let store = kb_store::PostgresStore::connect(store_options) + let store = ks_store::PostgresStore::connect(store_options) .await .unwrap_or_else(|error| panic!("PostgreSQL connection failed: {error}")); store .initialize_store_schema() .await .unwrap_or_else(|error| panic!("schema initialization failed: {error}")); - let decoders: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::DcSplAssociatedTokenAccountDecoder), - std::sync::Arc::new(kb_lib::DcSplTokenDecoder), + let decoders: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::DcSplAssociatedTokenAccountDecoder), + std::sync::Arc::new(ks_lib::DcSplTokenDecoder), ]; - let materializers: std::vec::Vec> = std::vec![ - std::sync::Arc::new(kb_lib::MtTokenAccountsMaterializer), - std::sync::Arc::new(kb_lib::MtRiskMaterializer), + let materializers: std::vec::Vec> = std::vec![ + std::sync::Arc::new(ks_lib::MtTokenAccountsMaterializer), + std::sync::Arc::new(ks_lib::MtRiskMaterializer), ]; let summary = crate::execute_devnet_spl_associated_token_account( &pool, @@ -1161,7 +1161,7 @@ mod tests { .unwrap_or_else(|error| panic!("Devnet ATA execution failed: {error}")); assert_eq!( summary.stateful_readiness.status, - kb_pipeline::SplAssociatedTokenAccountStatefulReadinessStatus::Ready + ks_pipeline::SplAssociatedTokenAccountStatefulReadinessStatus::Ready ); assert!(summary.simulation.success, "{:?}", summary.simulation.error); if submit { diff --git a/kb-pipeline-demo-scenarios/src/spl/memo.rs b/ks-pipeline-demo-scenarios/src/spl/memo.rs similarity index 81% rename from kb-pipeline-demo-scenarios/src/spl/memo.rs rename to ks-pipeline-demo-scenarios/src/spl/memo.rs index e750ac0..bf2b442 100644 --- a/kb-pipeline-demo-scenarios/src/spl/memo.rs +++ b/ks-pipeline-demo-scenarios/src/spl/memo.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/spl/memo.rs -// version: 6 +// file: ks-pipeline-demo-scenarios/src/spl/memo.rs +// version: 7 //! Devnet SPL Memo v4 execution with canonical post-validation. @@ -46,26 +46,26 @@ impl DevnetMemoExecutionRequest { } /// Validates request-local bounds independently from one profile. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet Memo execution intent id must not be empty", )); } if self.query_role.trim().is_empty() || self.transaction_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet Memo execution endpoint roles must not be empty", )); } - if self.message.len() > kb_lib::EX_SPL_MEMO_MAX_MESSAGE_BYTES { - return std::result::Result::Err(kb_core::Error::config(format!( + if self.message.len() > ks_lib::EX_SPL_MEMO_MAX_MESSAGE_BYTES { + return std::result::Result::Err(ks_core::Error::config(format!( "Devnet Memo payload length {} exceeds the executor limit {}", self.message.len(), - kb_lib::EX_SPL_MEMO_MAX_MESSAGE_BYTES + ks_lib::EX_SPL_MEMO_MAX_MESSAGE_BYTES ))); } if self.post_validation_max_retries > 20 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "post-execution getTransaction retries must not exceed 20", )); } @@ -79,55 +79,55 @@ pub struct DevnetMemoExecutionSummary { /// Profile used by the orchestration. pub profile_name: std::string::String, /// Exact classified cluster. - pub cluster: kb_lib::ExApiExecutionCluster, + pub cluster: ks_lib::ExApiExecutionCluster, /// Genesis hash returned by the selected endpoint. pub genesis_hash: std::string::String, /// Non-secret persistent wallet description. - pub wallet: kb_wallet::WalletSummary, + pub wallet: ks_wallet::WalletSummary, /// Wallet balance observed before planning. pub balance_lamports: u64, /// Exact prepared Memo plan. - pub plan: kb_lib::ExApiPreparedExecutionPlan, + pub plan: ks_lib::ExApiPreparedExecutionPlan, /// Recent blockhash used by the exact transaction. - pub latest_blockhash: kb_onchain_transport::LatestBlockhashResult, + pub latest_blockhash: ks_onchain_transport::LatestBlockhashResult, /// Fee estimate for the exact compiled message. - pub fee: kb_onchain_transport::FeeForMessageResult, + pub fee: ks_onchain_transport::FeeForMessageResult, /// Exact simulation result bound to the compiled message. - pub simulation: kb_lib::ExApiExecutionSimulationResult, + pub simulation: ks_lib::ExApiExecutionSimulationResult, /// Submission result when explicitly authorized. - pub send_result: std::option::Option, + pub send_result: std::option::Option, /// Confirmation result when submitted. - pub confirmation: std::option::Option, + pub confirmation: std::option::Option, /// Canonical hydration result for the exact signature. - pub backfill: std::option::Option, + pub backfill: std::option::Option, /// Core extraction result for the exact signature. - pub core_extraction: std::option::Option, + pub core_extraction: std::option::Option, /// First Memo decode and materialization replay. - pub decode_replay: std::option::Option, + pub decode_replay: std::option::Option, /// Second replay proving that the same decoder version and input are idempotent. - pub idempotence_replay: std::option::Option, + pub idempotence_replay: std::option::Option, /// Exact persisted transaction annotation rows for the submitted signature. - pub annotations: std::vec::Vec, + pub annotations: std::vec::Vec, /// Aggregated post-execution validation diagnostic. - pub post_execution: std::option::Option, + pub post_execution: std::option::Option, } /// Executes one Memo v4 Devnet simulation or explicitly authorized submission. #[allow(clippy::too_many_arguments)] pub async fn execute_devnet_memo( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetMemoExecutionRequest, - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { @@ -145,9 +145,9 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if genesis.classified_cluster - != std::option::Option::Some(kb_lib::ExApiExecutionCluster::Devnet) + != std::option::Option::Some(ks_lib::ExApiExecutionCluster::Devnet) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_cluster_mismatch", format!( "expected Devnet genesis hash but endpoint returned {} classified as {:?}", @@ -160,12 +160,12 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let wallet_summary = wallet.summary(); - let fee_payer = kb_lib::MdPubkey(wallet_summary.public_key.clone()); + let fee_payer = ks_lib::MdPubkey(wallet_summary.public_key.clone()); let balance = match http_pool .get_balance_for_role( request.query_role.as_str(), &fee_payer, - &kb_onchain_transport::GetBalanceConfig::confirmed(), + &ks_onchain_transport::GetBalanceConfig::confirmed(), ) .await { @@ -173,7 +173,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if balance.lamports < profile.execution.max_fee_lamports { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_balance_insufficient", format!( "Devnet wallet balance {} is below the configured fee ceiling {}", @@ -185,12 +185,12 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let plan_evaluation = match kb_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { + let plan_evaluation = match ks_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if plan_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if plan_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "execution_plan_denied", crate::violation_message(plan_evaluation.violations.as_slice()), )); @@ -198,14 +198,14 @@ where let latest_blockhash = match http_pool .get_latest_blockhash_for_role( request.query_role.as_str(), - &kb_onchain_transport::GetLatestBlockhashConfig::confirmed(), + &ks_onchain_transport::GetLatestBlockhashConfig::confirmed(), ) .await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let unsigned = match kb_lib::executor_solana_build_legacy_transaction( + let unsigned = match ks_lib::executor_solana_build_legacy_transaction( &plan, latest_blockhash.blockhash.as_str(), ) { @@ -217,8 +217,8 @@ where .get_fee_for_message_for_role( request.query_role.as_str(), message_base64.as_str(), - &kb_onchain_transport::GetFeeForMessageConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + &ks_onchain_transport::GetFeeForMessageConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, std::option::Option::Some(latest_blockhash.context.slot), ), ) @@ -228,7 +228,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if fee.fee_lamports.is_none() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_fee_unavailable", "getFeeForMessage returned null for the selected recent blockhash", )); @@ -237,8 +237,8 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let simulation_config = match kb_onchain_transport::SimulateTransactionConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let simulation_config = match ks_onchain_transport::SimulateTransactionConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, false, false, std::option::Option::Some(latest_blockhash.context.slot), @@ -267,8 +267,8 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let simulation = simulation_rpc.to_execution_result( - kb_lib::ExApiExecutionCluster::Devnet, - kb_lib::ExApiExecutionBlockhashKind::Latest, + ks_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionBlockhashKind::Latest, std::option::Option::Some( simulation_rpc.context.slot.saturating_sub(latest_blockhash.context.slot), ), @@ -279,7 +279,7 @@ where let evidence = unsigned.bind_simulation(simulation.clone()); let mut summary = crate::DevnetMemoExecutionSummary { profile_name: profile.name.clone(), - cluster: kb_lib::ExApiExecutionCluster::Devnet, + cluster: ks_lib::ExApiExecutionCluster::Devnet, genesis_hash: genesis.genesis_hash, wallet: wallet_summary, balance_lamports: balance.lamports, @@ -300,18 +300,18 @@ where return std::result::Result::Ok(summary); } if !summary.simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_simulation_failed", crate::simulation_failure_message(&summary.simulation), )); } let send_evaluation = - match kb_lib::ExSafetyChecker.evaluate_send(&summary.plan, &summary.simulation) { + match ks_lib::ExSafetyChecker.evaluate_send(&summary.plan, &summary.simulation) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if send_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if send_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "execution_send_denied", crate::violation_message(send_evaluation.violations.as_slice()), )); @@ -324,7 +324,7 @@ where return std::result::Result::Err(error); } let signature = signed.primary_signature().clone(); - let mut diagnostic = kb_lib::ExApiPostExecutionDiagnostic { + let mut diagnostic = ks_lib::ExApiPostExecutionDiagnostic { signature: signature.clone(), canonical_inserted: false, core_extracted: false, @@ -332,7 +332,7 @@ where materialized: false, diagnostics: std::vec::Vec::new(), }; - let send_config = match kb_onchain_transport::SendTransactionConfig::from_execution_config( + let send_config = match ks_onchain_transport::SendTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(summary.latest_blockhash.context.slot), ) { @@ -357,9 +357,9 @@ where }, }; summary.send_result = - std::option::Option::Some(sent.to_execution_result(kb_lib::ExApiExecutionCluster::Devnet)); + std::option::Option::Some(sent.to_execution_result(ks_lib::ExApiExecutionCluster::Devnet)); let confirmation_config = - match kb_onchain_transport::ConfirmTransactionConfig::from_execution_config( + match ks_onchain_transport::ConfirmTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(summary.latest_blockhash.last_valid_block_height), std::option::Option::Some(summary.latest_blockhash.context.slot), @@ -371,7 +371,7 @@ where .confirm_transaction_for_roles( request.transaction_role.as_str(), request.query_role.as_str(), - kb_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionCluster::Devnet, &signature, &confirmation_config, ) @@ -388,8 +388,8 @@ where summary.confirmation = std::option::Option::Some(confirmation); if !matches!( confirmation_status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) { diagnostic.diagnostics.push(format!( "Memo post-validation stopped at confirmation status {confirmation_status:?}" @@ -415,10 +415,10 @@ where summary.post_execution = std::option::Option::Some(diagnostic); return std::result::Result::Ok(summary); } - let extraction = match kb_pipeline::execute_core_extraction( + let extraction = match ks_pipeline::execute_core_extraction( store, - &kb_pipeline::CoreExtractionRequest { - source: kb_pipeline::CoreExtractionSource::Signatures(std::vec![signature.0.clone()]), + &ks_pipeline::CoreExtractionRequest { + source: ks_pipeline::CoreExtractionSource::Signatures(std::vec![signature.0.clone()]), limit: 1, max_concurrent_extractions: 1, force_replay: request.force_post_validation_replay, @@ -457,7 +457,7 @@ where }; diagnostic.decode_replayed = decode_completed(&first_replay); summary.decode_replay = std::option::Option::Some(first_replay); - let filter = match kb_store::MaterializedEventFilter::new( + let filter = match ks_store::MaterializedEventFilter::new( std::option::Option::Some("materializer.transaction.annotations".to_string()), std::option::Option::Some("transaction_annotation".to_string()), std::option::Option::Some(signature.0.clone()), @@ -467,7 +467,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; summary.annotations = - match kb_store::DecodePipelineStore::list_materialized_events(store, &filter).await { + match ks_store::DecodePipelineStore::list_materialized_events(store, &filter).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { diagnostic.diagnostics.push(format!("Memo annotation query failed: {error}")); @@ -526,26 +526,26 @@ where } fn validate_profile( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, request: &crate::DevnetMemoExecutionRequest, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if profile.wallet.cluster != "devnet" { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Memo Devnet orchestration requires a Devnet wallet profile", )); } if !profile.wallet.temporary_wallet_enabled || !profile.wallet.temporary_wallet_persist { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Memo Devnet orchestration requires an enabled persistent temporary wallet", )); } if !profile.execution.require_simulation { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Memo Devnet orchestration requires simulation", )); } if request.submit && !profile.wallet.devnet_send_enabled { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet transaction submission is disabled by the wallet profile", )); } @@ -553,7 +553,7 @@ fn validate_profile( && profile.execution.require_operator_confirmation && !request.operator_confirmed { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Memo Devnet submission requires explicit operator confirmation", )); } @@ -561,34 +561,34 @@ fn validate_profile( } fn build_plan( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, request: &crate::DevnetMemoExecutionRequest, - fee_payer: kb_lib::MdPubkey, -) -> kb_core::Result { + fee_payer: ks_lib::MdPubkey, +) -> ks_core::Result { let signers = if request.include_wallet_as_memo_signer { - std::vec![kb_lib::ExSplMemoSigner { pubkey: fee_payer.clone() }] + std::vec![ks_lib::ExSplMemoSigner { pubkey: fee_payer.clone() }] } else { std::vec::Vec::new() }; - let intent = kb_lib::ExSplMemoExecutionIntent { + let intent = ks_lib::ExSplMemoExecutionIntent { intent_id: request.intent_id.clone(), fee_payer: fee_payer.clone(), - policy: kb_lib::ExApiExecutionPolicy { - cluster: kb_lib::ExApiExecutionClusterPolicy { - expected_cluster: kb_lib::ExApiExecutionCluster::Devnet, + policy: ks_lib::ExApiExecutionPolicy { + cluster: ks_lib::ExApiExecutionClusterPolicy { + expected_cluster: ks_lib::ExApiExecutionCluster::Devnet, allow_mainnet: false, mainnet_confirmation: false, }, - simulation: kb_lib::ExApiExecutionSimulationPolicy::Required, - blockhash: kb_lib::ExApiExecutionBlockhashPolicy { - kind: kb_lib::ExApiExecutionBlockhashKind::Latest, + simulation: ks_lib::ExApiExecutionSimulationPolicy::Required, + blockhash: ks_lib::ExApiExecutionBlockhashPolicy { + kind: ks_lib::ExApiExecutionBlockhashKind::Latest, max_age_slots: std::option::Option::Some( profile.execution.recent_blockhash_max_age_slots, ), nonce_account: std::option::Option::None, nonce_authority: std::option::Option::None, }, - cost_limit: kb_lib::ExApiExecutionCostLimit { + cost_limit: ks_lib::ExApiExecutionCostLimit { max_spend_lamports: std::option::Option::Some(0), max_fee_lamports: std::option::Option::Some(profile.execution.max_fee_lamports), max_compute_unit_price_micro_lamports: std::option::Option::Some( @@ -597,46 +597,46 @@ fn build_plan( }, authorized_signers: std::vec![fee_payer.clone()], dry_run: !request.submit, - post_execution_validation: kb_lib::ExApiPostExecutionValidationPolicy { + post_execution_validation: ks_lib::ExApiPostExecutionValidationPolicy { canonical_insert_required: true, core_extraction_required: true, decode_replay_required: true, materialization_required: true, }, }, - operation: kb_lib::ExSplMemoOperation::AddMemo { - generation: kb_lib::ExSplMemoGeneration::V4, + operation: ks_lib::ExSplMemoOperation::AddMemo { + generation: ks_lib::ExSplMemoGeneration::V4, message: request.message.clone(), signers, }, }; - return kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan( - &kb_lib::ExSplMemoExecutor, + return ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan( + &ks_lib::ExSplMemoExecutor, &intent, ); } async fn hydrate_signature( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, request: &crate::DevnetMemoExecutionRequest, observer: &O, - signature: &kb_lib::MdSignature, -) -> kb_core::Result + signature: &ks_lib::MdSignature, +) -> ks_core::Result where - S: kb_store::RawTransactionStore + Sync, + S: ks_store::RawTransactionStore + Sync, O: crate::SolanaExecutionObserver, { let mut retry = 0_u32; loop { - let result = match kb_pipeline::execute_http_backfill( + let result = match ks_pipeline::execute_http_backfill( http_pool, store, - &kb_pipeline::BackfillRequest { + &ks_pipeline::BackfillRequest { role: request.query_role.clone(), commitment: "confirmed".to_string(), - source: kb_pipeline::BackfillSource::ExplicitSignatures(std::vec![ + source: ks_pipeline::BackfillSource::ExplicitSignatures(std::vec![ signature.0.clone() ]), page_size: 1, @@ -666,7 +666,7 @@ where } } -fn canonical_available(summary: &kb_pipeline::BackfillSummary) -> bool { +fn canonical_available(summary: &ks_pipeline::BackfillSummary) -> bool { return summary.failed == 0 && summary.missing == 0 && summary.candidates_completed == 1 @@ -682,30 +682,30 @@ fn canonical_available(summary: &kb_pipeline::BackfillSummary) -> bool { async fn replay_memo( store: &S, request: &crate::DevnetMemoExecutionRequest, - signature: &kb_lib::MdSignature, + signature: &ks_lib::MdSignature, include_materialized_state: bool, - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::DecodePipelineStore + Sync, + S: ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { let mut states = std::vec![ - kb_store::CoreInstructionProcessingState::Pending, - kb_store::CoreInstructionProcessingState::Failed, - kb_store::CoreInstructionProcessingState::ReplayRequested, + ks_store::CoreInstructionProcessingState::Pending, + ks_store::CoreInstructionProcessingState::Failed, + ks_store::CoreInstructionProcessingState::ReplayRequested, ]; if include_materialized_state { - states.push(kb_store::CoreInstructionProcessingState::Materialized); + states.push(ks_store::CoreInstructionProcessingState::Materialized); } - let selection = match kb_store::DecodeSelectionFilter::new( + let selection = match ks_store::DecodeSelectionFilter::new( std::vec![signature.0.clone()], states, std::option::Option::None, std::option::Option::None, - std::vec![kb_program_ids::SPL_MEMO_V4_PROGRAM_ID.to_string()], + std::vec![ks_program_ids::SPL_MEMO_V4_PROGRAM_ID.to_string()], std::vec::Vec::new(), false, 8, @@ -713,13 +713,13 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - return kb_pipeline::execute_decode_replay( + return ks_pipeline::execute_decode_replay( store, - &kb_pipeline::DecodeReplayRequest { - campaign_id: kb_pipeline::new_decode_campaign_id(), + &ks_pipeline::DecodeReplayRequest { + campaign_id: ks_pipeline::new_decode_campaign_id(), selection, decoder_names: std::vec::Vec::new(), - dispatch_policy: kb_pipeline::DecodeDispatchPolicy::HighestPriority, + dispatch_policy: ks_pipeline::DecodeDispatchPolicy::HighestPriority, max_concurrent_inputs: 1, force_replay: if include_materialized_state { false @@ -736,7 +736,7 @@ where .await; } -fn decode_completed(summary: &kb_pipeline::DecodeReplaySummary) -> bool { +fn decode_completed(summary: &ks_pipeline::DecodeReplaySummary) -> bool { return summary.failed_inputs == 0 && summary.processing_error_inputs == 0 && summary.unmatched == 0 @@ -753,9 +753,9 @@ fn decode_completed(summary: &kb_pipeline::DecodeReplaySummary) -> bool { #[cfg(test)] mod tests { - fn example_devnet_profile() -> kb_config::ProfileConfig { + fn example_devnet_profile() -> ks_config::ProfileConfig { let config = - match kb_config::parse_config_json(include_str!("../../../config/example.config.json")) + match ks_config::parse_config_json(include_str!("../../../config/example.config.json")) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("example config parse failed: {error}"), @@ -772,14 +772,14 @@ mod tests { assert!(!request.submit); assert!(request.include_wallet_as_memo_signer); assert!(request.validate().is_ok()); - let oversized = "x".repeat(kb_lib::EX_SPL_MEMO_MAX_MESSAGE_BYTES + 1); + let oversized = "x".repeat(ks_lib::EX_SPL_MEMO_MAX_MESSAGE_BYTES + 1); assert!(crate::DevnetMemoExecutionRequest::new("memo-2", oversized).validate().is_err()); } #[test] fn exact_v4_plan_has_zero_spend_and_wallet_signer() { let profile = example_devnet_profile(); - let fee_payer = kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()); + let fee_payer = ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()); let mut request = crate::DevnetMemoExecutionRequest::new("memo-3", "hello"); request.submit = true; request.operator_confirmed = true; @@ -790,11 +790,11 @@ mod tests { assert_eq!(plan.requested_spend_lamports, 0); assert_eq!(plan.fee_payer, fee_payer); assert_eq!(plan.instructions.len(), 1); - assert_eq!(plan.instructions[0].program_id.0, kb_program_ids::SPL_MEMO_V4_PROGRAM_ID); + assert_eq!(plan.instructions[0].program_id.0, ks_program_ids::SPL_MEMO_V4_PROGRAM_ID); assert_eq!(plan.instructions[0].accounts.len(), 1); assert!(plan.instructions[0].accounts[0].is_signer); assert!(!plan.instructions[0].accounts[0].is_writable); - assert!(kb_lib::ExSafetyChecker.evaluate_prepared_plan(&plan).is_ok()); + assert!(ks_lib::ExSafetyChecker.evaluate_prepared_plan(&plan).is_ok()); } #[test] @@ -827,11 +827,11 @@ mod tests { if let std::result::Result::Ok(directory) = std::env::var("KB_DEVNET_WALLET_DIR") { profile.wallet.wallet_dir = directory; } - let pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("HTTP pool creation failed: {error}"), }; - let store_options = match kb_store::PostgresStoreOptions::new( + let store_options = match ks_store::PostgresStoreOptions::new( profile.database.postgres.url.clone(), profile.database.postgres.max_connections, profile.database.postgres.connect_timeout_ms, @@ -840,7 +840,7 @@ mod tests { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("PostgreSQL options failed: {error}"), }; - let store = match kb_store::PostgresStore::connect(store_options).await { + let store = match ks_store::PostgresStore::connect(store_options).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("PostgreSQL connection failed: {error}"), }; @@ -857,10 +857,10 @@ mod tests { request.submit = true; request.operator_confirmed = true; } - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcSplMemoDecoder)]; - let materializers: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::MtTransactionAnnotationMaterializer,)]; + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcSplMemoDecoder)]; + let materializers: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::MtTransactionAnnotationMaterializer,)]; let workspace_root = match std::path::Path::new(env!("CARGO_MANIFEST_DIR")).parent() { std::option::Option::Some(value) => value, std::option::Option::None => panic!("workspace root cannot be resolved"), diff --git a/kb-pipeline-demo-scenarios/src/spl/token.rs b/ks-pipeline-demo-scenarios/src/spl/token.rs similarity index 62% rename from kb-pipeline-demo-scenarios/src/spl/token.rs rename to ks-pipeline-demo-scenarios/src/spl/token.rs index 1bf2202..d2df76d 100644 --- a/kb-pipeline-demo-scenarios/src/spl/token.rs +++ b/ks-pipeline-demo-scenarios/src/spl/token.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/spl/token.rs -// version: 1 +// file: ks-pipeline-demo-scenarios/src/spl/token.rs +// version: 2 //! Classic SPL Token demo and Devnet validation scenarios. diff --git a/kb-pipeline-demo-scenarios/src/spl/token/execution.rs b/ks-pipeline-demo-scenarios/src/spl/token/execution.rs similarity index 77% rename from kb-pipeline-demo-scenarios/src/spl/token/execution.rs rename to ks-pipeline-demo-scenarios/src/spl/token/execution.rs index b8e80d9..cf36352 100644 --- a/kb-pipeline-demo-scenarios/src/spl/token/execution.rs +++ b/ks-pipeline-demo-scenarios/src/spl/token/execution.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/spl/token/execution.rs -// version: 10 +// file: ks-pipeline-demo-scenarios/src/spl/token/execution.rs +// version: 11 //! Devnet classic SPL Token execution with stateful and canonical post-validation. @@ -13,7 +13,7 @@ pub struct DevnetSplTokenExecutionRequest { /// Endpoint role used for simulation, submission and confirmation polling. pub transaction_role: std::string::String, /// Exact typed classic SPL Token operation. - pub operation: kb_lib::ExSplClassicTokenOperation, + pub operation: ks_lib::ExSplClassicTokenOperation, /// Explicitly authorizes signing and submission after successful simulation. pub submit: bool, /// Explicit operator confirmation required by the active profile. @@ -28,7 +28,7 @@ impl crate::DevnetSplTokenExecutionRequest { /// Creates a conservative simulation-only request. pub fn new( intent_id: impl std::convert::Into, - operation: kb_lib::ExSplClassicTokenOperation, + operation: ks_lib::ExSplClassicTokenOperation, ) -> Self { return Self { intent_id: intent_id.into(), @@ -43,19 +43,19 @@ impl crate::DevnetSplTokenExecutionRequest { } /// Validates request-local bounds independently from one profile. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet SPL Token execution intent id must not be empty", )); } if self.query_role.trim().is_empty() || self.transaction_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet SPL Token execution endpoint roles must not be empty", )); } if self.post_validation_max_retries > 20 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "post-execution getTransaction retries must not exceed 20", )); } @@ -69,61 +69,61 @@ pub struct DevnetSplTokenExecutionSummary { /// Profile used by the orchestration. pub profile_name: std::string::String, /// Exact classified cluster. - pub cluster: kb_lib::ExApiExecutionCluster, + pub cluster: ks_lib::ExApiExecutionCluster, /// Genesis hash returned by the selected endpoint. pub genesis_hash: std::string::String, /// Non-secret persistent wallet description. - pub wallet: kb_wallet::WalletSummary, + pub wallet: ks_wallet::WalletSummary, /// Wallet balance observed before planning. pub balance_lamports: u64, /// Stateful readiness report produced before plan simulation. - pub stateful_readiness: kb_pipeline::SplTokenStatefulReadinessReport, + pub stateful_readiness: ks_pipeline::SplTokenStatefulReadinessReport, /// Exact prepared Token plan. - pub plan: kb_lib::ExApiPreparedExecutionPlan, + pub plan: ks_lib::ExApiPreparedExecutionPlan, /// Recent blockhash used by the exact transaction. - pub latest_blockhash: kb_onchain_transport::LatestBlockhashResult, + pub latest_blockhash: ks_onchain_transport::LatestBlockhashResult, /// Fee estimate for the exact compiled message. - pub fee: kb_onchain_transport::FeeForMessageResult, + pub fee: ks_onchain_transport::FeeForMessageResult, /// Exact simulation result bound to the compiled message. - pub simulation: kb_lib::ExApiExecutionSimulationResult, + pub simulation: ks_lib::ExApiExecutionSimulationResult, /// Submission result when explicitly authorized. - pub send_result: std::option::Option, + pub send_result: std::option::Option, /// Confirmation result when submitted. - pub confirmation: std::option::Option, + pub confirmation: std::option::Option, /// Canonical hydration result for the exact signature. - pub backfill: std::option::Option, + pub backfill: std::option::Option, /// Core extraction result for the exact signature. - pub core_extraction: std::option::Option, + pub core_extraction: std::option::Option, /// First Token decode and materialization replay. - pub decode_replay: std::option::Option, + pub decode_replay: std::option::Option, /// Second replay proving idempotence for the same decoder version and input. - pub idempotence_replay: std::option::Option, + pub idempotence_replay: std::option::Option, /// Exact materialized rows produced for the submitted Token transaction. - pub materializations: std::vec::Vec, + pub materializations: std::vec::Vec, /// Aggregated post-execution validation diagnostic. - pub post_execution: std::option::Option, + pub post_execution: std::option::Option, } struct PreparedTokenExecution { - wallet: kb_wallet::TemporaryWallet, - unsigned: kb_lib::ExSolanaUnsignedTransaction, - evidence: kb_lib::ExSolanaSimulationEvidence, + wallet: ks_wallet::TemporaryWallet, + unsigned: ks_lib::ExSolanaUnsignedTransaction, + evidence: ks_lib::ExSolanaSimulationEvidence, summary: crate::DevnetSplTokenExecutionSummary, } /// Simulates one Devnet classic SPL Token operation after stateful preflight. pub async fn simulate_devnet_spl_token( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetSplTokenExecutionRequest, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where O: crate::SolanaExecutionObserver, { if request.submit { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "simulate_devnet_spl_token requires submit=false", )); } @@ -138,19 +138,19 @@ where /// Executes one Devnet classic SPL Token simulation or authorized submission. #[allow(clippy::too_many_arguments)] pub async fn execute_devnet_spl_token( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetSplTokenExecutionRequest, - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { @@ -163,7 +163,7 @@ where return std::result::Result::Ok(prepared.summary); } if !prepared.summary.simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_simulation_failed", crate::simulation_failure_message(&prepared.summary.simulation), )); @@ -174,14 +174,14 @@ where ) { return std::result::Result::Err(error); } - let send_evaluation = match kb_lib::ExSafetyChecker + let send_evaluation = match ks_lib::ExSafetyChecker .evaluate_send(&prepared.summary.plan, &prepared.summary.simulation) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if send_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if send_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "execution_send_denied", crate::violation_message(send_evaluation.violations.as_slice()), )); @@ -198,7 +198,7 @@ where } let signature = signed.primary_signature().clone(); let mut summary = prepared.summary; - let mut diagnostic = kb_lib::ExApiPostExecutionDiagnostic { + let mut diagnostic = ks_lib::ExApiPostExecutionDiagnostic { signature: signature.clone(), canonical_inserted: false, core_extracted: false, @@ -206,7 +206,7 @@ where materialized: false, diagnostics: std::vec::Vec::new(), }; - let send_config = match kb_onchain_transport::SendTransactionConfig::from_execution_config( + let send_config = match ks_onchain_transport::SendTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(summary.latest_blockhash.context.slot), ) { @@ -230,9 +230,9 @@ where }, }; summary.send_result = - std::option::Option::Some(sent.to_execution_result(kb_lib::ExApiExecutionCluster::Devnet)); + std::option::Option::Some(sent.to_execution_result(ks_lib::ExApiExecutionCluster::Devnet)); let confirmation_config = - match kb_onchain_transport::ConfirmTransactionConfig::from_execution_config( + match ks_onchain_transport::ConfirmTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(summary.latest_blockhash.last_valid_block_height), std::option::Option::Some(summary.latest_blockhash.context.slot), @@ -244,7 +244,7 @@ where .confirm_transaction_for_roles( request.transaction_role.as_str(), request.query_role.as_str(), - kb_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionCluster::Devnet, &signature, &confirmation_config, ) @@ -261,8 +261,8 @@ where summary.confirmation = std::option::Option::Some(confirmation); if !matches!( confirmation_status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) { diagnostic.diagnostics.push(format!( "SPL Token post-validation stopped at confirmation status {confirmation_status:?}" @@ -297,10 +297,10 @@ where summary.post_execution = std::option::Option::Some(diagnostic); return std::result::Result::Ok(summary); } - let extraction = match kb_pipeline::execute_core_extraction( + let extraction = match ks_pipeline::execute_core_extraction( store, - &kb_pipeline::CoreExtractionRequest { - source: kb_pipeline::CoreExtractionSource::Signatures(std::vec![signature.0.clone()]), + &ks_pipeline::CoreExtractionRequest { + source: ks_pipeline::CoreExtractionSource::Signatures(std::vec![signature.0.clone()]), limit: 1, max_concurrent_extractions: 1, force_replay: request.force_post_validation_replay, @@ -335,7 +335,7 @@ where &signature, false, request.force_post_validation_replay, - &[kb_program_ids::SPL_TOKEN_PROGRAM_ID], + &[ks_program_ids::SPL_TOKEN_PROGRAM_ID], decoders, materializers, observer, @@ -351,7 +351,7 @@ where }; diagnostic.decode_replayed = crate::decode_completed(&first_replay); summary.decode_replay = std::option::Option::Some(first_replay); - let filter = match kb_store::MaterializedEventFilter::new( + let filter = match ks_store::MaterializedEventFilter::new( std::option::Option::None, std::option::Option::None, std::option::Option::Some(signature.0.clone()), @@ -360,7 +360,7 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let rows = match kb_store::DecodePipelineStore::list_materialized_events(store, &filter).await { + let rows = match ks_store::DecodePipelineStore::list_materialized_events(store, &filter).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { diagnostic @@ -382,7 +382,7 @@ where &signature, true, request.force_post_validation_replay, - &[kb_program_ids::SPL_TOKEN_PROGRAM_ID], + &[ks_program_ids::SPL_TOKEN_PROGRAM_ID], decoders, materializers, observer, @@ -426,12 +426,12 @@ where } async fn prepare_execution( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetSplTokenExecutionRequest, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where O: crate::SolanaExecutionObserver, { @@ -450,9 +450,9 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if genesis.classified_cluster - != std::option::Option::Some(kb_lib::ExApiExecutionCluster::Devnet) + != std::option::Option::Some(ks_lib::ExApiExecutionCluster::Devnet) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_cluster_mismatch", format!( "expected Devnet genesis hash but endpoint returned {} classified as {:?}", @@ -460,11 +460,11 @@ where ), )); } - let readiness = match kb_pipeline::inspect_spl_token_stateful_readiness( + let readiness = match ks_pipeline::inspect_spl_token_stateful_readiness( http_pool, - &kb_pipeline::SplTokenStatefulReadinessRequest { + &ks_pipeline::SplTokenStatefulReadinessRequest { query_role: request.query_role.clone(), - cluster: kb_lib::ExApiExecutionCluster::Devnet, + cluster: ks_lib::ExApiExecutionCluster::Devnet, operation: request.operation.clone(), }, ) @@ -473,8 +473,8 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if readiness.status != kb_pipeline::SplTokenStatefulReadinessStatus::Ready { - return std::result::Result::Err(kb_core::Error::new( + if readiness.status != ks_pipeline::SplTokenStatefulReadinessStatus::Ready { + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_stateful_blocked", failed_readiness_message(&readiness), )); @@ -484,12 +484,12 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let wallet_summary = wallet.summary(); - let fee_payer = kb_lib::MdPubkey(wallet_summary.public_key.clone()); + let fee_payer = ks_lib::MdPubkey(wallet_summary.public_key.clone()); let balance = match http_pool .get_balance_for_role( request.query_role.as_str(), &fee_payer, - &kb_onchain_transport::GetBalanceConfig::confirmed(), + &ks_onchain_transport::GetBalanceConfig::confirmed(), ) .await { @@ -497,7 +497,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if balance.lamports < profile.execution.max_fee_lamports { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_balance_insufficient", format!( "Devnet wallet balance {} is below the configured fee ceiling {}", @@ -509,12 +509,12 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let plan_evaluation = match kb_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { + let plan_evaluation = match ks_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if plan_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if plan_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "execution_plan_denied", crate::violation_message(plan_evaluation.violations.as_slice()), )); @@ -522,14 +522,14 @@ where let latest_blockhash = match http_pool .get_latest_blockhash_for_role( request.query_role.as_str(), - &kb_onchain_transport::GetLatestBlockhashConfig::confirmed(), + &ks_onchain_transport::GetLatestBlockhashConfig::confirmed(), ) .await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let unsigned = match kb_lib::executor_solana_build_legacy_transaction( + let unsigned = match ks_lib::executor_solana_build_legacy_transaction( &plan, latest_blockhash.blockhash.as_str(), ) { @@ -540,8 +540,8 @@ where .get_fee_for_message_for_role( request.query_role.as_str(), unsigned.message_base64().as_str(), - &kb_onchain_transport::GetFeeForMessageConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + &ks_onchain_transport::GetFeeForMessageConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, std::option::Option::Some(latest_blockhash.context.slot), ), ) @@ -551,7 +551,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if fee.fee_lamports.is_none() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_fee_unavailable", "getFeeForMessage returned null for the selected recent blockhash", )); @@ -560,8 +560,8 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let simulation_config = match kb_onchain_transport::SimulateTransactionConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let simulation_config = match ks_onchain_transport::SimulateTransactionConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, false, false, std::option::Option::Some(latest_blockhash.context.slot), @@ -590,8 +590,8 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let simulation = simulation_rpc.to_execution_result( - kb_lib::ExApiExecutionCluster::Devnet, - kb_lib::ExApiExecutionBlockhashKind::Latest, + ks_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionBlockhashKind::Latest, std::option::Option::Some( simulation_rpc.context.slot.saturating_sub(latest_blockhash.context.slot), ), @@ -602,7 +602,7 @@ where let evidence = unsigned.bind_simulation(simulation.clone()); let summary = crate::DevnetSplTokenExecutionSummary { profile_name: profile.name.clone(), - cluster: kb_lib::ExApiExecutionCluster::Devnet, + cluster: ks_lib::ExApiExecutionCluster::Devnet, genesis_hash: genesis.genesis_hash, wallet: wallet_summary, balance_lamports: balance.lamports, @@ -624,26 +624,26 @@ where } fn validate_profile( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, request: &crate::DevnetSplTokenExecutionRequest, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if profile.wallet.cluster != "devnet" { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "SPL Token Devnet orchestration requires a Devnet wallet profile", )); } if !profile.wallet.temporary_wallet_enabled || !profile.wallet.temporary_wallet_persist { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "SPL Token Devnet orchestration requires an enabled persistent temporary wallet", )); } if !profile.execution.require_simulation { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "SPL Token Devnet orchestration requires simulation", )); } if request.submit && !profile.wallet.devnet_send_enabled { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet transaction submission is disabled by the wallet profile", )); } @@ -651,7 +651,7 @@ fn validate_profile( && profile.execution.require_operator_confirmation && !request.operator_confirmed { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "SPL Token Devnet submission requires explicit operator confirmation", )); } @@ -659,32 +659,32 @@ fn validate_profile( } fn build_plan( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, request: &crate::DevnetSplTokenExecutionRequest, - fee_payer: kb_lib::MdPubkey, -) -> kb_core::Result { + fee_payer: ks_lib::MdPubkey, +) -> ks_core::Result { let materialization_required = operation_requires_materialization(&request.operation); let mut authorized_signers = std::vec![fee_payer.clone()]; collect_operation_signers(&request.operation, &mut authorized_signers); - let intent = kb_lib::ExSplClassicTokenExecutionIntent { + let intent = ks_lib::ExSplClassicTokenExecutionIntent { intent_id: request.intent_id.clone(), fee_payer, - policy: kb_lib::ExApiExecutionPolicy { - cluster: kb_lib::ExApiExecutionClusterPolicy { - expected_cluster: kb_lib::ExApiExecutionCluster::Devnet, + policy: ks_lib::ExApiExecutionPolicy { + cluster: ks_lib::ExApiExecutionClusterPolicy { + expected_cluster: ks_lib::ExApiExecutionCluster::Devnet, allow_mainnet: false, mainnet_confirmation: false, }, - simulation: kb_lib::ExApiExecutionSimulationPolicy::Required, - blockhash: kb_lib::ExApiExecutionBlockhashPolicy { - kind: kb_lib::ExApiExecutionBlockhashKind::Latest, + simulation: ks_lib::ExApiExecutionSimulationPolicy::Required, + blockhash: ks_lib::ExApiExecutionBlockhashPolicy { + kind: ks_lib::ExApiExecutionBlockhashKind::Latest, max_age_slots: std::option::Option::Some( profile.execution.recent_blockhash_max_age_slots, ), nonce_account: std::option::Option::None, nonce_authority: std::option::Option::None, }, - cost_limit: kb_lib::ExApiExecutionCostLimit { + cost_limit: ks_lib::ExApiExecutionCostLimit { max_spend_lamports: std::option::Option::Some( profile.execution.devnet_max_spend_lamports, ), @@ -695,7 +695,7 @@ fn build_plan( }, authorized_signers, dry_run: !request.submit, - post_execution_validation: kb_lib::ExApiPostExecutionValidationPolicy { + post_execution_validation: ks_lib::ExApiPostExecutionValidationPolicy { canonical_insert_required: true, core_extraction_required: true, decode_replay_required: true, @@ -704,21 +704,21 @@ fn build_plan( }, operation: request.operation.clone(), }; - return kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan( - &kb_lib::ExSplTokenExecutor, + return ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan( + &ks_lib::ExSplTokenExecutor, &intent, ); } fn collect_operation_signers( - operation: &kb_lib::ExSplClassicTokenOperation, - signers: &mut std::vec::Vec, + operation: &ks_lib::ExSplClassicTokenOperation, + signers: &mut std::vec::Vec, ) { match operation { - kb_lib::ExSplClassicTokenOperation::Instruction { value } => { + ks_lib::ExSplClassicTokenOperation::Instruction { value } => { collect_single_signers(value, signers); }, - kb_lib::ExSplClassicTokenOperation::Batch { instructions } => { + ks_lib::ExSplClassicTokenOperation::Batch { instructions } => { for value in instructions { collect_single_signers(value, signers); } @@ -727,37 +727,37 @@ fn collect_operation_signers( } fn collect_single_signers( - operation: &kb_lib::ExSplClassicTokenSingleOperation, - signers: &mut std::vec::Vec, + operation: &ks_lib::ExSplClassicTokenSingleOperation, + signers: &mut std::vec::Vec, ) { let authority = match operation { - kb_lib::ExSplClassicTokenSingleOperation::Transfer { authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::Approve { authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::Revoke { authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::MintTo { authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::Burn { authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::CloseAccount { authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::FreezeAccount { authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::ThawAccount { authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::TransferChecked { authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::ApproveChecked { authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::MintToChecked { authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::BurnChecked { authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::WithdrawExcessLamports { authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::UnwrapLamports { authority, .. } => { + ks_lib::ExSplClassicTokenSingleOperation::Transfer { authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::Approve { authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::Revoke { authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::MintTo { authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::Burn { authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::CloseAccount { authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::FreezeAccount { authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::ThawAccount { authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::TransferChecked { authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::ApproveChecked { authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::MintToChecked { authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::BurnChecked { authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::WithdrawExcessLamports { authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::UnwrapLamports { authority, .. } => { std::option::Option::Some(authority) }, - kb_lib::ExSplClassicTokenSingleOperation::SetAuthority { current_authority, .. } => { + ks_lib::ExSplClassicTokenSingleOperation::SetAuthority { current_authority, .. } => { std::option::Option::Some(current_authority) }, - kb_lib::ExSplClassicTokenSingleOperation::InitializeMint { .. } - | kb_lib::ExSplClassicTokenSingleOperation::InitializeAccount { .. } - | kb_lib::ExSplClassicTokenSingleOperation::InitializeMultisig { .. } - | kb_lib::ExSplClassicTokenSingleOperation::SyncNative { .. } - | kb_lib::ExSplClassicTokenSingleOperation::GetAccountDataSize { .. } - | kb_lib::ExSplClassicTokenSingleOperation::InitializeImmutableOwner { .. } - | kb_lib::ExSplClassicTokenSingleOperation::AmountToUiAmount { .. } - | kb_lib::ExSplClassicTokenSingleOperation::UiAmountToAmount { .. } => { + ks_lib::ExSplClassicTokenSingleOperation::InitializeMint { .. } + | ks_lib::ExSplClassicTokenSingleOperation::InitializeAccount { .. } + | ks_lib::ExSplClassicTokenSingleOperation::InitializeMultisig { .. } + | ks_lib::ExSplClassicTokenSingleOperation::SyncNative { .. } + | ks_lib::ExSplClassicTokenSingleOperation::GetAccountDataSize { .. } + | ks_lib::ExSplClassicTokenSingleOperation::InitializeImmutableOwner { .. } + | ks_lib::ExSplClassicTokenSingleOperation::AmountToUiAmount { .. } + | ks_lib::ExSplClassicTokenSingleOperation::UiAmountToAmount { .. } => { std::option::Option::None }, }; @@ -772,18 +772,18 @@ fn collect_single_signers( } } -fn add_signer(signers: &mut std::vec::Vec, signer: &kb_lib::MdPubkey) { +fn add_signer(signers: &mut std::vec::Vec, signer: &ks_lib::MdPubkey) { if !signers.iter().any(|value| return value == signer) { signers.push(signer.clone()); } } -fn operation_requires_materialization(operation: &kb_lib::ExSplClassicTokenOperation) -> bool { +fn operation_requires_materialization(operation: &ks_lib::ExSplClassicTokenOperation) -> bool { return match operation { - kb_lib::ExSplClassicTokenOperation::Instruction { value } => { + ks_lib::ExSplClassicTokenOperation::Instruction { value } => { single_requires_materialization(value) }, - kb_lib::ExSplClassicTokenOperation::Batch { instructions } => { + ks_lib::ExSplClassicTokenOperation::Batch { instructions } => { instructions.iter().any(|value| { return single_requires_materialization(value); }) @@ -791,18 +791,18 @@ fn operation_requires_materialization(operation: &kb_lib::ExSplClassicTokenOpera }; } -fn single_requires_materialization(operation: &kb_lib::ExSplClassicTokenSingleOperation) -> bool { +fn single_requires_materialization(operation: &ks_lib::ExSplClassicTokenSingleOperation) -> bool { return !matches!( operation, - kb_lib::ExSplClassicTokenSingleOperation::GetAccountDataSize { .. } - | kb_lib::ExSplClassicTokenSingleOperation::InitializeImmutableOwner { .. } - | kb_lib::ExSplClassicTokenSingleOperation::AmountToUiAmount { .. } - | kb_lib::ExSplClassicTokenSingleOperation::UiAmountToAmount { .. } + ks_lib::ExSplClassicTokenSingleOperation::GetAccountDataSize { .. } + | ks_lib::ExSplClassicTokenSingleOperation::InitializeImmutableOwner { .. } + | ks_lib::ExSplClassicTokenSingleOperation::AmountToUiAmount { .. } + | ks_lib::ExSplClassicTokenSingleOperation::UiAmountToAmount { .. } ); } fn failed_readiness_message( - readiness: &kb_pipeline::SplTokenStatefulReadinessReport, + readiness: &ks_pipeline::SplTokenStatefulReadinessReport, ) -> std::string::String { let failures = readiness .checks @@ -820,9 +820,9 @@ fn failed_readiness_message( fn validate_profile_wallet_signers( required_signers: &[std::string::String], wallet_pubkey: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if required_signers.iter().any(|value| return value.as_str() != wallet_pubkey) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_external_signer_unavailable", format!( "the Devnet Token orchestrator can sign only with profile wallet {}; required signers are {}", @@ -835,27 +835,27 @@ fn validate_profile_wallet_signers( } pub(crate) async fn hydrate_signature( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, query_role: &str, post_validation_max_retries: u32, observer: &O, - signature: &kb_lib::MdSignature, -) -> kb_core::Result + signature: &ks_lib::MdSignature, +) -> ks_core::Result where - S: kb_store::RawTransactionStore + Sync, + S: ks_store::RawTransactionStore + Sync, O: crate::SolanaExecutionObserver, { let mut retry = 0_u32; loop { - let result = match kb_pipeline::execute_http_backfill( + let result = match ks_pipeline::execute_http_backfill( http_pool, store, - &kb_pipeline::BackfillRequest { + &ks_pipeline::BackfillRequest { role: query_role.to_string(), commitment: "confirmed".to_string(), - source: kb_pipeline::BackfillSource::ExplicitSignatures(std::vec![ + source: ks_pipeline::BackfillSource::ExplicitSignatures(std::vec![ signature.0.clone() ]), page_size: 1, @@ -885,7 +885,7 @@ where } } -pub(crate) fn canonical_available(summary: &kb_pipeline::BackfillSummary) -> bool { +pub(crate) fn canonical_available(summary: &ks_pipeline::BackfillSummary) -> bool { return summary.failed == 0 && summary.missing == 0 && summary.candidates_completed == 1 @@ -900,27 +900,27 @@ pub(crate) fn canonical_available(summary: &kb_pipeline::BackfillSummary) -> boo pub(crate) async fn replay_program( store: &S, - signature: &kb_lib::MdSignature, + signature: &ks_lib::MdSignature, include_materialized_state: bool, force_post_validation_replay: bool, program_ids: &[&str], - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::DecodePipelineStore + Sync, + S: ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { let mut states = std::vec![ - kb_store::CoreInstructionProcessingState::Pending, - kb_store::CoreInstructionProcessingState::Failed, - kb_store::CoreInstructionProcessingState::ReplayRequested, + ks_store::CoreInstructionProcessingState::Pending, + ks_store::CoreInstructionProcessingState::Failed, + ks_store::CoreInstructionProcessingState::ReplayRequested, ]; if include_materialized_state { - states.push(kb_store::CoreInstructionProcessingState::Materialized); + states.push(ks_store::CoreInstructionProcessingState::Materialized); } - let selection = match kb_store::DecodeSelectionFilter::new( + let selection = match ks_store::DecodeSelectionFilter::new( std::vec![signature.0.clone()], states, std::option::Option::None, @@ -933,13 +933,13 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - return kb_pipeline::execute_decode_replay( + return ks_pipeline::execute_decode_replay( store, - &kb_pipeline::DecodeReplayRequest { - campaign_id: kb_pipeline::new_decode_campaign_id(), + &ks_pipeline::DecodeReplayRequest { + campaign_id: ks_pipeline::new_decode_campaign_id(), selection, decoder_names: std::vec::Vec::new(), - dispatch_policy: kb_pipeline::DecodeDispatchPolicy::HighestPriority, + dispatch_policy: ks_pipeline::DecodeDispatchPolicy::HighestPriority, max_concurrent_inputs: 1, force_replay: if include_materialized_state { false @@ -956,7 +956,7 @@ where .await; } -pub(crate) fn decode_completed(summary: &kb_pipeline::DecodeReplaySummary) -> bool { +pub(crate) fn decode_completed(summary: &ks_pipeline::DecodeReplaySummary) -> bool { return summary.failed_inputs == 0 && summary.processing_error_inputs == 0 && summary.unmatched == 0 @@ -973,8 +973,8 @@ pub(crate) fn decode_completed(summary: &kb_pipeline::DecodeReplaySummary) -> bo #[cfg(test)] mod tests { - fn example_devnet_profile() -> kb_config::ProfileConfig { - let config = match kb_config::parse_config_json(include_str!( + fn example_devnet_profile() -> ks_config::ProfileConfig { + let config = match ks_config::parse_config_json(include_str!( "../../../../config/example.config.json" )) { std::result::Result::Ok(value) => value, @@ -986,17 +986,17 @@ mod tests { }; } - fn checked_transfer(fee_authority: &str) -> kb_lib::ExSplClassicTokenOperation { - return kb_lib::ExSplClassicTokenOperation::Instruction { - value: kb_lib::ExSplClassicTokenSingleOperation::TransferChecked { - source: kb_lib::MdPubkey(kb_program_ids::VOTE_PROGRAM_ID.to_string()), - mint: kb_lib::MdPubkey(kb_program_ids::STAKE_PROGRAM_ID.to_string()), - destination: kb_lib::MdPubkey(kb_program_ids::CONFIG_PROGRAM_ID.to_string()), - authority: kb_lib::ExSplClassicTokenAuthority { - authority: kb_lib::MdPubkey(fee_authority.to_string()), + fn checked_transfer(fee_authority: &str) -> ks_lib::ExSplClassicTokenOperation { + return ks_lib::ExSplClassicTokenOperation::Instruction { + value: ks_lib::ExSplClassicTokenSingleOperation::TransferChecked { + source: ks_lib::MdPubkey(ks_program_ids::VOTE_PROGRAM_ID.to_string()), + mint: ks_lib::MdPubkey(ks_program_ids::STAKE_PROGRAM_ID.to_string()), + destination: ks_lib::MdPubkey(ks_program_ids::CONFIG_PROGRAM_ID.to_string()), + authority: ks_lib::ExSplClassicTokenAuthority { + authority: ks_lib::MdPubkey(fee_authority.to_string()), multisig_signers: std::vec::Vec::new(), }, - amount: kb_lib::ExSplClassicTokenAmount("1".to_string()), + amount: ks_lib::ExSplClassicTokenAmount("1".to_string()), decimals: 9, }, }; @@ -1006,7 +1006,7 @@ mod tests { fn request_is_simulation_only_and_bounded_by_default() { let request = crate::DevnetSplTokenExecutionRequest::new( "token-1", - checked_transfer(kb_program_ids::SYSTEM_PROGRAM_ID), + checked_transfer(ks_program_ids::SYSTEM_PROGRAM_ID), ); assert!(!request.submit); assert!(request.validate().is_ok()); @@ -1018,8 +1018,8 @@ mod tests { #[test] fn checked_transfer_plan_is_simulation_first_and_authorizes_exact_signers() { let profile = example_devnet_profile(); - let fee_payer = kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()); - let authority = kb_program_ids::VOTE_PROGRAM_ID; + let fee_payer = ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()); + let authority = ks_program_ids::VOTE_PROGRAM_ID; let request = crate::DevnetSplTokenExecutionRequest::new("token-2", checked_transfer(authority)); let plan = match super::build_plan(&profile, &request, fee_payer.clone()) { @@ -1038,17 +1038,17 @@ mod tests { let profile = example_devnet_profile(); let request = crate::DevnetSplTokenExecutionRequest::new( "token-3", - kb_lib::ExSplClassicTokenOperation::Instruction { - value: kb_lib::ExSplClassicTokenSingleOperation::AmountToUiAmount { - mint: kb_lib::MdPubkey(kb_program_ids::STAKE_PROGRAM_ID.to_string()), - amount: kb_lib::ExSplClassicTokenAmount("1".to_string()), + ks_lib::ExSplClassicTokenOperation::Instruction { + value: ks_lib::ExSplClassicTokenSingleOperation::AmountToUiAmount { + mint: ks_lib::MdPubkey(ks_program_ids::STAKE_PROGRAM_ID.to_string()), + amount: ks_lib::ExSplClassicTokenAmount("1".to_string()), }, }, ); let plan = match super::build_plan( &profile, &request, - kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), + ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("conversion plan failed: {error}"), @@ -1058,12 +1058,12 @@ mod tests { #[test] fn submission_signers_must_all_resolve_to_the_profile_wallet() { - let wallet = kb_program_ids::SYSTEM_PROGRAM_ID.to_string(); + let wallet = ks_program_ids::SYSTEM_PROGRAM_ID.to_string(); assert!( super::validate_profile_wallet_signers(std::slice::from_ref(&wallet), wallet.as_str(),) .is_ok() ); - let external = kb_program_ids::VOTE_PROGRAM_ID.to_string(); + let external = ks_program_ids::VOTE_PROGRAM_ID.to_string(); let error = super::validate_profile_wallet_signers(&[wallet.clone(), external], wallet.as_str()); assert!(error.is_err()); @@ -1095,7 +1095,7 @@ mod tests { if let std::result::Result::Ok(directory) = std::env::var("KB_DEVNET_WALLET_DIR") { profile.wallet.wallet_dir = directory; } - let pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("HTTP pool creation failed: {error}"), }; @@ -1105,16 +1105,16 @@ mod tests { }; let mut request = crate::DevnetSplTokenExecutionRequest::new( format!("devnet-token-test-{}", uuid::Uuid::new_v4()), - kb_lib::ExSplClassicTokenOperation::Instruction { - value: kb_lib::ExSplClassicTokenSingleOperation::TransferChecked { + ks_lib::ExSplClassicTokenOperation::Instruction { + value: ks_lib::ExSplClassicTokenSingleOperation::TransferChecked { source, mint, destination, - authority: kb_lib::ExSplClassicTokenAuthority { + authority: ks_lib::ExSplClassicTokenAuthority { authority, multisig_signers: std::vec::Vec::new(), }, - amount: kb_lib::ExSplClassicTokenAmount(amount), + amount: ks_lib::ExSplClassicTokenAmount(amount), decimals, }, }, @@ -1138,7 +1138,7 @@ mod tests { }; assert_eq!( summary.stateful_readiness.status, - kb_pipeline::SplTokenStatefulReadinessStatus::Ready + ks_pipeline::SplTokenStatefulReadinessStatus::Ready ); assert!(summary.simulation.success, "{:#?}", summary.simulation); return; @@ -1154,7 +1154,7 @@ mod tests { }; profile.database.backend = "postgres".to_string(); profile.database.postgres.url = database_url; - let store_options = match kb_store::PostgresStoreOptions::new( + let store_options = match ks_store::PostgresStoreOptions::new( profile.database.postgres.url.clone(), profile.database.postgres.max_connections, profile.database.postgres.connect_timeout_ms, @@ -1163,17 +1163,17 @@ mod tests { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("PostgreSQL options failed: {error}"), }; - let store = match kb_store::PostgresStore::connect(store_options).await { + let store = match ks_store::PostgresStore::connect(store_options).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("PostgreSQL connection failed: {error}"), }; if let std::result::Result::Err(error) = store.initialize_store_schema().await { panic!("PostgreSQL schema initialization failed: {error}"); } - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcSplTokenDecoder)]; - let materializers: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::MtTokenAccountsMaterializer,)]; + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcSplTokenDecoder)]; + let materializers: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::MtTokenAccountsMaterializer,)]; let summary = match crate::execute_devnet_spl_token( &pool, &store, @@ -1201,8 +1201,8 @@ mod tests { }; assert!(matches!( confirmation.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized )); let first_replay = match summary.decode_replay.as_ref() { std::option::Option::Some(value) => value, @@ -1265,7 +1265,7 @@ mod tests { if let std::result::Result::Ok(directory) = std::env::var("KB_DEVNET_WALLET_DIR") { profile.wallet.wallet_dir = directory; } - let pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("HTTP pool creation failed: {error}"), }; @@ -1273,20 +1273,20 @@ mod tests { std::option::Option::Some(value) => value, std::option::Option::None => panic!("workspace root cannot be resolved"), }; - let token_authority = kb_lib::ExSplClassicTokenAuthority { + let token_authority = ks_lib::ExSplClassicTokenAuthority { authority: authority.clone(), multisig_signers: std::vec::Vec::new(), }; let batch_request = crate::DevnetSplTokenExecutionRequest::new( format!("devnet-token-batch-probe-{}", uuid::Uuid::new_v4()), - kb_lib::ExSplClassicTokenOperation::Batch { + ks_lib::ExSplClassicTokenOperation::Batch { instructions: std::vec![ - kb_lib::ExSplClassicTokenSingleOperation::TransferChecked { + ks_lib::ExSplClassicTokenSingleOperation::TransferChecked { source, mint, destination, authority: token_authority.clone(), - amount: kb_lib::ExSplClassicTokenAmount("0".to_string()), + amount: ks_lib::ExSplClassicTokenAmount("0".to_string()), decimals, }, ], @@ -1309,12 +1309,12 @@ mod tests { let unwrap_request = crate::DevnetSplTokenExecutionRequest::new( format!("devnet-token-unwrap-probe-{}", uuid::Uuid::new_v4()), - kb_lib::ExSplClassicTokenOperation::Instruction { - value: kb_lib::ExSplClassicTokenSingleOperation::UnwrapLamports { + ks_lib::ExSplClassicTokenOperation::Instruction { + value: ks_lib::ExSplClassicTokenSingleOperation::UnwrapLamports { account: native_account, destination: authority, authority: token_authority, - amount_lamports: std::option::Option::Some(kb_lib::ExSplClassicTokenAmount( + amount_lamports: std::option::Option::Some(ks_lib::ExSplClassicTokenAmount( "1".to_string(), )), }, @@ -1338,16 +1338,16 @@ mod tests { print_recent_probe("unwrap_lamports", &unwrap.simulation); } - fn print_recent_probe(operation: &str, simulation: &kb_lib::ExApiExecutionSimulationResult) { + fn print_recent_probe(operation: &str, simulation: &ks_lib::ExApiExecutionSimulationResult) { println!( "SPL Token recent Devnet probe operation={operation} success={} error={:?} units={:?} logs={:?}", simulation.success, simulation.error, simulation.units_consumed, simulation.logs, ); } - fn required_pubkey_env(name: &str) -> kb_lib::MdPubkey { + fn required_pubkey_env(name: &str) -> ks_lib::MdPubkey { return match std::env::var(name) { - std::result::Result::Ok(value) => kb_lib::MdPubkey(value), + std::result::Result::Ok(value) => ks_lib::MdPubkey(value), std::result::Result::Err(error) => panic!("{name} is required: {error}"), }; } diff --git a/kb-pipeline-demo-scenarios/src/spl/token/lifecycle.rs b/ks-pipeline-demo-scenarios/src/spl/token/lifecycle.rs similarity index 82% rename from kb-pipeline-demo-scenarios/src/spl/token/lifecycle.rs rename to ks-pipeline-demo-scenarios/src/spl/token/lifecycle.rs index 43ec70e..0391fba 100644 --- a/kb-pipeline-demo-scenarios/src/spl/token/lifecycle.rs +++ b/ks-pipeline-demo-scenarios/src/spl/token/lifecycle.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/spl/token/lifecycle.rs -// version: 9 +// file: ks-pipeline-demo-scenarios/src/spl/token/lifecycle.rs +// version: 10 //! Controlled Devnet lifecycle for freshly prepared classic SPL Token accounts. @@ -33,19 +33,19 @@ impl crate::DevnetSplTokenLifecyclePreparationRequest { }; } - fn validate(&self) -> kb_core::Result<()> { + fn validate(&self) -> ks_core::Result<()> { if self.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet SPL Token lifecycle preparation intent id must not be empty", )); } if self.query_role.trim().is_empty() || self.transaction_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet SPL Token lifecycle preparation endpoint roles must not be empty", )); } if !self.submit || !self.operator_confirmed { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_preparation_authorization_required", "raw account preparation requires submit=true and explicit operator confirmation", )); @@ -60,30 +60,30 @@ pub struct DevnetSplTokenLifecyclePreparationStep { /// Stable account role: `mint`, `source` or `destination`. pub account_role: std::string::String, /// Newly generated account public key. - pub account: kb_lib::MdPubkey, + pub account: ks_lib::MdPubkey, /// Exact allocated data length. pub space: u64, /// Exact rent-exempt lamports funded into the account. pub rent_lamports: u64, /// Confirmed System account-creation transaction signature. - pub signature: kb_lib::MdSignature, + pub signature: ks_lib::MdSignature, /// Terminal confirmation status. - pub confirmation_status: kb_lib::ExApiExecutionConfirmationStatus, + pub confirmation_status: ks_lib::ExApiExecutionConfirmationStatus, } /// Fresh raw accounts and identities ready for the controlled Token lifecycle. #[derive(Clone, Debug, Eq, PartialEq)] pub struct DevnetSplTokenLifecyclePreparationSummary { /// Profile wallet that will own and administer the lifecycle accounts. - pub authority: kb_lib::MdPubkey, + pub authority: ks_lib::MdPubkey, /// Fresh uninitialized 82-byte Token-owned mint account. - pub mint: kb_lib::MdPubkey, + pub mint: ks_lib::MdPubkey, /// Fresh uninitialized 165-byte Token-owned source account. - pub source: kb_lib::MdPubkey, + pub source: ks_lib::MdPubkey, /// Fresh uninitialized 165-byte Token-owned destination account. - pub destination: kb_lib::MdPubkey, + pub destination: ks_lib::MdPubkey, /// Fresh off-chain delegate identity used only by approve/revoke. - pub delegate: kb_lib::MdPubkey, + pub delegate: ks_lib::MdPubkey, /// Ordered confirmed account-creation results. pub steps: std::vec::Vec, } @@ -98,23 +98,23 @@ pub struct DevnetSplTokenLifecycleRequest { /// Endpoint role used for simulation, submission and confirmation. pub transaction_role: std::string::String, /// Pre-created, rent-exempt, uninitialized 82-byte mint account. - pub mint: kb_lib::MdPubkey, + pub mint: ks_lib::MdPubkey, /// Pre-created, rent-exempt, uninitialized 165-byte source token account. - pub source: kb_lib::MdPubkey, + pub source: ks_lib::MdPubkey, /// Pre-created, rent-exempt, uninitialized 165-byte destination token account. - pub destination: kb_lib::MdPubkey, + pub destination: ks_lib::MdPubkey, /// Delegate recorded by the approval and removed by the following revoke. - pub delegate: kb_lib::MdPubkey, + pub delegate: ks_lib::MdPubkey, /// Mint authority and owner of both token accounts. - pub authority: kb_lib::MdPubkey, + pub authority: ks_lib::MdPubkey, /// Exact decimals used by all checked instructions. pub decimals: u8, /// Exact raw amount minted into the source account. - pub mint_amount: kb_lib::ExSplClassicTokenAmount, + pub mint_amount: ks_lib::ExSplClassicTokenAmount, /// Exact raw amount transferred from source to destination. - pub transfer_amount: kb_lib::ExSplClassicTokenAmount, + pub transfer_amount: ks_lib::ExSplClassicTokenAmount, /// Exact raw allowance approved on the destination account. - pub approve_amount: kb_lib::ExSplClassicTokenAmount, + pub approve_amount: ks_lib::ExSplClassicTokenAmount, /// Explicitly authorizes every submitted lifecycle transaction. pub submit: bool, /// Explicit operator confirmation applied to every lifecycle transaction. @@ -124,7 +124,7 @@ pub struct DevnetSplTokenLifecycleRequest { /// First zero-based lifecycle step to execute. pub first_step_index: u8, /// Confirmed signature of the immediately preceding step when resuming. - pub resume_predecessor_signature: std::option::Option, + pub resume_predecessor_signature: std::option::Option, /// Bounded pause inserted between recovered or newly executed steps. pub inter_step_delay_ms: u64, } @@ -133,11 +133,11 @@ impl crate::DevnetSplTokenLifecycleRequest { /// Creates a lifecycle request that remains non-submittable until explicitly authorized. pub fn new( intent_id: impl std::convert::Into, - mint: kb_lib::MdPubkey, - source: kb_lib::MdPubkey, - destination: kb_lib::MdPubkey, - delegate: kb_lib::MdPubkey, - authority: kb_lib::MdPubkey, + mint: ks_lib::MdPubkey, + source: ks_lib::MdPubkey, + destination: ks_lib::MdPubkey, + delegate: ks_lib::MdPubkey, + authority: ks_lib::MdPubkey, ) -> Self { return Self { intent_id: intent_id.into(), @@ -149,9 +149,9 @@ impl crate::DevnetSplTokenLifecycleRequest { delegate, authority, decimals: 9, - mint_amount: kb_lib::ExSplClassicTokenAmount("10".to_string()), - transfer_amount: kb_lib::ExSplClassicTokenAmount("4".to_string()), - approve_amount: kb_lib::ExSplClassicTokenAmount("2".to_string()), + mint_amount: ks_lib::ExSplClassicTokenAmount("10".to_string()), + transfer_amount: ks_lib::ExSplClassicTokenAmount("4".to_string()), + approve_amount: ks_lib::ExSplClassicTokenAmount("2".to_string()), submit: false, operator_confirmed: false, post_validation_max_retries: 10, @@ -162,43 +162,43 @@ impl crate::DevnetSplTokenLifecycleRequest { } /// Validates lifecycle-local bounds and amount conservation. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet SPL Token lifecycle intent id must not be empty", )); } if self.query_role.trim().is_empty() || self.transaction_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet SPL Token lifecycle endpoint roles must not be empty", )); } if self.post_validation_max_retries > 20 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "lifecycle post-execution retries must not exceed 20", )); } if self.first_step_index > 10 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "lifecycle first step index must be between 0 and 10", )); } if self.inter_step_delay_ms > 30_000 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "lifecycle inter-step delay must not exceed 30000 milliseconds", )); } if (self.first_step_index == 0 && self.resume_predecessor_signature.is_some()) || (self.first_step_index > 0 && self.resume_predecessor_signature.is_none()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_resume_contract_invalid", "a resumed lifecycle requires exactly the confirmed predecessor signature", )); } if let std::option::Option::Some(signature) = &self.resume_predecessor_signature { if let std::result::Result::Err(error) = - kb_onchain_transport::validate_transaction_signature_text( + ks_onchain_transport::validate_transaction_signature_text( signature.0.as_str(), "lifecycle predecessor signature", ) @@ -210,13 +210,13 @@ impl crate::DevnetSplTokenLifecycleRequest { || self.mint == self.destination || self.source == self.destination { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_accounts_not_distinct", "lifecycle mint, source and destination accounts must be distinct", )); } if self.delegate == self.authority { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_delegate_is_authority", "lifecycle delegate must differ from the token-account authority", )); @@ -239,7 +239,7 @@ impl crate::DevnetSplTokenLifecycleRequest { || approve_amount == 0 || approve_amount > transfer_amount { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_amounts_invalid", "lifecycle requires mint > transfer > 0 and 0 < approval <= transfer", )); @@ -256,9 +256,9 @@ pub struct DevnetSplTokenLifecycleStepSummary { /// Stable SPL Token operation code. pub operation_code: std::string::String, /// Confirmed transaction signature. - pub signature: kb_lib::MdSignature, + pub signature: ks_lib::MdSignature, /// Terminal confirmation status. - pub confirmation_status: kb_lib::ExApiExecutionConfirmationStatus, + pub confirmation_status: ks_lib::ExApiExecutionConfirmationStatus, /// Number of exact SPL Token materializations returned for the signature. pub materialization_count: u32, /// Whether the second replay produced no failure, refusal or new output. @@ -271,23 +271,23 @@ pub struct DevnetSplTokenLifecycleSummary { /// Stable lifecycle identifier. pub intent_id: std::string::String, /// Mint initialized and exercised by the lifecycle. - pub mint: kb_lib::MdPubkey, + pub mint: ks_lib::MdPubkey, /// Source token account closed by the lifecycle. - pub source: kb_lib::MdPubkey, + pub source: ks_lib::MdPubkey, /// Destination token account closed by the lifecycle. - pub destination: kb_lib::MdPubkey, + pub destination: ks_lib::MdPubkey, /// Ordered, fully validated lifecycle transactions. pub steps: std::vec::Vec, } /// Creates and verifies the three raw Token-owned accounts required by one lifecycle. pub async fn prepare_devnet_spl_token_lifecycle_accounts( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetSplTokenLifecyclePreparationRequest, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where O: crate::SolanaExecutionObserver, { @@ -298,12 +298,12 @@ where || !profile.wallet.devnet_send_enabled || !profile.execution.require_simulation { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "lifecycle account preparation requires a simulation-enabled Devnet send profile", )); } if profile.execution.require_operator_confirmation && !request.operator_confirmed { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "lifecycle account preparation requires explicit operator confirmation", )); } @@ -312,9 +312,9 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if genesis.classified_cluster - != std::option::Option::Some(kb_lib::ExApiExecutionCluster::Devnet) + != std::option::Option::Some(ks_lib::ExApiExecutionCluster::Devnet) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_cluster_mismatch", "lifecycle account preparation endpoint is not Devnet", )); @@ -323,7 +323,7 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let authority = kb_lib::MdPubkey(payer.public_key()); + let authority = ks_lib::MdPubkey(payer.public_key()); let mint_wallet = match generated_wallet("token-lifecycle-mint") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -340,7 +340,7 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let rent_config = kb_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(); + let rent_config = ks_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(); let mint_rent = match http_pool .get_minimum_balance_for_rent_exemption_for_role( request.query_role.as_str(), @@ -372,7 +372,7 @@ where }) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_preparation_cost_overflow", "lifecycle preparation rent and fee ceiling overflow u64", )); @@ -382,7 +382,7 @@ where .get_balance_for_role( request.query_role.as_str(), &authority, - &kb_onchain_transport::GetBalanceConfig::confirmed(), + &ks_onchain_transport::GetBalanceConfig::confirmed(), ) .await { @@ -390,7 +390,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if balance < required_balance { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_balance_insufficient", format!( "lifecycle preparation requires at most {required_balance} lamports but wallet has {balance}" @@ -424,10 +424,10 @@ where } return std::result::Result::Ok(crate::DevnetSplTokenLifecyclePreparationSummary { authority, - mint: kb_lib::MdPubkey(mint_wallet.public_key()), - source: kb_lib::MdPubkey(source_wallet.public_key()), - destination: kb_lib::MdPubkey(destination_wallet.public_key()), - delegate: kb_lib::MdPubkey(delegate_wallet.public_key()), + mint: ks_lib::MdPubkey(mint_wallet.public_key()), + source: ks_lib::MdPubkey(source_wallet.public_key()), + destination: ks_lib::MdPubkey(destination_wallet.public_key()), + delegate: ks_lib::MdPubkey(delegate_wallet.public_key()), steps, }); } @@ -435,19 +435,19 @@ where /// Executes initialize, mint, transfer, approve/revoke, burn and close on Devnet. #[allow(clippy::too_many_arguments)] pub async fn execute_devnet_spl_token_lifecycle( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetSplTokenLifecycleRequest, - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { @@ -455,7 +455,7 @@ where return std::result::Result::Err(error); } if !request.submit || !request.operator_confirmed { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_authorization_required", "the destructive lifecycle requires submit=true and explicit operator confirmation", )); @@ -465,7 +465,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if profile_wallet.public_key() != request.authority.0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_authority_wallet_mismatch", "lifecycle authority must equal the selected profile wallet before the first mutation", )); @@ -480,7 +480,7 @@ where let predecessor_operation = match operations.get(predecessor_index) { std::option::Option::Some(value) => value.clone(), std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_resume_index_missing", "lifecycle predecessor operation is unavailable", )); @@ -489,7 +489,7 @@ where let predecessor_signature = match request.resume_predecessor_signature.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_resume_signature_missing", "lifecycle predecessor signature is required for recovery", )); @@ -545,7 +545,7 @@ where { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_step_failed", format!("lifecycle step {index} {operation_code} failed: {error}"), )); @@ -569,21 +569,21 @@ where #[allow(clippy::too_many_arguments)] async fn recover_predecessor_step( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, lifecycle_request: &crate::DevnetSplTokenLifecycleRequest, index: usize, - operation: kb_lib::ExSplClassicTokenOperation, - signature: &kb_lib::MdSignature, - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + operation: ks_lib::ExSplClassicTokenOperation, + signature: &ks_lib::MdSignature, + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { @@ -611,15 +611,15 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if !crate::canonical_available(&backfill) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_resume_canonical_missing", "confirmed lifecycle predecessor is unavailable for canonical recovery", )); } - let extraction = match kb_pipeline::execute_core_extraction( + let extraction = match ks_pipeline::execute_core_extraction( store, - &kb_pipeline::CoreExtractionRequest { - source: kb_pipeline::CoreExtractionSource::Signatures(std::vec![signature.0.clone()]), + &ks_pipeline::CoreExtractionRequest { + source: ks_pipeline::CoreExtractionSource::Signatures(std::vec![signature.0.clone()]), limit: 1, max_concurrent_extractions: 1, force_replay: false, @@ -636,7 +636,7 @@ where || extraction.selected != 1 || extraction.extracted.saturating_add(extraction.skipped) < 1 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_resume_extraction_incomplete", "lifecycle predecessor core extraction did not complete", )); @@ -646,7 +646,7 @@ where signature, false, request.force_post_validation_replay, - &[kb_program_ids::SPL_TOKEN_PROGRAM_ID], + &[ks_program_ids::SPL_TOKEN_PROGRAM_ID], decoders, materializers, observer, @@ -657,12 +657,12 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if !crate::decode_completed(&first_replay) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_resume_decode_incomplete", "lifecycle predecessor decode and materialization did not complete", )); } - let filter = match kb_store::MaterializedEventFilter::new( + let filter = match ks_store::MaterializedEventFilter::new( std::option::Option::None, std::option::Option::None, std::option::Option::Some(signature.0.clone()), @@ -671,7 +671,7 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let rows = match kb_store::DecodePipelineStore::list_materialized_events(store, &filter).await { + let rows = match ks_store::DecodePipelineStore::list_materialized_events(store, &filter).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -684,7 +684,7 @@ where }) .count(); if recovered_count == 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_resume_materialization_missing", format!( "lifecycle predecessor signature did not materialize expected operation {expected_operation}" @@ -696,7 +696,7 @@ where signature, true, request.force_post_validation_replay, - &[kb_program_ids::SPL_TOKEN_PROGRAM_ID], + &[ks_program_ids::SPL_TOKEN_PROGRAM_ID], decoders, materializers, observer, @@ -715,7 +715,7 @@ where && processor.materialization_refused == 0; }); if !idempotent { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_resume_not_idempotent", "lifecycle predecessor second replay was not idempotent", )); @@ -723,7 +723,7 @@ where let materialization_count = match u32::try_from(recovered_count) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_materializations_overflow", "recovered lifecycle materialization count exceeds u32", )); @@ -732,7 +732,7 @@ where let step_index = match u8::try_from(index) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_step_index_overflow", "recovered lifecycle step index exceeds u8", )); @@ -742,19 +742,19 @@ where index: step_index, operation_code, signature: signature.clone(), - confirmation_status: kb_lib::ExApiExecutionConfirmationStatus::Confirmed, + confirmation_status: ks_lib::ExApiExecutionConfirmationStatus::Confirmed, materialization_count, idempotence_validated: true, }); } -fn materialized_operation_code(operation: &kb_lib::ExSplClassicTokenOperation) -> &str { +fn materialized_operation_code(operation: &ks_lib::ExSplClassicTokenOperation) -> &str { return match operation { - kb_lib::ExSplClassicTokenOperation::Instruction { - value: kb_lib::ExSplClassicTokenSingleOperation::InitializeMint { .. }, + ks_lib::ExSplClassicTokenOperation::Instruction { + value: ks_lib::ExSplClassicTokenSingleOperation::InitializeMint { .. }, } => "initialize_mint2", - kb_lib::ExSplClassicTokenOperation::Instruction { - value: kb_lib::ExSplClassicTokenSingleOperation::InitializeAccount { .. }, + ks_lib::ExSplClassicTokenOperation::Instruction { + value: ks_lib::ExSplClassicTokenSingleOperation::InitializeAccount { .. }, } => "initialize_account3", _ => match operation.operation_code().strip_prefix("spl.token.") { std::option::Option::Some(value) => value, @@ -784,26 +784,26 @@ fn emit_completed_step( ); } -fn generated_wallet(alias: &str) -> kb_core::Result { - let alias = match kb_wallet::WalletAlias::parse(alias) { +fn generated_wallet(alias: &str) -> ks_core::Result { + let alias = match ks_wallet::WalletAlias::parse(alias) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - return std::result::Result::Ok(kb_wallet::TemporaryWallet::generate(alias)); + return std::result::Result::Ok(ks_wallet::TemporaryWallet::generate(alias)); } #[allow(clippy::too_many_arguments)] async fn create_raw_token_account( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, request: &crate::DevnetSplTokenLifecyclePreparationRequest, observer: &O, - payer: &kb_wallet::TemporaryWallet, - account_wallet: &kb_wallet::TemporaryWallet, + payer: &ks_wallet::TemporaryWallet, + account_wallet: &ks_wallet::TemporaryWallet, account_role: &str, space: u64, rent_lamports: u64, -) -> kb_core::Result +) -> ks_core::Result where O: crate::SolanaExecutionObserver, { @@ -812,12 +812,12 @@ where { return std::result::Result::Err(error); } - let account = kb_lib::MdPubkey(account_wallet.public_key()); + let account = ks_lib::MdPubkey(account_wallet.public_key()); let preflight = match http_pool .get_account_info_for_role( request.query_role.as_str(), &account, - &kb_onchain_transport::GetAccountInfoConfig::confirmed(), + &ks_onchain_transport::GetAccountInfoConfig::confirmed(), ) .await { @@ -825,12 +825,12 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if preflight.account.is_some() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_preparation_account_exists", format!("generated lifecycle {account_role} account already exists"), )); } - let payer_pubkey = kb_lib::MdPubkey(payer.public_key()); + let payer_pubkey = ks_lib::MdPubkey(payer.public_key()); let plan = match build_account_creation_plan( profile, format!("{}-{account_role}", request.intent_id), @@ -842,12 +842,12 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let plan_evaluation = match kb_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { + let plan_evaluation = match ks_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if plan_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if plan_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "execution_plan_denied", crate::violation_message(plan_evaluation.violations.as_slice()), )); @@ -855,14 +855,14 @@ where let latest_blockhash = match http_pool .get_latest_blockhash_for_role( request.query_role.as_str(), - &kb_onchain_transport::GetLatestBlockhashConfig::confirmed(), + &ks_onchain_transport::GetLatestBlockhashConfig::confirmed(), ) .await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let unsigned = match kb_lib::executor_solana_build_legacy_transaction( + let unsigned = match ks_lib::executor_solana_build_legacy_transaction( &plan, latest_blockhash.blockhash.as_str(), ) { @@ -873,8 +873,8 @@ where .get_fee_for_message_for_role( request.query_role.as_str(), unsigned.message_base64().as_str(), - &kb_onchain_transport::GetFeeForMessageConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + &ks_onchain_transport::GetFeeForMessageConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, std::option::Option::Some(latest_blockhash.context.slot), ), ) @@ -884,7 +884,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if fee.fee_lamports.is_none() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_fee_unavailable", "lifecycle account-creation fee is unavailable", )); @@ -893,8 +893,8 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let simulation_config = match kb_onchain_transport::SimulateTransactionConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let simulation_config = match ks_onchain_transport::SimulateTransactionConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, false, false, std::option::Option::Some(latest_blockhash.context.slot), @@ -916,8 +916,8 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let simulation = simulation_rpc.to_execution_result( - kb_lib::ExApiExecutionCluster::Devnet, - kb_lib::ExApiExecutionBlockhashKind::Latest, + ks_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionBlockhashKind::Latest, std::option::Option::Some( simulation_rpc.context.slot.saturating_sub(latest_blockhash.context.slot), ), @@ -925,12 +925,12 @@ where std::option::Option::None, std::option::Option::Some(&fee), ); - let send_evaluation = match kb_lib::ExSafetyChecker.evaluate_send(&plan, &simulation) { + let send_evaluation = match ks_lib::ExSafetyChecker.evaluate_send(&plan, &simulation) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if send_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if send_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "execution_send_denied", crate::violation_message(send_evaluation.violations.as_slice()), )); @@ -946,7 +946,7 @@ where return std::result::Result::Err(error); } let signature = signed.primary_signature().clone(); - let send_config = match kb_onchain_transport::SendTransactionConfig::from_execution_config( + let send_config = match ks_onchain_transport::SendTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(latest_blockhash.context.slot), ) { @@ -965,7 +965,7 @@ where return std::result::Result::Err(error); } let confirmation_config = - match kb_onchain_transport::ConfirmTransactionConfig::from_execution_config( + match ks_onchain_transport::ConfirmTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(latest_blockhash.last_valid_block_height), std::option::Option::Some(latest_blockhash.context.slot), @@ -977,7 +977,7 @@ where .confirm_transaction_for_roles( request.transaction_role.as_str(), request.query_role.as_str(), - kb_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionCluster::Devnet, &signature, &confirmation_config, ) @@ -988,10 +988,10 @@ where }; if !matches!( confirmation.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_preparation_unconfirmed", format!("lifecycle {account_role} account creation was not confirmed"), )); @@ -999,14 +999,14 @@ where let data_limit = match usize::try_from(space) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_preparation_space_overflow", "lifecycle account space exceeds usize", )); }, }; let account_config = - match kb_onchain_transport::GetAccountInfoConfig::confirmed_with_data(data_limit) { + match ks_onchain_transport::GetAccountInfoConfig::confirmed_with_data(data_limit) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -1020,20 +1020,20 @@ where let value = match account_info.account { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_preparation_account_missing", format!("confirmed lifecycle {account_role} account is unavailable"), )); }, }; - if value.owner.0 != kb_program_ids::SPL_TOKEN_PROGRAM_ID + if value.owner.0 != ks_program_ids::SPL_TOKEN_PROGRAM_ID || value.executable || value.space != space || value.data.len() != data_limit || value.data.iter().any(|byte| return *byte != 0) || value.lamports < rent_lamports { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_preparation_account_invalid", format!("prepared lifecycle {account_role} account failed exact state validation"), )); @@ -1049,32 +1049,32 @@ where } fn build_account_creation_plan( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, intent_id: std::string::String, - payer: kb_lib::MdPubkey, - new_account: kb_lib::MdPubkey, + payer: ks_lib::MdPubkey, + new_account: ks_lib::MdPubkey, space: u64, rent_lamports: u64, -) -> kb_core::Result { - let intent = kb_lib::ExSolanaCoreExecutionIntent { +) -> ks_core::Result { + let intent = ks_lib::ExSolanaCoreExecutionIntent { intent_id, fee_payer: payer.clone(), - policy: kb_lib::ExApiExecutionPolicy { - cluster: kb_lib::ExApiExecutionClusterPolicy { - expected_cluster: kb_lib::ExApiExecutionCluster::Devnet, + policy: ks_lib::ExApiExecutionPolicy { + cluster: ks_lib::ExApiExecutionClusterPolicy { + expected_cluster: ks_lib::ExApiExecutionCluster::Devnet, allow_mainnet: false, mainnet_confirmation: false, }, - simulation: kb_lib::ExApiExecutionSimulationPolicy::Required, - blockhash: kb_lib::ExApiExecutionBlockhashPolicy { - kind: kb_lib::ExApiExecutionBlockhashKind::Latest, + simulation: ks_lib::ExApiExecutionSimulationPolicy::Required, + blockhash: ks_lib::ExApiExecutionBlockhashPolicy { + kind: ks_lib::ExApiExecutionBlockhashKind::Latest, max_age_slots: std::option::Option::Some( profile.execution.recent_blockhash_max_age_slots, ), nonce_account: std::option::Option::None, nonce_authority: std::option::Option::None, }, - cost_limit: kb_lib::ExApiExecutionCostLimit { + cost_limit: ks_lib::ExApiExecutionCostLimit { max_spend_lamports: std::option::Option::Some( profile.execution.devnet_max_spend_lamports, ), @@ -1085,34 +1085,34 @@ fn build_account_creation_plan( }, authorized_signers: std::vec![payer.clone(), new_account.clone()], dry_run: false, - post_execution_validation: kb_lib::ExApiPostExecutionValidationPolicy { + post_execution_validation: ks_lib::ExApiPostExecutionValidationPolicy { canonical_insert_required: false, core_extraction_required: false, decode_replay_required: false, materialization_required: false, }, }, - operation: kb_lib::ExSolanaCoreOperation::SystemCreateAccount { + operation: ks_lib::ExSolanaCoreOperation::SystemCreateAccount { from: payer, new_account, lamports: rent_lamports, space, - owner: kb_lib::MdPubkey(kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), + owner: ks_lib::MdPubkey(ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), }, }; - return kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan( - &kb_lib::ExSolanaCoreExecutor, + return ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan( + &ks_lib::ExSolanaCoreExecutor, &intent, ); } -fn canonical_amount(amount: &kb_lib::ExSplClassicTokenAmount, field: &str) -> kb_core::Result { +fn canonical_amount(amount: &ks_lib::ExSplClassicTokenAmount, field: &str) -> ks_core::Result { return match amount.0.parse::() { std::result::Result::Ok(value) if value.to_string() == amount.0 => { std::result::Result::Ok(value) }, std::result::Result::Ok(_) | std::result::Result::Err(_) => { - std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_amount_invalid", format!("{field} must be a canonical u64 decimal string"), )) @@ -1122,7 +1122,7 @@ fn canonical_amount(amount: &kb_lib::ExSplClassicTokenAmount, field: &str) -> kb fn lifecycle_operations( request: &crate::DevnetSplTokenLifecycleRequest, -) -> kb_core::Result> { +) -> ks_core::Result> { let mint_amount = match canonical_amount(&request.mint_amount, "mint_amount") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1131,36 +1131,36 @@ fn lifecycle_operations( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let authority = kb_lib::ExSplClassicTokenAuthority { + let authority = ks_lib::ExSplClassicTokenAuthority { authority: request.authority.clone(), multisig_signers: std::vec::Vec::new(), }; let source_burn = mint_amount.saturating_sub(transfer_amount).to_string(); let operations = std::vec![ - kb_lib::ExSplClassicTokenSingleOperation::InitializeMint { + ks_lib::ExSplClassicTokenSingleOperation::InitializeMint { mint: request.mint.clone(), mint_authority: request.authority.clone(), freeze_authority: std::option::Option::Some(request.authority.clone()), decimals: request.decimals, }, - kb_lib::ExSplClassicTokenSingleOperation::InitializeAccount { + ks_lib::ExSplClassicTokenSingleOperation::InitializeAccount { account: request.source.clone(), mint: request.mint.clone(), owner: request.authority.clone(), }, - kb_lib::ExSplClassicTokenSingleOperation::InitializeAccount { + ks_lib::ExSplClassicTokenSingleOperation::InitializeAccount { account: request.destination.clone(), mint: request.mint.clone(), owner: request.authority.clone(), }, - kb_lib::ExSplClassicTokenSingleOperation::MintToChecked { + ks_lib::ExSplClassicTokenSingleOperation::MintToChecked { mint: request.mint.clone(), destination: request.source.clone(), authority: authority.clone(), amount: request.mint_amount.clone(), decimals: request.decimals, }, - kb_lib::ExSplClassicTokenSingleOperation::TransferChecked { + ks_lib::ExSplClassicTokenSingleOperation::TransferChecked { source: request.source.clone(), mint: request.mint.clone(), destination: request.destination.clone(), @@ -1168,7 +1168,7 @@ fn lifecycle_operations( amount: request.transfer_amount.clone(), decimals: request.decimals, }, - kb_lib::ExSplClassicTokenSingleOperation::ApproveChecked { + ks_lib::ExSplClassicTokenSingleOperation::ApproveChecked { source: request.destination.clone(), mint: request.mint.clone(), delegate: request.delegate.clone(), @@ -1176,30 +1176,30 @@ fn lifecycle_operations( amount: request.approve_amount.clone(), decimals: request.decimals, }, - kb_lib::ExSplClassicTokenSingleOperation::Revoke { + ks_lib::ExSplClassicTokenSingleOperation::Revoke { source: request.destination.clone(), authority: authority.clone(), }, - kb_lib::ExSplClassicTokenSingleOperation::BurnChecked { + ks_lib::ExSplClassicTokenSingleOperation::BurnChecked { source: request.source.clone(), mint: request.mint.clone(), authority: authority.clone(), - amount: kb_lib::ExSplClassicTokenAmount(source_burn), + amount: ks_lib::ExSplClassicTokenAmount(source_burn), decimals: request.decimals, }, - kb_lib::ExSplClassicTokenSingleOperation::BurnChecked { + ks_lib::ExSplClassicTokenSingleOperation::BurnChecked { source: request.destination.clone(), mint: request.mint.clone(), authority: authority.clone(), amount: request.transfer_amount.clone(), decimals: request.decimals, }, - kb_lib::ExSplClassicTokenSingleOperation::CloseAccount { + ks_lib::ExSplClassicTokenSingleOperation::CloseAccount { account: request.source.clone(), destination: request.authority.clone(), authority: authority.clone(), }, - kb_lib::ExSplClassicTokenSingleOperation::CloseAccount { + ks_lib::ExSplClassicTokenSingleOperation::CloseAccount { account: request.destination.clone(), destination: request.authority.clone(), authority, @@ -1208,7 +1208,7 @@ fn lifecycle_operations( return std::result::Result::Ok( operations .into_iter() - .map(|value| return kb_lib::ExSplClassicTokenOperation::Instruction { value }) + .map(|value| return ks_lib::ExSplClassicTokenOperation::Instruction { value }) .collect(), ); } @@ -1217,7 +1217,7 @@ fn validated_step( index: usize, operation_code: &str, summary: &crate::DevnetSplTokenExecutionSummary, -) -> kb_core::Result { +) -> ks_core::Result { let send = match summary.send_result.as_ref() { std::option::Option::Some(value) if value.submitted => value, std::option::Option::Some(_) | std::option::Option::None => { @@ -1228,8 +1228,8 @@ fn validated_step( std::option::Option::Some(value) if matches!( value.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) => { value @@ -1276,7 +1276,7 @@ fn validated_step( let materialization_count = match u32::try_from(summary.materializations.len()) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_materializations_overflow", "lifecycle materialization count exceeds u32", )); @@ -1285,7 +1285,7 @@ fn validated_step( let step_index = match u8::try_from(index) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_lifecycle_step_index_overflow", "lifecycle step index exceeds u8", )); @@ -1301,8 +1301,8 @@ fn validated_step( }); } -fn incomplete_step(index: usize, operation_code: &str, stage: &str) -> kb_core::Error { - return kb_core::Error::new( +fn incomplete_step(index: usize, operation_code: &str, stage: &str) -> ks_core::Error { + return ks_core::Error::new( "execution_spl_token_lifecycle_post_validation_incomplete", format!("lifecycle step {index} {operation_code} did not validate {stage}"), ); @@ -1312,8 +1312,8 @@ fn incomplete_step(index: usize, operation_code: &str, stage: &str) -> kb_core:: mod tests { struct LifecycleTestObserver; - impl kb_pipeline::BackfillObserver for LifecycleTestObserver { - fn on_progress(&self, _event: &kb_pipeline::BackfillProgressEvent) { + impl ks_pipeline::BackfillObserver for LifecycleTestObserver { + fn on_progress(&self, _event: &ks_pipeline::BackfillProgressEvent) { return; } @@ -1322,8 +1322,8 @@ mod tests { } } - impl kb_pipeline::CoreExtractionObserver for LifecycleTestObserver { - fn on_progress(&self, _event: &kb_pipeline::CoreExtractionProgressEvent) { + impl ks_pipeline::CoreExtractionObserver for LifecycleTestObserver { + fn on_progress(&self, _event: &ks_pipeline::CoreExtractionProgressEvent) { return; } @@ -1332,8 +1332,8 @@ mod tests { } } - impl kb_pipeline::DecodeReplayObserver for LifecycleTestObserver { - fn on_progress(&self, _event: &kb_pipeline::DecodeReplayProgressEvent) { + impl ks_pipeline::DecodeReplayObserver for LifecycleTestObserver { + fn on_progress(&self, _event: &ks_pipeline::DecodeReplayProgressEvent) { return; } @@ -1359,18 +1359,18 @@ mod tests { } } - fn key(value: &str) -> kb_lib::MdPubkey { - return kb_lib::MdPubkey(value.to_string()); + fn key(value: &str) -> ks_lib::MdPubkey { + return ks_lib::MdPubkey(value.to_string()); } fn request() -> crate::DevnetSplTokenLifecycleRequest { return crate::DevnetSplTokenLifecycleRequest::new( "lifecycle-1", - key(kb_program_ids::STAKE_PROGRAM_ID), - key(kb_program_ids::VOTE_PROGRAM_ID), - key(kb_program_ids::CONFIG_PROGRAM_ID), - key(kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID), - key(kb_program_ids::SYSTEM_PROGRAM_ID), + key(ks_program_ids::STAKE_PROGRAM_ID), + key(ks_program_ids::VOTE_PROGRAM_ID), + key(ks_program_ids::CONFIG_PROGRAM_ID), + key(ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID), + key(ks_program_ids::SYSTEM_PROGRAM_ID), ); } @@ -1410,8 +1410,8 @@ mod tests { ], ); let source_burn = match &operations[7] { - kb_lib::ExSplClassicTokenOperation::Instruction { - value: kb_lib::ExSplClassicTokenSingleOperation::BurnChecked { amount, .. }, + ks_lib::ExSplClassicTokenOperation::Instruction { + value: ks_lib::ExSplClassicTokenSingleOperation::BurnChecked { amount, .. }, } => amount.0.as_str(), _ => panic!("source burn step missing"), }; @@ -1421,14 +1421,14 @@ mod tests { #[test] fn invalid_amounts_aliases_and_delegate_fail_closed() { let mut request = request(); - request.transfer_amount = kb_lib::ExSplClassicTokenAmount("10".to_string()); + request.transfer_amount = ks_lib::ExSplClassicTokenAmount("10".to_string()); assert!(request.validate().is_err()); - request.transfer_amount = kb_lib::ExSplClassicTokenAmount("04".to_string()); + request.transfer_amount = ks_lib::ExSplClassicTokenAmount("04".to_string()); assert!(request.validate().is_err()); - request.transfer_amount = kb_lib::ExSplClassicTokenAmount("4".to_string()); + request.transfer_amount = ks_lib::ExSplClassicTokenAmount("4".to_string()); request.delegate = request.authority.clone(); assert!(request.validate().is_err()); - request.delegate = key(kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID); + request.delegate = key(ks_program_ids::COMPUTE_BUDGET_PROGRAM_ID); request.destination = request.source.clone(); assert!(request.validate().is_err()); } @@ -1446,8 +1446,8 @@ mod tests { #[test] fn account_creation_plan_uses_exact_token_owner_space_spend_and_signers() { let profile = example_devnet_profile(); - let payer = key(kb_program_ids::SYSTEM_PROGRAM_ID); - let account = key(kb_program_ids::STAKE_PROGRAM_ID); + let payer = key(ks_program_ids::SYSTEM_PROGRAM_ID); + let account = key(ks_program_ids::STAKE_PROGRAM_ID); let plan = match super::build_account_creation_plan( &profile, "prepare-mint".to_string(), @@ -1475,7 +1475,7 @@ mod tests { let mut request = request(); request.first_step_index = 3; assert!(request.validate().is_err()); - request.resume_predecessor_signature = std::option::Option::Some(kb_lib::MdSignature( + request.resume_predecessor_signature = std::option::Option::Some(ks_lib::MdSignature( "3yxsCf8tc1H2P9E3m6Kgu7J3XVeBw7wePuRTHvCaidQ74bsa2TP5xg4hpXAw1jkRSB3LrkLrXgx5eqvCQqRsXcfq".to_string(), )); assert!(request.validate().is_ok()); @@ -1522,11 +1522,11 @@ mod tests { }; profile.database.backend = "postgres".to_string(); profile.database.postgres.url = database_url; - let pool = match kb_onchain_transport::HttpEndpointPool::from_profile(&profile) { + let pool = match ks_onchain_transport::HttpEndpointPool::from_profile(&profile) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("HTTP pool creation failed: {error}"), }; - let store_options = match kb_store::PostgresStoreOptions::new( + let store_options = match ks_store::PostgresStoreOptions::new( profile.database.postgres.url.clone(), profile.database.postgres.max_connections, profile.database.postgres.connect_timeout_ms, @@ -1535,7 +1535,7 @@ mod tests { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("PostgreSQL options failed: {error}"), }; - let store = match kb_store::PostgresStore::connect(store_options).await { + let store = match ks_store::PostgresStore::connect(store_options).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("PostgreSQL connection failed: {error}"), }; @@ -1619,15 +1619,15 @@ mod tests { authority, ); request.decimals = optional_u8_env("KB_DEVNET_SPL_TOKEN_LIFECYCLE_DECIMALS", 9); - request.mint_amount = kb_lib::ExSplClassicTokenAmount(optional_string_env( + request.mint_amount = ks_lib::ExSplClassicTokenAmount(optional_string_env( "KB_DEVNET_SPL_TOKEN_LIFECYCLE_MINT_AMOUNT", "10", )); - request.transfer_amount = kb_lib::ExSplClassicTokenAmount(optional_string_env( + request.transfer_amount = ks_lib::ExSplClassicTokenAmount(optional_string_env( "KB_DEVNET_SPL_TOKEN_LIFECYCLE_TRANSFER_AMOUNT", "4", )); - request.approve_amount = kb_lib::ExSplClassicTokenAmount(optional_string_env( + request.approve_amount = ks_lib::ExSplClassicTokenAmount(optional_string_env( "KB_DEVNET_SPL_TOKEN_LIFECYCLE_APPROVE_AMOUNT", "2", )); @@ -1637,7 +1637,7 @@ mod tests { request.first_step_index = optional_u8_env("KB_DEVNET_SPL_TOKEN_LIFECYCLE_FIRST_STEP_INDEX", 0); request.resume_predecessor_signature = if request.first_step_index > 0 { - std::option::Option::Some(kb_lib::MdSignature(required_string_env( + std::option::Option::Some(ks_lib::MdSignature(required_string_env( "KB_DEVNET_SPL_TOKEN_LIFECYCLE_RESUME_PREDECESSOR_SIGNATURE", ))) } else { @@ -1645,10 +1645,10 @@ mod tests { }; request.inter_step_delay_ms = optional_u64_env("KB_DEVNET_SPL_TOKEN_LIFECYCLE_INTER_STEP_DELAY_MS", 2_000); - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcSplTokenDecoder)]; - let materializers: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::MtTokenAccountsMaterializer,)]; + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcSplTokenDecoder)]; + let materializers: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::MtTokenAccountsMaterializer,)]; let summary = match crate::execute_devnet_spl_token_lifecycle( &pool, &store, @@ -1686,8 +1686,8 @@ mod tests { } } - fn example_devnet_profile() -> kb_config::ProfileConfig { - let config = match kb_config::parse_config_json(include_str!( + fn example_devnet_profile() -> ks_config::ProfileConfig { + let config = match ks_config::parse_config_json(include_str!( "../../../../config/example.config.json" )) { std::result::Result::Ok(value) => value, @@ -1699,9 +1699,9 @@ mod tests { }; } - fn required_pubkey_env(name: &str) -> kb_lib::MdPubkey { + fn required_pubkey_env(name: &str) -> ks_lib::MdPubkey { return match std::env::var(name) { - std::result::Result::Ok(value) => kb_lib::MdPubkey(value), + std::result::Result::Ok(value) => ks_lib::MdPubkey(value), std::result::Result::Err(error) => panic!("{name} is required: {error}"), }; } diff --git a/kb-pipeline-demo-scenarios/src/spl/token_2022.rs b/ks-pipeline-demo-scenarios/src/spl/token_2022.rs similarity index 73% rename from kb-pipeline-demo-scenarios/src/spl/token_2022.rs rename to ks-pipeline-demo-scenarios/src/spl/token_2022.rs index ec46e47..8671886 100644 --- a/kb-pipeline-demo-scenarios/src/spl/token_2022.rs +++ b/ks-pipeline-demo-scenarios/src/spl/token_2022.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/spl/token_2022.rs -// version: 1 +// file: ks-pipeline-demo-scenarios/src/spl/token_2022.rs +// version: 2 //! SPL Token-2022 demo and Devnet validation scenarios. diff --git a/kb-pipeline-demo-scenarios/src/spl/token_2022/devnet_execution.rs b/ks-pipeline-demo-scenarios/src/spl/token_2022/devnet_execution.rs similarity index 79% rename from kb-pipeline-demo-scenarios/src/spl/token_2022/devnet_execution.rs rename to ks-pipeline-demo-scenarios/src/spl/token_2022/devnet_execution.rs index 25695e7..63f69cb 100644 --- a/kb-pipeline-demo-scenarios/src/spl/token_2022/devnet_execution.rs +++ b/ks-pipeline-demo-scenarios/src/spl/token_2022/devnet_execution.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/spl/token_2022/devnet_execution.rs -// version: 7 +// file: ks-pipeline-demo-scenarios/src/spl/token_2022/devnet_execution.rs +// version: 8 //! Devnet Token-2022 execution with stateful and canonical post-validation. @@ -13,7 +13,7 @@ pub struct DevnetSplToken2022ExecutionRequest { /// Endpoint role used for simulation, submission and confirmation polling. pub transaction_role: std::string::String, /// Exact typed Token-2022 operation. - pub operation: kb_lib::ExSplToken2022Operation, + pub operation: ks_lib::ExSplToken2022Operation, /// Explicitly authorizes signing and submission after successful simulation. pub submit: bool, /// Explicit operator confirmation required by the active profile. @@ -28,7 +28,7 @@ impl crate::DevnetSplToken2022ExecutionRequest { /// Creates a conservative simulation-only request. pub fn new( intent_id: impl std::convert::Into, - operation: kb_lib::ExSplToken2022Operation, + operation: ks_lib::ExSplToken2022Operation, ) -> Self { return Self { intent_id: intent_id.into(), @@ -43,19 +43,19 @@ impl crate::DevnetSplToken2022ExecutionRequest { } /// Validates request-local bounds independently from one profile. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.intent_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet Token-2022 execution intent id must not be empty", )); } if self.query_role.trim().is_empty() || self.transaction_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet Token-2022 execution endpoint roles must not be empty", )); } if self.post_validation_max_retries > 20 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "post-execution getTransaction retries must not exceed 20", )); } @@ -69,61 +69,61 @@ pub struct DevnetSplToken2022ExecutionSummary { /// Profile used by the orchestration. pub profile_name: std::string::String, /// Exact classified cluster. - pub cluster: kb_lib::ExApiExecutionCluster, + pub cluster: ks_lib::ExApiExecutionCluster, /// Genesis hash returned by the selected endpoint. pub genesis_hash: std::string::String, /// Non-secret persistent wallet description. - pub wallet: kb_wallet::WalletSummary, + pub wallet: ks_wallet::WalletSummary, /// Wallet balance observed before planning. pub balance_lamports: u64, /// Stateful readiness report produced before plan simulation. - pub stateful_preflight: kb_pipeline::Token2022PreflightReport, + pub stateful_preflight: ks_pipeline::Token2022PreflightReport, /// Exact prepared Token plan. - pub plan: kb_lib::ExApiPreparedExecutionPlan, + pub plan: ks_lib::ExApiPreparedExecutionPlan, /// Recent blockhash used by the exact transaction. - pub latest_blockhash: kb_onchain_transport::LatestBlockhashResult, + pub latest_blockhash: ks_onchain_transport::LatestBlockhashResult, /// Fee estimate for the exact compiled message. - pub fee: kb_onchain_transport::FeeForMessageResult, + pub fee: ks_onchain_transport::FeeForMessageResult, /// Exact simulation result bound to the compiled message. - pub simulation: kb_lib::ExApiExecutionSimulationResult, + pub simulation: ks_lib::ExApiExecutionSimulationResult, /// Submission result when explicitly authorized. - pub send_result: std::option::Option, + pub send_result: std::option::Option, /// Confirmation result when submitted. - pub confirmation: std::option::Option, + pub confirmation: std::option::Option, /// Canonical hydration result for the exact signature. - pub backfill: std::option::Option, + pub backfill: std::option::Option, /// Core extraction result for the exact signature. - pub core_extraction: std::option::Option, + pub core_extraction: std::option::Option, /// First Token decode and materialization replay. - pub decode_replay: std::option::Option, + pub decode_replay: std::option::Option, /// Second replay proving idempotence for the same decoder version and input. - pub idempotence_replay: std::option::Option, + pub idempotence_replay: std::option::Option, /// Exact materialized rows produced for the submitted Token transaction. - pub materializations: std::vec::Vec, + pub materializations: std::vec::Vec, /// Aggregated post-execution validation diagnostic. - pub post_execution: std::option::Option, + pub post_execution: std::option::Option, } struct PreparedToken2022Execution { - wallet: kb_wallet::TemporaryWallet, - unsigned: kb_lib::ExSolanaUnsignedTransaction, - evidence: kb_lib::ExSolanaSimulationEvidence, + wallet: ks_wallet::TemporaryWallet, + unsigned: ks_lib::ExSolanaUnsignedTransaction, + evidence: ks_lib::ExSolanaSimulationEvidence, summary: crate::DevnetSplToken2022ExecutionSummary, } /// Simulates one Devnet Token-2022 operation after stateful preflight. pub async fn simulate_devnet_spl_token_2022( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetSplToken2022ExecutionRequest, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where O: crate::SolanaExecutionObserver, { if request.submit { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "simulate_devnet_spl_token_2022 requires submit=false", )); } @@ -138,19 +138,19 @@ where /// Executes one Devnet Token-2022 simulation or authorized submission. #[allow(clippy::too_many_arguments)] pub async fn execute_devnet_spl_token_2022( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetSplToken2022ExecutionRequest, - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { @@ -163,7 +163,7 @@ where return std::result::Result::Ok(prepared.summary); } if !prepared.summary.simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_simulation_failed", crate::simulation_failure_message(&prepared.summary.simulation), )); @@ -174,14 +174,14 @@ where ) { return std::result::Result::Err(error); } - let send_evaluation = match kb_lib::ExSafetyChecker + let send_evaluation = match ks_lib::ExSafetyChecker .evaluate_send(&prepared.summary.plan, &prepared.summary.simulation) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if send_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if send_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "execution_send_denied", crate::violation_message(send_evaluation.violations.as_slice()), )); @@ -198,7 +198,7 @@ where } let signature = signed.primary_signature().clone(); let mut summary = prepared.summary; - let mut diagnostic = kb_lib::ExApiPostExecutionDiagnostic { + let mut diagnostic = ks_lib::ExApiPostExecutionDiagnostic { signature: signature.clone(), canonical_inserted: false, core_extracted: false, @@ -206,7 +206,7 @@ where materialized: false, diagnostics: std::vec::Vec::new(), }; - let send_config = match kb_onchain_transport::SendTransactionConfig::from_execution_config( + let send_config = match ks_onchain_transport::SendTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(summary.latest_blockhash.context.slot), ) { @@ -230,9 +230,9 @@ where }, }; summary.send_result = - std::option::Option::Some(sent.to_execution_result(kb_lib::ExApiExecutionCluster::Devnet)); + std::option::Option::Some(sent.to_execution_result(ks_lib::ExApiExecutionCluster::Devnet)); let confirmation_config = - match kb_onchain_transport::ConfirmTransactionConfig::from_execution_config( + match ks_onchain_transport::ConfirmTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(summary.latest_blockhash.last_valid_block_height), std::option::Option::Some(summary.latest_blockhash.context.slot), @@ -244,7 +244,7 @@ where .confirm_transaction_for_roles( request.transaction_role.as_str(), request.query_role.as_str(), - kb_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionCluster::Devnet, &signature, &confirmation_config, ) @@ -261,8 +261,8 @@ where summary.confirmation = std::option::Option::Some(confirmation); if !matches!( confirmation_status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) { diagnostic.diagnostics.push(format!( "Token-2022 post-validation stopped at confirmation status {confirmation_status:?}" @@ -297,10 +297,10 @@ where summary.post_execution = std::option::Option::Some(diagnostic); return std::result::Result::Ok(summary); } - let extraction = match kb_pipeline::execute_core_extraction( + let extraction = match ks_pipeline::execute_core_extraction( store, - &kb_pipeline::CoreExtractionRequest { - source: kb_pipeline::CoreExtractionSource::Signatures(std::vec![signature.0.clone()]), + &ks_pipeline::CoreExtractionRequest { + source: ks_pipeline::CoreExtractionSource::Signatures(std::vec![signature.0.clone()]), limit: 1, max_concurrent_extractions: 1, force_replay: request.force_post_validation_replay, @@ -335,7 +335,7 @@ where &signature, false, request.force_post_validation_replay, - &[kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID], + &[ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID], decoders, materializers, observer, @@ -351,7 +351,7 @@ where }; diagnostic.decode_replayed = crate::decode_completed(&first_replay); summary.decode_replay = std::option::Option::Some(first_replay); - let filter = match kb_store::MaterializedEventFilter::new( + let filter = match ks_store::MaterializedEventFilter::new( std::option::Option::None, std::option::Option::None, std::option::Option::Some(signature.0.clone()), @@ -360,7 +360,7 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let rows = match kb_store::DecodePipelineStore::list_materialized_events(store, &filter).await { + let rows = match ks_store::DecodePipelineStore::list_materialized_events(store, &filter).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { diagnostic @@ -382,7 +382,7 @@ where &signature, true, request.force_post_validation_replay, - &[kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID], + &[ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID], decoders, materializers, observer, @@ -426,12 +426,12 @@ where } async fn prepare_execution( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, request: &crate::DevnetSplToken2022ExecutionRequest, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where O: crate::SolanaExecutionObserver, { @@ -450,9 +450,9 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if genesis.classified_cluster - != std::option::Option::Some(kb_lib::ExApiExecutionCluster::Devnet) + != std::option::Option::Some(ks_lib::ExApiExecutionCluster::Devnet) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_cluster_mismatch", format!( "expected Devnet genesis hash but endpoint returned {} classified as {:?}", @@ -465,7 +465,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let readiness = - match kb_pipeline::inspect_token_2022_preflight(http_pool, &preflight_request).await { + match ks_pipeline::inspect_token_2022_preflight(http_pool, &preflight_request).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -474,12 +474,12 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let wallet_summary = wallet.summary(); - let fee_payer = kb_lib::MdPubkey(wallet_summary.public_key.clone()); + let fee_payer = ks_lib::MdPubkey(wallet_summary.public_key.clone()); let balance = match http_pool .get_balance_for_role( request.query_role.as_str(), &fee_payer, - &kb_onchain_transport::GetBalanceConfig::confirmed(), + &ks_onchain_transport::GetBalanceConfig::confirmed(), ) .await { @@ -487,7 +487,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if balance.lamports < profile.execution.max_fee_lamports { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_balance_insufficient", format!( "Devnet wallet balance {} is below the configured fee ceiling {}", @@ -499,12 +499,12 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let plan_evaluation = match kb_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { + let plan_evaluation = match ks_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if plan_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if plan_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "execution_plan_denied", crate::violation_message(plan_evaluation.violations.as_slice()), )); @@ -512,14 +512,14 @@ where let latest_blockhash = match http_pool .get_latest_blockhash_for_role( request.query_role.as_str(), - &kb_onchain_transport::GetLatestBlockhashConfig::confirmed(), + &ks_onchain_transport::GetLatestBlockhashConfig::confirmed(), ) .await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let unsigned = match kb_lib::executor_solana_build_legacy_transaction( + let unsigned = match ks_lib::executor_solana_build_legacy_transaction( &plan, latest_blockhash.blockhash.as_str(), ) { @@ -530,8 +530,8 @@ where .get_fee_for_message_for_role( request.query_role.as_str(), unsigned.message_base64().as_str(), - &kb_onchain_transport::GetFeeForMessageConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + &ks_onchain_transport::GetFeeForMessageConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, std::option::Option::Some(latest_blockhash.context.slot), ), ) @@ -541,7 +541,7 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; if fee.fee_lamports.is_none() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_fee_unavailable", "getFeeForMessage returned null for the selected recent blockhash", )); @@ -550,8 +550,8 @@ where std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let simulation_config = match kb_onchain_transport::SimulateTransactionConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let simulation_config = match ks_onchain_transport::SimulateTransactionConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, false, false, std::option::Option::Some(latest_blockhash.context.slot), @@ -580,8 +580,8 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let simulation = simulation_rpc.to_execution_result( - kb_lib::ExApiExecutionCluster::Devnet, - kb_lib::ExApiExecutionBlockhashKind::Latest, + ks_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionBlockhashKind::Latest, std::option::Option::Some( simulation_rpc.context.slot.saturating_sub(latest_blockhash.context.slot), ), @@ -592,7 +592,7 @@ where let evidence = unsigned.bind_simulation(simulation.clone()); let summary = crate::DevnetSplToken2022ExecutionSummary { profile_name: profile.name.clone(), - cluster: kb_lib::ExApiExecutionCluster::Devnet, + cluster: ks_lib::ExApiExecutionCluster::Devnet, genesis_hash: genesis.genesis_hash, wallet: wallet_summary, balance_lamports: balance.lamports, @@ -620,11 +620,11 @@ where fn preflight_request( request: &crate::DevnetSplToken2022ExecutionRequest, -) -> kb_core::Result { +) -> ks_core::Result { let operation = match &request.operation { - kb_lib::ExSplToken2022Operation::Instruction { value } => value.as_ref(), - kb_lib::ExSplToken2022Operation::Batch { instructions: _ } => { - return std::result::Result::Err(kb_core::Error::new( + ks_lib::ExSplToken2022Operation::Instruction { value } => value.as_ref(), + ks_lib::ExSplToken2022Operation::Batch { instructions: _ } => { + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_batch_not_supported", "Devnet Token-2022 validation scenarios require one non-batch operation", )); @@ -632,7 +632,7 @@ fn preflight_request( }; let mut requirements = std::vec::Vec::new(); match operation { - kb_lib::ExSplTokenSingleOperation::MintToChecked { + ks_lib::ExSplTokenSingleOperation::MintToChecked { mint, destination, authority, @@ -650,7 +650,7 @@ fn preflight_request( return std::result::Result::Err(error); } }, - kb_lib::ExSplTokenSingleOperation::TransferChecked { + ks_lib::ExSplTokenSingleOperation::TransferChecked { source, mint, destination, @@ -675,7 +675,7 @@ fn preflight_request( return std::result::Result::Err(error); } }, - kb_lib::ExSplTokenSingleOperation::ApproveChecked { + ks_lib::ExSplTokenSingleOperation::ApproveChecked { source, mint, delegate: _, @@ -694,11 +694,11 @@ fn preflight_request( return std::result::Result::Err(error); } }, - kb_lib::ExSplTokenSingleOperation::Revoke { source, authority } => { + ks_lib::ExSplTokenSingleOperation::Revoke { source, authority } => { requirements.push(account_requirement( "source", source, - &kb_lib::MdPubkey(std::string::String::new()), + &ks_lib::MdPubkey(std::string::String::new()), std::option::Option::Some(authority.authority.clone()), )); requirements[0].expected_mint = std::option::Option::None; @@ -706,7 +706,7 @@ fn preflight_request( return std::result::Result::Err(error); } }, - kb_lib::ExSplTokenSingleOperation::BurnChecked { + ks_lib::ExSplTokenSingleOperation::BurnChecked { source, mint, authority, @@ -724,8 +724,8 @@ fn preflight_request( return std::result::Result::Err(error); } }, - kb_lib::ExSplTokenSingleOperation::FreezeAccount { account, mint, authority } - | kb_lib::ExSplTokenSingleOperation::ThawAccount { account, mint, authority } => { + ks_lib::ExSplTokenSingleOperation::FreezeAccount { account, mint, authority } + | ks_lib::ExSplTokenSingleOperation::ThawAccount { account, mint, authority } => { requirements.push(account_requirement( "account", account, @@ -737,11 +737,11 @@ fn preflight_request( return std::result::Result::Err(error); } }, - kb_lib::ExSplTokenSingleOperation::CloseAccount { account, destination: _, authority } => { + ks_lib::ExSplTokenSingleOperation::CloseAccount { account, destination: _, authority } => { requirements.push(account_requirement( "account", account, - &kb_lib::MdPubkey(std::string::String::new()), + &ks_lib::MdPubkey(std::string::String::new()), std::option::Option::Some(authority.authority.clone()), )); requirements[0].expected_mint = std::option::Option::None; @@ -749,7 +749,7 @@ fn preflight_request( return std::result::Result::Err(error); } }, - kb_lib::ExSplTokenSingleOperation::InitializeTokenMetadata { + ks_lib::ExSplTokenSingleOperation::InitializeTokenMetadata { metadata, update_authority: _, mint, @@ -759,35 +759,35 @@ fn preflight_request( uri: _, } => { if metadata != mint { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_metadata_mint_mismatch", "Token Metadata Initialize on Token-2022 requires metadata and mint to be the same account", )); } requirements.push(metadata_mint_requirement("metadata", metadata, "metadata_pointer")); }, - kb_lib::ExSplTokenSingleOperation::UpdateTokenMetadataField { + ks_lib::ExSplTokenSingleOperation::UpdateTokenMetadataField { metadata, update_authority: _, field: _, value: _, } - | kb_lib::ExSplTokenSingleOperation::RemoveTokenMetadataKey { + | ks_lib::ExSplTokenSingleOperation::RemoveTokenMetadataKey { metadata, update_authority: _, key: _, idempotent: _, } - | kb_lib::ExSplTokenSingleOperation::UpdateTokenMetadataAuthority { + | ks_lib::ExSplTokenSingleOperation::UpdateTokenMetadataAuthority { metadata, current_authority: _, new_authority: _, } - | kb_lib::ExSplTokenSingleOperation::EmitTokenMetadata { metadata, start: _, end: _ } => { + | ks_lib::ExSplTokenSingleOperation::EmitTokenMetadata { metadata, start: _, end: _ } => { requirements.push(metadata_mint_requirement("metadata", metadata, "token_metadata")); }, _ => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_devnet_operation_unsupported", format!( "Token-2022 Devnet validation does not expose {}", @@ -796,19 +796,19 @@ fn preflight_request( )); }, } - return std::result::Result::Ok(kb_pipeline::Token2022PreflightRequest { + return std::result::Result::Ok(ks_pipeline::Token2022PreflightRequest { query_role: request.query_role.clone(), min_context_slot: std::option::Option::None, - max_accounts: kb_pipeline::MAX_TOKEN_2022_PREFLIGHT_ACCOUNTS, - max_total_data_bytes: kb_pipeline::MAX_TOKEN_2022_PREFLIGHT_TOTAL_BYTES, + max_accounts: ks_pipeline::MAX_TOKEN_2022_PREFLIGHT_ACCOUNTS, + max_total_data_bytes: ks_pipeline::MAX_TOKEN_2022_PREFLIGHT_TOTAL_BYTES, requirements, elgamal_registry: std::option::Option::None, }); } -fn validate_single_authority(authority: &kb_lib::ExSplTokenAuthority) -> kb_core::Result<()> { +fn validate_single_authority(authority: &ks_lib::ExSplTokenAuthority) -> ks_core::Result<()> { if !authority.multisig_signers.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_devnet_multisig_not_supported", "the Devnet validation UI currently supports one profile-wallet authority", )); @@ -818,27 +818,27 @@ fn validate_single_authority(authority: &kb_lib::ExSplTokenAuthority) -> kb_core fn mint_requirement( role: &str, - mint: &kb_lib::MdPubkey, + mint: &ks_lib::MdPubkey, decimals: std::option::Option, -) -> kb_pipeline::Token2022PreflightRequirement { - return kb_pipeline::Token2022PreflightRequirement { +) -> ks_pipeline::Token2022PreflightRequirement { + return ks_pipeline::Token2022PreflightRequirement { role: role.to_string(), account: mint.clone(), - kind: kb_lib::DcToken2022StateKind::Mint, + kind: ks_lib::DcToken2022StateKind::Mint, max_data_bytes: 65_536, expected_mint: std::option::Option::None, expected_owner: std::option::Option::None, expected_decimals: decimals, required_extensions: std::vec::Vec::new(), - context: kb_pipeline::Token2022StatefulContext::default(), + context: ks_pipeline::Token2022StatefulContext::default(), }; } fn metadata_mint_requirement( role: &str, - mint: &kb_lib::MdPubkey, + mint: &ks_lib::MdPubkey, required_extension: &str, -) -> kb_pipeline::Token2022PreflightRequirement { +) -> ks_pipeline::Token2022PreflightRequirement { let mut requirement = mint_requirement(role, mint, std::option::Option::None); requirement.required_extensions = std::vec![required_extension.to_string()]; return requirement; @@ -846,44 +846,44 @@ fn metadata_mint_requirement( fn account_requirement( role: &str, - account: &kb_lib::MdPubkey, - mint: &kb_lib::MdPubkey, - owner: std::option::Option, -) -> kb_pipeline::Token2022PreflightRequirement { - return kb_pipeline::Token2022PreflightRequirement { + account: &ks_lib::MdPubkey, + mint: &ks_lib::MdPubkey, + owner: std::option::Option, +) -> ks_pipeline::Token2022PreflightRequirement { + return ks_pipeline::Token2022PreflightRequirement { role: role.to_string(), account: account.clone(), - kind: kb_lib::DcToken2022StateKind::Account, + kind: ks_lib::DcToken2022StateKind::Account, max_data_bytes: 65_536, expected_mint: std::option::Option::Some(mint.clone()), expected_owner: owner, expected_decimals: std::option::Option::None, required_extensions: std::vec::Vec::new(), - context: kb_pipeline::Token2022StatefulContext::default(), + context: ks_pipeline::Token2022StatefulContext::default(), }; } fn validate_profile( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, request: &crate::DevnetSplToken2022ExecutionRequest, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if profile.wallet.cluster != "devnet" { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 Devnet orchestration requires a Devnet wallet profile", )); } if !profile.wallet.temporary_wallet_enabled || !profile.wallet.temporary_wallet_persist { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 Devnet orchestration requires an enabled persistent temporary wallet", )); } if !profile.execution.require_simulation { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 Devnet orchestration requires simulation", )); } if request.submit && !profile.wallet.devnet_send_enabled { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Devnet transaction submission is disabled by the wallet profile", )); } @@ -891,7 +891,7 @@ fn validate_profile( && profile.execution.require_operator_confirmation && !request.operator_confirmed { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 Devnet submission requires explicit operator confirmation", )); } @@ -899,31 +899,31 @@ fn validate_profile( } fn build_plan( - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, request: &crate::DevnetSplToken2022ExecutionRequest, - fee_payer: kb_lib::MdPubkey, -) -> kb_core::Result { + fee_payer: ks_lib::MdPubkey, +) -> ks_core::Result { let materialization_required = operation_requires_materialization(&request.operation); let authorized_signers = std::vec![fee_payer.clone()]; - let intent = kb_lib::ExSplToken2022ExecutionIntent { + let intent = ks_lib::ExSplToken2022ExecutionIntent { intent_id: request.intent_id.clone(), fee_payer, - policy: kb_lib::ExApiExecutionPolicy { - cluster: kb_lib::ExApiExecutionClusterPolicy { - expected_cluster: kb_lib::ExApiExecutionCluster::Devnet, + policy: ks_lib::ExApiExecutionPolicy { + cluster: ks_lib::ExApiExecutionClusterPolicy { + expected_cluster: ks_lib::ExApiExecutionCluster::Devnet, allow_mainnet: false, mainnet_confirmation: false, }, - simulation: kb_lib::ExApiExecutionSimulationPolicy::Required, - blockhash: kb_lib::ExApiExecutionBlockhashPolicy { - kind: kb_lib::ExApiExecutionBlockhashKind::Latest, + simulation: ks_lib::ExApiExecutionSimulationPolicy::Required, + blockhash: ks_lib::ExApiExecutionBlockhashPolicy { + kind: ks_lib::ExApiExecutionBlockhashKind::Latest, max_age_slots: std::option::Option::Some( profile.execution.recent_blockhash_max_age_slots, ), nonce_account: std::option::Option::None, nonce_authority: std::option::Option::None, }, - cost_limit: kb_lib::ExApiExecutionCostLimit { + cost_limit: ks_lib::ExApiExecutionCostLimit { max_spend_lamports: std::option::Option::Some( profile.execution.devnet_max_spend_lamports, ), @@ -934,7 +934,7 @@ fn build_plan( }, authorized_signers, dry_run: !request.submit, - post_execution_validation: kb_lib::ExApiPostExecutionValidationPolicy { + post_execution_validation: ks_lib::ExApiPostExecutionValidationPolicy { canonical_insert_required: true, core_extraction_required: true, decode_replay_required: true, @@ -943,26 +943,26 @@ fn build_plan( }, operation: request.operation.clone(), }; - return kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan( - &kb_lib::ExSplToken2022Executor, + return ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan( + &ks_lib::ExSplToken2022Executor, &intent, ); } -fn operation_requires_materialization(operation: &kb_lib::ExSplToken2022Operation) -> bool { +fn operation_requires_materialization(operation: &ks_lib::ExSplToken2022Operation) -> bool { return !matches!( operation, - kb_lib::ExSplToken2022Operation::Instruction { value } - if matches!(value.as_ref(), kb_lib::ExSplTokenSingleOperation::EmitTokenMetadata { .. }) + ks_lib::ExSplToken2022Operation::Instruction { value } + if matches!(value.as_ref(), ks_lib::ExSplTokenSingleOperation::EmitTokenMetadata { .. }) ); } fn validate_profile_wallet_signers( required_signers: &[std::string::String], wallet_pubkey: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if required_signers.iter().any(|value| return value.as_str() != wallet_pubkey) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_spl_token_2022_external_signer_unavailable", format!( "the Devnet Token orchestrator can sign only with profile wallet {}; required signers are {}", @@ -976,23 +976,23 @@ fn validate_profile_wallet_signers( #[cfg(test)] mod tests { - fn pubkey(byte: u8) -> kb_lib::MdPubkey { - return kb_lib::MdPubkey(bs58::encode([byte; 32]).into_string()); + fn pubkey(byte: u8) -> ks_lib::MdPubkey { + return ks_lib::MdPubkey(bs58::encode([byte; 32]).into_string()); } fn request( - operation: kb_lib::ExSplTokenSingleOperation, + operation: ks_lib::ExSplTokenSingleOperation, ) -> crate::DevnetSplToken2022ExecutionRequest { return crate::DevnetSplToken2022ExecutionRequest::new( "metadata-preflight-test", - kb_lib::ExSplToken2022Operation::Instruction { value: std::boxed::Box::new(operation) }, + ks_lib::ExSplToken2022Operation::Instruction { value: std::boxed::Box::new(operation) }, ); } #[test] fn metadata_preflight_requires_pointer_before_initialize_and_metadata_afterward() { let mint = pubkey(1); - let initialize = request(kb_lib::ExSplTokenSingleOperation::InitializeTokenMetadata { + let initialize = request(ks_lib::ExSplTokenSingleOperation::InitializeTokenMetadata { metadata: mint.clone(), update_authority: pubkey(2), mint: mint.clone(), @@ -1007,10 +1007,10 @@ mod tests { initialize_preflight.requirements[0].required_extensions, vec!["metadata_pointer".to_string()] ); - let update = request(kb_lib::ExSplTokenSingleOperation::UpdateTokenMetadataField { + let update = request(ks_lib::ExSplTokenSingleOperation::UpdateTokenMetadataField { metadata: mint, update_authority: pubkey(2), - field: kb_lib::ExSplTokenMetadataField::Key("campaign".to_string()), + field: ks_lib::ExSplTokenMetadataField::Key("campaign".to_string()), value: "0.4.8-pre.012".to_string(), }); let update_preflight = @@ -1023,7 +1023,7 @@ mod tests { #[test] fn metadata_initialize_rejects_external_metadata_account_and_emit_skips_materialization() { - let invalid = request(kb_lib::ExSplTokenSingleOperation::InitializeTokenMetadata { + let invalid = request(ks_lib::ExSplTokenSingleOperation::InitializeTokenMetadata { metadata: pubkey(1), update_authority: pubkey(2), mint: pubkey(3), @@ -1033,8 +1033,8 @@ mod tests { uri: "https://example.invalid/token.json".to_string(), }); assert!(super::preflight_request(&invalid).is_err()); - let emit = kb_lib::ExSplToken2022Operation::Instruction { - value: std::boxed::Box::new(kb_lib::ExSplTokenSingleOperation::EmitTokenMetadata { + let emit = ks_lib::ExSplToken2022Operation::Instruction { + value: std::boxed::Box::new(ks_lib::ExSplTokenSingleOperation::EmitTokenMetadata { metadata: pubkey(1), start: std::option::Option::None, end: std::option::Option::None, diff --git a/kb-pipeline-demo-scenarios/src/spl/token_2022/devnet_scenarios.rs b/ks-pipeline-demo-scenarios/src/spl/token_2022/devnet_scenarios.rs similarity index 92% rename from kb-pipeline-demo-scenarios/src/spl/token_2022/devnet_scenarios.rs rename to ks-pipeline-demo-scenarios/src/spl/token_2022/devnet_scenarios.rs index b7d24a7..8495895 100644 --- a/kb-pipeline-demo-scenarios/src/spl/token_2022/devnet_scenarios.rs +++ b/ks-pipeline-demo-scenarios/src/spl/token_2022/devnet_scenarios.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/spl/token_2022/devnet_scenarios.rs -// version: 8 +// file: ks-pipeline-demo-scenarios/src/spl/token_2022/devnet_scenarios.rs +// version: 9 //! Stable Devnet validation scenarios required to close milestone 0.4.6. @@ -53,17 +53,17 @@ pub struct DevnetSplValidationScenario { /// Returns the complete ordered Devnet scenario inventory for milestone 0.4.6. pub fn devnet_spl_validation_scenarios() -> std::vec::Vec { return vec![ - public_scenario("token_2022_mint_to_checked", "Token-2022 MintToChecked", kb_lib::EX_SPL_TOKEN_2022_MINT_TO_CHECKED_OPERATION, &["TOKEN_2022_MINT", "TOKEN_2022_SOURCE", "TOKEN_2022_AUTHORITY", "TOKEN_2022_DECIMALS", "TOKEN_2022_MINT_AMOUNT_RAW"]), - public_scenario("token_2022_transfer_checked", "Token-2022 TransferChecked", kb_lib::EX_SPL_TOKEN_2022_TRANSFER_CHECKED_OPERATION, &["TOKEN_2022_SOURCE", "TOKEN_2022_MINT", "TOKEN_2022_DESTINATION", "TOKEN_2022_AUTHORITY", "TOKEN_2022_DECIMALS", "TOKEN_2022_TRANSFER_AMOUNT_RAW"]), - public_scenario("token_2022_approve_checked", "Token-2022 ApproveChecked", kb_lib::EX_SPL_TOKEN_2022_APPROVE_CHECKED_OPERATION, &["TOKEN_2022_SOURCE", "TOKEN_2022_MINT", "TOKEN_2022_DELEGATE", "TOKEN_2022_AUTHORITY", "TOKEN_2022_DECIMALS", "TOKEN_2022_APPROVE_AMOUNT_RAW"]), - public_scenario("token_2022_revoke", "Token-2022 Revoke", kb_lib::EX_SPL_TOKEN_2022_REVOKE_OPERATION, &["TOKEN_2022_SOURCE", "TOKEN_2022_AUTHORITY"]), - public_scenario("token_2022_burn_checked", "Token-2022 BurnChecked", kb_lib::EX_SPL_TOKEN_2022_BURN_CHECKED_OPERATION, &["TOKEN_2022_SOURCE", "TOKEN_2022_MINT", "TOKEN_2022_AUTHORITY", "TOKEN_2022_DECIMALS", "TOKEN_2022_BURN_AMOUNT_RAW"]), - public_scenario("token_2022_freeze_account", "Token-2022 FreezeAccount", kb_lib::EX_SPL_TOKEN_2022_FREEZE_ACCOUNT_OPERATION, &["TOKEN_2022_SOURCE", "TOKEN_2022_MINT", "TOKEN_2022_FREEZE_AUTHORITY"]), - public_scenario("token_2022_thaw_account", "Token-2022 ThawAccount", kb_lib::EX_SPL_TOKEN_2022_THAW_ACCOUNT_OPERATION, &["TOKEN_2022_SOURCE", "TOKEN_2022_MINT", "TOKEN_2022_FREEZE_AUTHORITY"]), - public_scenario("token_2022_close_destination", "Token-2022 CloseAccount destination", kb_lib::EX_SPL_TOKEN_2022_CLOSE_ACCOUNT_OPERATION, &["TOKEN_2022_DESTINATION", "KB_DEVNET_WALLET_ADDRESS", "TOKEN_2022_AUTHORITY"]), + public_scenario("token_2022_mint_to_checked", "Token-2022 MintToChecked", ks_lib::EX_SPL_TOKEN_2022_MINT_TO_CHECKED_OPERATION, &["TOKEN_2022_MINT", "TOKEN_2022_SOURCE", "TOKEN_2022_AUTHORITY", "TOKEN_2022_DECIMALS", "TOKEN_2022_MINT_AMOUNT_RAW"]), + public_scenario("token_2022_transfer_checked", "Token-2022 TransferChecked", ks_lib::EX_SPL_TOKEN_2022_TRANSFER_CHECKED_OPERATION, &["TOKEN_2022_SOURCE", "TOKEN_2022_MINT", "TOKEN_2022_DESTINATION", "TOKEN_2022_AUTHORITY", "TOKEN_2022_DECIMALS", "TOKEN_2022_TRANSFER_AMOUNT_RAW"]), + public_scenario("token_2022_approve_checked", "Token-2022 ApproveChecked", ks_lib::EX_SPL_TOKEN_2022_APPROVE_CHECKED_OPERATION, &["TOKEN_2022_SOURCE", "TOKEN_2022_MINT", "TOKEN_2022_DELEGATE", "TOKEN_2022_AUTHORITY", "TOKEN_2022_DECIMALS", "TOKEN_2022_APPROVE_AMOUNT_RAW"]), + public_scenario("token_2022_revoke", "Token-2022 Revoke", ks_lib::EX_SPL_TOKEN_2022_REVOKE_OPERATION, &["TOKEN_2022_SOURCE", "TOKEN_2022_AUTHORITY"]), + public_scenario("token_2022_burn_checked", "Token-2022 BurnChecked", ks_lib::EX_SPL_TOKEN_2022_BURN_CHECKED_OPERATION, &["TOKEN_2022_SOURCE", "TOKEN_2022_MINT", "TOKEN_2022_AUTHORITY", "TOKEN_2022_DECIMALS", "TOKEN_2022_BURN_AMOUNT_RAW"]), + public_scenario("token_2022_freeze_account", "Token-2022 FreezeAccount", ks_lib::EX_SPL_TOKEN_2022_FREEZE_ACCOUNT_OPERATION, &["TOKEN_2022_SOURCE", "TOKEN_2022_MINT", "TOKEN_2022_FREEZE_AUTHORITY"]), + public_scenario("token_2022_thaw_account", "Token-2022 ThawAccount", ks_lib::EX_SPL_TOKEN_2022_THAW_ACCOUNT_OPERATION, &["TOKEN_2022_SOURCE", "TOKEN_2022_MINT", "TOKEN_2022_FREEZE_AUTHORITY"]), + public_scenario("token_2022_close_destination", "Token-2022 CloseAccount destination", ks_lib::EX_SPL_TOKEN_2022_CLOSE_ACCOUNT_OPERATION, &["TOKEN_2022_DESTINATION", "KB_DEVNET_WALLET_ADDRESS", "TOKEN_2022_AUTHORITY"]), registry_scenario("elgamal_registry_create", "ElGamal Registry CreateRegistry", "spl.elgamal_registry.create_registry", &["ELGAMAL_REGISTRY_ADDRESS", "ELGAMAL_PUBKEY_BASE64", "PUBKEY_VALIDITY_PROOF_CONTEXT"]), registry_scenario("elgamal_registry_update", "ElGamal Registry UpdateRegistry", "spl.elgamal_registry.update_registry", &["ELGAMAL_REGISTRY_ADDRESS", "ELGAMAL_PUBKEY_BASE64", "PUBKEY_VALIDITY_PROOF_CONTEXT"]), - confidential_scenario("token_2022_configure_confidential_account", "Token-2022 ConfigureAccountWithRegistry", kb_lib::EX_SPL_TOKEN_2022_CONFIGURE_CONFIDENTIAL_TRANSFER_ACCOUNT_WITH_REGISTRY_OPERATION, &["TOKEN_2022_SOURCE", "TOKEN_2022_MINT", "ELGAMAL_REGISTRY_ADDRESS", "PUBKEY_VALIDITY_PROOF_CONTEXT"]), + confidential_scenario("token_2022_configure_confidential_account", "Token-2022 ConfigureAccountWithRegistry", ks_lib::EX_SPL_TOKEN_2022_CONFIGURE_CONFIDENTIAL_TRANSFER_ACCOUNT_WITH_REGISTRY_OPERATION, &["TOKEN_2022_SOURCE", "TOKEN_2022_MINT", "ELGAMAL_REGISTRY_ADDRESS", "PUBKEY_VALIDITY_PROOF_CONTEXT"]), ]; } diff --git a/kb-pipeline-demo-scenarios/src/spl/token_2022/fixture.rs b/ks-pipeline-demo-scenarios/src/spl/token_2022/fixture.rs similarity index 81% rename from kb-pipeline-demo-scenarios/src/spl/token_2022/fixture.rs rename to ks-pipeline-demo-scenarios/src/spl/token_2022/fixture.rs index 5244dd2..6a0df05 100644 --- a/kb-pipeline-demo-scenarios/src/spl/token_2022/fixture.rs +++ b/ks-pipeline-demo-scenarios/src/spl/token_2022/fixture.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/spl/token_2022/fixture.rs -// version: 3 +// file: ks-pipeline-demo-scenarios/src/spl/token_2022/fixture.rs +// version: 4 //! Idempotent Token-2022 public scenario fixture preparation. @@ -12,7 +12,7 @@ pub const DEFAULT_TOKEN_2022_APPROVE_AMOUNT_RAW: u64 = 2_000_000_000; /// Default raw amount burned by the public BurnChecked scenario. pub const DEFAULT_TOKEN_2022_BURN_AMOUNT_RAW: u64 = 1_000_000_000; -macro_rules! kb_try { +macro_rules! ks_try { ($expression:expr) => { match $expression { std::result::Result::Ok(value) => value, @@ -64,46 +64,46 @@ pub struct Token2022FixturePreparationSummary { /// Creates or reuses one complete Token-2022 public scenario fixture. pub async fn prepare_token_2022_fixture( options: &crate::Token2022FixturePreparationOptions, -) -> kb_core::Result { - kb_try!(validate_options(options)); +) -> ks_core::Result { + ks_try!(validate_options(options)); let fixture_dir = options.wallet_dir.join("spl_token_2022_validation"); if let std::result::Result::Err(error) = tokio::fs::create_dir_all(&fixture_dir).await { - return std::result::Result::Err(kb_core::Error::io(format!( + return std::result::Result::Err(ks_core::Error::io(format!( "unable to create Token-2022 fixture directory {}: {error}", fixture_dir.display() ))); } - let wallet_path = kb_try!(path_text(&options.wallet_path)); + let wallet_path = ks_try!(path_text(&options.wallet_path)); let authority = - kb_try!(command_stdout("solana-keygen", &["pubkey", wallet_path.as_str()]).await); + ks_try!(command_stdout("solana-keygen", &["pubkey", wallet_path.as_str()]).await); let mint_keypair = fixture_dir.join("mint.json"); let source_keypair = fixture_dir.join("source-account.json"); let destination_keypair = fixture_dir.join("destination-account.json"); let close_account_keypair = fixture_dir.join("close-account.json"); let delegate_keypair = fixture_dir.join("delegate.json"); - kb_try!(ensure_keypair(&mint_keypair).await); - kb_try!(ensure_keypair(&source_keypair).await); - kb_try!(ensure_keypair(&destination_keypair).await); - kb_try!(ensure_keypair(&close_account_keypair).await); - kb_try!(ensure_keypair(&delegate_keypair).await); - let mint = kb_try!(keypair_pubkey(&mint_keypair).await); - let source = kb_try!(keypair_pubkey(&source_keypair).await); - let destination = kb_try!(keypair_pubkey(&destination_keypair).await); - let close_account = kb_try!(keypair_pubkey(&close_account_keypair).await); - let delegate = kb_try!(keypair_pubkey(&delegate_keypair).await); - let mint_exists = kb_try!(account_exists(options.rpc_url.as_str(), mint.as_str()).await); + ks_try!(ensure_keypair(&mint_keypair).await); + ks_try!(ensure_keypair(&source_keypair).await); + ks_try!(ensure_keypair(&destination_keypair).await); + ks_try!(ensure_keypair(&close_account_keypair).await); + ks_try!(ensure_keypair(&delegate_keypair).await); + let mint = ks_try!(keypair_pubkey(&mint_keypair).await); + let source = ks_try!(keypair_pubkey(&source_keypair).await); + let destination = ks_try!(keypair_pubkey(&destination_keypair).await); + let close_account = ks_try!(keypair_pubkey(&close_account_keypair).await); + let delegate = ks_try!(keypair_pubkey(&delegate_keypair).await); + let mint_exists = ks_try!(account_exists(options.rpc_url.as_str(), mint.as_str()).await); if !mint_exists { let decimals = options.decimals.to_string(); - let wallet_path = kb_try!(path_text(&options.wallet_path)); - let mint_keypair_path = kb_try!(path_text(&mint_keypair)); - kb_try!( + let wallet_path = ks_try!(path_text(&options.wallet_path)); + let mint_keypair_path = ks_try!(path_text(&mint_keypair)); + ks_try!( run_command( "spl-token", &[ "--url", options.rpc_url.as_str(), "--program-id", - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, "create-token", "--enable-freeze", "--decimals", @@ -118,7 +118,7 @@ pub async fn prepare_token_2022_fixture( .await ); } - kb_try!( + ks_try!( ensure_token_account( options, mint.as_str(), @@ -128,7 +128,7 @@ pub async fn prepare_token_2022_fixture( ) .await ); - kb_try!( + ks_try!( ensure_token_account( options, mint.as_str(), @@ -138,7 +138,7 @@ pub async fn prepare_token_2022_fixture( ) .await ); - kb_try!( + ks_try!( ensure_token_account( options, mint.as_str(), @@ -151,7 +151,7 @@ pub async fn prepare_token_2022_fixture( let fixture_path = fixture_dir.join("fixture.env"); let summary = crate::Token2022FixturePreparationSummary { fixture_path: fixture_path.clone(), - program_id: kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string(), + program_id: ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string(), mint, source, destination, @@ -164,7 +164,7 @@ pub async fn prepare_token_2022_fixture( }; let contents = render_fixture(&summary); let fixture_written = - kb_try!(write_fixture_atomically(&fixture_path, contents.as_bytes()).await); + ks_try!(write_fixture_atomically(&fixture_path, contents.as_bytes()).await); return std::result::Result::Ok(crate::Token2022FixturePreparationSummary { fixture_path, program_id: summary.program_id, @@ -180,32 +180,32 @@ pub async fn prepare_token_2022_fixture( }); } -fn validate_options(options: &crate::Token2022FixturePreparationOptions) -> kb_core::Result<()> { +fn validate_options(options: &crate::Token2022FixturePreparationOptions) -> ks_core::Result<()> { if options.rpc_url.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 fixture RPC URL must not be empty", )); } if !options.wallet_path.is_file() { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Token-2022 fixture wallet does not exist: {}", options.wallet_path.display() ))); } if options.decimals > 18 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 fixture decimals must be at most 18", )); } return std::result::Result::Ok(()); } -async fn ensure_keypair(path: &std::path::Path) -> kb_core::Result<()> { +async fn ensure_keypair(path: &std::path::Path) -> ks_core::Result<()> { if path.is_file() { return std::result::Result::Ok(()); } - let keypair_path = kb_try!(path_text(path)); - kb_try!( + let keypair_path = ks_try!(path_text(path)); + ks_try!( run_command( "solana-keygen", &[ @@ -219,17 +219,17 @@ async fn ensure_keypair(path: &std::path::Path) -> kb_core::Result<()> { ) .await ); - kb_try!(set_private_permissions(path).await); + ks_try!(set_private_permissions(path).await); return std::result::Result::Ok(()); } -async fn set_private_permissions(path: &std::path::Path) -> kb_core::Result<()> { +async fn set_private_permissions(path: &std::path::Path) -> ks_core::Result<()> { #[cfg(unix)] { let metadata = match tokio::fs::metadata(path).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::io(format!( + return std::result::Result::Err(ks_core::Error::io(format!( "unable to read keypair metadata {}: {error}", path.display() ))); @@ -239,7 +239,7 @@ async fn set_private_permissions(path: &std::path::Path) -> kb_core::Result<()> std::os::unix::fs::PermissionsExt::set_mode(&mut permissions, 0o600); if let std::result::Result::Err(error) = tokio::fs::set_permissions(path, permissions).await { - return std::result::Result::Err(kb_core::Error::io(format!( + return std::result::Result::Err(ks_core::Error::io(format!( "unable to protect keypair {}: {error}", path.display() ))); @@ -248,12 +248,12 @@ async fn set_private_permissions(path: &std::path::Path) -> kb_core::Result<()> return std::result::Result::Ok(()); } -async fn keypair_pubkey(path: &std::path::Path) -> kb_core::Result { - let keypair_path = kb_try!(path_text(path)); +async fn keypair_pubkey(path: &std::path::Path) -> ks_core::Result { + let keypair_path = ks_try!(path_text(path)); return command_stdout("solana-keygen", &["pubkey", keypair_path.as_str()]).await; } -async fn account_exists(rpc_url: &str, address: &str) -> kb_core::Result { +async fn account_exists(rpc_url: &str, address: &str) -> ks_core::Result { let output = match tokio::process::Command::new("solana") .args(["account", address, "--url", rpc_url, "--output", "json"]) .output() @@ -261,7 +261,7 @@ async fn account_exists(rpc_url: &str, address: &str) -> kb_core::Result { { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::io(format!( + return std::result::Result::Err(ks_core::Error::io(format!( "unable to execute solana account: {error}" ))); }, @@ -275,21 +275,21 @@ async fn ensure_token_account( authority: &str, keypair_path: &std::path::Path, address: &str, -) -> kb_core::Result<()> { - let exists = kb_try!(account_exists(options.rpc_url.as_str(), address).await); +) -> ks_core::Result<()> { + let exists = ks_try!(account_exists(options.rpc_url.as_str(), address).await); if exists { return std::result::Result::Ok(()); } - let token_account_keypair = kb_try!(path_text(keypair_path)); - let wallet_path = kb_try!(path_text(&options.wallet_path)); - kb_try!( + let token_account_keypair = ks_try!(path_text(keypair_path)); + let wallet_path = ks_try!(path_text(&options.wallet_path)); + ks_try!( run_command( "spl-token", &[ "--url", options.rpc_url.as_str(), "--program-id", - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, "create-account", mint, token_account_keypair.as_str(), @@ -304,11 +304,11 @@ async fn ensure_token_account( return std::result::Result::Ok(()); } -async fn command_stdout(program: &str, arguments: &[&str]) -> kb_core::Result { +async fn command_stdout(program: &str, arguments: &[&str]) -> ks_core::Result { let output = match tokio::process::Command::new(program).args(arguments).output().await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::io(format!( + return std::result::Result::Err(ks_core::Error::io(format!( "unable to execute {program}: {error}" ))); }, @@ -319,7 +319,7 @@ async fn command_stdout(program: &str, arguments: &[&str]) -> kb_core::Result value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "{program} returned non-UTF-8 output: {error}" ))); }, @@ -327,11 +327,11 @@ async fn command_stdout(program: &str, arguments: &[&str]) -> kb_core::Result kb_core::Result<()> { +async fn run_command(program: &str, arguments: &[&str]) -> ks_core::Result<()> { let output = match tokio::process::Command::new(program).args(arguments).output().await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::io(format!( + return std::result::Result::Err(ks_core::Error::io(format!( "unable to execute {program}: {error}" ))); }, @@ -346,7 +346,7 @@ fn command_error( program: &str, arguments: &[&str], output: &std::process::Output, -) -> kb_core::Error { +) -> ks_core::Error { let stderr = std::string::String::from_utf8_lossy(output.stderr.as_slice()) .trim() .to_string(); @@ -354,7 +354,7 @@ fn command_error( .trim() .to_string(); let detail = if stderr.is_empty() { stdout } else { stderr }; - return kb_core::Error::new( + return ks_core::Error::new( "token_2022_fixture_command_failed", format!( "command {program} {} failed with status {}: {detail}", @@ -364,10 +364,10 @@ fn command_error( ); } -fn path_text(path: &std::path::Path) -> kb_core::Result { +fn path_text(path: &std::path::Path) -> ks_core::Result { return match path.to_str() { std::option::Option::Some(value) => std::result::Result::Ok(value.to_string()), - std::option::Option::None => std::result::Result::Err(kb_core::Error::config(format!( + std::option::Option::None => std::result::Result::Err(ks_core::Error::config(format!( "path is not valid UTF-8: {}", path.display() ))), @@ -397,7 +397,7 @@ fn render_fixture(summary: &crate::Token2022FixturePreparationSummary) -> std::s async fn write_fixture_atomically( path: &std::path::Path, contents: &[u8], -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Ok(existing) = tokio::fs::read(path).await { if existing == contents { return std::result::Result::Ok(false); @@ -405,13 +405,13 @@ async fn write_fixture_atomically( } let temporary = path.with_extension("env.tmp"); if let std::result::Result::Err(error) = tokio::fs::write(&temporary, contents).await { - return std::result::Result::Err(kb_core::Error::io(format!( + return std::result::Result::Err(ks_core::Error::io(format!( "unable to write temporary Token-2022 fixture {}: {error}", temporary.display() ))); } if let std::result::Result::Err(error) = tokio::fs::rename(&temporary, path).await { - return std::result::Result::Err(kb_core::Error::io(format!( + return std::result::Result::Err(ks_core::Error::io(format!( "unable to replace Token-2022 fixture {}: {error}", path.display() ))); @@ -425,7 +425,7 @@ mod tests { fn rendered_fixture_contains_every_public_scenario_variable() { let summary = super::Token2022FixturePreparationSummary { fixture_path: std::path::PathBuf::from("fixture.env"), - program_id: kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string(), + program_id: ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string(), mint: "mint".to_string(), source: "source".to_string(), destination: "destination".to_string(), diff --git a/kb-pipeline-demo-scenarios/src/spl/token_2022/metadata.rs b/ks-pipeline-demo-scenarios/src/spl/token_2022/metadata.rs similarity index 66% rename from kb-pipeline-demo-scenarios/src/spl/token_2022/metadata.rs rename to ks-pipeline-demo-scenarios/src/spl/token_2022/metadata.rs index 567a8c1..881dc70 100644 --- a/kb-pipeline-demo-scenarios/src/spl/token_2022/metadata.rs +++ b/ks-pipeline-demo-scenarios/src/spl/token_2022/metadata.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/spl/token_2022/metadata.rs -// version: 1 +// file: ks-pipeline-demo-scenarios/src/spl/token_2022/metadata.rs +// version: 2 //! Token-2022 embedded Token Metadata fixtures, campaigns and validation. diff --git a/kb-pipeline-demo-scenarios/src/spl/token_2022/metadata/campaign.rs b/ks-pipeline-demo-scenarios/src/spl/token_2022/metadata/campaign.rs similarity index 83% rename from kb-pipeline-demo-scenarios/src/spl/token_2022/metadata/campaign.rs rename to ks-pipeline-demo-scenarios/src/spl/token_2022/metadata/campaign.rs index 85417f0..2b701f4 100644 --- a/kb-pipeline-demo-scenarios/src/spl/token_2022/metadata/campaign.rs +++ b/ks-pipeline-demo-scenarios/src/spl/token_2022/metadata/campaign.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/spl/token_2022/metadata/campaign.rs -// version: 4 +// file: ks-pipeline-demo-scenarios/src/spl/token_2022/metadata/campaign.rs +// version: 5 //! Ordered confirmed Devnet campaign for the five Token-2022 Token Metadata instructions. @@ -8,16 +8,16 @@ pub struct DevnetToken2022MetadataCampaignStepSummary { /// Stable step identifier. pub step_id: std::string::String, - /// Canonical operation code built by `kb-lib`. + /// Canonical operation code built by `ks-lib`. pub operation_code: std::string::String, /// Complete simulation, submission, replay and instruction-materialization evidence. pub execution: crate::DevnetSplToken2022ExecutionSummary, /// Authoritative mint snapshot read at or after the confirmed transaction slot. - pub stateful_snapshot: kb_pipeline::Token2022StatefulReadResult, + pub stateful_snapshot: ks_pipeline::Token2022StatefulReadResult, /// Validated return-data evidence for the `Emit` step only. - pub emit_evidence: std::option::Option, + pub emit_evidence: std::option::Option, /// Explicit stateful or return-data postcondition. - pub postcondition: kb_pipeline::Token2022ExecutionPostcondition, + pub postcondition: ks_pipeline::Token2022ExecutionPostcondition, } /// Complete evidence retained by the five-step Token Metadata campaign. @@ -43,22 +43,22 @@ pub fn token_2022_metadata_campaign_operation_names() -> &'static [&'static str; /// Prepares a fresh mint and executes all five Token Metadata interface instructions on Devnet. #[allow(clippy::too_many_arguments)] pub async fn execute_devnet_token_2022_metadata_campaign( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, - profile: &kb_config::ProfileConfig, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::Token2022MetadataFixturePreparationOptions, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore - + kb_store::CoreExtractionStore - + kb_store::DecodePipelineStore + S: ks_store::RawTransactionStore + + ks_store::CoreExtractionStore + + ks_store::DecodePipelineStore + Sync, O: crate::SolanaExecutionObserver, { if !options.operator_confirmed { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 Token Metadata Devnet campaign requires explicit operator confirmation", )); } @@ -74,10 +74,10 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let operations = campaign_operations(&fixture); - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcSplToken2022Decoder)]; - let materializers: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::MtMetadataToken2022Materializer)]; + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcSplToken2022Decoder)]; + let materializers: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::MtMetadataToken2022Materializer)]; let mut steps = std::vec::Vec::with_capacity(operations.len()); for (index, (step_id, operation)) in operations.into_iter().enumerate() { let operation_code = operation.operation_code().to_string(); @@ -109,20 +109,20 @@ where std::option::Option::Some(value) if matches!( value.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) => { value }, std::option::Option::Some(value) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_campaign_step_not_confirmed", format!("campaign step {step_id} stopped at {:?}", value.status), )); }, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_campaign_confirmation_missing", format!("campaign step {step_id} has no confirmation evidence"), )); @@ -131,7 +131,7 @@ where let diagnostic = match execution.post_execution.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_campaign_post_execution_missing", format!("campaign step {step_id} has no post-execution diagnostic"), )); @@ -142,7 +142,7 @@ where || !diagnostic.core_extracted || !diagnostic.decode_replayed { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_campaign_replay_incomplete", format!( "campaign step {step_id} did not complete simulation and canonical decode replay" @@ -152,7 +152,7 @@ where let idempotence_replay = match execution.idempotence_replay.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_campaign_idempotence_missing", format!("campaign step {step_id} has no idempotence replay evidence"), )); @@ -167,15 +167,15 @@ where || processor.materialization_refused != 0; }) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_campaign_idempotence_failed", format!("campaign step {step_id} did not produce a clean second replay"), )); } if !execution.plan.policy.post_execution_validation.materialization_required - && operation_code != kb_lib::EX_SPL_TOKEN_2022_EMIT_TOKEN_METADATA_OPERATION + && operation_code != ks_lib::EX_SPL_TOKEN_2022_EMIT_TOKEN_METADATA_OPERATION { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_campaign_materialization_policy_invalid", format!("campaign step {step_id} unexpectedly disabled materialization"), )); @@ -183,20 +183,20 @@ where if execution.plan.policy.post_execution_validation.materialization_required && execution.materializations.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_campaign_materialization_missing", format!("campaign step {step_id} produced no metadata materialization"), )); } - let stateful_snapshot = match kb_pipeline::read_token_2022_stateful_snapshot( + let stateful_snapshot = match ks_pipeline::read_token_2022_stateful_snapshot( http_pool, - &kb_pipeline::Token2022StatefulReadRequest { + &ks_pipeline::Token2022StatefulReadRequest { query_role: options.query_role.clone(), account: fixture.mint.clone(), - kind: kb_lib::DcToken2022StateKind::Mint, + kind: ks_lib::DcToken2022StateKind::Mint, min_context_slot: confirmation.slot, - max_data_bytes: kb_pipeline::MAX_TOKEN_2022_STATEFUL_ACCOUNT_BYTES, - context: kb_pipeline::Token2022StatefulContext::default(), + max_data_bytes: ks_pipeline::MAX_TOKEN_2022_STATEFUL_ACCOUNT_BYTES, + context: ks_pipeline::Token2022StatefulContext::default(), }, ) .await @@ -205,9 +205,9 @@ where std::result::Result::Err(error) => return std::result::Result::Err(error), }; let emit_evidence = match &operation { - kb_lib::ExSplToken2022Operation::Instruction { value } => match value.as_ref() { - kb_lib::ExSplTokenSingleOperation::EmitTokenMetadata { start, end, .. } => { - match kb_pipeline::inspect_token_2022_metadata_emit_simulation( + ks_lib::ExSplToken2022Operation::Instruction { value } => match value.as_ref() { + ks_lib::ExSplTokenSingleOperation::EmitTokenMetadata { start, end, .. } => { + match ks_pipeline::inspect_token_2022_metadata_emit_simulation( &execution.simulation, *start, *end, @@ -218,7 +218,7 @@ where }, _ => std::option::Option::None, }, - kb_lib::ExSplToken2022Operation::Batch { instructions: _ } => std::option::Option::None, + ks_lib::ExSplToken2022Operation::Batch { instructions: _ } => std::option::Option::None, }; let postcondition = campaign_postcondition( index, @@ -226,8 +226,8 @@ where &stateful_snapshot.snapshot, emit_evidence.as_ref(), ); - if postcondition.status != kb_pipeline::Token2022ExecutionPostconditionStatus::Confirmed { - return std::result::Result::Err(kb_core::Error::new( + if postcondition.status != ks_pipeline::Token2022ExecutionPostconditionStatus::Confirmed { + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_campaign_postcondition_failed", format!("campaign step {step_id}: {}", postcondition.diagnostic), )); @@ -249,13 +249,13 @@ where fn campaign_operations( fixture: &crate::Token2022MetadataFixturePreparationSummary, -) -> std::vec::Vec<(&'static str, kb_lib::ExSplToken2022Operation)> { +) -> std::vec::Vec<(&'static str, ks_lib::ExSplToken2022Operation)> { let metadata = fixture.mint.clone(); let authority = fixture.initial_authority.clone(); return std::vec![ ( "token_2022_metadata_initialize", - instruction(kb_lib::ExSplTokenSingleOperation::InitializeTokenMetadata { + instruction(ks_lib::ExSplTokenSingleOperation::InitializeTokenMetadata { metadata: metadata.clone(), update_authority: authority.clone(), mint: metadata.clone(), @@ -267,10 +267,10 @@ fn campaign_operations( ), ( "token_2022_metadata_update_field", - instruction(kb_lib::ExSplTokenSingleOperation::UpdateTokenMetadataField { + instruction(ks_lib::ExSplTokenSingleOperation::UpdateTokenMetadataField { metadata: metadata.clone(), update_authority: authority.clone(), - field: kb_lib::ExSplTokenMetadataField::Key( + field: ks_lib::ExSplTokenMetadataField::Key( crate::TOKEN_2022_METADATA_CAMPAIGN_KEY.to_string(), ), value: crate::TOKEN_2022_METADATA_CAMPAIGN_VALUE.to_string(), @@ -278,7 +278,7 @@ fn campaign_operations( ), ( "token_2022_metadata_emit", - instruction(kb_lib::ExSplTokenSingleOperation::EmitTokenMetadata { + instruction(ks_lib::ExSplTokenSingleOperation::EmitTokenMetadata { metadata: metadata.clone(), start: std::option::Option::None, end: std::option::Option::None, @@ -286,7 +286,7 @@ fn campaign_operations( ), ( "token_2022_metadata_remove_key", - instruction(kb_lib::ExSplTokenSingleOperation::RemoveTokenMetadataKey { + instruction(ks_lib::ExSplTokenSingleOperation::RemoveTokenMetadataKey { metadata: metadata.clone(), update_authority: authority.clone(), key: crate::TOKEN_2022_METADATA_CAMPAIGN_KEY.to_string(), @@ -295,7 +295,7 @@ fn campaign_operations( ), ( "token_2022_metadata_update_authority", - instruction(kb_lib::ExSplTokenSingleOperation::UpdateTokenMetadataAuthority { + instruction(ks_lib::ExSplTokenSingleOperation::UpdateTokenMetadataAuthority { metadata, current_authority: authority, new_authority: std::option::Option::Some(fixture.final_authority.clone()), @@ -304,18 +304,18 @@ fn campaign_operations( ]; } -fn instruction(value: kb_lib::ExSplTokenSingleOperation) -> kb_lib::ExSplToken2022Operation { - return kb_lib::ExSplToken2022Operation::Instruction { value: std::boxed::Box::new(value) }; +fn instruction(value: ks_lib::ExSplTokenSingleOperation) -> ks_lib::ExSplToken2022Operation { + return ks_lib::ExSplToken2022Operation::Instruction { value: std::boxed::Box::new(value) }; } fn campaign_postcondition( step_index: usize, fixture: &crate::Token2022MetadataFixturePreparationSummary, - snapshot: &kb_pipeline::Token2022StatefulSnapshotBundle, - emit_evidence: std::option::Option<&kb_pipeline::Token2022MetadataEmitEvidence>, -) -> kb_pipeline::Token2022ExecutionPostcondition { + snapshot: &ks_pipeline::Token2022StatefulSnapshotBundle, + emit_evidence: std::option::Option<&ks_pipeline::Token2022MetadataEmitEvidence>, +) -> ks_pipeline::Token2022ExecutionPostcondition { if step_index == 4 { - return kb_pipeline::inspect_token_2022_metadata_authority_postcondition( + return ks_pipeline::inspect_token_2022_metadata_authority_postcondition( &fixture.mint, std::option::Option::Some(&fixture.final_authority), snapshot, @@ -350,13 +350,13 @@ fn campaign_postcondition( }), _ => false, }; - return kb_pipeline::Token2022ExecutionPostcondition { + return ks_pipeline::Token2022ExecutionPostcondition { role: "metadata".to_string(), account: fixture.mint.clone(), status: if confirmed { - kb_pipeline::Token2022ExecutionPostconditionStatus::Confirmed + ks_pipeline::Token2022ExecutionPostconditionStatus::Confirmed } else { - kb_pipeline::Token2022ExecutionPostconditionStatus::Contradicted + ks_pipeline::Token2022ExecutionPostconditionStatus::Contradicted }, diagnostic: if confirmed { format!("Token-2022 metadata campaign postcondition {step_index} is confirmed") @@ -367,10 +367,10 @@ fn campaign_postcondition( } fn metadata_value_fields( - snapshot: &kb_pipeline::Token2022StatefulSnapshotBundle, + snapshot: &ks_pipeline::Token2022StatefulSnapshotBundle, ) -> std::option::Option<&serde_json::Value> { return snapshot.outputs.iter().find_map(|output| { - if output.family != kb_lib::MdMaterializedEventFamily::Metadata + if output.family != ks_lib::MdMaterializedEventFamily::Metadata || output.payload_json.get("projectionKind").and_then(serde_json::Value::as_str) != std::option::Option::Some("token_metadata") { @@ -407,8 +407,8 @@ fn contains_campaign_pair(value: &serde_json::Value) -> bool { #[cfg(test)] mod tests { - fn pubkey(byte: u8) -> kb_lib::MdPubkey { - return kb_lib::MdPubkey(bs58::encode([byte; 32]).into_string()); + fn pubkey(byte: u8) -> ks_lib::MdPubkey { + return ks_lib::MdPubkey(bs58::encode([byte; 32]).into_string()); } fn fixture() -> crate::Token2022MetadataFixturePreparationSummary { @@ -422,10 +422,10 @@ mod tests { rent_budget_space: 512, rent_reserve_lamports: 1, preparation_signature: "signature".to_string(), - initial_snapshot: kb_pipeline::Token2022StatefulReadResult { + initial_snapshot: ks_pipeline::Token2022StatefulReadResult { commitment: "confirmed".to_string(), context_slot: 1, - snapshot: kb_pipeline::Token2022StatefulSnapshotBundle { + snapshot: ks_pipeline::Token2022StatefulSnapshotBundle { account_key: pubkey(1).0, slot: 1, state_kind: "mint".to_string(), @@ -445,11 +445,11 @@ mod tests { .map(|(_, operation)| return operation.operation_code()) .collect::>(), vec![ - kb_lib::EX_SPL_TOKEN_2022_INITIALIZE_TOKEN_METADATA_OPERATION, - kb_lib::EX_SPL_TOKEN_2022_UPDATE_TOKEN_METADATA_FIELD_OPERATION, - kb_lib::EX_SPL_TOKEN_2022_EMIT_TOKEN_METADATA_OPERATION, - kb_lib::EX_SPL_TOKEN_2022_REMOVE_TOKEN_METADATA_KEY_OPERATION, - kb_lib::EX_SPL_TOKEN_2022_UPDATE_TOKEN_METADATA_AUTHORITY_OPERATION, + ks_lib::EX_SPL_TOKEN_2022_INITIALIZE_TOKEN_METADATA_OPERATION, + ks_lib::EX_SPL_TOKEN_2022_UPDATE_TOKEN_METADATA_FIELD_OPERATION, + ks_lib::EX_SPL_TOKEN_2022_EMIT_TOKEN_METADATA_OPERATION, + ks_lib::EX_SPL_TOKEN_2022_REMOVE_TOKEN_METADATA_KEY_OPERATION, + ks_lib::EX_SPL_TOKEN_2022_UPDATE_TOKEN_METADATA_AUTHORITY_OPERATION, ] ); assert_eq!( @@ -504,7 +504,7 @@ mod tests { }, std::result::Result::Err(_) => workspace_root.join("config/example.config.json"), }; - let config = kb_config::read_config_json_file_with_environment( + let config = ks_config::read_config_json_file_with_environment( config_path.as_path(), workspace_root, ) @@ -516,16 +516,16 @@ mod tests { .unwrap_or_else(|error| panic!("KB_POSTGRES_TEST_URL is required: {error}")); profile.database.backend = "postgres".to_string(); profile.database.postgres.url = database_url; - let pool = kb_onchain_transport::HttpEndpointPool::from_profile(&profile) + let pool = ks_onchain_transport::HttpEndpointPool::from_profile(&profile) .unwrap_or_else(|error| panic!("HTTP pool creation failed: {error}")); - let store_options = kb_store::PostgresStoreOptions::new( + let store_options = ks_store::PostgresStoreOptions::new( profile.database.postgres.url.clone(), profile.database.postgres.max_connections, profile.database.postgres.connect_timeout_ms, false, ) .unwrap_or_else(|error| panic!("PostgreSQL options failed: {error}")); - let store = kb_store::PostgresStore::connect(store_options) + let store = ks_store::PostgresStore::connect(store_options) .await .unwrap_or_else(|error| panic!("PostgreSQL connection failed: {error}")); if let std::result::Result::Err(error) = store.initialize_store_schema().await { @@ -554,7 +554,7 @@ mod tests { assert_eq!(summary.steps.len(), 5); assert!(summary.steps.iter().all(|step| { return step.postcondition.status - == kb_pipeline::Token2022ExecutionPostconditionStatus::Confirmed; + == ks_pipeline::Token2022ExecutionPostconditionStatus::Confirmed; })); println!( "TOKEN_2022_METADATA_FIXTURE mint={} preparation_signature={} initial_authority={} final_authority={}", diff --git a/kb-pipeline-demo-scenarios/src/spl/token_2022/metadata/fixture.rs b/ks-pipeline-demo-scenarios/src/spl/token_2022/metadata/fixture.rs similarity index 80% rename from kb-pipeline-demo-scenarios/src/spl/token_2022/metadata/fixture.rs rename to ks-pipeline-demo-scenarios/src/spl/token_2022/metadata/fixture.rs index c49da82..d698bf0 100644 --- a/kb-pipeline-demo-scenarios/src/spl/token_2022/metadata/fixture.rs +++ b/ks-pipeline-demo-scenarios/src/spl/token_2022/metadata/fixture.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/spl/token_2022/metadata/fixture.rs -// version: 3 +// file: ks-pipeline-demo-scenarios/src/spl/token_2022/metadata/fixture.rs +// version: 4 //! Native Token-2022 mint preparation for the embedded Token Metadata Devnet campaign. @@ -50,11 +50,11 @@ pub struct Token2022MetadataFixturePreparationSummary { /// Persistent final metadata-authority keypair path. pub final_authority_keypair_path: std::path::PathBuf, /// Fresh Token-2022 mint address. Embedded metadata uses this same account. - pub mint: kb_lib::MdPubkey, + pub mint: ks_lib::MdPubkey, /// Profile wallet used as mint and initial metadata update authority. - pub initial_authority: kb_lib::MdPubkey, + pub initial_authority: ks_lib::MdPubkey, /// Fresh public key installed by the final `UpdateAuthority` campaign step. - pub final_authority: kb_lib::MdPubkey, + pub final_authority: ks_lib::MdPubkey, /// Initial mint account bytes containing only the fixed Metadata Pointer extension. pub mint_space: usize, /// Account-size budget used to pre-fund rent for the largest campaign metadata state. @@ -64,7 +64,7 @@ pub struct Token2022MetadataFixturePreparationSummary { /// Confirmed signature that created the Token-2022 mint fixture. pub preparation_signature: std::string::String, /// Authoritative snapshot after mint creation and before Token Metadata initialization. - pub initial_snapshot: kb_pipeline::Token2022StatefulReadResult, + pub initial_snapshot: ks_pipeline::Token2022StatefulReadResult, } /// Creates a fresh Token-2022 mint with Metadata Pointer initialized to the mint itself. @@ -73,13 +73,13 @@ pub struct Token2022MetadataFixturePreparationSummary { /// for the largest state reached by this campaign so Token Metadata reallocations /// remain rent-exempt without introducing an additional payer instruction. pub async fn prepare_token_2022_metadata_fixture( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, workspace_root: &std::path::Path, options: &crate::Token2022MetadataFixturePreparationOptions, -) -> kb_core::Result { +) -> ks_core::Result { if options.query_role.trim().is_empty() || options.transaction_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 metadata fixture endpoint roles must not be empty", )); } @@ -87,12 +87,12 @@ pub async fn prepare_token_2022_metadata_fixture( || !profile.wallet.temporary_wallet_enabled || !profile.wallet.temporary_wallet_persist { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 metadata fixture requires a persistent Devnet wallet profile", )); } if !profile.wallet.devnet_send_enabled || !options.operator_confirmed { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 metadata fixture requires enabled Devnet submission and explicit operator confirmation", )); } @@ -100,7 +100,7 @@ pub async fn prepare_token_2022_metadata_fixture( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let fixture_store = match kb_wallet::TemporaryWalletStore::new( + let fixture_store = match ks_wallet::TemporaryWalletStore::new( options.wallet_dir.join("token_2022_metadata_validation"), ) { std::result::Result::Ok(value) => value, @@ -109,18 +109,18 @@ pub async fn prepare_token_2022_metadata_fixture( let fixture_epoch = match std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH) { std::result::Result::Ok(value) => value.as_millis(), std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "unable to create a unique Token-2022 metadata fixture identifier: {error}" ))); }, }; - let mint_alias = match kb_wallet::WalletAlias::parse( + let mint_alias = match ks_wallet::WalletAlias::parse( format!("token-2022-metadata-mint-{fixture_epoch}").as_str(), ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let final_authority_alias = match kb_wallet::WalletAlias::parse( + let final_authority_alias = match ks_wallet::WalletAlias::parse( format!("token-2022-metadata-authority-{fixture_epoch}").as_str(), ) { std::result::Result::Ok(value) => value, @@ -135,9 +135,9 @@ pub async fn prepare_token_2022_metadata_fixture( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let mint = kb_lib::MdPubkey(mint_wallet.public_key()); - let initial_authority = kb_lib::MdPubkey(operator.public_key()); - let final_authority = kb_lib::MdPubkey(final_authority_wallet.public_key()); + let mint = ks_lib::MdPubkey(mint_wallet.public_key()); + let initial_authority = ks_lib::MdPubkey(operator.public_key()); + let final_authority = ks_lib::MdPubkey(final_authority_wallet.public_key()); let mint_space = match token_2022_metadata_pointer_mint_space() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -157,15 +157,15 @@ pub async fn prepare_token_2022_metadata_fixture( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let initial_snapshot = match kb_pipeline::read_token_2022_stateful_snapshot( + let initial_snapshot = match ks_pipeline::read_token_2022_stateful_snapshot( http_pool, - &kb_pipeline::Token2022StatefulReadRequest { + &ks_pipeline::Token2022StatefulReadRequest { query_role: options.query_role.clone(), account: mint.clone(), - kind: kb_lib::DcToken2022StateKind::Mint, + kind: ks_lib::DcToken2022StateKind::Mint, min_context_slot: std::option::Option::None, - max_data_bytes: kb_pipeline::MAX_TOKEN_2022_STATEFUL_ACCOUNT_BYTES, - context: kb_pipeline::Token2022StatefulContext::default(), + max_data_bytes: ks_pipeline::MAX_TOKEN_2022_STATEFUL_ACCOUNT_BYTES, + context: ks_pipeline::Token2022StatefulContext::default(), }, ) .await @@ -185,7 +185,7 @@ pub async fn prepare_token_2022_metadata_fixture( .any(|value| return value == "token_metadata") || !metadata_pointer_snapshot_matches(&initial_snapshot.snapshot, &mint, &initial_authority) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_fixture_state_invalid", "fresh metadata fixture must contain the expected self-referential Metadata Pointer and no Token Metadata extension", )); @@ -196,12 +196,12 @@ pub async fn prepare_token_2022_metadata_fixture( match u64::try_from(rent_budget_space) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Token-2022 metadata rent budget does not fit u64: {error}" ))); }, }, - &kb_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), + &ks_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), ) .await { @@ -223,12 +223,12 @@ pub async fn prepare_token_2022_metadata_fixture( } fn metadata_pointer_snapshot_matches( - snapshot: &kb_pipeline::Token2022StatefulSnapshotBundle, - mint: &kb_lib::MdPubkey, - authority: &kb_lib::MdPubkey, + snapshot: &ks_pipeline::Token2022StatefulSnapshotBundle, + mint: &ks_lib::MdPubkey, + authority: &ks_lib::MdPubkey, ) -> bool { return snapshot.outputs.iter().any(|output| { - return output.family == kb_lib::MdMaterializedEventFamily::Admin + return output.family == ks_lib::MdMaterializedEventFamily::Admin && output.payload_json.get("extensionName").and_then(serde_json::Value::as_str) == std::option::Option::Some("metadata_pointer") && output @@ -246,13 +246,13 @@ fn metadata_pointer_snapshot_matches( }); } -fn token_2022_metadata_pointer_mint_space() -> kb_core::Result { +fn token_2022_metadata_pointer_mint_space() -> ks_core::Result { return match spl_token_2022_interface::extension::ExtensionType::try_calculate_account_len::< spl_token_2022_interface::pod::PodMint, >(&[spl_token_2022_interface::extension::ExtensionType::MetadataPointer]) { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_fixture_space_failed", format!("unable to calculate Metadata Pointer mint space: {error}"), )), @@ -282,18 +282,18 @@ fn metadata_campaign_max_value_bytes() -> usize { #[allow(clippy::too_many_arguments)] async fn create_native_token_2022_metadata_mint( - http_pool: &kb_onchain_transport::HttpEndpointPool, - profile: &kb_config::ProfileConfig, + http_pool: &ks_onchain_transport::HttpEndpointPool, + profile: &ks_config::ProfileConfig, options: &crate::Token2022MetadataFixturePreparationOptions, - operator: &kb_wallet::TemporaryWallet, - mint_wallet: &kb_wallet::TemporaryWallet, + operator: &ks_wallet::TemporaryWallet, + mint_wallet: &ks_wallet::TemporaryWallet, mint_space: usize, rent_budget_space: usize, -) -> kb_core::Result { +) -> ks_core::Result { let rent_space = match u64::try_from(rent_budget_space) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Token-2022 metadata rent budget does not fit u64: {error}" ))); }, @@ -301,7 +301,7 @@ async fn create_native_token_2022_metadata_mint( let account_space = match u64::try_from(mint_space) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Token-2022 Metadata Pointer mint space does not fit u64: {error}" ))); }, @@ -310,42 +310,42 @@ async fn create_native_token_2022_metadata_mint( .get_minimum_balance_for_rent_exemption_for_role( options.query_role.as_str(), rent_space, - &kb_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), + &ks_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), ) .await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let payer = kb_lib::MdPubkey(operator.public_key()); - let mint = kb_lib::MdPubkey(mint_wallet.public_key()); + let payer = ks_lib::MdPubkey(operator.public_key()); + let mint = ks_lib::MdPubkey(mint_wallet.public_key()); let policy = fixture_policy(profile, payer.clone(), mint.clone(), rent.minimum_balance_lamports); - let system_intent = kb_lib::ExSolanaCoreExecutionIntent { + let system_intent = ks_lib::ExSolanaCoreExecutionIntent { intent_id: format!("token-2022-metadata-fixture-create-account-{}", mint.0), fee_payer: payer.clone(), policy: policy.clone(), - operation: kb_lib::ExSolanaCoreOperation::SystemCreateAccount { + operation: ks_lib::ExSolanaCoreOperation::SystemCreateAccount { from: payer.clone(), new_account: mint.clone(), lamports: rent.minimum_balance_lamports, space: account_space, - owner: kb_lib::MdPubkey(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()), + owner: ks_lib::MdPubkey(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()), }, }; - let system_plan = match kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan( - &kb_lib::ExSolanaCoreExecutor, + let system_plan = match ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan( + &ks_lib::ExSolanaCoreExecutor, &system_intent, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; let token_program = match ::from_str( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid Token-2022 Program ID: {error}" ))); }, @@ -354,7 +354,7 @@ async fn create_native_token_2022_metadata_mint( { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid Token-2022 metadata fixture mint: {error}" ))); }, @@ -363,7 +363,7 @@ async fn create_native_token_2022_metadata_mint( match ::from_str(payer.0.as_str()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid Token-2022 metadata fixture authority: {error}" ))); }, @@ -377,7 +377,7 @@ async fn create_native_token_2022_metadata_mint( ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_fixture_pointer_build_failed", error.to_string(), )); @@ -392,7 +392,7 @@ async fn create_native_token_2022_metadata_mint( ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_fixture_initialize_mint_build_failed", error.to_string(), )); @@ -407,12 +407,12 @@ async fn create_native_token_2022_metadata_mint( policy, rent.minimum_balance_lamports, ); - let plan_evaluation = match kb_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { + let plan_evaluation = match ks_lib::ExSafetyChecker.evaluate_prepared_plan(&plan) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if plan_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if plan_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_fixture_plan_denied", crate::violation_message(plan_evaluation.violations.as_slice()), )); @@ -420,14 +420,14 @@ async fn create_native_token_2022_metadata_mint( let latest_blockhash = match http_pool .get_latest_blockhash_for_role( options.query_role.as_str(), - &kb_onchain_transport::GetLatestBlockhashConfig::confirmed(), + &ks_onchain_transport::GetLatestBlockhashConfig::confirmed(), ) .await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let unsigned = match kb_lib::executor_solana_build_legacy_transaction( + let unsigned = match ks_lib::executor_solana_build_legacy_transaction( &plan, latest_blockhash.blockhash.as_str(), ) { @@ -438,8 +438,8 @@ async fn create_native_token_2022_metadata_mint( .get_fee_for_message_for_role( options.query_role.as_str(), unsigned.message_base64().as_str(), - &kb_onchain_transport::GetFeeForMessageConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + &ks_onchain_transport::GetFeeForMessageConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, std::option::Option::Some(latest_blockhash.context.slot), ), ) @@ -452,8 +452,8 @@ async fn create_native_token_2022_metadata_mint( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let simulation_config = match kb_onchain_transport::SimulateTransactionConfig::new( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let simulation_config = match ks_onchain_transport::SimulateTransactionConfig::new( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, false, false, std::option::Option::Some(latest_blockhash.context.slot), @@ -475,8 +475,8 @@ async fn create_native_token_2022_metadata_mint( std::result::Result::Err(error) => return std::result::Result::Err(error), }; let simulation = simulation_rpc.to_execution_result( - kb_lib::ExApiExecutionCluster::Devnet, - kb_lib::ExApiExecutionBlockhashKind::Latest, + ks_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionBlockhashKind::Latest, std::option::Option::Some( simulation_rpc.context.slot.saturating_sub(latest_blockhash.context.slot), ), @@ -485,17 +485,17 @@ async fn create_native_token_2022_metadata_mint( std::option::Option::Some(&fee), ); if !simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_fixture_simulation_failed", crate::simulation_failure_message(&simulation), )); } - let send_evaluation = match kb_lib::ExSafetyChecker.evaluate_send(&plan, &simulation) { + let send_evaluation = match ks_lib::ExSafetyChecker.evaluate_send(&plan, &simulation) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if send_evaluation.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if send_evaluation.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_fixture_send_denied", crate::violation_message(send_evaluation.violations.as_slice()), )); @@ -511,7 +511,7 @@ async fn create_native_token_2022_metadata_mint( return std::result::Result::Err(error); } let signature = signed.primary_signature().clone(); - let send_config = match kb_onchain_transport::SendTransactionConfig::from_execution_config( + let send_config = match ks_onchain_transport::SendTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(latest_blockhash.context.slot), ) { @@ -530,7 +530,7 @@ async fn create_native_token_2022_metadata_mint( return std::result::Result::Err(error); } let confirmation_config = - match kb_onchain_transport::ConfirmTransactionConfig::from_execution_config( + match ks_onchain_transport::ConfirmTransactionConfig::from_execution_config( &profile.execution, std::option::Option::Some(latest_blockhash.last_valid_block_height), std::option::Option::Some(latest_blockhash.context.slot), @@ -542,7 +542,7 @@ async fn create_native_token_2022_metadata_mint( .confirm_transaction_for_roles( options.transaction_role.as_str(), options.query_role.as_str(), - kb_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionCluster::Devnet, &signature, &confirmation_config, ) @@ -553,10 +553,10 @@ async fn create_native_token_2022_metadata_mint( }; if !matches!( confirmation.status, - kb_lib::ExApiExecutionConfirmationStatus::Confirmed - | kb_lib::ExApiExecutionConfirmationStatus::Finalized + ks_lib::ExApiExecutionConfirmationStatus::Confirmed + | ks_lib::ExApiExecutionConfirmationStatus::Finalized ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_fixture_confirmation_failed", format!("Token-2022 metadata mint preparation stopped at {:?}", confirmation.status), )); @@ -567,16 +567,16 @@ async fn create_native_token_2022_metadata_mint( fn planned_instruction( operation_code: &str, instruction: &solana_instruction::Instruction, -) -> kb_lib::ExApiPlannedInstruction { - return kb_lib::ExApiPlannedInstruction { - program_id: kb_lib::MdProgramId(instruction.program_id.to_string()), +) -> ks_lib::ExApiPlannedInstruction { + return ks_lib::ExApiPlannedInstruction { + program_id: ks_lib::MdProgramId(instruction.program_id.to_string()), operation_code: operation_code.to_string(), accounts: instruction .accounts .iter() .map(|account| { - return kb_lib::ExApiPlannedAccount { - pubkey: kb_lib::MdPubkey(account.pubkey.to_string()), + return ks_lib::ExApiPlannedAccount { + pubkey: ks_lib::MdPubkey(account.pubkey.to_string()), is_signer: account.is_signer, is_writable: account.is_writable, }; @@ -587,27 +587,27 @@ fn planned_instruction( } fn fixture_policy( - profile: &kb_config::ProfileConfig, - payer: kb_lib::MdPubkey, - mint: kb_lib::MdPubkey, + profile: &ks_config::ProfileConfig, + payer: ks_lib::MdPubkey, + mint: ks_lib::MdPubkey, _rent_lamports: u64, -) -> kb_lib::ExApiExecutionPolicy { - return kb_lib::ExApiExecutionPolicy { - cluster: kb_lib::ExApiExecutionClusterPolicy { - expected_cluster: kb_lib::ExApiExecutionCluster::Devnet, +) -> ks_lib::ExApiExecutionPolicy { + return ks_lib::ExApiExecutionPolicy { + cluster: ks_lib::ExApiExecutionClusterPolicy { + expected_cluster: ks_lib::ExApiExecutionCluster::Devnet, allow_mainnet: false, mainnet_confirmation: false, }, - simulation: kb_lib::ExApiExecutionSimulationPolicy::Required, - blockhash: kb_lib::ExApiExecutionBlockhashPolicy { - kind: kb_lib::ExApiExecutionBlockhashKind::Latest, + simulation: ks_lib::ExApiExecutionSimulationPolicy::Required, + blockhash: ks_lib::ExApiExecutionBlockhashPolicy { + kind: ks_lib::ExApiExecutionBlockhashKind::Latest, max_age_slots: std::option::Option::Some( profile.execution.recent_blockhash_max_age_slots, ), nonce_account: std::option::Option::None, nonce_authority: std::option::Option::None, }, - cost_limit: kb_lib::ExApiExecutionCostLimit { + cost_limit: ks_lib::ExApiExecutionCostLimit { max_spend_lamports: std::option::Option::Some( profile.execution.devnet_max_spend_lamports, ), @@ -618,7 +618,7 @@ fn fixture_policy( }, authorized_signers: std::vec![payer, mint], dry_run: false, - post_execution_validation: kb_lib::ExApiPostExecutionValidationPolicy { + post_execution_validation: ks_lib::ExApiPostExecutionValidationPolicy { canonical_insert_required: false, core_extraction_required: false, decode_replay_required: false, @@ -628,14 +628,14 @@ fn fixture_policy( } fn merge_fixture_instructions( - mut system_plan: kb_lib::ExApiPreparedExecutionPlan, - token_instructions: std::vec::Vec, - policy: kb_lib::ExApiExecutionPolicy, + mut system_plan: ks_lib::ExApiPreparedExecutionPlan, + token_instructions: std::vec::Vec, + policy: ks_lib::ExApiExecutionPolicy, rent_lamports: u64, -) -> kb_lib::ExApiPreparedExecutionPlan { +) -> ks_lib::ExApiPreparedExecutionPlan { system_plan.instructions.extend(token_instructions); system_plan.executor_name = - "kb-pipeline-demo-scenarios.token_2022_metadata_fixture".to_string(); + "ks-pipeline-demo-scenarios.token_2022_metadata_fixture".to_string(); system_plan.operation_code = "spl.token_2022.metadata.prepare_mint".to_string(); system_plan.policy = policy; system_plan.requested_spend_lamports = rent_lamports; diff --git a/kb-pipeline-demo-scenarios/src/spl/token_2022/metadata/validation.rs b/ks-pipeline-demo-scenarios/src/spl/token_2022/metadata/validation.rs similarity index 89% rename from kb-pipeline-demo-scenarios/src/spl/token_2022/metadata/validation.rs rename to ks-pipeline-demo-scenarios/src/spl/token_2022/metadata/validation.rs index a9ec8c7..7c8a27e 100644 --- a/kb-pipeline-demo-scenarios/src/spl/token_2022/metadata/validation.rs +++ b/ks-pipeline-demo-scenarios/src/spl/token_2022/metadata/validation.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/spl/token_2022/metadata/validation.rs -// version: 3 +// file: ks-pipeline-demo-scenarios/src/spl/token_2022/metadata/validation.rs +// version: 4 //! Conservative validation matrix for the `0.4.8-pre.012` Token Metadata campaign. @@ -60,7 +60,7 @@ pub struct Token2022MetadataValidationMatrix { /// Loads and validates the canonical Token Metadata Devnet matrix. pub fn load_token_2022_metadata_validation_matrix() --> kb_core::Result { +-> ks_core::Result { let matrix = match serde_json::from_str::( include_str!( "../../../../../test-fixtures/contract-matrices/SPL_TOKEN_2022_METADATA_DEVNET_VALIDATION_MATRIX.json" @@ -68,7 +68,7 @@ pub fn load_token_2022_metadata_validation_matrix() ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_validation_matrix_invalid_json", error.to_string(), )); @@ -83,18 +83,18 @@ pub fn load_token_2022_metadata_validation_matrix() /// Validates campaign coverage and prevents promotion without complete evidence. pub fn validate_token_2022_metadata_validation_matrix( matrix: &crate::Token2022MetadataValidationMatrix, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if matrix.matrix_version != 1 || matrix.milestone != "0.4.8-pre.012" - || matrix.program_id != kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID + || matrix.program_id != ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 metadata validation matrix identity is invalid", )); } let expected = crate::token_2022_metadata_campaign_operation_names(); if matrix.scenarios.len() != expected.len() { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Token-2022 metadata validation matrix requires exactly {} scenarios", expected.len() ))); @@ -102,13 +102,13 @@ pub fn validate_token_2022_metadata_validation_matrix( let mut ids = std::collections::BTreeSet::new(); for (index, scenario) in matrix.scenarios.iter().enumerate() { if !ids.insert(scenario.id.as_str()) { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "duplicate Token-2022 metadata validation scenario {}", scenario.id ))); } if scenario.operation != expected[index] { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Token-2022 metadata scenario {} expected operation {}, got {}", scenario.id, expected[index], scenario.operation ))); @@ -117,7 +117,7 @@ pub fn validate_token_2022_metadata_validation_matrix( || scenario.required_evidence.len() > MAX_TOKEN_2022_METADATA_VALIDATION_EVIDENCE || scenario.evidence.len() > MAX_TOKEN_2022_METADATA_VALIDATION_EVIDENCE { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Token-2022 metadata scenario {} has invalid evidence bounds", scenario.id ))); @@ -128,7 +128,7 @@ pub fn validate_token_2022_metadata_validation_matrix( .iter() .any(|kind| return kind.trim().is_empty() || !required.insert(kind.as_str())) { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Token-2022 metadata scenario {} has empty or duplicate required evidence", scenario.id ))); @@ -139,7 +139,7 @@ pub fn validate_token_2022_metadata_validation_matrix( || evidence.value.trim().is_empty() || !observed.insert(evidence.kind.as_str()) { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Token-2022 metadata scenario {} has invalid observed evidence", scenario.id ))); @@ -148,7 +148,7 @@ pub fn validate_token_2022_metadata_validation_matrix( match scenario.status { crate::Token2022MetadataValidationStatus::NotRun => { if !scenario.evidence.is_empty() { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "not-run Token-2022 metadata scenario {} cannot claim evidence", scenario.id ))); @@ -160,7 +160,7 @@ pub fn validate_token_2022_metadata_validation_matrix( .iter() .any(|kind| return !observed.contains(kind.as_str())) { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "confirmed Token-2022 metadata scenario {} is missing required evidence", scenario.id ))); @@ -168,7 +168,7 @@ pub fn validate_token_2022_metadata_validation_matrix( }, crate::Token2022MetadataValidationStatus::Unavailable => { if !observed.contains("unavailable_reason") { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "unavailable Token-2022 metadata scenario {} requires unavailable_reason", scenario.id ))); diff --git a/kb-pipeline-demo-scenarios/src/spl/token_2022/validation.rs b/ks-pipeline-demo-scenarios/src/spl/token_2022/validation.rs similarity index 94% rename from kb-pipeline-demo-scenarios/src/spl/token_2022/validation.rs rename to ks-pipeline-demo-scenarios/src/spl/token_2022/validation.rs index 9004687..7efd1d7 100644 --- a/kb-pipeline-demo-scenarios/src/spl/token_2022/validation.rs +++ b/ks-pipeline-demo-scenarios/src/spl/token_2022/validation.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline-demo-scenarios/src/spl/token_2022/validation.rs -// version: 7 +// file: ks-pipeline-demo-scenarios/src/spl/token_2022/validation.rs +// version: 8 //! Machine-readable validation evidence contract for the Token-2022 milestone. @@ -110,13 +110,13 @@ pub struct Token2022ValidationMatrixScenario { } /// Loads and validates the canonical Token-2022 validation matrix. -pub fn load_token_2022_validation_matrix() -> kb_core::Result { +pub fn load_token_2022_validation_matrix() -> ks_core::Result { let parsed = match serde_json::from_str::(include_str!( "../../../../test-fixtures/contract-matrices/SPL_TOKEN_2022_VALIDATION_MATRIX.json" )) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_validation_matrix_invalid_json", format!("Token-2022 validation matrix JSON is invalid: {error}"), )); @@ -131,9 +131,9 @@ pub fn load_token_2022_validation_matrix() -> kb_core::Result kb_core::Result<()> { +) -> ks_core::Result<()> { if matrix.matrix_version != 2 || matrix.milestone != "0.4.6" { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_validation_matrix_contract_mismatch", "Token-2022 validation matrix must use version 2 for milestone 0.4.6", )); @@ -146,7 +146,7 @@ pub fn validate_token_2022_validation_matrix( .map(|status| return status.as_str()) .collect::>(); if actual_statuses.as_slice() != expected_statuses { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_validation_matrix_status_vocabulary_mismatch", "Token-2022 validation status vocabulary differs from the compiled contract", )); @@ -168,7 +168,7 @@ pub fn validate_token_2022_validation_matrix( .map(|scenario| return scenario.id.as_str()) .collect::>(); if actual_ids.as_slice() != expected_ids { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_validation_matrix_scenario_inventory_mismatch", "Token-2022 validation scenario inventory or order differs from the compiled contract", )); @@ -177,7 +177,7 @@ pub fn validate_token_2022_validation_matrix( if scenario.required_evidence.is_empty() || scenario.required_evidence.len() > crate::MAX_TOKEN_2022_VALIDATION_EVIDENCE { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_validation_matrix_required_evidence_invalid", "Every Token-2022 validation scenario must declare bounded required evidence", )); @@ -185,7 +185,7 @@ pub fn validate_token_2022_validation_matrix( let mut required = std::collections::BTreeSet::<&str>::new(); for evidence_kind in &scenario.required_evidence { if evidence_kind.trim().is_empty() || !required.insert(evidence_kind.as_str()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_validation_matrix_required_evidence_invalid", "Required Token-2022 validation evidence must be non-empty and unique", )); @@ -198,7 +198,7 @@ pub fn validate_token_2022_validation_matrix( .map(|evidence| return evidence.kind.as_str()) .collect::>(); if !required.iter().all(|kind| return observed.contains(kind)) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_validation_matrix_confirmed_without_required_evidence", format!( "Confirmed Token-2022 validation scenario {} lacks required evidence", @@ -212,7 +212,7 @@ pub fn validate_token_2022_validation_matrix( | crate::Token2022ValidationStatus::Unavailable ) && !scenario.evidence.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_validation_matrix_unobserved_with_evidence", "Not-run or unavailable Token-2022 scenarios must not retain observed evidence", )); @@ -231,22 +231,22 @@ pub struct Token2022ValidationReport { /// Validates that a milestone report is bounded, unique, and does not overclaim evidence. pub fn validate_token_2022_validation_report( report: &crate::Token2022ValidationReport, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if report.scenarios.is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 validation report must contain at least one scenario", )); } let mut ids = std::collections::BTreeSet::::new(); for scenario in &report.scenarios { if scenario.id.trim().is_empty() || !ids.insert(scenario.id.clone()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_validation_scenario_identity_invalid", "Token-2022 validation scenario ids must be non-empty and unique", )); } if scenario.evidence.len() > crate::MAX_TOKEN_2022_VALIDATION_EVIDENCE { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_validation_evidence_limit_exceeded", format!( "Token-2022 validation accepts at most {} evidence records per scenario", @@ -256,7 +256,7 @@ pub fn validate_token_2022_validation_report( } for evidence in &scenario.evidence { if evidence.kind.trim().is_empty() || evidence.value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_validation_evidence_invalid", "Token-2022 validation evidence kind and value must be non-empty", )); @@ -270,7 +270,7 @@ pub fn validate_token_2022_validation_report( | crate::Token2022ValidationStatus::Failed ); if completed && scenario.evidence.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_validation_completed_without_evidence", "A completed Token-2022 validation scenario must retain evidence", )); @@ -283,7 +283,7 @@ pub fn validate_token_2022_validation_report( || scenario.requires_second_replay) && !has_pipeline_evidence(scenario) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_validation_confirmed_without_pipeline_evidence", "A confirmed end-to-end Token-2022 scenario must retain hydration, extraction, replay, materialization, and idempotence evidence", )); diff --git a/kb-pipeline-demo-scenarios/tests/external_metadata_solana_program_scenarios_api.rs b/ks-pipeline-demo-scenarios/tests/external_metadata_solana_program_scenarios_api.rs similarity index 68% rename from kb-pipeline-demo-scenarios/tests/external_metadata_solana_program_scenarios_api.rs rename to ks-pipeline-demo-scenarios/tests/external_metadata_solana_program_scenarios_api.rs index 9acf725..adf317c 100644 --- a/kb-pipeline-demo-scenarios/tests/external_metadata_solana_program_scenarios_api.rs +++ b/ks-pipeline-demo-scenarios/tests/external_metadata_solana_program_scenarios_api.rs @@ -1,13 +1,13 @@ -// file: kb-pipeline-demo-scenarios/tests/external_metadata_solana_program_scenarios_api.rs -// version: 2 +// file: ks-pipeline-demo-scenarios/tests/external_metadata_solana_program_scenarios_api.rs +// version: 3 //! Public API regression test for Solana Program Metadata Devnet scenarios. #[test] fn external_consumers_use_only_public_solana_program_metadata_scenario_exports() { - let scenarios = kb_pipeline_demo_scenarios::solana_program_metadata_devnet_scenarios(); + let scenarios = ks_pipeline_demo_scenarios::solana_program_metadata_devnet_scenarios(); assert_eq!(scenarios.len(), 2); - let matrix = match kb_pipeline_demo_scenarios::load_solana_program_metadata_validation_matrix() + let matrix = match ks_pipeline_demo_scenarios::load_solana_program_metadata_validation_matrix() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { @@ -15,28 +15,28 @@ fn external_consumers_use_only_public_solana_program_metadata_scenario_exports() }, }; assert_eq!(matrix.operations.len(), 9); - let wallet = kb_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([3_u8; 32]).to_string()); - let operation = kb_lib::ExMetadataSpmOperation::Extend { + let wallet = ks_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([3_u8; 32]).to_string()); + let operation = ks_lib::ExMetadataSpmOperation::Extend { account: wallet.clone(), authority: wallet.clone(), length: 1, program_context: std::option::Option::None, }; - let mut request = kb_pipeline_demo_scenarios::DevnetSolanaProgramMetadataExecutionRequest::new( + let mut request = ks_pipeline_demo_scenarios::DevnetSolanaProgramMetadataExecutionRequest::new( "external-spm", operation.clone(), ); request .preflight_reads - .push(kb_pipeline::SolanaProgramMetadataStatefulReadRequest { + .push(ks_pipeline::SolanaProgramMetadataStatefulReadRequest { query_role: "http_queries".to_string(), account: wallet.clone(), - expected_state: kb_pipeline::SolanaProgramMetadataExpectedAccountState::Buffer, + expected_state: ks_pipeline::SolanaProgramMetadataExpectedAccountState::Buffer, min_context_slot: std::option::Option::None, - max_data_bytes: kb_pipeline::MAX_SOLANA_PROGRAM_METADATA_STATEFUL_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_SOLANA_PROGRAM_METADATA_STATEFUL_ACCOUNT_BYTES, }); assert!(request.validate().is_ok()); - let step = kb_pipeline_demo_scenarios::SolanaProgramMetadataPreparedStep { + let step = ks_pipeline_demo_scenarios::SolanaProgramMetadataPreparedStep { scenario_id: "external".to_string(), step_id: "extend".to_string(), step_index: 0, @@ -48,10 +48,10 @@ fn external_consumers_use_only_public_solana_program_metadata_scenario_exports() }; assert_eq!(step.execution_request("prepared").intent_id, "prepared"); let fixture_options = - kb_pipeline_demo_scenarios::SolanaProgramMetadataFixturePreparationOptions::new(); + ks_pipeline_demo_scenarios::SolanaProgramMetadataFixturePreparationOptions::new(); assert_eq!(fixture_options.query_role, "http_queries"); assert_eq!( - kb_pipeline_demo_scenarios::SOLANA_PROGRAM_METADATA_FIXTURE_BUFFER_DATA_BYTES, + ks_pipeline_demo_scenarios::SOLANA_PROGRAM_METADATA_FIXTURE_BUFFER_DATA_BYTES, 128 ); } diff --git a/kb-pipeline/CHANGELOG.md b/ks-pipeline/CHANGELOG.md similarity index 91% rename from kb-pipeline/CHANGELOG.md rename to ks-pipeline/CHANGELOG.md index 3147fa1..f7589e2 100644 --- a/kb-pipeline/CHANGELOG.md +++ b/ks-pipeline/CHANGELOG.md @@ -1,7 +1,13 @@ - - + + -# CHANGELOG — kb-pipeline +# CHANGELOG — ks-pipeline + +## `0.5.1-pre.002` + +- renomme `kb-pipeline` en `ks-pipeline` et `kb_pipeline` en `ks_pipeline` ; +- aligne son target racine de tracing et les descripteurs de crate directement liés au package ; +- conserve les identités d'exécuteurs/décodeurs `kb-lib.*` jusqu'à `pre.003`. ## `0.4.8-pre.015` @@ -11,7 +17,7 @@ ## `0.4.8-pre.013` -- `pre.013-delta-fix-031` expose `MetaplexTokenMetadataAccountKind::TokenOwnedEscrow` dans les lectures stateful et réutilise le décodeur strict déjà présent dans `kb-lib`, y compris validation du propriétaire, du discriminant, du PDA d’autorité et du bump ; +- `pre.013-delta-fix-031` expose `MetaplexTokenMetadataAccountKind::TokenOwnedEscrow` dans les lectures stateful et réutilise le décodeur strict déjà présent dans `ks-lib`, y compris validation du propriétaire, du discriminant, du PDA d’autorité et du bump ; - ajoute une régression de projection canonique pour un escrow `TokenOwner` et conserve `base_token`, `authority_kind`, `creator` et `stored_bump` comme postconditions queryables. - `pre.013-delta-fix-030` conserve les simulations Metaplex exactes échouées comme résultats observables lorsque `submit=false`, afin que les probes de disponibilité puissent classifier un refus runtime sans le transformer en erreur d'orchestration ; - maintient une barrière stricte pour toute soumission : `submit=true` exige toujours `simulation_succeeded=true`, et une simulation négative ne peut jamais produire `send_authorized=true` ; @@ -25,7 +31,7 @@ - la projection stateful conserve le groupe, l’index de bit, le masque, `edition_taken`, le ledger borné et le payload canonique sans inventer de sémantique de fermeture après burn. ## `0.4.8-pre.013` — borne stateful Metaplex -- aligne `MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES` sur `kb_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES`, soit `65536` octets pour une lecture complète `getAccountInfo` ; +- aligne `MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES` sur `ks_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES`, soit `65536` octets pour une lecture complète `getAccountInfo` ; - valide la borne dans `MetaplexTokenMetadataStatefulReadRequest` avant la construction de la requête RPC ; - conserve séparées les bornes de décodage offline et la borne du transport d'exécution ; - ajoute une régression empêchant de réintroduire une limite stateful supérieure au contrat du transport. @@ -48,10 +54,10 @@ ## 0.4.8-pre.008 — orchestration Solana Program Metadata généraliste -- ajoute les lectures de comptes `Buffer` et `Metadata` bornées, avec décodage et projection autoritative délégués à `kb-lib` ; +- ajoute les lectures de comptes `Buffer` et `Metadata` bornées, avec décodage et projection autoritative délégués à `ks-lib` ; - ajoute le préflight stateful des neuf opérations stables, les preuves de préfinancement rent et l’évaluation commune par `ExSafetyChecker` ; - ajoute la readiness simulation-first, la résolution des signers et les postconditions confirmées sans transformer une absence de lecture en succès ; -- publie la matrice `METADATA_SOLANA_PROGRAM_PIPELINE_MATRIX.json` et maintient une frontière stricte avec les fixtures et scénarios Devnet de `kb-pipeline-demo-scenarios` ; +- publie la matrice `METADATA_SOLANA_PROGRAM_PIPELINE_MATRIX.json` et maintient une frontière stricte avec les fixtures et scénarios Devnet de `ks-pipeline-demo-scenarios` ; - renomme les modules internes selon la hiérarchie de domaine : `metadata_*` pour Metaplex et Solana Program Metadata, `spl_*` pour ATA, ElGamal Registry, Token et Token-2022, tout en conservant les fonctions publiques existantes ; - remplace les assertions runtime sur constantes du test d’API externe par des assertions `const`, afin de rester propre sous Clippy. @@ -65,7 +71,7 @@ ### Documentation - réorganisation des quatre documents de crate ; -- clarification que les campagnes Devnet appartiennent à `kb-pipeline-demo-scenarios`, tandis que `kb-pipeline` reste généraliste et indépendant des scénarios. +- clarification que les campagnes Devnet appartiennent à `ks-pipeline-demo-scenarios`, tandis que `ks-pipeline` reste généraliste et indépendant des scénarios. ## 0.4.7-pre.007 — orchestration Metaplex généraliste diff --git a/kb-pipeline/Cargo.toml b/ks-pipeline/Cargo.toml similarity index 66% rename from kb-pipeline/Cargo.toml rename to ks-pipeline/Cargo.toml index fcc24fd..9ee71f3 100644 --- a/kb-pipeline/Cargo.toml +++ b/ks-pipeline/Cargo.toml @@ -1,8 +1,8 @@ -# file: kb-pipeline/Cargo.toml -# version: 15 +# file: ks-pipeline/Cargo.toml +# version: 16 [package] -name = "kb-pipeline" +name = "ks-pipeline" version.workspace = true edition.workspace = true license.workspace = true @@ -14,12 +14,12 @@ base64.workspace = true bs58.workspace = true chrono.workspace = true futures-util.workspace = true -kb-core = { path = "../kb-core" } -kb-config = { path = "../kb-config" } -kb-lib = { path = "../kb-lib" } -kb-onchain-transport = { path = "../kb-onchain-transport" } -kb-program-ids = { path = "../kb-program-ids" } -kb-store = { path = "../kb-store" } +ks-core = { path = "../ks-core" } +ks-config = { path = "../ks-config" } +ks-lib = { path = "../ks-lib" } +ks-onchain-transport = { path = "../ks-onchain-transport" } +ks-program-ids = { path = "../ks-program-ids" } +ks-store = { path = "../ks-store" } serde.workspace = true serde_json.workspace = true solana-address-lookup-table-interface.workspace = true diff --git a/kb-pipeline/README.md b/ks-pipeline/README.md similarity index 87% rename from kb-pipeline/README.md rename to ks-pipeline/README.md index 43d3b59..e63c383 100644 --- a/kb-pipeline/README.md +++ b/ks-pipeline/README.md @@ -1,9 +1,9 @@ - - + + -# kb-pipeline +# ks-pipeline -`kb-pipeline` est le pipeline généraliste de `khadhroony-bot3`. Il coordonne les transports, le stockage et `kb-lib` sans dépendre d’un scénario de démonstration ni d’un cluster particulier. +`ks-pipeline` est le pipeline généraliste de `khadhroony-bot3`. Il coordonne les transports, le stockage et `ks-lib` sans dépendre d’un scénario de démonstration ni d’un cluster particulier. ## Responsabilités @@ -36,13 +36,13 @@ Pour Solana Program Metadata, elle expose les mêmes frontières réutilisables - `validate_solana_program_metadata_execution_readiness` ; - `inspect_solana_program_metadata_post_execution`. -Les fichiers internes suivent la même nomenclature que `kb-lib` : préfixe `metadata_` pour les programmes metadata, préfixe `spl_` pour les programmes SPL et préfixe `solana_` uniquement pour les contrats Solana Core transversaux. Les noms des fonctions publiques sont conservés pour éviter une rupture d’API. +Les fichiers internes suivent la même nomenclature que `ks-lib` : préfixe `metadata_` pour les programmes metadata, préfixe `spl_` pour les programmes SPL et préfixe `solana_` uniquement pour les contrats Solana Core transversaux. Les noms des fonctions publiques sont conservés pour éviter une rupture d’API. Voir [USAGE.md](USAGE.md) pour les exemples et invariants. ## Relations avec le workspace -La crate coordonne `kb-onchain-transport`, `kb-store`, `kb-lib`, `kb-core` et `kb-program-ids`. Elle ne dépend jamais de `kb-pipeline-demo-scenarios` ni de `kb-app-demo-desktop`. Les fixtures, wallets temporaires et appels RPC de démonstration appartiennent aux scénarios ou aux applications qui consomment ces contrats. +La crate coordonne `ks-onchain-transport`, `ks-store`, `ks-lib`, `ks-core` et `ks-program-ids`. Elle ne dépend jamais de `ks-pipeline-demo-scenarios` ni de `kb-app-demo-desktop`. Les fixtures, wallets temporaires et appels RPC de démonstration appartiennent aux scénarios ou aux applications qui consomment ces contrats. ## Documentation diff --git a/kb-pipeline/TODO.md b/ks-pipeline/TODO.md similarity index 87% rename from kb-pipeline/TODO.md rename to ks-pipeline/TODO.md index bae1b5c..6219463 100644 --- a/kb-pipeline/TODO.md +++ b/ks-pipeline/TODO.md @@ -1,11 +1,11 @@ - - + + -# TODO — kb-pipeline +# TODO — ks-pipeline ## Réaudit ultérieur des surfaces historiques -- [ ] Version à déterminer - après le réaudit des exécuteurs Solana Core et SPL dans `kb-lib`, vérifier que le pipeline orchestre sans filtrage implicite les opérations courantes et les opérations obsolètes explicitement approuvées. +- [ ] Version à déterminer - après le réaudit des exécuteurs Solana Core et SPL dans `ks-lib`, vérifier que le pipeline orchestre sans filtrage implicite les opérations courantes et les opérations obsolètes explicitement approuvées. - [ ] Préflight et diagnostics - propager les remplacements canoniques, avertissements de dépréciation et approbations opérateur des surfaces réauditées. - [ ] Tests - ajouter les cas pipeline nécessaires aux opérations dépréciées réintroduites, sans créer de chemin pour les versions remplacées intermédiaires. diff --git a/kb-pipeline/USAGE.md b/ks-pipeline/USAGE.md similarity index 77% rename from kb-pipeline/USAGE.md rename to ks-pipeline/USAGE.md index 29a46ca..46371fe 100644 --- a/kb-pipeline/USAGE.md +++ b/ks-pipeline/USAGE.md @@ -1,11 +1,11 @@ - - + + -# Utilisation de kb-pipeline +# Utilisation de ks-pipeline ## Lecture stateful des Edition Markers Metaplex -Les lectures stateful `Edition` acceptent les allocations Metaplex courantes après validation par `kb-lib`. Un `Print` récent produit notamment une allocation compacte de 42 octets alors que la structure Borsh `Edition` sérialise 41 octets ; le pipeline ne recalcule pas cette règle et consomme uniquement le snapshot déjà validé par le décodeur. Les erreurs de décodage stateful conservent l’adresse et le `kind` demandés pour localiser la postcondition fautive. +Les lectures stateful `Edition` acceptent les allocations Metaplex courantes après validation par `ks-lib`. Un `Print` récent produit notamment une allocation compacte de 42 octets alors que la structure Borsh `Edition` sérialise 41 octets ; le pipeline ne recalcule pas cette règle et consomme uniquement le snapshot déjà validé par le décodeur. Les erreurs de décodage stateful conservent l’adresse et le `kind` demandés pour localiser la postcondition fautive. Les campagnes d’éditions imprimées peuvent demander un snapshot borné `EditionMarker` en fournissant le mint maître et le numéro d’édition. Le pipeline dérive et vérifie le contrat du compte via le décodeur Metaplex existant, puis expose notamment `marker_group`, `edition`, `byte_index`, `bit_mask`, `edition_taken` et le ledger. Cette lecture sert à prouver qu’un numéro d’édition a été consommé ; elle ne suppose pas que le marker est fermé lors d’un burn. La validation de requête contrôle aussi les pubkeys utilisées pour les dérivations `Edition`, `EditionMarker` et `TokenRecord` avant tout accès RPC. @@ -16,9 +16,9 @@ La crate expose les campagnes bornées d’acquisition, d’extraction, de repla ## Valider une requête d’extraction Core ```rust -fn validate_pending_extraction() -> kb_core::Result<()> { - let request = kb_pipeline::CoreExtractionRequest { - source: kb_pipeline::CoreExtractionSource::Pending, +fn validate_pending_extraction() -> ks_core::Result<()> { + let request = ks_pipeline::CoreExtractionRequest { + source: ks_pipeline::CoreExtractionSource::Pending, limit: 1_000, max_concurrent_extractions: 4, force_replay: false, @@ -36,15 +36,15 @@ Une extraction ciblée peut utiliser `CoreExtractionSource::Signatures`, `SlotRa async fn run_core_extraction( store: &S, observer: &O, - request: kb_pipeline::CoreExtractionRequest, -) -> kb_core::Result + request: ks_pipeline::CoreExtractionRequest, +) -> ks_core::Result where - S: kb_store::CanonicalTransactionStore - + kb_store::CoreExtractionStore + S: ks_store::CanonicalTransactionStore + + ks_store::CoreExtractionStore + Sync, - O: kb_pipeline::CoreExtractionObserver, + O: ks_pipeline::CoreExtractionObserver, { - let result = kb_pipeline::execute_core_extraction(store, observer, request).await; + let result = ks_pipeline::execute_core_extraction(store, observer, request).await; match result { Ok(summary) => Ok(summary), @@ -57,13 +57,13 @@ where ```rust fn validate_decode_request( - selection: kb_store::DecodeSelectionFilter, -) -> kb_core::Result<()> { - let request = kb_pipeline::DecodeReplayRequest { + selection: ks_store::DecodeSelectionFilter, +) -> ks_core::Result<()> { + let request = ks_pipeline::DecodeReplayRequest { campaign_id: "manual-replay-001".to_string(), selection, decoder_names: Vec::new(), - dispatch_policy: kb_pipeline::DecodeDispatchPolicy::HighestPriority, + dispatch_policy: ks_pipeline::DecodeDispatchPolicy::HighestPriority, max_concurrent_inputs: 4, force_replay: false, force_replay_all_matching: false, @@ -82,15 +82,15 @@ Une liste vide dans `decoder_names` signifie que tous les décodeurs fournis à async fn run_decode_replay( store: &S, observer: &O, - request: kb_pipeline::DecodeReplayRequest, - decoders: &[&dyn kb_lib::MdApiInstructionDecoder], - materializers: &[&dyn kb_lib::MdApiEventMaterializer], -) -> kb_core::Result + request: ks_pipeline::DecodeReplayRequest, + decoders: &[&dyn ks_lib::MdApiInstructionDecoder], + materializers: &[&dyn ks_lib::MdApiEventMaterializer], +) -> ks_core::Result where - S: kb_store::DecodeReplayStore + Sync, - O: kb_pipeline::DecodeReplayObserver, + S: ks_store::DecodeReplayStore + Sync, + O: ks_pipeline::DecodeReplayObserver, { - let result = kb_pipeline::execute_decode_replay( + let result = ks_pipeline::execute_decode_replay( store, observer, request, @@ -114,13 +114,13 @@ La surface principale utilise `BackfillRequest`, `BackfillObserver`, `execute_ht async fn run_backfill( store: &S, observer: &O, - request: kb_pipeline::BackfillRequest, -) -> kb_core::Result + request: ks_pipeline::BackfillRequest, +) -> ks_core::Result where - S: kb_store::CanonicalTransactionStore + Sync, - O: kb_pipeline::BackfillObserver, + S: ks_store::CanonicalTransactionStore + Sync, + O: ks_pipeline::BackfillObserver, { - let result = kb_pipeline::execute_http_backfill(store, observer, request).await; + let result = ks_pipeline::execute_http_backfill(store, observer, request).await; match result { Ok(summary) => Ok(summary), @@ -142,12 +142,12 @@ Les familles publiques comprennent : ```rust async fn inspect_classic_token( store: &S, - request: kb_pipeline::SplTokenStatefulReadinessRequest, -) -> kb_core::Result + request: ks_pipeline::SplTokenStatefulReadinessRequest, +) -> ks_core::Result where - S: kb_store::CanonicalTransactionStore + Sync, + S: ks_store::CanonicalTransactionStore + Sync, { - let result = kb_pipeline::inspect_spl_token_stateful_readiness(store, request).await; + let result = ks_pipeline::inspect_spl_token_stateful_readiness(store, request).await; match result { Ok(report) => Ok(report), @@ -180,23 +180,23 @@ La validation historique reste un enchaînement de surfaces généralistes, pas 4. `materializeAfterDecode` active `materializer.metadata.solana_program_metadata` ; 5. la requête bornée des événements matérialisés permet de vérifier les faits produits. -Le registre générique du desktop fournit désormais ce décodeur et ce matérialiseur. `kb-pipeline-demo-scenarios` n’intervient pas dans ce parcours historique. +Le registre générique du desktop fournit désormais ce décodeur et ce matérialiseur. `ks-pipeline-demo-scenarios` n’intervient pas dans ce parcours historique. ## Lire et prévalider Solana Program Metadata ```rust async fn read_program_metadata( - pool: &kb_onchain_transport::HttpEndpointPool, - account: kb_lib::MdPubkey, -) -> kb_core::Result { - let request = kb_pipeline::SolanaProgramMetadataStatefulReadRequest { + pool: &ks_onchain_transport::HttpEndpointPool, + account: ks_lib::MdPubkey, +) -> ks_core::Result { + let request = ks_pipeline::SolanaProgramMetadataStatefulReadRequest { query_role: "rpc".to_string(), account, - expected_state: kb_pipeline::SolanaProgramMetadataExpectedAccountState::Any, + expected_state: ks_pipeline::SolanaProgramMetadataExpectedAccountState::Any, min_context_slot: std::option::Option::None, - max_data_bytes: kb_pipeline::MAX_SOLANA_PROGRAM_METADATA_STATEFUL_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_SOLANA_PROGRAM_METADATA_STATEFUL_ACCOUNT_BYTES, }; - let result = kb_pipeline::read_solana_program_metadata_stateful_snapshot(pool, &request).await; + let result = ks_pipeline::read_solana_program_metadata_stateful_snapshot(pool, &request).await; return match result { std::result::Result::Ok(value) => std::result::Result::Ok(value), @@ -236,7 +236,7 @@ Les campagnes longues exposent des traits d’observation distincts pour le back - la crate orchestre les traitements mais ne fournit pas d’interface opérateur ; - elle ne conserve pas de secret de wallet ; -- elle ne remplace pas les scénarios Devnet et validations explicites de `kb-pipeline-demo-scenarios`. +- elle ne remplace pas les scénarios Devnet et validations explicites de `ks-pipeline-demo-scenarios`. ## Lire un compte Metaplex Token Metadata @@ -244,17 +244,17 @@ La lecture stateful exige un endpoint HTTP, une catégorie de compte explicite e ```rust async fn read_metaplex_metadata( - pool: &kb_onchain_transport::HttpEndpointPool, - metadata: kb_lib::MdPubkey, -) -> kb_core::Result { - let request = kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { + pool: &ks_onchain_transport::HttpEndpointPool, + metadata: ks_lib::MdPubkey, +) -> ks_core::Result { + let request = ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: "rpc".to_string(), account: metadata, - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::Metadata, + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::Metadata, min_context_slot: std::option::Option::None, - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }; - let result = kb_pipeline::read_metaplex_token_metadata_stateful_snapshot( + let result = ks_pipeline::read_metaplex_token_metadata_stateful_snapshot( pool, &request, ) @@ -269,29 +269,29 @@ async fn read_metaplex_metadata( Pour une edition, fournir le mint dans `MetaplexTokenMetadataAccountKind::Edition`. Pour un token record programmable, fournir le mint et le token account dans `TokenRecord`. Pour un Token Owned Escrow, utiliser `TokenOwnedEscrow` : le décodeur récupère le mint parent et l’autorité depuis le compte, puis valide lui-même le PDA et le bump avant projection stateful. -`MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES` représente la borne d'une lecture RPC complète et suit `kb_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES`, soit actuellement `65536` octets. Cette borne stateful ne doit pas être confondue avec les bornes propres aux décodeurs pour des octets déjà disponibles offline ou avec un futur lecteur par tranches. +`MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES` représente la borne d'une lecture RPC complète et suit `ks_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES`, soit actuellement `65536` octets. Cette borne stateful ne doit pas être confondue avec les bornes propres aux décodeurs pour des octets déjà disponibles offline ou avec un futur lecteur par tranches. ## Inspecter le préflight Metaplex -Le préflight lie un plan préparé par `kb-lib` à des snapshots confirmés et applique la politique des opérations dépréciées. +Le préflight lie un plan préparé par `ks-lib` à des snapshots confirmés et applique la politique des opérations dépréciées. ```rust fn inspect_metaplex_preflight( - plan: kb_lib::ExApiPreparedExecutionPlan, - snapshots: Vec, + plan: ks_lib::ExApiPreparedExecutionPlan, + snapshots: Vec, allow_deprecated_operation: bool, -) -> kb_core::Result { - let request = kb_pipeline::MetaplexTokenMetadataPreflightRequest { +) -> ks_core::Result { + let request = ks_pipeline::MetaplexTokenMetadataPreflightRequest { plan, snapshots, allow_deprecated_operation, }; - kb_pipeline::inspect_metaplex_token_metadata_preflight(&request) + ks_pipeline::inspect_metaplex_token_metadata_preflight(&request) } ``` -Une opération marquée dépréciée par `kb-lib` est refusée lorsque `allow_deprecated_operation` vaut `false`. +Une opération marquée dépréciée par `ks-lib` est refusée lorsque `allow_deprecated_operation` vaut `false`. ### Exigences stateful par famille @@ -311,12 +311,12 @@ L’orchestration refuse la signature ou la soumission tant que la simulation ex ```rust fn validate_metaplex_execution( - plan: kb_lib::ExApiPreparedExecutionPlan, - preflight: kb_pipeline::MetaplexTokenMetadataPreflightReport, + plan: ks_lib::ExApiPreparedExecutionPlan, + preflight: ks_pipeline::MetaplexTokenMetadataPreflightReport, message_hash: String, - resolved_signers: Vec, -) -> kb_core::Result { - let request = kb_pipeline::MetaplexTokenMetadataExecutionReadinessRequest { + resolved_signers: Vec, +) -> ks_core::Result { + let request = ks_pipeline::MetaplexTokenMetadataExecutionReadinessRequest { plan, preflight, message_hash: message_hash.clone(), @@ -328,7 +328,7 @@ fn validate_metaplex_execution( operator_confirmed: false, }; - kb_pipeline::validate_metaplex_token_metadata_execution_readiness(&request) + ks_pipeline::validate_metaplex_token_metadata_execution_readiness(&request) } ``` @@ -340,9 +340,9 @@ Une requête `submit=false` peut conserver une simulation exacte ayant échoué ```rust fn summarize_metaplex_postconditions( - statuses: &[kb_pipeline::MetaplexTokenMetadataPostconditionStatus], -) -> kb_pipeline::MetaplexTokenMetadataPostconditionStatus { - kb_pipeline::summarize_metaplex_token_metadata_postconditions(statuses) + statuses: &[ks_pipeline::MetaplexTokenMetadataPostconditionStatus], +) -> ks_pipeline::MetaplexTokenMetadataPostconditionStatus { + ks_pipeline::summarize_metaplex_token_metadata_postconditions(statuses) } ``` @@ -350,7 +350,7 @@ fn summarize_metaplex_postconditions( ## Orchestration des scénarios Metaplex -`kb-pipeline-demo-scenarios` expose des parcours déclaratifs plutôt que cent combinaisons forcées. Chaque parcours déclare : +`ks-pipeline-demo-scenarios` expose des parcours déclaratifs plutôt que cent combinaisons forcées. Chaque parcours déclare : - la famille d’asset ; - la fixture requise ; diff --git a/kb-pipeline/src/backfill.rs b/ks-pipeline/src/backfill.rs similarity index 95% rename from kb-pipeline/src/backfill.rs rename to ks-pipeline/src/backfill.rs index 4a8318c..5ed06ed 100644 --- a/kb-pipeline/src/backfill.rs +++ b/ks-pipeline/src/backfill.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/backfill.rs -// version: 10 +// file: ks-pipeline/src/backfill.rs +// version: 11 //! Reusable HTTP transaction backfill orchestration. @@ -92,42 +92,42 @@ pub struct BackfillRequest { impl BackfillRequest { /// Validates request bounds and source identifiers. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "backfill endpoint role must not be empty", )); } let transaction_config_result = - kb_onchain_transport::GetTransactionConfig::new(self.commitment.clone(), 0); + ks_onchain_transport::GetTransactionConfig::new(self.commitment.clone(), 0); if let std::result::Result::Err(error) = transaction_config_result { return std::result::Result::Err(error); } if self.page_size == 0 || self.page_size > 1000 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "backfill page size must be between 1 and 1000", )); } if self.max_pages == 0 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "backfill max pages must be greater than zero", )); } if self.max_concurrent_requests == 0 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "backfill concurrency must be greater than zero", )); } match &self.source { crate::BackfillSource::ExplicitSignatures(signatures) => { if signatures.is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "explicit signature backfill requires at least one signature", )); } for signature in signatures { let validation_result = - kb_onchain_transport::validate_transaction_signature_text( + ks_onchain_transport::validate_transaction_signature_text( signature.as_str(), "explicit backfill signature", ); @@ -143,7 +143,7 @@ impl BackfillRequest { limit, .. } => { - let address_result = kb_onchain_transport::validate_solana_pubkey_text( + let address_result = ks_onchain_transport::validate_solana_pubkey_text( address.as_str(), "backfill history address", ); @@ -152,7 +152,7 @@ impl BackfillRequest { } if let std::option::Option::Some(signature) = anchor_signature { let signature_result = - kb_onchain_transport::validate_transaction_signature_text( + ks_onchain_transport::validate_transaction_signature_text( signature.as_str(), "backfill anchor signature", ); @@ -160,12 +160,12 @@ impl BackfillRequest { return std::result::Result::Err(error); } } else if *direction == crate::BackfillDirection::After { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "newer address history backfill requires an anchor signature", )); } if *limit == 0 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "address history backfill limit must be greater than zero", )); } @@ -411,7 +411,7 @@ impl CandidateOutcome { #[derive(Debug)] struct CandidateTaskResult { index: usize, - result: kb_core::Result, + result: ks_core::Result, } #[derive(Debug)] @@ -444,13 +444,13 @@ impl CandidateCompletionFrontier { /// Executes one bounded HTTP backfill and persists canonical transactions plus observations. pub async fn execute_http_backfill( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, store: &S, request: &crate::BackfillRequest, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore + Sync, + S: ks_store::RawTransactionStore + Sync, O: crate::BackfillObserver + Sync, { let validation_result = request.validate(); @@ -553,7 +553,7 @@ where ); let pacer = std::sync::Arc::new(RequestPacer::new(transaction_limits.requests_per_second)); let transaction_config_result = - kb_onchain_transport::GetTransactionConfig::new(request.commitment.clone(), 0); + ks_onchain_transport::GetTransactionConfig::new(request.commitment.clone(), 0); let transaction_config = match transaction_config_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -741,10 +741,10 @@ struct CandidateDiscovery { } async fn collect_candidates( - http_pool: &kb_onchain_transport::HttpEndpointPool, + http_pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::BackfillRequest, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where O: crate::BackfillObserver + Sync, { @@ -797,7 +797,7 @@ where match anchor_signature.as_deref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "newer address history backfill requires an anchor signature", )); }, @@ -836,7 +836,7 @@ fn explicit_candidates(signatures: &[std::string::String]) -> CandidateDiscovery } async fn collect_before_candidates( - client: &kb_onchain_transport::HttpClient, + client: &ks_onchain_transport::HttpClient, request: &crate::BackfillRequest, observer: &O, address: &str, @@ -844,7 +844,7 @@ async fn collect_before_candidates( limit: usize, pacer: &RequestPacer, pause_after_rate_limit_ms: u64, -) -> kb_core::Result +) -> ks_core::Result where O: crate::BackfillObserver + Sync, { @@ -861,12 +861,12 @@ where let page_limit_u16 = match u16::try_from(page_limit) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "backfill page limit conversion failed: {error}" ))); }, }; - let config_result = kb_onchain_transport::GetSignaturesForAddressConfig::new( + let config_result = ks_onchain_transport::GetSignaturesForAddressConfig::new( request.commitment.clone(), page_limit_u16, before.clone(), @@ -917,7 +917,7 @@ where } async fn collect_after_candidates( - client: &kb_onchain_transport::HttpClient, + client: &ks_onchain_transport::HttpClient, request: &crate::BackfillRequest, observer: &O, address: &str, @@ -925,7 +925,7 @@ async fn collect_after_candidates( limit: usize, pacer: &RequestPacer, pause_after_rate_limit_ms: u64, -) -> kb_core::Result +) -> ks_core::Result where O: crate::BackfillObserver + Sync, { @@ -941,7 +941,7 @@ where if observer.is_cancelled() { break; } - let config_result = kb_onchain_transport::GetSignaturesForAddressConfig::new( + let config_result = ks_onchain_transport::GetSignaturesForAddressConfig::new( request.commitment.clone(), page_size, before.clone(), @@ -973,7 +973,7 @@ where let page_count = match u64::try_from(page.len()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "after-history page length conversion failed: {error}" ))); }, @@ -998,7 +998,7 @@ where } } if !boundary_reached && !observer.is_cancelled() { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "anchor boundary was not reached within {} pages after scanning {scanned} signatures; increase max_pages", request.max_pages ))); @@ -1013,7 +1013,7 @@ where fn append_nearest_newer_candidates( candidates: &mut std::collections::VecDeque, seen: &mut std::collections::HashSet, - page: &[kb_onchain_transport::AddressSignatureInfo], + page: &[ks_onchain_transport::AddressSignatureInfo], limit: usize, ) { let detected_at = chrono::Utc::now(); @@ -1035,7 +1035,7 @@ fn append_nearest_newer_candidates( fn append_signature_candidates( candidates: &mut std::vec::Vec, seen: &mut std::collections::HashSet, - page: &[kb_onchain_transport::AddressSignatureInfo], + page: &[ks_onchain_transport::AddressSignatureInfo], ) { let detected_at = chrono::Utc::now(); for item in page { @@ -1051,14 +1051,14 @@ fn append_signature_candidates( } async fn fetch_signature_page( - client: &kb_onchain_transport::HttpClient, + client: &ks_onchain_transport::HttpClient, address: &str, - config: &kb_onchain_transport::GetSignaturesForAddressConfig, + config: &ks_onchain_transport::GetSignaturesForAddressConfig, max_retries: u32, pacer: &RequestPacer, pause_after_rate_limit_ms: u64, observer: &O, -) -> kb_core::Result> +) -> ks_core::Result> where O: crate::BackfillObserver + Sync, { @@ -1113,17 +1113,17 @@ where async fn hydrate_candidate( store: &S, observer: &O, - client: &kb_onchain_transport::HttpClient, - config: &kb_onchain_transport::GetTransactionConfig, + client: &ks_onchain_transport::HttpClient, + config: &ks_onchain_transport::GetTransactionConfig, request: &crate::BackfillRequest, capture_session_id: &str, filter_code: &str, candidate: BackfillCandidate, pacer: &RequestPacer, pause_after_rate_limit_ms: u64, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore + Sync, + S: ks_store::RawTransactionStore + Sync, O: crate::BackfillObserver + Sync, { let mut outcome = CandidateOutcome::empty(); @@ -1131,9 +1131,9 @@ where outcome.cancelled = true; return std::result::Result::Ok(outcome); } - let signature_model = kb_lib::MdSignature(candidate.signature.clone()); + let signature_model = ks_lib::MdSignature(candidate.signature.clone()); let exists_result = - kb_store::RawTransactionStore::has_raw_transaction_signature(store, &signature_model).await; + ks_store::RawTransactionStore::has_raw_transaction_signature(store, &signature_model).await; let exists = match exists_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1181,7 +1181,7 @@ where outcome.transactions_received = 1; let normalized_at = chrono::Utc::now(); let raw_insert_result = - kb_store::RawTransactionInsert::from_canonical(&transaction); + ks_store::RawTransactionInsert::from_canonical(&transaction); let raw_insert = match raw_insert_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { @@ -1209,7 +1209,7 @@ where return std::result::Result::Ok(outcome); }, }; - let persist_result = kb_store::RawTransactionStore::insert_raw_transaction( + let persist_result = ks_store::RawTransactionStore::insert_raw_transaction( store, &raw_insert, ) @@ -1367,7 +1367,7 @@ where async fn persist_success_observation( store: &S, - client: &kb_onchain_transport::HttpClient, + client: &ks_onchain_transport::HttpClient, request: &crate::BackfillRequest, capture_session_id: &str, filter_code: &str, @@ -1378,9 +1378,9 @@ async fn persist_success_observation( normalized_at: chrono::DateTime, payload_size_bytes: std::option::Option, source_payload_hash: std::option::Option, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore + Sync, + S: ks_store::RawTransactionStore + Sync, { let observation_result = base_observation( client, @@ -1409,7 +1409,7 @@ where observation_with_timings.with_payload_metadata(payload_size_bytes, source_payload_hash); let observation = match payload_result { std::result::Result::Ok(value) => { - value.with_status(kb_store::TransactionObservationStatus::Persisted) + value.with_status(ks_store::TransactionObservationStatus::Persisted) }, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -1418,7 +1418,7 @@ where async fn persist_missing_observation( store: &S, - client: &kb_onchain_transport::HttpClient, + client: &ks_onchain_transport::HttpClient, request: &crate::BackfillRequest, capture_session_id: &str, filter_code: &str, @@ -1427,9 +1427,9 @@ async fn persist_missing_observation( received_at: chrono::DateTime, payload_size_bytes: std::option::Option, source_payload_hash: std::option::Option, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore + Sync, + S: ks_store::RawTransactionStore + Sync, { let observation_result = base_observation( client, @@ -1456,7 +1456,7 @@ where observation_with_timings.with_payload_metadata(payload_size_bytes, source_payload_hash); let observation = match payload_result { std::result::Result::Ok(value) => { - value.with_status(kb_store::TransactionObservationStatus::Missing) + value.with_status(ks_store::TransactionObservationStatus::Missing) }, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -1465,7 +1465,7 @@ where async fn persist_failed_observation( store: &S, - client: &kb_onchain_transport::HttpClient, + client: &ks_onchain_transport::HttpClient, request: &crate::BackfillRequest, capture_session_id: &str, filter_code: &str, @@ -1477,9 +1477,9 @@ async fn persist_failed_observation( source_payload_hash: std::option::Option, error_code: &str, error_message: std::string::String, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::RawTransactionStore + Sync, + S: ks_store::RawTransactionStore + Sync, { let observation_result = base_observation( client, @@ -1518,14 +1518,14 @@ where } fn base_observation( - client: &kb_onchain_transport::HttpClient, + client: &ks_onchain_transport::HttpClient, request: &crate::BackfillRequest, capture_session_id: &str, filter_code: &str, candidate: &BackfillCandidate, attempt: u32, received_at: chrono::DateTime, -) -> kb_core::Result { +) -> ks_core::Result { let observation_key = format!( "backfill:{}:{}:{}:{}", capture_session_id, @@ -1533,12 +1533,12 @@ fn base_observation( candidate.signature, attempt ); - let observation_result = kb_store::TransactionObservationInsert::new( + let observation_result = ks_store::TransactionObservationInsert::new( observation_key, client.provider().to_string(), "solana_http_json_rpc".to_string(), "getTransaction".to_string(), - kb_store::TransactionObservationOrigin::Backfill, + ks_store::TransactionObservationOrigin::Backfill, received_at, ); let observation = match observation_result { @@ -1563,13 +1563,13 @@ fn base_observation( async fn insert_observation( store: &S, - observation: &kb_store::TransactionObservationInsert, -) -> kb_core::Result + observation: &ks_store::TransactionObservationInsert, +) -> ks_core::Result where - S: kb_store::RawTransactionStore + Sync, + S: ks_store::RawTransactionStore + Sync, { let insert_result = - kb_store::RawTransactionStore::insert_transaction_observation(store, observation).await; + ks_store::RawTransactionStore::insert_transaction_observation(store, observation).await; let outcome = match insert_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1579,12 +1579,12 @@ where fn source_payload_metadata( source: &serde_json::Value, -) -> kb_core::Result<(std::option::Option, std::option::Option)> { +) -> ks_core::Result<(std::option::Option, std::option::Option)> { let bytes_result = serde_json::to_vec(source); let bytes = match bytes_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot serialize source getTransaction payload for metrics: {error}" ))); }, @@ -1592,7 +1592,7 @@ fn source_payload_metadata( let size = match u64::try_from(bytes.len()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "source payload size conversion failed: {error}" ))); }, @@ -1615,10 +1615,10 @@ fn lower_hex(bytes: &[u8]) -> std::string::String { } fn role_limits( - client: &kb_onchain_transport::HttpClient, + client: &ks_onchain_transport::HttpClient, required_role: &str, request_kind: &str, -) -> kb_core::Result { +) -> ks_core::Result { for role in &client.endpoint_config().roles { if !role.enabled || role.role != required_role { continue; @@ -1634,7 +1634,7 @@ fn role_limits( pause_after_rate_limit_ms: role.pause_after_rate_limit_ms, }); } - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "endpoint '{}' does not expose role '{}' for '{}'", client.endpoint_name(), required_role, @@ -1778,7 +1778,7 @@ mod tests { fn nearest_newer_candidates_keep_only_entries_closest_to_anchor() { let page = (1_u8..=6_u8) .map(|byte| { - return kb_onchain_transport::AddressSignatureInfo { + return ks_onchain_transport::AddressSignatureInfo { signature: signature(byte), slot: u64::from(byte), err: std::option::Option::None, @@ -1787,7 +1787,7 @@ mod tests { confirmation_status: std::option::Option::Some("confirmed".to_string()), }; }) - .collect::>(); + .collect::>(); let mut candidates = std::collections::VecDeque::new(); let mut seen = std::collections::HashSet::new(); super::append_nearest_newer_candidates(&mut candidates, &mut seen, &page, 3); @@ -1802,7 +1802,7 @@ mod tests { fn nearest_newer_candidates_deduplicate_page_entries() { let duplicate = signature(7); let page = vec![ - kb_onchain_transport::AddressSignatureInfo { + ks_onchain_transport::AddressSignatureInfo { signature: duplicate.clone(), slot: 7, err: std::option::Option::None, @@ -1810,7 +1810,7 @@ mod tests { block_time: std::option::Option::None, confirmation_status: std::option::Option::Some("confirmed".to_string()), }, - kb_onchain_transport::AddressSignatureInfo { + ks_onchain_transport::AddressSignatureInfo { signature: duplicate, slot: 7, err: std::option::Option::None, diff --git a/ks-pipeline/src/constants.rs b/ks-pipeline/src/constants.rs new file mode 100644 index 0000000..726efa3 --- /dev/null +++ b/ks-pipeline/src/constants.rs @@ -0,0 +1,7 @@ +// file: ks-pipeline/src/constants.rs +// version: 3 + +//! Pipeline constants. + +/// Canonical tracing target for pipeline orchestration. +pub(crate) const TRACING_TARGET: &str = "ks-pipeline"; diff --git a/kb-pipeline/src/core_extraction.rs b/ks-pipeline/src/core_extraction.rs similarity index 90% rename from kb-pipeline/src/core_extraction.rs rename to ks-pipeline/src/core_extraction.rs index 26abcac..c8260ad 100644 --- a/kb-pipeline/src/core_extraction.rs +++ b/ks-pipeline/src/core_extraction.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/core_extraction.rs -// version: 10 +// file: ks-pipeline/src/core_extraction.rs +// version: 11 //! Canonical Solana transaction to normalized core extraction pipeline. @@ -50,27 +50,27 @@ pub struct CoreExtractionRequest { impl CoreExtractionRequest { /// Validates campaign bounds and source values. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.limit == 0 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "core extraction limit must be greater than zero", )); } if self.max_concurrent_extractions == 0 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "core extraction concurrency must be greater than zero", )); } match &self.source { crate::CoreExtractionSource::Signatures(signatures) => { if signatures.is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "signature extraction requires at least one signature", )); } for signature in signatures { let validation_result = - kb_onchain_transport::validate_transaction_signature_text( + ks_onchain_transport::validate_transaction_signature_text( signature.as_str(), "core extraction signature", ); @@ -82,13 +82,13 @@ impl CoreExtractionRequest { crate::CoreExtractionSource::Pending => {}, crate::CoreExtractionSource::SlotRange { min_slot, max_slot } => { if min_slot > max_slot { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "core extraction minimum slot must not exceed maximum slot", )); } }, crate::CoreExtractionSource::ProgramId { program_id } => { - let validation_result = kb_onchain_transport::validate_solana_pubkey_text( + let validation_result = ks_onchain_transport::validate_solana_pubkey_text( program_id.as_str(), "core extraction program id", ); @@ -100,10 +100,10 @@ impl CoreExtractionRequest { return std::result::Result::Ok(()); } - fn selection_filter(&self) -> kb_core::Result { + fn selection_filter(&self) -> ks_core::Result { return match &self.source { crate::CoreExtractionSource::Signatures(signatures) => { - kb_store::CoreExtractionSelectionFilter::new( + ks_store::CoreExtractionSelectionFilter::new( signatures.clone(), std::option::Option::None, std::option::Option::None, @@ -113,10 +113,10 @@ impl CoreExtractionRequest { ) }, crate::CoreExtractionSource::Pending => { - kb_store::CoreExtractionSelectionFilter::pending(self.limit) + ks_store::CoreExtractionSelectionFilter::pending(self.limit) }, crate::CoreExtractionSource::SlotRange { min_slot, max_slot } => { - kb_store::CoreExtractionSelectionFilter::new( + ks_store::CoreExtractionSelectionFilter::new( std::vec::Vec::new(), std::option::Option::Some(*min_slot), std::option::Option::Some(*max_slot), @@ -126,7 +126,7 @@ impl CoreExtractionRequest { ) }, crate::CoreExtractionSource::ProgramId { program_id } => { - kb_store::CoreExtractionSelectionFilter::new( + ks_store::CoreExtractionSelectionFilter::new( std::vec::Vec::new(), std::option::Option::None, std::option::Option::None, @@ -252,9 +252,9 @@ pub async fn execute_core_extraction( store: &S, request: &crate::CoreExtractionRequest, observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::CoreExtractionStore + Sync, + S: ks_store::CoreExtractionStore + Sync, O: crate::CoreExtractionObserver, { let validation_result = request.validate(); @@ -275,7 +275,7 @@ where let total = match u64::try_from(rows.len()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "core extraction selected count overflow: {error}" ))); }, @@ -299,7 +299,7 @@ where let concurrency = match usize::try_from(request.max_concurrent_extractions) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "core extraction concurrency conversion failed: {error}" ))); }, @@ -410,12 +410,12 @@ where async fn process_one_core_extraction( store: &S, - row: kb_store::RawTransactionRow, + row: ks_store::RawTransactionRow, index: usize, force_replay: bool, ) -> crate::core_extraction::CoreExtractionItemOutcome where - S: kb_store::CoreExtractionStore + Sync, + S: ks_store::CoreExtractionStore + Sync, { let identity_result = crate::core_extraction::ledger_identity_from_raw(&row); let identity = match identity_result { @@ -459,7 +459,7 @@ where let bundle = match extraction_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - let failure_result = kb_store::CoreExtractionFailure::new( + let failure_result = ks_store::CoreExtractionFailure::new( row.id, identity, "canonical_to_core_extraction_failed", @@ -483,7 +483,7 @@ where message: "extracted and committed".to_string(), }, std::result::Result::Err(error) => { - let failure_result = kb_store::CoreExtractionFailure::new( + let failure_result = ks_store::CoreExtractionFailure::new( row.id, bundle.ledger_identity, "canonical_to_core_persist_failed", @@ -503,12 +503,12 @@ where /// Extracts one canonical raw transaction into a complete normalized core bundle. pub fn extract_raw_transaction_to_core( - row: &kb_store::RawTransactionRow, -) -> kb_core::Result { + row: &ks_store::RawTransactionRow, +) -> ks_core::Result { let canonical_json = match &row.canonical_json { std::option::Option::Some(value) => value.clone(), std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical JSON is unavailable for core extraction", )); }, @@ -516,31 +516,31 @@ pub fn extract_raw_transaction_to_core( let input_hash = match &row.canonical_json_hash { std::option::Option::Some(value) if !value.trim().is_empty() => value.clone(), _ => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical JSON hash is unavailable for core extraction", )); }, }; let expected_format_version = - match i32::try_from(kb_lib::MD_CANONICAL_TRANSACTION_FORMAT_VERSION) { + match i32::try_from(ks_lib::MD_CANONICAL_TRANSACTION_FORMAT_VERSION) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "canonical format version conversion failed: {error}" ))); }, }; if row.canonical_format_version != expected_format_version { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "unsupported canonical format version in raw store: {}", row.canonical_format_version ))); } - let parse_result = serde_json::from_value::(canonical_json); + let parse_result = serde_json::from_value::(canonical_json); let transaction = match parse_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot parse canonical transaction for core extraction: {error}" ))); }, @@ -550,7 +550,7 @@ pub fn extract_raw_transaction_to_core( return std::result::Result::Err(error); } if transaction.primary_signature != row.signature { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical transaction signature does not match raw row signature", )); } @@ -558,13 +558,13 @@ pub fn extract_raw_transaction_to_core( let row_slot = match row_slot_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "raw transaction slot is negative: {error}" ))); }, }; if transaction.slot != row_slot { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical transaction slot does not match raw row slot", )); } @@ -574,7 +574,7 @@ pub fn extract_raw_transaction_to_core( std::result::Result::Err(error) => return std::result::Result::Err(error), }; if computed_hash != input_hash { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical transaction hash does not match the stored hash", )); } @@ -591,7 +591,7 @@ pub fn extract_raw_transaction_to_core( ledger_identity, ); } - let core_transaction_result = kb_store::CoreTransactionInsert::new( + let core_transaction_result = ks_store::CoreTransactionInsert::new( transaction.primary_signature.clone(), transaction.slot, false, @@ -611,7 +611,7 @@ pub fn extract_raw_transaction_to_core( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - return std::result::Result::Ok(kb_store::CoreExtractionBundle { + return std::result::Result::Ok(ks_store::CoreExtractionBundle { raw_transaction_id: row.id, ledger_identity, transaction: core_transaction, @@ -624,13 +624,13 @@ pub fn extract_raw_transaction_to_core( } fn build_bundle_with_metadata( - row: &kb_store::RawTransactionRow, - transaction: &kb_lib::MdCanonicalTransaction, - metadata: &kb_lib::MdCanonicalTransactionMetadata, - ledger_identity: kb_store::ProcessingLedgerIdentity, -) -> kb_core::Result { - let failed = metadata.status == kb_lib::MdCanonicalTransactionStatus::Failed; - let core_transaction_result = kb_store::CoreTransactionInsert::new( + row: &ks_store::RawTransactionRow, + transaction: &ks_lib::MdCanonicalTransaction, + metadata: &ks_lib::MdCanonicalTransactionMetadata, + ledger_identity: ks_store::ProcessingLedgerIdentity, +) -> ks_core::Result { + let failed = metadata.status == ks_lib::MdCanonicalTransactionStatus::Failed; + let core_transaction_result = ks_store::CoreTransactionInsert::new( transaction.primary_signature.clone(), transaction.slot, failed, @@ -660,7 +660,7 @@ fn build_bundle_with_metadata( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - return std::result::Result::Ok(kb_store::CoreExtractionBundle { + return std::result::Result::Ok(ks_store::CoreExtractionBundle { raw_transaction_id: row.id, ledger_identity, transaction: core_transaction, @@ -673,17 +673,17 @@ fn build_bundle_with_metadata( } fn ledger_identity_from_raw( - row: &kb_store::RawTransactionRow, -) -> kb_core::Result { + row: &ks_store::RawTransactionRow, +) -> ks_core::Result { let input_hash = match &row.canonical_json_hash { std::option::Option::Some(value) => value.clone(), std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "canonical JSON hash is required for the processing ledger", )); }, }; - return kb_store::ProcessingLedgerIdentity::new( + return ks_store::ProcessingLedgerIdentity::new( crate::CORE_EXTRACTION_STAGE, crate::CORE_EXTRACTION_PROCESSOR_NAME, crate::CORE_EXTRACTION_PROCESSOR_VERSION, @@ -693,7 +693,7 @@ fn ledger_identity_from_raw( } fn resolved_account_keys( - transaction: &kb_lib::MdCanonicalTransaction, + transaction: &ks_lib::MdCanonicalTransaction, ) -> std::vec::Vec { let mut keys = std::vec::Vec::with_capacity(transaction.message.resolved_account_count()); keys.extend(transaction.message.static_account_keys.iter().cloned()); @@ -703,8 +703,8 @@ fn resolved_account_keys( } fn extract_account_keys( - transaction: &kb_lib::MdCanonicalTransaction, -) -> kb_core::Result> { + transaction: &ks_lib::MdCanonicalTransaction, +) -> ks_core::Result> { let static_count = transaction.message.static_account_keys.len(); let required = usize::from(transaction.message.header.num_required_signatures); let readonly_signed = usize::from(transaction.message.header.num_readonly_signed_accounts); @@ -717,7 +717,7 @@ fn extract_account_keys( let account_index = match account_index_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "static account index overflow: {error}" ))); }, @@ -728,12 +728,12 @@ fn extract_account_keys( } else { index < writable_unsigned_end }; - let insert_result = kb_store::CoreAccountKeyInsert::new( + let insert_result = ks_store::CoreAccountKeyInsert::new( transaction.primary_signature.clone(), transaction.slot, account_index, key.clone(), - kb_store::CoreAccountKeySource::Static, + ks_store::CoreAccountKeySource::Static, writable, signer, std::option::Option::None, @@ -749,17 +749,17 @@ fn extract_account_keys( let account_index = match account_index_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "loaded writable account index overflow: {error}" ))); }, }; - let insert_result = kb_store::CoreAccountKeyInsert::new( + let insert_result = ks_store::CoreAccountKeyInsert::new( transaction.primary_signature.clone(), transaction.slot, account_index, key.clone(), - kb_store::CoreAccountKeySource::LoadedWritable, + ks_store::CoreAccountKeySource::LoadedWritable, true, false, std::option::Option::None, @@ -775,17 +775,17 @@ fn extract_account_keys( let account_index = match account_index_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "loaded readonly account index overflow: {error}" ))); }, }; - let insert_result = kb_store::CoreAccountKeyInsert::new( + let insert_result = ks_store::CoreAccountKeyInsert::new( transaction.primary_signature.clone(), transaction.slot, account_index, key.clone(), - kb_store::CoreAccountKeySource::LoadedReadonly, + ks_store::CoreAccountKeySource::LoadedReadonly, false, false, std::option::Option::None, @@ -800,10 +800,10 @@ fn extract_account_keys( } fn extract_instructions( - transaction: &kb_lib::MdCanonicalTransaction, -) -> kb_core::Result<( - std::vec::Vec, - std::vec::Vec, + transaction: &ks_lib::MdCanonicalTransaction, +) -> ks_core::Result<( + std::vec::Vec, + std::vec::Vec, )> { let keys = crate::core_extraction::resolved_account_keys(transaction); let mut instructions = std::vec::Vec::new(); @@ -814,7 +814,7 @@ fn extract_instructions( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let insert_result = kb_store::CoreInstructionInsert::new( + let insert_result = ks_store::CoreInstructionInsert::new( transaction.primary_signature.clone(), transaction.slot, path, @@ -846,7 +846,7 @@ fn extract_instructions( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let insert_result = kb_store::CoreInnerInstructionInsert::new( + let insert_result = ks_store::CoreInnerInstructionInsert::new( transaction.primary_signature.clone(), transaction.slot, parent_path.clone(), @@ -873,13 +873,13 @@ fn extract_instructions( fn resolve_instruction( keys: &[std::string::String], - instruction: &kb_lib::MdCanonicalCompiledInstruction, -) -> kb_core::Result<(std::string::String, serde_json::Value, serde_json::Value, std::string::String)> + instruction: &ks_lib::MdCanonicalCompiledInstruction, +) -> ks_core::Result<(std::string::String, serde_json::Value, serde_json::Value, std::string::String)> { let program_id = match keys.get(usize::from(instruction.program_id_index)) { std::option::Option::Some(value) => value.clone(), std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "instruction program id index is outside resolved accounts", )); }, @@ -889,7 +889,7 @@ fn resolve_instruction( let account_key = match keys.get(usize::from(*account_index)) { std::option::Option::Some(value) => value.clone(), std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "instruction account index is outside resolved accounts", )); }, @@ -914,9 +914,9 @@ fn resolve_instruction( } fn extract_logs( - transaction: &kb_lib::MdCanonicalTransaction, - metadata: &kb_lib::MdCanonicalTransactionMetadata, -) -> kb_core::Result> { + transaction: &ks_lib::MdCanonicalTransaction, + metadata: &ks_lib::MdCanonicalTransactionMetadata, +) -> ks_core::Result> { let mut output = std::vec::Vec::with_capacity(metadata.log_messages.len()); let links = crate::core_extraction::resolve_log_links(transaction, metadata); for (index, text) in metadata.log_messages.iter().enumerate() { @@ -924,7 +924,7 @@ fn extract_logs( let log_index = match log_index_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "log index overflow: {error}" ))); }, @@ -933,7 +933,7 @@ fn extract_logs( std::option::Option::Some(value) => value.clone(), std::option::Option::None => (std::option::Option::None, std::option::Option::None), }; - let insert_result = kb_store::CoreLogInsert::new( + let insert_result = ks_store::CoreLogInsert::new( transaction.primary_signature.clone(), transaction.slot, log_index, @@ -957,8 +957,8 @@ fn extract_logs( } fn resolve_log_links( - transaction: &kb_lib::MdCanonicalTransaction, - metadata: &kb_lib::MdCanonicalTransactionMetadata, + transaction: &ks_lib::MdCanonicalTransaction, + metadata: &ks_lib::MdCanonicalTransactionMetadata, ) -> std::vec::Vec<( std::option::Option, std::option::Option, @@ -1104,9 +1104,9 @@ fn parse_program_log(text: &str) -> std::option::Option<(std::string::String, Pr } fn extract_balance_changes( - transaction: &kb_lib::MdCanonicalTransaction, - metadata: &kb_lib::MdCanonicalTransactionMetadata, -) -> kb_core::Result> { + transaction: &ks_lib::MdCanonicalTransaction, + metadata: &ks_lib::MdCanonicalTransactionMetadata, +) -> ks_core::Result> { let keys = crate::core_extraction::resolved_account_keys(transaction); let mut output = std::vec::Vec::new(); for index in 0..metadata.pre_balances.len() { @@ -1117,7 +1117,7 @@ fn extract_balance_changes( let account_index = match account_index_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "native balance account index overflow: {error}" ))); }, @@ -1126,17 +1126,17 @@ fn extract_balance_changes( let balance_index = match balance_index_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "balance change index overflow: {error}" ))); }, }; let account_key = keys.get(index).cloned(); - let insert_result = kb_store::CoreBalanceChangeInsert::new( + let insert_result = ks_store::CoreBalanceChangeInsert::new( transaction.primary_signature.clone(), transaction.slot, balance_index, - kb_store::CoreBalanceChangeKind::NativeLamports, + ks_store::CoreBalanceChangeKind::NativeLamports, std::option::Option::Some(account_index), account_key, std::option::Option::None, @@ -1184,7 +1184,7 @@ fn extract_balance_changes( let decimals = match (pre, post) { (std::option::Option::Some(left), std::option::Option::Some(right)) => { if left.decimals != right.decimals { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "token balance decimals changed between pre and post metadata", )); } @@ -1210,7 +1210,7 @@ fn extract_balance_changes( let balance_index = match balance_index_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "token balance change index overflow: {error}" ))); }, @@ -1253,11 +1253,11 @@ fn extract_balance_changes( "decimalAmount": delta_decimal, "programId": key.2.clone(), }); - let insert_result = kb_store::CoreBalanceChangeInsert::new( + let insert_result = ks_store::CoreBalanceChangeInsert::new( transaction.primary_signature.clone(), transaction.slot, balance_index, - kb_store::CoreBalanceChangeKind::TokenAmount, + ks_store::CoreBalanceChangeKind::TokenAmount, std::option::Option::Some(u32::from(key.0)), account_key, std::option::Option::Some(key.1), @@ -1355,12 +1355,12 @@ fn signed_fixed_decimal(amount: &str, decimals: u8) -> std::string::String { return unsigned; } -fn hash_json(value: &serde_json::Value) -> kb_core::Result { +fn hash_json(value: &serde_json::Value) -> ks_core::Result { let serialization_result = serde_json::to_vec(value); let bytes = match serialization_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot serialize core payload for hashing: {error}" ))); }, @@ -1380,14 +1380,14 @@ fn hash_bytes(bytes: &[u8]) -> std::string::String { #[cfg(test)] mod tests { struct TestCoreExtractionStore { - rows: std::vec::Vec, + rows: std::vec::Vec, current: std::sync::atomic::AtomicBool, persist_calls: std::sync::atomic::AtomicU64, failure_calls: std::sync::atomic::AtomicU64, } impl TestCoreExtractionStore { - fn new(rows: std::vec::Vec, current: bool) -> Self { + fn new(rows: std::vec::Vec, current: bool) -> Self { return Self { rows, current: std::sync::atomic::AtomicBool::new(current), @@ -1398,15 +1398,15 @@ mod tests { } #[async_trait::async_trait] - impl kb_store::CoreExtractionStore for TestCoreExtractionStore { + impl ks_store::CoreExtractionStore for TestCoreExtractionStore { #[expect( clippy::implicit_return, reason = "async_trait expansion triggers implicit_return on generated async trait methods." )] async fn list_raw_transactions_for_core_extraction( &self, - _filter: &kb_store::CoreExtractionSelectionFilter, - ) -> kb_core::Result> { + _filter: &ks_store::CoreExtractionSelectionFilter, + ) -> ks_core::Result> { return std::result::Result::Ok(self.rows.clone()); } @@ -1416,8 +1416,8 @@ mod tests { )] async fn is_core_extraction_current( &self, - _identity: &kb_store::ProcessingLedgerIdentity, - ) -> kb_core::Result { + _identity: &ks_store::ProcessingLedgerIdentity, + ) -> ks_core::Result { return std::result::Result::Ok( self.current.load(std::sync::atomic::Ordering::Acquire), ); @@ -1429,11 +1429,11 @@ mod tests { )] async fn persist_core_extraction( &self, - _bundle: &kb_store::CoreExtractionBundle, + _bundle: &ks_store::CoreExtractionBundle, _force_replay: bool, - ) -> kb_core::Result { + ) -> ks_core::Result { self.persist_calls.fetch_add(1, std::sync::atomic::Ordering::AcqRel); - return std::result::Result::Ok(kb_store::InsertOutcome::new(1, 0, 0)); + return std::result::Result::Ok(ks_store::InsertOutcome::new(1, 0, 0)); } #[expect( @@ -1442,10 +1442,10 @@ mod tests { )] async fn mark_core_extraction_failed( &self, - _failure: &kb_store::CoreExtractionFailure, - ) -> kb_core::Result { + _failure: &ks_store::CoreExtractionFailure, + ) -> ks_core::Result { self.failure_calls.fetch_add(1, std::sync::atomic::Ordering::AcqRel); - return std::result::Result::Ok(kb_store::InsertOutcome::new(0, 1, 0)); + return std::result::Result::Ok(ks_store::InsertOutcome::new(0, 1, 0)); } } @@ -1476,8 +1476,8 @@ mod tests { } } - fn sample_transaction() -> kb_lib::MdCanonicalTransaction { - let token_pre = match kb_lib::MdCanonicalTokenBalance::new( + fn sample_transaction() -> ks_lib::MdCanonicalTransaction { + let token_pre = match ks_lib::MdCanonicalTokenBalance::new( 1, "11111111111111111111111111111111", std::option::Option::Some("SysvarC1ock11111111111111111111111111111111".to_string()), @@ -1488,7 +1488,7 @@ mod tests { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("sample token pre balance failed: {error}"), }; - let token_post = match kb_lib::MdCanonicalTokenBalance::new( + let token_post = match ks_lib::MdCanonicalTokenBalance::new( 1, "11111111111111111111111111111111", std::option::Option::Some("SysvarC1ock11111111111111111111111111111111".to_string()), @@ -1499,15 +1499,15 @@ mod tests { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("sample token post balance failed: {error}"), }; - return kb_lib::MdCanonicalTransaction { - format_version: kb_lib::MD_CANONICAL_TRANSACTION_FORMAT_VERSION, + return ks_lib::MdCanonicalTransaction { + format_version: ks_lib::MD_CANONICAL_TRANSACTION_FORMAT_VERSION, primary_signature: "2Ana1pUpv2ZbMVkwF5FXapYeBEjdxDatLn7nvJkhgTSXbs59SyZSx866bXirPgj8QQVB57uxHJBG1YFvkRbFj4T".to_string(), slot: 42, block_time: std::option::Option::Some(1_700_000_000), - version: kb_lib::MdCanonicalTransactionVersion::Legacy, + version: ks_lib::MdCanonicalTransactionVersion::Legacy, signatures: std::vec!["2Ana1pUpv2ZbMVkwF5FXapYeBEjdxDatLn7nvJkhgTSXbs59SyZSx866bXirPgj8QQVB57uxHJBG1YFvkRbFj4T".to_string()], - message: kb_lib::MdCanonicalTransactionMessage { - header: kb_lib::MdCanonicalMessageHeader { + message: ks_lib::MdCanonicalTransactionMessage { + header: ks_lib::MdCanonicalMessageHeader { num_required_signatures: 1, num_readonly_signed_accounts: 0, num_readonly_unsigned_accounts: 1, @@ -1517,24 +1517,24 @@ mod tests { "SysvarC1ock11111111111111111111111111111111".to_string(), ], recent_blockhash: "11111111111111111111111111111111".to_string(), - instructions: std::vec![kb_lib::MdCanonicalCompiledInstruction { + instructions: std::vec![ks_lib::MdCanonicalCompiledInstruction { program_id_index: 0, account_indexes: std::vec![1], data_base64: "AQ==".to_string(), stack_height: std::option::Option::Some(1), }], address_table_lookups: std::vec::Vec::new(), - loaded_addresses: kb_lib::MdCanonicalLoadedAddresses::default(), + loaded_addresses: ks_lib::MdCanonicalLoadedAddresses::default(), }, - metadata: std::option::Option::Some(kb_lib::MdCanonicalTransactionMetadata { - status: kb_lib::MdCanonicalTransactionStatus::Success, + metadata: std::option::Option::Some(ks_lib::MdCanonicalTransactionMetadata { + status: ks_lib::MdCanonicalTransactionStatus::Success, error: std::option::Option::None, fee: 5000, pre_balances: std::vec![10_000, 1], post_balances: std::vec![5_000, 1], - inner_instructions: std::vec![kb_lib::MdCanonicalInnerInstructionGroup { + inner_instructions: std::vec![ks_lib::MdCanonicalInnerInstructionGroup { parent_instruction_index: 0, - instructions: std::vec![kb_lib::MdCanonicalCompiledInstruction { + instructions: std::vec![ks_lib::MdCanonicalCompiledInstruction { program_id_index: 0, account_indexes: std::vec![1], data_base64: "Ag==".to_string(), @@ -1557,7 +1557,7 @@ mod tests { }; } - fn raw_row(transaction: &kb_lib::MdCanonicalTransaction) -> kb_store::RawTransactionRow { + fn raw_row(transaction: &ks_lib::MdCanonicalTransaction) -> ks_store::RawTransactionRow { let json = match transaction.to_canonical_json() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("sample canonical JSON failed: {error}"), @@ -1566,15 +1566,15 @@ mod tests { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("sample canonical hash failed: {error}"), }; - return kb_store::RawTransactionRow { + return ks_store::RawTransactionRow { id: 1, signature: transaction.primary_signature.clone(), slot: 42, canonical_json: std::option::Option::Some(json), canonical_json_hash: std::option::Option::Some(hash), canonical_format_version: 1, - retention_state: kb_store::RawPayloadRetentionState::Full, - processing_state: kb_store::RawPayloadProcessingState::Received, + retention_state: ks_store::RawPayloadRetentionState::Full, + processing_state: ks_store::RawPayloadProcessingState::Received, created_at: chrono::Utc::now(), updated_at: chrono::Utc::now(), }; @@ -1632,7 +1632,7 @@ mod tests { #[test] fn version_zero_loaded_addresses_extend_resolved_account_space() { let mut transaction = crate::core_extraction::tests::sample_transaction(); - transaction.version = kb_lib::MdCanonicalTransactionVersion::Number(0); + transaction.version = ks_lib::MdCanonicalTransactionVersion::Number(0); transaction.message.loaded_addresses.writable = std::vec!["Vote111111111111111111111111111111111111111".to_string(),]; transaction.message.loaded_addresses.readonly = @@ -1645,10 +1645,10 @@ mod tests { std::result::Result::Err(error) => panic!("loaded account extraction failed: {error}"), }; assert_eq!(keys.len(), 4); - assert_eq!(keys[2].source, kb_store::CoreAccountKeySource::LoadedWritable); + assert_eq!(keys[2].source, ks_store::CoreAccountKeySource::LoadedWritable); assert!(keys[2].writable); assert!(!keys[2].signer); - assert_eq!(keys[3].source, kb_store::CoreAccountKeySource::LoadedReadonly); + assert_eq!(keys[3].source, ks_store::CoreAccountKeySource::LoadedReadonly); assert!(!keys[3].writable); let instruction_result = crate::core_extraction::extract_instructions(&transaction); let (instructions, _) = match instruction_result { @@ -1667,7 +1667,7 @@ mod tests { std::option::Option::Some(value) => value, std::option::Option::None => panic!("sample metadata is required"), }; - metadata.status = kb_lib::MdCanonicalTransactionStatus::Failed; + metadata.status = ks_lib::MdCanonicalTransactionStatus::Failed; metadata.error = std::option::Option::Some(serde_json::json!({"InstructionError": [0, "Custom"]})); let expected_error = metadata.error.clone(); diff --git a/kb-pipeline/src/decode_replay.rs b/ks-pipeline/src/decode_replay.rs similarity index 84% rename from kb-pipeline/src/decode_replay.rs rename to ks-pipeline/src/decode_replay.rs index f495ab8..c6c00d5 100644 --- a/kb-pipeline/src/decode_replay.rs +++ b/ks-pipeline/src/decode_replay.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/decode_replay.rs -// version: 2 +// file: ks-pipeline/src/decode_replay.rs +// version: 3 //! Common contextual instruction decode and optional materialization pipeline. @@ -31,7 +31,7 @@ pub struct DecodeReplayRequest { /// Stable caller-provided campaign identifier used by structured tracing. pub campaign_id: std::string::String, /// Bounded backend-neutral input selection. - pub selection: kb_store::DecodeSelectionFilter, + pub selection: ks_store::DecodeSelectionFilter, /// Explicit decoder names to enable, or every supplied decoder when empty. pub decoder_names: std::vec::Vec, /// Deterministic multi-decoder dispatch policy. @@ -48,14 +48,14 @@ pub struct DecodeReplayRequest { impl DecodeReplayRequest { /// Validates campaign bounds and explicit decoder names. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.campaign_id.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "decode replay campaign id must not be empty", )); } if self.max_concurrent_inputs == 0 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "decode replay concurrency must be greater than zero", )); } @@ -63,22 +63,22 @@ impl DecodeReplayRequest { && self.selection.signatures.is_empty() && !self.force_replay_all_matching { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "force replay requires exact signatures or explicit all-matching authorization", )); } if self.force_replay_all_matching && !self.force_replay { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "all-matching replay authorization requires force replay", )); } if self.force_replay_all_matching && !self.selection.signatures.is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "all-matching replay authorization cannot be combined with exact signatures", )); } if self.decoder_names.iter().any(|name| return name.trim().is_empty()) { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "decode replay decoder names must not be empty", )); } @@ -224,21 +224,21 @@ struct DecodeItemOutcome { } struct RankedDecoder<'decoder> { - decoder: &'decoder dyn kb_lib::DcApiInstructionDecoder, - identity: kb_lib::DcApiDecoderIdentity, - recognition: kb_lib::DcApiDecoderRecognition, + decoder: &'decoder dyn ks_lib::DcApiInstructionDecoder, + identity: ks_lib::DcApiDecoderIdentity, + recognition: ks_lib::DcApiDecoderRecognition, } /// Executes one bounded contextual instruction decode and optional materialization campaign. pub async fn execute_decode_replay( store: &S, request: &crate::DecodeReplayRequest, - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::DecodePipelineStore + Sync, + S: ks_store::DecodePipelineStore + Sync, O: crate::DecodeReplayObserver, { let campaign_id = request.campaign_id.clone(); @@ -263,13 +263,13 @@ where async fn execute_decode_replay_campaign( store: &S, request: &crate::DecodeReplayRequest, - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, campaign_id: std::string::String, -) -> kb_core::Result +) -> ks_core::Result where - S: kb_store::DecodePipelineStore + Sync, + S: ks_store::DecodePipelineStore + Sync, O: crate::DecodeReplayObserver, { let signature_sample = text_sample(request.selection.signatures.as_slice(), 5); @@ -302,7 +302,7 @@ where let enabled = enabled_decoders(request, decoders); if enabled.is_empty() { tracing::error!(target: crate::TRACING_TARGET, action = "resolve_decoders", campaign_id = %campaign_id, requested_decoder_names = ?request.decoder_names, supplied_decoder_count = decoders.len(), "no contextual decoder is enabled"); - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "decode replay requires at least one enabled decoder", )); } @@ -352,7 +352,7 @@ where .collect::>(); if request.materialize_after_decode && ordered_materializers.is_empty() { tracing::error!(target: crate::TRACING_TARGET, action = "resolve_materializers", campaign_id = %campaign_id, requested = true, available_count = 0_usize, "materialization requested without available materializer"); - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "decode replay materialization requires at least one available materializer", )); } @@ -403,7 +403,7 @@ where let selected = match selected_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "decode selected count conversion failed: {error}" ))); }, @@ -421,7 +421,7 @@ where let concurrency = match concurrency_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "decode concurrency conversion failed: {error}" ))); }, @@ -541,14 +541,14 @@ where async fn execute_decode_input( store: &S, request: &crate::DecodeReplayRequest, - decoders: &[std::sync::Arc], - materializers: &[std::sync::Arc], + decoders: &[std::sync::Arc], + materializers: &[std::sync::Arc], observer: &O, campaign_id: &str, - input: &kb_lib::MdCoreInstructionReplayInput, + input: &ks_lib::MdCoreInstructionReplayInput, ) -> DecodeItemOutcome where - S: kb_store::DecodePipelineStore + Sync, + S: ks_store::DecodePipelineStore + Sync, O: crate::DecodeReplayObserver, { tracing::debug!(target: crate::TRACING_TARGET, action = "admit_input", campaign_id = %campaign_id, signature = %input.signature, slot = input.slot, instruction_path = %input.instruction_path, program_id = %input.program_id, input_key = %input.replay_input_key, transaction_failed = input.transaction_failed, "consider contextual decode replay input"); @@ -676,18 +676,18 @@ async fn execute_decoder( request: &crate::DecodeReplayRequest, campaign_id: &str, ranked: &RankedDecoder<'_>, - materializers: &[std::sync::Arc], - input: &kb_lib::MdCoreInstructionReplayInput, -) -> kb_core::Result + materializers: &[std::sync::Arc], + input: &ks_lib::MdCoreInstructionReplayInput, +) -> ks_core::Result where - S: kb_store::DecodePipelineStore + Sync, + S: ks_store::DecodePipelineStore + Sync, { - let input_hash_result = kb_lib::decoder_api_contextual_input_hash(input); + let input_hash_result = ks_lib::decoder_api_contextual_input_hash(input); let input_hash = match input_hash_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let ledger_result = kb_store::ProcessingLedgerIdentity::new( + let ledger_result = ks_store::ProcessingLedgerIdentity::new( crate::INSTRUCTION_DECODE_STAGE, ranked.identity.name.clone(), ranked.identity.version.clone(), @@ -750,7 +750,7 @@ where tracing::debug!(target: crate::TRACING_TARGET, action = "call_decoder", campaign_id = %campaign_id, signature = %input.signature, instruction_path = %input.instruction_path, processor_name = %ranked.identity.name, processor_version = %ranked.identity.version, status = ?decode_result.status, recognized_entry_code = ?decode_result.recognized_entry_code, observation_count = decode_result.observations.len(), diagnostics = ?decode_result.diagnostics, "contextual instruction decoder returned"); if matches!( decode_result.status, - kb_lib::DcApiDecoderOutcomeStatus::Failed | kb_lib::DcApiDecoderOutcomeStatus::Unsupported + ks_lib::DcApiDecoderOutcomeStatus::Failed | ks_lib::DcApiDecoderOutcomeStatus::Unsupported ) { tracing::error!( target: crate::TRACING_TARGET, @@ -772,7 +772,7 @@ where let validation_result = decode_result.validate(); if let std::result::Result::Err(error) = validation_result { tracing::error!(target: crate::TRACING_TARGET, action = "validate_decoder_result", campaign_id = %campaign_id, signature = %input.signature, instruction_path = %input.instruction_path, processor_name = %ranked.identity.name, processor_version = %ranked.identity.version, error = %error, "contextual decoder returned an invalid result"); - let failure = kb_store::DecodeFailure { + let failure = ks_store::DecodeFailure { ledger_identity, signature: input.signature.clone(), instruction_path: input.instruction_path.clone(), @@ -800,7 +800,7 @@ where let decoded_count = match decoded_count_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "decoded observation count conversion failed: {error}" ))); }, @@ -809,12 +809,12 @@ where let error_count = match error_count_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "decoder diagnostic count conversion failed: {error}" ))); }, }; - let coverage = kb_store::DecodeCoverageObservationInsert { + let coverage = ks_store::DecodeCoverageObservationInsert { processor_name: ranked.identity.name.clone(), processor_version: ranked.identity.version.clone(), input_key: input.replay_input_key.clone(), @@ -836,12 +836,12 @@ where error_count, transaction_failed: input.transaction_failed, }; - let decode_error = if decode_result.status == kb_lib::DcApiDecoderOutcomeStatus::Failed { + let decode_error = if decode_result.status == ks_lib::DcApiDecoderOutcomeStatus::Failed { decode_result.diagnostics.first() } else { std::option::Option::None }; - let bundle = kb_store::DecodePersistenceBundle { + let bundle = ks_store::DecodePersistenceBundle { ledger_identity, signature: input.signature.clone(), instruction_path: input.instruction_path.clone(), @@ -862,13 +862,13 @@ where }; tracing::debug!(target: crate::TRACING_TARGET, action = "persist_decode_result", campaign_id = %campaign_id, signature = %input.signature, instruction_path = %input.instruction_path, processor_name = %ranked.identity.name, processor_version = %ranked.identity.version, outcome = ?persist_outcome, "contextual decode result persisted"); match decode_result.status { - kb_lib::DcApiDecoderOutcomeStatus::Decoded => summary.decoded = 1, - kb_lib::DcApiDecoderOutcomeStatus::Ignored => summary.ignored = 1, - kb_lib::DcApiDecoderOutcomeStatus::Unsupported => summary.unsupported = 1, - kb_lib::DcApiDecoderOutcomeStatus::Failed => summary.failed = 1, + ks_lib::DcApiDecoderOutcomeStatus::Decoded => summary.decoded = 1, + ks_lib::DcApiDecoderOutcomeStatus::Ignored => summary.ignored = 1, + ks_lib::DcApiDecoderOutcomeStatus::Unsupported => summary.unsupported = 1, + ks_lib::DcApiDecoderOutcomeStatus::Failed => summary.failed = 1, } if request.materialize_after_decode - && decode_result.status == kb_lib::DcApiDecoderOutcomeStatus::Decoded + && decode_result.status == ks_lib::DcApiDecoderOutcomeStatus::Decoded { tracing::debug!(target: crate::TRACING_TARGET, action = "materialize_after_decode", campaign_id = %campaign_id, signature = %input.signature, instruction_path = %input.instruction_path, processor_name = %ranked.identity.name, processor_version = %ranked.identity.version, observation_count = decode_result.observations.len(), materializer_count = materializers.len(), "run materializers after contextual decode"); for observation in &decode_result.observations { @@ -900,20 +900,20 @@ async fn execute_materializers( store: &S, force_replay: bool, campaign_id: &str, - decoder_identity: &kb_lib::DcApiDecoderIdentity, - input: &kb_lib::MdCoreInstructionReplayInput, - observation: &kb_lib::DcApiDecodedObservation, - materializers: &[std::sync::Arc], -) -> kb_core::Result<(u64, u64)> + decoder_identity: &ks_lib::DcApiDecoderIdentity, + input: &ks_lib::MdCoreInstructionReplayInput, + observation: &ks_lib::DcApiDecodedObservation, + materializers: &[std::sync::Arc], +) -> ks_core::Result<(u64, u64)> where - S: kb_store::DecodePipelineStore + Sync, + S: ks_store::DecodePipelineStore + Sync, { tracing::debug!(target: crate::TRACING_TARGET, action = "execute_materializers", campaign_id = %campaign_id, signature = %input.signature, slot = input.slot, instruction_path = %input.instruction_path, program_id = %input.program_id, source_decoder_name = %decoder_identity.name, source_decoder_version = %decoder_identity.version, event_key = %observation.event_key, event_family = ?observation.event.event_family, materializer_count = materializers.len(), force_replay, "evaluate materializers for decoded observation"); let mut output_count = 0_u64; let mut refusal_count = 0_u64; for materializer in materializers { let identity = materializer.identity(); - if !kb_lib::materializer_api_accepts_observation(materializer.as_ref(), observation) { + if !ks_lib::materializer_api_accepts_observation(materializer.as_ref(), observation) { tracing::debug!(target: crate::TRACING_TARGET, action = "select_materializer", campaign_id = %campaign_id, signature = %input.signature, instruction_path = %input.instruction_path, event_key = %observation.event_key, materializer_name = %identity.name, materializer_version = %identity.version, accepted = false, event_family = ?observation.event.event_family, surface_code = %observation.event.surface_code.0.as_str(), entry_code = %observation.event.event_name.0.as_str(), "materializer does not accept decoded observation"); continue; } @@ -924,17 +924,17 @@ where let mut observation_json = match serialize_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot serialize decoded observation for materialization hash: {error}" ))); }, }; - let hash_result = kb_lib::decoder_api_deterministic_json_hash(&mut observation_json); + let hash_result = ks_lib::decoder_api_deterministic_json_hash(&mut observation_json); let input_hash = match hash_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let ledger_result = kb_store::ProcessingLedgerIdentity::new( + let ledger_result = ks_store::ProcessingLedgerIdentity::new( crate::EVENT_MATERIALIZATION_STAGE, identity.name.clone(), identity.version.clone(), @@ -959,7 +959,7 @@ where } else { tracing::debug!(target: crate::TRACING_TARGET, action = "check_materialization_ledger", campaign_id = %campaign_id, signature = %input.signature, instruction_path = %input.instruction_path, event_key = %observation.event_key, materializer_name = %identity.name, materializer_version = %identity.version, force_replay = true, ledger_check_bypassed = true, "force replay bypasses materialization skip check"); } - let policy_result = kb_lib::materializer_api_validate_materialization_policy( + let policy_result = ks_lib::materializer_api_validate_materialization_policy( materializer.as_ref(), observation, ); @@ -968,15 +968,15 @@ where std::result::Result::Err(refusal) => refusal, }; let output_policy_result = - kb_lib::materializer_api_validate_materialized_output_policy(observation, &execution); + ks_lib::materializer_api_validate_materialized_output_policy(observation, &execution); if let std::result::Result::Err(refusal) = output_policy_result { execution = refusal; } - if execution.status == kb_lib::MtApiMaterializerOutcomeStatus::Refused { + if execution.status == ks_lib::MtApiMaterializerOutcomeStatus::Refused { refusal_count += 1; } tracing::debug!(target: crate::TRACING_TARGET, action = "call_materializer", campaign_id = %campaign_id, signature = %input.signature, instruction_path = %input.instruction_path, event_key = %observation.event_key, materializer_name = %identity.name, materializer_version = %identity.version, status = ?execution.status, output_count = execution.outputs.len(), diagnostics = ?execution.diagnostics, "materializer returned"); - if execution.status == kb_lib::MtApiMaterializerOutcomeStatus::Failed { + if execution.status == ks_lib::MtApiMaterializerOutcomeStatus::Failed { tracing::error!( target: crate::TRACING_TARGET, action = "materializer_outcome_failure", @@ -1000,7 +1000,7 @@ where } let mut outputs = std::vec::Vec::with_capacity(execution.outputs.len()); for output in &execution.outputs { - outputs.push(kb_store::MaterializedOutputInsert { + outputs.push(ks_store::MaterializedOutputInsert { processor_name: identity.name.clone(), processor_version: identity.version.clone(), input_key: materializer_input_key.clone(), @@ -1014,12 +1014,12 @@ where }); } let materialization_error = - if execution.status == kb_lib::MtApiMaterializerOutcomeStatus::Failed { + if execution.status == ks_lib::MtApiMaterializerOutcomeStatus::Failed { execution.diagnostics.first() } else { std::option::Option::None }; - let bundle = kb_store::MaterializationPersistenceBundle { + let bundle = ks_store::MaterializationPersistenceBundle { ledger_identity, source_decoder_name: decoder_identity.name.clone(), source_decoder_version: decoder_identity.version.clone(), @@ -1046,7 +1046,7 @@ where let count = match count_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "materialized output count conversion failed: {error}" ))); }, @@ -1058,8 +1058,8 @@ where } fn materializer_input_key( - input: &kb_lib::MdCoreInstructionReplayInput, - decoder_identity: &kb_lib::DcApiDecoderIdentity, + input: &ks_lib::MdCoreInstructionReplayInput, + decoder_identity: &ks_lib::DcApiDecoderIdentity, event_key: &str, ) -> std::string::String { return format!( @@ -1069,18 +1069,18 @@ fn materializer_input_key( } fn validate_decoder_registry( - decoders: &[std::sync::Arc], -) -> kb_core::Result<()> { + decoders: &[std::sync::Arc], +) -> ks_core::Result<()> { let mut identities = std::collections::BTreeSet::new(); for decoder in decoders { let identity = decoder.identity(); if identity.name.trim().is_empty() || identity.version.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "decoder registry contains an empty processor identity", )); } if !identities.insert((identity.name, identity.version)) { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "decoder registry contains a duplicate processor identity", )); } @@ -1089,8 +1089,8 @@ fn validate_decoder_registry( } fn ordered_materializers( - materializers: &[std::sync::Arc], -) -> kb_core::Result>> { + materializers: &[std::sync::Arc], +) -> ks_core::Result>> { let mut output = materializers.to_vec(); output.sort_by(|left, right| { let left_identity = left.identity(); @@ -1104,13 +1104,13 @@ fn ordered_materializers( for materializer in &output { let identity = materializer.identity(); if identity.name.trim().is_empty() || identity.version.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "materializer registry contains an empty processor identity", )); } let key = (identity.name, identity.version); if previous.as_ref() == std::option::Option::Some(&key) { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "materializer registry contains a duplicate processor identity", )); } @@ -1131,8 +1131,8 @@ fn text_sample(values: &[std::string::String], limit: usize) -> std::vec::Vec<&s fn effective_selection( request: &crate::DecodeReplayRequest, - decoders: &[std::sync::Arc], -) -> kb_core::Result { + decoders: &[std::sync::Arc], +) -> ks_core::Result { let mut supported_program_ids = std::collections::BTreeSet::::new(); for decoder in decoders { for surface in decoder.surfaces() { @@ -1140,7 +1140,7 @@ fn effective_selection( } } if supported_program_ids.is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "enabled decoders declare no exact program ids", )); } @@ -1158,7 +1158,7 @@ fn effective_selection( } if !unsupported.is_empty() { unsupported.sort(); - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "selected program ids are not supported by enabled decoders: {}", unsupported.join(", ") ))); @@ -1172,7 +1172,7 @@ fn effective_selection( } else { request.selection.processing_states.clone() }; - return kb_store::DecodeSelectionFilter::new( + return ks_store::DecodeSelectionFilter::new( request.selection.signatures.clone(), processing_states, request.selection.min_slot, @@ -1186,8 +1186,8 @@ fn effective_selection( fn enabled_decoders( request: &crate::DecodeReplayRequest, - decoders: &[std::sync::Arc], -) -> std::vec::Vec> { + decoders: &[std::sync::Arc], +) -> std::vec::Vec> { let mut output = decoders .iter() .filter(|decoder| { @@ -1212,13 +1212,13 @@ fn enabled_decoders( fn rank_decoders<'decoder>( campaign_id: &str, - input: &kb_lib::MdCoreInstructionReplayInput, - decoders: &'decoder [std::sync::Arc], + input: &ks_lib::MdCoreInstructionReplayInput, + decoders: &'decoder [std::sync::Arc], ) -> std::vec::Vec> { let mut output = std::vec::Vec::new(); for decoder in decoders { let identity = decoder.identity(); - if !kb_lib::decoder_api_decoder_handles_program_id( + if !ks_lib::decoder_api_decoder_handles_program_id( decoder.as_ref(), input.program_id.as_str(), ) { @@ -1251,14 +1251,14 @@ fn rank_decoders<'decoder>( } fn coverage_declaration_inserts( - decoder: &dyn kb_lib::DcApiInstructionDecoder, -) -> std::vec::Vec { + decoder: &dyn ks_lib::DcApiInstructionDecoder, +) -> std::vec::Vec { let identity = decoder.identity(); return decoder .coverage() .into_iter() .map(|entry| { - return kb_store::DecodeCoverageDeclarationInsert { + return ks_store::DecodeCoverageDeclarationInsert { processor_name: identity.name.clone(), processor_version: identity.version.clone(), program_id: entry.program_id, @@ -1273,11 +1273,11 @@ fn coverage_declaration_inserts( } fn observation_inserts( - identity: &kb_lib::DcApiDecoderIdentity, - input: &kb_lib::MdCoreInstructionReplayInput, + identity: &ks_lib::DcApiDecoderIdentity, + input: &ks_lib::MdCoreInstructionReplayInput, input_hash: &str, - observations: &[kb_lib::DcApiDecodedObservation], -) -> kb_core::Result> { + observations: &[ks_lib::DcApiDecodedObservation], +) -> ks_core::Result> { let mut output = std::vec::Vec::with_capacity(observations.len()); for observation in observations { if observation.event.signature.0 != input.signature @@ -1287,7 +1287,7 @@ fn observation_inserts( || observation.transaction_failed != input.transaction_failed || observation.transaction_error != input.transaction_err_json { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "decoded observation context does not match contextual input", )); } @@ -1295,12 +1295,12 @@ fn observation_inserts( let proof_json = match proof_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::json(format!( + return std::result::Result::Err(ks_core::Error::json(format!( "cannot serialize decoder proof: {error}" ))); }, }; - output.push(kb_store::DecodeObservationInsert { + output.push(ks_store::DecodeObservationInsert { processor_name: identity.name.clone(), processor_version: identity.version.clone(), input_key: input.replay_input_key.clone(), @@ -1351,129 +1351,129 @@ fn merge_processor_summary( summaries.push(value); } -fn decoder_status_code(status: kb_lib::DcApiDecoderOutcomeStatus) -> &'static str { +fn decoder_status_code(status: ks_lib::DcApiDecoderOutcomeStatus) -> &'static str { return match status { - kb_lib::DcApiDecoderOutcomeStatus::Decoded => "decoded", - kb_lib::DcApiDecoderOutcomeStatus::Ignored => "ignored", - kb_lib::DcApiDecoderOutcomeStatus::Unsupported => "unsupported", - kb_lib::DcApiDecoderOutcomeStatus::Failed => "failed", + ks_lib::DcApiDecoderOutcomeStatus::Decoded => "decoded", + ks_lib::DcApiDecoderOutcomeStatus::Ignored => "ignored", + ks_lib::DcApiDecoderOutcomeStatus::Unsupported => "unsupported", + ks_lib::DcApiDecoderOutcomeStatus::Failed => "failed", }; } -fn materializer_status_code(status: kb_lib::MtApiMaterializerOutcomeStatus) -> &'static str { +fn materializer_status_code(status: ks_lib::MtApiMaterializerOutcomeStatus) -> &'static str { return match status { - kb_lib::MtApiMaterializerOutcomeStatus::Inserted => "inserted", - kb_lib::MtApiMaterializerOutcomeStatus::Replaced => "replaced", - kb_lib::MtApiMaterializerOutcomeStatus::Ignored => "ignored", - kb_lib::MtApiMaterializerOutcomeStatus::Refused => "refused", - kb_lib::MtApiMaterializerOutcomeStatus::Failed => "failed", + ks_lib::MtApiMaterializerOutcomeStatus::Inserted => "inserted", + ks_lib::MtApiMaterializerOutcomeStatus::Replaced => "replaced", + ks_lib::MtApiMaterializerOutcomeStatus::Ignored => "ignored", + ks_lib::MtApiMaterializerOutcomeStatus::Refused => "refused", + ks_lib::MtApiMaterializerOutcomeStatus::Failed => "failed", }; } -fn coverage_entry_kind_code(kind: kb_lib::DcApiDecoderCoverageEntryKind) -> &'static str { +fn coverage_entry_kind_code(kind: ks_lib::DcApiDecoderCoverageEntryKind) -> &'static str { return match kind { - kb_lib::DcApiDecoderCoverageEntryKind::Instruction => "instruction", - kb_lib::DcApiDecoderCoverageEntryKind::Event => "event", - kb_lib::DcApiDecoderCoverageEntryKind::Discriminator => "discriminator", + ks_lib::DcApiDecoderCoverageEntryKind::Instruction => "instruction", + ks_lib::DcApiDecoderCoverageEntryKind::Event => "event", + ks_lib::DcApiDecoderCoverageEntryKind::Discriminator => "discriminator", }; } -fn proof_kind_code(kind: kb_lib::DcApiDecoderProofKind) -> &'static str { +fn proof_kind_code(kind: ks_lib::DcApiDecoderProofKind) -> &'static str { return match kind { - kb_lib::DcApiDecoderProofKind::ExactDiscriminator => "exact_discriminator", - kb_lib::DcApiDecoderProofKind::ExactLayout => "exact_layout", - kb_lib::DcApiDecoderProofKind::Idl => "idl", - kb_lib::DcApiDecoderProofKind::Manual => "manual", - kb_lib::DcApiDecoderProofKind::LogCorrelation => "log_correlation", - kb_lib::DcApiDecoderProofKind::BalanceDelta => "balance_delta", - kb_lib::DcApiDecoderProofKind::Heuristic => "heuristic", - kb_lib::DcApiDecoderProofKind::Audit => "audit", - kb_lib::DcApiDecoderProofKind::Unknown => "unknown", + ks_lib::DcApiDecoderProofKind::ExactDiscriminator => "exact_discriminator", + ks_lib::DcApiDecoderProofKind::ExactLayout => "exact_layout", + ks_lib::DcApiDecoderProofKind::Idl => "idl", + ks_lib::DcApiDecoderProofKind::Manual => "manual", + ks_lib::DcApiDecoderProofKind::LogCorrelation => "log_correlation", + ks_lib::DcApiDecoderProofKind::BalanceDelta => "balance_delta", + ks_lib::DcApiDecoderProofKind::Heuristic => "heuristic", + ks_lib::DcApiDecoderProofKind::Audit => "audit", + ks_lib::DcApiDecoderProofKind::Unknown => "unknown", }; } -fn decoder_confidence_code(confidence: kb_lib::MdDecoderConfidence) -> &'static str { +fn decoder_confidence_code(confidence: ks_lib::MdDecoderConfidence) -> &'static str { return match confidence { - kb_lib::MdDecoderConfidence::Exact => "exact", - kb_lib::MdDecoderConfidence::IdlExact => "idl_exact", - kb_lib::MdDecoderConfidence::ManualExact => "manual_exact", - kb_lib::MdDecoderConfidence::Inferred => "inferred", - kb_lib::MdDecoderConfidence::Unsafe => "unsafe", - kb_lib::MdDecoderConfidence::AuditOnly => "audit_only", - kb_lib::MdDecoderConfidence::Unknown => "unknown", + ks_lib::MdDecoderConfidence::Exact => "exact", + ks_lib::MdDecoderConfidence::IdlExact => "idl_exact", + ks_lib::MdDecoderConfidence::ManualExact => "manual_exact", + ks_lib::MdDecoderConfidence::Inferred => "inferred", + ks_lib::MdDecoderConfidence::Unsafe => "unsafe", + ks_lib::MdDecoderConfidence::AuditOnly => "audit_only", + ks_lib::MdDecoderConfidence::Unknown => "unknown", }; } -fn event_source_kind_code(kind: kb_lib::MdEventSourceKind) -> &'static str { +fn event_source_kind_code(kind: ks_lib::MdEventSourceKind) -> &'static str { return match kind { - kb_lib::MdEventSourceKind::Instruction => "instruction", - kb_lib::MdEventSourceKind::InnerInstruction => "inner_instruction", - kb_lib::MdEventSourceKind::Log => "log", - kb_lib::MdEventSourceKind::AnchorEvent => "anchor_event", - kb_lib::MdEventSourceKind::AnchorSelfCpiEvent => "anchor_self_cpi_event", - kb_lib::MdEventSourceKind::BalanceDelta => "balance_delta", - kb_lib::MdEventSourceKind::Synthetic => "synthetic", - kb_lib::MdEventSourceKind::Inferred => "inferred", - kb_lib::MdEventSourceKind::Audit => "audit", + ks_lib::MdEventSourceKind::Instruction => "instruction", + ks_lib::MdEventSourceKind::InnerInstruction => "inner_instruction", + ks_lib::MdEventSourceKind::Log => "log", + ks_lib::MdEventSourceKind::AnchorEvent => "anchor_event", + ks_lib::MdEventSourceKind::AnchorSelfCpiEvent => "anchor_self_cpi_event", + ks_lib::MdEventSourceKind::BalanceDelta => "balance_delta", + ks_lib::MdEventSourceKind::Synthetic => "synthetic", + ks_lib::MdEventSourceKind::Inferred => "inferred", + ks_lib::MdEventSourceKind::Audit => "audit", }; } -fn event_family_code(family: kb_lib::MdEventFamily) -> &'static str { +fn event_family_code(family: ks_lib::MdEventFamily) -> &'static str { return match family { - kb_lib::MdEventFamily::Trade => "trade", - kb_lib::MdEventFamily::Liquidity => "liquidity", - kb_lib::MdEventFamily::Lifecycle => "lifecycle", - kb_lib::MdEventFamily::Fee => "fee", - kb_lib::MdEventFamily::Admin => "admin", - kb_lib::MdEventFamily::Reward => "reward", - kb_lib::MdEventFamily::Orderbook => "orderbook", - kb_lib::MdEventFamily::TokenAccount => "token_account", - kb_lib::MdEventFamily::TokenMint => "token_mint", - kb_lib::MdEventFamily::TokenBurn => "token_burn", - kb_lib::MdEventFamily::Nft => "nft", - kb_lib::MdEventFamily::Metadata => "metadata", - kb_lib::MdEventFamily::Oracle => "oracle", - kb_lib::MdEventFamily::Lending => "lending", - kb_lib::MdEventFamily::Staking => "staking", - kb_lib::MdEventFamily::Governance => "governance", - kb_lib::MdEventFamily::Bridge => "bridge", - kb_lib::MdEventFamily::Perpetuals => "perpetuals", - kb_lib::MdEventFamily::Vault => "vault", - kb_lib::MdEventFamily::Routing => "routing", - kb_lib::MdEventFamily::ComplianceAudit => "compliance_audit", - kb_lib::MdEventFamily::TokenMetadataRisk => "token_metadata_risk", - kb_lib::MdEventFamily::Risk => "risk", - kb_lib::MdEventFamily::Audit => "audit", - kb_lib::MdEventFamily::Unknown => "unknown", + ks_lib::MdEventFamily::Trade => "trade", + ks_lib::MdEventFamily::Liquidity => "liquidity", + ks_lib::MdEventFamily::Lifecycle => "lifecycle", + ks_lib::MdEventFamily::Fee => "fee", + ks_lib::MdEventFamily::Admin => "admin", + ks_lib::MdEventFamily::Reward => "reward", + ks_lib::MdEventFamily::Orderbook => "orderbook", + ks_lib::MdEventFamily::TokenAccount => "token_account", + ks_lib::MdEventFamily::TokenMint => "token_mint", + ks_lib::MdEventFamily::TokenBurn => "token_burn", + ks_lib::MdEventFamily::Nft => "nft", + ks_lib::MdEventFamily::Metadata => "metadata", + ks_lib::MdEventFamily::Oracle => "oracle", + ks_lib::MdEventFamily::Lending => "lending", + ks_lib::MdEventFamily::Staking => "staking", + ks_lib::MdEventFamily::Governance => "governance", + ks_lib::MdEventFamily::Bridge => "bridge", + ks_lib::MdEventFamily::Perpetuals => "perpetuals", + ks_lib::MdEventFamily::Vault => "vault", + ks_lib::MdEventFamily::Routing => "routing", + ks_lib::MdEventFamily::ComplianceAudit => "compliance_audit", + ks_lib::MdEventFamily::TokenMetadataRisk => "token_metadata_risk", + ks_lib::MdEventFamily::Risk => "risk", + ks_lib::MdEventFamily::Audit => "audit", + ks_lib::MdEventFamily::Unknown => "unknown", }; } -fn materialized_family_code(family: kb_lib::MdMaterializedEventFamily) -> &'static str { +fn materialized_family_code(family: ks_lib::MdMaterializedEventFamily) -> &'static str { return match family { - kb_lib::MdMaterializedEventFamily::Trade => "trade", - kb_lib::MdMaterializedEventFamily::Liquidity => "liquidity", - kb_lib::MdMaterializedEventFamily::Lifecycle => "lifecycle", - kb_lib::MdMaterializedEventFamily::Fee => "fee", - kb_lib::MdMaterializedEventFamily::Admin => "admin", - kb_lib::MdMaterializedEventFamily::TokenAccount => "token_account", - kb_lib::MdMaterializedEventFamily::PoolState => "pool_state", - kb_lib::MdMaterializedEventFamily::Orderbook => "orderbook", - kb_lib::MdMaterializedEventFamily::Reward => "reward", - kb_lib::MdMaterializedEventFamily::Nft => "nft", - kb_lib::MdMaterializedEventFamily::Metadata => "metadata", - kb_lib::MdMaterializedEventFamily::Oracle => "oracle", - kb_lib::MdMaterializedEventFamily::Lending => "lending", - kb_lib::MdMaterializedEventFamily::Staking => "staking", - kb_lib::MdMaterializedEventFamily::Governance => "governance", - kb_lib::MdMaterializedEventFamily::Bridge => "bridge", - kb_lib::MdMaterializedEventFamily::Perpetuals => "perpetuals", - kb_lib::MdMaterializedEventFamily::Vault => "vault", - kb_lib::MdMaterializedEventFamily::Routing => "routing", - kb_lib::MdMaterializedEventFamily::ComplianceAudit => "compliance_audit", - kb_lib::MdMaterializedEventFamily::TokenMetadataRisk => "token_metadata_risk", - kb_lib::MdMaterializedEventFamily::Risk => "risk", - kb_lib::MdMaterializedEventFamily::TransactionAnnotation => "transaction_annotation", - kb_lib::MdMaterializedEventFamily::Unknown => "unknown", + ks_lib::MdMaterializedEventFamily::Trade => "trade", + ks_lib::MdMaterializedEventFamily::Liquidity => "liquidity", + ks_lib::MdMaterializedEventFamily::Lifecycle => "lifecycle", + ks_lib::MdMaterializedEventFamily::Fee => "fee", + ks_lib::MdMaterializedEventFamily::Admin => "admin", + ks_lib::MdMaterializedEventFamily::TokenAccount => "token_account", + ks_lib::MdMaterializedEventFamily::PoolState => "pool_state", + ks_lib::MdMaterializedEventFamily::Orderbook => "orderbook", + ks_lib::MdMaterializedEventFamily::Reward => "reward", + ks_lib::MdMaterializedEventFamily::Nft => "nft", + ks_lib::MdMaterializedEventFamily::Metadata => "metadata", + ks_lib::MdMaterializedEventFamily::Oracle => "oracle", + ks_lib::MdMaterializedEventFamily::Lending => "lending", + ks_lib::MdMaterializedEventFamily::Staking => "staking", + ks_lib::MdMaterializedEventFamily::Governance => "governance", + ks_lib::MdMaterializedEventFamily::Bridge => "bridge", + ks_lib::MdMaterializedEventFamily::Perpetuals => "perpetuals", + ks_lib::MdMaterializedEventFamily::Vault => "vault", + ks_lib::MdMaterializedEventFamily::Routing => "routing", + ks_lib::MdMaterializedEventFamily::ComplianceAudit => "compliance_audit", + ks_lib::MdMaterializedEventFamily::TokenMetadataRisk => "token_metadata_risk", + ks_lib::MdMaterializedEventFamily::Risk => "risk", + ks_lib::MdMaterializedEventFamily::TransactionAnnotation => "transaction_annotation", + ks_lib::MdMaterializedEventFamily::Unknown => "unknown", }; } @@ -1496,7 +1496,7 @@ mod tests { }; } - static SURFACES: &[kb_lib::DcApiDecoderSurface] = &[kb_lib::DcApiDecoderSurface { + static SURFACES: &[ks_lib::DcApiDecoderSurface] = &[ks_lib::DcApiDecoderSurface { program_id: "program_a", surface_code: "surface_a", priority: 10, @@ -1508,23 +1508,23 @@ mod tests { priority: u16, } - impl kb_lib::DcApiInstructionDecoder for TestDecoder { - fn identity(&self) -> kb_lib::DcApiDecoderIdentity { - return kb_lib::DcApiDecoderIdentity { + impl ks_lib::DcApiInstructionDecoder for TestDecoder { + fn identity(&self) -> ks_lib::DcApiDecoderIdentity { + return ks_lib::DcApiDecoderIdentity { name: "test_decoder".to_string(), version: self.version.to_string(), }; } - fn surfaces(&self) -> &'static [kb_lib::DcApiDecoderSurface] { + fn surfaces(&self) -> &'static [ks_lib::DcApiDecoderSurface] { return SURFACES; } - fn coverage(&self) -> std::vec::Vec { - return std::vec![kb_lib::DcApiDecoderCoverageDeclaration { + fn coverage(&self) -> std::vec::Vec { + return std::vec![ks_lib::DcApiDecoderCoverageDeclaration { program_id: "program_a".to_string(), surface_code: std::option::Option::Some("surface_a".to_string()), - entry_kind: kb_lib::DcApiDecoderCoverageEntryKind::Instruction, + entry_kind: ks_lib::DcApiDecoderCoverageEntryKind::Instruction, entry_code: "attempt".to_string(), discriminator_hex: std::option::Option::None, historical: false, @@ -1533,51 +1533,51 @@ mod tests { fn recognize( &self, - input: &kb_lib::MdCoreInstructionReplayInput, - ) -> kb_lib::DcApiDecoderRecognition { + input: &ks_lib::MdCoreInstructionReplayInput, + ) -> ks_lib::DcApiDecoderRecognition { if input.program_id != "program_a" { - return kb_lib::DcApiDecoderRecognition::incompatible(); + return ks_lib::DcApiDecoderRecognition::incompatible(); } - return kb_lib::DcApiDecoderRecognition::compatible( + return ks_lib::DcApiDecoderRecognition::compatible( self.exact, self.priority, std::option::Option::Some("surface_a".to_string()), std::option::Option::Some("attempt".to_string()), - kb_lib::decoder_api_discriminator_8_hex(input), + ks_lib::decoder_api_discriminator_8_hex(input), ); } fn decode( &self, - input: &kb_lib::MdCoreInstructionReplayInput, - ) -> kb_lib::DcApiDecoderExecutionResult { - let observation = kb_lib::DcApiDecodedObservation { + input: &ks_lib::MdCoreInstructionReplayInput, + ) -> ks_lib::DcApiDecoderExecutionResult { + let observation = ks_lib::DcApiDecodedObservation { event_key: "attempt".to_string(), - event: kb_lib::MdDecodedProtocolEvent { - signature: kb_lib::MdSignature(input.signature.clone()), - slot: kb_lib::MdSlot(input.slot), - instruction_path: kb_lib::MdInstructionPath(input.instruction_path.clone()), - program_id: kb_lib::MdProgramId(input.program_id.clone()), - protocol_code: kb_lib::MdProtocolCode("test".to_string()), - surface_code: kb_lib::MdSurfaceCode("surface_a".to_string()), - event_code: kb_lib::MdEventCode("attempt".to_string()), - event_name: kb_lib::MdEventName("attempt".to_string()), - event_family: kb_lib::MdEventFamily::Audit, - source_kind: kb_lib::MdEventSourceKind::Instruction, - confidence: kb_lib::MdDecoderConfidence::Exact, + event: ks_lib::MdDecodedProtocolEvent { + signature: ks_lib::MdSignature(input.signature.clone()), + slot: ks_lib::MdSlot(input.slot), + instruction_path: ks_lib::MdInstructionPath(input.instruction_path.clone()), + program_id: ks_lib::MdProgramId(input.program_id.clone()), + protocol_code: ks_lib::MdProtocolCode("test".to_string()), + surface_code: ks_lib::MdSurfaceCode("surface_a".to_string()), + event_code: ks_lib::MdEventCode("attempt".to_string()), + event_name: ks_lib::MdEventName("attempt".to_string()), + event_family: ks_lib::MdEventFamily::Audit, + source_kind: ks_lib::MdEventSourceKind::Instruction, + confidence: ks_lib::MdDecoderConfidence::Exact, }, payload_json: serde_json::json!({"attempted": true}), transaction_failed: input.transaction_failed, transaction_error: input.transaction_err_json.clone(), observation_committed: !input.transaction_failed, - proof: kb_lib::DcApiDecoderProof { - kind: kb_lib::DcApiDecoderProofKind::ExactLayout, - confidence: kb_lib::MdDecoderConfidence::Exact, + proof: ks_lib::DcApiDecoderProof { + kind: ks_lib::DcApiDecoderProofKind::ExactLayout, + confidence: ks_lib::MdDecoderConfidence::Exact, evidence: std::vec!["test".to_string()], }, }; - return kb_lib::DcApiDecoderExecutionResult { - status: kb_lib::DcApiDecoderOutcomeStatus::Decoded, + return ks_lib::DcApiDecoderExecutionResult { + status: ks_lib::DcApiDecoderOutcomeStatus::Decoded, recognized_entry_code: std::option::Option::Some("attempt".to_string()), observations: std::vec![observation], diagnostics: std::vec::Vec::new(), @@ -1587,37 +1587,37 @@ mod tests { struct SelectiveAuditMaterializer; - impl kb_lib::MtApiEventMaterializer for SelectiveAuditMaterializer { - fn identity(&self) -> kb_lib::MtApiMaterializerIdentity { - return kb_lib::MtApiMaterializerIdentity { + impl ks_lib::MtApiEventMaterializer for SelectiveAuditMaterializer { + fn identity(&self) -> ks_lib::MtApiMaterializerIdentity { + return ks_lib::MtApiMaterializerIdentity { name: "selective_audit_materializer".to_string(), version: "1".to_string(), }; } - fn accepted_families(&self) -> &'static [kb_lib::MdEventFamily] { - return &[kb_lib::MdEventFamily::Audit]; + fn accepted_families(&self) -> &'static [ks_lib::MdEventFamily] { + return &[ks_lib::MdEventFamily::Audit]; } - fn accepts_observation(&self, observation: &kb_lib::DcApiDecodedObservation) -> bool { + fn accepts_observation(&self, observation: &ks_lib::DcApiDecodedObservation) -> bool { return observation.event.surface_code.0.as_str() == "accepted_surface"; } fn transaction_policy( &self, - _family: kb_lib::MdEventFamily, - ) -> kb_lib::MtApiMaterializationTransactionPolicy { - return kb_lib::MtApiMaterializationTransactionPolicy::SuccessfulCommittedOnly; + _family: ks_lib::MdEventFamily, + ) -> ks_lib::MtApiMaterializationTransactionPolicy { + return ks_lib::MtApiMaterializationTransactionPolicy::SuccessfulCommittedOnly; } fn materialize( &self, - _observation: &kb_lib::DcApiDecodedObservation, - ) -> kb_lib::MtApiMaterializerExecutionResult { - return kb_lib::MtApiMaterializerExecutionResult { - status: kb_lib::MtApiMaterializerOutcomeStatus::Failed, + _observation: &ks_lib::DcApiDecodedObservation, + ) -> ks_lib::MtApiMaterializerExecutionResult { + return ks_lib::MtApiMaterializerExecutionResult { + status: ks_lib::MtApiMaterializerOutcomeStatus::Failed, outputs: std::vec::Vec::new(), - diagnostics: std::vec![kb_lib::MtApiMaterializerDiagnostic { + diagnostics: std::vec![ks_lib::MtApiMaterializerDiagnostic { code: "unexpected_materializer_call".to_string(), message: "selective materializer must not be called for an unaccepted observation" @@ -1642,25 +1642,25 @@ mod tests { #[derive(Default)] struct TestStore { - inputs: std::sync::Mutex>, - filters: std::sync::Mutex>, + inputs: std::sync::Mutex>, + filters: std::sync::Mutex>, current: std::sync::Mutex>, - decode_bundles: std::sync::Mutex>, + decode_bundles: std::sync::Mutex>, materialization_bundles: - std::sync::Mutex>, - declarations: std::sync::Mutex>, + std::sync::Mutex>, + declarations: std::sync::Mutex>, } #[async_trait::async_trait] - impl kb_store::DecodePipelineStore for TestStore { + impl ks_store::DecodePipelineStore for TestStore { #[expect( clippy::implicit_return, reason = "async_trait expansion triggers implicit_return on generated async trait methods." )] async fn list_decode_inputs( &self, - filter: &kb_store::DecodeSelectionFilter, - ) -> kb_core::Result> { + filter: &ks_store::DecodeSelectionFilter, + ) -> ks_core::Result> { super::tests::lock_or_panic(&self.filters).push(filter.clone()); let limit_result = usize::try_from(filter.limit); let limit = match limit_result { @@ -1689,8 +1689,8 @@ mod tests { )] async fn is_decode_current( &self, - identity: &kb_store::ProcessingLedgerIdentity, - ) -> kb_core::Result { + identity: &ks_store::ProcessingLedgerIdentity, + ) -> ks_core::Result { let key = format!( "{}:{}:{}:{}:{}", identity.stage, @@ -1710,10 +1710,10 @@ mod tests { )] async fn persist_decode_coverage_declarations( &self, - declarations: &[kb_store::DecodeCoverageDeclarationInsert], - ) -> kb_core::Result { + declarations: &[ks_store::DecodeCoverageDeclarationInsert], + ) -> ks_core::Result { super::tests::lock_or_panic(&self.declarations).extend_from_slice(declarations); - return std::result::Result::Ok(kb_store::InsertOutcome::new( + return std::result::Result::Ok(ks_store::InsertOutcome::new( declarations.len() as u64, 0, 0, @@ -1726,9 +1726,9 @@ mod tests { )] async fn persist_decode_result( &self, - bundle: &kb_store::DecodePersistenceBundle, + bundle: &ks_store::DecodePersistenceBundle, force_replay: bool, - ) -> kb_core::Result { + ) -> ks_core::Result { let key = format!( "{}:{}:{}:{}:{}", bundle.ledger_identity.stage, @@ -1749,7 +1749,7 @@ mod tests { }); } bundles.push(bundle.clone()); - return std::result::Result::Ok(kb_store::InsertOutcome::new(1, 1, 0)); + return std::result::Result::Ok(ks_store::InsertOutcome::new(1, 1, 0)); } #[expect( @@ -1758,9 +1758,9 @@ mod tests { )] async fn mark_decode_failed( &self, - _failure: &kb_store::DecodeFailure, - ) -> kb_core::Result { - return std::result::Result::Ok(kb_store::InsertOutcome::new(0, 1, 0)); + _failure: &ks_store::DecodeFailure, + ) -> ks_core::Result { + return std::result::Result::Ok(ks_store::InsertOutcome::new(0, 1, 0)); } #[expect( @@ -1769,9 +1769,9 @@ mod tests { )] async fn persist_materialization_result( &self, - bundle: &kb_store::MaterializationPersistenceBundle, + bundle: &ks_store::MaterializationPersistenceBundle, force_replay: bool, - ) -> kb_core::Result { + ) -> ks_core::Result { let key = format!( "{}:{}:{}:{}:{}", bundle.ledger_identity.stage, @@ -1796,12 +1796,12 @@ mod tests { let count = match count_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::invalid_state(format!( + return std::result::Result::Err(ks_core::Error::invalid_state(format!( "test materialization output count conversion failed: {error}" ))); }, }; - return std::result::Result::Ok(kb_store::InsertOutcome::new(count, 1, 0)); + return std::result::Result::Ok(ks_store::InsertOutcome::new(count, 1, 0)); } #[expect( @@ -1813,7 +1813,7 @@ mod tests { _processor_name: std::option::Option<&str>, _processor_version: std::option::Option<&str>, _limit: u32, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } @@ -1823,14 +1823,14 @@ mod tests { )] async fn list_materialized_events( &self, - _filter: &kb_store::MaterializedEventFilter, - ) -> kb_core::Result> { + _filter: &ks_store::MaterializedEventFilter, + ) -> ks_core::Result> { return std::result::Result::Ok(std::vec::Vec::new()); } } - fn replay_input(program_id: &str, failed: bool) -> kb_lib::MdCoreInstructionReplayInput { - let result = kb_lib::MdCoreInstructionReplayInput::new( + fn replay_input(program_id: &str, failed: bool) -> ks_lib::MdCoreInstructionReplayInput { + let result = ks_lib::MdCoreInstructionReplayInput::new( "signature:0", "signature", 42, @@ -1857,7 +1857,7 @@ mod tests { fn request(force_replay: bool) -> crate::DecodeReplayRequest { return crate::DecodeReplayRequest { campaign_id: "decode-test-campaign".to_string(), - selection: super::tests::result_or_panic(kb_store::DecodeSelectionFilter::actionable( + selection: super::tests::result_or_panic(ks_store::DecodeSelectionFilter::actionable( 10, )), decoder_names: std::vec::Vec::new(), @@ -1869,13 +1869,13 @@ mod tests { }; } - fn memo_replay_input(failed: bool) -> kb_lib::MdCoreInstructionReplayInput { - let result = kb_lib::MdCoreInstructionReplayInput::new( + fn memo_replay_input(failed: bool) -> ks_lib::MdCoreInstructionReplayInput { + let result = ks_lib::MdCoreInstructionReplayInput::new( "memo-signature:0", "memo-signature", 84, "0", - kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, failed, if failed { std::option::Option::Some(serde_json::json!({ @@ -1900,7 +1900,7 @@ mod tests { #[test] fn dispatch_is_exact_by_program_and_rank() { - let decoders: std::vec::Vec> = std::vec![ + let decoders: std::vec::Vec> = std::vec![ std::sync::Arc::new(TestDecoder { version: "1", exact: false, @@ -1922,9 +1922,9 @@ mod tests { fn decoded_observation_context_must_match_core_input() { let input = replay_input("program_a", true); let decoder = TestDecoder { version: "1", exact: true, priority: 1 }; - let mut execution = kb_lib::DcApiInstructionDecoder::decode(&decoder, &input); - execution.observations[0].event.slot = kb_lib::MdSlot(input.slot + 1); - let identity = kb_lib::DcApiInstructionDecoder::identity(&decoder); + let mut execution = ks_lib::DcApiInstructionDecoder::decode(&decoder, &input); + execution.observations[0].event.slot = ks_lib::MdSlot(input.slot + 1); + let identity = ks_lib::DcApiInstructionDecoder::identity(&decoder); let result = super::observation_inserts(&identity, &input, "input-hash", &execution.observations); assert!(result.is_err()); @@ -1932,7 +1932,7 @@ mod tests { #[test] fn duplicate_decoder_identity_is_rejected() { - let decoders: std::vec::Vec> = std::vec![ + let decoders: std::vec::Vec> = std::vec![ std::sync::Arc::new(TestDecoder { version: "1", exact: true, priority: 1 }), std::sync::Arc::new(TestDecoder { version: "1", exact: false, priority: 2 }), ]; @@ -1943,11 +1943,11 @@ mod tests { #[test] fn materializer_input_key_changes_with_decoder_version() { let input = replay_input("program_a", false); - let version_one = kb_lib::DcApiDecoderIdentity { + let version_one = ks_lib::DcApiDecoderIdentity { name: "test_decoder".to_string(), version: "1".to_string(), }; - let version_two = kb_lib::DcApiDecoderIdentity { + let version_two = ks_lib::DcApiDecoderIdentity { name: "test_decoder".to_string(), version: "2".to_string(), }; @@ -1958,7 +1958,7 @@ mod tests { #[test] fn effective_selection_uses_enabled_decoder_programs() { - let decoders: std::vec::Vec> = + let decoders: std::vec::Vec> = std::vec![std::sync::Arc::new(TestDecoder { version: "1", exact: true, priority: 1 })]; let selection = super::tests::result_or_panic(super::effective_selection( &request(false), @@ -1970,7 +1970,7 @@ mod tests { #[test] fn force_replay_with_explicit_signatures_bypasses_state_filter() { - let decoders: std::vec::Vec> = + let decoders: std::vec::Vec> = std::vec![std::sync::Arc::new(TestDecoder { version: "1", exact: true, priority: 1 })]; let mut replay_request = request(true); replay_request.force_replay_all_matching = false; @@ -2000,7 +2000,7 @@ mod tests { #[test] fn force_replay_all_matching_bypasses_state_filter() { - let decoders: std::vec::Vec> = + let decoders: std::vec::Vec> = std::vec![std::sync::Arc::new(TestDecoder { version: "1", exact: true, priority: 1 })]; let replay_request = request(true); let selection = super::tests::result_or_panic(super::effective_selection( @@ -2014,9 +2014,9 @@ mod tests { async fn observation_level_materializer_filter_avoids_false_refusals() { let store = TestStore::default(); super::tests::lock_or_panic(&store.inputs).push(replay_input("program_a", false)); - let decoders: std::vec::Vec> = + let decoders: std::vec::Vec> = std::vec![std::sync::Arc::new(TestDecoder { version: "1", exact: true, priority: 1 })]; - let materializers: std::vec::Vec> = + let materializers: std::vec::Vec> = std::vec![std::sync::Arc::new(SelectiveAuditMaterializer)]; let observer = TestObserver { cancelled: std::sync::atomic::AtomicBool::new(false), @@ -2042,7 +2042,7 @@ mod tests { async fn materialization_without_materializer_is_rejected() { let store = TestStore::default(); super::tests::lock_or_panic(&store.inputs).push(replay_input("program_a", false)); - let decoders: std::vec::Vec> = + let decoders: std::vec::Vec> = std::vec![std::sync::Arc::new(TestDecoder { version: "1", exact: true, priority: 1 })]; let observer = TestObserver { cancelled: std::sync::atomic::AtomicBool::new(false), @@ -2056,7 +2056,7 @@ mod tests { #[test] fn explicit_unsupported_program_is_rejected_before_selection() { - let decoders: std::vec::Vec> = + let decoders: std::vec::Vec> = std::vec![std::sync::Arc::new(TestDecoder { version: "1", exact: true, priority: 1 })]; let mut replay_request = request(false); replay_request.selection.program_ids = std::vec!["unrelated".to_string()]; @@ -2072,7 +2072,7 @@ mod tests { inputs.push(replay_input("program_a", false)); inputs.push(replay_input("unrelated", false)); } - let decoders: std::vec::Vec> = + let decoders: std::vec::Vec> = std::vec![std::sync::Arc::new(TestDecoder { version: "1", exact: true, priority: 1 })]; let observer = TestObserver { cancelled: std::sync::atomic::AtomicBool::new(false), @@ -2089,7 +2089,7 @@ mod tests { async fn same_version_and_hash_is_skipped() { let store = TestStore::default(); super::tests::lock_or_panic(&store.inputs).push(replay_input("program_a", false)); - let decoders: std::vec::Vec> = + let decoders: std::vec::Vec> = std::vec![std::sync::Arc::new(TestDecoder { version: "1", exact: true, priority: 1 })]; let observer = TestObserver { cancelled: std::sync::atomic::AtomicBool::new(false), @@ -2111,9 +2111,9 @@ mod tests { let observer = TestObserver { cancelled: std::sync::atomic::AtomicBool::new(false), }; - let version_one: std::vec::Vec> = + let version_one: std::vec::Vec> = std::vec![std::sync::Arc::new(TestDecoder { version: "1", exact: true, priority: 1 })]; - let version_two: std::vec::Vec> = + let version_two: std::vec::Vec> = std::vec![std::sync::Arc::new(TestDecoder { version: "2", exact: true, priority: 1 })]; super::tests::result_or_panic( crate::execute_decode_replay(&store, &request(false), &version_one, &[], &observer) @@ -2145,7 +2145,7 @@ mod tests { async fn failed_transaction_observation_is_persisted_uncommitted() { let store = TestStore::default(); super::tests::lock_or_panic(&store.inputs).push(replay_input("program_a", true)); - let decoders: std::vec::Vec> = + let decoders: std::vec::Vec> = std::vec![std::sync::Arc::new(TestDecoder { version: "1", exact: true, priority: 1 })]; let observer = TestObserver { cancelled: std::sync::atomic::AtomicBool::new(false), @@ -2162,10 +2162,10 @@ mod tests { async fn concrete_memo_replay_materializes_only_committed_annotations_idempotently() { let store = TestStore::default(); super::tests::lock_or_panic(&store.inputs).push(memo_replay_input(false)); - let decoders: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::DcSplMemoDecoder)]; - let materializers: std::vec::Vec> = - std::vec![std::sync::Arc::new(kb_lib::MtTransactionAnnotationMaterializer,)]; + let decoders: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::DcSplMemoDecoder)]; + let materializers: std::vec::Vec> = + std::vec![std::sync::Arc::new(ks_lib::MtTransactionAnnotationMaterializer,)]; let observer = TestObserver { cancelled: std::sync::atomic::AtomicBool::new(false), }; @@ -2223,7 +2223,7 @@ mod tests { async fn declared_and_observed_coverage_are_recorded() { let store = TestStore::default(); super::tests::lock_or_panic(&store.inputs).push(replay_input("program_a", false)); - let decoders: std::vec::Vec> = + let decoders: std::vec::Vec> = std::vec![std::sync::Arc::new(TestDecoder { version: "1", exact: true, priority: 1 })]; let observer = TestObserver { cancelled: std::sync::atomic::AtomicBool::new(false), @@ -2246,7 +2246,7 @@ mod tests { async fn cancellation_leaves_candidates_not_started() { let store = TestStore::default(); super::tests::lock_or_panic(&store.inputs).push(replay_input("program_a", false)); - let decoders: std::vec::Vec> = + let decoders: std::vec::Vec> = std::vec![std::sync::Arc::new(TestDecoder { version: "1", exact: true, priority: 1 })]; let observer = TestObserver { cancelled: std::sync::atomic::AtomicBool::new(true), diff --git a/kb-pipeline/src/lib.rs b/ks-pipeline/src/lib.rs similarity index 99% rename from kb-pipeline/src/lib.rs rename to ks-pipeline/src/lib.rs index 59afd64..55eff18 100644 --- a/kb-pipeline/src/lib.rs +++ b/ks-pipeline/src/lib.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/lib.rs -// version: 21 +// file: ks-pipeline/src/lib.rs +// version: 22 #![forbid(unsafe_code)] #![deny(unreachable_pub)] @@ -124,7 +124,7 @@ pub use self::metadata_metaplex_token_metadata_stateful::MetaplexTokenMetadataSt pub use self::metadata_metaplex_token_metadata_stateful::MetaplexTokenMetadataStatefulReadResult; /// Canonical bounded Metaplex state snapshot. pub use self::metadata_metaplex_token_metadata_stateful::MetaplexTokenMetadataStatefulSnapshot; -/// Validates one RPC account response and delegates parsing to `kb-lib`. +/// Validates one RPC account response and delegates parsing to `ks-lib`. pub use self::metadata_metaplex_token_metadata_stateful::materialize_metaplex_token_metadata_account_info_result; /// Reads one bounded Metaplex Token Metadata account. pub use self::metadata_metaplex_token_metadata_stateful::read_metaplex_token_metadata_stateful_snapshot; diff --git a/kb-pipeline/src/metadata_metaplex_token_metadata_execution_orchestration.rs b/ks-pipeline/src/metadata_metaplex_token_metadata_execution_orchestration.rs similarity index 87% rename from kb-pipeline/src/metadata_metaplex_token_metadata_execution_orchestration.rs rename to ks-pipeline/src/metadata_metaplex_token_metadata_execution_orchestration.rs index a0381e6..8884594 100644 --- a/kb-pipeline/src/metadata_metaplex_token_metadata_execution_orchestration.rs +++ b/ks-pipeline/src/metadata_metaplex_token_metadata_execution_orchestration.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/metadata_metaplex_token_metadata_execution_orchestration.rs -// version: 3 +// file: ks-pipeline/src/metadata_metaplex_token_metadata_execution_orchestration.rs +// version: 4 //! Simulation-first Metaplex Token Metadata execution orchestration. @@ -10,7 +10,7 @@ pub const MAX_METAPLEX_TOKEN_METADATA_EXECUTION_SIGNERS: usize = 32; #[derive(Clone, Debug, PartialEq)] pub struct MetaplexTokenMetadataExecutionReadinessRequest { /// Exact prepared execution plan. - pub plan: kb_lib::ExApiPreparedExecutionPlan, + pub plan: ks_lib::ExApiPreparedExecutionPlan, /// Successful stateful preflight report. pub preflight: crate::MetaplexTokenMetadataPreflightReport, /// Exact compiled message hash. @@ -22,7 +22,7 @@ pub struct MetaplexTokenMetadataExecutionReadinessRequest { /// Whether simulation succeeded. pub simulation_succeeded: bool, /// Public keys available to sign. - pub resolved_signers: std::vec::Vec, + pub resolved_signers: std::vec::Vec, /// Whether submission was requested. pub submit: bool, /// Whether the operator confirmed submission. @@ -39,7 +39,7 @@ pub struct MetaplexTokenMetadataExecutionReadinessReport { /// Confirmed preflight context slot. pub context_slot: u64, /// Deduplicated required signers. - pub required_signers: std::vec::Vec, + pub required_signers: std::vec::Vec, /// Whether signing and submission are authorized. pub send_authorized: bool, /// Ordered readiness checks, including a probe-only failed-simulation marker when applicable. @@ -51,9 +51,9 @@ pub struct MetaplexTokenMetadataExecutionReadinessReport { /// Failed simulations remain observable only for `submit=false`; submission always requires success. pub fn validate_metaplex_token_metadata_execution_readiness( request: &crate::MetaplexTokenMetadataExecutionReadinessRequest, -) -> kb_core::Result { +) -> ks_core::Result { if request.plan.operation_code != request.preflight.operation_code { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_execution_operation_mismatch", "Metaplex plan and preflight operation codes must match", )); @@ -62,19 +62,19 @@ pub fn validate_metaplex_token_metadata_execution_readiness( || request.message_hash != request.simulated_message_hash || !request.simulated { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_execution_simulation_required", "Metaplex execution requires exact-message simulation evidence", )); } if request.submit && !request.simulation_succeeded { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_execution_simulation_required", "Metaplex submission requires successful exact-message simulation", )); } if request.resolved_signers.len() > crate::MAX_METAPLEX_TOKEN_METADATA_EXECUTION_SIGNERS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_execution_signer_limit_exceeded", "Metaplex execution signer limit exceeded", )); @@ -84,10 +84,10 @@ pub fn validate_metaplex_token_metadata_execution_readiness( .iter() .map(|item| return item.0.clone()) .collect::>(); - let mut required = std::collections::BTreeMap::::new(); + let mut required = std::collections::BTreeMap::::new(); for signer in &request.plan.required_signers { if !resolved.contains(signer.pubkey.0.as_str()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_execution_signer_unresolved", format!("Metaplex signer {} is unresolved", signer.pubkey.0), )); @@ -97,13 +97,13 @@ pub fn validate_metaplex_token_metadata_execution_readiness( .or_insert_with(|| return signer.pubkey.clone()); } if request.submit && !request.operator_confirmed { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_execution_confirmation_required", "Metaplex submission requires explicit operator confirmation", )); } if request.submit && request.plan.policy.dry_run { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_execution_dry_run_blocks_submission", "Metaplex dry-run plan cannot be submitted", )); @@ -165,25 +165,25 @@ pub fn summarize_metaplex_token_metadata_postconditions( mod tests { #[test] fn failed_simulation_is_reportable_only_without_submission() { - let fee_payer = kb_lib::MdPubkey("11111111111111111111111111111111".to_string()); - let plan = kb_lib::ExApiPreparedExecutionPlan { + let fee_payer = ks_lib::MdPubkey("11111111111111111111111111111111".to_string()); + let plan = ks_lib::ExApiPreparedExecutionPlan { executor_name: "kb-lib.executor.metadata.metaplex_token_metadata".to_string(), executor_version: "0.4.8".to_string(), intent_id: "metaplex-failed-simulation-probe".to_string(), - operation_code: kb_lib::EX_METAPLEX_TOKEN_METADATA_USE_OPERATION.to_string(), + operation_code: ks_lib::EX_METAPLEX_TOKEN_METADATA_USE_OPERATION.to_string(), fee_payer: fee_payer.clone(), - instructions: vec![kb_lib::ExApiPlannedInstruction { - program_id: kb_lib::MdProgramId( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(), + instructions: vec![ks_lib::ExApiPlannedInstruction { + program_id: ks_lib::MdProgramId( + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(), ), - operation_code: kb_lib::EX_METAPLEX_TOKEN_METADATA_USE_OPERATION.to_string(), + operation_code: ks_lib::EX_METAPLEX_TOKEN_METADATA_USE_OPERATION.to_string(), accounts: vec![], data: vec![51], }], required_signers: vec![], - policy: kb_lib::ExApiExecutionPolicy { + policy: ks_lib::ExApiExecutionPolicy { dry_run: false, - ..kb_lib::ExApiExecutionPolicy::default() + ..ks_lib::ExApiExecutionPolicy::default() }, requested_spend_lamports: 0, requested_compute_unit_price_micro_lamports: std::option::Option::None, diff --git a/kb-pipeline/src/metadata_metaplex_token_metadata_preflight.rs b/ks-pipeline/src/metadata_metaplex_token_metadata_preflight.rs similarity index 79% rename from kb-pipeline/src/metadata_metaplex_token_metadata_preflight.rs rename to ks-pipeline/src/metadata_metaplex_token_metadata_preflight.rs index b8d78bc..fbdbced 100644 --- a/kb-pipeline/src/metadata_metaplex_token_metadata_preflight.rs +++ b/ks-pipeline/src/metadata_metaplex_token_metadata_preflight.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/metadata_metaplex_token_metadata_preflight.rs -// version: 3 +// file: ks-pipeline/src/metadata_metaplex_token_metadata_preflight.rs +// version: 4 //! Stateful Metaplex Token Metadata preflight contracts. @@ -9,8 +9,8 @@ pub const MAX_METAPLEX_TOKEN_METADATA_PREFLIGHT_ACCOUNTS: usize = 32; /// Complete preflight request for one prepared Metaplex execution plan. #[derive(Clone, Debug, PartialEq)] pub struct MetaplexTokenMetadataPreflightRequest { - /// Exact prepared plan produced by `kb-lib`. - pub plan: kb_lib::ExApiPreparedExecutionPlan, + /// Exact prepared plan produced by `ks-lib`. + pub plan: ks_lib::ExApiPreparedExecutionPlan, /// Confirmed bounded state snapshots correlated with the plan. pub snapshots: std::vec::Vec, /// Whether deprecated execution was explicitly approved by the operator. @@ -25,7 +25,7 @@ pub struct MetaplexTokenMetadataPreflightReport { /// Highest confirmed context slot across supplied snapshots. pub context_slot: u64, /// Canonical accounts inspected by the preflight. - pub inspected_accounts: std::vec::Vec, + pub inspected_accounts: std::vec::Vec, /// Ordered successful checks. pub checks: std::vec::Vec, } @@ -33,46 +33,46 @@ pub struct MetaplexTokenMetadataPreflightReport { /// Validates program ownership, snapshot bounds, account correlation and deprecation policy. pub fn inspect_metaplex_token_metadata_preflight( request: &crate::MetaplexTokenMetadataPreflightRequest, -) -> kb_core::Result { +) -> ks_core::Result { if request.snapshots.len() > crate::MAX_METAPLEX_TOKEN_METADATA_PREFLIGHT_ACCOUNTS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_preflight_account_limit_exceeded", "Metaplex preflight account limit exceeded", )); } if request.plan.instructions.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_preflight_empty_plan", "Metaplex execution plan must contain at least one instruction", )); } for instruction in &request.plan.instructions { - if instruction.program_id.0 != kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID { - return std::result::Result::Err(kb_core::Error::new( + if instruction.program_id.0 != ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID { + return std::result::Result::Err(ks_core::Error::new( "metaplex_preflight_program_mismatch", "Every Metaplex plan instruction must target Token Metadata", )); } if instruction.operation_code != request.plan.operation_code { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_preflight_operation_mismatch", "Metaplex plan and instruction operation codes must match", )); } } - let deprecated = kb_lib::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_OPERATION_CODES + let deprecated = ks_lib::EX_METAPLEX_TOKEN_METADATA_DEPRECATED_OPERATION_CODES .contains(&request.plan.operation_code.as_str()); if deprecated && !request.allow_deprecated_operation { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_preflight_deprecated_operation_not_approved", "Deprecated Metaplex execution requires explicit operator approval", )); } - let mut inspected = std::collections::BTreeMap::::new(); + let mut inspected = std::collections::BTreeMap::::new(); let mut context_slot = 0_u64; for snapshot in &request.snapshots { if snapshot.commitment != "confirmed" { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_preflight_commitment_mismatch", "Metaplex stateful snapshots must use confirmed commitment", )); @@ -100,12 +100,12 @@ pub fn inspect_metaplex_token_metadata_preflight( mod tests { #[test] fn rejects_empty_plans_and_unapproved_deprecated_operations() { - let mut plan = kb_lib::ExApiPreparedExecutionPlan { - executor_name: "kb-lib".to_string(), + let mut plan = ks_lib::ExApiPreparedExecutionPlan { + executor_name: "ks-lib".to_string(), executor_version: "0".to_string(), intent_id: "i".to_string(), - operation_code: kb_lib::EX_METAPLEX_TOKEN_METADATA_PUFF_METADATA_OPERATION.to_string(), - fee_payer: kb_lib::MdPubkey("11111111111111111111111111111111".to_string()), + operation_code: ks_lib::EX_METAPLEX_TOKEN_METADATA_PUFF_METADATA_OPERATION.to_string(), + fee_payer: ks_lib::MdPubkey("11111111111111111111111111111111".to_string()), instructions: vec![], required_signers: vec![], policy: std::default::Default::default(), @@ -118,9 +118,9 @@ mod tests { allow_deprecated_operation: false, }; assert!(crate::inspect_metaplex_token_metadata_preflight(&empty).is_err()); - plan.instructions.push(kb_lib::ExApiPlannedInstruction { - program_id: kb_lib::MdProgramId( - kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(), + plan.instructions.push(ks_lib::ExApiPlannedInstruction { + program_id: ks_lib::MdProgramId( + ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string(), ), operation_code: plan.operation_code.clone(), accounts: vec![], diff --git a/kb-pipeline/src/metadata_metaplex_token_metadata_stateful.rs b/ks-pipeline/src/metadata_metaplex_token_metadata_stateful.rs similarity index 84% rename from kb-pipeline/src/metadata_metaplex_token_metadata_stateful.rs rename to ks-pipeline/src/metadata_metaplex_token_metadata_stateful.rs index f0ae0a0..bf5f636 100644 --- a/kb-pipeline/src/metadata_metaplex_token_metadata_stateful.rs +++ b/ks-pipeline/src/metadata_metaplex_token_metadata_stateful.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/metadata_metaplex_token_metadata_stateful.rs -// version: 9 +// file: ks-pipeline/src/metadata_metaplex_token_metadata_stateful.rs +// version: 10 //! Bounded Metaplex Token Metadata account reads and canonical state projections. @@ -8,7 +8,7 @@ /// This bound follows the complete `getAccountInfo` contract of the execution transport. Decoder /// limits remain independent for already-available offline bytes or future chunked readers. pub const MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES: usize = - kb_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES; + ks_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES; /// Supported Metaplex account category for one bounded stateful read. #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] @@ -19,21 +19,21 @@ pub enum MetaplexTokenMetadataAccountKind { /// Master edition or printed edition PDA derived from the supplied mint. Edition { /// Mint used to derive the edition PDA. - mint: kb_lib::MdPubkey, + mint: ks_lib::MdPubkey, }, /// Edition marker PDA derived from the master mint and printed edition number. EditionMarker { /// Master mint used to derive the edition marker PDA. - mint: kb_lib::MdPubkey, + mint: ks_lib::MdPubkey, /// Printed edition number whose marker bit must be decoded. edition: u64, }, /// Programmable token record PDA derived from mint and token account. TokenRecord { /// Mint used to derive the token-record PDA. - mint: kb_lib::MdPubkey, + mint: ks_lib::MdPubkey, /// Token account used to derive the token-record PDA. - token: kb_lib::MdPubkey, + token: ks_lib::MdPubkey, }, /// Token Owned Escrow PDA whose authority seeds and bump are self-validated by the decoder. TokenOwnedEscrow, @@ -45,7 +45,7 @@ pub struct MetaplexTokenMetadataStatefulReadRequest { /// Endpoint role used for the HTTP RPC request. pub query_role: std::string::String, /// Canonical account address. - pub account: kb_lib::MdPubkey, + pub account: ks_lib::MdPubkey, /// Expected account category and derivation inputs. pub kind: crate::MetaplexTokenMetadataAccountKind, /// Optional minimum RPC context slot. @@ -56,13 +56,13 @@ pub struct MetaplexTokenMetadataStatefulReadRequest { impl crate::MetaplexTokenMetadataStatefulReadRequest { /// Validates the bounded complete-account RPC request. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.query_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Metaplex stateful read query_role must not be empty", )); } - let account_result = kb_onchain_transport::validate_solana_pubkey_text( + let account_result = ks_onchain_transport::validate_solana_pubkey_text( self.account.0.as_str(), "Metaplex stateful account", ); @@ -73,20 +73,20 @@ impl crate::MetaplexTokenMetadataStatefulReadRequest { crate::MetaplexTokenMetadataAccountKind::Metadata => std::result::Result::Ok(()), crate::MetaplexTokenMetadataAccountKind::Edition { mint } | crate::MetaplexTokenMetadataAccountKind::EditionMarker { mint, .. } => { - kb_onchain_transport::validate_solana_pubkey_text( + ks_onchain_transport::validate_solana_pubkey_text( mint.0.as_str(), "Metaplex stateful derivation mint", ) }, crate::MetaplexTokenMetadataAccountKind::TokenRecord { mint, token } => { - let mint_result = kb_onchain_transport::validate_solana_pubkey_text( + let mint_result = ks_onchain_transport::validate_solana_pubkey_text( mint.0.as_str(), "Metaplex stateful derivation mint", ); if let std::result::Result::Err(error) = mint_result { return std::result::Result::Err(error); } - kb_onchain_transport::validate_solana_pubkey_text( + ks_onchain_transport::validate_solana_pubkey_text( token.0.as_str(), "Metaplex stateful derivation token", ) @@ -101,7 +101,7 @@ impl crate::MetaplexTokenMetadataStatefulReadRequest { if self.max_data_bytes == 0 || self.max_data_bytes > crate::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Metaplex stateful max_data_bytes must be between 1 and {}", crate::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES ))); @@ -114,11 +114,11 @@ impl crate::MetaplexTokenMetadataStatefulReadRequest { #[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)] pub struct MetaplexTokenMetadataStatefulSnapshot { /// Canonical account address. - pub account: kb_lib::MdPubkey, + pub account: ks_lib::MdPubkey, /// Stable account category. pub account_kind: std::string::String, /// Mint correlated with this account when available. - pub mint: std::option::Option, + pub mint: std::option::Option, /// RPC context slot. pub slot: u64, /// Bounded decoder-owned projection. @@ -138,14 +138,14 @@ pub struct MetaplexTokenMetadataStatefulReadResult { /// Reads and validates one bounded Metaplex Token Metadata account. pub async fn read_metaplex_token_metadata_stateful_snapshot( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::MetaplexTokenMetadataStatefulReadRequest, -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Err(error) = request.validate() { return std::result::Result::Err(error); } - let config = match kb_onchain_transport::GetAccountInfoConfig::new_with_data( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let config = match ks_onchain_transport::GetAccountInfoConfig::new_with_data( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, request.min_context_slot, request.max_data_bytes, ) { @@ -162,17 +162,17 @@ pub async fn read_metaplex_token_metadata_stateful_snapshot( return crate::materialize_metaplex_token_metadata_account_info_result(request, &result); } -/// Validates one RPC account response and delegates parsing to `kb-lib`. +/// Validates one RPC account response and delegates parsing to `ks-lib`. pub fn materialize_metaplex_token_metadata_account_info_result( request: &crate::MetaplexTokenMetadataStatefulReadRequest, - result: &kb_onchain_transport::AccountInfoResult, -) -> kb_core::Result { + result: &ks_onchain_transport::AccountInfoResult, +) -> ks_core::Result { if let std::result::Result::Err(error) = request.validate() { return std::result::Result::Err(error); } if let std::option::Option::Some(minimum) = request.min_context_slot { if result.context.slot < minimum { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_stateful_context_slot_too_old", "Metaplex account context slot is below the requested minimum", )); @@ -181,26 +181,26 @@ pub fn materialize_metaplex_token_metadata_account_info_result( let account = match result.account.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_stateful_account_missing", format!("Metaplex account {} does not exist", request.account.0), )); }, }; if account.executable { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_stateful_account_executable", "Metaplex state accounts must not be executable", )); } - if account.owner.0 != kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID { - return std::result::Result::Err(kb_core::Error::new( + if account.owner.0 != ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID { + return std::result::Result::Err(ks_core::Error::new( "metaplex_stateful_owner_mismatch", "Metaplex state account owner does not match Token Metadata", )); } if account.space != account.data.len() as u64 || account.data.len() > request.max_data_bytes { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metaplex_stateful_account_data_invalid", "Metaplex account data is incomplete or above the configured bound", )); @@ -218,9 +218,9 @@ pub fn materialize_metaplex_token_metadata_account_info_result( fn stateful_decode_error( request: &crate::MetaplexTokenMetadataStatefulReadRequest, - error: kb_lib::DcMetadataMtmMetadataAccountDecodeError, -) -> kb_core::Error { - return kb_core::Error::new( + error: ks_lib::DcMetadataMtmMetadataAccountDecodeError, +) -> ks_core::Error { + return ks_core::Error::new( "metaplex_stateful_decode_failed", format!( "Metaplex stateful decode failed for account {} kind {:?}: {error}", @@ -233,11 +233,11 @@ fn decode_snapshot( request: &crate::MetaplexTokenMetadataStatefulReadRequest, slot: u64, data: &[u8], -) -> kb_core::Result { - let owner = kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID; +) -> ks_core::Result { + let owner = ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID; return match &request.kind { crate::MetaplexTokenMetadataAccountKind::Metadata => { - match kb_lib::decoder_metadata_metaplex_token_metadata_decode_metadata_account( + match ks_lib::decoder_metadata_metaplex_token_metadata_decode_metadata_account( request.account.0.as_str(), owner, data, @@ -246,7 +246,7 @@ fn decode_snapshot( std::result::Result::Ok(crate::MetaplexTokenMetadataStatefulSnapshot { account: request.account.clone(), account_kind: "metadata".to_string(), - mint: std::option::Option::Some(kb_lib::MdPubkey(value.mint)), + mint: std::option::Option::Some(ks_lib::MdPubkey(value.mint)), slot, payload_json: value.payload_json, }) @@ -257,7 +257,7 @@ fn decode_snapshot( } }, crate::MetaplexTokenMetadataAccountKind::Edition { mint } => { - match kb_lib::decoder_metadata_metaplex_token_metadata_decode_edition_account( + match ks_lib::decoder_metadata_metaplex_token_metadata_decode_edition_account( request.account.0.as_str(), owner, mint.0.as_str(), @@ -278,7 +278,7 @@ fn decode_snapshot( } }, crate::MetaplexTokenMetadataAccountKind::EditionMarker { mint, edition } => { - match kb_lib::decoder_metadata_metaplex_token_metadata_decode_edition_marker_account( + match ks_lib::decoder_metadata_metaplex_token_metadata_decode_edition_marker_account( request.account.0.as_str(), owner, mint.0.as_str(), @@ -296,8 +296,8 @@ fn decode_snapshot( "bump": value.bump, "mint": value.mint, "kind": match value.kind { - kb_lib::DcMetadataMtmEditionMarkerAccountKind::EditionMarkerV1 => "edition_marker_v1", - kb_lib::DcMetadataMtmEditionMarkerAccountKind::EditionMarkerV2 => "edition_marker_v2", + ks_lib::DcMetadataMtmEditionMarkerAccountKind::EditionMarkerV1 => "edition_marker_v1", + ks_lib::DcMetadataMtmEditionMarkerAccountKind::EditionMarkerV2 => "edition_marker_v2", }, "marker_group": value.marker_group, "edition": value.edition, @@ -315,7 +315,7 @@ fn decode_snapshot( } }, crate::MetaplexTokenMetadataAccountKind::TokenRecord { mint, token } => { - match kb_lib::decoder_metadata_metaplex_token_metadata_decode_token_record_account( + match ks_lib::decoder_metadata_metaplex_token_metadata_decode_token_record_account( request.account.0.as_str(), owner, mint.0.as_str(), @@ -337,22 +337,22 @@ fn decode_snapshot( } }, crate::MetaplexTokenMetadataAccountKind::TokenOwnedEscrow => { - match kb_lib::decoder_metadata_metaplex_token_metadata_decode_token_owned_escrow_account( + match ks_lib::decoder_metadata_metaplex_token_metadata_decode_token_owned_escrow_account( request.account.0.as_str(), owner, data, ) { std::result::Result::Ok(value) => { let authority_kind = match value.authority_kind { - kb_lib::DcMetadataMtmTokenOwnedEscrowAuthorityKind::TokenOwner => { + ks_lib::DcMetadataMtmTokenOwnedEscrowAuthorityKind::TokenOwner => { "token_owner" }, - kb_lib::DcMetadataMtmTokenOwnedEscrowAuthorityKind::Creator => "creator", + ks_lib::DcMetadataMtmTokenOwnedEscrowAuthorityKind::Creator => "creator", }; std::result::Result::Ok(crate::MetaplexTokenMetadataStatefulSnapshot { account: request.account.clone(), account_kind: "token_owned_escrow".to_string(), - mint: std::option::Option::Some(kb_lib::MdPubkey(value.base_token.clone())), + mint: std::option::Option::Some(ks_lib::MdPubkey(value.base_token.clone())), slot, payload_json: serde_json::json!({ "account": value.account, @@ -379,7 +379,7 @@ mod tests { fn stateful_read_request_round_trips_through_json() { let request = crate::MetaplexTokenMetadataStatefulReadRequest { query_role: "rpc".to_string(), - account: kb_lib::MdPubkey("11111111111111111111111111111111".to_string()), + account: ks_lib::MdPubkey("11111111111111111111111111111111".to_string()), kind: crate::MetaplexTokenMetadataAccountKind::Metadata, min_context_slot: std::option::Option::Some(42), max_data_bytes: 1024, @@ -397,9 +397,9 @@ mod tests { assert_eq!(decoded, request); let marker = crate::MetaplexTokenMetadataStatefulReadRequest { query_role: "rpc".to_string(), - account: kb_lib::MdPubkey("11111111111111111111111111111111".to_string()), + account: ks_lib::MdPubkey("11111111111111111111111111111111".to_string()), kind: crate::MetaplexTokenMetadataAccountKind::EditionMarker { - mint: kb_lib::MdPubkey("11111111111111111111111111111111".to_string()), + mint: ks_lib::MdPubkey("11111111111111111111111111111111".to_string()), edition: 1, }, min_context_slot: std::option::Option::Some(43), @@ -423,7 +423,7 @@ mod tests { assert_eq!(marker_decoded, marker); let escrow = crate::MetaplexTokenMetadataStatefulReadRequest { query_role: "rpc".to_string(), - account: kb_lib::MdPubkey("11111111111111111111111111111111".to_string()), + account: ks_lib::MdPubkey("11111111111111111111111111111111".to_string()), kind: crate::MetaplexTokenMetadataAccountKind::TokenOwnedEscrow, min_context_slot: std::option::Option::Some(44), max_data_bytes: 1024, @@ -446,9 +446,9 @@ mod tests { assert_eq!(escrow_decoded, escrow); let invalid_marker = crate::MetaplexTokenMetadataStatefulReadRequest { query_role: "rpc".to_string(), - account: kb_lib::MdPubkey("11111111111111111111111111111111".to_string()), + account: ks_lib::MdPubkey("11111111111111111111111111111111".to_string()), kind: crate::MetaplexTokenMetadataAccountKind::EditionMarker { - mint: kb_lib::MdPubkey("invalid".to_string()), + mint: ks_lib::MdPubkey("invalid".to_string()), edition: 1, }, min_context_slot: std::option::Option::None, @@ -461,13 +461,13 @@ mod tests { fn rejects_zero_and_oversize_bounds_before_account_decoding() { let request = crate::MetaplexTokenMetadataStatefulReadRequest { query_role: "rpc".to_string(), - account: kb_lib::MdPubkey("11111111111111111111111111111111".to_string()), + account: ks_lib::MdPubkey("11111111111111111111111111111111".to_string()), kind: crate::MetaplexTokenMetadataAccountKind::Metadata, min_context_slot: std::option::Option::None, max_data_bytes: 0, }; - let result = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + let result = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 1, api_version: std::option::Option::None, }, @@ -478,13 +478,13 @@ mod tests { .is_err() ); let mut oversized = request; - oversized.max_data_bytes = kb_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES + 1; + oversized.max_data_bytes = ks_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES + 1; assert!(oversized.validate().is_err()); } #[test] fn token_owned_escrow_materializes_with_canonical_authority_projection() { - let program = match kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID + let program = match ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID .parse::() { std::result::Result::Ok(value) => value, @@ -502,19 +502,19 @@ mod tests { assert_eq!(data.len(), 35); let request = crate::MetaplexTokenMetadataStatefulReadRequest { query_role: "rpc".to_string(), - account: kb_lib::MdPubkey(account.to_string()), + account: ks_lib::MdPubkey(account.to_string()), kind: crate::MetaplexTokenMetadataAccountKind::TokenOwnedEscrow, min_context_slot: std::option::Option::Some(11), max_data_bytes: 1024, }; - let result = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + let result = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 11, api_version: std::option::Option::None, }, - account: std::option::Option::Some(kb_onchain_transport::AccountInfoValue { + account: std::option::Option::Some(ks_onchain_transport::AccountInfoValue { lamports: 1_000, - owner: kb_lib::MdProgramId(program.to_string()), + owner: ks_lib::MdProgramId(program.to_string()), executable: false, rent_epoch: 0, space: data.len() as u64, @@ -528,7 +528,7 @@ mod tests { std::result::Result::Err(error) => panic!("escrow stateful decode failed: {error}"), }; assert_eq!(snapshot.account_kind, "token_owned_escrow"); - assert_eq!(snapshot.mint, std::option::Option::Some(kb_lib::MdPubkey(mint.to_string()))); + assert_eq!(snapshot.mint, std::option::Option::Some(ks_lib::MdPubkey(mint.to_string()))); assert_eq!(snapshot.payload_json["base_token"], serde_json::json!(mint.to_string())); assert_eq!(snapshot.payload_json["authority_kind"], serde_json::json!("token_owner")); assert_eq!(snapshot.payload_json["creator"], serde_json::Value::Null); @@ -537,7 +537,7 @@ mod tests { #[test] fn compact_printed_edition_account_materializes_from_current_network_allocation() { - let program = match kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID + let program = match ks_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID .parse::() { std::result::Result::Ok(value) => value, @@ -556,21 +556,21 @@ mod tests { assert_eq!(data.len(), 42); let request = crate::MetaplexTokenMetadataStatefulReadRequest { query_role: "rpc".to_string(), - account: kb_lib::MdPubkey(account.to_string()), + account: ks_lib::MdPubkey(account.to_string()), kind: crate::MetaplexTokenMetadataAccountKind::Edition { - mint: kb_lib::MdPubkey(mint.to_string()), + mint: ks_lib::MdPubkey(mint.to_string()), }, min_context_slot: std::option::Option::Some(12), max_data_bytes: 1024, }; - let result = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + let result = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 12, api_version: std::option::Option::None, }, - account: std::option::Option::Some(kb_onchain_transport::AccountInfoValue { + account: std::option::Option::Some(ks_onchain_transport::AccountInfoValue { lamports: 1_000, - owner: kb_lib::MdProgramId(program.to_string()), + owner: ks_lib::MdProgramId(program.to_string()), executable: false, rent_epoch: 0, space: 42, @@ -594,7 +594,7 @@ mod tests { fn stateful_complete_read_bound_matches_the_transport_contract() { assert_eq!( crate::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, - kb_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES + ks_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES ); } } diff --git a/kb-pipeline/src/metadata_solana_program_execution_orchestration.rs b/ks-pipeline/src/metadata_solana_program_execution_orchestration.rs similarity index 81% rename from kb-pipeline/src/metadata_solana_program_execution_orchestration.rs rename to ks-pipeline/src/metadata_solana_program_execution_orchestration.rs index 6441987..8df3a73 100644 --- a/kb-pipeline/src/metadata_solana_program_execution_orchestration.rs +++ b/ks-pipeline/src/metadata_solana_program_execution_orchestration.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/metadata_solana_program_execution_orchestration.rs -// version: 2 +// file: ks-pipeline/src/metadata_solana_program_execution_orchestration.rs +// version: 3 //! Simulation-first Solana Program Metadata execution orchestration and postconditions. @@ -10,7 +10,7 @@ pub const MAX_SOLANA_PROGRAM_METADATA_EXECUTION_SIGNERS: usize = 16; #[derive(Clone, Debug, PartialEq)] pub struct SolanaProgramMetadataExecutionReadinessRequest { /// Exact prepared execution plan. - pub plan: kb_lib::ExApiPreparedExecutionPlan, + pub plan: ks_lib::ExApiPreparedExecutionPlan, /// Successful stateful preflight report. pub preflight: crate::SolanaProgramMetadataPreflightReport, /// Exact compiled message hash. @@ -22,7 +22,7 @@ pub struct SolanaProgramMetadataExecutionReadinessRequest { /// Whether simulation succeeded. pub simulation_succeeded: bool, /// Public keys available to sign. - pub resolved_signers: std::vec::Vec, + pub resolved_signers: std::vec::Vec, /// Whether submission was requested. pub submit: bool, /// Whether the operator confirmed submission. @@ -39,7 +39,7 @@ pub struct SolanaProgramMetadataExecutionReadinessReport { /// Confirmed preflight context slot. pub context_slot: u64, /// Deduplicated required signers. - pub required_signers: std::vec::Vec, + pub required_signers: std::vec::Vec, /// Whether signing and submission are authorized. pub send_authorized: bool, /// Ordered successful checks. @@ -64,7 +64,7 @@ pub struct SolanaProgramMetadataPostcondition { /// Stable check code. pub code: std::string::String, /// Account inspected by the check. - pub account: kb_lib::MdPubkey, + pub account: ks_lib::MdPubkey, /// Terminal status. pub status: crate::SolanaProgramMetadataPostconditionStatus, /// Human-readable diagnostic. @@ -75,7 +75,7 @@ pub struct SolanaProgramMetadataPostcondition { #[derive(Clone, Debug, PartialEq)] pub struct SolanaProgramMetadataPostExecutionRequest { /// Exact operation that was submitted. - pub operation: kb_lib::ExMetadataSpmOperation, + pub operation: ks_lib::ExMetadataSpmOperation, /// Confirmed snapshots captured before execution. pub before: std::vec::Vec, /// Confirmed snapshots captured after execution. @@ -96,23 +96,23 @@ pub struct SolanaProgramMetadataPostExecutionReport { /// Validates simulation, preflight, signer and submission policies. pub fn validate_solana_program_metadata_execution_readiness( request: &crate::SolanaProgramMetadataExecutionReadinessRequest, -) -> kb_core::Result { +) -> ks_core::Result { if request.plan.operation_code != request.preflight.operation_code { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_execution_operation_mismatch", "Program Metadata plan and preflight operation codes must match", )); } - if request.preflight.safety.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if request.preflight.safety.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_execution_safety_denied", "Program Metadata preflight safety decision denied execution", )); } - if request.preflight.safety.decision == kb_lib::ExSafetyDecision::RequireConfirmation + if request.preflight.safety.decision == ks_lib::ExSafetyDecision::RequireConfirmation && !request.operator_confirmed { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_execution_safety_confirmation_required", "Program Metadata safety policy requires explicit operator confirmation", )); @@ -122,13 +122,13 @@ pub fn validate_solana_program_metadata_execution_readiness( || !request.simulated || !request.simulation_succeeded { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_execution_simulation_required", "Program Metadata execution requires successful exact-message simulation", )); } if request.resolved_signers.len() > crate::MAX_SOLANA_PROGRAM_METADATA_EXECUTION_SIGNERS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_execution_signer_limit_exceeded", "Program Metadata execution signer limit exceeded", )); @@ -138,10 +138,10 @@ pub fn validate_solana_program_metadata_execution_readiness( .iter() .map(|item| return item.0.clone()) .collect::>(); - let mut required = std::collections::BTreeMap::::new(); + let mut required = std::collections::BTreeMap::::new(); for signer in &request.plan.required_signers { if !resolved.contains(signer.pubkey.0.as_str()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_execution_signer_unresolved", format!("Program Metadata signer {} is unresolved", signer.pubkey.0), )); @@ -151,13 +151,13 @@ pub fn validate_solana_program_metadata_execution_readiness( .or_insert_with(|| return signer.pubkey.clone()); } if request.submit && !request.operator_confirmed { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_execution_confirmation_required", "Program Metadata submission requires explicit operator confirmation", )); } if request.submit && request.plan.policy.dry_run { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_execution_dry_run_blocks_submission", "Program Metadata dry-run plan cannot be submitted", )); @@ -193,7 +193,7 @@ pub fn validate_solana_program_metadata_execution_readiness( /// Inspects confirmed state after one Program Metadata execution. pub fn inspect_solana_program_metadata_post_execution( request: &crate::SolanaProgramMetadataPostExecutionRequest, -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Err(error) = validate_snapshot_set(request.before.as_slice(), "before") { @@ -250,9 +250,9 @@ pub fn summarize_solana_program_metadata_postconditions( fn validate_snapshot_set( snapshots: &[crate::SolanaProgramMetadataStatefulReadResult], phase: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if snapshots.len() > crate::MAX_SOLANA_PROGRAM_METADATA_PREFLIGHT_ACCOUNTS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_post_execution_account_limit_exceeded", format!("Program Metadata {phase} snapshot limit exceeded"), )); @@ -260,13 +260,13 @@ fn validate_snapshot_set( let mut accounts = std::collections::BTreeSet::new(); for snapshot in snapshots { if snapshot.commitment != "confirmed" { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_post_execution_commitment_mismatch", format!("Program Metadata {phase} snapshots must use confirmed commitment"), )); } if !accounts.insert(snapshot.account.0.as_str()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "solana_program_metadata_post_execution_duplicate_account", format!("duplicate Program Metadata {phase} snapshot for {}", snapshot.account.0), )); @@ -275,39 +275,39 @@ fn validate_snapshot_set( return std::result::Result::Ok(()); } -fn operation_target(operation: &kb_lib::ExMetadataSpmOperation) -> &kb_lib::MdPubkey { +fn operation_target(operation: &ks_lib::ExMetadataSpmOperation) -> &ks_lib::MdPubkey { return match operation { - kb_lib::ExMetadataSpmOperation::Write { buffer, .. } - | kb_lib::ExMetadataSpmOperation::Allocate { buffer, .. } => buffer, - kb_lib::ExMetadataSpmOperation::Initialize { metadata, .. } - | kb_lib::ExMetadataSpmOperation::SetData { metadata, .. } - | kb_lib::ExMetadataSpmOperation::SetImmutable { metadata, .. } => metadata, - kb_lib::ExMetadataSpmOperation::SetAuthority { account, .. } - | kb_lib::ExMetadataSpmOperation::Trim { account, .. } - | kb_lib::ExMetadataSpmOperation::Close { account, .. } - | kb_lib::ExMetadataSpmOperation::Extend { account, .. } => account, + ks_lib::ExMetadataSpmOperation::Write { buffer, .. } + | ks_lib::ExMetadataSpmOperation::Allocate { buffer, .. } => buffer, + ks_lib::ExMetadataSpmOperation::Initialize { metadata, .. } + | ks_lib::ExMetadataSpmOperation::SetData { metadata, .. } + | ks_lib::ExMetadataSpmOperation::SetImmutable { metadata, .. } => metadata, + ks_lib::ExMetadataSpmOperation::SetAuthority { account, .. } + | ks_lib::ExMetadataSpmOperation::Trim { account, .. } + | ks_lib::ExMetadataSpmOperation::Close { account, .. } + | ks_lib::ExMetadataSpmOperation::Extend { account, .. } => account, }; } fn find_snapshot<'a>( snapshots: &'a [crate::SolanaProgramMetadataStatefulReadResult], - account: &kb_lib::MdPubkey, + account: &ks_lib::MdPubkey, ) -> std::option::Option<&'a crate::SolanaProgramMetadataStatefulReadResult> { return snapshots.iter().find(|value| return value.account == *account); } fn evaluate_operation_postcondition( - operation: &kb_lib::ExMetadataSpmOperation, + operation: &ks_lib::ExMetadataSpmOperation, before: std::option::Option<&crate::SolanaProgramMetadataStatefulReadResult>, after: std::option::Option<&crate::SolanaProgramMetadataStatefulReadResult>, before_all: &[crate::SolanaProgramMetadataStatefulReadResult], ) -> crate::SolanaProgramMetadataPostcondition { let target = operation_target(operation).clone(); let confirmed = match operation { - kb_lib::ExMetadataSpmOperation::Write { offset, source, .. } => { + ks_lib::ExMetadataSpmOperation::Write { offset, source, .. } => { write_postcondition(*offset, source, after, before_all) }, - kb_lib::ExMetadataSpmOperation::Initialize { + ks_lib::ExMetadataSpmOperation::Initialize { program, canonical, seed, @@ -328,10 +328,10 @@ fn evaluate_operation_postcondition( data.as_ref(), after, ), - kb_lib::ExMetadataSpmOperation::SetAuthority { new_authority, .. } => { + ks_lib::ExMetadataSpmOperation::SetAuthority { new_authority, .. } => { authority_postcondition(new_authority.as_ref(), after) }, - kb_lib::ExMetadataSpmOperation::SetData { + ks_lib::ExMetadataSpmOperation::SetData { encoding, compression, format, source, .. } => set_data_postcondition( *encoding, @@ -342,24 +342,24 @@ fn evaluate_operation_postcondition( after, before_all, ), - kb_lib::ExMetadataSpmOperation::SetImmutable { .. } => match after { + ks_lib::ExMetadataSpmOperation::SetImmutable { .. } => match after { std::option::Option::Some(value) => matches!( &value.state, crate::SolanaProgramMetadataObservedAccountState::Metadata(metadata) if !metadata.mutable ), std::option::Option::None => false, }, - kb_lib::ExMetadataSpmOperation::Trim { .. } => trim_postcondition(before, after), - kb_lib::ExMetadataSpmOperation::Close { .. } => match after { + ks_lib::ExMetadataSpmOperation::Trim { .. } => trim_postcondition(before, after), + ks_lib::ExMetadataSpmOperation::Close { .. } => match after { std::option::Option::Some(value) => { matches!(&value.state, crate::SolanaProgramMetadataObservedAccountState::Missing) }, std::option::Option::None => false, }, - kb_lib::ExMetadataSpmOperation::Allocate { authority, seed, canonical, .. } => { + ks_lib::ExMetadataSpmOperation::Allocate { authority, seed, canonical, .. } => { allocate_postcondition(authority, seed.as_deref(), *canonical, after) }, - kb_lib::ExMetadataSpmOperation::Extend { length, .. } => { + ks_lib::ExMetadataSpmOperation::Extend { length, .. } => { extend_postcondition(*length, before, after) }, }; @@ -390,7 +390,7 @@ fn evaluate_operation_postcondition( fn write_postcondition( offset: u32, - source: &kb_lib::ExMetadataSpmWriteSource, + source: &ks_lib::ExMetadataSpmWriteSource, after: std::option::Option<&crate::SolanaProgramMetadataStatefulReadResult>, before_all: &[crate::SolanaProgramMetadataStatefulReadResult], ) -> bool { @@ -405,8 +405,8 @@ fn write_postcondition( std::result::Result::Err(_) => return false, }; let expected = match source { - kb_lib::ExMetadataSpmWriteSource::Inline { data } => data.as_slice(), - kb_lib::ExMetadataSpmWriteSource::Buffer { source_buffer } => { + ks_lib::ExMetadataSpmWriteSource::Inline { data } => data.as_slice(), + ks_lib::ExMetadataSpmWriteSource::Buffer { source_buffer } => { let source_snapshot = match find_snapshot(before_all, source_buffer) { std::option::Option::Some(value) => value, std::option::Option::None => return false, @@ -428,14 +428,14 @@ fn write_postcondition( #[allow(clippy::too_many_arguments)] fn initialize_postcondition( - program: &kb_lib::MdPubkey, + program: &ks_lib::MdPubkey, canonical: bool, seed: &[u8], - encoding: kb_lib::ExMetadataSpmEncoding, - compression: kb_lib::ExMetadataSpmCompression, - format: kb_lib::ExMetadataSpmFormat, - data_source: kb_lib::ExMetadataSpmDataSource, - data: std::option::Option<&kb_lib::ExMetadataSpmDataInput>, + encoding: ks_lib::ExMetadataSpmEncoding, + compression: ks_lib::ExMetadataSpmCompression, + format: ks_lib::ExMetadataSpmFormat, + data_source: ks_lib::ExMetadataSpmDataSource, + data: std::option::Option<&ks_lib::ExMetadataSpmDataInput>, after: std::option::Option<&crate::SolanaProgramMetadataStatefulReadResult>, ) -> bool { let metadata = match after.map(|value| return &value.state) { @@ -467,7 +467,7 @@ fn initialize_postcondition( } fn authority_postcondition( - new_authority: std::option::Option<&kb_lib::MdPubkey>, + new_authority: std::option::Option<&ks_lib::MdPubkey>, after: std::option::Option<&crate::SolanaProgramMetadataStatefulReadResult>, ) -> bool { let observed = match after.map(|value| return &value.state) { @@ -483,10 +483,10 @@ fn authority_postcondition( } fn set_data_postcondition( - encoding: kb_lib::ExMetadataSpmEncoding, - compression: kb_lib::ExMetadataSpmCompression, - format: kb_lib::ExMetadataSpmFormat, - source: &kb_lib::ExMetadataSpmSetDataSource, + encoding: ks_lib::ExMetadataSpmEncoding, + compression: ks_lib::ExMetadataSpmCompression, + format: ks_lib::ExMetadataSpmFormat, + source: &ks_lib::ExMetadataSpmSetDataSource, before: std::option::Option<&crate::SolanaProgramMetadataStatefulReadResult>, after: std::option::Option<&crate::SolanaProgramMetadataStatefulReadResult>, before_all: &[crate::SolanaProgramMetadataStatefulReadResult], @@ -504,7 +504,7 @@ fn set_data_postcondition( return false; } return match source { - kb_lib::ExMetadataSpmSetDataSource::PreserveExisting => { + ks_lib::ExMetadataSpmSetDataSource::PreserveExisting => { match before.map(|value| return &value.state) { std::option::Option::Some( crate::SolanaProgramMetadataObservedAccountState::Metadata(value), @@ -512,8 +512,8 @@ fn set_data_postcondition( _ => false, } }, - kb_lib::ExMetadataSpmSetDataSource::Inline { data } => data_matches(data, &metadata.data), - kb_lib::ExMetadataSpmSetDataSource::Buffer { buffer, data_source } => { + ks_lib::ExMetadataSpmSetDataSource::Inline { data } => data_matches(data, &metadata.data), + ks_lib::ExMetadataSpmSetDataSource::Buffer { buffer, data_source } => { if metadata.data_source.wire_value() != data_source.wire_value() { return false; } @@ -528,9 +528,9 @@ fn set_data_postcondition( _ => return false, }; return match &metadata.data { - kb_lib::DcMetadataSpmData::Direct(value) => value.as_slice() == bytes, - kb_lib::DcMetadataSpmData::Url(value) => value.as_bytes() == bytes, - kb_lib::DcMetadataSpmData::External(value) => &value.to_wire_bytes()[..] == bytes, + ks_lib::DcMetadataSpmData::Direct(value) => value.as_slice() == bytes, + ks_lib::DcMetadataSpmData::Url(value) => value.as_bytes() == bytes, + ks_lib::DcMetadataSpmData::External(value) => &value.to_wire_bytes()[..] == bytes, }; }, }; @@ -559,7 +559,7 @@ fn trim_postcondition( } fn allocate_postcondition( - authority: &kb_lib::MdPubkey, + authority: &ks_lib::MdPubkey, seed: std::option::Option<&[u8]>, canonical: bool, after: std::option::Option<&crate::SolanaProgramMetadataStatefulReadResult>, @@ -604,20 +604,20 @@ fn extend_postcondition( } fn data_matches( - input: &kb_lib::ExMetadataSpmDataInput, - observed: &kb_lib::DcMetadataSpmData, + input: &ks_lib::ExMetadataSpmDataInput, + observed: &ks_lib::DcMetadataSpmData, ) -> bool { return match (input, observed) { ( - kb_lib::ExMetadataSpmDataInput::Direct { bytes }, - kb_lib::DcMetadataSpmData::Direct(value), + ks_lib::ExMetadataSpmDataInput::Direct { bytes }, + ks_lib::DcMetadataSpmData::Direct(value), ) => bytes == value, - (kb_lib::ExMetadataSpmDataInput::Url { url }, kb_lib::DcMetadataSpmData::Url(value)) => { + (ks_lib::ExMetadataSpmDataInput::Url { url }, ks_lib::DcMetadataSpmData::Url(value)) => { url == value }, ( - kb_lib::ExMetadataSpmDataInput::External { address, offset, length }, - kb_lib::DcMetadataSpmData::External(value), + ks_lib::ExMetadataSpmDataInput::External { address, offset, length }, + ks_lib::DcMetadataSpmData::External(value), ) => { value.address.to_string().as_str() == address.0.as_str() && value.offset == *offset @@ -629,34 +629,34 @@ fn data_matches( #[cfg(test)] mod tests { - fn pubkey(byte: u8) -> kb_lib::MdPubkey { - return kb_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([byte; 32]).to_string()); + fn pubkey(byte: u8) -> ks_lib::MdPubkey { + return ks_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([byte; 32]).to_string()); } #[test] fn readiness_requires_exact_simulation_and_resolved_signers() { let signer = pubkey(1); - let plan = kb_lib::ExApiPreparedExecutionPlan { + let plan = ks_lib::ExApiPreparedExecutionPlan { executor_name: "kb-lib.executor.metadata.solana_program_metadata".to_string(), executor_version: "0.4.8".to_string(), intent_id: "spm-readiness".to_string(), - operation_code: kb_lib::EX_METADATA_SPM_WRITE_OPERATION.to_string(), + operation_code: ks_lib::EX_METADATA_SPM_WRITE_OPERATION.to_string(), fee_payer: signer.clone(), - instructions: vec![kb_lib::ExApiPlannedInstruction { - program_id: kb_lib::MdProgramId( - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), + instructions: vec![ks_lib::ExApiPlannedInstruction { + program_id: ks_lib::MdProgramId( + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), ), - operation_code: kb_lib::EX_METADATA_SPM_WRITE_OPERATION.to_string(), + operation_code: ks_lib::EX_METADATA_SPM_WRITE_OPERATION.to_string(), accounts: vec![], data: vec![0], }], - required_signers: vec![kb_lib::ExApiRequiredSigner { + required_signers: vec![ks_lib::ExApiRequiredSigner { pubkey: signer.clone(), role: "authority".to_string(), }], - policy: kb_lib::ExApiExecutionPolicy { + policy: ks_lib::ExApiExecutionPolicy { dry_run: false, - ..kb_lib::ExApiExecutionPolicy::default() + ..ks_lib::ExApiExecutionPolicy::default() }, requested_spend_lamports: 0, requested_compute_unit_price_micro_lamports: std::option::Option::None, @@ -664,12 +664,12 @@ mod tests { let request = crate::SolanaProgramMetadataExecutionReadinessRequest { plan, preflight: crate::SolanaProgramMetadataPreflightReport { - operation_code: kb_lib::EX_METADATA_SPM_WRITE_OPERATION.to_string(), + operation_code: ks_lib::EX_METADATA_SPM_WRITE_OPERATION.to_string(), target_account: pubkey(2), context_slot: 99, inspected_accounts: vec![], - safety: kb_lib::ExSafetyEvaluation { - decision: kb_lib::ExSafetyDecision::Allow, + safety: ks_lib::ExSafetyEvaluation { + decision: ks_lib::ExSafetyDecision::Allow, violations: vec![], }, runtime_authority_validation_required: false, @@ -700,14 +700,14 @@ mod tests { if let std::result::Result::Ok(matrix) = matrix_result { assert_eq!( matrix["programId"], - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID ); assert_eq!( matrix["operations"].as_array().map(std::vec::Vec::len), - std::option::Option::Some(kb_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.len()) + std::option::Option::Some(ks_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.len()) ); - assert_eq!(matrix["pipelineCrate"], "kb-pipeline"); - assert_eq!(matrix["demoScenarioCrate"], "kb-pipeline-demo-scenarios"); + assert_eq!(matrix["pipelineCrate"], "ks-pipeline"); + assert_eq!(matrix["demoScenarioCrate"], "ks-pipeline-demo-scenarios"); } } @@ -718,61 +718,61 @@ mod tests { let program = pubkey(6); let destination = pubkey(7); let operations = vec![ - kb_lib::ExMetadataSpmOperation::Write { + ks_lib::ExMetadataSpmOperation::Write { buffer: account.clone(), authority: authority.clone(), offset: 0, - source: kb_lib::ExMetadataSpmWriteSource::Inline { data: vec![1] }, + source: ks_lib::ExMetadataSpmWriteSource::Inline { data: vec![1] }, }, - kb_lib::ExMetadataSpmOperation::Initialize { + ks_lib::ExMetadataSpmOperation::Initialize { metadata: account.clone(), authority: authority.clone(), program: program.clone(), program_data: std::option::Option::None, canonical: false, - seed: vec![0_u8; kb_lib::DC_METADATA_SPM_SEED_BYTES], - encoding: kb_lib::ExMetadataSpmEncoding::Utf8, - compression: kb_lib::ExMetadataSpmCompression::None, - format: kb_lib::ExMetadataSpmFormat::Json, - data_source: kb_lib::ExMetadataSpmDataSource::Direct, - data: std::option::Option::Some(kb_lib::ExMetadataSpmDataInput::Direct { + seed: vec![0_u8; ks_lib::DC_METADATA_SPM_SEED_BYTES], + encoding: ks_lib::ExMetadataSpmEncoding::Utf8, + compression: ks_lib::ExMetadataSpmCompression::None, + format: ks_lib::ExMetadataSpmFormat::Json, + data_source: ks_lib::ExMetadataSpmDataSource::Direct, + data: std::option::Option::Some(ks_lib::ExMetadataSpmDataInput::Direct { bytes: vec![1], }), allocate_account: true, }, - kb_lib::ExMetadataSpmOperation::SetAuthority { + ks_lib::ExMetadataSpmOperation::SetAuthority { account: account.clone(), authority: authority.clone(), new_authority: std::option::Option::Some(pubkey(8)), program_context: std::option::Option::None, }, - kb_lib::ExMetadataSpmOperation::SetData { + ks_lib::ExMetadataSpmOperation::SetData { metadata: account.clone(), authority: authority.clone(), - encoding: kb_lib::ExMetadataSpmEncoding::Utf8, - compression: kb_lib::ExMetadataSpmCompression::None, - format: kb_lib::ExMetadataSpmFormat::Json, - source: kb_lib::ExMetadataSpmSetDataSource::PreserveExisting, + encoding: ks_lib::ExMetadataSpmEncoding::Utf8, + compression: ks_lib::ExMetadataSpmCompression::None, + format: ks_lib::ExMetadataSpmFormat::Json, + source: ks_lib::ExMetadataSpmSetDataSource::PreserveExisting, program_context: std::option::Option::None, }, - kb_lib::ExMetadataSpmOperation::SetImmutable { + ks_lib::ExMetadataSpmOperation::SetImmutable { metadata: account.clone(), authority: authority.clone(), program_context: std::option::Option::None, }, - kb_lib::ExMetadataSpmOperation::Trim { + ks_lib::ExMetadataSpmOperation::Trim { account: account.clone(), authority: authority.clone(), destination: destination.clone(), program_context: std::option::Option::None, }, - kb_lib::ExMetadataSpmOperation::Close { + ks_lib::ExMetadataSpmOperation::Close { account: account.clone(), authority: authority.clone(), destination, program_context: std::option::Option::None, }, - kb_lib::ExMetadataSpmOperation::Allocate { + ks_lib::ExMetadataSpmOperation::Allocate { buffer: account.clone(), authority: authority.clone(), seed: std::option::Option::None, @@ -780,7 +780,7 @@ mod tests { canonical: false, allocate_account: true, }, - kb_lib::ExMetadataSpmOperation::Extend { + ks_lib::ExMetadataSpmOperation::Extend { account, authority, length: 1, @@ -792,7 +792,7 @@ mod tests { .map(|operation| return operation.operation_code()) .collect::>(); codes.sort(); - let mut expected = kb_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.to_vec(); + let mut expected = ks_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.to_vec(); expected.sort(); assert_eq!(codes, expected); for operation in operations { diff --git a/kb-pipeline/src/metadata_solana_program_preflight.rs b/ks-pipeline/src/metadata_solana_program_preflight.rs similarity index 76% rename from kb-pipeline/src/metadata_solana_program_preflight.rs rename to ks-pipeline/src/metadata_solana_program_preflight.rs index f8cfb00..7ce5729 100644 --- a/kb-pipeline/src/metadata_solana_program_preflight.rs +++ b/ks-pipeline/src/metadata_solana_program_preflight.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/metadata_solana_program_preflight.rs -// version: 2 +// file: ks-pipeline/src/metadata_solana_program_preflight.rs +// version: 3 //! Stateful preflight for Solana Program Metadata execution plans. @@ -10,7 +10,7 @@ pub const MAX_SOLANA_PROGRAM_METADATA_PREFLIGHT_ACCOUNTS: usize = 16; #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] pub struct SolanaProgramMetadataRentObservation { /// Account whose allocation or growth is being validated. - pub account: kb_lib::MdPubkey, + pub account: ks_lib::MdPubkey, /// Target account-data size used for the rent query. pub target_space: u64, /// Lamports observed on the account before execution. @@ -30,9 +30,9 @@ impl crate::SolanaProgramMetadataRentObservation { #[derive(Clone, Debug, PartialEq)] pub struct SolanaProgramMetadataPreflightRequest { /// Exact typed intent used to build the plan. - pub intent: kb_lib::ExMetadataSpmExecutionIntent, - /// Exact prepared plan produced by `kb-lib`. - pub plan: kb_lib::ExApiPreparedExecutionPlan, + pub intent: ks_lib::ExMetadataSpmExecutionIntent, + /// Exact prepared plan produced by `ks-lib`. + pub plan: ks_lib::ExApiPreparedExecutionPlan, /// Confirmed account snapshots observed before simulation. pub before: std::vec::Vec, /// Explicit rent observations required by account growth operations. @@ -45,13 +45,13 @@ pub struct SolanaProgramMetadataPreflightReport { /// Stable operation code. pub operation_code: std::string::String, /// Primary account mutated by the instruction. - pub target_account: kb_lib::MdPubkey, + pub target_account: ks_lib::MdPubkey, /// Highest confirmed context slot across supplied snapshots. pub context_slot: u64, /// Canonical accounts inspected by the preflight. - pub inspected_accounts: std::vec::Vec, + pub inspected_accounts: std::vec::Vec, /// Safety decision applied before simulation. - pub safety: kb_lib::ExSafetyEvaluation, + pub safety: ks_lib::ExSafetyEvaluation, /// Whether the on-chain program must validate an upgrade authority at runtime. pub runtime_authority_validation_required: bool, /// Ordered successful checks. @@ -61,22 +61,22 @@ pub struct SolanaProgramMetadataPreflightReport { /// Validates one Program Metadata plan against confirmed pre-execution state. pub fn inspect_solana_program_metadata_preflight( request: &crate::SolanaProgramMetadataPreflightRequest, -) -> kb_core::Result { +) -> ks_core::Result { if request.before.len() > crate::MAX_SOLANA_PROGRAM_METADATA_PREFLIGHT_ACCOUNTS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_account_limit_exceeded", "Solana Program Metadata preflight account limit exceeded", )); } let operation_code = request.intent.operation.operation_code(); if request.plan.operation_code != operation_code { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_operation_mismatch", "Program Metadata intent and plan operation codes must match", )); } if request.plan.instructions.len() != 1 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_instruction_count_invalid", "Program Metadata plans must contain exactly one instruction", )); @@ -84,17 +84,17 @@ pub fn inspect_solana_program_metadata_preflight( let instruction = match request.plan.instructions.first() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_instruction_missing", "Program Metadata plan instruction is missing", )); }, }; - if instruction.program_id.0 != kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID + if instruction.program_id.0 != ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID || instruction.operation_code != operation_code - || !kb_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.contains(&operation_code) + || !ks_lib::EX_METADATA_SPM_SUPPORTED_OPERATION_CODES.contains(&operation_code) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_instruction_contract_mismatch", "Program Metadata plan does not preserve the exact program and operation contract", )); @@ -102,17 +102,17 @@ pub fn inspect_solana_program_metadata_preflight( if request.intent.operation.requires_explicit_approval() && !request.intent.allow_destructive_operation { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_destructive_approval_required", "destructive Program Metadata execution requires explicit approval", )); } - let safety = match kb_lib::ExSafetyChecker.evaluate_prepared_plan(&request.plan) { + let safety = match ks_lib::ExSafetyChecker.evaluate_prepared_plan(&request.plan) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - if safety.decision == kb_lib::ExSafetyDecision::Deny { - return std::result::Result::Err(kb_core::Error::new( + if safety.decision == ks_lib::ExSafetyDecision::Deny { + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_safety_denied", safety_violation_codes(safety.violations.as_slice()), )); @@ -124,13 +124,13 @@ pub fn inspect_solana_program_metadata_preflight( let mut context_slot = 0_u64; for snapshot in &request.before { if snapshot.commitment != "confirmed" { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_commitment_mismatch", "Program Metadata stateful snapshots must use confirmed commitment", )); } if snapshots.insert(snapshot.account.0.clone(), snapshot).is_some() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_duplicate_account", format!("duplicate Program Metadata snapshot for {}", snapshot.account.0), )); @@ -141,7 +141,7 @@ pub fn inspect_solana_program_metadata_preflight( let target = match snapshots.get(target_account.0.as_str()) { std::option::Option::Some(value) => *value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_target_snapshot_missing", format!("missing preflight snapshot for {}", target_account.0), )); @@ -206,51 +206,51 @@ pub fn inspect_solana_program_metadata_preflight( }); } -fn operation_target(operation: &kb_lib::ExMetadataSpmOperation) -> &kb_lib::MdPubkey { +fn operation_target(operation: &ks_lib::ExMetadataSpmOperation) -> &ks_lib::MdPubkey { return match operation { - kb_lib::ExMetadataSpmOperation::Write { buffer, .. } - | kb_lib::ExMetadataSpmOperation::Allocate { buffer, .. } => buffer, - kb_lib::ExMetadataSpmOperation::Initialize { metadata, .. } - | kb_lib::ExMetadataSpmOperation::SetData { metadata, .. } - | kb_lib::ExMetadataSpmOperation::SetImmutable { metadata, .. } => metadata, - kb_lib::ExMetadataSpmOperation::SetAuthority { account, .. } - | kb_lib::ExMetadataSpmOperation::Trim { account, .. } - | kb_lib::ExMetadataSpmOperation::Close { account, .. } - | kb_lib::ExMetadataSpmOperation::Extend { account, .. } => account, + ks_lib::ExMetadataSpmOperation::Write { buffer, .. } + | ks_lib::ExMetadataSpmOperation::Allocate { buffer, .. } => buffer, + ks_lib::ExMetadataSpmOperation::Initialize { metadata, .. } + | ks_lib::ExMetadataSpmOperation::SetData { metadata, .. } + | ks_lib::ExMetadataSpmOperation::SetImmutable { metadata, .. } => metadata, + ks_lib::ExMetadataSpmOperation::SetAuthority { account, .. } + | ks_lib::ExMetadataSpmOperation::Trim { account, .. } + | ks_lib::ExMetadataSpmOperation::Close { account, .. } + | ks_lib::ExMetadataSpmOperation::Extend { account, .. } => account, }; } fn validate_target_state( - operation: &kb_lib::ExMetadataSpmOperation, + operation: &ks_lib::ExMetadataSpmOperation, target: &crate::SolanaProgramMetadataStatefulReadResult, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let valid = match operation { - kb_lib::ExMetadataSpmOperation::Write { .. } => { + ks_lib::ExMetadataSpmOperation::Write { .. } => { matches!(&target.state, crate::SolanaProgramMetadataObservedAccountState::Buffer(_)) }, - kb_lib::ExMetadataSpmOperation::Initialize { data, .. } => { + ks_lib::ExMetadataSpmOperation::Initialize { data, .. } => { if data.is_some() { is_prefunded_uninitialized(target) } else { matches!(&target.state, crate::SolanaProgramMetadataObservedAccountState::Buffer(_)) } }, - kb_lib::ExMetadataSpmOperation::SetData { .. } - | kb_lib::ExMetadataSpmOperation::SetImmutable { .. } => { + ks_lib::ExMetadataSpmOperation::SetData { .. } + | ks_lib::ExMetadataSpmOperation::SetImmutable { .. } => { matches!(&target.state, crate::SolanaProgramMetadataObservedAccountState::Metadata(_)) }, - kb_lib::ExMetadataSpmOperation::Allocate { .. } => is_prefunded_uninitialized(target), - kb_lib::ExMetadataSpmOperation::SetAuthority { .. } - | kb_lib::ExMetadataSpmOperation::Trim { .. } - | kb_lib::ExMetadataSpmOperation::Close { .. } - | kb_lib::ExMetadataSpmOperation::Extend { .. } => matches!( + ks_lib::ExMetadataSpmOperation::Allocate { .. } => is_prefunded_uninitialized(target), + ks_lib::ExMetadataSpmOperation::SetAuthority { .. } + | ks_lib::ExMetadataSpmOperation::Trim { .. } + | ks_lib::ExMetadataSpmOperation::Close { .. } + | ks_lib::ExMetadataSpmOperation::Extend { .. } => matches!( &target.state, crate::SolanaProgramMetadataObservedAccountState::Buffer(_) | crate::SolanaProgramMetadataObservedAccountState::Metadata(_) ), }; if !valid { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_target_state_invalid", format!( "operation {} cannot use target state {}", @@ -270,34 +270,34 @@ fn is_prefunded_uninitialized(target: &crate::SolanaProgramMetadataStatefulReadR space: _, } => { *lamports > 0 - && (owner.0 == kb_program_ids::SYSTEM_PROGRAM_ID - || owner.0 == kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID) + && (owner.0 == ks_program_ids::SYSTEM_PROGRAM_ID + || owner.0 == ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID) }, _ => false, }; } fn validate_source_state( - operation: &kb_lib::ExMetadataSpmOperation, + operation: &ks_lib::ExMetadataSpmOperation, snapshots: &std::collections::BTreeMap< std::string::String, &crate::SolanaProgramMetadataStatefulReadResult, >, target: &crate::SolanaProgramMetadataStatefulReadResult, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { match operation { - kb_lib::ExMetadataSpmOperation::Write { offset, source, .. } => { + ks_lib::ExMetadataSpmOperation::Write { offset, source, .. } => { let target_buffer = match &target.state { crate::SolanaProgramMetadataObservedAccountState::Buffer(value) => value, _ => return std::result::Result::Ok(()), }; let source_length = match source { - kb_lib::ExMetadataSpmWriteSource::Inline { data } => data.len(), - kb_lib::ExMetadataSpmWriteSource::Buffer { source_buffer } => { + ks_lib::ExMetadataSpmWriteSource::Inline { data } => data.len(), + ks_lib::ExMetadataSpmWriteSource::Buffer { source_buffer } => { let source_snapshot = match snapshots.get(source_buffer.0.as_str()) { std::option::Option::Some(value) => *value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_source_buffer_missing", format!("missing source Buffer snapshot for {}", source_buffer.0), )); @@ -308,7 +308,7 @@ fn validate_source_state( value.data.len() }, _ => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_source_buffer_invalid", "Write source account must be an initialized Buffer", )); @@ -319,27 +319,27 @@ fn validate_source_state( let offset = match usize::try_from(*offset) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_write_offset_invalid", error.to_string(), )); }, }; if offset.saturating_add(source_length) > target_buffer.allocated_data_bytes { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_write_out_of_bounds", "Write source exceeds the allocated Buffer capacity", )); } }, - kb_lib::ExMetadataSpmOperation::SetData { - source: kb_lib::ExMetadataSpmSetDataSource::Buffer { buffer, .. }, + ks_lib::ExMetadataSpmOperation::SetData { + source: ks_lib::ExMetadataSpmSetDataSource::Buffer { buffer, .. }, .. } => { let source_snapshot = match snapshots.get(buffer.0.as_str()) { std::option::Option::Some(value) => *value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_source_buffer_missing", format!("missing source Buffer snapshot for {}", buffer.0), )); @@ -349,7 +349,7 @@ fn validate_source_state( &source_snapshot.state, crate::SolanaProgramMetadataObservedAccountState::Buffer(_) ) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_source_buffer_invalid", "SetData source account must be an initialized Buffer", )); @@ -361,25 +361,25 @@ fn validate_source_state( } fn validate_authority_state( - operation: &kb_lib::ExMetadataSpmOperation, + operation: &ks_lib::ExMetadataSpmOperation, target: &crate::SolanaProgramMetadataStatefulReadResult, -) -> kb_core::Result { +) -> ks_core::Result { let (authority, has_program_context) = match operation { - kb_lib::ExMetadataSpmOperation::Write { authority: _, .. } => { + ks_lib::ExMetadataSpmOperation::Write { authority: _, .. } => { return std::result::Result::Ok(false); }, - kb_lib::ExMetadataSpmOperation::Initialize { canonical, .. } => { + ks_lib::ExMetadataSpmOperation::Initialize { canonical, .. } => { return std::result::Result::Ok(*canonical); }, - kb_lib::ExMetadataSpmOperation::Allocate { seed, canonical, .. } => { + ks_lib::ExMetadataSpmOperation::Allocate { seed, canonical, .. } => { return std::result::Result::Ok(seed.is_some() && *canonical); }, - kb_lib::ExMetadataSpmOperation::SetAuthority { authority, program_context, .. } - | kb_lib::ExMetadataSpmOperation::SetData { authority, program_context, .. } - | kb_lib::ExMetadataSpmOperation::SetImmutable { authority, program_context, .. } - | kb_lib::ExMetadataSpmOperation::Trim { authority, program_context, .. } - | kb_lib::ExMetadataSpmOperation::Close { authority, program_context, .. } - | kb_lib::ExMetadataSpmOperation::Extend { authority, program_context, .. } => { + ks_lib::ExMetadataSpmOperation::SetAuthority { authority, program_context, .. } + | ks_lib::ExMetadataSpmOperation::SetData { authority, program_context, .. } + | ks_lib::ExMetadataSpmOperation::SetImmutable { authority, program_context, .. } + | ks_lib::ExMetadataSpmOperation::Trim { authority, program_context, .. } + | ks_lib::ExMetadataSpmOperation::Close { authority, program_context, .. } + | ks_lib::ExMetadataSpmOperation::Extend { authority, program_context, .. } => { (authority, program_context.is_some()) }, }; @@ -398,21 +398,21 @@ fn validate_authority_state( if canonical && has_program_context { return std::result::Result::Ok(true); } - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_authority_mismatch", "the supplied authority does not match account state and no canonical program context was provided", )); } fn validate_rent_observations( - operation: &kb_lib::ExMetadataSpmOperation, + operation: &ks_lib::ExMetadataSpmOperation, target: &crate::SolanaProgramMetadataStatefulReadResult, snapshots: &std::collections::BTreeMap< std::string::String, &crate::SolanaProgramMetadataStatefulReadResult, >, observations: &[crate::SolanaProgramMetadataRentObservation], -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let expected_space = match expected_rent_target_space(operation, target, snapshots) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -425,7 +425,7 @@ fn validate_rent_observations( { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_rent_observation_missing", format!("missing rent observation for {}", target.account.0), )); @@ -439,7 +439,7 @@ fn validate_rent_observations( || observation.observed_lamports != observed_lamports || !observation.is_satisfied() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_rent_not_satisfied", format!( "account {} has {} lamports but requires {} for exact target space {}", @@ -454,43 +454,43 @@ fn validate_rent_observations( } fn expected_rent_target_space( - operation: &kb_lib::ExMetadataSpmOperation, + operation: &ks_lib::ExMetadataSpmOperation, target: &crate::SolanaProgramMetadataStatefulReadResult, snapshots: &std::collections::BTreeMap< std::string::String, &crate::SolanaProgramMetadataStatefulReadResult, >, -) -> kb_core::Result> { - let header = match u64::try_from(kb_lib::DC_METADATA_SPM_METADATA_HEADER_BYTES) { +) -> ks_core::Result> { + let header = match u64::try_from(ks_lib::DC_METADATA_SPM_METADATA_HEADER_BYTES) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_header_size_overflow", error.to_string(), )); }, }; return match operation { - kb_lib::ExMetadataSpmOperation::Initialize { + ks_lib::ExMetadataSpmOperation::Initialize { data: std::option::Option::Some(data), .. } => add_metadata_header(header, metadata_input_wire_len(data)), - kb_lib::ExMetadataSpmOperation::SetData { - source: kb_lib::ExMetadataSpmSetDataSource::PreserveExisting, + ks_lib::ExMetadataSpmOperation::SetData { + source: ks_lib::ExMetadataSpmSetDataSource::PreserveExisting, .. } => std::result::Result::Ok(std::option::Option::None), - kb_lib::ExMetadataSpmOperation::SetData { - source: kb_lib::ExMetadataSpmSetDataSource::Inline { data }, + ks_lib::ExMetadataSpmOperation::SetData { + source: ks_lib::ExMetadataSpmSetDataSource::Inline { data }, .. } => add_metadata_header(header, metadata_input_wire_len(data)), - kb_lib::ExMetadataSpmOperation::SetData { - source: kb_lib::ExMetadataSpmSetDataSource::Buffer { buffer, .. }, + ks_lib::ExMetadataSpmOperation::SetData { + source: ks_lib::ExMetadataSpmSetDataSource::Buffer { buffer, .. }, .. } => { let source = match snapshots.get(buffer.0.as_str()) { std::option::Option::Some(value) => *value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_source_buffer_missing", format!("missing source Buffer snapshot for {}", buffer.0), )); @@ -501,7 +501,7 @@ fn expected_rent_target_space( match u64::try_from(value.data.len()) { std::result::Result::Ok(length) => length, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_source_length_overflow", error.to_string(), )); @@ -509,7 +509,7 @@ fn expected_rent_target_space( } }, _ => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_source_buffer_invalid", "SetData source account must be an initialized Buffer", )); @@ -517,18 +517,18 @@ fn expected_rent_target_space( }; return add_metadata_header(header, std::result::Result::Ok(length)); }, - kb_lib::ExMetadataSpmOperation::Allocate { .. } => { + ks_lib::ExMetadataSpmOperation::Allocate { .. } => { let current = match target.space { std::option::Option::Some(value) => value, std::option::Option::None => 0, }; std::result::Result::Ok(std::option::Option::Some(current.max(header))) }, - kb_lib::ExMetadataSpmOperation::Extend { length, .. } => { + ks_lib::ExMetadataSpmOperation::Extend { length, .. } => { let current = match target.space { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_target_space_missing", "Extend requires the current account space", )); @@ -538,7 +538,7 @@ fn expected_rent_target_space( std::option::Option::Some(value) => { std::result::Result::Ok(std::option::Option::Some(value)) }, - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_target_space_overflow", "Extend target space overflowed u64", )), @@ -548,17 +548,17 @@ fn expected_rent_target_space( }; } -fn metadata_input_wire_len(data: &kb_lib::ExMetadataSpmDataInput) -> kb_core::Result { +fn metadata_input_wire_len(data: &ks_lib::ExMetadataSpmDataInput) -> ks_core::Result { let length = match data { - kb_lib::ExMetadataSpmDataInput::Direct { bytes } => bytes.len(), - kb_lib::ExMetadataSpmDataInput::Url { url } => url.len(), - kb_lib::ExMetadataSpmDataInput::External { .. } => { - kb_lib::DC_METADATA_SPM_EXTERNAL_DATA_BYTES + ks_lib::ExMetadataSpmDataInput::Direct { bytes } => bytes.len(), + ks_lib::ExMetadataSpmDataInput::Url { url } => url.len(), + ks_lib::ExMetadataSpmDataInput::External { .. } => { + ks_lib::DC_METADATA_SPM_EXTERNAL_DATA_BYTES }, }; return match u64::try_from(length) { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_data_length_overflow", error.to_string(), )), @@ -567,8 +567,8 @@ fn metadata_input_wire_len(data: &kb_lib::ExMetadataSpmDataInput) -> kb_core::Re fn add_metadata_header( header: u64, - data_length: kb_core::Result, -) -> kb_core::Result> { + data_length: ks_core::Result, +) -> ks_core::Result> { let data_length = match data_length { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -577,14 +577,14 @@ fn add_metadata_header( std::option::Option::Some(value) => { std::result::Result::Ok(std::option::Option::Some(value)) }, - std::option::Option::None => std::result::Result::Err(kb_core::Error::new( + std::option::Option::None => std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_preflight_target_space_overflow", "Program Metadata target space overflowed u64", )), }; } -fn safety_violation_codes(violations: &[kb_lib::ExSafetyViolation]) -> std::string::String { +fn safety_violation_codes(violations: &[ks_lib::ExSafetyViolation]) -> std::string::String { if violations.is_empty() { return "Program Metadata execution safety denied without a diagnostic".to_string(); } @@ -597,48 +597,48 @@ fn safety_violation_codes(violations: &[kb_lib::ExSafetyViolation]) -> std::stri #[cfg(test)] mod tests { - fn pubkey(value: u8) -> kb_lib::MdPubkey { - return kb_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([value; 32]).to_string()); + fn pubkey(value: u8) -> ks_lib::MdPubkey { + return ks_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([value; 32]).to_string()); } - fn policy(authority: &kb_lib::MdPubkey) -> kb_lib::ExApiExecutionPolicy { - return kb_lib::ExApiExecutionPolicy { - cost_limit: kb_lib::ExApiExecutionCostLimit { + fn policy(authority: &ks_lib::MdPubkey) -> ks_lib::ExApiExecutionPolicy { + return ks_lib::ExApiExecutionPolicy { + cost_limit: ks_lib::ExApiExecutionCostLimit { max_spend_lamports: std::option::Option::Some(0), max_fee_lamports: std::option::Option::Some(20_000), max_compute_unit_price_micro_lamports: std::option::Option::None, }, authorized_signers: vec![authority.clone()], - post_execution_validation: kb_lib::ExApiPostExecutionValidationPolicy { + post_execution_validation: ks_lib::ExApiPostExecutionValidationPolicy { canonical_insert_required: true, core_extraction_required: true, decode_replay_required: true, materialization_required: true, }, - ..kb_lib::ExApiExecutionPolicy::default() + ..ks_lib::ExApiExecutionPolicy::default() }; } fn buffer_read( - account: kb_lib::MdPubkey, - authority: kb_lib::MdPubkey, + account: ks_lib::MdPubkey, + authority: ks_lib::MdPubkey, ) -> crate::SolanaProgramMetadataStatefulReadResult { return crate::SolanaProgramMetadataStatefulReadResult { commitment: "confirmed".to_string(), context_slot: 42, account: account.clone(), lamports: std::option::Option::Some(1_000), - owner: std::option::Option::Some(kb_lib::MdProgramId( - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), + owner: std::option::Option::Some(ks_lib::MdProgramId( + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), )), space: std::option::Option::Some(100), state: crate::SolanaProgramMetadataObservedAccountState::Buffer( - kb_lib::DcMetadataSpmBufferAccountSnapshot { + ks_lib::DcMetadataSpmBufferAccountSnapshot { account: account.0, program: std::option::Option::None, authority: std::option::Option::Some(authority.0), canonical: false, - seed: kb_lib::DcMetadataSpmSeed::default(), + seed: ks_lib::DcMetadataSpmSeed::default(), data: vec![0_u8; 4], allocated_data_bytes: 4, }, @@ -651,20 +651,20 @@ mod tests { fn write_preflight_requires_buffer_capacity_and_common_safety() { let authority = pubkey(2); let buffer = pubkey(3); - let intent = kb_lib::ExMetadataSpmExecutionIntent { + let intent = ks_lib::ExMetadataSpmExecutionIntent { intent_id: "spm-preflight-write".to_string(), fee_payer: authority.clone(), policy: policy(&authority), allow_destructive_operation: true, - operation: kb_lib::ExMetadataSpmOperation::Write { + operation: ks_lib::ExMetadataSpmOperation::Write { buffer: buffer.clone(), authority: authority.clone(), offset: 2, - source: kb_lib::ExMetadataSpmWriteSource::Inline { data: vec![8, 9] }, + source: ks_lib::ExMetadataSpmWriteSource::Inline { data: vec![8, 9] }, }, }; - let plan = kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan( - &kb_lib::ExMetadataSolanaProgramMetadataExecutor, + let plan = ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan( + &ks_lib::ExMetadataSolanaProgramMetadataExecutor, &intent, ); assert!(plan.is_ok()); @@ -682,8 +682,8 @@ mod tests { ); assert!(report.is_ok()); if let std::result::Result::Ok(value) = report { - assert_eq!(value.operation_code, kb_lib::EX_METADATA_SPM_WRITE_OPERATION); - assert_eq!(value.safety.decision, kb_lib::ExSafetyDecision::Allow); + assert_eq!(value.operation_code, ks_lib::EX_METADATA_SPM_WRITE_OPERATION); + assert_eq!(value.safety.decision, ks_lib::ExSafetyDecision::Allow); } } @@ -691,12 +691,12 @@ mod tests { fn allocate_requires_vacancy_and_explicit_rent_evidence() { let authority = pubkey(4); let buffer = authority.clone(); - let intent = kb_lib::ExMetadataSpmExecutionIntent { + let intent = ks_lib::ExMetadataSpmExecutionIntent { intent_id: "spm-preflight-allocate".to_string(), fee_payer: authority.clone(), policy: policy(&authority), allow_destructive_operation: false, - operation: kb_lib::ExMetadataSpmOperation::Allocate { + operation: ks_lib::ExMetadataSpmOperation::Allocate { buffer: buffer.clone(), authority: authority.clone(), seed: std::option::Option::None, @@ -705,8 +705,8 @@ mod tests { allocate_account: true, }, }; - let plan = kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan( - &kb_lib::ExMetadataSolanaProgramMetadataExecutor, + let plan = ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan( + &ks_lib::ExMetadataSolanaProgramMetadataExecutor, &intent, ); assert!(plan.is_ok()); @@ -719,12 +719,12 @@ mod tests { context_slot: 9, account: buffer.clone(), lamports: std::option::Option::Some(1_000), - owner: std::option::Option::Some(kb_lib::MdProgramId( - kb_program_ids::SYSTEM_PROGRAM_ID.to_string(), + owner: std::option::Option::Some(ks_lib::MdProgramId( + ks_program_ids::SYSTEM_PROGRAM_ID.to_string(), )), space: std::option::Option::Some(0), state: crate::SolanaProgramMetadataObservedAccountState::Uninitialized { - owner: kb_lib::MdProgramId(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), + owner: ks_lib::MdProgramId(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), lamports: 1_000, space: 0, }, @@ -739,7 +739,7 @@ mod tests { }, ); assert!(missing_rent.is_err()); - let target_space = match u64::try_from(kb_lib::DC_METADATA_SPM_BUFFER_HEADER_BYTES) { + let target_space = match u64::try_from(ks_lib::DC_METADATA_SPM_BUFFER_HEADER_BYTES) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => return, }; diff --git a/kb-pipeline/src/metadata_solana_program_stateful.rs b/ks-pipeline/src/metadata_solana_program_stateful.rs similarity index 85% rename from kb-pipeline/src/metadata_solana_program_stateful.rs rename to ks-pipeline/src/metadata_solana_program_stateful.rs index 052cbdb..a08d676 100644 --- a/kb-pipeline/src/metadata_solana_program_stateful.rs +++ b/ks-pipeline/src/metadata_solana_program_stateful.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/metadata_solana_program_stateful.rs -// version: 4 +// file: ks-pipeline/src/metadata_solana_program_stateful.rs +// version: 5 //! Bounded Solana Program Metadata account reads and authoritative state projections. @@ -8,7 +8,7 @@ /// The decoder can validate larger account byte arrays supplied by offline or chunked sources, but /// the current execution RPC adapter intentionally bounds one complete `getAccountInfo` response. pub const MAX_SOLANA_PROGRAM_METADATA_STATEFUL_ACCOUNT_BYTES: usize = - kb_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES; + ks_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES; /// Expected state of one Solana Program Metadata account read. #[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] @@ -35,16 +35,16 @@ pub enum SolanaProgramMetadataObservedAccountState { /// The address exists but contains only zeroed or empty data and is not initialized. Uninitialized { /// Current owner before Program Metadata assignment. - owner: kb_lib::MdProgramId, + owner: ks_lib::MdProgramId, /// Current lamports retained by the account. lamports: u64, /// Current allocated account-data bytes. space: u64, }, /// Decoded Program Metadata Buffer account. - Buffer(kb_lib::DcMetadataSpmBufferAccountSnapshot), + Buffer(ks_lib::DcMetadataSpmBufferAccountSnapshot), /// Decoded Program Metadata Metadata account. - Metadata(kb_lib::DcMetadataSpmMetadataAccountSnapshot), + Metadata(ks_lib::DcMetadataSpmMetadataAccountSnapshot), } impl crate::SolanaProgramMetadataObservedAccountState { @@ -73,7 +73,7 @@ pub struct SolanaProgramMetadataStatefulReadRequest { /// Endpoint role used for the HTTP RPC request. pub query_role: std::string::String, /// Account address to inspect. - pub account: kb_lib::MdPubkey, + pub account: ks_lib::MdPubkey, /// Expected account state. pub expected_state: crate::SolanaProgramMetadataExpectedAccountState, /// Optional minimum RPC context slot. @@ -84,13 +84,13 @@ pub struct SolanaProgramMetadataStatefulReadRequest { impl crate::SolanaProgramMetadataStatefulReadRequest { /// Validates the bounded request. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.query_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Solana Program Metadata stateful query_role must not be empty", )); } - let account_result = kb_onchain_transport::validate_solana_pubkey_text( + let account_result = ks_onchain_transport::validate_solana_pubkey_text( self.account.0.as_str(), "Solana Program Metadata stateful account", ); @@ -100,7 +100,7 @@ impl crate::SolanaProgramMetadataStatefulReadRequest { if self.max_data_bytes == 0 || self.max_data_bytes > crate::MAX_SOLANA_PROGRAM_METADATA_STATEFUL_ACCOUNT_BYTES { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Solana Program Metadata stateful max_data_bytes must be between 1 and {}", crate::MAX_SOLANA_PROGRAM_METADATA_STATEFUL_ACCOUNT_BYTES ))); @@ -117,29 +117,29 @@ pub struct SolanaProgramMetadataStatefulReadResult { /// Context slot returned by the endpoint. pub context_slot: u64, /// Account address requested by the caller. - pub account: kb_lib::MdPubkey, + pub account: ks_lib::MdPubkey, /// Current lamports when the account exists. pub lamports: std::option::Option, /// Current owner when the account exists. - pub owner: std::option::Option, + pub owner: std::option::Option, /// Current account-data allocation when the account exists. pub space: std::option::Option, /// Validated account state. pub state: crate::SolanaProgramMetadataObservedAccountState, /// Authoritative materialized projection for Buffer or Metadata state. - pub materialized_output: std::option::Option, + pub materialized_output: std::option::Option, } /// Reads one bounded Solana Program Metadata account. pub async fn read_solana_program_metadata_stateful_snapshot( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::SolanaProgramMetadataStatefulReadRequest, -) -> kb_core::Result { +) -> ks_core::Result { if let std::result::Result::Err(error) = request.validate() { return std::result::Result::Err(error); } - let config = match kb_onchain_transport::GetAccountInfoConfig::new_with_data( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let config = match ks_onchain_transport::GetAccountInfoConfig::new_with_data( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, request.min_context_slot, request.max_data_bytes, ) { @@ -159,14 +159,14 @@ pub async fn read_solana_program_metadata_stateful_snapshot( /// Validates one RPC account response, decodes its state and emits the authoritative projection. pub fn materialize_solana_program_metadata_account_info_result( request: &crate::SolanaProgramMetadataStatefulReadRequest, - result: &kb_onchain_transport::AccountInfoResult, -) -> kb_core::Result { + result: &ks_onchain_transport::AccountInfoResult, +) -> ks_core::Result { if let std::result::Result::Err(error) = request.validate() { return std::result::Result::Err(error); } if let std::option::Option::Some(minimum) = request.min_context_slot { if result.context.slot < minimum { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_stateful_context_slot_too_old", "Solana Program Metadata account context slot is below the requested minimum", )); @@ -185,7 +185,7 @@ pub fn materialize_solana_program_metadata_account_info_result( }, std::option::Option::Some(account) => { if account.executable { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_stateful_account_executable", "Solana Program Metadata state accounts must not be executable", )); @@ -193,14 +193,14 @@ pub fn materialize_solana_program_metadata_account_info_result( let data_len = match u64::try_from(account.data.len()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_stateful_account_length_overflow", error.to_string(), )); }, }; if account.space != data_len || account.data.len() > request.max_data_bytes { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_stateful_account_data_invalid", "Solana Program Metadata account data is incomplete or above the configured bound", )); @@ -222,42 +222,42 @@ pub fn materialize_solana_program_metadata_account_info_result( materialized_output: std::option::Option::None, } } else { - if account.owner.0 != kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID { - return std::result::Result::Err(kb_core::Error::new( + if account.owner.0 != ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID { + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_stateful_owner_mismatch", "initialized Solana Program Metadata state must be owned by ProgM6", )); } - let snapshot = match kb_lib::decoder_metadata_solana_program_metadata_decode_account( + let snapshot = match ks_lib::decoder_metadata_solana_program_metadata_decode_account( request.account.0.as_str(), account.owner.0.as_str(), account.data.as_slice(), ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_stateful_decode_failed", error.to_string(), )); }, }; - let materialized = match kb_lib::materializer_metadata_materialize_solana_program_metadata_account_snapshot( + let materialized = match ks_lib::materializer_metadata_materialize_solana_program_metadata_account_snapshot( result.context.slot, &snapshot, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_stateful_materialization_failed", error, )); }, }; let state = match snapshot { - kb_lib::DcMetadataSpmAccountSnapshot::Buffer(value) => { + ks_lib::DcMetadataSpmAccountSnapshot::Buffer(value) => { crate::SolanaProgramMetadataObservedAccountState::Buffer(value) }, - kb_lib::DcMetadataSpmAccountSnapshot::Metadata(value) => { + ks_lib::DcMetadataSpmAccountSnapshot::Metadata(value) => { crate::SolanaProgramMetadataObservedAccountState::Metadata(value) }, }; @@ -275,7 +275,7 @@ pub fn materialize_solana_program_metadata_account_info_result( }, }; if !expected_state_matches(request.expected_state, &output.state) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "metadata_solana_program_stateful_expected_state_mismatch", format!( "expected {:?}, observed {} for {}", @@ -323,7 +323,7 @@ mod tests { ) -> crate::SolanaProgramMetadataStatefulReadRequest { return crate::SolanaProgramMetadataStatefulReadRequest { query_role: "http_queries".to_string(), - account: kb_lib::MdPubkey( + account: ks_lib::MdPubkey( solana_pubkey::Pubkey::new_from_array([3_u8; 32]).to_string(), ), expected_state, @@ -334,8 +334,8 @@ mod tests { #[test] fn missing_and_zeroed_accounts_are_distinguished_and_bounded() { - let missing = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + let missing = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 10, api_version: std::option::Option::None, }, @@ -349,14 +349,14 @@ mod tests { missing_result.as_ref().map(|value| return &value.state), std::result::Result::Ok(crate::SolanaProgramMetadataObservedAccountState::Missing) )); - let zeroed = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + let zeroed = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 11, api_version: std::option::Option::None, }, - account: std::option::Option::Some(kb_onchain_transport::AccountInfoValue { + account: std::option::Option::Some(ks_onchain_transport::AccountInfoValue { lamports: 100, - owner: kb_lib::MdProgramId(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()), + owner: ks_lib::MdProgramId(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()), executable: false, rent_epoch: 0, space: 96, @@ -379,8 +379,8 @@ mod tests { fn buffer_state_is_decoded_and_materialized_authoritatively() { let program = solana_pubkey::Pubkey::new_from_array([4_u8; 32]); let authority = solana_pubkey::Pubkey::new_from_array([5_u8; 32]); - let mut data = vec![0_u8; kb_lib::DC_METADATA_SPM_BUFFER_HEADER_BYTES]; - data[0] = kb_lib::DcMetadataSpmAccountDiscriminator::Buffer.wire_value(); + let mut data = vec![0_u8; ks_lib::DC_METADATA_SPM_BUFFER_HEADER_BYTES]; + data[0] = ks_lib::DcMetadataSpmAccountDiscriminator::Buffer.wire_value(); data[1..33].copy_from_slice(&program.to_bytes()); data[33..65].copy_from_slice(&authority.to_bytes()); data[65] = 1; @@ -390,15 +390,15 @@ mod tests { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => return, }; - let result = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + let result = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 12, api_version: std::option::Option::None, }, - account: std::option::Option::Some(kb_onchain_transport::AccountInfoValue { + account: std::option::Option::Some(ks_onchain_transport::AccountInfoValue { lamports: 1_000, - owner: kb_lib::MdProgramId( - kb_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), + owner: ks_lib::MdProgramId( + ks_program_ids::METADATA_SOLANA_PROGRAM_METADATA_PROGRAM_ID.to_string(), ), executable: false, rent_epoch: 0, @@ -430,12 +430,12 @@ mod tests { fn stateful_complete_read_bound_matches_the_transport_contract() { assert_eq!( crate::MAX_SOLANA_PROGRAM_METADATA_STATEFUL_ACCOUNT_BYTES, - kb_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES + ks_onchain_transport::MAX_COMPLETE_ACCOUNT_DATA_BYTES ); const { assert!( crate::MAX_SOLANA_PROGRAM_METADATA_STATEFUL_ACCOUNT_BYTES - < kb_lib::DC_METADATA_SPM_MAX_ACCOUNT_BYTES + < ks_lib::DC_METADATA_SPM_MAX_ACCOUNT_BYTES ); } } diff --git a/kb-pipeline/src/plan.rs b/ks-pipeline/src/plan.rs similarity index 96% rename from kb-pipeline/src/plan.rs rename to ks-pipeline/src/plan.rs index df3d052..ae7fb47 100644 --- a/kb-pipeline/src/plan.rs +++ b/ks-pipeline/src/plan.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/plan.rs -// version: 2 +// file: ks-pipeline/src/plan.rs +// version: 3 //! Pipeline planning primitives. diff --git a/kb-pipeline/src/solana_stateful.rs b/ks-pipeline/src/solana_stateful.rs similarity index 87% rename from kb-pipeline/src/solana_stateful.rs rename to ks-pipeline/src/solana_stateful.rs index 9292550..6f0d813 100644 --- a/kb-pipeline/src/solana_stateful.rs +++ b/ks-pipeline/src/solana_stateful.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/solana_stateful.rs -// version: 2 +// file: ks-pipeline/src/solana_stateful.rs +// version: 3 //! Stateful Localnet and Devnet readiness checks for native Solana execution plans. @@ -51,16 +51,16 @@ pub struct SolanaCoreStatefulReadinessRequest { /// HTTP endpoint role used for all state reads. pub query_role: std::string::String, /// Expected Localnet or Devnet cluster. - pub cluster: kb_lib::ExApiExecutionCluster, + pub cluster: ks_lib::ExApiExecutionCluster, /// Native operation whose external state must be inspected. - pub operation: kb_lib::ExSolanaCoreOperation, + pub operation: ks_lib::ExSolanaCoreOperation, } /// Complete stateful readiness report produced before simulation. #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] pub struct SolanaCoreStatefulReadinessReport { /// Expected cluster. - pub cluster: kb_lib::ExApiExecutionCluster, + pub cluster: ks_lib::ExApiExecutionCluster, /// Stable native operation code. pub operation_code: std::string::String, /// Aggregate stateful readiness status. @@ -82,18 +82,18 @@ struct AddressLookupTableState { /// Inspects Localnet or Devnet state required before simulating one native operation. pub async fn inspect_solana_core_stateful_readiness( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::SolanaCoreStatefulReadinessRequest, -) -> kb_core::Result { +) -> ks_core::Result { if request.query_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "stateful execution readiness query_role must not be empty", )); } match request.cluster { - kb_lib::ExApiExecutionCluster::Localnet | kb_lib::ExApiExecutionCluster::Devnet => {}, - kb_lib::ExApiExecutionCluster::Testnet | kb_lib::ExApiExecutionCluster::Mainnet => { - return std::result::Result::Err(kb_core::Error::new( + ks_lib::ExApiExecutionCluster::Localnet | ks_lib::ExApiExecutionCluster::Devnet => {}, + ks_lib::ExApiExecutionCluster::Testnet | ks_lib::ExApiExecutionCluster::Mainnet => { + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_cluster_unsupported", "stateful native execution readiness is restricted to Localnet and Devnet", )); @@ -110,7 +110,7 @@ pub async fn inspect_solana_core_stateful_readiness( let mut report = new_report(request); push_fact(&mut report, "genesis_hash", genesis.genesis_hash.as_str()); match &request.operation { - kb_lib::ExSolanaCoreOperation::AddressLookupTableCreate { + ks_lib::ExSolanaCoreOperation::AddressLookupTableCreate { authority, payer, recent_slot, @@ -124,7 +124,7 @@ pub async fn inspect_solana_core_stateful_readiness( }, } }, - kb_lib::ExSolanaCoreOperation::AddressLookupTableExtend { + ks_lib::ExSolanaCoreOperation::AddressLookupTableExtend { lookup_table, authority, payer, @@ -149,7 +149,7 @@ pub async fn inspect_solana_core_stateful_readiness( }, } }, - kb_lib::ExSolanaCoreOperation::AddressLookupTableFreeze { lookup_table, authority } => { + ks_lib::ExSolanaCoreOperation::AddressLookupTableFreeze { lookup_table, authority } => { match inspect_alt_existing( pool, request, @@ -166,7 +166,7 @@ pub async fn inspect_solana_core_stateful_readiness( }, } }, - kb_lib::ExSolanaCoreOperation::AddressLookupTableDeactivate { lookup_table, authority } => { + ks_lib::ExSolanaCoreOperation::AddressLookupTableDeactivate { lookup_table, authority } => { match inspect_alt_existing( pool, request, @@ -183,7 +183,7 @@ pub async fn inspect_solana_core_stateful_readiness( }, } }, - kb_lib::ExSolanaCoreOperation::AddressLookupTableClose { + ks_lib::ExSolanaCoreOperation::AddressLookupTableClose { lookup_table, authority, .. } => { match inspect_alt_existing( @@ -202,7 +202,7 @@ pub async fn inspect_solana_core_stateful_readiness( }, } }, - kb_lib::ExSolanaCoreOperation::ConfigCreateAccount { + ks_lib::ExSolanaCoreOperation::ConfigCreateAccount { config_account, lamports, max_config_data_space, @@ -226,7 +226,7 @@ pub async fn inspect_solana_core_stateful_readiness( }, } }, - kb_lib::ExSolanaCoreOperation::ConfigStore { config_account, keys, data, .. } => { + ks_lib::ExSolanaCoreOperation::ConfigStore { config_account, keys, data, .. } => { match inspect_config_store( pool, request, @@ -243,7 +243,7 @@ pub async fn inspect_solana_core_stateful_readiness( }, } }, - kb_lib::ExSolanaCoreOperation::FeatureActivate { feature_account, lamports, .. } => { + ks_lib::ExSolanaCoreOperation::FeatureActivate { feature_account, lamports, .. } => { match inspect_feature_activate(pool, request, &mut report, feature_account, *lamports) .await { @@ -253,7 +253,7 @@ pub async fn inspect_solana_core_stateful_readiness( }, } }, - kb_lib::ExSolanaCoreOperation::FeatureRevokePendingActivation { feature_account } => { + ks_lib::ExSolanaCoreOperation::FeatureRevokePendingActivation { feature_account } => { match inspect_feature_revoke(pool, request, &mut report, feature_account).await { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => { @@ -261,7 +261,7 @@ pub async fn inspect_solana_core_stateful_readiness( }, } }, - kb_lib::ExSolanaCoreOperation::SlashingSubmitDuplicateBlockProof { + ks_lib::ExSolanaCoreOperation::SlashingSubmitDuplicateBlockProof { proof_account, report_account, report_lamports, @@ -287,7 +287,7 @@ pub async fn inspect_solana_core_stateful_readiness( }, } }, - kb_lib::ExSolanaCoreOperation::SlashingCloseViolationReport { + ks_lib::ExSolanaCoreOperation::SlashingCloseViolationReport { report_account, destination, } => { @@ -300,7 +300,7 @@ pub async fn inspect_solana_core_stateful_readiness( }, } }, - kb_lib::ExSolanaCoreOperation::ZkElGamalVerifyInline { + ks_lib::ExSolanaCoreOperation::ZkElGamalVerifyInline { proof_type, context_state, .. } => { match inspect_zk_verify( @@ -319,7 +319,7 @@ pub async fn inspect_solana_core_stateful_readiness( }, } }, - kb_lib::ExSolanaCoreOperation::ZkElGamalVerifyFromAccount { + ks_lib::ExSolanaCoreOperation::ZkElGamalVerifyFromAccount { proof_type, proof_account, proof_offset, @@ -341,7 +341,7 @@ pub async fn inspect_solana_core_stateful_readiness( }, } }, - kb_lib::ExSolanaCoreOperation::ZkElGamalCloseContextState { + ks_lib::ExSolanaCoreOperation::ZkElGamalCloseContextState { context_state, authority, .. @@ -375,34 +375,34 @@ fn new_report( } fn validate_cluster( - expected: kb_lib::ExApiExecutionCluster, - genesis: &kb_onchain_transport::GenesisHashResult, -) -> kb_core::Result<()> { + expected: ks_lib::ExApiExecutionCluster, + genesis: &ks_onchain_transport::GenesisHashResult, +) -> ks_core::Result<()> { return match expected { - kb_lib::ExApiExecutionCluster::Devnet => { + ks_lib::ExApiExecutionCluster::Devnet => { if genesis.classified_cluster - == std::option::Option::Some(kb_lib::ExApiExecutionCluster::Devnet) + == std::option::Option::Some(ks_lib::ExApiExecutionCluster::Devnet) { std::result::Result::Ok(()) } else { - std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(ks_core::Error::new( "execution_stateful_devnet_genesis_mismatch", "stateful Devnet readiness requires the official Devnet genesis hash", )) } }, - kb_lib::ExApiExecutionCluster::Localnet => { + ks_lib::ExApiExecutionCluster::Localnet => { if genesis.classified_cluster.is_none() { std::result::Result::Ok(()) } else { - std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(ks_core::Error::new( "execution_stateful_localnet_public_cluster", "Localnet readiness refuses endpoints classified as an official public cluster", )) } }, - kb_lib::ExApiExecutionCluster::Testnet | kb_lib::ExApiExecutionCluster::Mainnet => { - std::result::Result::Err(kb_core::Error::new( + ks_lib::ExApiExecutionCluster::Testnet | ks_lib::ExApiExecutionCluster::Mainnet => { + std::result::Result::Err(ks_core::Error::new( "execution_stateful_cluster_unsupported", "stateful native execution readiness is restricted to Localnet and Devnet", )) @@ -451,11 +451,11 @@ fn finalize_report(report: &mut crate::SolanaCoreStatefulReadinessReport) { } async fn account_with_data( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::SolanaCoreStatefulReadinessRequest, - pubkey: &kb_lib::MdPubkey, -) -> kb_core::Result { - let config = match kb_onchain_transport::GetAccountInfoConfig::confirmed_with_data( + pubkey: &ks_lib::MdPubkey, +) -> ks_core::Result { + let config = match ks_onchain_transport::GetAccountInfoConfig::confirmed_with_data( COMPLETE_ACCOUNT_DATA_LIMIT, ) { std::result::Result::Ok(value) => value, @@ -467,15 +467,15 @@ async fn account_with_data( } async fn rent_minimum( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::SolanaCoreStatefulReadinessRequest, data_length: u64, -) -> kb_core::Result { +) -> ks_core::Result { let result = pool .get_minimum_balance_for_rent_exemption_for_role( request.query_role.as_str(), data_length, - &kb_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), + &ks_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), ) .await; return match result { @@ -485,29 +485,29 @@ async fn rent_minimum( } async fn epoch_info( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::SolanaCoreStatefulReadinessRequest, -) -> kb_core::Result { +) -> ks_core::Result { return pool .get_epoch_info_for_role( request.query_role.as_str(), - &kb_onchain_transport::GetEpochInfoConfig::confirmed(), + &ks_onchain_transport::GetEpochInfoConfig::confirmed(), ) .await; } async fn inspect_alt_create( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::SolanaCoreStatefulReadinessRequest, report: &mut crate::SolanaCoreStatefulReadinessReport, - authority: &kb_lib::MdPubkey, - payer: &kb_lib::MdPubkey, + authority: &ks_lib::MdPubkey, + payer: &ks_lib::MdPubkey, recent_slot: u64, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let authority_address = match solana_pubkey::Pubkey::from_str(authority.0.as_str()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid ALT authority: {error}" ))); }, @@ -515,7 +515,7 @@ async fn inspect_alt_create( let payer_address = match solana_pubkey::Pubkey::from_str(payer.0.as_str()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "invalid ALT payer: {error}" ))); }, @@ -526,7 +526,7 @@ async fn inspect_alt_create( payer_address, recent_slot, ); - let table = kb_lib::MdPubkey(table_address.to_string()); + let table = ks_lib::MdPubkey(table_address.to_string()); let account_result = match account_with_data(pool, request, &table).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -579,13 +579,13 @@ enum AltAction { } async fn inspect_alt_existing( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::SolanaCoreStatefulReadinessRequest, report: &mut crate::SolanaCoreStatefulReadinessReport, - lookup_table: &kb_lib::MdPubkey, - authority: &kb_lib::MdPubkey, + lookup_table: &ks_lib::MdPubkey, + authority: &ks_lib::MdPubkey, action: AltAction, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let account_result = match account_with_data(pool, request, lookup_table).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -601,7 +601,7 @@ async fn inspect_alt_existing( push_check( report, "alt_owner_matches", - account.owner.0 == kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID, + account.owner.0 == ks_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID, "lookup table account must be owned by the Address Lookup Table program", ); push_check( @@ -708,9 +708,9 @@ async fn inspect_alt_existing( return std::result::Result::Ok(()); } -fn parse_alt_state(data: &[u8]) -> kb_core::Result { +fn parse_alt_state(data: &[u8]) -> ks_core::Result { if data.len() < ALT_META_SIZE { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_alt_data_short", "lookup table account data is shorter than the 56-byte metadata region", )); @@ -720,7 +720,7 @@ fn parse_alt_state(data: &[u8]) -> kb_core::Result { std::result::Result::Err(error) => return std::result::Result::Err(error), }; if tag != 1 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_alt_uninitialized", "lookup table account is not in the initialized LookupTable program state", )); @@ -735,7 +735,7 @@ fn parse_alt_state(data: &[u8]) -> kb_core::Result { let bytes = match data.get(22..54) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_alt_authority_short", "lookup table authority bytes are truncated", )); @@ -744,7 +744,7 @@ fn parse_alt_state(data: &[u8]) -> kb_core::Result { let array = match <[u8; 32]>::try_from(bytes) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_alt_authority_short", "lookup table authority bytes are not exactly 32 bytes", )); @@ -753,7 +753,7 @@ fn parse_alt_state(data: &[u8]) -> kb_core::Result { std::option::Option::Some(solana_pubkey::Pubkey::new_from_array(array).to_string()) }, value => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_alt_authority_option_invalid", format!("lookup table authority option tag must be 0 or 1 but received {value}"), )); @@ -761,14 +761,14 @@ fn parse_alt_state(data: &[u8]) -> kb_core::Result { }; let address_bytes = data.len() - ALT_META_SIZE; if address_bytes % 32 != 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_alt_addresses_misaligned", "lookup table address bytes must be aligned to 32-byte public keys", )); } let address_count = address_bytes / 32; if address_count > ALT_MAX_ADDRESSES { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_alt_capacity_invalid", "lookup table account contains more than 256 addresses", )); @@ -781,14 +781,14 @@ fn parse_alt_state(data: &[u8]) -> kb_core::Result { } async fn inspect_config_create( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::SolanaCoreStatefulReadinessRequest, report: &mut crate::SolanaCoreStatefulReadinessReport, - config_account: &kb_lib::MdPubkey, + config_account: &ks_lib::MdPubkey, lamports: u64, max_data_space: u64, max_key_count: usize, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let account_result = match account_with_data(pool, request, config_account).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -805,7 +805,7 @@ async fn inspect_config_create( let space = match max_data_space.checked_add(key_bytes as u64) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_config_space_overflow", "Config account allocation length overflow", )); @@ -827,13 +827,13 @@ async fn inspect_config_create( } async fn inspect_config_store( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::SolanaCoreStatefulReadinessRequest, report: &mut crate::SolanaCoreStatefulReadinessReport, - config_account: &kb_lib::MdPubkey, + config_account: &ks_lib::MdPubkey, key_count: usize, data_length: usize, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let account_result = match account_with_data(pool, request, config_account).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -854,7 +854,7 @@ async fn inspect_config_store( push_check( report, "config_store_owner_matches", - account.owner.0 == kb_program_ids::CONFIG_PROGRAM_ID, + account.owner.0 == ks_program_ids::CONFIG_PROGRAM_ID, "Config account must be owned by the Config program", ); push_check( @@ -878,12 +878,12 @@ async fn inspect_config_store( } async fn inspect_feature_activate( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::SolanaCoreStatefulReadinessRequest, report: &mut crate::SolanaCoreStatefulReadinessReport, - feature_account: &kb_lib::MdPubkey, + feature_account: &ks_lib::MdPubkey, lamports: u64, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let account_result = match account_with_data(pool, request, feature_account).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -894,7 +894,7 @@ async fn inspect_feature_activate( std::option::Option::None => 0, }; let reusable = account_result.account.as_ref().map(|account| { - return account.owner.0 == kb_program_ids::SYSTEM_PROGRAM_ID + return account.owner.0 == ks_program_ids::SYSTEM_PROGRAM_ID && !account.executable && account.space == 0 && account.data.is_empty(); @@ -925,11 +925,11 @@ async fn inspect_feature_activate( } async fn inspect_feature_revoke( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::SolanaCoreStatefulReadinessRequest, report: &mut crate::SolanaCoreStatefulReadinessReport, - feature_account: &kb_lib::MdPubkey, -) -> kb_core::Result<()> { + feature_account: &ks_lib::MdPubkey, +) -> ks_core::Result<()> { let account_result = match account_with_data(pool, request, feature_account).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -950,7 +950,7 @@ async fn inspect_feature_revoke( push_check( report, "feature_revoke_owner_matches", - account.owner.0 == kb_program_ids::FEATURE_PROGRAM_ID, + account.owner.0 == ks_program_ids::FEATURE_PROGRAM_ID, "feature account must be owned by the Feature program", ); push_check( @@ -971,15 +971,15 @@ async fn inspect_feature_revoke( } async fn inspect_slashing_submit( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::SolanaCoreStatefulReadinessRequest, report: &mut crate::SolanaCoreStatefulReadinessReport, - proof_account: &kb_lib::MdPubkey, - report_account: &kb_lib::MdPubkey, + proof_account: &ks_lib::MdPubkey, + report_account: &ks_lib::MdPubkey, report_lamports: u64, proof_offset: u64, slot: u64, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let proof_result = match account_with_data(pool, request, proof_account).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1025,7 +1025,7 @@ async fn inspect_slashing_submit( }; update_context_slot(report, report_result.context.slot); let report_reusable = report_result.account.as_ref().map(|account| { - return account.owner.0 == kb_program_ids::SYSTEM_PROGRAM_ID + return account.owner.0 == ks_program_ids::SYSTEM_PROGRAM_ID && !account.executable && account.space == 0 && account.data.is_empty(); @@ -1077,12 +1077,12 @@ async fn inspect_slashing_submit( } async fn inspect_slashing_close( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::SolanaCoreStatefulReadinessRequest, report: &mut crate::SolanaCoreStatefulReadinessReport, - report_account: &kb_lib::MdPubkey, - destination: &kb_lib::MdPubkey, -) -> kb_core::Result<()> { + report_account: &ks_lib::MdPubkey, + destination: &ks_lib::MdPubkey, +) -> ks_core::Result<()> { let account_result = match account_with_data(pool, request, report_account).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1103,7 +1103,7 @@ async fn inspect_slashing_close( push_check( report, "slashing_report_owner_matches", - account.owner.0 == kb_program_ids::SLASHING_PROGRAM_ID, + account.owner.0 == ks_program_ids::SLASHING_PROGRAM_ID, "violation report must be owned by the Slashing program", ); push_check( @@ -1162,13 +1162,13 @@ async fn inspect_slashing_close( } async fn inspect_zk_verify( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::SolanaCoreStatefulReadinessRequest, report: &mut crate::SolanaCoreStatefulReadinessReport, - proof_type: kb_lib::ExSolanaCoreZkElGamalProofType, - proof_account: std::option::Option<(&kb_lib::MdPubkey, u32)>, - context_state: std::option::Option<&kb_lib::ExSolanaCoreZkElGamalContextState>, -) -> kb_core::Result<()> { + proof_type: ks_lib::ExSolanaCoreZkElGamalProofType, + proof_account: std::option::Option<(&ks_lib::MdPubkey, u32)>, + context_state: std::option::Option<&ks_lib::ExSolanaCoreZkElGamalContextState>, +) -> ks_core::Result<()> { if let std::option::Option::Some((account_pubkey, offset)) = proof_account { let proof_result = match account_with_data(pool, request, account_pubkey).await { std::result::Result::Ok(value) => value, @@ -1234,7 +1234,7 @@ async fn inspect_zk_verify( push_check( report, "zk_context_owner_matches", - account.owner.0 == kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, + account.owner.0 == ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, "ZK context-state account must be owned by the ZK ElGamal Proof program", ); push_check( @@ -1270,12 +1270,12 @@ async fn inspect_zk_verify( } async fn inspect_zk_close( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::SolanaCoreStatefulReadinessRequest, report: &mut crate::SolanaCoreStatefulReadinessReport, - context_state: &kb_lib::MdPubkey, - authority: &kb_lib::MdPubkey, -) -> kb_core::Result<()> { + context_state: &ks_lib::MdPubkey, + authority: &ks_lib::MdPubkey, +) -> ks_core::Result<()> { let account_result = match account_with_data(pool, request, context_state).await { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -1296,7 +1296,7 @@ async fn inspect_zk_close( push_check( report, "zk_context_owner_matches", - account.owner.0 == kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, + account.owner.0 == ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, "ZK context-state account must be owned by the ZK ElGamal Proof program", ); push_check( @@ -1350,47 +1350,47 @@ async fn inspect_zk_close( fn proof_type_from_discriminator( discriminator: u8, -) -> std::option::Option { +) -> std::option::Option { return match discriminator { - 1 => std::option::Option::Some(kb_lib::ExSolanaCoreZkElGamalProofType::ZeroCiphertext), + 1 => std::option::Option::Some(ks_lib::ExSolanaCoreZkElGamalProofType::ZeroCiphertext), 2 => std::option::Option::Some( - kb_lib::ExSolanaCoreZkElGamalProofType::CiphertextCiphertextEquality, + ks_lib::ExSolanaCoreZkElGamalProofType::CiphertextCiphertextEquality, ), 3 => std::option::Option::Some( - kb_lib::ExSolanaCoreZkElGamalProofType::CiphertextCommitmentEquality, + ks_lib::ExSolanaCoreZkElGamalProofType::CiphertextCommitmentEquality, ), - 4 => std::option::Option::Some(kb_lib::ExSolanaCoreZkElGamalProofType::PubkeyValidity), - 5 => std::option::Option::Some(kb_lib::ExSolanaCoreZkElGamalProofType::PercentageWithCap), + 4 => std::option::Option::Some(ks_lib::ExSolanaCoreZkElGamalProofType::PubkeyValidity), + 5 => std::option::Option::Some(ks_lib::ExSolanaCoreZkElGamalProofType::PercentageWithCap), 6 => { - std::option::Option::Some(kb_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU64) + std::option::Option::Some(ks_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU64) }, 7 => { - std::option::Option::Some(kb_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU128) + std::option::Option::Some(ks_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU128) }, 8 => { - std::option::Option::Some(kb_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU256) + std::option::Option::Some(ks_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU256) }, 9 => std::option::Option::Some( - kb_lib::ExSolanaCoreZkElGamalProofType::GroupedCiphertext2HandlesValidity, + ks_lib::ExSolanaCoreZkElGamalProofType::GroupedCiphertext2HandlesValidity, ), 10 => std::option::Option::Some( - kb_lib::ExSolanaCoreZkElGamalProofType::BatchedGroupedCiphertext2HandlesValidity, + ks_lib::ExSolanaCoreZkElGamalProofType::BatchedGroupedCiphertext2HandlesValidity, ), 11 => std::option::Option::Some( - kb_lib::ExSolanaCoreZkElGamalProofType::GroupedCiphertext3HandlesValidity, + ks_lib::ExSolanaCoreZkElGamalProofType::GroupedCiphertext3HandlesValidity, ), 12 => std::option::Option::Some( - kb_lib::ExSolanaCoreZkElGamalProofType::BatchedGroupedCiphertext3HandlesValidity, + ks_lib::ExSolanaCoreZkElGamalProofType::BatchedGroupedCiphertext3HandlesValidity, ), _ => std::option::Option::None, }; } -fn duplicate_block_proof_length(data: &[u8], offset: u64) -> kb_core::Result { +fn duplicate_block_proof_length(data: &[u8], offset: u64) -> ks_core::Result { let start = match usize::try_from(offset) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_slashing_offset_invalid", "duplicate-block proof offset does not fit the local address space", )); @@ -1401,7 +1401,7 @@ fn duplicate_block_proof_length(data: &[u8], offset: u64) -> kb_core::Result return std::result::Result::Err(error), }; if first_length == 0 || first_length > MAX_SHRED_SIZE { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_slashing_first_shred_length_invalid", "first duplicate-block shred length must be between 1 and 1232 bytes", )); @@ -1410,7 +1410,7 @@ fn duplicate_block_proof_length(data: &[u8], offset: u64) -> kb_core::Result value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_slashing_proof_overflow", "duplicate-block proof length arithmetic overflow", )); @@ -1422,7 +1422,7 @@ fn duplicate_block_proof_length(data: &[u8], offset: u64) -> kb_core::Result return std::result::Result::Err(error), }; if second_length == 0 || second_length > MAX_SHRED_SIZE { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_slashing_second_shred_length_invalid", "second duplicate-block shred length must be between 1 and 1232 bytes", )); @@ -1434,7 +1434,7 @@ fn duplicate_block_proof_length(data: &[u8], offset: u64) -> kb_core::Result value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_slashing_proof_overflow", "duplicate-block proof length arithmetic overflow", )); @@ -1443,14 +1443,14 @@ fn duplicate_block_proof_length(data: &[u8], offset: u64) -> kb_core::Result value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_slashing_proof_overflow", "duplicate-block proof end offset overflow", )); }, }; if end > data.len() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_slashing_proof_truncated", "duplicate-block proof account does not contain both declared shreds", )); @@ -1468,11 +1468,11 @@ fn compact_u16_length(value: usize) -> usize { return 3; } -fn read_u32(data: &[u8], offset: usize, label: &str) -> kb_core::Result { +fn read_u32(data: &[u8], offset: usize, label: &str) -> ks_core::Result { let end = match offset.checked_add(4) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_integer_overflow", format!("{label} offset overflow"), )); @@ -1481,7 +1481,7 @@ fn read_u32(data: &[u8], offset: usize, label: &str) -> kb_core::Result { let bytes = match data.get(offset..end) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_integer_truncated", format!("{label} is truncated"), )); @@ -1490,7 +1490,7 @@ fn read_u32(data: &[u8], offset: usize, label: &str) -> kb_core::Result { let array = match <[u8; 4]>::try_from(bytes) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_integer_truncated", format!("{label} is not exactly four bytes"), )); @@ -1499,11 +1499,11 @@ fn read_u32(data: &[u8], offset: usize, label: &str) -> kb_core::Result { return std::result::Result::Ok(u32::from_le_bytes(array)); } -fn read_u64(data: &[u8], offset: usize, label: &str) -> kb_core::Result { +fn read_u64(data: &[u8], offset: usize, label: &str) -> ks_core::Result { let end = match offset.checked_add(8) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_integer_overflow", format!("{label} offset overflow"), )); @@ -1512,7 +1512,7 @@ fn read_u64(data: &[u8], offset: usize, label: &str) -> kb_core::Result { let bytes = match data.get(offset..end) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_integer_truncated", format!("{label} is truncated"), )); @@ -1521,7 +1521,7 @@ fn read_u64(data: &[u8], offset: usize, label: &str) -> kb_core::Result { let array = match <[u8; 8]>::try_from(bytes) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_integer_truncated", format!("{label} is not exactly eight bytes"), )); @@ -1530,11 +1530,11 @@ fn read_u64(data: &[u8], offset: usize, label: &str) -> kb_core::Result { return std::result::Result::Ok(u64::from_le_bytes(array)); } -fn pubkey_text(bytes: &[u8]) -> kb_core::Result { +fn pubkey_text(bytes: &[u8]) -> ks_core::Result { let array = match <[u8; 32]>::try_from(bytes) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "execution_stateful_pubkey_length_invalid", "stateful account field is not exactly 32 bytes", )); @@ -1547,19 +1547,19 @@ fn pubkey_text(bytes: &[u8]) -> kb_core::Result { mod tests { #[test] fn cluster_policy_restricts_stateful_reads_to_localnet_and_devnet() { - let devnet = kb_onchain_transport::GenesisHashResult { + let devnet = ks_onchain_transport::GenesisHashResult { genesis_hash: std::string::String::from("devnet"), - classified_cluster: std::option::Option::Some(kb_lib::ExApiExecutionCluster::Devnet), + classified_cluster: std::option::Option::Some(ks_lib::ExApiExecutionCluster::Devnet), }; - assert!(super::validate_cluster(kb_lib::ExApiExecutionCluster::Devnet, &devnet,).is_ok()); + assert!(super::validate_cluster(ks_lib::ExApiExecutionCluster::Devnet, &devnet,).is_ok()); assert!( - super::validate_cluster(kb_lib::ExApiExecutionCluster::Localnet, &devnet,).is_err() + super::validate_cluster(ks_lib::ExApiExecutionCluster::Localnet, &devnet,).is_err() ); - let local = kb_onchain_transport::GenesisHashResult { + let local = ks_onchain_transport::GenesisHashResult { genesis_hash: std::string::String::from("local"), classified_cluster: std::option::Option::None, }; - assert!(super::validate_cluster(kb_lib::ExApiExecutionCluster::Localnet, &local,).is_ok()); + assert!(super::validate_cluster(ks_lib::ExApiExecutionCluster::Localnet, &local,).is_ok()); } #[test] @@ -1607,8 +1607,8 @@ mod tests { assert!(proof_type.context_state_size() > super::ZK_CONTEXT_META_SIZE); } assert_eq!( - kb_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU64.context_state_size(), - kb_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU256.context_state_size(), + ks_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU64.context_state_size(), + ks_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU256.context_state_size(), ); assert!(super::proof_type_from_discriminator(0).is_none()); } diff --git a/kb-pipeline/src/spl_ata_stateful.rs b/ks-pipeline/src/spl_ata_stateful.rs similarity index 83% rename from kb-pipeline/src/spl_ata_stateful.rs rename to ks-pipeline/src/spl_ata_stateful.rs index 99c6c69..7424c3d 100644 --- a/kb-pipeline/src/spl_ata_stateful.rs +++ b/ks-pipeline/src/spl_ata_stateful.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/spl_ata_stateful.rs -// version: 4 +// file: ks-pipeline/src/spl_ata_stateful.rs +// version: 5 //! Stateful Localnet and Devnet readiness checks for ATA operations. @@ -52,18 +52,18 @@ pub struct SplAssociatedTokenAccountStatefulReadinessRequest { /// HTTP endpoint role used for every state read. pub query_role: std::string::String, /// Expected Localnet or Devnet cluster. - pub cluster: kb_lib::ExApiExecutionCluster, + pub cluster: ks_lib::ExApiExecutionCluster, /// Typed simulation-first ATA intent. - pub intent: kb_lib::ExSplAssociatedTokenAccountExecutionIntent, + pub intent: ks_lib::ExSplAssociatedTokenAccountExecutionIntent, /// Signer public keys currently available to the caller. - pub available_signers: std::vec::Vec, + pub available_signers: std::vec::Vec, } /// Complete ATA stateful readiness report. #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] pub struct SplAssociatedTokenAccountStatefulReadinessReport { /// Expected cluster. - pub cluster: kb_lib::ExApiExecutionCluster, + pub cluster: ks_lib::ExApiExecutionCluster, /// Stable operation code. pub operation_code: std::string::String, /// Aggregate readiness status. @@ -80,7 +80,7 @@ pub struct SplAssociatedTokenAccountStatefulReadinessReport { #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] pub struct SplAssociatedTokenAccountPostExecutionReport { /// Expected Localnet or Devnet cluster. - pub cluster: kb_lib::ExApiExecutionCluster, + pub cluster: ks_lib::ExApiExecutionCluster, /// Stable operation code. pub operation_code: std::string::String, /// Aggregate postcondition status. @@ -95,16 +95,16 @@ pub struct SplAssociatedTokenAccountPostExecutionReport { type AccountCache = std::collections::BTreeMap< std::string::String, - std::option::Option, + std::option::Option, >; /// Inspects Localnet or Devnet ATA state required before simulation. pub async fn inspect_spl_associated_token_account_stateful_readiness( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &SplAssociatedTokenAccountStatefulReadinessRequest, -) -> kb_core::Result { +) -> ks_core::Result { if request.query_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "ATA stateful readiness query_role must not be empty", )); } @@ -120,8 +120,8 @@ pub async fn inspect_spl_associated_token_account_stateful_readiness( std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), } - let plan = match kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan( - &kb_lib::ExSplAssociatedTokenAccountExecutor, + let plan = match ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan( + &ks_lib::ExSplAssociatedTokenAccountExecutor, &request.intent, ) { std::result::Result::Ok(value) => value, @@ -131,7 +131,7 @@ pub async fn inspect_spl_associated_token_account_stateful_readiness( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let config = match kb_onchain_transport::GetAccountInfoConfig::confirmed_with_data( + let config = match ks_onchain_transport::GetAccountInfoConfig::confirmed_with_data( MAX_TOKEN_2022_ACCOUNT_BYTES, ) { std::result::Result::Ok(value) => value, @@ -157,14 +157,14 @@ pub async fn inspect_spl_associated_token_account_stateful_readiness( .get_minimum_balance_for_rent_exemption_for_role( request.query_role.as_str(), BASE_TOKEN_ACCOUNT_LEN as u64, - &kb_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), + &ks_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), ) .await { std::result::Result::Ok(value) => value.minimum_balance_lamports, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let balance_config = kb_onchain_transport::GetBalanceConfig::confirmed(); + let balance_config = ks_onchain_transport::GetBalanceConfig::confirmed(); let payer_balance = match pool .get_balance_for_role( request.query_role.as_str(), @@ -189,13 +189,13 @@ pub async fn inspect_spl_associated_token_account_stateful_readiness( /// Verifies final ATA account relationships after a confirmed execution. pub async fn inspect_spl_associated_token_account_post_execution( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, query_role: &str, - cluster: kb_lib::ExApiExecutionCluster, - operation: &kb_lib::ExSplAssociatedTokenAccountOperation, -) -> kb_core::Result { + cluster: ks_lib::ExApiExecutionCluster, + operation: &ks_lib::ExSplAssociatedTokenAccountOperation, +) -> ks_core::Result { if query_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "ATA post-execution query role must not be empty", )); } @@ -213,7 +213,7 @@ pub async fn inspect_spl_associated_token_account_post_execution( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let config = match kb_onchain_transport::GetAccountInfoConfig::confirmed_with_data( + let config = match ks_onchain_transport::GetAccountInfoConfig::confirmed_with_data( MAX_TOKEN_2022_ACCOUNT_BYTES, ) { std::result::Result::Ok(value) => value, @@ -235,13 +235,13 @@ pub async fn inspect_spl_associated_token_account_post_execution( return evaluate_post_execution(cluster, operation, context_slot, &cache); } -fn validate_cluster_kind(cluster: kb_lib::ExApiExecutionCluster) -> kb_core::Result<()> { +fn validate_cluster_kind(cluster: ks_lib::ExApiExecutionCluster) -> ks_core::Result<()> { return match cluster { - kb_lib::ExApiExecutionCluster::Localnet | kb_lib::ExApiExecutionCluster::Devnet => { + ks_lib::ExApiExecutionCluster::Localnet | ks_lib::ExApiExecutionCluster::Devnet => { std::result::Result::Ok(()) }, - kb_lib::ExApiExecutionCluster::Testnet | kb_lib::ExApiExecutionCluster::Mainnet => { - std::result::Result::Err(kb_core::Error::new( + ks_lib::ExApiExecutionCluster::Testnet | ks_lib::ExApiExecutionCluster::Mainnet => { + std::result::Result::Err(ks_core::Error::new( "spl_ata_stateful_cluster_unsupported", "ATA stateful readiness is restricted to Localnet and Devnet", )) @@ -250,44 +250,44 @@ fn validate_cluster_kind(cluster: kb_lib::ExApiExecutionCluster) -> kb_core::Res } fn validate_genesis( - expected: kb_lib::ExApiExecutionCluster, - genesis: &kb_onchain_transport::GenesisHashResult, -) -> kb_core::Result<()> { + expected: ks_lib::ExApiExecutionCluster, + genesis: &ks_onchain_transport::GenesisHashResult, +) -> ks_core::Result<()> { return match expected { - kb_lib::ExApiExecutionCluster::Devnet + ks_lib::ExApiExecutionCluster::Devnet if genesis.classified_cluster - == std::option::Option::Some(kb_lib::ExApiExecutionCluster::Devnet) => + == std::option::Option::Some(ks_lib::ExApiExecutionCluster::Devnet) => { std::result::Result::Ok(()) }, - kb_lib::ExApiExecutionCluster::Localnet if genesis.classified_cluster.is_none() => { + ks_lib::ExApiExecutionCluster::Localnet if genesis.classified_cluster.is_none() => { std::result::Result::Ok(()) }, - kb_lib::ExApiExecutionCluster::Devnet => std::result::Result::Err(kb_core::Error::new( + ks_lib::ExApiExecutionCluster::Devnet => std::result::Result::Err(ks_core::Error::new( "spl_ata_stateful_devnet_genesis_mismatch", "ATA Devnet readiness requires the official Devnet genesis hash", )), - kb_lib::ExApiExecutionCluster::Localnet => std::result::Result::Err(kb_core::Error::new( + ks_lib::ExApiExecutionCluster::Localnet => std::result::Result::Err(ks_core::Error::new( "spl_ata_stateful_localnet_public_cluster", "ATA Localnet readiness refuses endpoints classified as a public cluster", )), - kb_lib::ExApiExecutionCluster::Testnet | kb_lib::ExApiExecutionCluster::Mainnet => { + ks_lib::ExApiExecutionCluster::Testnet | ks_lib::ExApiExecutionCluster::Mainnet => { validate_cluster_kind(expected) }, }; } fn operation_addresses( - operation: &kb_lib::ExSplAssociatedTokenAccountOperation, -) -> kb_core::Result> { + operation: &ks_lib::ExSplAssociatedTokenAccountOperation, +) -> ks_core::Result> { let mut values = std::vec::Vec::new(); match operation { - kb_lib::ExSplAssociatedTokenAccountOperation::Create { + ks_lib::ExSplAssociatedTokenAccountOperation::Create { wallet_owner, mint, token_program, } - | kb_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { + | ks_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { wallet_owner, mint, token_program, @@ -295,7 +295,7 @@ fn operation_addresses( values.push(mint.clone()); values.push(result_value!(derive_ata(wallet_owner, mint, token_program.program_id(),))); }, - kb_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { + ks_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { wallet_owner, owner_mint, nested_mint, @@ -322,14 +322,14 @@ fn operation_addresses( } fn derive_ata( - wallet: &kb_lib::MdPubkey, - mint: &kb_lib::MdPubkey, + wallet: &ks_lib::MdPubkey, + mint: &ks_lib::MdPubkey, token_program: &str, -) -> kb_core::Result { +) -> ks_core::Result { let wallet: solana_pubkey::Pubkey = match wallet.0.parse() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "spl_ata_stateful_wallet_invalid", error.to_string(), )); @@ -338,7 +338,7 @@ fn derive_ata( let mint: solana_pubkey::Pubkey = match mint.0.parse() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "spl_ata_stateful_mint_invalid", error.to_string(), )); @@ -347,7 +347,7 @@ fn derive_ata( let token_program: solana_pubkey::Pubkey = match token_program.parse() { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "spl_ata_stateful_token_program_invalid", error.to_string(), )); @@ -358,18 +358,18 @@ fn derive_ata( &mint, &token_program, ); - return std::result::Result::Ok(kb_lib::MdPubkey(derived.to_string())); + return std::result::Result::Ok(ks_lib::MdPubkey(derived.to_string())); } fn evaluate( request: &SplAssociatedTokenAccountStatefulReadinessRequest, - plan: &kb_lib::ExApiPreparedExecutionPlan, + plan: &ks_lib::ExApiPreparedExecutionPlan, genesis_hash: &str, context_slot: std::option::Option, cache: &AccountCache, base_rent_lamports: u64, payer_balance_lamports: u64, -) -> kb_core::Result { +) -> ks_core::Result { let mut report = SplAssociatedTokenAccountStatefulReadinessReport { cluster: request.cluster, operation_code: request.intent.operation.operation_code().to_string(), @@ -391,13 +391,13 @@ fn evaluate( &mut report, "ata_program_id", plan.instructions.len() == 1 - && plan.instructions[0].program_id.0 == kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID, + && plan.instructions[0].program_id.0 == ks_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID, "plan must contain exactly one instruction for the canonical ATA Program", ); push_check( &mut report, "simulation_required", - plan.policy.simulation == kb_lib::ExApiExecutionSimulationPolicy::Required, + plan.policy.simulation == ks_lib::ExApiExecutionSimulationPolicy::Required, "ATA plan must require simulation", ); for signer in &plan.required_signers { @@ -424,7 +424,7 @@ fn evaluate( ); let operation = &request.intent.operation; match operation { - kb_lib::ExSplAssociatedTokenAccountOperation::Create { + ks_lib::ExSplAssociatedTokenAccountOperation::Create { wallet_owner, mint, token_program, @@ -446,7 +446,7 @@ fn evaluate( "creation rent ceiling must cover at least the base Token account rent", ); }, - kb_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { + ks_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { wallet_owner, mint, token_program, @@ -481,7 +481,7 @@ fn evaluate( ); } }, - kb_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { + ks_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { wallet_owner, owner_mint, nested_mint, @@ -562,11 +562,11 @@ fn evaluate( } fn evaluate_post_execution( - cluster: kb_lib::ExApiExecutionCluster, - operation: &kb_lib::ExSplAssociatedTokenAccountOperation, + cluster: ks_lib::ExApiExecutionCluster, + operation: &ks_lib::ExSplAssociatedTokenAccountOperation, context_slot: std::option::Option, cache: &AccountCache, -) -> kb_core::Result { +) -> ks_core::Result { let mut report = SplAssociatedTokenAccountPostExecutionReport { cluster, operation_code: operation.operation_code().to_string(), @@ -576,12 +576,12 @@ fn evaluate_post_execution( facts: std::vec::Vec::new(), }; match operation { - kb_lib::ExSplAssociatedTokenAccountOperation::Create { + ks_lib::ExSplAssociatedTokenAccountOperation::Create { wallet_owner, mint, token_program, } - | kb_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { + | ks_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { wallet_owner, mint, token_program, @@ -601,7 +601,7 @@ fn evaluate_post_execution( "post_execution_ata", ); }, - kb_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { + ks_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { wallet_owner, owner_mint, nested_mint, @@ -657,10 +657,10 @@ fn evaluate_post_execution( fn check_post_cached_token_account( report: &mut SplAssociatedTokenAccountPostExecutionReport, cache: &AccountCache, - address: &kb_lib::MdPubkey, + address: &ks_lib::MdPubkey, token_program: &str, - expected_mint: &kb_lib::MdPubkey, - expected_owner: &kb_lib::MdPubkey, + expected_mint: &ks_lib::MdPubkey, + expected_owner: &ks_lib::MdPubkey, role: &str, ) { let account = cache.get(address.0.as_str()).and_then(|value| return value.as_ref()); @@ -734,15 +734,15 @@ fn push_post_fact( fn check_creation_plan_accounts( report: &mut SplAssociatedTokenAccountStatefulReadinessReport, - plan: &kb_lib::ExApiPreparedExecutionPlan, - derived_ata: &kb_lib::MdPubkey, + plan: &ks_lib::ExApiPreparedExecutionPlan, + derived_ata: &ks_lib::MdPubkey, token_program: &str, ) { let accounts_exact = match plan.instructions.first() { std::option::Option::Some(instruction) => { instruction.accounts.len() == 6 && instruction.accounts[1].pubkey == derived_ata.clone() - && instruction.accounts[4].pubkey.0 == kb_program_ids::SYSTEM_PROGRAM_ID + && instruction.accounts[4].pubkey.0 == ks_program_ids::SYSTEM_PROGRAM_ID && instruction.accounts[5].pubkey.0 == token_program }, std::option::Option::None => false, @@ -758,7 +758,7 @@ fn check_creation_plan_accounts( fn check_mint( report: &mut SplAssociatedTokenAccountStatefulReadinessReport, cache: &AccountCache, - mint: &kb_lib::MdPubkey, + mint: &ks_lib::MdPubkey, token_program: &str, ) { let account = cache.get(mint.0.as_str()).and_then(|value| return value.as_ref()); @@ -788,10 +788,10 @@ fn check_mint( fn check_cached_token_account( report: &mut SplAssociatedTokenAccountStatefulReadinessReport, cache: &AccountCache, - address: &kb_lib::MdPubkey, + address: &ks_lib::MdPubkey, token_program: &str, - expected_mint: &kb_lib::MdPubkey, - expected_owner: &kb_lib::MdPubkey, + expected_mint: &ks_lib::MdPubkey, + expected_owner: &ks_lib::MdPubkey, role: &str, ) { let account = cache.get(address.0.as_str()).and_then(|value| return value.as_ref()); @@ -808,10 +808,10 @@ fn check_cached_token_account( fn check_token_account( report: &mut SplAssociatedTokenAccountStatefulReadinessReport, - account: &kb_onchain_transport::AccountInfoValue, + account: &ks_onchain_transport::AccountInfoValue, token_program: &str, - expected_mint: &kb_lib::MdPubkey, - expected_owner: &kb_lib::MdPubkey, + expected_mint: &ks_lib::MdPubkey, + expected_owner: &ks_lib::MdPubkey, role: &str, ) { push_check( @@ -876,39 +876,39 @@ fn push_fact( #[cfg(test)] mod tests { - fn pubkey(value: &str) -> kb_lib::MdPubkey { - return kb_lib::MdPubkey(value.to_string()); + fn pubkey(value: &str) -> ks_lib::MdPubkey { + return ks_lib::MdPubkey(value.to_string()); } - fn policy(rent: u64, signers: std::vec::Vec) -> kb_lib::ExApiExecutionPolicy { - return kb_lib::ExApiExecutionPolicy { - cost_limit: kb_lib::ExApiExecutionCostLimit { + fn policy(rent: u64, signers: std::vec::Vec) -> ks_lib::ExApiExecutionPolicy { + return ks_lib::ExApiExecutionPolicy { + cost_limit: ks_lib::ExApiExecutionCostLimit { max_spend_lamports: std::option::Option::Some(rent), max_fee_lamports: std::option::Option::Some(10_000), max_compute_unit_price_micro_lamports: std::option::Option::None, }, authorized_signers: signers, - post_execution_validation: kb_lib::ExApiPostExecutionValidationPolicy { + post_execution_validation: ks_lib::ExApiPostExecutionValidationPolicy { canonical_insert_required: true, core_extraction_required: true, decode_replay_required: true, materialization_required: true, }, - ..kb_lib::ExApiExecutionPolicy::default() + ..ks_lib::ExApiExecutionPolicy::default() }; } fn request( - operation: kb_lib::ExSplAssociatedTokenAccountOperation, + operation: ks_lib::ExSplAssociatedTokenAccountOperation, rent: u64, ) -> crate::SplAssociatedTokenAccountStatefulReadinessRequest { - let fee_payer = pubkey(kb_program_ids::SYSTEM_PROGRAM_ID); + let fee_payer = pubkey(ks_program_ids::SYSTEM_PROGRAM_ID); let wallet = match &operation { - kb_lib::ExSplAssociatedTokenAccountOperation::Create { wallet_owner, .. } - | kb_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { + ks_lib::ExSplAssociatedTokenAccountOperation::Create { wallet_owner, .. } + | ks_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { wallet_owner, .. } - | kb_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { + | ks_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { wallet_owner, .. } => wallet_owner.clone(), }; @@ -918,8 +918,8 @@ mod tests { } return crate::SplAssociatedTokenAccountStatefulReadinessRequest { query_role: "query".to_string(), - cluster: kb_lib::ExApiExecutionCluster::Devnet, - intent: kb_lib::ExSplAssociatedTokenAccountExecutionIntent { + cluster: ks_lib::ExApiExecutionCluster::Devnet, + intent: ks_lib::ExSplAssociatedTokenAccountExecutionIntent { intent_id: "ata-stateful-1".to_string(), fee_payer, max_rent_lamports: rent, @@ -930,12 +930,12 @@ mod tests { }; } - fn mint_account(token_program: &str) -> kb_onchain_transport::AccountInfoValue { + fn mint_account(token_program: &str) -> ks_onchain_transport::AccountInfoValue { let mut data = std::vec![0; super::BASE_MINT_LEN]; data[45] = 1; - return kb_onchain_transport::AccountInfoValue { + return ks_onchain_transport::AccountInfoValue { lamports: 1, - owner: kb_lib::MdProgramId(token_program.to_string()), + owner: ks_lib::MdProgramId(token_program.to_string()), executable: false, rent_epoch: 0, space: data.len() as u64, @@ -945,9 +945,9 @@ mod tests { fn token_account( token_program: &str, - mint: &kb_lib::MdPubkey, - owner: &kb_lib::MdPubkey, - ) -> kb_onchain_transport::AccountInfoValue { + mint: &ks_lib::MdPubkey, + owner: &ks_lib::MdPubkey, + ) -> ks_onchain_transport::AccountInfoValue { let mut data = std::vec![0; super::BASE_TOKEN_ACCOUNT_LEN]; let mint_bytes = bs58::decode(&mint.0) .into_vec() @@ -958,9 +958,9 @@ mod tests { data[0..32].copy_from_slice(&mint_bytes); data[32..64].copy_from_slice(&owner_bytes); data[108] = 1; - return kb_onchain_transport::AccountInfoValue { + return ks_onchain_transport::AccountInfoValue { lamports: 1, - owner: kb_lib::MdProgramId(token_program.to_string()), + owner: ks_lib::MdProgramId(token_program.to_string()), executable: false, rent_epoch: 0, space: data.len() as u64, @@ -970,9 +970,9 @@ mod tests { fn plan( request: &crate::SplAssociatedTokenAccountStatefulReadinessRequest, - ) -> kb_lib::ExApiPreparedExecutionPlan { - return kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan( - &kb_lib::ExSplAssociatedTokenAccountExecutor, + ) -> ks_lib::ExApiPreparedExecutionPlan { + return ks_lib::ExApiTypedInstructionExecutor::build_prepared_plan( + &ks_lib::ExSplAssociatedTokenAccountExecutor, &request.intent, ) .unwrap_or_else(|error| panic!("ATA test plan failed: {error}")); @@ -980,22 +980,22 @@ mod tests { #[test] fn absent_classic_create_is_ready_with_exact_derived_address_and_rent_ceiling() { - let wallet = pubkey(kb_program_ids::STAKE_PROGRAM_ID); - let mint = pubkey(kb_program_ids::VOTE_PROGRAM_ID); + let wallet = pubkey(ks_program_ids::STAKE_PROGRAM_ID); + let mint = pubkey(ks_program_ids::VOTE_PROGRAM_ID); let request = request( - kb_lib::ExSplAssociatedTokenAccountOperation::Create { + ks_lib::ExSplAssociatedTokenAccountOperation::Create { wallet_owner: wallet.clone(), mint: mint.clone(), - token_program: kb_lib::ExSplAssociatedTokenProgram::Classic, + token_program: ks_lib::ExSplAssociatedTokenProgram::Classic, }, 2_100_000, ); - let ata = super::derive_ata(&wallet, &mint, kb_program_ids::SPL_TOKEN_PROGRAM_ID) + let ata = super::derive_ata(&wallet, &mint, ks_program_ids::SPL_TOKEN_PROGRAM_ID) .unwrap_or_else(|error| panic!("ATA derivation failed: {error}")); let mut cache = super::AccountCache::new(); cache.insert( mint.0.clone(), - std::option::Option::Some(mint_account(kb_program_ids::SPL_TOKEN_PROGRAM_ID)), + std::option::Option::Some(mint_account(ks_program_ids::SPL_TOKEN_PROGRAM_ID)), ); cache.insert(ata.0, std::option::Option::None); let report = super::evaluate( @@ -1013,29 +1013,29 @@ mod tests { #[test] fn idempotent_existing_account_conflict_is_blocked() { - let wallet = pubkey(kb_program_ids::STAKE_PROGRAM_ID); - let mint = pubkey(kb_program_ids::VOTE_PROGRAM_ID); + let wallet = pubkey(ks_program_ids::STAKE_PROGRAM_ID); + let mint = pubkey(ks_program_ids::VOTE_PROGRAM_ID); let request = request( - kb_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { + ks_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { wallet_owner: wallet.clone(), mint: mint.clone(), - token_program: kb_lib::ExSplAssociatedTokenProgram::Token2022, + token_program: ks_lib::ExSplAssociatedTokenProgram::Token2022, }, 2_100_000, ); - let ata = super::derive_ata(&wallet, &mint, kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID) + let ata = super::derive_ata(&wallet, &mint, ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID) .unwrap_or_else(|error| panic!("ATA derivation failed: {error}")); let mut cache = super::AccountCache::new(); cache.insert( mint.0.clone(), - std::option::Option::Some(mint_account(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID)), + std::option::Option::Some(mint_account(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID)), ); cache.insert( ata.0, std::option::Option::Some(token_account( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, &mint, - &pubkey(kb_program_ids::CONFIG_PROGRAM_ID), + &pubkey(ks_program_ids::CONFIG_PROGRAM_ID), )), ); let report = super::evaluate( @@ -1060,16 +1060,16 @@ mod tests { #[test] fn recover_nested_validates_all_three_canonical_accounts_and_signers() { - let wallet = pubkey(kb_program_ids::STAKE_PROGRAM_ID); - let owner_mint = pubkey(kb_program_ids::VOTE_PROGRAM_ID); - let nested_mint = pubkey(kb_program_ids::CONFIG_PROGRAM_ID); - let token_program = kb_program_ids::SPL_TOKEN_PROGRAM_ID; + let wallet = pubkey(ks_program_ids::STAKE_PROGRAM_ID); + let owner_mint = pubkey(ks_program_ids::VOTE_PROGRAM_ID); + let nested_mint = pubkey(ks_program_ids::CONFIG_PROGRAM_ID); + let token_program = ks_program_ids::SPL_TOKEN_PROGRAM_ID; let request = request( - kb_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { + ks_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { wallet_owner: wallet.clone(), owner_mint: owner_mint.clone(), nested_mint: nested_mint.clone(), - token_program: kb_lib::ExSplAssociatedTokenProgram::Classic, + token_program: ks_lib::ExSplAssociatedTokenProgram::Classic, }, 0, ); @@ -1109,26 +1109,26 @@ mod tests { #[test] fn creation_postcondition_requires_one_compatible_existing_ata() { - let wallet = pubkey(kb_program_ids::STAKE_PROGRAM_ID); - let mint = pubkey(kb_program_ids::VOTE_PROGRAM_ID); - let operation = kb_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { + let wallet = pubkey(ks_program_ids::STAKE_PROGRAM_ID); + let mint = pubkey(ks_program_ids::VOTE_PROGRAM_ID); + let operation = ks_lib::ExSplAssociatedTokenAccountOperation::CreateIdempotent { wallet_owner: wallet.clone(), mint: mint.clone(), - token_program: kb_lib::ExSplAssociatedTokenProgram::Token2022, + token_program: ks_lib::ExSplAssociatedTokenProgram::Token2022, }; - let ata = super::derive_ata(&wallet, &mint, kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID) + let ata = super::derive_ata(&wallet, &mint, ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID) .unwrap_or_else(|error| panic!("ATA derivation failed: {error}")); let mut cache = super::AccountCache::new(); cache.insert( ata.0, std::option::Option::Some(token_account( - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, &mint, &wallet, )), ); let report = super::evaluate_post_execution( - kb_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionCluster::Devnet, &operation, std::option::Option::Some(12), &cache, @@ -1139,15 +1139,15 @@ mod tests { #[test] fn recover_postcondition_requires_nested_closed_and_destination_compatible() { - let wallet = pubkey(kb_program_ids::STAKE_PROGRAM_ID); - let owner_mint = pubkey(kb_program_ids::VOTE_PROGRAM_ID); - let nested_mint = pubkey(kb_program_ids::CONFIG_PROGRAM_ID); - let token_program = kb_program_ids::SPL_TOKEN_PROGRAM_ID; - let operation = kb_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { + let wallet = pubkey(ks_program_ids::STAKE_PROGRAM_ID); + let owner_mint = pubkey(ks_program_ids::VOTE_PROGRAM_ID); + let nested_mint = pubkey(ks_program_ids::CONFIG_PROGRAM_ID); + let token_program = ks_program_ids::SPL_TOKEN_PROGRAM_ID; + let operation = ks_lib::ExSplAssociatedTokenAccountOperation::RecoverNested { wallet_owner: wallet.clone(), owner_mint: owner_mint.clone(), nested_mint: nested_mint.clone(), - token_program: kb_lib::ExSplAssociatedTokenProgram::Classic, + token_program: ks_lib::ExSplAssociatedTokenProgram::Classic, }; let owner_ata = super::derive_ata(&wallet, &owner_mint, token_program) .unwrap_or_else(|error| panic!("owner ATA failed: {error}")); @@ -1166,7 +1166,7 @@ mod tests { std::option::Option::Some(token_account(token_program, &nested_mint, &wallet)), ); let report = super::evaluate_post_execution( - kb_lib::ExApiExecutionCluster::Devnet, + ks_lib::ExApiExecutionCluster::Devnet, &operation, std::option::Option::Some(13), &cache, diff --git a/kb-pipeline/src/spl_elgamal_registry_stateful.rs b/ks-pipeline/src/spl_elgamal_registry_stateful.rs similarity index 81% rename from kb-pipeline/src/spl_elgamal_registry_stateful.rs rename to ks-pipeline/src/spl_elgamal_registry_stateful.rs index 0f2d1f6..a3d12cf 100644 --- a/kb-pipeline/src/spl_elgamal_registry_stateful.rs +++ b/ks-pipeline/src/spl_elgamal_registry_stateful.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/spl_elgamal_registry_stateful.rs -// version: 5 +// file: ks-pipeline/src/spl_elgamal_registry_stateful.rs +// version: 6 //! Contextual SPL ElGamal registry account-state validation and materialization routing. @@ -14,7 +14,7 @@ pub struct ElGamalRegistryStatefulReadRequest { /// Endpoint role used for the HTTP RPC request. pub query_role: std::string::String, /// Canonical registry PDA. - pub registry_account: kb_lib::MdPubkey, + pub registry_account: ks_lib::MdPubkey, /// Optional minimum RPC context slot. pub min_context_slot: std::option::Option, } @@ -32,16 +32,16 @@ pub struct ElGamalRegistryStatefulReadResult { /// Reads, validates, and routes one exact SPL ElGamal registry account. pub async fn read_elgamal_registry_stateful_snapshot( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::ElGamalRegistryStatefulReadRequest, -) -> kb_core::Result { +) -> ks_core::Result { if request.query_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "SPL ElGamal registry stateful read query_role must not be empty", )); } - let config = match kb_onchain_transport::GetAccountInfoConfig::new_with_data( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let config = match ks_onchain_transport::GetAccountInfoConfig::new_with_data( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, request.min_context_slot, crate::ELGAMAL_REGISTRY_STATEFUL_ACCOUNT_BYTES, ) { @@ -61,11 +61,11 @@ pub async fn read_elgamal_registry_stateful_snapshot( /// Validates one complete RPC registry response before parsing and routing. pub fn materialize_elgamal_registry_account_info_result( request: &crate::ElGamalRegistryStatefulReadRequest, - result: &kb_onchain_transport::AccountInfoResult, -) -> kb_core::Result { + result: &ks_onchain_transport::AccountInfoResult, +) -> ks_core::Result { if let std::option::Option::Some(min_context_slot) = request.min_context_slot { if result.context.slot < min_context_slot { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "elgamal_registry_stateful_context_slot_too_old", format!( "SPL ElGamal registry context slot {} is below requested minimum {min_context_slot}", @@ -77,7 +77,7 @@ pub fn materialize_elgamal_registry_account_info_result( let account = match result.account.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "elgamal_registry_stateful_account_missing", format!( "SPL ElGamal registry account {} does not exist", @@ -87,7 +87,7 @@ pub fn materialize_elgamal_registry_account_info_result( }, }; if account.executable { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "elgamal_registry_stateful_account_executable", format!( "SPL ElGamal registry state account {} must not be executable", @@ -95,12 +95,12 @@ pub fn materialize_elgamal_registry_account_info_result( ), )); } - if account.owner.0 != kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID { - return std::result::Result::Err(kb_core::Error::new( + if account.owner.0 != ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID { + return std::result::Result::Err(ks_core::Error::new( "elgamal_registry_stateful_owner_mismatch", format!( "SPL ElGamal registry owner must be {}, got {}", - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, account.owner.0 ), )); @@ -108,7 +108,7 @@ pub fn materialize_elgamal_registry_account_info_result( if account.space != crate::ELGAMAL_REGISTRY_STATEFUL_ACCOUNT_BYTES as u64 || account.data.len() != crate::ELGAMAL_REGISTRY_STATEFUL_ACCOUNT_BYTES { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "elgamal_registry_stateful_account_length_invalid", format!( "SPL ElGamal registry account must report and return exactly {} bytes, got space {} and data {}", @@ -126,7 +126,7 @@ pub fn materialize_elgamal_registry_account_info_result( ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "elgamal_registry_stateful_projection_failed", error, )); @@ -149,7 +149,7 @@ pub struct ElGamalRegistryStatefulSnapshot { /// Context slot associated with the account read. pub slot: u64, /// Processor-owned administrative projection. - pub output: kb_lib::MtApiMaterializedOutput, + pub output: ks_lib::MtApiMaterializedOutput, } /// Parse, validate the official owner-derived PDA, and materialize one registry snapshot. @@ -159,13 +159,13 @@ pub fn materialize_elgamal_registry_stateful_snapshot( slot: u64, data: &[u8], ) -> std::result::Result { - if owner_program_id != kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID { + if owner_program_id != ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID { return std::result::Result::Err(format!( "SPL ElGamal registry snapshot owner must be {}, got {owner_program_id}", - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID )); } - let state = match kb_lib::decoder_spl_elgamal_registry_parse_elgamal_registry_state(data) { + let state = match ks_lib::decoder_spl_elgamal_registry_parse_elgamal_registry_state(data) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -178,7 +178,7 @@ pub fn materialize_elgamal_registry_stateful_snapshot( }, }; let program_id = match solana_pubkey::Pubkey::from_str( - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { @@ -194,7 +194,7 @@ pub fn materialize_elgamal_registry_stateful_snapshot( "SPL ElGamal registry account {registry_account_key} does not match owner-derived PDA {expected}" )); } - let output = match kb_lib::materializer_admin_materialize_elgamal_registry_state_snapshot( + let output = match ks_lib::materializer_admin_materialize_elgamal_registry_state_snapshot( registry_account_key, slot, &state, @@ -216,7 +216,7 @@ mod tests { fn registry_fixture(owner: &solana_pubkey::Pubkey) -> (std::string::String, [u8; 64]) { let program_id = match solana_pubkey::Pubkey::from_str( - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => solana_pubkey::Pubkey::default(), @@ -235,7 +235,7 @@ mod tests { let (registry, data) = registry_fixture(&owner); let snapshot = crate::materialize_elgamal_registry_stateful_snapshot( registry.as_str(), - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, 55, &data, ); @@ -257,21 +257,21 @@ mod tests { let (registry, data) = registry_fixture(&owner); let foreign = crate::materialize_elgamal_registry_stateful_snapshot( registry.as_str(), - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, 55, &data, ); assert!(foreign.is_err()); let wrong = crate::materialize_elgamal_registry_stateful_snapshot( solana_pubkey::Pubkey::new_from_array([10u8; 32]).to_string().as_str(), - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, 55, &data, ); assert!(wrong.is_err()); let invalid = crate::materialize_elgamal_registry_stateful_snapshot( registry.as_str(), - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID, 55, &data[..63], ); @@ -284,18 +284,18 @@ mod tests { let (registry, data) = registry_fixture(&owner); let request = crate::ElGamalRegistryStatefulReadRequest { query_role: "execution".to_string(), - registry_account: kb_lib::MdPubkey(registry), + registry_account: ks_lib::MdPubkey(registry), min_context_slot: std::option::Option::Some(70), }; - let result = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + let result = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 71, api_version: std::option::Option::None, }, - account: std::option::Option::Some(kb_onchain_transport::AccountInfoValue { + account: std::option::Option::Some(ks_onchain_transport::AccountInfoValue { lamports: 1, - owner: kb_lib::MdProgramId( - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID.to_string(), + owner: ks_lib::MdProgramId( + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID.to_string(), ), executable: false, rent_epoch: 0, @@ -321,29 +321,29 @@ mod tests { let (registry, data) = registry_fixture(&owner); let request = crate::ElGamalRegistryStatefulReadRequest { query_role: "execution".to_string(), - registry_account: kb_lib::MdPubkey(registry), + registry_account: ks_lib::MdPubkey(registry), min_context_slot: std::option::Option::Some(80), }; - let base = kb_onchain_transport::AccountInfoValue { + let base = ks_onchain_transport::AccountInfoValue { lamports: 1, - owner: kb_lib::MdProgramId( - kb_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID.to_string(), + owner: ks_lib::MdProgramId( + ks_program_ids::SPL_TOKEN_2022_ELGAMAL_REGISTRY_PROGRAM_ID.to_string(), ), executable: false, rent_epoch: 0, space: 64, data: data.to_vec(), }; - let stale = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + let stale = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 79, api_version: std::option::Option::None, }, account: std::option::Option::Some(base.clone()), }; assert!(crate::materialize_elgamal_registry_account_info_result(&request, &stale).is_err()); - let missing = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + let missing = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 80, api_version: std::option::Option::None, }, @@ -353,9 +353,9 @@ mod tests { crate::materialize_elgamal_registry_account_info_result(&request, &missing).is_err() ); let mut foreign = base.clone(); - foreign.owner = kb_lib::MdProgramId(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); - let foreign = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + foreign.owner = ks_lib::MdProgramId(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()); + let foreign = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 80, api_version: std::option::Option::None, }, @@ -366,8 +366,8 @@ mod tests { ); let mut executable = base.clone(); executable.executable = true; - let executable = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + let executable = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 80, api_version: std::option::Option::None, }, @@ -378,8 +378,8 @@ mod tests { ); let mut wrong_length = base; wrong_length.data.pop(); - let wrong_length = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + let wrong_length = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 80, api_version: std::option::Option::None, }, diff --git a/kb-pipeline/src/spl_token_2022_correlation.rs b/ks-pipeline/src/spl_token_2022_correlation.rs similarity index 91% rename from kb-pipeline/src/spl_token_2022_correlation.rs rename to ks-pipeline/src/spl_token_2022_correlation.rs index eb0bef0..02f0eef 100644 --- a/kb-pipeline/src/spl_token_2022_correlation.rs +++ b/ks-pipeline/src/spl_token_2022_correlation.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/spl_token_2022_correlation.rs -// version: 3 +// file: ks-pipeline/src/spl_token_2022_correlation.rs +// version: 4 //! Deterministic Token-2022 instruction-to-state correlation. @@ -20,7 +20,7 @@ pub struct Token2022StateCorrelationReport { /// Stable caller-provided correlation identity. pub correlation_key: std::string::String, /// Canonical account identity checked against the snapshot. - pub account: kb_lib::MdPubkey, + pub account: ks_lib::MdPubkey, /// Instruction operation or risk fact used for correlation. pub fact_code: std::string::String, /// Extension expected from the fact when the fact is supported. @@ -38,17 +38,17 @@ pub struct Token2022StateCorrelationReport { /// Correlates one materialized instruction fact with one authoritative Token-2022 snapshot. pub fn correlate_token_2022_instruction_with_snapshot( correlation_key: &str, - account: &kb_lib::MdPubkey, - instruction_output: &kb_lib::MtApiMaterializedOutput, + account: &ks_lib::MdPubkey, + instruction_output: &ks_lib::MtApiMaterializedOutput, snapshot: &crate::Token2022StatefulSnapshotBundle, -) -> kb_core::Result { +) -> ks_core::Result { if correlation_key.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 correlation key must not be empty", )); } if snapshot.account_key != account.0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_correlation_account_mismatch", format!( "Token-2022 correlation expected account {}, got snapshot {}", @@ -66,7 +66,7 @@ pub fn correlate_token_2022_instruction_with_snapshot( .to_string(), }; if fact_code.is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_correlation_fact_missing", "Token-2022 correlation requires riskKind or operation in the instruction output", )); @@ -163,12 +163,12 @@ mod tests { }; } - fn output(field: &str, value: &str) -> kb_lib::MtApiMaterializedOutput { + fn output(field: &str, value: &str) -> ks_lib::MtApiMaterializedOutput { let mut payload = serde_json::Map::new(); payload.insert(field.to_string(), serde_json::Value::String(value.to_string())); - return kb_lib::MtApiMaterializedOutput { + return ks_lib::MtApiMaterializedOutput { output_key: "fact:0".to_string(), - family: kb_lib::MdMaterializedEventFamily::Risk, + family: ks_lib::MdMaterializedEventFamily::Risk, payload_json: serde_json::Value::Object(payload), }; } @@ -176,7 +176,7 @@ mod tests { #[test] fn known_fact_is_confirmed_or_contradicted_by_the_final_extension_inventory() { let snapshot = snapshot(&["pausable"]); - let account = kb_lib::MdPubkey(snapshot.account_key.clone()); + let account = ks_lib::MdPubkey(snapshot.account_key.clone()); let confirmed = super::correlate_token_2022_instruction_with_snapshot( "corr:pause", &account, @@ -204,7 +204,7 @@ mod tests { #[test] fn unsupported_fact_is_explicitly_not_applicable_without_inventing_a_conclusion() { let snapshot = snapshot(&[]); - let account = kb_lib::MdPubkey(snapshot.account_key.clone()); + let account = ks_lib::MdPubkey(snapshot.account_key.clone()); let report = super::correlate_token_2022_instruction_with_snapshot( "corr:unknown", &account, @@ -222,7 +222,7 @@ mod tests { #[test] fn correlation_identity_and_account_mismatch_fail_closed() { let snapshot = snapshot(&["memo_transfer"]); - let account = kb_lib::MdPubkey(snapshot.account_key.clone()); + let account = ks_lib::MdPubkey(snapshot.account_key.clone()); let empty = super::correlate_token_2022_instruction_with_snapshot( "", &account, @@ -230,7 +230,7 @@ mod tests { &snapshot, ); assert!(empty.is_err()); - let wrong = kb_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([8u8; 32]).to_string()); + let wrong = ks_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([8u8; 32]).to_string()); let mismatch = super::correlate_token_2022_instruction_with_snapshot( "corr:mismatch", &wrong, diff --git a/kb-pipeline/src/spl_token_2022_crypto_preflight.rs b/ks-pipeline/src/spl_token_2022_crypto_preflight.rs similarity index 82% rename from kb-pipeline/src/spl_token_2022_crypto_preflight.rs rename to ks-pipeline/src/spl_token_2022_crypto_preflight.rs index 4cdaa75..eb78bde 100644 --- a/kb-pipeline/src/spl_token_2022_crypto_preflight.rs +++ b/ks-pipeline/src/spl_token_2022_crypto_preflight.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/spl_token_2022_crypto_preflight.rs -// version: 4 +// file: ks-pipeline/src/spl_token_2022_crypto_preflight.rs +// version: 5 //! Bounded cryptographic preflight for Token-2022 proof context-state accounts. @@ -14,11 +14,11 @@ pub struct Token2022ProofContextRequirement { /// Stable semantic role used in diagnostics. pub role: std::string::String, /// Canonical proof context-state account. - pub account: kb_lib::MdPubkey, + pub account: ks_lib::MdPubkey, /// Exact proof kind expected by the Token-2022 builder. - pub proof_type: kb_lib::ExSolanaCoreZkElGamalProofType, + pub proof_type: ks_lib::ExSolanaCoreZkElGamalProofType, /// Optional authority retained by the context-state account. - pub expected_authority: std::option::Option, + pub expected_authority: std::option::Option, } /// One bounded cryptographic preflight request. @@ -38,7 +38,7 @@ pub struct Token2022ProofContextReport { /// Stable semantic role. pub role: std::string::String, /// Canonical proof context-state account. - pub account: kb_lib::MdPubkey, + pub account: ks_lib::MdPubkey, /// Official one-byte proof discriminator. pub proof_discriminator: u8, /// Exact context-state size for the proof type. @@ -62,9 +62,9 @@ pub struct Token2022CryptographicPreflightReport { /// Reads and validates all pre-verified proof context-state accounts required by one operation. pub async fn inspect_token_2022_cryptographic_preflight( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::Token2022CryptographicPreflightRequest, -) -> kb_core::Result { +) -> ks_core::Result { let requirements = match validate_proof_context_requirements(request) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -73,8 +73,8 @@ pub async fn inspect_token_2022_cryptographic_preflight( let mut reports = std::vec::Vec::with_capacity(requirements.len()); for requirement in requirements { let expected_size = requirement.proof_type.context_state_size(); - let config = match kb_onchain_transport::GetAccountInfoConfig::new_with_data( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let config = match ks_onchain_transport::GetAccountInfoConfig::new_with_data( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, request.min_context_slot, expected_size, ) { @@ -104,14 +104,14 @@ pub async fn inspect_token_2022_cryptographic_preflight( fn validate_proof_context_requirements( request: &crate::Token2022CryptographicPreflightRequest, -) -> kb_core::Result> { +) -> ks_core::Result> { if request.query_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 cryptographic preflight query_role must not be empty", )); } if request.proof_contexts.len() > crate::MAX_TOKEN_2022_PROOF_CONTEXTS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_proof_context_limit_exceeded", format!( "Token-2022 cryptographic preflight accepts at most {} proof contexts", @@ -123,13 +123,13 @@ fn validate_proof_context_requirements( let mut unique = std::vec::Vec::::new(); for requirement in &request.proof_contexts { if requirement.role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 proof context role must not be empty", )); } if let std::option::Option::Some(index) = indexes.get(requirement.account.0.as_str()) { if &unique[*index] != requirement { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_proof_context_conflicting_duplicate", format!( "Token-2022 proof context {} has conflicting requirements", @@ -147,12 +147,12 @@ fn validate_proof_context_requirements( fn validate_proof_context_account( requirement: &crate::Token2022ProofContextRequirement, - result: &kb_onchain_transport::AccountInfoResult, -) -> kb_core::Result { + result: &ks_onchain_transport::AccountInfoResult, +) -> ks_core::Result { let account = match result.account.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_proof_context_missing", format!( "Token-2022 proof context account {} does not exist", @@ -161,25 +161,25 @@ fn validate_proof_context_account( )); }, }; - if account.owner.0 != kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID { - return std::result::Result::Err(kb_core::Error::new( + if account.owner.0 != ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID { + return std::result::Result::Err(ks_core::Error::new( "token_2022_proof_context_owner_mismatch", format!( "Token-2022 proof context owner must be {}, got {}", - kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, + ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID, account.owner.0 ), )); } if account.executable { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_proof_context_executable", "Token-2022 proof context account must not be executable", )); } let expected_size = requirement.proof_type.context_state_size(); if account.space != expected_size as u64 || account.data.len() != expected_size { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_proof_context_size_mismatch", format!( "Token-2022 proof context {} must contain exactly {expected_size} bytes, got space {} and data {}", @@ -190,13 +190,13 @@ fn validate_proof_context_account( )); } if account.data.len() < crate::ZK_PROOF_CONTEXT_META_BYTES { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Token-2022 proof context is shorter than its generic metadata", )); } let discriminator = account.data[32]; if discriminator != requirement.proof_type.discriminator() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_proof_context_type_mismatch", format!( "Token-2022 proof context {} discriminator {} does not match expected {}", @@ -215,7 +215,7 @@ fn validate_proof_context_account( if let std::option::Option::Some(expected_authority) = requirement.expected_authority.as_ref() { let retained_authority = bs58::encode(&account.data[..32]).into_string(); if retained_authority != expected_authority.0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_proof_context_authority_mismatch", format!( "Token-2022 proof context {} retains authority {}, expected {}", @@ -237,13 +237,13 @@ fn validate_proof_context_account( #[cfg(test)] mod tests { - fn pubkey(byte: u8) -> kb_lib::MdPubkey { - return kb_lib::MdPubkey(bs58::encode([byte; 32]).into_string()); + fn pubkey(byte: u8) -> ks_lib::MdPubkey { + return ks_lib::MdPubkey(bs58::encode([byte; 32]).into_string()); } fn requirement( - account: kb_lib::MdPubkey, - proof_type: kb_lib::ExSolanaCoreZkElGamalProofType, + account: ks_lib::MdPubkey, + proof_type: ks_lib::ExSolanaCoreZkElGamalProofType, ) -> crate::Token2022ProofContextRequirement { return crate::Token2022ProofContextRequirement { role: "equality_proof".to_string(), @@ -254,19 +254,19 @@ mod tests { } fn account_result( - proof_type: kb_lib::ExSolanaCoreZkElGamalProofType, - ) -> kb_onchain_transport::AccountInfoResult { + proof_type: ks_lib::ExSolanaCoreZkElGamalProofType, + ) -> ks_onchain_transport::AccountInfoResult { let mut data = std::vec![0u8; proof_type.context_state_size()]; data[..32].copy_from_slice(&[9u8; 32]); data[32] = proof_type.discriminator(); - return kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + return ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 77, api_version: std::option::Option::None, }, - account: std::option::Option::Some(kb_onchain_transport::AccountInfoValue { + account: std::option::Option::Some(ks_onchain_transport::AccountInfoValue { lamports: 1, - owner: kb_lib::MdProgramId(kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID.to_string()), + owner: ks_lib::MdProgramId(ks_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID.to_string()), executable: false, rent_epoch: 0, space: data.len() as u64, @@ -279,7 +279,7 @@ mod tests { fn exact_duplicates_are_deduplicated_and_conflicts_fail_closed() { let item = requirement( pubkey(1), - kb_lib::ExSolanaCoreZkElGamalProofType::CiphertextCiphertextEquality, + ks_lib::ExSolanaCoreZkElGamalProofType::CiphertextCiphertextEquality, ); let request = crate::Token2022CryptographicPreflightRequest { query_role: "query".to_string(), @@ -295,7 +295,7 @@ mod tests { item, requirement( pubkey(1), - kb_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU128, + ks_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU128, ), ], }; @@ -304,7 +304,7 @@ mod tests { #[test] fn proof_context_validation_checks_owner_size_type_and_authority() { - let proof_type = kb_lib::ExSolanaCoreZkElGamalProofType::CiphertextCiphertextEquality; + let proof_type = ks_lib::ExSolanaCoreZkElGamalProofType::CiphertextCiphertextEquality; let context_requirement = requirement(pubkey(1), proof_type); let result = account_result(proof_type); let report = super::validate_proof_context_account(&context_requirement, &result); @@ -313,7 +313,7 @@ mod tests { std::result::Result::Ok(5) ); let wrong_type = - requirement(pubkey(1), kb_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU128); + requirement(pubkey(1), ks_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU128); assert!(super::validate_proof_context_account(&wrong_type, &result,).is_err()); } } diff --git a/kb-pipeline/src/spl_token_2022_execution_orchestration.rs b/ks-pipeline/src/spl_token_2022_execution_orchestration.rs similarity index 89% rename from kb-pipeline/src/spl_token_2022_execution_orchestration.rs rename to ks-pipeline/src/spl_token_2022_execution_orchestration.rs index 5c44ee8..eb8845c 100644 --- a/kb-pipeline/src/spl_token_2022_execution_orchestration.rs +++ b/ks-pipeline/src/spl_token_2022_execution_orchestration.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/spl_token_2022_execution_orchestration.rs -// version: 4 +// file: ks-pipeline/src/spl_token_2022_execution_orchestration.rs +// version: 5 //! Final Token-2022 execution-readiness and stateful postcondition contracts. @@ -24,7 +24,7 @@ pub struct Token2022ExecutionPostcondition { /// Stable semantic role such as `mint`, `source`, `destination`, or `registry`. pub role: std::string::String, /// Canonical account whose final state was inspected. - pub account: kb_lib::MdPubkey, + pub account: ks_lib::MdPubkey, /// Explicit result of the postcondition. pub status: crate::Token2022ExecutionPostconditionStatus, /// Bounded diagnostic explaining the result without retaining complete account data. @@ -35,7 +35,7 @@ pub struct Token2022ExecutionPostcondition { #[derive(Clone, Debug, PartialEq)] pub struct Token2022ExecutionReadinessRequest { /// Exact prepared executor plan. - pub plan: kb_lib::ExApiPreparedExecutionPlan, + pub plan: ks_lib::ExApiPreparedExecutionPlan, /// Exact hash of the compiled Solana message. pub message_hash: std::string::String, /// Hash retained by the simulation evidence. @@ -51,7 +51,7 @@ pub struct Token2022ExecutionReadinessRequest { /// Ordered proof orchestration report. pub proof_orchestration: crate::Token2022ProofOrchestrationReport, /// Public keys actually available to sign the transaction. - pub resolved_signers: std::vec::Vec, + pub resolved_signers: std::vec::Vec, /// Whether submission was explicitly requested. pub submit: bool, /// Whether submission received explicit operator confirmation. @@ -68,7 +68,7 @@ pub struct Token2022ExecutionReadinessReport { /// Highest RPC context slot across stateful and cryptographic preflights. pub context_slot: u64, /// Ordered signer public keys required by the plan. - pub required_signers: std::vec::Vec, + pub required_signers: std::vec::Vec, /// Whether transaction signing and submission are authorized. pub send_authorized: bool, /// Ordered successful checks. @@ -78,14 +78,14 @@ pub struct Token2022ExecutionReadinessReport { /// Validates the complete Token-2022 execution envelope before transaction signing. pub fn validate_token_2022_execution_readiness( request: &crate::Token2022ExecutionReadinessRequest, -) -> kb_core::Result { +) -> ks_core::Result { if request.plan.operation_code.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 execution plan operation_code must not be empty", )); } if request.plan.operation_code != request.proof_orchestration.operation_code { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_execution_operation_mismatch", "Token-2022 plan and proof orchestration operation codes must match", )); @@ -94,19 +94,19 @@ pub fn validate_token_2022_execution_readiness( || request.simulated_message_hash.trim().is_empty() || request.message_hash != request.simulated_message_hash { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_execution_simulation_message_mismatch", "Token-2022 simulation must be bound to the exact compiled message hash", )); } if !request.simulated || !request.simulation_succeeded { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_execution_simulation_required", "Token-2022 execution requires one successful exact-message simulation", )); } if !request.proof_orchestration.simulation_required { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_execution_proof_policy_mismatch", "Token-2022 proof orchestration must require simulation", )); @@ -114,7 +114,7 @@ pub fn validate_token_2022_execution_readiness( if request.stateful_preflight.commitment != "confirmed" || request.cryptographic_preflight.commitment != "confirmed" { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_execution_preflight_commitment_mismatch", "Token-2022 stateful and cryptographic preflights must use confirmed commitment", )); @@ -127,19 +127,19 @@ pub fn validate_token_2022_execution_readiness( std::result::Result::Err(error) => return std::result::Result::Err(error), }; if request.submit && !request.operator_confirmed { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_execution_confirmation_required", "Token-2022 submission requires explicit operator confirmation", )); } if request.submit && !request.proof_orchestration.send_authorized { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_execution_proof_send_not_authorized", "Token-2022 proof orchestration did not authorize submission", )); } if request.submit && request.plan.policy.dry_run { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_execution_dry_run_blocks_submission", "Token-2022 plan remains dry-run and cannot be submitted", )); @@ -186,13 +186,13 @@ pub fn summarize_token_2022_postconditions( } fn validate_signers( - required: &[kb_lib::ExApiRequiredSigner], - resolved: &[kb_lib::MdPubkey], -) -> kb_core::Result> { + required: &[ks_lib::ExApiRequiredSigner], + resolved: &[ks_lib::MdPubkey], +) -> ks_core::Result> { if required.len() > crate::MAX_TOKEN_2022_EXECUTION_SIGNERS || resolved.len() > crate::MAX_TOKEN_2022_EXECUTION_SIGNERS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_execution_signer_limit_exceeded", format!( "Token-2022 execution accepts at most {} signers", @@ -201,7 +201,7 @@ fn validate_signers( )); } let mut required_unique = - std::collections::BTreeMap::::new(); + std::collections::BTreeMap::::new(); for signer in required { required_unique .entry(signer.pubkey.0.clone()) @@ -213,7 +213,7 @@ fn validate_signers( .collect::>(); for signer in required_unique.values() { if !resolved_set.contains(signer.0.as_str()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_execution_signer_unresolved", format!("Token-2022 required signer {} is unresolved", signer.0), )); @@ -224,24 +224,24 @@ fn validate_signers( #[cfg(test)] mod tests { - fn pubkey(byte: u8) -> kb_lib::MdPubkey { - return kb_lib::MdPubkey(bs58::encode([byte; 32]).into_string()); + fn pubkey(byte: u8) -> ks_lib::MdPubkey { + return ks_lib::MdPubkey(bs58::encode([byte; 32]).into_string()); } fn request() -> crate::Token2022ExecutionReadinessRequest { let signer = pubkey(1); - let policy = kb_lib::ExApiExecutionPolicy { + let policy = ks_lib::ExApiExecutionPolicy { dry_run: false, ..std::default::Default::default() }; - let plan = kb_lib::ExApiPreparedExecutionPlan { + let plan = ks_lib::ExApiPreparedExecutionPlan { executor_name: "kb-lib.executor.spl.token_2022".to_string(), executor_version: "0.4.6".to_string(), intent_id: "intent".to_string(), operation_code: "spl.token_2022.confidential_transfer".to_string(), fee_payer: signer.clone(), instructions: vec![], - required_signers: vec![kb_lib::ExApiRequiredSigner { + required_signers: vec![ks_lib::ExApiRequiredSigner { pubkey: signer.clone(), role: "authority".to_string(), }], diff --git a/kb-pipeline/src/spl_token_2022_metadata.rs b/ks-pipeline/src/spl_token_2022_metadata.rs similarity index 87% rename from kb-pipeline/src/spl_token_2022_metadata.rs rename to ks-pipeline/src/spl_token_2022_metadata.rs index 573098a..319559b 100644 --- a/kb-pipeline/src/spl_token_2022_metadata.rs +++ b/ks-pipeline/src/spl_token_2022_metadata.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/spl_token_2022_metadata.rs -// version: 3 +// file: ks-pipeline/src/spl_token_2022_metadata.rs +// version: 4 //! Token-2022 Token Metadata return-data and authority postcondition contracts. @@ -27,16 +27,16 @@ pub struct Token2022MetadataEmitEvidence { pub fn validate_token_2022_metadata_emit_range( start: std::option::Option, end: std::option::Option, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if let (std::option::Option::Some(start), std::option::Option::Some(end)) = (start, end) { if start > end { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_emit_range_invalid", format!("Token Metadata Emit start {start} exceeds end {end}"), )); } if end - start > crate::MAX_TOKEN_2022_METADATA_EMIT_BYTES as u64 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_emit_range_too_large", format!( "Token Metadata Emit range exceeds {} bytes", @@ -47,7 +47,7 @@ pub fn validate_token_2022_metadata_emit_range( } if let (std::option::Option::None, std::option::Option::Some(end)) = (start, end) { if end > crate::MAX_TOKEN_2022_METADATA_EMIT_BYTES as u64 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_emit_range_too_large", format!( "Token Metadata Emit range from zero exceeds {} bytes", @@ -57,7 +57,7 @@ pub fn validate_token_2022_metadata_emit_range( } } if let (std::option::Option::Some(_), std::option::Option::None) = (start, end) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_emit_range_end_required", "Token Metadata Emit with a start offset requires an explicit end to remain bounded", )); @@ -67,16 +67,16 @@ pub fn validate_token_2022_metadata_emit_range( /// Extracts and validates Token Metadata return data from one exact simulation. pub fn inspect_token_2022_metadata_emit_simulation( - simulation: &kb_lib::ExApiExecutionSimulationResult, + simulation: &ks_lib::ExApiExecutionSimulationResult, start: std::option::Option, end: std::option::Option, -) -> kb_core::Result { +) -> ks_core::Result { match crate::validate_token_2022_metadata_emit_range(start, end) { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), } if !simulation.simulated || !simulation.success { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_emit_simulation_required", "Token Metadata Emit evidence requires a successful simulation", )); @@ -84,7 +84,7 @@ pub fn inspect_token_2022_metadata_emit_simulation( let return_data = match simulation.return_data.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_emit_return_data_missing", "Token Metadata Emit simulation did not return program data", )); @@ -93,14 +93,14 @@ pub fn inspect_token_2022_metadata_emit_simulation( let program_id = match return_data.get("programId").and_then(serde_json::Value::as_str) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_emit_program_id_missing", "Token Metadata Emit return data is missing programId", )); }, }; - if program_id != kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID { - return std::result::Result::Err(kb_core::Error::new( + if program_id != ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID { + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_emit_program_id_mismatch", format!("Token Metadata Emit return data came from {program_id}"), )); @@ -108,7 +108,7 @@ pub fn inspect_token_2022_metadata_emit_simulation( let data = match return_data.get("data").and_then(serde_json::Value::as_array) { std::option::Option::Some(value) if value.len() == 2 => value, _ => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_emit_data_invalid", "Token Metadata Emit return data must be [payload, encoding]", )); @@ -117,7 +117,7 @@ pub fn inspect_token_2022_metadata_emit_simulation( let payload = match data.first().and_then(|value| return value.as_str()) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_emit_payload_invalid", "Token Metadata Emit return payload must be a base64 string", )); @@ -126,14 +126,14 @@ pub fn inspect_token_2022_metadata_emit_simulation( let encoding = match data.get(1).and_then(|value| return value.as_str()) { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_emit_encoding_invalid", "Token Metadata Emit return data encoding is missing", )); }, }; if encoding != "base64" { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_emit_encoding_invalid", "Token Metadata Emit return data encoding must be base64", )); @@ -141,14 +141,14 @@ pub fn inspect_token_2022_metadata_emit_simulation( let decoded = match base64::engine::general_purpose::STANDARD.decode(payload) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_emit_base64_invalid", format!("Token Metadata Emit return payload is invalid base64: {error}"), )); }, }; if decoded.len() > crate::MAX_TOKEN_2022_METADATA_EMIT_BYTES { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_emit_data_too_large", format!( "Token Metadata Emit returned {} bytes, maximum is {}", @@ -158,10 +158,10 @@ pub fn inspect_token_2022_metadata_emit_simulation( )); } let decoded_metadata = if start.is_none() && end.is_none() { - match kb_lib::decoder_spl_token_2022_parse_token_metadata_value(decoded.as_slice()) { + match ks_lib::decoder_spl_token_2022_parse_token_metadata_value(decoded.as_slice()) { std::result::Result::Ok(value) => std::option::Option::Some(value), std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_metadata_emit_payload_decode_failed", error, )); @@ -181,8 +181,8 @@ pub fn inspect_token_2022_metadata_emit_simulation( /// Checks the final embedded metadata authority against one authoritative snapshot. pub fn inspect_token_2022_metadata_authority_postcondition( - account: &kb_lib::MdPubkey, - expected_authority: std::option::Option<&kb_lib::MdPubkey>, + account: &ks_lib::MdPubkey, + expected_authority: std::option::Option<&ks_lib::MdPubkey>, snapshot: &crate::Token2022StatefulSnapshotBundle, ) -> crate::Token2022ExecutionPostcondition { if snapshot.account_key != account.0 { @@ -194,7 +194,7 @@ pub fn inspect_token_2022_metadata_authority_postcondition( }; } let output = snapshot.outputs.iter().find(|output| { - return output.family == kb_lib::MdMaterializedEventFamily::Metadata + return output.family == ks_lib::MdMaterializedEventFamily::Metadata && output.payload_json.get("projectionKind").and_then(serde_json::Value::as_str) == std::option::Option::Some("token_metadata"); }); @@ -232,12 +232,12 @@ pub fn inspect_token_2022_metadata_authority_postcondition( mod tests { use base64::Engine; // rust-rules: trait-import - fn simulation(data: &[u8]) -> kb_lib::ExApiExecutionSimulationResult { - return kb_lib::ExApiExecutionSimulationResult { + fn simulation(data: &[u8]) -> ks_lib::ExApiExecutionSimulationResult { + return ks_lib::ExApiExecutionSimulationResult { simulated: true, success: true, - cluster: kb_lib::ExApiExecutionCluster::Devnet, - blockhash_kind: kb_lib::ExApiExecutionBlockhashKind::Latest, + cluster: ks_lib::ExApiExecutionCluster::Devnet, + blockhash_kind: ks_lib::ExApiExecutionBlockhashKind::Latest, blockhash_age_slots: std::option::Option::Some(0), replacement_blockhash: std::option::Option::None, replacement_last_valid_block_height: std::option::Option::None, @@ -247,7 +247,7 @@ mod tests { estimated_fee_lamports: std::option::Option::Some(5_000), logs: std::vec::Vec::new(), return_data: std::option::Option::Some(serde_json::json!({ - "programId": kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + "programId": ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, "data": [base64::engine::general_purpose::STANDARD.encode(data), "base64"] })), error: std::option::Option::None, @@ -317,7 +317,7 @@ mod tests { ); let mut invalid = simulation(&[1_u8]); invalid.return_data = std::option::Option::Some(serde_json::json!({ - "programId": kb_program_ids::SYSTEM_PROGRAM_ID, + "programId": ks_program_ids::SYSTEM_PROGRAM_ID, "data": ["AQ==", "base64"] })); assert!( @@ -332,16 +332,16 @@ mod tests { #[test] fn authority_postcondition_accepts_exact_value_and_null() { - let account = kb_lib::MdPubkey(bs58::encode([3_u8; 32]).into_string()); - let authority = kb_lib::MdPubkey(bs58::encode([4_u8; 32]).into_string()); + let account = ks_lib::MdPubkey(bs58::encode([3_u8; 32]).into_string()); + let authority = ks_lib::MdPubkey(bs58::encode([4_u8; 32]).into_string()); let mut snapshot = crate::Token2022StatefulSnapshotBundle { account_key: account.0.clone(), slot: 9, state_kind: "mint".to_string(), extension_names: vec!["token_metadata".to_string()], - outputs: vec![kb_lib::MtApiMaterializedOutput { + outputs: vec![ks_lib::MtApiMaterializedOutput { output_key: "metadata".to_string(), - family: kb_lib::MdMaterializedEventFamily::Metadata, + family: ks_lib::MdMaterializedEventFamily::Metadata, payload_json: serde_json::json!({ "projectionKind": "token_metadata", "valueFields": {"updateAuthority": authority.0} diff --git a/kb-pipeline/src/spl_token_2022_preflight.rs b/ks-pipeline/src/spl_token_2022_preflight.rs similarity index 89% rename from kb-pipeline/src/spl_token_2022_preflight.rs rename to ks-pipeline/src/spl_token_2022_preflight.rs index 2c6fd21..24b42db 100644 --- a/kb-pipeline/src/spl_token_2022_preflight.rs +++ b/ks-pipeline/src/spl_token_2022_preflight.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/spl_token_2022_preflight.rs -// version: 4 +// file: ks-pipeline/src/spl_token_2022_preflight.rs +// version: 5 //! Bounded Token-2022 stateful preflight orchestration. @@ -14,15 +14,15 @@ pub struct Token2022PreflightRequirement { /// Stable semantic role used in diagnostics. pub role: std::string::String, /// Canonical account address. - pub account: kb_lib::MdPubkey, + pub account: ks_lib::MdPubkey, /// Expected Token-2022 state category. - pub kind: kb_lib::DcToken2022StateKind, + pub kind: ks_lib::DcToken2022StateKind, /// Maximum complete account bytes accepted for this requirement. pub max_data_bytes: usize, /// Optional expected mint for a Token Account. - pub expected_mint: std::option::Option, + pub expected_mint: std::option::Option, /// Optional expected owner for a Token Account. - pub expected_owner: std::option::Option, + pub expected_owner: std::option::Option, /// Optional exact decimals expected for a Mint. pub expected_decimals: std::option::Option, /// Published extension names required on the account. @@ -54,7 +54,7 @@ pub struct Token2022PreflightAccountReport { /// Stable semantic role. pub role: std::string::String, /// Canonical account address. - pub account: kb_lib::MdPubkey, + pub account: ks_lib::MdPubkey, /// State category observed after parsing. pub state_kind: std::string::String, /// Context slot returned by the endpoint. @@ -82,9 +82,9 @@ pub struct Token2022PreflightReport { /// Inspects all bounded Token-2022 state required before simulation. pub async fn inspect_token_2022_preflight( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::Token2022PreflightRequest, -) -> kb_core::Result { +) -> ks_core::Result { let requirements = match validate_and_deduplicate_requirements(request) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -125,7 +125,7 @@ pub async fn inspect_token_2022_preflight( let mut elgamal_registry_validated = false; if let std::option::Option::Some(registry_request) = request.elgamal_registry.as_ref() { if registry_request.query_role != request.query_role { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 preflight ElGamal registry query role must match the shared query role", )); } @@ -148,15 +148,15 @@ pub async fn inspect_token_2022_preflight( fn validate_and_deduplicate_requirements( request: &crate::Token2022PreflightRequest, -) -> kb_core::Result> { +) -> ks_core::Result> { if request.query_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 preflight query_role must not be empty", )); } if request.max_accounts == 0 || request.max_accounts > crate::MAX_TOKEN_2022_PREFLIGHT_ACCOUNTS { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Token-2022 preflight max_accounts must be between 1 and {}", crate::MAX_TOKEN_2022_PREFLIGHT_ACCOUNTS ))); @@ -164,13 +164,13 @@ fn validate_and_deduplicate_requirements( if request.max_total_data_bytes == 0 || request.max_total_data_bytes > crate::MAX_TOKEN_2022_PREFLIGHT_TOTAL_BYTES { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Token-2022 preflight max_total_data_bytes must be between 1 and {}", crate::MAX_TOKEN_2022_PREFLIGHT_TOTAL_BYTES ))); } if request.requirements.is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 preflight requires at least one account", )); } @@ -178,21 +178,21 @@ fn validate_and_deduplicate_requirements( let mut unique = std::vec::Vec::::new(); for requirement in &request.requirements { if requirement.role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 preflight requirement role must not be empty", )); } if requirement.max_data_bytes == 0 || requirement.max_data_bytes > crate::MAX_TOKEN_2022_STATEFUL_ACCOUNT_BYTES { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Token-2022 preflight account {} has invalid max_data_bytes {}", requirement.account.0, requirement.max_data_bytes ))); } if let std::option::Option::Some(index) = indexes.get(requirement.account.0.as_str()) { if &unique[*index] != requirement { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_preflight_conflicting_duplicate", format!( "Token-2022 preflight account {} has conflicting requirements", @@ -210,7 +210,7 @@ fn validate_and_deduplicate_requirements( .len() .saturating_add(if request.elgamal_registry.is_some() { 1 } else { 0 }); if total_accounts > request.max_accounts { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_preflight_account_limit_exceeded", format!( "Token-2022 preflight requires {total_accounts} distinct accounts above limit {}", @@ -229,7 +229,7 @@ fn validate_and_deduplicate_requirements( 0 }); if requested_data_bytes > request.max_total_data_bytes { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_preflight_data_budget_exceeded", format!( "Token-2022 preflight requests {requested_data_bytes} bytes above aggregate limit {}", @@ -243,7 +243,7 @@ fn validate_and_deduplicate_requirements( fn validate_snapshot_requirement( requirement: &crate::Token2022PreflightRequirement, result: &crate::Token2022StatefulReadResult, -) -> kb_core::Result { +) -> ks_core::Result { let token_output = result .snapshot .outputs @@ -252,7 +252,7 @@ fn validate_snapshot_requirement( let token_output = match token_output { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::invalid_state( + return std::result::Result::Err(ks_core::Error::invalid_state( "Token-2022 preflight snapshot is missing its token account owner projection", )); }, @@ -265,7 +265,7 @@ fn validate_snapshot_requirement( ]; if let std::option::Option::Some(expected_mint) = requirement.expected_mint.as_ref() { if base_fields["mint"].as_str() != std::option::Option::Some(expected_mint.0.as_str()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_preflight_mint_mismatch", format!( "Token-2022 account {} mint does not match expected {}", @@ -277,7 +277,7 @@ fn validate_snapshot_requirement( } if let std::option::Option::Some(expected_owner) = requirement.expected_owner.as_ref() { if base_fields["owner"].as_str() != std::option::Option::Some(expected_owner.0.as_str()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_preflight_owner_mismatch", format!( "Token-2022 account {} owner does not match expected {}", @@ -289,7 +289,7 @@ fn validate_snapshot_requirement( } if let std::option::Option::Some(expected_decimals) = requirement.expected_decimals { if base_fields["decimals"].as_u64() != std::option::Option::Some(expected_decimals as u64) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_preflight_decimals_mismatch", format!( "Token-2022 mint {} decimals do not match expected {expected_decimals}", @@ -306,7 +306,7 @@ fn validate_snapshot_requirement( .iter() .any(|value| return value == required_extension) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_preflight_extension_missing", format!( "Token-2022 account {} is missing required extension {required_extension}", @@ -330,15 +330,15 @@ fn validate_snapshot_requirement( #[cfg(test)] mod tests { - fn pubkey(byte: u8) -> kb_lib::MdPubkey { - return kb_lib::MdPubkey(bs58::encode([byte; 32]).into_string()); + fn pubkey(byte: u8) -> ks_lib::MdPubkey { + return ks_lib::MdPubkey(bs58::encode([byte; 32]).into_string()); } - fn requirement(account: kb_lib::MdPubkey) -> crate::Token2022PreflightRequirement { + fn requirement(account: ks_lib::MdPubkey) -> crate::Token2022PreflightRequirement { return crate::Token2022PreflightRequirement { role: "source".to_string(), account, - kind: kb_lib::DcToken2022StateKind::Account, + kind: ks_lib::DcToken2022StateKind::Account, max_data_bytes: 512, expected_mint: std::option::Option::None, expected_owner: std::option::Option::None, @@ -396,7 +396,7 @@ mod tests { let requirement = crate::Token2022PreflightRequirement { role: "source".to_string(), account: account.clone(), - kind: kb_lib::DcToken2022StateKind::Account, + kind: ks_lib::DcToken2022StateKind::Account, max_data_bytes: 512, expected_mint: std::option::Option::Some(mint.clone()), expected_owner: std::option::Option::Some(owner.clone()), @@ -412,9 +412,9 @@ mod tests { slot: 42, state_kind: "account".to_string(), extension_names: std::vec!["memo_transfer".to_string()], - outputs: std::vec![kb_lib::MtApiMaterializedOutput { + outputs: std::vec![ks_lib::MtApiMaterializedOutput { output_key: "state".to_string(), - family: kb_lib::MdMaterializedEventFamily::TokenAccount, + family: ks_lib::MdMaterializedEventFamily::TokenAccount, payload_json: serde_json::json!({ "domain":"spl_token_2022_account_state", "baseFields":{"mint":mint.0,"owner":owner.0} diff --git a/kb-pipeline/src/spl_token_2022_proof_orchestration.rs b/ks-pipeline/src/spl_token_2022_proof_orchestration.rs similarity index 73% rename from kb-pipeline/src/spl_token_2022_proof_orchestration.rs rename to ks-pipeline/src/spl_token_2022_proof_orchestration.rs index 8aac76c..17ffc66 100644 --- a/kb-pipeline/src/spl_token_2022_proof_orchestration.rs +++ b/ks-pipeline/src/spl_token_2022_proof_orchestration.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/spl_token_2022_proof_orchestration.rs -// version: 5 +// file: ks-pipeline/src/spl_token_2022_proof_orchestration.rs +// version: 6 //! Deterministic orchestration contract for mixed Token-2022 proof locations. @@ -12,9 +12,9 @@ pub struct Token2022ProofOrchestrationRequest { /// Stable executor operation code. pub operation_code: std::string::String, /// Exact ordered proof references required by the operation. - pub proofs: std::vec::Vec, + pub proofs: std::vec::Vec, /// Optional authority expected on every context-state account. - pub expected_context_authority: std::option::Option, + pub expected_context_authority: std::option::Option, /// Maximum compute-unit limit accepted for the future transaction. pub compute_unit_limit: u32, /// Maximum total fee accepted for the future transaction. @@ -48,14 +48,14 @@ pub struct Token2022ProofOrchestrationReport { pub fn orchestrate_token_2022_proofs( request: &crate::Token2022ProofOrchestrationRequest, cryptographic_preflight: &crate::Token2022CryptographicPreflightReport, -) -> kb_core::Result { +) -> ks_core::Result { if request.operation_code.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 proof orchestration operation_code must not be empty", )); } if request.proofs.len() > crate::MAX_TOKEN_2022_OPERATION_PROOFS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_operation_proof_limit_exceeded", format!( "Token-2022 proof orchestration accepts at most {} proofs", @@ -64,12 +64,12 @@ pub fn orchestrate_token_2022_proofs( )); } if request.compute_unit_limit == 0 || request.max_fee_lamports == 0 { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 proof orchestration requires non-zero compute and fee ceilings", )); } if request.submit && !request.operator_confirmed { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_submission_confirmation_required", "Token-2022 submission requires explicit operator confirmation", )); @@ -82,7 +82,7 @@ pub fn orchestrate_token_2022_proofs( for proof in &request.proofs { let kind_code = proof_kind_code(proof.kind).to_string(); if !kinds.insert(kind_code.clone()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_duplicate_proof_kind", format!( "Token-2022 operation {} contains duplicate proof kind {kind_code}", @@ -91,12 +91,12 @@ pub fn orchestrate_token_2022_proofs( )); } if let std::result::Result::Err(error) = proof.location.validate() { - return std::result::Result::Err(kb_core::Error::invalid_state(error)); + return std::result::Result::Err(ks_core::Error::invalid_state(error)); } match &proof.location { - kb_lib::ExSplTokenConfidentialProofLocation::InstructionOffset { offset } => { + ks_lib::ExSplTokenConfidentialProofLocation::InstructionOffset { offset } => { if !offsets.insert(*offset) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_duplicate_inline_proof_offset", format!( "Token-2022 operation {} reuses inline proof offset {offset}", @@ -106,9 +106,9 @@ pub fn orchestrate_token_2022_proofs( } inline_offsets.push(*offset); }, - kb_lib::ExSplTokenConfidentialProofLocation::ContextStateAccount { account } => { + ks_lib::ExSplTokenConfidentialProofLocation::ContextStateAccount { account } => { if !context_accounts.insert(account.0.clone()) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_duplicate_context_state_account", format!( "Token-2022 operation {} reuses context-state account {}", @@ -151,9 +151,9 @@ pub fn orchestrate_token_2022_proofs( fn validate_context_reports( requirements: &[crate::Token2022ProofContextRequirement], report: &crate::Token2022CryptographicPreflightReport, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if requirements.len() != report.proof_contexts.len() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_context_preflight_count_mismatch", format!( "Token-2022 operation requires {} context states, preflight contains {}", @@ -166,7 +166,7 @@ fn validate_context_reports( if requirement.account != observed.account || requirement.proof_type.discriminator() != observed.proof_discriminator { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_context_preflight_mismatch", format!( "Token-2022 proof context {} does not match the ordered operation requirement", @@ -178,79 +178,79 @@ fn validate_context_reports( return std::result::Result::Ok(()); } -fn proof_kind_code(kind: kb_lib::ExSplTokenConfidentialProofKind) -> &'static str { +fn proof_kind_code(kind: ks_lib::ExSplTokenConfidentialProofKind) -> &'static str { return match kind { - kb_lib::ExSplTokenConfidentialProofKind::PubkeyValidity => "pubkey_validity", - kb_lib::ExSplTokenConfidentialProofKind::ZeroCiphertext => "zero_ciphertext", - kb_lib::ExSplTokenConfidentialProofKind::CiphertextCommitmentEquality => { + ks_lib::ExSplTokenConfidentialProofKind::PubkeyValidity => "pubkey_validity", + ks_lib::ExSplTokenConfidentialProofKind::ZeroCiphertext => "zero_ciphertext", + ks_lib::ExSplTokenConfidentialProofKind::CiphertextCommitmentEquality => { "ciphertext_commitment_equality" }, - kb_lib::ExSplTokenConfidentialProofKind::CiphertextCiphertextEquality => { + ks_lib::ExSplTokenConfidentialProofKind::CiphertextCiphertextEquality => { "ciphertext_ciphertext_equality" }, - kb_lib::ExSplTokenConfidentialProofKind::BatchedGroupedCiphertext3HandlesValidity => { + ks_lib::ExSplTokenConfidentialProofKind::BatchedGroupedCiphertext3HandlesValidity => { "batched_grouped_ciphertext_3_handles_validity" }, - kb_lib::ExSplTokenConfidentialProofKind::BatchedGroupedCiphertext2HandlesValidity => { + ks_lib::ExSplTokenConfidentialProofKind::BatchedGroupedCiphertext2HandlesValidity => { "batched_grouped_ciphertext_2_handles_validity" }, - kb_lib::ExSplTokenConfidentialProofKind::PercentageWithFee => "percentage_with_fee", - kb_lib::ExSplTokenConfidentialProofKind::BatchedRangeProofU64 => "batched_range_proof_u64", - kb_lib::ExSplTokenConfidentialProofKind::BatchedRangeProofU128 => { + ks_lib::ExSplTokenConfidentialProofKind::PercentageWithFee => "percentage_with_fee", + ks_lib::ExSplTokenConfidentialProofKind::BatchedRangeProofU64 => "batched_range_proof_u64", + ks_lib::ExSplTokenConfidentialProofKind::BatchedRangeProofU128 => { "batched_range_proof_u128" }, - kb_lib::ExSplTokenConfidentialProofKind::BatchedRangeProofU256 => { + ks_lib::ExSplTokenConfidentialProofKind::BatchedRangeProofU256 => { "batched_range_proof_u256" }, }; } fn proof_kind_to_zk_type( - kind: kb_lib::ExSplTokenConfidentialProofKind, -) -> kb_lib::ExSolanaCoreZkElGamalProofType { + kind: ks_lib::ExSplTokenConfidentialProofKind, +) -> ks_lib::ExSolanaCoreZkElGamalProofType { return match kind { - kb_lib::ExSplTokenConfidentialProofKind::PubkeyValidity => { - kb_lib::ExSolanaCoreZkElGamalProofType::PubkeyValidity + ks_lib::ExSplTokenConfidentialProofKind::PubkeyValidity => { + ks_lib::ExSolanaCoreZkElGamalProofType::PubkeyValidity }, - kb_lib::ExSplTokenConfidentialProofKind::ZeroCiphertext => { - kb_lib::ExSolanaCoreZkElGamalProofType::ZeroCiphertext + ks_lib::ExSplTokenConfidentialProofKind::ZeroCiphertext => { + ks_lib::ExSolanaCoreZkElGamalProofType::ZeroCiphertext }, - kb_lib::ExSplTokenConfidentialProofKind::CiphertextCommitmentEquality => { - kb_lib::ExSolanaCoreZkElGamalProofType::CiphertextCommitmentEquality + ks_lib::ExSplTokenConfidentialProofKind::CiphertextCommitmentEquality => { + ks_lib::ExSolanaCoreZkElGamalProofType::CiphertextCommitmentEquality }, - kb_lib::ExSplTokenConfidentialProofKind::CiphertextCiphertextEquality => { - kb_lib::ExSolanaCoreZkElGamalProofType::CiphertextCiphertextEquality + ks_lib::ExSplTokenConfidentialProofKind::CiphertextCiphertextEquality => { + ks_lib::ExSolanaCoreZkElGamalProofType::CiphertextCiphertextEquality }, - kb_lib::ExSplTokenConfidentialProofKind::BatchedGroupedCiphertext3HandlesValidity => { - kb_lib::ExSolanaCoreZkElGamalProofType::BatchedGroupedCiphertext3HandlesValidity + ks_lib::ExSplTokenConfidentialProofKind::BatchedGroupedCiphertext3HandlesValidity => { + ks_lib::ExSolanaCoreZkElGamalProofType::BatchedGroupedCiphertext3HandlesValidity }, - kb_lib::ExSplTokenConfidentialProofKind::BatchedGroupedCiphertext2HandlesValidity => { - kb_lib::ExSolanaCoreZkElGamalProofType::BatchedGroupedCiphertext2HandlesValidity + ks_lib::ExSplTokenConfidentialProofKind::BatchedGroupedCiphertext2HandlesValidity => { + ks_lib::ExSolanaCoreZkElGamalProofType::BatchedGroupedCiphertext2HandlesValidity }, - kb_lib::ExSplTokenConfidentialProofKind::PercentageWithFee => { - kb_lib::ExSolanaCoreZkElGamalProofType::PercentageWithCap + ks_lib::ExSplTokenConfidentialProofKind::PercentageWithFee => { + ks_lib::ExSolanaCoreZkElGamalProofType::PercentageWithCap }, - kb_lib::ExSplTokenConfidentialProofKind::BatchedRangeProofU64 => { - kb_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU64 + ks_lib::ExSplTokenConfidentialProofKind::BatchedRangeProofU64 => { + ks_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU64 }, - kb_lib::ExSplTokenConfidentialProofKind::BatchedRangeProofU128 => { - kb_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU128 + ks_lib::ExSplTokenConfidentialProofKind::BatchedRangeProofU128 => { + ks_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU128 }, - kb_lib::ExSplTokenConfidentialProofKind::BatchedRangeProofU256 => { - kb_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU256 + ks_lib::ExSplTokenConfidentialProofKind::BatchedRangeProofU256 => { + ks_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU256 }, }; } #[cfg(test)] mod tests { - fn pubkey(byte: u8) -> kb_lib::MdPubkey { - return kb_lib::MdPubkey(bs58::encode([byte; 32]).into_string()); + fn pubkey(byte: u8) -> ks_lib::MdPubkey { + return ks_lib::MdPubkey(bs58::encode([byte; 32]).into_string()); } fn context_report( - account: kb_lib::MdPubkey, - proof_type: kb_lib::ExSolanaCoreZkElGamalProofType, + account: ks_lib::MdPubkey, + proof_type: ks_lib::ExSolanaCoreZkElGamalProofType, ) -> crate::Token2022ProofContextReport { return crate::Token2022ProofContextReport { role: "proof".to_string(), @@ -268,15 +268,15 @@ mod tests { let request = crate::Token2022ProofOrchestrationRequest { operation_code: "spl.token_2022.confidential_transfer".to_string(), proofs: vec![ - kb_lib::ExSplTokenConfidentialProofReference { - kind: kb_lib::ExSplTokenConfidentialProofKind::CiphertextCommitmentEquality, - location: kb_lib::ExSplTokenConfidentialProofLocation::InstructionOffset { + ks_lib::ExSplTokenConfidentialProofReference { + kind: ks_lib::ExSplTokenConfidentialProofKind::CiphertextCommitmentEquality, + location: ks_lib::ExSplTokenConfidentialProofLocation::InstructionOffset { offset: 1, }, }, - kb_lib::ExSplTokenConfidentialProofReference { - kind: kb_lib::ExSplTokenConfidentialProofKind::BatchedRangeProofU128, - location: kb_lib::ExSplTokenConfidentialProofLocation::ContextStateAccount { + ks_lib::ExSplTokenConfidentialProofReference { + kind: ks_lib::ExSplTokenConfidentialProofKind::BatchedRangeProofU128, + location: ks_lib::ExSplTokenConfidentialProofLocation::ContextStateAccount { account: context.clone(), }, }, @@ -292,7 +292,7 @@ mod tests { context_slot: 100, proof_contexts: vec![context_report( context, - kb_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU128, + ks_lib::ExSolanaCoreZkElGamalProofType::BatchedRangeProofU128, )], }; let report = crate::orchestrate_token_2022_proofs(&request, &preflight) @@ -309,9 +309,9 @@ mod tests { let context = pubkey(2); let request = crate::Token2022ProofOrchestrationRequest { operation_code: "spl.token_2022.empty_confidential_account".to_string(), - proofs: vec![kb_lib::ExSplTokenConfidentialProofReference { - kind: kb_lib::ExSplTokenConfidentialProofKind::ZeroCiphertext, - location: kb_lib::ExSplTokenConfidentialProofLocation::ContextStateAccount { + proofs: vec![ks_lib::ExSplTokenConfidentialProofReference { + kind: ks_lib::ExSplTokenConfidentialProofKind::ZeroCiphertext, + location: ks_lib::ExSplTokenConfidentialProofLocation::ContextStateAccount { account: context.clone(), }, }], @@ -326,7 +326,7 @@ mod tests { context_slot: 100, proof_contexts: vec![context_report( context, - kb_lib::ExSolanaCoreZkElGamalProofType::ZeroCiphertext, + ks_lib::ExSolanaCoreZkElGamalProofType::ZeroCiphertext, )], }; let report = crate::orchestrate_token_2022_proofs(&request, &preflight) @@ -340,15 +340,15 @@ mod tests { let duplicate_offset = crate::Token2022ProofOrchestrationRequest { operation_code: "operation".to_string(), proofs: vec![ - kb_lib::ExSplTokenConfidentialProofReference { - kind: kb_lib::ExSplTokenConfidentialProofKind::ZeroCiphertext, - location: kb_lib::ExSplTokenConfidentialProofLocation::InstructionOffset { + ks_lib::ExSplTokenConfidentialProofReference { + kind: ks_lib::ExSplTokenConfidentialProofKind::ZeroCiphertext, + location: ks_lib::ExSplTokenConfidentialProofLocation::InstructionOffset { offset: 1, }, }, - kb_lib::ExSplTokenConfidentialProofReference { - kind: kb_lib::ExSplTokenConfidentialProofKind::BatchedRangeProofU64, - location: kb_lib::ExSplTokenConfidentialProofLocation::InstructionOffset { + ks_lib::ExSplTokenConfidentialProofReference { + kind: ks_lib::ExSplTokenConfidentialProofKind::BatchedRangeProofU64, + location: ks_lib::ExSplTokenConfidentialProofLocation::InstructionOffset { offset: 1, }, }, diff --git a/kb-pipeline/src/spl_token_2022_stateful.rs b/ks-pipeline/src/spl_token_2022_stateful.rs similarity index 85% rename from kb-pipeline/src/spl_token_2022_stateful.rs rename to ks-pipeline/src/spl_token_2022_stateful.rs index 805f7ad..6342159 100644 --- a/kb-pipeline/src/spl_token_2022_stateful.rs +++ b/ks-pipeline/src/spl_token_2022_stateful.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/spl_token_2022_stateful.rs -// version: 8 +// file: ks-pipeline/src/spl_token_2022_stateful.rs +// version: 9 //! Contextual Token-2022 account-state validation and materialization routing. @@ -19,9 +19,9 @@ pub struct Token2022StatefulReadRequest { /// Endpoint role used for the HTTP RPC request. pub query_role: std::string::String, /// Canonical account address. - pub account: kb_lib::MdPubkey, + pub account: ks_lib::MdPubkey, /// Expected Token-2022 base-state category. - pub kind: kb_lib::DcToken2022StateKind, + pub kind: ks_lib::DcToken2022StateKind, /// Optional minimum RPC context slot. pub min_context_slot: std::option::Option, /// Maximum decoded account bytes accepted from the endpoint. @@ -43,24 +43,24 @@ pub struct Token2022StatefulReadResult { /// Reads, validates, parses, and routes one bounded Token-2022 account snapshot. pub async fn read_token_2022_stateful_snapshot( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::Token2022StatefulReadRequest, -) -> kb_core::Result { +) -> ks_core::Result { if request.query_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "Token-2022 stateful read query_role must not be empty", )); } if request.max_data_bytes == 0 || request.max_data_bytes > crate::MAX_TOKEN_2022_STATEFUL_ACCOUNT_BYTES { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Token-2022 stateful read max_data_bytes must be between 1 and {}", crate::MAX_TOKEN_2022_STATEFUL_ACCOUNT_BYTES ))); } - let config = match kb_onchain_transport::GetAccountInfoConfig::new_with_data( - kb_onchain_transport::RpcCommitmentLevel::Confirmed, + let config = match ks_onchain_transport::GetAccountInfoConfig::new_with_data( + ks_onchain_transport::RpcCommitmentLevel::Confirmed, request.min_context_slot, request.max_data_bytes, ) { @@ -80,19 +80,19 @@ pub async fn read_token_2022_stateful_snapshot( /// Validates one complete RPC account response before Token-2022 parsing and routing. pub fn materialize_token_2022_account_info_result( request: &crate::Token2022StatefulReadRequest, - result: &kb_onchain_transport::AccountInfoResult, -) -> kb_core::Result { + result: &ks_onchain_transport::AccountInfoResult, +) -> ks_core::Result { if request.max_data_bytes == 0 || request.max_data_bytes > crate::MAX_TOKEN_2022_STATEFUL_ACCOUNT_BYTES { - return std::result::Result::Err(kb_core::Error::config(format!( + return std::result::Result::Err(ks_core::Error::config(format!( "Token-2022 stateful read max_data_bytes must be between 1 and {}", crate::MAX_TOKEN_2022_STATEFUL_ACCOUNT_BYTES ))); } if let std::option::Option::Some(min_context_slot) = request.min_context_slot { if result.context.slot < min_context_slot { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_stateful_context_slot_too_old", format!( "Token-2022 account context slot {} is below requested minimum {min_context_slot}", @@ -104,32 +104,32 @@ pub fn materialize_token_2022_account_info_result( let account = match result.account.as_ref() { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_stateful_account_missing", format!("Token-2022 account {} does not exist", request.account.0), )); }, }; if account.executable { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_stateful_account_executable", format!("Token-2022 state account {} must not be executable", request.account.0), )); } - if account.owner.0 != kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID { - return std::result::Result::Err(kb_core::Error::new( + if account.owner.0 != ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID { + return std::result::Result::Err(ks_core::Error::new( "token_2022_stateful_owner_mismatch", format!( "Token-2022 state account {} owner must be {}, got {}", request.account.0, - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, account.owner.0 ), )); } if account.space > request.max_data_bytes as u64 || account.data.len() > request.max_data_bytes { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_stateful_account_too_large", format!( "Token-2022 account {} reports {} bytes and returned {} bytes above limit {}", @@ -141,7 +141,7 @@ pub fn materialize_token_2022_account_info_result( )); } if account.space != account.data.len() as u64 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_stateful_account_data_incomplete", format!( "Token-2022 account {} reports {} bytes but returned {} decoded bytes", @@ -151,13 +151,13 @@ pub fn materialize_token_2022_account_info_result( ), )); } - let state = match kb_lib::decoder_spl_token_2022_parse_token_2022_state( + let state = match ks_lib::decoder_spl_token_2022_parse_token_2022_state( request.kind, account.data.as_slice(), ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_stateful_parse_failed", error, )); @@ -171,7 +171,7 @@ pub fn materialize_token_2022_account_info_result( ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "token_2022_stateful_projection_failed", error, )); @@ -196,7 +196,7 @@ pub struct Token2022StatefulSnapshotBundle { /// Ordered published or future extension names retained by the parser. pub extension_names: std::vec::Vec, /// Processor-owned projections routed without duplicate ownership. - pub outputs: std::vec::Vec, + pub outputs: std::vec::Vec, } /// Parse, contextually validate, and materialize one bounded Token-2022 account snapshot. @@ -204,16 +204,16 @@ pub fn materialize_token_2022_stateful_snapshot( account_key: &str, owner_program_id: &str, slot: u64, - kind: kb_lib::DcToken2022StateKind, + kind: ks_lib::DcToken2022StateKind, data: &[u8], ) -> std::result::Result { - if owner_program_id != kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID { + if owner_program_id != ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID { return std::result::Result::Err(format!( "Token-2022 state snapshot owner must be {}, got {owner_program_id}", - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID )); } - let state = match kb_lib::decoder_spl_token_2022_parse_token_2022_state(kind, data) { + let state = match ks_lib::decoder_spl_token_2022_parse_token_2022_state(kind, data) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; @@ -229,7 +229,7 @@ pub fn materialize_token_2022_stateful_snapshot( pub fn materialize_parsed_token_2022_stateful_snapshot( account_key: &str, slot: u64, - state: &kb_lib::DcToken2022State, + state: &ks_lib::DcToken2022State, ) -> std::result::Result { return crate::materialize_parsed_token_2022_stateful_snapshot_with_context( account_key, @@ -243,7 +243,7 @@ pub fn materialize_parsed_token_2022_stateful_snapshot( pub fn materialize_parsed_token_2022_stateful_snapshot_with_context( account_key: &str, slot: u64, - state: &kb_lib::DcToken2022State, + state: &ks_lib::DcToken2022State, context: &crate::Token2022StatefulContext, ) -> std::result::Result { if account_key.trim().is_empty() { @@ -273,7 +273,7 @@ pub fn materialize_parsed_token_2022_stateful_snapshot_with_context( std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), } - let account_output = match kb_lib::materializer_token_materialize_token_2022_state_snapshot( + let account_output = match ks_lib::materializer_token_materialize_token_2022_state_snapshot( account_key, slot, state, @@ -282,8 +282,8 @@ pub fn materialize_parsed_token_2022_stateful_snapshot_with_context( std::result::Result::Err(error) => return std::result::Result::Err(error), }; let mut outputs = std::vec![account_output]; - if state.kind == kb_lib::DcToken2022StateKind::Mint { - let metadata_outputs = match kb_lib::materializer_metadata_materialize_token_2022_snapshot( + if state.kind == ks_lib::DcToken2022StateKind::Mint { + let metadata_outputs = match ks_lib::materializer_metadata_materialize_token_2022_snapshot( account_key, slot, state, @@ -293,7 +293,7 @@ pub fn materialize_parsed_token_2022_stateful_snapshot_with_context( }; outputs.extend(metadata_outputs); } - let fee_outputs = match kb_lib::materializer_fees_materialize_token_2022_state_snapshots( + let fee_outputs = match ks_lib::materializer_fees_materialize_token_2022_state_snapshots( account_key, slot, state, @@ -302,7 +302,7 @@ pub fn materialize_parsed_token_2022_stateful_snapshot_with_context( std::result::Result::Err(error) => return std::result::Result::Err(error), }; outputs.extend(fee_outputs); - let admin_outputs = match kb_lib::materializer_admin_materialize_token_2022_state_snapshots( + let admin_outputs = match ks_lib::materializer_admin_materialize_token_2022_state_snapshots( account_key, slot, state, @@ -312,9 +312,9 @@ pub fn materialize_parsed_token_2022_stateful_snapshot_with_context( }; outputs.extend(admin_outputs); let state_kind = match state.kind { - kb_lib::DcToken2022StateKind::Mint => "mint", - kb_lib::DcToken2022StateKind::Account => "account", - kb_lib::DcToken2022StateKind::Multisig => "multisig", + ks_lib::DcToken2022StateKind::Mint => "mint", + ks_lib::DcToken2022StateKind::Account => "account", + ks_lib::DcToken2022StateKind::Multisig => "multisig", }; return std::result::Result::Ok(crate::Token2022StatefulSnapshotBundle { account_key: account_key.to_string(), @@ -331,7 +331,7 @@ pub fn materialize_parsed_token_2022_stateful_snapshot_with_context( fn validate_embedded_mint_identity( account_key: &str, - state: &kb_lib::DcToken2022State, + state: &ks_lib::DcToken2022State, ) -> std::result::Result<(), String> { for entry in &state.extensions { if entry.extension_name != "token_metadata" @@ -361,7 +361,7 @@ fn validate_embedded_mint_identity( } fn validate_group_member_identity( - state: &kb_lib::DcToken2022State, + state: &ks_lib::DcToken2022State, context: &crate::Token2022StatefulContext, ) -> std::result::Result<(), String> { for entry in &state.extensions { @@ -402,14 +402,14 @@ mod tests { return bs58::encode([byte; 32]).into_string(); } - fn mint_state(account_key: &str) -> kb_lib::DcToken2022State { - return kb_lib::DcToken2022State { - kind: kb_lib::DcToken2022StateKind::Mint, + fn mint_state(account_key: &str) -> ks_lib::DcToken2022State { + return ks_lib::DcToken2022State { + kind: ks_lib::DcToken2022StateKind::Mint, base_fields: serde_json::json!({"supply":"1","decimals":0,"initialized":true}), base_hex: "00".repeat(82), account_type: std::option::Option::Some(1), extensions: std::vec![ - kb_lib::DcToken2022TlvEntry { + ks_lib::DcToken2022TlvEntry { extension_type: 19, extension_name: "token_metadata", value_hex: "01".to_string(), @@ -420,7 +420,7 @@ mod tests { "uri": "https://example.invalid/token.json" }), }, - kb_lib::DcToken2022TlvEntry { + ks_lib::DcToken2022TlvEntry { extension_type: 20, extension_name: "token_group", value_hex: "02".to_string(), @@ -479,9 +479,9 @@ mod tests { let data = [0u8; 82]; let wrong_owner = crate::materialize_token_2022_stateful_snapshot( account_key.as_str(), - kb_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, 1, - kb_lib::DcToken2022StateKind::Mint, + ks_lib::DcToken2022StateKind::Mint, &data, ); assert!(wrong_owner.is_err()); @@ -494,8 +494,8 @@ mod tests { #[test] fn account_snapshot_has_no_metadata_projection() { let account_key = account_key(11); - let state = kb_lib::DcToken2022State { - kind: kb_lib::DcToken2022StateKind::Account, + let state = ks_lib::DcToken2022State { + kind: ks_lib::DcToken2022StateKind::Account, base_fields: serde_json::json!({"amount":"0","state":"initialized"}), base_hex: "00".repeat(165), account_type: std::option::Option::None, @@ -512,12 +512,12 @@ mod tests { fn group_member_requires_and_matches_external_group_identity() { let account_address = account_key(12); let group_address = account_key(13); - let state = kb_lib::DcToken2022State { - kind: kb_lib::DcToken2022StateKind::Mint, + let state = ks_lib::DcToken2022State { + kind: ks_lib::DcToken2022StateKind::Mint, base_fields: serde_json::json!({"supply":"1","decimals":0,"initialized":true}), base_hex: "00".repeat(82), account_type: std::option::Option::Some(1), - extensions: std::vec![kb_lib::DcToken2022TlvEntry { + extensions: std::vec![ks_lib::DcToken2022TlvEntry { extension_type: 23, extension_name: "token_group_member", value_hex: "03".to_string(), @@ -561,12 +561,12 @@ mod tests { #[test] fn mint_and_account_fee_extensions_route_to_the_fee_owner_once() { let mint_address = account_key(15); - let mint = kb_lib::DcToken2022State { - kind: kb_lib::DcToken2022StateKind::Mint, + let mint = ks_lib::DcToken2022State { + kind: ks_lib::DcToken2022StateKind::Mint, base_fields: serde_json::json!({"supply":"1","decimals":0,"initialized":true}), base_hex: "00".repeat(82), account_type: std::option::Option::Some(1), - extensions: std::vec![kb_lib::DcToken2022TlvEntry { + extensions: std::vec![ks_lib::DcToken2022TlvEntry { extension_type: 1, extension_name: "transfer_fee_config", value_hex: "01".to_string(), @@ -590,12 +590,12 @@ mod tests { std::result::Result::Ok(serde_json::json!("materializer.fees")) ); let account_address = account_key(16); - let account = kb_lib::DcToken2022State { - kind: kb_lib::DcToken2022StateKind::Account, + let account = ks_lib::DcToken2022State { + kind: ks_lib::DcToken2022StateKind::Account, base_fields: serde_json::json!({"amount":"0","state":"initialized"}), base_hex: "00".repeat(165), account_type: std::option::Option::Some(2), - extensions: std::vec![kb_lib::DcToken2022TlvEntry { + extensions: std::vec![ks_lib::DcToken2022TlvEntry { extension_type: 17, extension_name: "confidential_transfer_fee_amount", value_hex: "02".to_string(), @@ -624,7 +624,7 @@ mod tests { fn mint_admin_extensions_route_to_the_admin_owner_once() { let account_key = account_key(12); let mut state = mint_state(account_key.as_str()); - state.extensions.push(kb_lib::DcToken2022TlvEntry { + state.extensions.push(ks_lib::DcToken2022TlvEntry { extension_type: 6, extension_name: "default_account_state", value_hex: "02".to_string(), @@ -659,20 +659,20 @@ mod tests { let account = account_key(21); let request = crate::Token2022StatefulReadRequest { query_role: "execution".to_string(), - account: kb_lib::MdPubkey(account.clone()), - kind: kb_lib::DcToken2022StateKind::Mint, + account: ks_lib::MdPubkey(account.clone()), + kind: ks_lib::DcToken2022StateKind::Mint, min_context_slot: std::option::Option::Some(40), max_data_bytes: 82, context: crate::Token2022StatefulContext::default(), }; - let result = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + let result = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 41, api_version: std::option::Option::None, }, - account: std::option::Option::Some(kb_onchain_transport::AccountInfoValue { + account: std::option::Option::Some(ks_onchain_transport::AccountInfoValue { lamports: 1, - owner: kb_lib::MdProgramId(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()), + owner: ks_lib::MdProgramId(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()), executable: false, rent_epoch: 0, space: 82, @@ -695,22 +695,22 @@ mod tests { let account = account_key(22); let request = crate::Token2022StatefulReadRequest { query_role: "execution".to_string(), - account: kb_lib::MdPubkey(account), - kind: kb_lib::DcToken2022StateKind::Mint, + account: ks_lib::MdPubkey(account), + kind: ks_lib::DcToken2022StateKind::Mint, min_context_slot: std::option::Option::Some(50), max_data_bytes: 82, context: crate::Token2022StatefulContext::default(), }; - let base = kb_onchain_transport::AccountInfoValue { + let base = ks_onchain_transport::AccountInfoValue { lamports: 1, - owner: kb_lib::MdProgramId(kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()), + owner: ks_lib::MdProgramId(ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID.to_string()), executable: false, rent_epoch: 0, space: 82, data: std::vec![0; 82], }; - let stale = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + let stale = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 49, api_version: std::option::Option::None, }, @@ -718,9 +718,9 @@ mod tests { }; assert!(crate::materialize_token_2022_account_info_result(&request, &stale).is_err()); let mut foreign = base.clone(); - foreign.owner = kb_lib::MdProgramId(kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()); - let foreign = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + foreign.owner = ks_lib::MdProgramId(ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()); + let foreign = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 50, api_version: std::option::Option::None, }, @@ -729,8 +729,8 @@ mod tests { assert!(crate::materialize_token_2022_account_info_result(&request, &foreign).is_err()); let mut executable = base.clone(); executable.executable = true; - let executable = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + let executable = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 50, api_version: std::option::Option::None, }, @@ -739,8 +739,8 @@ mod tests { assert!(crate::materialize_token_2022_account_info_result(&request, &executable).is_err()); let mut incomplete = base; incomplete.data.pop(); - let incomplete = kb_onchain_transport::AccountInfoResult { - context: kb_onchain_transport::RpcResponseContext { + let incomplete = ks_onchain_transport::AccountInfoResult { + context: ks_onchain_transport::RpcResponseContext { slot: 50, api_version: std::option::Option::None, }, diff --git a/kb-pipeline/src/spl_token_stateful.rs b/ks-pipeline/src/spl_token_stateful.rs similarity index 85% rename from kb-pipeline/src/spl_token_stateful.rs rename to ks-pipeline/src/spl_token_stateful.rs index f1f06d7..90cc159 100644 --- a/kb-pipeline/src/spl_token_stateful.rs +++ b/ks-pipeline/src/spl_token_stateful.rs @@ -1,5 +1,5 @@ -// file: kb-pipeline/src/spl_token_stateful.rs -// version: 2 +// file: ks-pipeline/src/spl_token_stateful.rs +// version: 3 //! Stateful Localnet and Devnet readiness checks for classic SPL Token operations. @@ -44,16 +44,16 @@ pub struct SplTokenStatefulReadinessRequest { /// HTTP endpoint role used for all state reads. pub query_role: std::string::String, /// Expected Localnet or Devnet cluster. - pub cluster: kb_lib::ExApiExecutionCluster, + pub cluster: ks_lib::ExApiExecutionCluster, /// Typed operation whose external state must be inspected. - pub operation: kb_lib::ExSplClassicTokenOperation, + pub operation: ks_lib::ExSplClassicTokenOperation, } /// Complete classic SPL Token stateful readiness report. #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] pub struct SplTokenStatefulReadinessReport { /// Expected cluster. - pub cluster: kb_lib::ExApiExecutionCluster, + pub cluster: ks_lib::ExApiExecutionCluster, /// Stable top-level operation code. pub operation_code: std::string::String, /// Aggregate readiness status. @@ -97,23 +97,23 @@ struct MultisigState { type AccountCache = std::collections::BTreeMap< std::string::String, - std::option::Option, + std::option::Option, >; /// Inspects Localnet or Devnet Token state required before simulation. pub async fn inspect_spl_token_stateful_readiness( - pool: &kb_onchain_transport::HttpEndpointPool, + pool: &ks_onchain_transport::HttpEndpointPool, request: &crate::SplTokenStatefulReadinessRequest, -) -> kb_core::Result { +) -> ks_core::Result { if request.query_role.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::config( + return std::result::Result::Err(ks_core::Error::config( "SPL Token stateful readiness query_role must not be empty", )); } match request.cluster { - kb_lib::ExApiExecutionCluster::Localnet | kb_lib::ExApiExecutionCluster::Devnet => {}, - kb_lib::ExApiExecutionCluster::Testnet | kb_lib::ExApiExecutionCluster::Mainnet => { - return std::result::Result::Err(kb_core::Error::new( + ks_lib::ExApiExecutionCluster::Localnet | ks_lib::ExApiExecutionCluster::Devnet => {}, + ks_lib::ExApiExecutionCluster::Testnet | ks_lib::ExApiExecutionCluster::Mainnet => { + return std::result::Result::Err(ks_core::Error::new( "spl_token_stateful_cluster_unsupported", "SPL Token stateful readiness is restricted to Localnet and Devnet", )); @@ -131,7 +131,7 @@ pub async fn inspect_spl_token_stateful_readiness( std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), }; - let config = match kb_onchain_transport::GetAccountInfoConfig::confirmed_with_data(MULTISIG_LEN) + let config = match ks_onchain_transport::GetAccountInfoConfig::confirmed_with_data(MULTISIG_LEN) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -169,7 +169,7 @@ pub async fn inspect_spl_token_stateful_readiness( .get_minimum_balance_for_rent_exemption_for_role( request.query_role.as_str(), data_length as u64, - &kb_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), + &ks_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), ) .await; let rent = match rent { @@ -197,7 +197,7 @@ pub async fn inspect_spl_token_stateful_readiness( .get_minimum_balance_for_rent_exemption_for_role( request.query_role.as_str(), account.space, - &kb_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), + &ks_onchain_transport::GetMinimumBalanceForRentExemptionConfig::confirmed(), ) .await; let rent = match rent { @@ -218,10 +218,10 @@ pub async fn inspect_spl_token_stateful_readiness( } } match &request.operation { - kb_lib::ExSplClassicTokenOperation::Instruction { value } => { + ks_lib::ExSplClassicTokenOperation::Instruction { value } => { inspect_single(&mut report, &cache, value); }, - kb_lib::ExSplClassicTokenOperation::Batch { instructions } => { + ks_lib::ExSplClassicTokenOperation::Batch { instructions } => { for (index, value) in instructions.iter().enumerate() { push_fact( &mut report, @@ -241,34 +241,34 @@ pub async fn inspect_spl_token_stateful_readiness( } fn validate_cluster( - expected: kb_lib::ExApiExecutionCluster, - genesis: &kb_onchain_transport::GenesisHashResult, -) -> kb_core::Result<()> { + expected: ks_lib::ExApiExecutionCluster, + genesis: &ks_onchain_transport::GenesisHashResult, +) -> ks_core::Result<()> { return match expected { - kb_lib::ExApiExecutionCluster::Devnet => { + ks_lib::ExApiExecutionCluster::Devnet => { if genesis.classified_cluster - == std::option::Option::Some(kb_lib::ExApiExecutionCluster::Devnet) + == std::option::Option::Some(ks_lib::ExApiExecutionCluster::Devnet) { std::result::Result::Ok(()) } else { - std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(ks_core::Error::new( "spl_token_stateful_devnet_genesis_mismatch", "SPL Token Devnet readiness requires the official Devnet genesis hash", )) } }, - kb_lib::ExApiExecutionCluster::Localnet => { + ks_lib::ExApiExecutionCluster::Localnet => { if genesis.classified_cluster.is_none() { std::result::Result::Ok(()) } else { - std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(ks_core::Error::new( "spl_token_stateful_localnet_public_cluster", "Localnet readiness refuses endpoints classified as a public cluster", )) } }, - kb_lib::ExApiExecutionCluster::Testnet | kb_lib::ExApiExecutionCluster::Mainnet => { - std::result::Result::Err(kb_core::Error::new( + ks_lib::ExApiExecutionCluster::Testnet | ks_lib::ExApiExecutionCluster::Mainnet => { + std::result::Result::Err(ks_core::Error::new( "spl_token_stateful_cluster_unsupported", "SPL Token stateful readiness is restricted to Localnet and Devnet", )) @@ -277,21 +277,21 @@ fn validate_cluster( } fn operation_addresses( - operation: &kb_lib::ExSplClassicTokenOperation, -) -> kb_core::Result> { + operation: &ks_lib::ExSplClassicTokenOperation, +) -> ks_core::Result> { let mut addresses = std::vec::Vec::new(); match operation { - kb_lib::ExSplClassicTokenOperation::Instruction { value } => { + ks_lib::ExSplClassicTokenOperation::Instruction { value } => { collect_single_addresses(&mut addresses, value); }, - kb_lib::ExSplClassicTokenOperation::Batch { instructions } => { + ks_lib::ExSplClassicTokenOperation::Batch { instructions } => { for value in instructions { collect_single_addresses(&mut addresses, value); } }, } if addresses.len() > MAX_STATE_ACCOUNTS { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "spl_token_stateful_account_limit", format!("SPL Token stateful readiness exceeds {MAX_STATE_ACCOUNTS} unique accounts"), )); @@ -300,24 +300,24 @@ fn operation_addresses( } fn initialization_accounts( - operation: &kb_lib::ExSplClassicTokenOperation, -) -> std::vec::Vec<(kb_lib::MdPubkey, usize)> { + operation: &ks_lib::ExSplClassicTokenOperation, +) -> std::vec::Vec<(ks_lib::MdPubkey, usize)> { let mut values = std::vec::Vec::new(); - let instructions: std::vec::Vec<&kb_lib::ExSplClassicTokenSingleOperation> = match operation { - kb_lib::ExSplClassicTokenOperation::Instruction { value } => { + let instructions: std::vec::Vec<&ks_lib::ExSplClassicTokenSingleOperation> = match operation { + ks_lib::ExSplClassicTokenOperation::Instruction { value } => { std::vec![value] }, - kb_lib::ExSplClassicTokenOperation::Batch { instructions } => instructions.iter().collect(), + ks_lib::ExSplClassicTokenOperation::Batch { instructions } => instructions.iter().collect(), }; for operation in instructions { let candidate = match operation { - kb_lib::ExSplClassicTokenSingleOperation::InitializeMint { mint, .. } => { + ks_lib::ExSplClassicTokenSingleOperation::InitializeMint { mint, .. } => { std::option::Option::Some((mint.clone(), MINT_LEN)) }, - kb_lib::ExSplClassicTokenSingleOperation::InitializeAccount { account, .. } => { + ks_lib::ExSplClassicTokenSingleOperation::InitializeAccount { account, .. } => { std::option::Option::Some((account.clone(), TOKEN_ACCOUNT_LEN)) }, - kb_lib::ExSplClassicTokenSingleOperation::InitializeMultisig { multisig, .. } => { + ks_lib::ExSplClassicTokenSingleOperation::InitializeMultisig { multisig, .. } => { std::option::Option::Some((multisig.clone(), MULTISIG_LEN)) }, _ => std::option::Option::None, @@ -335,17 +335,17 @@ fn initialization_accounts( } fn withdraw_excess_accounts( - operation: &kb_lib::ExSplClassicTokenOperation, -) -> std::vec::Vec { - let instructions: std::vec::Vec<&kb_lib::ExSplClassicTokenSingleOperation> = match operation { - kb_lib::ExSplClassicTokenOperation::Instruction { value } => { + operation: &ks_lib::ExSplClassicTokenOperation, +) -> std::vec::Vec { + let instructions: std::vec::Vec<&ks_lib::ExSplClassicTokenSingleOperation> = match operation { + ks_lib::ExSplClassicTokenOperation::Instruction { value } => { std::vec![value] }, - kb_lib::ExSplClassicTokenOperation::Batch { instructions } => instructions.iter().collect(), + ks_lib::ExSplClassicTokenOperation::Batch { instructions } => instructions.iter().collect(), }; let mut values = std::vec::Vec::new(); for operation in instructions { - if let kb_lib::ExSplClassicTokenSingleOperation::WithdrawExcessLamports { + if let ks_lib::ExSplClassicTokenSingleOperation::WithdrawExcessLamports { account, .. } = operation { @@ -357,15 +357,15 @@ fn withdraw_excess_accounts( return values; } -fn add_address(addresses: &mut std::vec::Vec, value: &kb_lib::MdPubkey) { +fn add_address(addresses: &mut std::vec::Vec, value: &ks_lib::MdPubkey) { if !addresses.iter().any(|existing| return existing == value) { addresses.push(value.clone()); } } fn add_authority( - addresses: &mut std::vec::Vec, - authority: &kb_lib::ExSplClassicTokenAuthority, + addresses: &mut std::vec::Vec, + authority: &ks_lib::ExSplClassicTokenAuthority, ) { if !authority.multisig_signers.is_empty() { add_address(addresses, &authority.authority); @@ -373,24 +373,24 @@ fn add_authority( } fn collect_single_addresses( - addresses: &mut std::vec::Vec, - operation: &kb_lib::ExSplClassicTokenSingleOperation, + addresses: &mut std::vec::Vec, + operation: &ks_lib::ExSplClassicTokenSingleOperation, ) { match operation { - kb_lib::ExSplClassicTokenSingleOperation::InitializeMint { mint, .. } - | kb_lib::ExSplClassicTokenSingleOperation::GetAccountDataSize { mint } - | kb_lib::ExSplClassicTokenSingleOperation::AmountToUiAmount { mint, .. } - | kb_lib::ExSplClassicTokenSingleOperation::UiAmountToAmount { mint, .. } => { + ks_lib::ExSplClassicTokenSingleOperation::InitializeMint { mint, .. } + | ks_lib::ExSplClassicTokenSingleOperation::GetAccountDataSize { mint } + | ks_lib::ExSplClassicTokenSingleOperation::AmountToUiAmount { mint, .. } + | ks_lib::ExSplClassicTokenSingleOperation::UiAmountToAmount { mint, .. } => { add_address(addresses, mint); }, - kb_lib::ExSplClassicTokenSingleOperation::InitializeAccount { account, mint, .. } => { + ks_lib::ExSplClassicTokenSingleOperation::InitializeAccount { account, mint, .. } => { add_address(addresses, account); add_address(addresses, mint); }, - kb_lib::ExSplClassicTokenSingleOperation::InitializeMultisig { multisig, .. } => { + ks_lib::ExSplClassicTokenSingleOperation::InitializeMultisig { multisig, .. } => { add_address(addresses, multisig); }, - kb_lib::ExSplClassicTokenSingleOperation::Transfer { + ks_lib::ExSplClassicTokenSingleOperation::Transfer { source, destination, authority, @@ -400,21 +400,21 @@ fn collect_single_addresses( add_address(addresses, destination); add_authority(addresses, authority); }, - kb_lib::ExSplClassicTokenSingleOperation::Approve { source, authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::Revoke { source, authority } => { + ks_lib::ExSplClassicTokenSingleOperation::Approve { source, authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::Revoke { source, authority } => { add_address(addresses, source); add_authority(addresses, authority); }, - kb_lib::ExSplClassicTokenSingleOperation::SetAuthority { + ks_lib::ExSplClassicTokenSingleOperation::SetAuthority { owned, current_authority, .. } => { add_address(addresses, owned); add_authority(addresses, current_authority); }, - kb_lib::ExSplClassicTokenSingleOperation::MintTo { + ks_lib::ExSplClassicTokenSingleOperation::MintTo { mint, destination, authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::MintToChecked { + | ks_lib::ExSplClassicTokenSingleOperation::MintToChecked { mint, destination, authority, @@ -424,17 +424,17 @@ fn collect_single_addresses( add_address(addresses, destination); add_authority(addresses, authority); }, - kb_lib::ExSplClassicTokenSingleOperation::Burn { source, mint, authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::BurnChecked { + ks_lib::ExSplClassicTokenSingleOperation::Burn { source, mint, authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::BurnChecked { source, mint, authority, .. } => { add_address(addresses, source); add_address(addresses, mint); add_authority(addresses, authority); }, - kb_lib::ExSplClassicTokenSingleOperation::CloseAccount { account, authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::UnwrapLamports { account, authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::WithdrawExcessLamports { + ks_lib::ExSplClassicTokenSingleOperation::CloseAccount { account, authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::UnwrapLamports { account, authority, .. } + | ks_lib::ExSplClassicTokenSingleOperation::WithdrawExcessLamports { account, authority, .. @@ -442,20 +442,20 @@ fn collect_single_addresses( add_address(addresses, account); add_authority(addresses, authority); }, - kb_lib::ExSplClassicTokenSingleOperation::FreezeAccount { account, mint, authority } - | kb_lib::ExSplClassicTokenSingleOperation::ThawAccount { account, mint, authority } => { + ks_lib::ExSplClassicTokenSingleOperation::FreezeAccount { account, mint, authority } + | ks_lib::ExSplClassicTokenSingleOperation::ThawAccount { account, mint, authority } => { add_address(addresses, account); add_address(addresses, mint); add_authority(addresses, authority); }, - kb_lib::ExSplClassicTokenSingleOperation::TransferChecked { + ks_lib::ExSplClassicTokenSingleOperation::TransferChecked { source, mint, destination, authority, .. } - | kb_lib::ExSplClassicTokenSingleOperation::ApproveChecked { + | ks_lib::ExSplClassicTokenSingleOperation::ApproveChecked { source, mint, delegate: destination, @@ -464,14 +464,14 @@ fn collect_single_addresses( } => { add_address(addresses, source); add_address(addresses, mint); - if matches!(operation, kb_lib::ExSplClassicTokenSingleOperation::TransferChecked { .. }) + if matches!(operation, ks_lib::ExSplClassicTokenSingleOperation::TransferChecked { .. }) { add_address(addresses, destination); } add_authority(addresses, authority); }, - kb_lib::ExSplClassicTokenSingleOperation::SyncNative { account, .. } - | kb_lib::ExSplClassicTokenSingleOperation::InitializeImmutableOwner { account } => { + ks_lib::ExSplClassicTokenSingleOperation::SyncNative { account, .. } + | ks_lib::ExSplClassicTokenSingleOperation::InitializeImmutableOwner { account } => { add_address(addresses, account); }, } @@ -480,10 +480,10 @@ fn collect_single_addresses( fn inspect_single( report: &mut crate::SplTokenStatefulReadinessReport, cache: &AccountCache, - operation: &kb_lib::ExSplClassicTokenSingleOperation, + operation: &ks_lib::ExSplClassicTokenSingleOperation, ) { match operation { - kb_lib::ExSplClassicTokenSingleOperation::InitializeMint { mint, .. } => { + ks_lib::ExSplClassicTokenSingleOperation::InitializeMint { mint, .. } => { let state = mint_state(report, cache, mint); if let std::option::Option::Some(state) = state { push_check( @@ -494,7 +494,7 @@ fn inspect_single( ); } }, - kb_lib::ExSplClassicTokenSingleOperation::InitializeAccount { account, mint, .. } => { + ks_lib::ExSplClassicTokenSingleOperation::InitializeAccount { account, mint, .. } => { let state = token_state(report, cache, account); if let std::option::Option::Some(state) = state { push_check( @@ -507,7 +507,7 @@ fn inspect_single( let mint_state = mint_state(report, cache, mint); check_mint_initialized(report, mint_state.as_ref()); }, - kb_lib::ExSplClassicTokenSingleOperation::InitializeMultisig { multisig, .. } => { + ks_lib::ExSplClassicTokenSingleOperation::InitializeMultisig { multisig, .. } => { let state = multisig_state(report, cache, multisig); if let std::option::Option::Some(state) = state { push_check( @@ -518,7 +518,7 @@ fn inspect_single( ); } }, - kb_lib::ExSplClassicTokenSingleOperation::Transfer { + ks_lib::ExSplClassicTokenSingleOperation::Transfer { source, destination, authority, @@ -535,7 +535,7 @@ fn inspect_single( std::option::Option::None, ); }, - kb_lib::ExSplClassicTokenSingleOperation::TransferChecked { + ks_lib::ExSplClassicTokenSingleOperation::TransferChecked { source, mint, destination, @@ -554,10 +554,10 @@ fn inspect_single( std::option::Option::Some(*decimals), ); }, - kb_lib::ExSplClassicTokenSingleOperation::Approve { source, authority, amount, .. } => { + ks_lib::ExSplClassicTokenSingleOperation::Approve { source, authority, amount, .. } => { inspect_owner_amount(report, cache, source, authority, amount, false); }, - kb_lib::ExSplClassicTokenSingleOperation::ApproveChecked { + ks_lib::ExSplClassicTokenSingleOperation::ApproveChecked { source, mint, authority, @@ -568,7 +568,7 @@ fn inspect_single( inspect_owner_amount(report, cache, source, authority, amount, false); inspect_checked_mint(report, cache, source, mint, *decimals); }, - kb_lib::ExSplClassicTokenSingleOperation::Revoke { source, authority } => { + ks_lib::ExSplClassicTokenSingleOperation::Revoke { source, authority } => { let state = token_state(report, cache, source); if let std::option::Option::Some(state) = state { check_authority( @@ -585,13 +585,13 @@ fn inspect_single( ); } }, - kb_lib::ExSplClassicTokenSingleOperation::MintTo { + ks_lib::ExSplClassicTokenSingleOperation::MintTo { mint, destination, authority, amount, } - | kb_lib::ExSplClassicTokenSingleOperation::MintToChecked { + | ks_lib::ExSplClassicTokenSingleOperation::MintToChecked { mint, destination, authority, @@ -623,7 +623,7 @@ fn inspect_single( ); } } - if let kb_lib::ExSplClassicTokenSingleOperation::MintToChecked { decimals, .. } = + if let ks_lib::ExSplClassicTokenSingleOperation::MintToChecked { decimals, .. } = operation { if let std::option::Option::Some(mint_value) = mint_state_quiet(cache, mint) { @@ -636,8 +636,8 @@ fn inspect_single( } } }, - kb_lib::ExSplClassicTokenSingleOperation::Burn { source, mint, authority, amount } - | kb_lib::ExSplClassicTokenSingleOperation::BurnChecked { + ks_lib::ExSplClassicTokenSingleOperation::Burn { source, mint, authority, amount } + | ks_lib::ExSplClassicTokenSingleOperation::BurnChecked { source, mint, authority, @@ -656,13 +656,13 @@ fn inspect_single( "mint supply must cover burned amount", ); } - if let kb_lib::ExSplClassicTokenSingleOperation::BurnChecked { decimals, .. } = + if let ks_lib::ExSplClassicTokenSingleOperation::BurnChecked { decimals, .. } = operation { inspect_checked_mint(report, cache, source, mint, *decimals); } }, - kb_lib::ExSplClassicTokenSingleOperation::CloseAccount { account, authority, .. } => { + ks_lib::ExSplClassicTokenSingleOperation::CloseAccount { account, authority, .. } => { let state = token_state(report, cache, account); if let std::option::Option::Some(state) = state { let expected = match state.close_authority.as_deref() { @@ -678,13 +678,13 @@ fn inspect_single( ); } }, - kb_lib::ExSplClassicTokenSingleOperation::FreezeAccount { account, mint, authority } => { + ks_lib::ExSplClassicTokenSingleOperation::FreezeAccount { account, mint, authority } => { inspect_freeze_thaw(report, cache, account, mint, authority, 1); }, - kb_lib::ExSplClassicTokenSingleOperation::ThawAccount { account, mint, authority } => { + ks_lib::ExSplClassicTokenSingleOperation::ThawAccount { account, mint, authority } => { inspect_freeze_thaw(report, cache, account, mint, authority, 2); }, - kb_lib::ExSplClassicTokenSingleOperation::SyncNative { account, .. } => { + ks_lib::ExSplClassicTokenSingleOperation::SyncNative { account, .. } => { let state = token_state(report, cache, account); if let std::option::Option::Some(state) = state { push_check( @@ -695,13 +695,13 @@ fn inspect_single( ); } }, - kb_lib::ExSplClassicTokenSingleOperation::GetAccountDataSize { mint } - | kb_lib::ExSplClassicTokenSingleOperation::AmountToUiAmount { mint, .. } - | kb_lib::ExSplClassicTokenSingleOperation::UiAmountToAmount { mint, .. } => { + ks_lib::ExSplClassicTokenSingleOperation::GetAccountDataSize { mint } + | ks_lib::ExSplClassicTokenSingleOperation::AmountToUiAmount { mint, .. } + | ks_lib::ExSplClassicTokenSingleOperation::UiAmountToAmount { mint, .. } => { let state = mint_state(report, cache, mint); check_mint_initialized(report, state.as_ref()); }, - kb_lib::ExSplClassicTokenSingleOperation::InitializeImmutableOwner { account } => { + ks_lib::ExSplClassicTokenSingleOperation::InitializeImmutableOwner { account } => { let state = token_state(report, cache, account); if let std::option::Option::Some(state) = state { push_check( @@ -712,7 +712,7 @@ fn inspect_single( ); } }, - kb_lib::ExSplClassicTokenSingleOperation::UnwrapLamports { + ks_lib::ExSplClassicTokenSingleOperation::UnwrapLamports { account, authority, amount_lamports, @@ -743,7 +743,7 @@ fn inspect_single( } } }, - kb_lib::ExSplClassicTokenSingleOperation::WithdrawExcessLamports { + ks_lib::ExSplClassicTokenSingleOperation::WithdrawExcessLamports { account, authority, .. @@ -785,7 +785,7 @@ fn inspect_single( } } }, - kb_lib::ExSplClassicTokenSingleOperation::SetAuthority { + ks_lib::ExSplClassicTokenSingleOperation::SetAuthority { owned, authority_type, new_authority, @@ -806,11 +806,11 @@ fn inspect_single( fn inspect_transfer( report: &mut crate::SplTokenStatefulReadinessReport, cache: &AccountCache, - source: &kb_lib::MdPubkey, - destination: &kb_lib::MdPubkey, - explicit_mint: std::option::Option<&kb_lib::MdPubkey>, - authority: &kb_lib::ExSplClassicTokenAuthority, - amount: &kb_lib::ExSplClassicTokenAmount, + source: &ks_lib::MdPubkey, + destination: &ks_lib::MdPubkey, + explicit_mint: std::option::Option<&ks_lib::MdPubkey>, + authority: &ks_lib::ExSplClassicTokenAuthority, + amount: &ks_lib::ExSplClassicTokenAmount, decimals: std::option::Option, ) { let source_state = token_state(report, cache, source); @@ -879,9 +879,9 @@ fn inspect_transfer( fn inspect_owner_amount( report: &mut crate::SplTokenStatefulReadinessReport, cache: &AccountCache, - source: &kb_lib::MdPubkey, - authority: &kb_lib::ExSplClassicTokenAuthority, - amount: &kb_lib::ExSplClassicTokenAmount, + source: &ks_lib::MdPubkey, + authority: &ks_lib::ExSplClassicTokenAuthority, + amount: &ks_lib::ExSplClassicTokenAmount, require_balance: bool, ) { let state = token_state(report, cache, source); @@ -919,8 +919,8 @@ fn inspect_owner_amount( fn inspect_checked_relation( report: &mut crate::SplTokenStatefulReadinessReport, cache: &AccountCache, - source: &kb_lib::MdPubkey, - mint: &kb_lib::MdPubkey, + source: &ks_lib::MdPubkey, + mint: &ks_lib::MdPubkey, ) { if let std::option::Option::Some(state) = token_state_quiet(cache, source) { push_check( @@ -937,8 +937,8 @@ fn inspect_checked_relation( fn inspect_checked_mint( report: &mut crate::SplTokenStatefulReadinessReport, cache: &AccountCache, - source: &kb_lib::MdPubkey, - mint: &kb_lib::MdPubkey, + source: &ks_lib::MdPubkey, + mint: &ks_lib::MdPubkey, decimals: u8, ) { inspect_checked_relation(report, cache, source, mint); @@ -955,9 +955,9 @@ fn inspect_checked_mint( fn inspect_freeze_thaw( report: &mut crate::SplTokenStatefulReadinessReport, cache: &AccountCache, - account: &kb_lib::MdPubkey, - mint: &kb_lib::MdPubkey, - authority: &kb_lib::ExSplClassicTokenAuthority, + account: &ks_lib::MdPubkey, + mint: &ks_lib::MdPubkey, + authority: &ks_lib::ExSplClassicTokenAuthority, required_state: u8, ) { let account_state = token_state(report, cache, account); @@ -984,19 +984,19 @@ fn inspect_freeze_thaw( fn inspect_set_authority( report: &mut crate::SplTokenStatefulReadinessReport, cache: &AccountCache, - owned: &kb_lib::MdPubkey, - authority_type: kb_lib::ExSplClassicTokenAuthorityType, - new_authority: &std::option::Option, - current: &kb_lib::ExSplClassicTokenAuthority, + owned: &ks_lib::MdPubkey, + authority_type: ks_lib::ExSplClassicTokenAuthorityType, + new_authority: &std::option::Option, + current: &ks_lib::ExSplClassicTokenAuthority, ) { let value = account_value(report, cache, owned, std::option::Option::None); if let std::option::Option::Some(value) = value { match authority_type { - kb_lib::ExSplClassicTokenAuthorityType::MintTokens - | kb_lib::ExSplClassicTokenAuthorityType::FreezeAccount => { + ks_lib::ExSplClassicTokenAuthorityType::MintTokens + | ks_lib::ExSplClassicTokenAuthorityType::FreezeAccount => { if let std::result::Result::Ok(state) = parse_mint(value.data.as_slice()) { let expected = - if authority_type == kb_lib::ExSplClassicTokenAuthorityType::MintTokens { + if authority_type == ks_lib::ExSplClassicTokenAuthorityType::MintTokens { state.mint_authority.as_deref() } else { state.freeze_authority.as_deref() @@ -1011,21 +1011,21 @@ fn inspect_set_authority( ); } }, - kb_lib::ExSplClassicTokenAuthorityType::AccountOwner - | kb_lib::ExSplClassicTokenAuthorityType::CloseAccount => { + ks_lib::ExSplClassicTokenAuthorityType::AccountOwner + | ks_lib::ExSplClassicTokenAuthorityType::CloseAccount => { if let std::result::Result::Ok(state) = parse_token_account(value.data.as_slice()) { let close_authority = match state.close_authority.as_deref() { std::option::Option::Some(value) => value, std::option::Option::None => state.owner.as_str(), }; let expected = - if authority_type == kb_lib::ExSplClassicTokenAuthorityType::AccountOwner { + if authority_type == ks_lib::ExSplClassicTokenAuthorityType::AccountOwner { std::option::Option::Some(state.owner.as_str()) } else { std::option::Option::Some(close_authority) }; check_authority(report, cache, current, expected); - if authority_type == kb_lib::ExSplClassicTokenAuthorityType::AccountOwner { + if authority_type == ks_lib::ExSplClassicTokenAuthorityType::AccountOwner { push_check( report, "account_owner_not_revoked", @@ -1049,7 +1049,7 @@ fn inspect_set_authority( fn check_token_authority( report: &mut crate::SplTokenStatefulReadinessReport, cache: &AccountCache, - authority: &kb_lib::ExSplClassicTokenAuthority, + authority: &ks_lib::ExSplClassicTokenAuthority, account: &TokenAccountState, ) { let supplied = authority.authority.0.as_str(); @@ -1064,7 +1064,7 @@ fn check_token_authority( fn check_authority( report: &mut crate::SplTokenStatefulReadinessReport, cache: &AccountCache, - authority: &kb_lib::ExSplClassicTokenAuthority, + authority: &ks_lib::ExSplClassicTokenAuthority, expected: std::option::Option<&str>, ) { push_check( @@ -1127,9 +1127,9 @@ fn check_mint_initialized( fn account_value<'a>( report: &mut crate::SplTokenStatefulReadinessReport, cache: &'a AccountCache, - address: &kb_lib::MdPubkey, + address: &ks_lib::MdPubkey, expected_len: std::option::Option, -) -> std::option::Option<&'a kb_onchain_transport::AccountInfoValue> { +) -> std::option::Option<&'a ks_onchain_transport::AccountInfoValue> { let value = cache.get(address.0.as_str()).and_then(|value| return value.as_ref()); push_check( report, @@ -1141,7 +1141,7 @@ fn account_value<'a>( push_check( report, "classic_token_owner", - value.owner.0 == kb_program_ids::SPL_TOKEN_PROGRAM_ID, + value.owner.0 == ks_program_ids::SPL_TOKEN_PROGRAM_ID, format!("state account {} must be owned by classic SPL Token", address.0), ); if let std::option::Option::Some(expected_len) = expected_len { @@ -1162,7 +1162,7 @@ fn account_value<'a>( fn mint_state( report: &mut crate::SplTokenStatefulReadinessReport, cache: &AccountCache, - address: &kb_lib::MdPubkey, + address: &ks_lib::MdPubkey, ) -> std::option::Option { let value = account_value(report, cache, address, std::option::Option::Some(MINT_LEN)); return match value { @@ -1183,7 +1183,7 @@ fn mint_state( fn mint_state_quiet( cache: &AccountCache, - address: &kb_lib::MdPubkey, + address: &ks_lib::MdPubkey, ) -> std::option::Option { return cache .get(address.0.as_str()) @@ -1194,7 +1194,7 @@ fn mint_state_quiet( fn token_state( report: &mut crate::SplTokenStatefulReadinessReport, cache: &AccountCache, - address: &kb_lib::MdPubkey, + address: &ks_lib::MdPubkey, ) -> std::option::Option { let value = account_value(report, cache, address, std::option::Option::Some(TOKEN_ACCOUNT_LEN)); return match value { @@ -1215,7 +1215,7 @@ fn token_state( fn token_state_quiet( cache: &AccountCache, - address: &kb_lib::MdPubkey, + address: &ks_lib::MdPubkey, ) -> std::option::Option { return cache.get(address.0.as_str()).and_then(|value| return value.as_ref()).and_then( |value| { @@ -1227,7 +1227,7 @@ fn token_state_quiet( fn multisig_state( report: &mut crate::SplTokenStatefulReadinessReport, cache: &AccountCache, - address: &kb_lib::MdPubkey, + address: &ks_lib::MdPubkey, ) -> std::option::Option { let value = account_value(report, cache, address, std::option::Option::Some(MULTISIG_LEN)); return match value { @@ -1244,7 +1244,7 @@ fn multisig_state( fn amount_value( report: &mut crate::SplTokenStatefulReadinessReport, - amount: &kb_lib::ExSplClassicTokenAmount, + amount: &ks_lib::ExSplClassicTokenAmount, ) -> std::option::Option { return match amount.0.parse::() { std::result::Result::Ok(value) => std::option::Option::Some(value), @@ -1418,8 +1418,8 @@ fn read_u64(bytes: &[u8]) -> std::result::Result { mod tests { fn empty_report() -> crate::SplTokenStatefulReadinessReport { return crate::SplTokenStatefulReadinessReport { - cluster: kb_lib::ExApiExecutionCluster::Devnet, - operation_code: kb_lib::EX_SPL_TOKEN_TRANSFER_CHECKED_OPERATION.to_string(), + cluster: ks_lib::ExApiExecutionCluster::Devnet, + operation_code: ks_lib::EX_SPL_TOKEN_TRANSFER_CHECKED_OPERATION.to_string(), status: crate::SplTokenStatefulReadinessStatus::Ready, context_slot: std::option::Option::Some(1), checks: std::vec::Vec::new(), @@ -1427,10 +1427,10 @@ mod tests { }; } - fn account_info(data: std::vec::Vec) -> kb_onchain_transport::AccountInfoValue { - return kb_onchain_transport::AccountInfoValue { + fn account_info(data: std::vec::Vec) -> ks_onchain_transport::AccountInfoValue { + return ks_onchain_transport::AccountInfoValue { lamports: 10_000_000, - owner: kb_lib::MdProgramId(kb_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), + owner: ks_lib::MdProgramId(ks_program_ids::SPL_TOKEN_PROGRAM_ID.to_string()), executable: false, rent_epoch: 0, space: data.len() as u64, @@ -1438,9 +1438,9 @@ mod tests { }; } - fn local_devnet_profile() -> kb_config::ProfileConfig { + fn local_devnet_profile() -> ks_config::ProfileConfig { let config = - match kb_config::parse_config_json(include_str!("../../config/example.config.json")) { + match ks_config::parse_config_json(include_str!("../../config/example.config.json")) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("example config parse failed: {error}"), }; @@ -1509,10 +1509,10 @@ mod tests { #[test] fn checked_transfer_state_checks_exact_mint_decimals_balance_and_owner() { - let mint_key = kb_lib::MdPubkey(bs58::encode([2_u8; 32]).into_string()); - let owner_key = kb_lib::MdPubkey(bs58::encode([3_u8; 32]).into_string()); - let source_key = kb_lib::MdPubkey(bs58::encode([7_u8; 32]).into_string()); - let destination_key = kb_lib::MdPubkey(bs58::encode([8_u8; 32]).into_string()); + let mint_key = ks_lib::MdPubkey(bs58::encode([2_u8; 32]).into_string()); + let owner_key = ks_lib::MdPubkey(bs58::encode([3_u8; 32]).into_string()); + let source_key = ks_lib::MdPubkey(bs58::encode([7_u8; 32]).into_string()); + let destination_key = ks_lib::MdPubkey(bs58::encode([8_u8; 32]).into_string()); let mut mint = [0_u8; super::MINT_LEN]; mint[44] = 9; mint[45] = 1; @@ -1537,15 +1537,15 @@ mod tests { super::inspect_single( &mut report, &cache, - &kb_lib::ExSplClassicTokenSingleOperation::TransferChecked { + &ks_lib::ExSplClassicTokenSingleOperation::TransferChecked { source: source_key, mint: mint_key, destination: destination_key, - authority: kb_lib::ExSplClassicTokenAuthority { + authority: ks_lib::ExSplClassicTokenAuthority { authority: owner_key, multisig_signers: std::vec::Vec::new(), }, - amount: kb_lib::ExSplClassicTokenAmount("42".to_string()), + amount: ks_lib::ExSplClassicTokenAmount("42".to_string()), decimals: 9, }, ); @@ -1561,9 +1561,9 @@ mod tests { #[test] fn multisig_members_are_deduplicated_before_threshold_validation() { - let multisig_key = kb_lib::MdPubkey(bs58::encode([10_u8; 32]).into_string()); - let member_one = kb_lib::MdPubkey(bs58::encode([11_u8; 32]).into_string()); - let member_two = kb_lib::MdPubkey(bs58::encode([12_u8; 32]).into_string()); + let multisig_key = ks_lib::MdPubkey(bs58::encode([10_u8; 32]).into_string()); + let member_one = ks_lib::MdPubkey(bs58::encode([11_u8; 32]).into_string()); + let member_two = ks_lib::MdPubkey(bs58::encode([12_u8; 32]).into_string()); let mut multisig = [0_u8; super::MULTISIG_LEN]; multisig[0] = 2; multisig[1] = 2; @@ -1579,7 +1579,7 @@ mod tests { super::check_authority( &mut report, &cache, - &kb_lib::ExSplClassicTokenAuthority { + &ks_lib::ExSplClassicTokenAuthority { authority: multisig_key.clone(), multisig_signers: std::vec![member_one.clone(), member_one, member_two,], }, @@ -1591,17 +1591,17 @@ mod tests { #[test] fn operation_account_collection_is_bounded_and_deduplicated() { - let key = kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()); - let operation = kb_lib::ExSplClassicTokenOperation::Instruction { - value: kb_lib::ExSplClassicTokenSingleOperation::TransferChecked { + let key = ks_lib::MdPubkey(ks_program_ids::SYSTEM_PROGRAM_ID.to_string()); + let operation = ks_lib::ExSplClassicTokenOperation::Instruction { + value: ks_lib::ExSplClassicTokenSingleOperation::TransferChecked { source: key.clone(), mint: key.clone(), destination: key.clone(), - authority: kb_lib::ExSplClassicTokenAuthority { + authority: ks_lib::ExSplClassicTokenAuthority { authority: key.clone(), multisig_signers: std::vec::Vec::new(), }, - amount: kb_lib::ExSplClassicTokenAmount("1".to_string()), + amount: ks_lib::ExSplClassicTokenAmount("1".to_string()), decimals: 9, }, }; @@ -1620,25 +1620,25 @@ mod tests { return; } let source = match std::env::var("KB_DEVNET_SPL_TOKEN_SOURCE") { - std::result::Result::Ok(value) => kb_lib::MdPubkey(value), + std::result::Result::Ok(value) => ks_lib::MdPubkey(value), std::result::Result::Err(error) => { panic!("KB_DEVNET_SPL_TOKEN_SOURCE is required: {error}"); }, }; let mint = match std::env::var("KB_DEVNET_SPL_TOKEN_MINT") { - std::result::Result::Ok(value) => kb_lib::MdPubkey(value), + std::result::Result::Ok(value) => ks_lib::MdPubkey(value), std::result::Result::Err(error) => { panic!("KB_DEVNET_SPL_TOKEN_MINT is required: {error}"); }, }; let destination = match std::env::var("KB_DEVNET_SPL_TOKEN_DESTINATION") { - std::result::Result::Ok(value) => kb_lib::MdPubkey(value), + std::result::Result::Ok(value) => ks_lib::MdPubkey(value), std::result::Result::Err(error) => { panic!("KB_DEVNET_SPL_TOKEN_DESTINATION is required: {error}"); }, }; let authority = match std::env::var("KB_DEVNET_SPL_TOKEN_AUTHORITY") { - std::result::Result::Ok(value) => kb_lib::MdPubkey(value), + std::result::Result::Ok(value) => ks_lib::MdPubkey(value), std::result::Result::Err(error) => { panic!("KB_DEVNET_SPL_TOKEN_AUTHORITY is required: {error}"); }, @@ -1657,7 +1657,7 @@ mod tests { std::result::Result::Err(_) => "1".to_string(), }; let pool = - match kb_onchain_transport::HttpEndpointPool::from_profile(&local_devnet_profile()) { + match ks_onchain_transport::HttpEndpointPool::from_profile(&local_devnet_profile()) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => panic!("HTTP pool creation failed: {error}"), }; @@ -1665,17 +1665,17 @@ mod tests { &pool, &crate::SplTokenStatefulReadinessRequest { query_role: "http_queries".to_string(), - cluster: kb_lib::ExApiExecutionCluster::Devnet, - operation: kb_lib::ExSplClassicTokenOperation::Instruction { - value: kb_lib::ExSplClassicTokenSingleOperation::TransferChecked { + cluster: ks_lib::ExApiExecutionCluster::Devnet, + operation: ks_lib::ExSplClassicTokenOperation::Instruction { + value: ks_lib::ExSplClassicTokenSingleOperation::TransferChecked { source, mint, destination, - authority: kb_lib::ExSplClassicTokenAuthority { + authority: ks_lib::ExSplClassicTokenAuthority { authority, multisig_signers: std::vec::Vec::new(), }, - amount: kb_lib::ExSplClassicTokenAmount(amount), + amount: ks_lib::ExSplClassicTokenAmount(amount), decimals, }, }, diff --git a/kb-pipeline/tests/external_metadata_metaplex_token_metadata_pipeline_api.rs b/ks-pipeline/tests/external_metadata_metaplex_token_metadata_pipeline_api.rs similarity index 66% rename from kb-pipeline/tests/external_metadata_metaplex_token_metadata_pipeline_api.rs rename to ks-pipeline/tests/external_metadata_metaplex_token_metadata_pipeline_api.rs index 6b778ef..c9abd9b 100644 --- a/kb-pipeline/tests/external_metadata_metaplex_token_metadata_pipeline_api.rs +++ b/ks-pipeline/tests/external_metadata_metaplex_token_metadata_pipeline_api.rs @@ -1,18 +1,18 @@ -// file: kb-pipeline/tests/external_metadata_metaplex_token_metadata_pipeline_api.rs -// version: 1 +// file: ks-pipeline/tests/external_metadata_metaplex_token_metadata_pipeline_api.rs +// version: 2 //! External-only coverage for the public Metaplex Token Metadata pipeline contract. #[test] fn external_consumers_can_request_edition_marker_state_through_crate_root_exports() { - let account = kb_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([7_u8; 32]).to_string()); - let mint = kb_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([8_u8; 32]).to_string()); - let request = kb_pipeline::MetaplexTokenMetadataStatefulReadRequest { + let account = ks_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([7_u8; 32]).to_string()); + let mint = ks_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([8_u8; 32]).to_string()); + let request = ks_pipeline::MetaplexTokenMetadataStatefulReadRequest { query_role: "rpc".to_string(), account, - kind: kb_pipeline::MetaplexTokenMetadataAccountKind::EditionMarker { mint, edition: 1 }, + kind: ks_pipeline::MetaplexTokenMetadataAccountKind::EditionMarker { mint, edition: 1 }, min_context_slot: std::option::Option::Some(42), - max_data_bytes: kb_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_METAPLEX_TOKEN_METADATA_ACCOUNT_BYTES, }; assert!(request.validate().is_ok()); let json = match serde_json::to_value(&request) { diff --git a/kb-pipeline/tests/external_metadata_solana_program_pipeline_api.rs b/ks-pipeline/tests/external_metadata_solana_program_pipeline_api.rs similarity index 51% rename from kb-pipeline/tests/external_metadata_solana_program_pipeline_api.rs rename to ks-pipeline/tests/external_metadata_solana_program_pipeline_api.rs index 80fa679..0937166 100644 --- a/kb-pipeline/tests/external_metadata_solana_program_pipeline_api.rs +++ b/ks-pipeline/tests/external_metadata_solana_program_pipeline_api.rs @@ -1,31 +1,31 @@ -// file: kb-pipeline/tests/external_metadata_solana_program_pipeline_api.rs -// version: 2 +// file: ks-pipeline/tests/external_metadata_solana_program_pipeline_api.rs +// version: 3 //! External-only coverage for the public Solana Program Metadata pipeline contract. #[test] fn external_consumers_use_only_public_program_metadata_pipeline_exports() { - let account = kb_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([7_u8; 32]).to_string()); - let request = kb_pipeline::SolanaProgramMetadataStatefulReadRequest { + let account = ks_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([7_u8; 32]).to_string()); + let request = ks_pipeline::SolanaProgramMetadataStatefulReadRequest { query_role: "rpc".to_string(), account: account.clone(), - expected_state: kb_pipeline::SolanaProgramMetadataExpectedAccountState::Any, + expected_state: ks_pipeline::SolanaProgramMetadataExpectedAccountState::Any, min_context_slot: std::option::Option::None, - max_data_bytes: kb_pipeline::MAX_SOLANA_PROGRAM_METADATA_STATEFUL_ACCOUNT_BYTES, + max_data_bytes: ks_pipeline::MAX_SOLANA_PROGRAM_METADATA_STATEFUL_ACCOUNT_BYTES, }; assert!(request.validate().is_ok()); - let postcondition = kb_pipeline::SolanaProgramMetadataPostcondition { + let postcondition = ks_pipeline::SolanaProgramMetadataPostcondition { code: "metadata.solana_program_metadata.external_api".to_string(), account, - status: kb_pipeline::SolanaProgramMetadataPostconditionStatus::NotApplicable, + status: ks_pipeline::SolanaProgramMetadataPostconditionStatus::NotApplicable, diagnostic: "external API coverage".to_string(), }; assert_eq!( - kb_pipeline::summarize_solana_program_metadata_postconditions(&[postcondition]), - kb_pipeline::SolanaProgramMetadataPostconditionStatus::NotApplicable + ks_pipeline::summarize_solana_program_metadata_postconditions(&[postcondition]), + ks_pipeline::SolanaProgramMetadataPostconditionStatus::NotApplicable ); const { - assert!(kb_pipeline::MAX_SOLANA_PROGRAM_METADATA_EXECUTION_SIGNERS > 0); - assert!(kb_pipeline::MAX_SOLANA_PROGRAM_METADATA_PREFLIGHT_ACCOUNTS > 0); + assert!(ks_pipeline::MAX_SOLANA_PROGRAM_METADATA_EXECUTION_SIGNERS > 0); + assert!(ks_pipeline::MAX_SOLANA_PROGRAM_METADATA_PREFLIGHT_ACCOUNTS > 0); } } diff --git a/ks-pipeline/tests/external_metadata_token_2022_pipeline_api.rs b/ks-pipeline/tests/external_metadata_token_2022_pipeline_api.rs new file mode 100644 index 0000000..8323e86 --- /dev/null +++ b/ks-pipeline/tests/external_metadata_token_2022_pipeline_api.rs @@ -0,0 +1,42 @@ +// file: ks-pipeline/tests/external_metadata_token_2022_pipeline_api.rs +// version: 2 + +//! External-only coverage for the public Token-2022 Token Metadata pipeline contract. + +#[test] +fn external_consumers_use_only_public_token_2022_metadata_pipeline_exports() { + let account = ks_lib::MdPubkey(solana_pubkey::Pubkey::new_from_array([9_u8; 32]).to_string()); + let request = ks_pipeline::Token2022StatefulReadRequest { + query_role: "rpc".to_string(), + account: account.clone(), + kind: ks_lib::DcToken2022StateKind::Mint, + min_context_slot: std::option::Option::Some(42), + max_data_bytes: ks_pipeline::MAX_TOKEN_2022_STATEFUL_ACCOUNT_BYTES, + context: ks_pipeline::Token2022StatefulContext::default(), + }; + assert_eq!(request.account, account); + assert_eq!(request.kind, ks_lib::DcToken2022StateKind::Mint); + assert!( + ks_pipeline::validate_token_2022_metadata_emit_range( + std::option::Option::Some(0), + std::option::Option::Some(32), + ) + .is_ok() + ); + let _emit_inspector: fn( + &ks_lib::ExApiExecutionSimulationResult, + std::option::Option, + std::option::Option, + ) -> ks_core::Result = + ks_pipeline::inspect_token_2022_metadata_emit_simulation; + let _authority_inspector: fn( + &ks_lib::MdPubkey, + std::option::Option<&ks_lib::MdPubkey>, + &ks_pipeline::Token2022StatefulSnapshotBundle, + ) -> ks_pipeline::Token2022ExecutionPostcondition = + ks_pipeline::inspect_token_2022_metadata_authority_postcondition; + const { + assert!(ks_pipeline::MAX_TOKEN_2022_METADATA_EMIT_BYTES > 0); + assert!(ks_pipeline::MAX_TOKEN_2022_STATEFUL_ACCOUNT_BYTES > 0); + } +} diff --git a/kb-program-ids/CHANGELOG.md b/ks-program-ids/CHANGELOG.md similarity index 79% rename from kb-program-ids/CHANGELOG.md rename to ks-program-ids/CHANGELOG.md index 7ab8c9b..7eb114e 100644 --- a/kb-program-ids/CHANGELOG.md +++ b/ks-program-ids/CHANGELOG.md @@ -1,7 +1,12 @@ - - + + -# CHANGELOG — kb-program-ids +# CHANGELOG — ks-program-ids + +## `0.5.1-pre.002` + +- renomme `kb-program-ids` en `ks-program-ids` et l'identifiant Rust `kb_program_ids` en `ks_program_ids` ; +- met à jour les consommateurs et tests sans modifier le registre des Program IDs. ## 0.4.6 diff --git a/kb-program-ids/Cargo.toml b/ks-program-ids/Cargo.toml similarity index 65% rename from kb-program-ids/Cargo.toml rename to ks-program-ids/Cargo.toml index 6254807..3502380 100644 --- a/kb-program-ids/Cargo.toml +++ b/ks-program-ids/Cargo.toml @@ -1,8 +1,8 @@ -# file: kb-program-ids/Cargo.toml -# version: 1 +# file: ks-program-ids/Cargo.toml +# version: 2 [package] -name = "kb-program-ids" +name = "ks-program-ids" version.workspace = true edition.workspace = true license.workspace = true diff --git a/kb-program-ids/README.md b/ks-program-ids/README.md similarity index 89% rename from kb-program-ids/README.md rename to ks-program-ids/README.md index b16fa8e..e1ef9df 100644 --- a/kb-program-ids/README.md +++ b/ks-program-ids/README.md @@ -1,9 +1,9 @@ - - + + -# kb-program-ids +# ks-program-ids -`kb-program-ids` est la source Rust canonique des Program IDs Solana et des comptes connus utilisés par le workspace. +`ks-program-ids` est la source Rust canonique des Program IDs Solana et des comptes connus utilisés par le workspace. ## Responsabilités diff --git a/kb-program-ids/TODO.md b/ks-program-ids/TODO.md similarity index 89% rename from kb-program-ids/TODO.md rename to ks-program-ids/TODO.md index 885fd6c..7c2f81d 100644 --- a/kb-program-ids/TODO.md +++ b/ks-program-ids/TODO.md @@ -1,7 +1,7 @@ - - + + -# TODO — kb-program-ids +# TODO — ks-program-ids ## Documentation ultérieure nécessitant des sources complémentaires diff --git a/kb-program-ids/USAGE.md b/ks-program-ids/USAGE.md similarity index 78% rename from kb-program-ids/USAGE.md rename to ks-program-ids/USAGE.md index 3daa57e..ce89fd9 100644 --- a/kb-program-ids/USAGE.md +++ b/ks-program-ids/USAGE.md @@ -1,7 +1,7 @@ - - + + -# Utilisation de kb-program-ids +# Utilisation de ks-program-ids ## Objectif @@ -11,9 +11,9 @@ La crate fournit des identifiants Solana canoniques et un registre public énum ```rust let token_program = - kb_program_ids::SPL_TOKEN_PROGRAM_ID; + ks_program_ids::SPL_TOKEN_PROGRAM_ID; let token_2022_program = - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID; + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID; assert_ne!(token_program, token_2022_program); ``` @@ -26,12 +26,12 @@ Les constantes sont des chaînes Base58. Le consommateur peut les parser dans le use std::str::FromStr; // rust-rules: trait-import let program_id = match solana_pubkey::Pubkey::from_str( - kb_program_ids::SYSTEM_PROGRAM_ID, + ks_program_ids::SYSTEM_PROGRAM_ID, ) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { return std::result::Result::Err( - kb_core::Error::new( + ks_core::Error::new( "program_id_invalid", error.to_string(), ), @@ -43,7 +43,7 @@ let program_id = match solana_pubkey::Pubkey::from_str( ## Parcourir le registre complet ```rust -for entry in kb_program_ids::registered_program_ids() { +for entry in ks_program_ids::registered_program_ids() { println!( "{}={}", entry.code(), @@ -57,8 +57,8 @@ for entry in kb_program_ids::registered_program_ids() { ## Rechercher une adresse exacte ```rust -let entry = kb_program_ids::find_registered_program_id( - kb_program_ids::SYSTEM_PROGRAM_ID, +let entry = ks_program_ids::find_registered_program_id( + ks_program_ids::SYSTEM_PROGRAM_ID, ); match entry { @@ -67,7 +67,7 @@ match entry { }, std::option::Option::None => { return std::result::Result::Err( - kb_core::Error::new( + ks_core::Error::new( "program_id_not_registered", "system program must be registered", ), @@ -80,18 +80,18 @@ match entry { ```rust let native_programs = - kb_program_ids::native_program_ids(); + ks_program_ids::native_program_ids(); let native_accounts = - kb_program_ids::native_well_known_account_ids(); + ks_program_ids::native_well_known_account_ids(); assert!(native_programs.iter().any(|entry| { entry.program_id() - == kb_program_ids::SYSTEM_PROGRAM_ID + == ks_program_ids::SYSTEM_PROGRAM_ID })); assert!(native_accounts.iter().any(|entry| { entry.program_id() - == kb_program_ids::STAKE_CONFIG_ACCOUNT_ID + == ks_program_ids::STAKE_CONFIG_ACCOUNT_ID })); ``` @@ -101,9 +101,9 @@ assert!(native_accounts.iter().any(|entry| { ```rust let supported = [ - kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, - kb_program_ids::SPL_TOKEN_PROGRAM_ID, - kb_program_ids::SPL_TOKEN_2022_PROGRAM_ID, + ks_program_ids::SPL_MEMO_V4_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_PROGRAM_ID, + ks_program_ids::SPL_TOKEN_2022_PROGRAM_ID, ]; let matches = supported.contains( diff --git a/kb-program-ids/src/constants.rs b/ks-program-ids/src/constants.rs similarity index 99% rename from kb-program-ids/src/constants.rs rename to ks-program-ids/src/constants.rs index 4d5f021..0d8baec 100644 --- a/kb-program-ids/src/constants.rs +++ b/ks-program-ids/src/constants.rs @@ -1,5 +1,5 @@ -// file: kb-program-ids/src/constants.rs -// version: 7 +// file: ks-program-ids/src/constants.rs +// version: 8 //! Canonical Solana program and well-known account identifiers. diff --git a/kb-program-ids/src/lib.rs b/ks-program-ids/src/lib.rs similarity index 99% rename from kb-program-ids/src/lib.rs rename to ks-program-ids/src/lib.rs index 0d32935..de003bc 100644 --- a/kb-program-ids/src/lib.rs +++ b/ks-program-ids/src/lib.rs @@ -1,5 +1,5 @@ -// file: kb-program-ids/src/lib.rs -// version: 11 +// file: ks-program-ids/src/lib.rs +// version: 12 #![forbid(unsafe_code)] #![deny(unreachable_pub)] diff --git a/kb-program-ids/src/programs.rs b/ks-program-ids/src/programs.rs similarity index 99% rename from kb-program-ids/src/programs.rs rename to ks-program-ids/src/programs.rs index 976f2f8..6c1927b 100644 --- a/kb-program-ids/src/programs.rs +++ b/ks-program-ids/src/programs.rs @@ -1,5 +1,5 @@ -// file: kb-program-ids/src/programs.rs -// version: 4 +// file: ks-program-ids/src/programs.rs +// version: 5 //! Enumerable canonical program registry. diff --git a/kb-store/CHANGELOG.md b/ks-store/CHANGELOG.md similarity index 82% rename from kb-store/CHANGELOG.md rename to ks-store/CHANGELOG.md index 1068205..ab49c84 100644 --- a/kb-store/CHANGELOG.md +++ b/ks-store/CHANGELOG.md @@ -1,7 +1,12 @@ - - + + -# CHANGELOG — kb-store +# CHANGELOG — ks-store + +## `0.5.1-pre.002` + +- renomme `kb-store` en `ks-store` et `kb_store` en `ks_store` ; +- aligne le target racine et les consommateurs, tout en conservant volontairement les tables `kb_sol_*` et les migrations SQL inchangées jusqu'à `0.5.3`. ## `0.5.0-pre.003` @@ -46,7 +51,7 @@ ### Migré -- consolidation de `kb_store_core`, `kb_store_pg` et des contrats associés dans `kb-store` ; +- consolidation de `ks_store_core`, `ks_store_pg` et des contrats associés dans `ks-store` ; - migration des tables raw, observations, Core, ledger, événements décodés, couverture et matérialisations ; - migration des migrations SQL, diagnostics et requêtes de replay. @@ -54,7 +59,7 @@ - adoption de Rust 2024 et des règles Khadhroony ; - maintien des modules internes privés derrière une façade publique contrôlée ; -- erreurs structurées via `kb_core::Error` et transactions async via `sqlx`. +- erreurs structurées via `ks_core::Error` et transactions async via `sqlx`. ### Validation diff --git a/kb-store/Cargo.toml b/ks-store/Cargo.toml similarity index 72% rename from kb-store/Cargo.toml rename to ks-store/Cargo.toml index 626dba0..fcc1ad6 100644 --- a/kb-store/Cargo.toml +++ b/ks-store/Cargo.toml @@ -1,8 +1,8 @@ -# file: kb-store/Cargo.toml -# version: 2 +# file: ks-store/Cargo.toml +# version: 3 [package] -name = "kb-store" +name = "ks-store" version.workspace = true edition.workspace = true license.workspace = true @@ -11,8 +11,8 @@ publish.workspace = true [dependencies] async-trait.workspace = true chrono.workspace = true -kb-core = { path = "../kb-core" } -kb-lib = { path = "../kb-lib" } +ks-core = { path = "../ks-core" } +ks-lib = { path = "../ks-lib" } serde.workspace = true serde_json.workspace = true sqlx.workspace = true diff --git a/kb-store/README.md b/ks-store/README.md similarity index 83% rename from kb-store/README.md rename to ks-store/README.md index 4b88286..db760b3 100644 --- a/kb-store/README.md +++ b/ks-store/README.md @@ -1,9 +1,9 @@ - - + + -# kb-store +# ks-store -`kb-store` consolide les contrats de stockage et l’implémentation PostgreSQL de `khadhroony-bot3`. +`ks-store` consolide les contrats de stockage et l’implémentation PostgreSQL de `khadhroony-bot3`. ## Périmètre @@ -28,7 +28,7 @@ La crate expose : ## Hors périmètre -La crate ne décode pas les instructions, n’acquiert pas les transactions et ne décide pas quelle matérialisation exécuter. Elle persiste les résultats produits par `kb-lib` et orchestrés par `kb-pipeline`. +La crate ne décode pas les instructions, n’acquiert pas les transactions et ne décide pas quelle matérialisation exécuter. Elle persiste les résultats produits par `ks-lib` et orchestrés par `ks-pipeline`. ## API publique @@ -36,9 +36,9 @@ Les consommateurs utilisent principalement `PostgresStore`, `PostgresStoreOption ## Relations -- dépend de `kb-core` pour les erreurs ; -- utilise les contrats de replay de `kb-lib` ; -- est consommée principalement par `kb-pipeline`, les scénarios de démonstration et le desktop. +- dépend de `ks-core` pour les erreurs ; +- utilise les contrats de replay de `ks-lib` ; +- est consommée principalement par `ks-pipeline`, les scénarios de démonstration et le desktop. ## Statut diff --git a/kb-store/TODO.md b/ks-store/TODO.md similarity index 93% rename from kb-store/TODO.md rename to ks-store/TODO.md index af6621d..c92e055 100644 --- a/kb-store/TODO.md +++ b/ks-store/TODO.md @@ -1,7 +1,7 @@ - - + + -# TODO — kb-store +# TODO — ks-store ## Série `0.5.x` diff --git a/kb-store/USAGE.md b/ks-store/USAGE.md similarity index 84% rename from kb-store/USAGE.md rename to ks-store/USAGE.md index 8e57295..9d2cb4e 100644 --- a/kb-store/USAGE.md +++ b/ks-store/USAGE.md @@ -1,12 +1,12 @@ - - + + -# Utilisation de kb-store +# Utilisation de ks-store ## Connexion PostgreSQL ```rust -let options = match kb_store::PostgresStoreOptions::new( +let options = match ks_store::PostgresStoreOptions::new( database_url, 10, 10_000, @@ -18,7 +18,7 @@ let options = match kb_store::PostgresStoreOptions::new( println!("postgres endpoint: {}", options.masked_dsn()); -let store = match kb_store::PostgresStore::connect(options).await { +let store = match ks_store::PostgresStore::connect(options).await { Ok(value) => value, Err(error) => return Err(error), }; @@ -59,15 +59,15 @@ for table in raw_tables { ## Pagination bornée ```rust -let first_page = kb_store::PageRequest::first_page(); +let first_page = ks_store::PageRequest::first_page(); -let next_page = match kb_store::PageRequest::new(250, 250) { +let next_page = match ks_store::PageRequest::new(250, 250) { Ok(value) => value, Err(error) => return Err(error), }; -assert_eq!(first_page.limit, kb_store::DEFAULT_PAGE_SIZE); -assert!(next_page.limit <= kb_store::MAX_PAGE_SIZE); +assert_eq!(first_page.limit, ks_store::DEFAULT_PAGE_SIZE); +assert!(next_page.limit <= ks_store::MAX_PAGE_SIZE); ``` ## Contrats de repositories @@ -126,18 +126,18 @@ Les bundles `CoreExtractionBundle`, `DecodePersistenceBundle` et `Materializatio ## Validation des noms de tables ```rust -if let Err(error) = kb_store::validate_raw_store_table_names() { +if let Err(error) = ks_store::validate_raw_store_table_names() { return Err(error); } -if let Err(error) = kb_store::validate_core_store_table_names() { +if let Err(error) = ks_store::validate_core_store_table_names() { return Err(error); } -if let Err(error) = kb_store::validate_decode_store_table_names() { +if let Err(error) = ks_store::validate_decode_store_table_names() { return Err(error); } -assert!(kb_store::is_valid_solana_table_name( - kb_store::CORE_TRANSACTIONS_TABLE_NAME +assert!(ks_store::is_valid_solana_table_name( + ks_store::CORE_TRANSACTIONS_TABLE_NAME )); ``` @@ -147,7 +147,7 @@ Les constantes `RAW_STORE_TABLE_NAMES`, `CORE_STORE_TABLE_NAMES` et `DECODE_STOR ## Erreurs et invariants -Toutes les APIs utilisent `kb_core::Result`. Les DTO valident notamment les signatures, chemins, Program IDs, clés, montants, états de traitement et identités de ledger. Les erreurs de contrat peuvent être construites avec `storage_contract_error`. +Toutes les APIs utilisent `ks_core::Result`. Les DTO valident notamment les signatures, chemins, Program IDs, clés, montants, états de traitement et identités de ledger. Les erreurs de contrat peuvent être construites avec `storage_contract_error`. ## Tests instructifs diff --git a/kb-store/maintenance/drop_raw_core_store.sql b/ks-store/maintenance/drop_raw_core_store.sql similarity index 92% rename from kb-store/maintenance/drop_raw_core_store.sql rename to ks-store/maintenance/drop_raw_core_store.sql index 9ccb7e5..454f857 100644 --- a/kb-store/maintenance/drop_raw_core_store.sql +++ b/ks-store/maintenance/drop_raw_core_store.sql @@ -1,5 +1,5 @@ --- file: kb-store/maintenance/drop_raw_core_store.sql --- version: 1 +-- file: ks-store/maintenance/drop_raw_core_store.sql +-- version: 2 -- Drop raw and core Solana storage tables in reverse dependency order. -- This script is intended for local development and test databases only. diff --git a/kb-store/maintenance/reset_derived_store_keep_raw.sql b/ks-store/maintenance/reset_derived_store_keep_raw.sql similarity index 91% rename from kb-store/maintenance/reset_derived_store_keep_raw.sql rename to ks-store/maintenance/reset_derived_store_keep_raw.sql index 6e4d5b6..1a7d4f5 100644 --- a/kb-store/maintenance/reset_derived_store_keep_raw.sql +++ b/ks-store/maintenance/reset_derived_store_keep_raw.sql @@ -1,5 +1,5 @@ --- file: kb-store/maintenance/reset_derived_store_keep_raw.sql --- version: 2 +-- file: ks-store/maintenance/reset_derived_store_keep_raw.sql +-- version: 3 -- Reset every reconstructible Solana projection while preserving acquisition data. -- Intended for controlled local/research rebuilds only. diff --git a/kb-store/migrations/0001_canonical_transaction_store.sql b/ks-store/migrations/0001_canonical_transaction_store.sql similarity index 98% rename from kb-store/migrations/0001_canonical_transaction_store.sql rename to ks-store/migrations/0001_canonical_transaction_store.sql index 5d1b566..e7a7ea1 100644 --- a/kb-store/migrations/0001_canonical_transaction_store.sql +++ b/ks-store/migrations/0001_canonical_transaction_store.sql @@ -1,5 +1,5 @@ --- file: kb-store/migrations/0001_canonical_transaction_store.sql --- version: 1 +-- file: ks-store/migrations/0001_canonical_transaction_store.sql +-- version: 2 -- Current canonical transaction and acquisition observation store. -- This baseline contains only active tables and uses the current PostgreSQL schema. diff --git a/kb-store/migrations/0002_core_store.sql b/ks-store/migrations/0002_core_store.sql similarity index 99% rename from kb-store/migrations/0002_core_store.sql rename to ks-store/migrations/0002_core_store.sql index 3fd717d..e6ccad1 100644 --- a/kb-store/migrations/0002_core_store.sql +++ b/ks-store/migrations/0002_core_store.sql @@ -1,5 +1,5 @@ --- file: kb-store/migrations/0002_core_store.sql --- version: 1 +-- file: ks-store/migrations/0002_core_store.sql +-- version: 2 -- Current normalized Solana core store. -- This migration uses the current PostgreSQL schema from the active profile. diff --git a/kb-store/migrations/0003_processing_ledger.sql b/ks-store/migrations/0003_processing_ledger.sql similarity index 96% rename from kb-store/migrations/0003_processing_ledger.sql rename to ks-store/migrations/0003_processing_ledger.sql index b0c83d1..52b5b01 100644 --- a/kb-store/migrations/0003_processing_ledger.sql +++ b/ks-store/migrations/0003_processing_ledger.sql @@ -1,5 +1,5 @@ --- file: kb-store/migrations/0003_processing_ledger.sql --- version: 1 +-- file: ks-store/migrations/0003_processing_ledger.sql +-- version: 2 -- Current processing ledger for canonical to core extraction and later pipeline stages. -- This migration uses the current PostgreSQL schema from the active profile. diff --git a/kb-store/migrations/0004_decode_materialization_store.sql b/ks-store/migrations/0004_decode_materialization_store.sql similarity index 98% rename from kb-store/migrations/0004_decode_materialization_store.sql rename to ks-store/migrations/0004_decode_materialization_store.sql index 8bf1158..e7d9359 100644 --- a/kb-store/migrations/0004_decode_materialization_store.sql +++ b/ks-store/migrations/0004_decode_materialization_store.sql @@ -1,5 +1,5 @@ --- file: kb-store/migrations/0004_decode_materialization_store.sql --- version: 1 +-- file: ks-store/migrations/0004_decode_materialization_store.sql +-- version: 2 -- Common versioned decode, coverage and materialization store. -- This migration uses the current PostgreSQL schema from the active profile. diff --git a/ks-store/src/constants.rs b/ks-store/src/constants.rs new file mode 100644 index 0000000..f7136f0 --- /dev/null +++ b/ks-store/src/constants.rs @@ -0,0 +1,7 @@ +// file: ks-store/src/constants.rs +// version: 2 + +//! Local constants for the `ks-store` crate. + +/// Canonical tracing target for this crate. +pub(crate) const TRACING_TARGET: &str = "ks-store"; diff --git a/kb-store/src/contracts.rs b/ks-store/src/contracts.rs similarity index 99% rename from kb-store/src/contracts.rs rename to ks-store/src/contracts.rs index d25605b..2a71645 100644 --- a/kb-store/src/contracts.rs +++ b/ks-store/src/contracts.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts.rs -// version: 2 +// file: ks-store/src/contracts.rs +// version: 3 //! Backend-neutral storage contracts used by pipeline crates. diff --git a/kb-store/src/contracts/dto.rs b/ks-store/src/contracts/dto.rs similarity index 98% rename from kb-store/src/contracts/dto.rs rename to ks-store/src/contracts/dto.rs index f1555dd..567a352 100644 --- a/kb-store/src/contracts/dto.rs +++ b/ks-store/src/contracts/dto.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts/dto.rs -// version: 2 +// file: ks-store/src/contracts/dto.rs +// version: 3 //! Backend-neutral DTO exports for storage repository contracts. diff --git a/kb-store/src/contracts/dto/core.rs b/ks-store/src/contracts/dto/core.rs similarity index 96% rename from kb-store/src/contracts/dto/core.rs rename to ks-store/src/contracts/dto/core.rs index ece51d1..abf1d89 100644 --- a/kb-store/src/contracts/dto/core.rs +++ b/ks-store/src/contracts/dto/core.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts/dto/core.rs -// version: 1 +// file: ks-store/src/contracts/dto/core.rs +// version: 2 //! Core Solana storage DTOs. @@ -62,7 +62,7 @@ impl CoreTransactionInsert { slot: u64, failed: bool, err_json: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { let signature_value = signature.into(); let signature_result = validate_required_text( &signature_value, @@ -120,7 +120,7 @@ impl CoreAccountKeyInsert { writable: bool, signer: bool, executable: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { let signature_value = signature.into(); let account_key_value = account_key.into(); let signature_result = validate_required_text( @@ -178,7 +178,7 @@ impl CoreInstructionInsert { program_id: impl std::convert::Into, accounts_json: serde_json::Value, payload_json: serde_json::Value, - ) -> kb_core::Result { + ) -> ks_core::Result { let signature_value = signature.into(); let instruction_path_value = instruction_path.into(); let program_id_value = program_id.into(); @@ -207,10 +207,10 @@ impl CoreInstructionInsert { pub fn with_payload_json_hash( mut self, payload_json_hash: impl std::convert::Into, - ) -> kb_core::Result { + ) -> ks_core::Result { let value = payload_json_hash.into(); if value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core instruction payload hash must not be empty", )); } @@ -250,7 +250,7 @@ impl CoreInnerInstructionInsert { program_id: impl std::convert::Into, accounts_json: serde_json::Value, payload_json: serde_json::Value, - ) -> kb_core::Result { + ) -> ks_core::Result { let signature_value = signature.into(); let parent_instruction_path_value = parent_instruction_path.into(); let instruction_path_value = instruction_path.into(); @@ -287,10 +287,10 @@ impl CoreInnerInstructionInsert { pub fn with_payload_json_hash( mut self, payload_json_hash: impl std::convert::Into, - ) -> kb_core::Result { + ) -> ks_core::Result { let value = payload_json_hash.into(); if value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core inner instruction payload hash must not be empty", )); } @@ -327,7 +327,7 @@ impl CoreLogInsert { instruction_path: std::option::Option, program_id: std::option::Option, log_text: impl std::convert::Into, - ) -> kb_core::Result { + ) -> ks_core::Result { let signature_value = signature.into(); let log_text_value = log_text.into(); let signature_result = @@ -369,10 +369,10 @@ impl CoreLogInsert { pub fn with_log_text_hash( mut self, log_text_hash: impl std::convert::Into, - ) -> kb_core::Result { + ) -> ks_core::Result { let value = log_text_hash.into(); if value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core log text hash must not be empty", )); } @@ -423,7 +423,7 @@ impl CoreBalanceChangeInsert { pre_balance_json: std::option::Option, post_balance_json: std::option::Option, delta_json: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { let signature_value = signature.into(); let signature_result = validate_required_text( &signature_value, @@ -489,10 +489,10 @@ impl CoreInstructionReplayFilter { program_id: std::option::Option, min_slot: std::option::Option, max_slot: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { if let std::option::Option::Some(program_id_value) = program_id.as_ref() { if program_id_value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core instruction replay program id must not be empty when present", )); } @@ -503,7 +503,7 @@ impl CoreInstructionReplayFilter { ) = (min_slot, max_slot) { if min_slot_value > max_slot_value { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core instruction replay min slot must be lower than or equal to max slot", )); } @@ -553,7 +553,7 @@ impl CoreInstructionLifecycleMark { processor_name: std::option::Option, processor_version: std::option::Option, reason: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { let signature_value = signature.into(); let instruction_path_value = instruction_path.into(); let signature_result = validate_required_text( @@ -607,25 +607,25 @@ fn validate_instruction_identity( instruction_path: &str, program_id: &str, label: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let signature_result = validate_required_text(signature, "instruction signature must not be empty"); if let std::result::Result::Err(_error) = signature_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "{label} signature must not be empty" ))); } let instruction_path_result = validate_required_text(instruction_path, "instruction path must not be empty"); if let std::result::Result::Err(_error) = instruction_path_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "{label} path must not be empty" ))); } let program_id_result = validate_required_text(program_id, "instruction program id must not be empty"); if let std::result::Result::Err(_error) = program_id_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "{label} program id must not be empty" ))); } @@ -635,9 +635,9 @@ fn validate_instruction_identity( fn validate_required_text( value: &str, message: impl std::convert::Into, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db(message.into())); + return std::result::Result::Err(ks_core::Error::db(message.into())); } return std::result::Result::Ok(()); } @@ -645,10 +645,10 @@ fn validate_required_text( fn validate_optional_text( value: std::option::Option<&str>, message: &'static str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if let std::option::Option::Some(text_value) = value { if text_value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db(message)); + return std::result::Result::Err(ks_core::Error::db(message)); } } return std::result::Result::Ok(()); diff --git a/kb-store/src/contracts/dto/core_extraction.rs b/ks-store/src/contracts/dto/core_extraction.rs similarity index 89% rename from kb-store/src/contracts/dto/core_extraction.rs rename to ks-store/src/contracts/dto/core_extraction.rs index 9280d27..bf326ca 100644 --- a/kb-store/src/contracts/dto/core_extraction.rs +++ b/ks-store/src/contracts/dto/core_extraction.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts/dto/core_extraction.rs -// version: 1 +// file: ks-store/src/contracts/dto/core_extraction.rs +// version: 2 //! Canonical transaction to core extraction storage contracts. @@ -40,9 +40,9 @@ impl CoreExtractionSelectionFilter { processing_state: std::option::Option, program_id: std::option::Option, limit: u32, - ) -> kb_core::Result { + ) -> ks_core::Result { if limit == 0 { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core extraction selection limit must be greater than zero", )); } @@ -50,20 +50,20 @@ impl CoreExtractionSelectionFilter { (min_slot, max_slot) { if minimum > maximum { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core extraction minimum slot must not exceed maximum slot", )); } } for signature in &signatures { if signature.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core extraction signature filter must not contain empty values", )); } } if program_id.as_deref().is_some_and(|value| return value.trim().is_empty()) { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core extraction program id filter must not be empty", )); } @@ -78,7 +78,7 @@ impl CoreExtractionSelectionFilter { } /// Builds a pending raw transaction selection. - pub fn pending(limit: u32) -> kb_core::Result { + pub fn pending(limit: u32) -> ks_core::Result { return Self::new( std::vec::Vec::new(), std::option::Option::None, @@ -113,7 +113,7 @@ impl ProcessingLedgerIdentity { processor_version: impl std::convert::Into, input_key: impl std::convert::Into, input_hash: impl std::convert::Into, - ) -> kb_core::Result { + ) -> ks_core::Result { let value = Self { stage: stage.into(), processor_name: processor_name.into(), @@ -127,7 +127,7 @@ impl ProcessingLedgerIdentity { || value.input_key.trim().is_empty() || value.input_hash.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "processing ledger identity fields must not be empty", )); } @@ -158,55 +158,55 @@ pub struct CoreExtractionBundle { impl CoreExtractionBundle { /// Validates lineage and stable signature consistency across the bundle. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.raw_transaction_id <= 0 { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core extraction raw transaction id must be positive", )); } if self.transaction.raw_transaction_id != std::option::Option::Some(self.raw_transaction_id) { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core extraction transaction lineage does not match the raw transaction id", )); } if self.transaction.signature != self.ledger_identity.input_key { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core extraction ledger input key must equal the transaction signature", )); } let signature = self.transaction.signature.as_str(); for input in &self.account_keys { if input.signature != signature { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core extraction account key signature mismatch", )); } } for input in &self.instructions { if input.signature != signature { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core extraction instruction signature mismatch", )); } } for input in &self.inner_instructions { if input.signature != signature { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core extraction inner instruction signature mismatch", )); } } for input in &self.logs { if input.signature != signature { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core extraction log signature mismatch", )); } } for input in &self.balance_changes { if input.signature != signature { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core extraction balance signature mismatch", )); } @@ -235,7 +235,7 @@ impl CoreExtractionFailure { ledger_identity: crate::ProcessingLedgerIdentity, error_code: impl std::convert::Into, error_message: impl std::convert::Into, - ) -> kb_core::Result { + ) -> ks_core::Result { let value = Self { raw_transaction_id, ledger_identity, @@ -246,7 +246,7 @@ impl CoreExtractionFailure { || value.error_code.trim().is_empty() || value.error_message.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core extraction failure fields are invalid", )); } diff --git a/kb-store/src/contracts/dto/decode.rs b/ks-store/src/contracts/dto/decode.rs similarity index 94% rename from kb-store/src/contracts/dto/decode.rs rename to ks-store/src/contracts/dto/decode.rs index f06ad0a..156edf8 100644 --- a/kb-store/src/contracts/dto/decode.rs +++ b/ks-store/src/contracts/dto/decode.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts/dto/decode.rs -// version: 4 +// file: ks-store/src/contracts/dto/decode.rs +// version: 5 //! Backend-neutral decode, coverage and materialization persistence DTOs. @@ -26,9 +26,9 @@ impl MaterializedEventFilter { materialized_family: std::option::Option, signature_contains: std::option::Option, limit: u32, - ) -> kb_core::Result { + ) -> ks_core::Result { if limit == 0 || limit > crate::MAX_MATERIALIZED_EVENT_QUERY_ROWS { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "materialized event query limit must be between 1 and {}", crate::MAX_MATERIALIZED_EVENT_QUERY_ROWS ))); @@ -110,14 +110,14 @@ impl DecodeSelectionFilter { instruction_paths: std::vec::Vec, incomplete_signatures: bool, limit: u32, - ) -> kb_core::Result { + ) -> ks_core::Result { if limit == 0 { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "decode selection limit must be greater than zero", )); } if min_slot.is_some() && max_slot.is_some() && min_slot > max_slot { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "decode selection minimum slot must not exceed maximum slot", )); } @@ -147,7 +147,7 @@ impl DecodeSelectionFilter { } /// Builds the default pending, failed and replay-requested selection. - pub fn actionable(limit: u32) -> kb_core::Result { + pub fn actionable(limit: u32) -> ks_core::Result { return crate::DecodeSelectionFilter::new( std::vec::Vec::new(), std::vec![ @@ -216,7 +216,7 @@ pub struct DecodeObservationInsert { impl DecodeObservationInsert { /// Validates stable identities and failed transaction commit semantics. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { let fields = [ self.processor_name.as_str(), self.processor_version.as_str(), @@ -236,12 +236,12 @@ impl DecodeObservationInsert { self.proof_kind.as_str(), ]; if fields.iter().any(|value| return value.trim().is_empty()) { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "decoded observation identity fields must not be empty", )); } if self.transaction_failed && self.observation_committed { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "failed transaction decoded observations must not be committed", )); } @@ -332,18 +332,18 @@ pub struct DecodePersistenceBundle { impl DecodePersistenceBundle { /// Validates identities shared by every atomic decode output. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.ledger_identity.stage != "instruction_decode" || self.signature.trim().is_empty() || self.instruction_path.trim().is_empty() || self.status.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "decode persistence bundle identity is invalid", )); } if !matches!(self.status.as_str(), "decoded" | "ignored" | "unsupported" | "failed") { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "decode persistence bundle status is unsupported", )); } @@ -355,7 +355,7 @@ impl DecodePersistenceBundle { || self.coverage.instruction_path != self.instruction_path || self.coverage.status != self.status { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "decode coverage observation does not match bundle identity", )); } @@ -363,7 +363,7 @@ impl DecodePersistenceBundle { let observation_count = match observation_count_result { std::result::Result::Ok(value) => value, std::result::Result::Err(_) => { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "decode observation count exceeds the supported range", )); }, @@ -372,7 +372,7 @@ impl DecodePersistenceBundle { || (self.status == "decoded" && self.observations.is_empty()) || (self.status != "decoded" && !self.observations.is_empty()) { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "decode status, coverage count and observations are inconsistent", )); } @@ -383,7 +383,7 @@ impl DecodePersistenceBundle { _ => true, }; if self.status == "failed" && missing_decode_error { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "failed decode bundle requires error code and message", )); } @@ -400,7 +400,7 @@ impl DecodePersistenceBundle { || observation.instruction_path != self.instruction_path || observation.transaction_failed != self.coverage.transaction_failed { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "decoded observation does not match bundle identity", )); } @@ -476,7 +476,7 @@ pub struct MaterializationPersistenceBundle { impl MaterializationPersistenceBundle { /// Validates the materializer, source decoder and output identities. - pub fn validate(&self) -> kb_core::Result<()> { + pub fn validate(&self) -> ks_core::Result<()> { if self.ledger_identity.stage != "event_materialization" || self.source_decoder_name.trim().is_empty() || self.source_decoder_version.trim().is_empty() @@ -485,7 +485,7 @@ impl MaterializationPersistenceBundle { || self.instruction_path.trim().is_empty() || self.status.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "materialization persistence bundle identity is invalid", )); } @@ -493,7 +493,7 @@ impl MaterializationPersistenceBundle { self.status.as_str(), "inserted" | "replaced" | "ignored" | "refused" | "failed" ) { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "materialization persistence bundle status is unsupported", )); } @@ -501,7 +501,7 @@ impl MaterializationPersistenceBundle { || (matches!(self.status.as_str(), "ignored" | "refused" | "failed") && !self.outputs.is_empty()) { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "materialization status and outputs are inconsistent", )); } @@ -512,7 +512,7 @@ impl MaterializationPersistenceBundle { _ => true, }; if self.status == "failed" && missing_materialization_error { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "failed materialization bundle requires error code and message", )); } @@ -526,7 +526,7 @@ impl MaterializationPersistenceBundle { || output.input_hash != self.ledger_identity.input_hash || output.signature != self.signature { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "materialized output does not match bundle identity", )); } @@ -568,9 +568,9 @@ pub struct DecodeCoverageSummaryRow { pub failed_transaction_count: i64, } -fn validate_text_list(values: &[std::string::String], label: &str) -> kb_core::Result<()> { +fn validate_text_list(values: &[std::string::String], label: &str) -> ks_core::Result<()> { if values.iter().any(|value| return value.trim().is_empty()) { - return std::result::Result::Err(kb_core::Error::db(format!("{label} must not be empty"))); + return std::result::Result::Err(ks_core::Error::db(format!("{label} must not be empty"))); } return std::result::Result::Ok(()); } diff --git a/kb-store/src/contracts/dto/event.rs b/ks-store/src/contracts/dto/event.rs similarity index 91% rename from kb-store/src/contracts/dto/event.rs rename to ks-store/src/contracts/dto/event.rs index 85b0f0c..fbdc09c 100644 --- a/kb-store/src/contracts/dto/event.rs +++ b/ks-store/src/contracts/dto/event.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts/dto/event.rs -// version: 1 +// file: ks-store/src/contracts/dto/event.rs +// version: 2 //! Decoded and materialized event storage DTOs. @@ -54,16 +54,16 @@ pub struct DecodedEventInsert { impl DecodedEventInsert { /// Builds a decoded event insert contract from the shared decoded model. pub fn from_model( - event: &kb_lib::MdDecodedProtocolEvent, + event: &ks_lib::MdDecodedProtocolEvent, payload_json: serde_json::Value, - ) -> kb_core::Result { + ) -> ks_core::Result { if event.signature.0.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "decoded event signature must not be empty", )); } if event.program_id.0.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "decoded event program id must not be empty", )); } @@ -100,16 +100,16 @@ impl MaterializedEventInsert { slot: u64, materialized_family: impl std::convert::Into, payload_json: serde_json::Value, - ) -> kb_core::Result { + ) -> ks_core::Result { let signature_value = signature.into(); let materialized_family_value = materialized_family.into(); if signature_value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "materialized event signature must not be empty", )); } if materialized_family_value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "materialized event family must not be empty", )); } diff --git a/kb-store/src/contracts/dto/ledger.rs b/ks-store/src/contracts/dto/ledger.rs similarity index 87% rename from kb-store/src/contracts/dto/ledger.rs rename to ks-store/src/contracts/dto/ledger.rs index bb53a0d..9095a21 100644 --- a/kb-store/src/contracts/dto/ledger.rs +++ b/ks-store/src/contracts/dto/ledger.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts/dto/ledger.rs -// version: 1 +// file: ks-store/src/contracts/dto/ledger.rs +// version: 2 //! Processing ledger storage DTOs. @@ -23,28 +23,28 @@ impl ProcessingLedgerMark { module_name: impl std::convert::Into, module_version: impl std::convert::Into, input_key: impl std::convert::Into, - ) -> kb_core::Result { + ) -> ks_core::Result { let stage_value = stage.into(); let module_name_value = module_name.into(); let module_version_value = module_version.into(); let input_key_value = input_key.into(); if stage_value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "processing ledger stage must not be empty", )); } if module_name_value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "processing ledger module name must not be empty", )); } if module_version_value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "processing ledger module version must not be empty", )); } if input_key_value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "processing ledger input key must not be empty", )); } diff --git a/kb-store/src/contracts/dto/raw.rs b/ks-store/src/contracts/dto/raw.rs similarity index 92% rename from kb-store/src/contracts/dto/raw.rs rename to ks-store/src/contracts/dto/raw.rs index 4f98a89..21253a7 100644 --- a/kb-store/src/contracts/dto/raw.rs +++ b/ks-store/src/contracts/dto/raw.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts/dto/raw.rs -// version: 1 +// file: ks-store/src/contracts/dto/raw.rs +// version: 2 //! Canonical Solana transaction and acquisition observation storage DTOs. @@ -85,15 +85,15 @@ impl RawTransactionInsert { slot: u64, canonical_json: serde_json::Value, canonical_format_version: u32, - ) -> kb_core::Result { + ) -> ks_core::Result { let signature_value = signature.into(); if signature_value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "canonical transaction signature must not be empty", )); } if canonical_format_version == 0 { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "canonical transaction format version must be greater than zero", )); } @@ -107,7 +107,7 @@ impl RawTransactionInsert { } /// Builds a storage insert from the source-independent canonical transaction model. - pub fn from_canonical(transaction: &kb_lib::MdCanonicalTransaction) -> kb_core::Result { + pub fn from_canonical(transaction: &ks_lib::MdCanonicalTransaction) -> ks_core::Result { let canonical_json_result = transaction.to_canonical_json(); let canonical_json = match canonical_json_result { std::result::Result::Ok(value) => value, @@ -135,10 +135,10 @@ impl RawTransactionInsert { pub fn with_canonical_json_hash( mut self, canonical_json_hash: impl std::convert::Into, - ) -> kb_core::Result { + ) -> ks_core::Result { let hash_value = canonical_json_hash.into(); if hash_value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "canonical transaction hash must not be empty", )); } @@ -201,7 +201,7 @@ impl TransactionObservationInsert { acquisition_method: impl std::convert::Into, origin: TransactionObservationOrigin, received_at: chrono::DateTime, - ) -> kb_core::Result { + ) -> ks_core::Result { let observation_key_value = observation_key.into(); let provider_value = provider.into(); let protocol_value = protocol.into(); @@ -240,9 +240,9 @@ impl TransactionObservationInsert { } /// Links the observation to a known canonical transaction row id. - pub fn with_raw_transaction_id(mut self, raw_transaction_id: i64) -> kb_core::Result { + pub fn with_raw_transaction_id(mut self, raw_transaction_id: i64) -> ks_core::Result { if raw_transaction_id <= 0 { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "transaction observation raw transaction id must be greater than zero", )); } @@ -255,10 +255,10 @@ impl TransactionObservationInsert { mut self, signature: impl std::convert::Into, slot: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { let signature_value = signature.into(); if signature_value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "transaction observation signature must not be empty", )); } @@ -271,7 +271,7 @@ impl TransactionObservationInsert { pub fn with_endpoint_code( mut self, endpoint_code: impl std::convert::Into, - ) -> kb_core::Result { + ) -> ks_core::Result { let endpoint_code_value = endpoint_code.into(); let validation_result = validate_optional_text( endpoint_code_value.as_str(), @@ -288,7 +288,7 @@ impl TransactionObservationInsert { pub fn with_commitment( mut self, commitment: impl std::convert::Into, - ) -> kb_core::Result { + ) -> ks_core::Result { let commitment_value = commitment.into(); let validation_result = validate_optional_text( commitment_value.as_str(), @@ -306,7 +306,7 @@ impl TransactionObservationInsert { mut self, capture_session_id: std::option::Option, filter_code: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { let session_result = validate_optional_owned_text( capture_session_id.as_ref(), "transaction observation capture session id must not be empty when present", @@ -342,7 +342,7 @@ impl TransactionObservationInsert { mut self, payload_size_bytes: std::option::Option, source_payload_hash: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { let hash_result = validate_optional_owned_text( source_payload_hash.as_ref(), "transaction observation source payload hash must not be empty when present", @@ -366,7 +366,7 @@ impl TransactionObservationInsert { mut self, error_code: impl std::convert::Into, error_message: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { let error_code_value = error_code.into(); let code_result = validate_optional_text( error_code_value.as_str(), @@ -412,16 +412,16 @@ impl RawPayloadLifecycleMark { retention_state: RawPayloadRetentionState, processing_state: RawPayloadProcessingState, reason: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { let raw_table_name_value = raw_table_name.into(); let raw_row_key_value = raw_row_key.into(); if raw_table_name_value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "raw lifecycle table name must not be empty", )); } if raw_row_key_value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "raw lifecycle row key must not be empty", )); } @@ -447,7 +447,7 @@ fn validate_required_observation_texts( provider: &str, protocol: &str, acquisition_method: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let values = [ (observation_key, "transaction observation key must not be empty"), (provider, "transaction observation provider must not be empty"), @@ -459,15 +459,15 @@ fn validate_required_observation_texts( ]; for (value, message) in values { if value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db(message)); + return std::result::Result::Err(ks_core::Error::db(message)); } } return std::result::Result::Ok(()); } -fn validate_optional_text(value: &str, message: &str) -> kb_core::Result<()> { +fn validate_optional_text(value: &str, message: &str) -> ks_core::Result<()> { if value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db(message)); + return std::result::Result::Err(ks_core::Error::db(message)); } return std::result::Result::Ok(()); } @@ -475,10 +475,10 @@ fn validate_optional_text(value: &str, message: &str) -> kb_core::Result<()> { fn validate_optional_owned_text( value: std::option::Option<&std::string::String>, message: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if let std::option::Option::Some(text) = value { if text.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db(message)); + return std::result::Result::Err(ks_core::Error::db(message)); } } return std::result::Result::Ok(()); @@ -498,18 +498,18 @@ mod tests { assert!(result.is_err()); } - fn canonical_transaction_fixture() -> kb_lib::MdCanonicalTransaction { - return kb_lib::MdCanonicalTransaction { - format_version: kb_lib::MD_CANONICAL_TRANSACTION_FORMAT_VERSION, + fn canonical_transaction_fixture() -> ks_lib::MdCanonicalTransaction { + return ks_lib::MdCanonicalTransaction { + format_version: ks_lib::MD_CANONICAL_TRANSACTION_FORMAT_VERSION, primary_signature: "2Ana1pUpv2ZbMVkwF5FXapYeBEjdxDatLn7nvJkhgTSXbs59SyZSx866bXirPgj8QQVB57uxHJBG1YFvkRbFj4T".to_string(), slot: 9, block_time: std::option::Option::None, - version: kb_lib::MdCanonicalTransactionVersion::Legacy, + version: ks_lib::MdCanonicalTransactionVersion::Legacy, signatures: std::vec![ "2Ana1pUpv2ZbMVkwF5FXapYeBEjdxDatLn7nvJkhgTSXbs59SyZSx866bXirPgj8QQVB57uxHJBG1YFvkRbFj4T".to_string(), ], - message: kb_lib::MdCanonicalTransactionMessage { - header: kb_lib::MdCanonicalMessageHeader { + message: ks_lib::MdCanonicalTransactionMessage { + header: ks_lib::MdCanonicalMessageHeader { num_required_signatures: 1, num_readonly_signed_accounts: 0, num_readonly_unsigned_accounts: 1, @@ -519,17 +519,17 @@ mod tests { "ComputeBudget111111111111111111111111111111".to_string(), ], recent_blockhash: "11111111111111111111111111111111".to_string(), - instructions: std::vec![kb_lib::MdCanonicalCompiledInstruction { + instructions: std::vec![ks_lib::MdCanonicalCompiledInstruction { program_id_index: 1, account_indexes: std::vec![0], data_base64: "AQ==".to_string(), stack_height: std::option::Option::Some(1), }], address_table_lookups: std::vec::Vec::new(), - loaded_addresses: kb_lib::MdCanonicalLoadedAddresses::default(), + loaded_addresses: ks_lib::MdCanonicalLoadedAddresses::default(), }, - metadata: std::option::Option::Some(kb_lib::MdCanonicalTransactionMetadata { - status: kb_lib::MdCanonicalTransactionStatus::Success, + metadata: std::option::Option::Some(ks_lib::MdCanonicalTransactionMetadata { + status: ks_lib::MdCanonicalTransactionStatus::Success, error: std::option::Option::None, fee: 5000, pre_balances: std::vec![10000, 1], @@ -558,7 +558,7 @@ mod tests { assert_eq!(insert.slot, transaction.slot); assert_eq!( insert.canonical_format_version, - kb_lib::MD_CANONICAL_TRANSACTION_FORMAT_VERSION + ks_lib::MD_CANONICAL_TRANSACTION_FORMAT_VERSION ); assert_eq!(insert.canonical_json_hash.as_deref().map(|value| return value.len()), Some(64)); } diff --git a/kb-store/src/contracts/dto/store.rs b/ks-store/src/contracts/dto/store.rs similarity index 96% rename from kb-store/src/contracts/dto/store.rs rename to ks-store/src/contracts/dto/store.rs index a7cdb4d..3e60785 100644 --- a/kb-store/src/contracts/dto/store.rs +++ b/ks-store/src/contracts/dto/store.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts/dto/store.rs -// version: 1 +// file: ks-store/src/contracts/dto/store.rs +// version: 2 //! Store backend diagnostic DTOs. @@ -53,10 +53,10 @@ impl StoreBackendDescriptor { backend_label: impl std::convert::Into, masked_dsn: std::option::Option, current_schema: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { let backend_label_value = backend_label.into(); if backend_label_value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "store backend label must not be empty", )); } diff --git a/kb-store/src/contracts/entity.rs b/ks-store/src/contracts/entity.rs similarity index 95% rename from kb-store/src/contracts/entity.rs rename to ks-store/src/contracts/entity.rs index c779318..1baa5a6 100644 --- a/kb-store/src/contracts/entity.rs +++ b/ks-store/src/contracts/entity.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts/entity.rs -// version: 2 +// file: ks-store/src/contracts/entity.rs +// version: 3 //! Backend-neutral SQL-like entity exports for storage adapters. diff --git a/kb-store/src/contracts/entity/core.rs b/ks-store/src/contracts/entity/core.rs similarity index 99% rename from kb-store/src/contracts/entity/core.rs rename to ks-store/src/contracts/entity/core.rs index 6813056..bea4adf 100644 --- a/kb-store/src/contracts/entity/core.rs +++ b/ks-store/src/contracts/entity/core.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts/entity/core.rs -// version: 1 +// file: ks-store/src/contracts/entity/core.rs +// version: 2 //! Core Solana SQL-like entities. diff --git a/kb-store/src/contracts/entity/event.rs b/ks-store/src/contracts/entity/event.rs similarity index 96% rename from kb-store/src/contracts/entity/event.rs rename to ks-store/src/contracts/entity/event.rs index 9399dc8..f421ba4 100644 --- a/kb-store/src/contracts/entity/event.rs +++ b/ks-store/src/contracts/entity/event.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts/entity/event.rs -// version: 1 +// file: ks-store/src/contracts/entity/event.rs +// version: 2 //! Decoded and materialized event SQL-like entities. diff --git a/kb-store/src/contracts/entity/ledger.rs b/ks-store/src/contracts/entity/ledger.rs similarity index 95% rename from kb-store/src/contracts/entity/ledger.rs rename to ks-store/src/contracts/entity/ledger.rs index 854ed44..4035462 100644 --- a/kb-store/src/contracts/entity/ledger.rs +++ b/ks-store/src/contracts/entity/ledger.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts/entity/ledger.rs -// version: 1 +// file: ks-store/src/contracts/entity/ledger.rs +// version: 2 //! Processing ledger SQL-like entities. diff --git a/kb-store/src/contracts/entity/raw.rs b/ks-store/src/contracts/entity/raw.rs similarity index 98% rename from kb-store/src/contracts/entity/raw.rs rename to ks-store/src/contracts/entity/raw.rs index c8a26c1..26e9d52 100644 --- a/kb-store/src/contracts/entity/raw.rs +++ b/ks-store/src/contracts/entity/raw.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts/entity/raw.rs -// version: 1 +// file: ks-store/src/contracts/entity/raw.rs +// version: 2 //! Canonical Solana transaction and acquisition observation SQL-like entities. diff --git a/kb-store/src/contracts/error.rs b/ks-store/src/contracts/error.rs similarity index 73% rename from kb-store/src/contracts/error.rs rename to ks-store/src/contracts/error.rs index 6080152..3d1d150 100644 --- a/kb-store/src/contracts/error.rs +++ b/ks-store/src/contracts/error.rs @@ -1,14 +1,14 @@ -// file: kb-store/src/contracts/error.rs -// version: 1 +// file: ks-store/src/contracts/error.rs +// version: 2 //! Backend-neutral storage error helpers. /// Creates a storage contract error with a stable code. -pub fn storage_contract_error(code: &str, message: &str) -> kb_core::Error { +pub fn storage_contract_error(code: &str, message: &str) -> ks_core::Error { if code.trim().is_empty() { - return kb_core::Error::db(message); + return ks_core::Error::db(message); } - return kb_core::Error::new(code, message); + return ks_core::Error::new(code, message); } #[cfg(test)] diff --git a/kb-store/src/contracts/health.rs b/ks-store/src/contracts/health.rs similarity index 91% rename from kb-store/src/contracts/health.rs rename to ks-store/src/contracts/health.rs index c47a10b..4fd68b8 100644 --- a/kb-store/src/contracts/health.rs +++ b/ks-store/src/contracts/health.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts/health.rs -// version: 1 +// file: ks-store/src/contracts/health.rs +// version: 2 //! Backend-neutral health contracts for storage implementations. @@ -33,10 +33,10 @@ impl StoreHealthSnapshot { backend: impl std::convert::Into, status: StoreHealthStatus, message: std::option::Option, - ) -> kb_core::Result { + ) -> ks_core::Result { let backend_value = backend.into(); if backend_value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "store health backend must not be empty", )); } diff --git a/kb-store/src/contracts/pagination.rs b/ks-store/src/contracts/pagination.rs similarity index 88% rename from kb-store/src/contracts/pagination.rs rename to ks-store/src/contracts/pagination.rs index f27acd3..015d9ec 100644 --- a/kb-store/src/contracts/pagination.rs +++ b/ks-store/src/contracts/pagination.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts/pagination.rs -// version: 1 +// file: ks-store/src/contracts/pagination.rs +// version: 2 //! Backend-neutral pagination and sorting contracts for repository operations. @@ -28,14 +28,14 @@ pub struct PageRequest { impl PageRequest { /// Builds a page request after minimal bounds validation. - pub fn new(limit: u16, offset: u64) -> kb_core::Result { + pub fn new(limit: u16, offset: u64) -> ks_core::Result { if limit == 0 { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "page limit must be greater than zero", )); } if limit > crate::MAX_PAGE_SIZE { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "page limit exceeds maximum page size", )); } diff --git a/kb-store/src/contracts/repository.rs b/ks-store/src/contracts/repository.rs similarity index 78% rename from kb-store/src/contracts/repository.rs rename to ks-store/src/contracts/repository.rs index 6fa7cd7..9569a9b 100644 --- a/kb-store/src/contracts/repository.rs +++ b/ks-store/src/contracts/repository.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/contracts/repository.rs -// version: 1 +// file: ks-store/src/contracts/repository.rs +// version: 2 //! Storage trait definitions shared by concrete stores. @@ -7,13 +7,13 @@ #[async_trait::async_trait] pub trait StoreHealthStore { /// Reads the backend descriptor visible to diagnostics. - async fn backend_descriptor(&self) -> kb_core::Result; + async fn backend_descriptor(&self) -> ks_core::Result; /// Reads the current health snapshot. - async fn health_snapshot(&self) -> kb_core::Result; + async fn health_snapshot(&self) -> ks_core::Result; /// Reads the current migration snapshot when the backend supports migrations. - async fn migration_snapshot(&self) -> kb_core::Result; + async fn migration_snapshot(&self) -> ks_core::Result; } /// Canonical raw transaction and acquisition observation storage behavior. @@ -22,30 +22,30 @@ pub trait RawTransactionStore { /// Returns true when a canonical transaction signature is already stored. async fn has_raw_transaction_signature( &self, - signature: &kb_lib::MdSignature, - ) -> kb_core::Result; + signature: &ks_lib::MdSignature, + ) -> ks_core::Result; /// Returns true when a transaction observation key is already stored. async fn has_transaction_observation_key(&self, observation_key: &str) - -> kb_core::Result; + -> ks_core::Result; /// Stores one canonical source-independent transaction payload. async fn insert_raw_transaction( &self, input: &crate::RawTransactionInsert, - ) -> kb_core::Result; + ) -> ks_core::Result; /// Stores one lightweight transaction acquisition observation. async fn insert_transaction_observation( &self, input: &crate::TransactionObservationInsert, - ) -> kb_core::Result; + ) -> ks_core::Result; /// Updates canonical raw transaction retention and processing metadata. async fn mark_raw_payload_lifecycle( &self, mark: &crate::RawPayloadLifecycleMark, - ) -> kb_core::Result; + ) -> ks_core::Result; } /// Core Solana storage behavior. @@ -55,57 +55,57 @@ pub trait CoreTransactionStore { async fn insert_core_transaction( &self, input: &crate::CoreTransactionInsert, - ) -> kb_core::Result; + ) -> ks_core::Result; /// Stores normalized core account keys. async fn insert_core_account_keys( &self, inputs: &[crate::CoreAccountKeyInsert], - ) -> kb_core::Result; + ) -> ks_core::Result; /// Stores normalized core instructions. async fn insert_core_instructions( &self, inputs: &[crate::CoreInstructionInsert], - ) -> kb_core::Result; + ) -> ks_core::Result; /// Stores normalized core inner instructions. async fn insert_core_inner_instructions( &self, inputs: &[crate::CoreInnerInstructionInsert], - ) -> kb_core::Result; + ) -> ks_core::Result; /// Stores normalized core logs. async fn insert_core_logs( &self, inputs: &[crate::CoreLogInsert], - ) -> kb_core::Result; + ) -> ks_core::Result; /// Stores normalized core balance changes. async fn insert_core_balance_changes( &self, inputs: &[crate::CoreBalanceChangeInsert], - ) -> kb_core::Result; + ) -> ks_core::Result; /// Lists normalized core instructions selected for replay or first processing. async fn list_core_instructions_for_replay( &self, filter: &crate::CoreInstructionReplayFilter, page_request: &crate::PageRequest, - ) -> kb_core::Result>; + ) -> ks_core::Result>; /// Lists replay inputs with instruction context, logs, balances and account keys. async fn list_core_instruction_replay_inputs( &self, filter: &crate::CoreInstructionReplayFilter, page_request: &crate::PageRequest, - ) -> kb_core::Result>; + ) -> ks_core::Result>; /// Updates one normalized core instruction lifecycle state. async fn mark_core_instruction_lifecycle( &self, mark: &crate::CoreInstructionLifecycleMark, - ) -> kb_core::Result; + ) -> ks_core::Result; } /// Canonical transaction to core extraction storage behavior. @@ -115,26 +115,26 @@ pub trait CoreExtractionStore { async fn list_raw_transactions_for_core_extraction( &self, filter: &crate::CoreExtractionSelectionFilter, - ) -> kb_core::Result>; + ) -> ks_core::Result>; /// Returns true when the same processor version already succeeded for the same input hash. async fn is_core_extraction_current( &self, identity: &crate::ProcessingLedgerIdentity, - ) -> kb_core::Result; + ) -> ks_core::Result; /// Atomically replaces one signature core graph and marks the processing ledger as succeeded. async fn persist_core_extraction( &self, bundle: &crate::CoreExtractionBundle, force_replay: bool, - ) -> kb_core::Result; + ) -> ks_core::Result; /// Persists one failed extraction attempt and marks the canonical raw transaction as failed. async fn mark_core_extraction_failed( &self, failure: &crate::CoreExtractionFailure, - ) -> kb_core::Result; + ) -> ks_core::Result; } /// Contextual instruction decode and materialization storage behavior. @@ -144,39 +144,39 @@ pub trait DecodePipelineStore { async fn list_decode_inputs( &self, filter: &crate::DecodeSelectionFilter, - ) -> kb_core::Result>; + ) -> ks_core::Result>; /// Returns true when the same processor version already succeeded for the same input hash. async fn is_decode_current( &self, identity: &crate::ProcessingLedgerIdentity, - ) -> kb_core::Result; + ) -> ks_core::Result; /// Replaces declarations owned by one decoder version. async fn persist_decode_coverage_declarations( &self, declarations: &[crate::DecodeCoverageDeclarationInsert], - ) -> kb_core::Result; + ) -> ks_core::Result; /// Atomically persists decoded observations, coverage and the common ledger. async fn persist_decode_result( &self, bundle: &crate::DecodePersistenceBundle, force_replay: bool, - ) -> kb_core::Result; + ) -> ks_core::Result; /// Persists a failed decode attempt and marks the source instruction as failed. async fn mark_decode_failed( &self, failure: &crate::DecodeFailure, - ) -> kb_core::Result; + ) -> ks_core::Result; /// Atomically persists materialized outputs and the common ledger. async fn persist_materialization_result( &self, bundle: &crate::MaterializationPersistenceBundle, force_replay: bool, - ) -> kb_core::Result; + ) -> ks_core::Result; /// Reads aggregated machine-readable coverage diagnostics. async fn list_decode_coverage_summary( @@ -184,13 +184,13 @@ pub trait DecodePipelineStore { processor_name: std::option::Option<&str>, processor_version: std::option::Option<&str>, limit: u32, - ) -> kb_core::Result>; + ) -> ks_core::Result>; /// Lists bounded materialized outputs for read-only application views. async fn list_materialized_events( &self, filter: &crate::MaterializedEventFilter, - ) -> kb_core::Result>; + ) -> ks_core::Result>; } /// Program observation storage behavior. @@ -199,8 +199,8 @@ pub trait ProgramObservationStore { /// Stores program observations. async fn store_observations( &self, - observations: &[kb_lib::MdProgramObservation], - ) -> kb_core::Result; + observations: &[ks_lib::MdProgramObservation], + ) -> ks_core::Result; } /// Decoded event storage behavior. @@ -210,7 +210,7 @@ pub trait DecodedEventStore { async fn store_decoded_events( &self, events: &[crate::DecodedEventInsert], - ) -> kb_core::Result; + ) -> ks_core::Result; } /// Materialized event storage behavior. @@ -220,7 +220,7 @@ pub trait MaterializedEventStore { async fn store_materialized_events( &self, events: &[crate::MaterializedEventInsert], - ) -> kb_core::Result; + ) -> ks_core::Result; } /// Processing ledger storage behavior. @@ -230,8 +230,8 @@ pub trait ProcessingLedgerStore { async fn mark_processed( &self, mark: &crate::ProcessingLedgerMark, - ) -> kb_core::Result; + ) -> ks_core::Result; /// Returns true when an input was already processed for a module version. - async fn is_processed(&self, mark: &crate::ProcessingLedgerMark) -> kb_core::Result; + async fn is_processed(&self, mark: &crate::ProcessingLedgerMark) -> ks_core::Result; } diff --git a/kb-store/src/lib.rs b/ks-store/src/lib.rs similarity index 98% rename from kb-store/src/lib.rs rename to ks-store/src/lib.rs index 4ddb3f5..d34186a 100644 --- a/kb-store/src/lib.rs +++ b/ks-store/src/lib.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/lib.rs -// version: 4 +// file: ks-store/src/lib.rs +// version: 5 //! Backend-neutral storage contracts and PostgreSQL implementation. #![warn(missing_docs)] @@ -252,6 +252,6 @@ pub use self::postgres::validate_raw_store_table_names; /// Validates a canonical Solana table name. pub use self::postgres::validate_solana_table_name; /// Current normalized core replay input contract version. -pub use kb_lib::MD_CORE_REPLAY_INPUT_CONTRACT_VERSION; +pub use ks_lib::MD_CORE_REPLAY_INPUT_CONTRACT_VERSION; /// Decoder replay input containing one instruction plus extracted transaction context. -pub use kb_lib::MdCoreInstructionReplayInput; +pub use ks_lib::MdCoreInstructionReplayInput; diff --git a/kb-store/src/postgres.rs b/ks-store/src/postgres.rs similarity index 99% rename from kb-store/src/postgres.rs rename to ks-store/src/postgres.rs index a1a9288..7abe144 100644 --- a/kb-store/src/postgres.rs +++ b/ks-store/src/postgres.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/postgres.rs -// version: 3 +// file: ks-store/src/postgres.rs +// version: 4 //! PostgreSQL storage implementation boundary. diff --git a/kb-store/src/postgres/migrations.rs b/ks-store/src/postgres/migrations.rs similarity index 98% rename from kb-store/src/postgres/migrations.rs rename to ks-store/src/postgres/migrations.rs index d7b138d..54ec2b7 100644 --- a/kb-store/src/postgres/migrations.rs +++ b/ks-store/src/postgres/migrations.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/postgres/migrations.rs -// version: 2 +// file: ks-store/src/postgres/migrations.rs +// version: 3 //! PostgreSQL migration conventions for the storage backend. @@ -714,40 +714,40 @@ pub fn is_valid_solana_table_name(table_name: &str) -> bool { } /// Validates a canonical Solana table name. -pub fn validate_solana_table_name(table_name: &str) -> kb_core::Result<()> { +pub fn validate_solana_table_name(table_name: &str) -> ks_core::Result<()> { let trimmed_table_name = table_name.trim(); if trimmed_table_name.is_empty() { - return std::result::Result::Err(kb_core::Error::db("table name must not be empty")); + return std::result::Result::Err(ks_core::Error::db("table name must not be empty")); } if trimmed_table_name.contains('.') { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "solana table names must not contain an explicit PostgreSQL schema", )); } if !trimmed_table_name.starts_with(crate::SOLANA_TABLE_PREFIX) { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "solana table name must start with kb_sol_", )); } let suffix = &trimmed_table_name[crate::SOLANA_TABLE_PREFIX.len()..]; let domain = crate::postgres::migrations::first_segment(suffix); if domain.is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "solana table name must include a domain after kb_sol_", )); } if !crate::postgres::migrations::is_allowed_domain(domain) { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "solana table name domain is not allowed", )); } if suffix.len() <= domain.len() + 1 { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "solana table name must include a name after the domain", )); } if !crate::postgres::migrations::contains_only_table_name_chars(trimmed_table_name) { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "solana table name must use lowercase ascii, digits and underscores only", )); } @@ -755,21 +755,21 @@ pub fn validate_solana_table_name(table_name: &str) -> kb_core::Result<()> { } /// Validates the raw store table names introduced by `0.2.3`. -pub fn validate_raw_store_table_names() -> kb_core::Result<()> { +pub fn validate_raw_store_table_names() -> ks_core::Result<()> { return crate::postgres::migrations::validate_table_names(crate::RAW_STORE_TABLE_NAMES); } /// Validates the core store table names introduced by `0.2.4`. -pub fn validate_core_store_table_names() -> kb_core::Result<()> { +pub fn validate_core_store_table_names() -> ks_core::Result<()> { return crate::postgres::migrations::validate_table_names(crate::CORE_STORE_TABLE_NAMES); } /// Validates the decode and materialization table names introduced by `0.4.0`. -pub fn validate_decode_store_table_names() -> kb_core::Result<()> { +pub fn validate_decode_store_table_names() -> ks_core::Result<()> { return crate::postgres::migrations::validate_table_names(crate::DECODE_STORE_TABLE_NAMES); } -fn validate_table_names(table_names: &[&str]) -> kb_core::Result<()> { +fn validate_table_names(table_names: &[&str]) -> ks_core::Result<()> { for table_name in table_names { let validation_result = crate::validate_solana_table_name(table_name); if let std::result::Result::Err(error) = validation_result { diff --git a/kb-store/src/postgres/query.rs b/ks-store/src/postgres/query.rs similarity index 98% rename from kb-store/src/postgres/query.rs rename to ks-store/src/postgres/query.rs index c3002ae..45b506c 100644 --- a/kb-store/src/postgres/query.rs +++ b/ks-store/src/postgres/query.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/postgres/query.rs -// version: 2 +// file: ks-store/src/postgres/query.rs +// version: 3 //! PostgreSQL query modules. diff --git a/kb-store/src/postgres/query/core_extraction_queries.rs b/ks-store/src/postgres/query/core_extraction_queries.rs similarity index 93% rename from kb-store/src/postgres/query/core_extraction_queries.rs rename to ks-store/src/postgres/query/core_extraction_queries.rs index 628e9e8..729a12c 100644 --- a/kb-store/src/postgres/query/core_extraction_queries.rs +++ b/ks-store/src/postgres/query/core_extraction_queries.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/postgres/query/core_extraction_queries.rs -// version: 2 +// file: ks-store/src/postgres/query/core_extraction_queries.rs +// version: 3 //! PostgreSQL queries for atomic canonical transaction to core extraction. @@ -8,7 +8,7 @@ use sqlx::Row; // rust-rules: trait-import pub(in crate::postgres) async fn list_raw_transactions_for_core_extraction( pool: &sqlx::PgPool, filter: &crate::CoreExtractionSelectionFilter, -) -> kb_core::Result> { +) -> ks_core::Result> { let min_slot_result = crate::postgres::query::core_extraction_queries::optional_sql_slot(filter.min_slot); let min_slot = match min_slot_result { @@ -41,7 +41,7 @@ pub(in crate::postgres) async fn list_raw_transactions_for_core_extraction( let rows = match query_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction raw selection failed: {error}" ))); }, @@ -62,7 +62,7 @@ pub(in crate::postgres) async fn list_raw_transactions_for_core_extraction( pub(in crate::postgres) async fn is_core_extraction_current( pool: &sqlx::PgPool, identity: &crate::ProcessingLedgerIdentity, -) -> kb_core::Result { +) -> ks_core::Result { let query_result = sqlx::query_scalar::( "SELECT EXISTS(SELECT 1 FROM kb_sol_ops_processing_ledger WHERE stage = $1 AND processor_name = $2 AND processor_version = $3 AND input_key = $4 AND input_hash = $5 AND status = 'succeeded')", ) @@ -75,7 +75,7 @@ pub(in crate::postgres) async fn is_core_extraction_current( .await; return match query_result { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction ledger lookup failed: {error}" ))), }; @@ -85,7 +85,7 @@ pub(in crate::postgres) async fn persist_core_extraction( pool: &sqlx::PgPool, bundle: &crate::CoreExtractionBundle, _force_replay: bool, -) -> kb_core::Result { +) -> ks_core::Result { let validation_result = bundle.validate(); if let std::result::Result::Err(error) = validation_result { return std::result::Result::Err(error); @@ -94,7 +94,7 @@ pub(in crate::postgres) async fn persist_core_extraction( let mut transaction = match transaction_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction transaction start failed: {error}" ))); }, @@ -108,7 +108,7 @@ pub(in crate::postgres) async fn persist_core_extraction( let existing = match existing_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction existing transaction lookup failed: {error}" ))); }, @@ -120,7 +120,7 @@ pub(in crate::postgres) async fn persist_core_extraction( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = delete_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction replacement delete failed: {error}" ))); } @@ -191,7 +191,7 @@ pub(in crate::postgres) async fn persist_core_extraction( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = raw_update_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction raw lifecycle update failed: {error}" ))); } @@ -209,7 +209,7 @@ pub(in crate::postgres) async fn persist_core_extraction( } let commit_result = transaction.commit().await; if let std::result::Result::Err(error) = commit_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction commit failed: {error}" ))); } @@ -229,12 +229,12 @@ pub(in crate::postgres) async fn persist_core_extraction( pub(in crate::postgres) async fn mark_core_extraction_failed( pool: &sqlx::PgPool, failure: &crate::CoreExtractionFailure, -) -> kb_core::Result { +) -> ks_core::Result { let transaction_result = pool.begin().await; let mut transaction = match transaction_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction failure transaction start failed: {error}" ))); }, @@ -247,7 +247,7 @@ pub(in crate::postgres) async fn mark_core_extraction_failed( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = raw_update_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction failed lifecycle update failed: {error}" ))); } @@ -265,7 +265,7 @@ pub(in crate::postgres) async fn mark_core_extraction_failed( } let commit_result = transaction.commit().await; if let std::result::Result::Err(error) = commit_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction failure commit failed: {error}" ))); } @@ -275,7 +275,7 @@ pub(in crate::postgres) async fn mark_core_extraction_failed( async fn insert_core_transaction_in_transaction( transaction: &mut sqlx::Transaction<'_, sqlx::Postgres>, input: &crate::CoreTransactionInsert, -) -> kb_core::Result { +) -> ks_core::Result { let slot_result = crate::postgres::query::core_extraction_queries::sql_slot(input.slot); let slot = match slot_result { std::result::Result::Ok(value) => value, @@ -293,7 +293,7 @@ async fn insert_core_transaction_in_transaction( .await; return match query_result { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction transaction insert failed: {error}" ))), }; @@ -303,7 +303,7 @@ async fn insert_account_keys_in_transaction( transaction: &mut sqlx::Transaction<'_, sqlx::Postgres>, transaction_id: i64, inputs: &[crate::CoreAccountKeyInsert], -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { for input in inputs { let slot_result = crate::postgres::query::core_extraction_queries::sql_slot(input.slot); let slot = match slot_result { @@ -314,7 +314,7 @@ async fn insert_account_keys_in_transaction( let account_index = match account_index_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "core account index does not fit into SQL INTEGER: {error}" ))); }, @@ -334,7 +334,7 @@ async fn insert_account_keys_in_transaction( .execute(&mut **transaction) .await; if let std::result::Result::Err(error) = query_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction account key insert failed: {error}" ))); } @@ -346,7 +346,7 @@ async fn insert_instructions_in_transaction( transaction: &mut sqlx::Transaction<'_, sqlx::Postgres>, transaction_id: i64, inputs: &[crate::CoreInstructionInsert], -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { for input in inputs { let slot_result = crate::postgres::query::core_extraction_queries::sql_slot(input.slot); let slot = match slot_result { @@ -367,7 +367,7 @@ async fn insert_instructions_in_transaction( .execute(&mut **transaction) .await; if let std::result::Result::Err(error) = query_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction instruction insert failed: {error}" ))); } @@ -379,7 +379,7 @@ async fn insert_inner_instructions_in_transaction( transaction: &mut sqlx::Transaction<'_, sqlx::Postgres>, transaction_id: i64, inputs: &[crate::CoreInnerInstructionInsert], -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { for input in inputs { let slot_result = crate::postgres::query::core_extraction_queries::sql_slot(input.slot); let slot = match slot_result { @@ -401,7 +401,7 @@ async fn insert_inner_instructions_in_transaction( .execute(&mut **transaction) .await; if let std::result::Result::Err(error) = query_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction inner instruction insert failed: {error}" ))); } @@ -413,7 +413,7 @@ async fn insert_logs_in_transaction( transaction: &mut sqlx::Transaction<'_, sqlx::Postgres>, transaction_id: i64, inputs: &[crate::CoreLogInsert], -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { for input in inputs { let slot_result = crate::postgres::query::core_extraction_queries::sql_slot(input.slot); let slot = match slot_result { @@ -424,7 +424,7 @@ async fn insert_logs_in_transaction( let log_index = match log_index_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "core log index does not fit into SQL INTEGER: {error}" ))); }, @@ -443,7 +443,7 @@ async fn insert_logs_in_transaction( .execute(&mut **transaction) .await; if let std::result::Result::Err(error) = query_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction log insert failed: {error}" ))); } @@ -455,7 +455,7 @@ async fn insert_balance_changes_in_transaction( transaction: &mut sqlx::Transaction<'_, sqlx::Postgres>, transaction_id: i64, inputs: &[crate::CoreBalanceChangeInsert], -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { for input in inputs { let slot_result = crate::postgres::query::core_extraction_queries::sql_slot(input.slot); let slot = match slot_result { @@ -466,7 +466,7 @@ async fn insert_balance_changes_in_transaction( let balance_index = match balance_index_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "core balance change index does not fit into SQL INTEGER: {error}" ))); }, @@ -475,7 +475,7 @@ async fn insert_balance_changes_in_transaction( let account_index = match account_index_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "core balance account index does not fit into SQL INTEGER: {error}" ))); }, @@ -498,7 +498,7 @@ async fn insert_balance_changes_in_transaction( .execute(&mut **transaction) .await; if let std::result::Result::Err(error) = query_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction balance insert failed: {error}" ))); } @@ -512,7 +512,7 @@ async fn upsert_ledger_terminal_in_transaction( status: &str, error_code: std::option::Option<&str>, error_message: std::option::Option<&str>, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let query_result = sqlx::query( "INSERT INTO kb_sol_ops_processing_ledger (stage, processor_name, processor_version, input_key, input_hash, status, attempt_count, started_at, finished_at, error_code, error_message) VALUES ($1, $2, $3, $4, $5, $6, 1, NOW(), NOW(), $7, $8) ON CONFLICT (stage, processor_name, processor_version, input_key) DO UPDATE SET input_hash = EXCLUDED.input_hash, status = EXCLUDED.status, attempt_count = kb_sol_ops_processing_ledger.attempt_count + 1, started_at = NOW(), finished_at = NOW(), error_code = EXCLUDED.error_code, error_message = EXCLUDED.error_message, updated_at = NOW()", ) @@ -527,7 +527,7 @@ async fn upsert_ledger_terminal_in_transaction( .execute(&mut **transaction) .await; if let std::result::Result::Err(error) = query_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core extraction ledger upsert failed: {error}" ))); } @@ -536,12 +536,12 @@ async fn upsert_ledger_terminal_in_transaction( fn map_raw_transaction_row( row: &sqlx::postgres::PgRow, -) -> kb_core::Result { +) -> ks_core::Result { let retention_text_result = row.try_get::("retention_state"); let retention_text = match retention_text_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres raw retention state mapping failed: {error}" ))); }, @@ -550,7 +550,7 @@ fn map_raw_transaction_row( let processing_text = match processing_text_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres raw processing state mapping failed: {error}" ))); }, @@ -574,7 +574,7 @@ fn map_raw_transaction_row( let id = match row.try_get::("id") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres raw id mapping failed: {error}" ))); }, @@ -582,7 +582,7 @@ fn map_raw_transaction_row( let signature = match row.try_get::("signature") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres raw signature mapping failed: {error}" ))); }, @@ -590,7 +590,7 @@ fn map_raw_transaction_row( let slot = match row.try_get::("slot") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres raw slot mapping failed: {error}" ))); }, @@ -599,7 +599,7 @@ fn map_raw_transaction_row( match row.try_get::, _>("canonical_json") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres canonical JSON mapping failed: {error}" ))); }, @@ -608,7 +608,7 @@ fn map_raw_transaction_row( match row.try_get::, _>("canonical_json_hash") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres canonical hash mapping failed: {error}" ))); }, @@ -616,7 +616,7 @@ fn map_raw_transaction_row( let canonical_format_version = match row.try_get::("canonical_format_version") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres canonical format version mapping failed: {error}" ))); }, @@ -624,7 +624,7 @@ fn map_raw_transaction_row( let created_at = match row.try_get::, _>("created_at") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres raw created_at mapping failed: {error}" ))); }, @@ -632,7 +632,7 @@ fn map_raw_transaction_row( let updated_at = match row.try_get::, _>("updated_at") { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres raw updated_at mapping failed: {error}" ))); }, @@ -651,7 +651,7 @@ fn map_raw_transaction_row( }); } -fn bundle_inserted_count(bundle: &crate::CoreExtractionBundle) -> kb_core::Result { +fn bundle_inserted_count(bundle: &crate::CoreExtractionBundle) -> ks_core::Result { let mut total = 1_u64; for length in [ bundle.account_keys.len(), @@ -664,7 +664,7 @@ fn bundle_inserted_count(bundle: &crate::CoreExtractionBundle) -> kb_core::Resul let value = match value_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "core extraction inserted row count overflow: {error}" ))); }, @@ -673,7 +673,7 @@ fn bundle_inserted_count(bundle: &crate::CoreExtractionBundle) -> kb_core::Resul total = match sum_result { std::option::Option::Some(value) => value, std::option::Option::None => { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "core extraction inserted row count overflow", )); }, @@ -682,7 +682,7 @@ fn bundle_inserted_count(bundle: &crate::CoreExtractionBundle) -> kb_core::Resul return std::result::Result::Ok(total); } -fn optional_sql_slot(value: std::option::Option) -> kb_core::Result> { +fn optional_sql_slot(value: std::option::Option) -> ks_core::Result> { return match value { std::option::Option::Some(slot) => { let converted_result = crate::postgres::query::core_extraction_queries::sql_slot(slot); @@ -697,11 +697,11 @@ fn optional_sql_slot(value: std::option::Option) -> kb_core::Result kb_core::Result { +fn sql_slot(value: u64) -> ks_core::Result { let conversion_result = i64::try_from(value); return match conversion_result { std::result::Result::Ok(converted) => std::result::Result::Ok(converted), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!( "Solana slot does not fit into SQL BIGINT: {error}" ))), }; @@ -717,7 +717,7 @@ fn raw_processing_state_to_sql(value: crate::RawPayloadProcessingState) -> &'sta }; } -fn raw_processing_state_from_sql(value: &str) -> kb_core::Result { +fn raw_processing_state_from_sql(value: &str) -> ks_core::Result { return match value { "received" => std::result::Result::Ok(crate::RawPayloadProcessingState::Received), "core_extracted" => { @@ -726,19 +726,19 @@ fn raw_processing_state_from_sql(value: &str) -> kb_core::Result std::result::Result::Ok(crate::RawPayloadProcessingState::Decoded), "materialized" => std::result::Result::Ok(crate::RawPayloadProcessingState::Materialized), "failed" => std::result::Result::Ok(crate::RawPayloadProcessingState::Failed), - _ => std::result::Result::Err(kb_core::Error::db(format!( + _ => std::result::Result::Err(ks_core::Error::db(format!( "unknown raw processing state: {value}" ))), }; } -fn raw_retention_state_from_sql(value: &str) -> kb_core::Result { +fn raw_retention_state_from_sql(value: &str) -> ks_core::Result { return match value { "full" => std::result::Result::Ok(crate::RawPayloadRetentionState::Full), "compacted" => std::result::Result::Ok(crate::RawPayloadRetentionState::Compacted), "archived" => std::result::Result::Ok(crate::RawPayloadRetentionState::Archived), "purged" => std::result::Result::Ok(crate::RawPayloadRetentionState::Purged), - _ => std::result::Result::Err(kb_core::Error::db(format!( + _ => std::result::Result::Err(ks_core::Error::db(format!( "unknown raw retention state: {value}" ))), }; @@ -851,7 +851,7 @@ mod tests { std::result::Result::Ok(value) => value.as_nanos(), std::result::Result::Err(_error) => 0, }; - return format!("kb-core-rollback-{}-{nanos}", std::process::id()); + return format!("ks-core-rollback-{}-{nanos}", std::process::id()); } fn rollback_test_bundle( diff --git a/kb-store/src/postgres/query/core_queries.rs b/ks-store/src/postgres/query/core_queries.rs similarity index 95% rename from kb-store/src/postgres/query/core_queries.rs rename to ks-store/src/postgres/query/core_queries.rs index f25c825..a7fef3f 100644 --- a/kb-store/src/postgres/query/core_queries.rs +++ b/ks-store/src/postgres/query/core_queries.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/postgres/query/core_queries.rs -// version: 2 +// file: ks-store/src/postgres/query/core_queries.rs +// version: 3 //! PostgreSQL queries for normalized Solana core storage. @@ -9,7 +9,7 @@ const OUTER_INSTRUCTIONS_CONTEXT_SQL: &str = "SELECT COALESCE(jsonb_agg(jsonb_bu pub(in crate::postgres) async fn apply_core_store_schema( pool: &sqlx::PgPool, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let validation_result = crate::validate_core_store_table_names(); if let std::result::Result::Err(error) = validation_result { return std::result::Result::Err(error); @@ -18,7 +18,7 @@ pub(in crate::postgres) async fn apply_core_store_schema( let mut transaction = match transaction_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core store schema transaction failed: {error}" ))); }, @@ -28,21 +28,21 @@ pub(in crate::postgres) async fn apply_core_store_schema( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = lock_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core store schema advisory lock failed: {error}" ))); } for statement in crate::core_store_schema_statements() { let execution_result = sqlx::query(statement).execute(&mut *transaction).await; if let std::result::Result::Err(error) = execution_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core store schema initialization failed: {error}" ))); } } let commit_result = transaction.commit().await; if let std::result::Result::Err(error) = commit_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core store schema commit failed: {error}" ))); } @@ -52,7 +52,7 @@ pub(in crate::postgres) async fn apply_core_store_schema( pub(in crate::postgres) async fn insert_core_transaction( pool: &sqlx::PgPool, input: &crate::CoreTransactionInsert, -) -> kb_core::Result { +) -> ks_core::Result { let slot_result = crate::postgres::query::core_queries::sql_slot_from_u64(input.slot); let slot = match slot_result { std::result::Result::Ok(value) => value, @@ -77,7 +77,7 @@ pub(in crate::postgres) async fn insert_core_transaction( pub(in crate::postgres) async fn insert_core_account_keys( pool: &sqlx::PgPool, inputs: &[crate::CoreAccountKeyInsert], -) -> kb_core::Result { +) -> ks_core::Result { let mut inserted_count = 0_u64; let mut skipped_count = 0_u64; for input in inputs { @@ -125,7 +125,7 @@ pub(in crate::postgres) async fn insert_core_account_keys( pub(in crate::postgres) async fn insert_core_instructions( pool: &sqlx::PgPool, inputs: &[crate::CoreInstructionInsert], -) -> kb_core::Result { +) -> ks_core::Result { let mut inserted_count = 0_u64; let mut skipped_count = 0_u64; for input in inputs { @@ -168,7 +168,7 @@ pub(in crate::postgres) async fn insert_core_instructions( pub(in crate::postgres) async fn insert_core_inner_instructions( pool: &sqlx::PgPool, inputs: &[crate::CoreInnerInstructionInsert], -) -> kb_core::Result { +) -> ks_core::Result { let mut inserted_count = 0_u64; let mut skipped_count = 0_u64; for input in inputs { @@ -207,7 +207,7 @@ pub(in crate::postgres) async fn insert_core_inner_instructions( pub(in crate::postgres) async fn insert_core_logs( pool: &sqlx::PgPool, inputs: &[crate::CoreLogInsert], -) -> kb_core::Result { +) -> ks_core::Result { let mut inserted_count = 0_u64; let mut skipped_count = 0_u64; for input in inputs { @@ -253,7 +253,7 @@ pub(in crate::postgres) async fn insert_core_logs( pub(in crate::postgres) async fn insert_core_balance_changes( pool: &sqlx::PgPool, inputs: &[crate::CoreBalanceChangeInsert], -) -> kb_core::Result { +) -> ks_core::Result { let mut inserted_count = 0_u64; let mut skipped_count = 0_u64; for input in inputs { @@ -314,7 +314,7 @@ pub(in crate::postgres) async fn list_core_instructions_for_replay( pool: &sqlx::PgPool, filter: &crate::CoreInstructionReplayFilter, page_request: &crate::PageRequest, -) -> kb_core::Result> { +) -> ks_core::Result> { let min_slot_result = crate::postgres::query::core_queries::optional_sql_slot_from_u64(filter.min_slot); let min_slot = match min_slot_result { @@ -352,7 +352,7 @@ pub(in crate::postgres) async fn list_core_instructions_for_replay( let rows = match query_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core instruction replay query failed: {error}" ))); }, @@ -372,7 +372,7 @@ pub(in crate::postgres) async fn list_core_instruction_replay_inputs( pool: &sqlx::PgPool, filter: &crate::CoreInstructionReplayFilter, page_request: &crate::PageRequest, -) -> kb_core::Result> { +) -> ks_core::Result> { let instructions_result = crate::postgres::query::core_queries::list_core_instructions_for_replay( pool, @@ -402,7 +402,7 @@ pub(in crate::postgres) async fn list_core_instruction_replay_inputs( pub(in crate::postgres) async fn list_decode_replay_inputs( pool: &sqlx::PgPool, filter: &crate::DecodeSelectionFilter, -) -> kb_core::Result> { +) -> ks_core::Result> { let min_slot_result = crate::postgres::query::core_queries::optional_sql_slot_from_u64(filter.min_slot); let min_slot = match min_slot_result { @@ -456,7 +456,7 @@ pub(in crate::postgres) async fn list_decode_replay_inputs( let rows = match rows_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode replay input selection failed: {error}" ))); }, @@ -485,7 +485,7 @@ pub(in crate::postgres) async fn list_decode_replay_inputs( pub(in crate::postgres) async fn update_core_instruction_lifecycle( pool: &sqlx::PgPool, mark: &crate::CoreInstructionLifecycleMark, -) -> kb_core::Result { +) -> ks_core::Result { let processing_state = crate::postgres::query::core_queries::instruction_processing_state_to_sql( mark.processing_state, @@ -522,7 +522,7 @@ pub(in crate::postgres) fn instruction_processing_state_to_sql( fn instruction_processing_state_from_sql( state: &str, -) -> kb_core::Result { +) -> ks_core::Result { return match state { "pending" => std::result::Result::Ok(crate::CoreInstructionProcessingState::Pending), "decoded" => std::result::Result::Ok(crate::CoreInstructionProcessingState::Decoded), @@ -534,7 +534,7 @@ fn instruction_processing_state_from_sql( "replay_requested" => { std::result::Result::Ok(crate::CoreInstructionProcessingState::ReplayRequested) }, - _unknown => std::result::Result::Err(kb_core::Error::db( + _unknown => std::result::Result::Err(ks_core::Error::db( "unknown core instruction processing state", )), }; @@ -555,7 +555,7 @@ fn balance_change_kind_to_sql(kind: crate::CoreBalanceChangeKind) -> &'static st }; } -fn sql_slot_from_u64(slot: u64) -> kb_core::Result { +fn sql_slot_from_u64(slot: u64) -> ks_core::Result { return crate::postgres::query::core_queries::sql_i64_from_u64( slot, "solana slot does not fit into SQL BIGINT", @@ -564,7 +564,7 @@ fn sql_slot_from_u64(slot: u64) -> kb_core::Result { fn optional_sql_slot_from_u64( slot: std::option::Option, -) -> kb_core::Result> { +) -> ks_core::Result> { return match slot { std::option::Option::Some(value) => { let conversion_result = crate::postgres::query::core_queries::sql_slot_from_u64(value); @@ -579,18 +579,18 @@ fn optional_sql_slot_from_u64( }; } -fn sql_i32_from_u32(value: u32, message: &str) -> kb_core::Result { +fn sql_i32_from_u32(value: u32, message: &str) -> ks_core::Result { let conversion_result = i32::try_from(value); return match conversion_result { std::result::Result::Ok(converted) => std::result::Result::Ok(converted), - std::result::Result::Err(_error) => std::result::Result::Err(kb_core::Error::db(message)), + std::result::Result::Err(_error) => std::result::Result::Err(ks_core::Error::db(message)), }; } fn optional_sql_i32_from_u32( value: std::option::Option, message: &str, -) -> kb_core::Result> { +) -> ks_core::Result> { return match value { std::option::Option::Some(inner) => { let conversion_result = @@ -606,26 +606,26 @@ fn optional_sql_i32_from_u32( }; } -fn sql_i64_from_u64(value: u64, message: &str) -> kb_core::Result { +fn sql_i64_from_u64(value: u64, message: &str) -> ks_core::Result { let conversion_result = i64::try_from(value); return match conversion_result { std::result::Result::Ok(converted) => std::result::Result::Ok(converted), - std::result::Result::Err(_error) => std::result::Result::Err(kb_core::Error::db(message)), + std::result::Result::Err(_error) => std::result::Result::Err(ks_core::Error::db(message)), }; } -fn u64_from_sql_i64(value: i64, message: &str) -> kb_core::Result { +fn u64_from_sql_i64(value: i64, message: &str) -> ks_core::Result { let conversion_result = u64::try_from(value); return match conversion_result { std::result::Result::Ok(converted) => std::result::Result::Ok(converted), - std::result::Result::Err(_error) => std::result::Result::Err(kb_core::Error::db(message)), + std::result::Result::Err(_error) => std::result::Result::Err(ks_core::Error::db(message)), }; } fn outcome_from_insert_optional( query_result: std::result::Result, sqlx::Error>, error_prefix: &str, -) -> kb_core::Result { +) -> ks_core::Result { return match query_result { std::result::Result::Ok(std::option::Option::Some(_id)) => { std::result::Result::Ok(crate::InsertOutcome::new(1, 0, 0)) @@ -634,7 +634,7 @@ fn outcome_from_insert_optional( std::result::Result::Ok(crate::InsertOutcome::new(0, 0, 1)) }, std::result::Result::Err(error) => { - std::result::Result::Err(kb_core::Error::db(format!("{error_prefix}: {error}"))) + std::result::Result::Err(ks_core::Error::db(format!("{error_prefix}: {error}"))) }, }; } @@ -642,7 +642,7 @@ fn outcome_from_insert_optional( fn outcome_from_update_result( query_result: std::result::Result, error_prefix: &str, -) -> kb_core::Result { +) -> ks_core::Result { return match query_result { std::result::Result::Ok(result) => { let rows_affected = result.rows_affected(); @@ -652,20 +652,20 @@ fn outcome_from_update_result( std::result::Result::Ok(crate::InsertOutcome::new(0, rows_affected, 0)) }, std::result::Result::Err(error) => { - std::result::Result::Err(kb_core::Error::db(format!("{error_prefix}: {error}"))) + std::result::Result::Err(ks_core::Error::db(format!("{error_prefix}: {error}"))) }, }; } fn row_to_core_instruction_row( row: &sqlx::postgres::PgRow, -) -> kb_core::Result { +) -> ks_core::Result { let state_text_result: std::result::Result = row.try_get("processing_state"); let state_text = match state_text_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core instruction processing state read failed: {error}" ))); }, @@ -742,14 +742,14 @@ fn row_to_core_instruction_row( }); } -fn read_row_value<'row, T>(row: &'row sqlx::postgres::PgRow, column: &str) -> kb_core::Result +fn read_row_value<'row, T>(row: &'row sqlx::postgres::PgRow, column: &str) -> ks_core::Result where T: sqlx::Decode<'row, sqlx::Postgres> + sqlx::Type, { let value_result = row.try_get::(column); return match value_result { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!( "postgres row read failed for {column}: {error}" ))), }; @@ -758,7 +758,7 @@ where pub(in crate::postgres) async fn load_replay_input_for_instruction( pool: &sqlx::PgPool, instruction: &crate::CoreInstructionRow, -) -> kb_core::Result { +) -> ks_core::Result { let transaction_context_result = sqlx::query_as::)>( "SELECT failed, err_json FROM kb_sol_core_transactions WHERE signature = $1 LIMIT 1", @@ -769,7 +769,7 @@ pub(in crate::postgres) async fn load_replay_input_for_instruction( let transaction_context = match transaction_context_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres core transaction context query failed: {error}" ))); }, @@ -852,7 +852,7 @@ pub(in crate::postgres) async fn load_replay_input_for_instruction( async fn load_account_keys_json( pool: &sqlx::PgPool, signature: &str, -) -> kb_core::Result { +) -> ks_core::Result { return crate::postgres::query::core_queries::load_json_aggregate( pool, "SELECT COALESCE(jsonb_agg(jsonb_build_object('accountIndex', account_index, 'accountKey', account_key, 'source', source, 'writable', writable, 'signer', signer, 'executable', executable) ORDER BY account_index), '[]'::jsonb) FROM kb_sol_core_account_keys WHERE signature = $1", @@ -865,7 +865,7 @@ async fn load_account_keys_json( async fn load_outer_instructions_json( pool: &sqlx::PgPool, signature: &str, -) -> kb_core::Result { +) -> ks_core::Result { return crate::postgres::query::core_queries::load_json_aggregate( pool, crate::postgres::query::core_queries::OUTER_INSTRUCTIONS_CONTEXT_SQL, @@ -879,7 +879,7 @@ async fn load_inner_instructions_json( pool: &sqlx::PgPool, signature: &str, instruction_path: &str, -) -> kb_core::Result { +) -> ks_core::Result { let like_pattern = format!("{instruction_path}/%"); let query_result = sqlx::query_scalar::( "SELECT COALESCE(jsonb_agg(jsonb_build_object('parentInstructionPath', parent_instruction_path, 'instructionPath', instruction_path, 'programId', program_id, 'accounts', accounts_json, 'payload', payload_json) ORDER BY instruction_path), '[]'::jsonb) FROM kb_sol_core_inner_instructions WHERE signature = $1 AND (parent_instruction_path = $2 OR instruction_path LIKE $3)", @@ -891,7 +891,7 @@ async fn load_inner_instructions_json( .await; return match query_result { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!( "postgres core inner instructions context query failed: {error}" ))), }; @@ -900,7 +900,7 @@ async fn load_inner_instructions_json( async fn load_logs_json( pool: &sqlx::PgPool, signature: &str, -) -> kb_core::Result { +) -> ks_core::Result { return crate::postgres::query::core_queries::load_json_aggregate( pool, "SELECT COALESCE(jsonb_agg(jsonb_build_object('logIndex', log_index, 'instructionPath', instruction_path, 'programId', program_id, 'text', log_text) ORDER BY log_index), '[]'::jsonb) FROM kb_sol_core_logs WHERE signature = $1", @@ -913,7 +913,7 @@ async fn load_logs_json( async fn load_balance_changes_json( pool: &sqlx::PgPool, signature: &str, -) -> kb_core::Result { +) -> ks_core::Result { return crate::postgres::query::core_queries::load_json_aggregate( pool, "SELECT COALESCE(jsonb_agg(jsonb_build_object('balanceChangeIndex', balance_change_index, 'balanceKind', balance_kind, 'accountIndex', account_index, 'accountKey', account_key, 'mint', mint, 'owner', owner, 'pre', pre_balance_json, 'post', post_balance_json, 'delta', delta_json) ORDER BY balance_change_index), '[]'::jsonb) FROM kb_sol_core_balance_changes WHERE signature = $1", @@ -928,7 +928,7 @@ async fn load_json_aggregate( sql: &'static str, signature: &str, error_prefix: &str, -) -> kb_core::Result { +) -> ks_core::Result { let query_result = sqlx::query_scalar::(sql) .bind(signature) .fetch_one(pool) @@ -936,7 +936,7 @@ async fn load_json_aggregate( return match query_result { std::result::Result::Ok(value) => std::result::Result::Ok(value), std::result::Result::Err(error) => { - std::result::Result::Err(kb_core::Error::db(format!("{error_prefix}: {error}"))) + std::result::Result::Err(ks_core::Error::db(format!("{error_prefix}: {error}"))) }, }; } diff --git a/kb-store/src/postgres/query/decode_pipeline_queries.rs b/ks-store/src/postgres/query/decode_pipeline_queries.rs similarity index 94% rename from kb-store/src/postgres/query/decode_pipeline_queries.rs rename to ks-store/src/postgres/query/decode_pipeline_queries.rs index 040f15e..36ed10b 100644 --- a/kb-store/src/postgres/query/decode_pipeline_queries.rs +++ b/ks-store/src/postgres/query/decode_pipeline_queries.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/postgres/query/decode_pipeline_queries.rs -// version: 4 +// file: ks-store/src/postgres/query/decode_pipeline_queries.rs +// version: 5 //! PostgreSQL queries for contextual decode, coverage and materialization persistence. @@ -24,7 +24,7 @@ struct MaterializedEventDatabaseRow { pub(in crate::postgres) async fn apply_decode_store_schema( pool: &sqlx::PgPool, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { tracing::debug!(target: crate::TRACING_TARGET, action = "apply_decode_store_schema", statement_count = crate::decode_store_schema_statements().len(), "apply PostgreSQL decode store schema"); let validation_result = crate::validate_decode_store_table_names(); if let std::result::Result::Err(error) = validation_result { @@ -34,7 +34,7 @@ pub(in crate::postgres) async fn apply_decode_store_schema( let mut transaction = match transaction_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode store schema transaction failed: {error}" ))); }, @@ -44,21 +44,21 @@ pub(in crate::postgres) async fn apply_decode_store_schema( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = lock_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode store schema advisory lock failed: {error}" ))); } for statement in crate::decode_store_schema_statements() { let execution_result = sqlx::query(statement).execute(&mut *transaction).await; if let std::result::Result::Err(error) = execution_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode store schema initialization failed: {error}" ))); } } let commit_result = transaction.commit().await; if let std::result::Result::Err(error) = commit_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode store schema commit failed: {error}" ))); } @@ -69,7 +69,7 @@ pub(in crate::postgres) async fn apply_decode_store_schema( pub(in crate::postgres) async fn list_decode_inputs( pool: &sqlx::PgPool, filter: &crate::DecodeSelectionFilter, -) -> kb_core::Result> { +) -> ks_core::Result> { tracing::debug!(target: crate::TRACING_TARGET, action = "list_decode_inputs", signature_count = filter.signatures.len(), signature_sample = ?filter.signatures.iter().take(5).map(std::string::String::as_str).collect::>(), processing_states = ?filter.processing_states, min_slot = ?filter.min_slot, max_slot = ?filter.max_slot, program_ids = ?filter.program_ids, instruction_paths = ?filter.instruction_paths, limit = filter.limit, "query PostgreSQL contextual decode inputs"); let result = crate::postgres::query::core_queries::list_decode_replay_inputs(pool, filter).await; @@ -93,10 +93,10 @@ pub(in crate::postgres) async fn list_decode_inputs( pub(in crate::postgres) async fn list_materialized_events( pool: &sqlx::PgPool, filter: &crate::MaterializedEventFilter, -) -> kb_core::Result> { +) -> ks_core::Result> { tracing::debug!(target: crate::TRACING_TARGET, action = "list_materialized_events", processor_name = ?filter.processor_name, materialized_family = ?filter.materialized_family, signature_contains = ?filter.signature_contains, limit = filter.limit, "query bounded PostgreSQL materialized events"); if filter.limit == 0 || filter.limit > crate::MAX_MATERIALIZED_EVENT_QUERY_ROWS { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "materialized event query limit must be between 1 and {}", crate::MAX_MATERIALIZED_EVENT_QUERY_ROWS ))); @@ -113,7 +113,7 @@ pub(in crate::postgres) async fn list_materialized_events( let rows = match query_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres materialized event query failed: {error}" ))); }, @@ -124,7 +124,7 @@ pub(in crate::postgres) async fn list_materialized_events( let slot = match slot_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres materialized event slot conversion failed: {error}" ))); }, @@ -152,7 +152,7 @@ pub(in crate::postgres) async fn list_materialized_events( pub(in crate::postgres) async fn is_decode_current( pool: &sqlx::PgPool, identity: &crate::ProcessingLedgerIdentity, -) -> kb_core::Result { +) -> ks_core::Result { tracing::debug!(target: crate::TRACING_TARGET, action = "is_decode_current", stage = %identity.stage, processor_name = %identity.processor_name, processor_version = %identity.processor_version, input_key = %identity.input_key, input_hash = %identity.input_hash, "query PostgreSQL processing ledger current state"); let query_result = sqlx::query_scalar::( "SELECT EXISTS(SELECT 1 FROM kb_sol_ops_processing_ledger WHERE stage = $1 AND processor_name = $2 AND processor_version = $3 AND input_key = $4 AND input_hash = $5 AND status = 'succeeded')", @@ -171,7 +171,7 @@ pub(in crate::postgres) async fn is_decode_current( }, std::result::Result::Err(error) => { tracing::error!(target: crate::TRACING_TARGET, action = "is_decode_current", stage = %identity.stage, processor_name = %identity.processor_name, processor_version = %identity.processor_version, input_key = %identity.input_key, error = %error, "PostgreSQL processing ledger current check failed"); - std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(ks_core::Error::db(format!( "postgres decode ledger current check failed: {error}" ))) }, @@ -181,7 +181,7 @@ pub(in crate::postgres) async fn is_decode_current( pub(in crate::postgres) async fn persist_decode_coverage_declarations( pool: &sqlx::PgPool, declarations: &[crate::DecodeCoverageDeclarationInsert], -) -> kb_core::Result { +) -> ks_core::Result { if declarations.is_empty() { tracing::debug!(target: crate::TRACING_TARGET, action = "persist_coverage_declarations", declaration_count = 0_usize, "skip empty PostgreSQL decode coverage declarations"); return std::result::Result::Ok(crate::InsertOutcome::new(0, 0, 0)); @@ -200,7 +200,7 @@ pub(in crate::postgres) async fn persist_decode_coverage_declarations( || entry.entry_kind.trim().is_empty() || entry.entry_code.trim().is_empty(); }) { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "decode coverage declarations must share one valid processor identity", )); } @@ -214,7 +214,7 @@ pub(in crate::postgres) async fn persist_decode_coverage_declarations( declaration.discriminator_hex.clone(), ); if !desired_keys.insert(key) { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "decode coverage declarations contain a duplicate identity", )); } @@ -223,7 +223,7 @@ pub(in crate::postgres) async fn persist_decode_coverage_declarations( let mut transaction = match transaction_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode coverage transaction failed: {error}" ))); }, @@ -234,7 +234,7 @@ pub(in crate::postgres) async fn persist_decode_coverage_declarations( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = lock_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode coverage declaration lock failed: {error}" ))); } @@ -248,7 +248,7 @@ pub(in crate::postgres) async fn persist_decode_coverage_declarations( let existing_rows = match existing_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode coverage declaration lookup failed: {error}" ))); }, @@ -292,7 +292,7 @@ pub(in crate::postgres) async fn persist_decode_coverage_declarations( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = insert_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode coverage declaration insert failed: {error}" ))); } @@ -316,7 +316,7 @@ pub(in crate::postgres) async fn persist_decode_coverage_declarations( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = update_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode coverage declaration update failed: {error}" ))); } @@ -338,7 +338,7 @@ pub(in crate::postgres) async fn persist_decode_coverage_declarations( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = delete_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres stale decode coverage declaration delete failed: {error}" ))); } @@ -346,7 +346,7 @@ pub(in crate::postgres) async fn persist_decode_coverage_declarations( } let commit_result = transaction.commit().await; if let std::result::Result::Err(error) = commit_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode coverage commit failed: {error}" ))); } @@ -359,7 +359,7 @@ pub(in crate::postgres) async fn persist_decode_result( pool: &sqlx::PgPool, bundle: &crate::DecodePersistenceBundle, force_replay: bool, -) -> kb_core::Result { +) -> ks_core::Result { tracing::debug!(target: crate::TRACING_TARGET, action = "persist_decode_result", signature = %bundle.signature, instruction_path = %bundle.instruction_path, stage = %bundle.ledger_identity.stage, processor_name = %bundle.ledger_identity.processor_name, processor_version = %bundle.ledger_identity.processor_version, input_key = %bundle.ledger_identity.input_key, input_hash = %bundle.ledger_identity.input_hash, status = %bundle.status, observation_count = bundle.observations.len(), coverage_program_id = %bundle.coverage.program_id, force_replay, "persist PostgreSQL contextual decode result"); let validation_result = bundle.validate(); if let std::result::Result::Err(error) = validation_result { @@ -369,7 +369,7 @@ pub(in crate::postgres) async fn persist_decode_result( let mut transaction = match transaction_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode persistence transaction failed: {error}" ))); }, @@ -383,7 +383,7 @@ pub(in crate::postgres) async fn persist_decode_result( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = delete_events_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode output replacement failed: {error}" ))); } @@ -396,7 +396,7 @@ pub(in crate::postgres) async fn persist_decode_result( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = delete_coverage_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode coverage replacement failed: {error}" ))); } @@ -405,7 +405,7 @@ pub(in crate::postgres) async fn persist_decode_result( let slot = match slot_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "decoded observation slot conversion failed: {error}" ))); }, @@ -438,7 +438,7 @@ pub(in crate::postgres) async fn persist_decode_result( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = insert_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decoded observation insert failed: {error}" ))); } @@ -481,7 +481,7 @@ pub(in crate::postgres) async fn persist_decode_result( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = lifecycle_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode instruction lifecycle update failed: {error}" ))); } @@ -499,7 +499,7 @@ pub(in crate::postgres) async fn persist_decode_result( } let commit_result = transaction.commit().await; if let std::result::Result::Err(error) = commit_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode persistence commit failed: {error}" ))); } @@ -507,7 +507,7 @@ pub(in crate::postgres) async fn persist_decode_result( let count = match count_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "decoded observation count conversion failed: {error}" ))); }, @@ -520,7 +520,7 @@ pub(in crate::postgres) async fn persist_decode_result( pub(in crate::postgres) async fn mark_decode_failed( pool: &sqlx::PgPool, failure: &crate::DecodeFailure, -) -> kb_core::Result { +) -> ks_core::Result { tracing::error!(target: crate::TRACING_TARGET, action = "mark_decode_failed", signature = %failure.signature, instruction_path = %failure.instruction_path, processor_name = %failure.ledger_identity.processor_name, processor_version = %failure.ledger_identity.processor_version, input_key = %failure.ledger_identity.input_key, input_hash = %failure.ledger_identity.input_hash, error_code = %failure.error_code, error_message = %failure.error_message, "persist PostgreSQL contextual decode failure"); if failure.ledger_identity.stage != "instruction_decode" || failure.signature.trim().is_empty() @@ -528,13 +528,13 @@ pub(in crate::postgres) async fn mark_decode_failed( || failure.error_code.trim().is_empty() || failure.error_message.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db("decode failure identity is invalid")); + return std::result::Result::Err(ks_core::Error::db("decode failure identity is invalid")); } let transaction_result = pool.begin().await; let mut transaction = match transaction_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode failure transaction failed: {error}" ))); }, @@ -550,7 +550,7 @@ pub(in crate::postgres) async fn mark_decode_failed( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = lifecycle_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode failure lifecycle update failed: {error}" ))); } @@ -567,7 +567,7 @@ pub(in crate::postgres) async fn mark_decode_failed( } let commit_result = transaction.commit().await; if let std::result::Result::Err(error) = commit_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode failure commit failed: {error}" ))); } @@ -580,7 +580,7 @@ pub(in crate::postgres) async fn persist_materialization_result( pool: &sqlx::PgPool, bundle: &crate::MaterializationPersistenceBundle, force_replay: bool, -) -> kb_core::Result { +) -> ks_core::Result { if bundle.status == "failed" { tracing::error!( target: crate::TRACING_TARGET, @@ -607,7 +607,7 @@ pub(in crate::postgres) async fn persist_materialization_result( let mut transaction = match transaction_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres materialization transaction failed: {error}" ))); }, @@ -621,7 +621,7 @@ pub(in crate::postgres) async fn persist_materialization_result( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = delete_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres materialization output replacement failed: {error}" ))); } @@ -630,7 +630,7 @@ pub(in crate::postgres) async fn persist_materialization_result( let slot = match slot_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "materialized output slot conversion failed: {error}" ))); }, @@ -654,7 +654,7 @@ pub(in crate::postgres) async fn persist_materialization_result( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = insert_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres materialized output insert failed: {error}" ))); } @@ -683,7 +683,7 @@ pub(in crate::postgres) async fn persist_materialization_result( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = lifecycle_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres materialization lifecycle update failed: {error}" ))); } @@ -701,7 +701,7 @@ pub(in crate::postgres) async fn persist_materialization_result( } let commit_result = transaction.commit().await; if let std::result::Result::Err(error) = commit_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres materialization commit failed: {error}" ))); } @@ -709,7 +709,7 @@ pub(in crate::postgres) async fn persist_materialization_result( let count = match count_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "materialized output count conversion failed: {error}" ))); }, @@ -724,10 +724,10 @@ pub(in crate::postgres) async fn list_decode_coverage_summary( processor_name: std::option::Option<&str>, processor_version: std::option::Option<&str>, limit: u32, -) -> kb_core::Result> { +) -> ks_core::Result> { tracing::debug!(target: crate::TRACING_TARGET, action = "list_decode_coverage_summary", processor_name = ?processor_name, processor_version = ?processor_version, limit, "query PostgreSQL decode coverage summary"); if limit == 0 { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "decode coverage summary limit must be greater than zero", )); } @@ -742,7 +742,7 @@ pub(in crate::postgres) async fn list_decode_coverage_summary( let rows = match query_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode coverage summary query failed: {error}" ))); }, @@ -763,12 +763,12 @@ pub(in crate::postgres) async fn list_decode_coverage_summary( async fn upsert_coverage_observation( transaction: &mut sqlx::Transaction<'_, sqlx::Postgres>, coverage: &crate::DecodeCoverageObservationInsert, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let slot_result = i64::try_from(coverage.slot); let slot = match slot_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "decode coverage slot conversion failed: {error}" ))); }, @@ -777,7 +777,7 @@ async fn upsert_coverage_observation( let decoded_count = match decoded_count_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "decode coverage decoded count conversion failed: {error}" ))); }, @@ -786,7 +786,7 @@ async fn upsert_coverage_observation( let materialized_count = match materialized_count_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "decode coverage materialized count conversion failed: {error}" ))); }, @@ -795,7 +795,7 @@ async fn upsert_coverage_observation( let error_count = match error_count_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "decode coverage error count conversion failed: {error}" ))); }, @@ -823,7 +823,7 @@ async fn upsert_coverage_observation( .execute(&mut **transaction) .await; if let std::result::Result::Err(error) = query_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode coverage observation upsert failed: {error}" ))); } @@ -835,7 +835,7 @@ async fn refresh_materialized_coverage_count( decoder_name: &str, decoder_version: &str, decode_input_key: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let query_result = sqlx::query( "UPDATE kb_sol_decode_coverage_observations SET materialized_count = (SELECT COUNT(*)::INTEGER FROM kb_sol_mat_events WHERE source_decoder_name = $1 AND source_decoder_version = $2 AND source_decode_input_key = $3), updated_at = NOW() WHERE processor_name = $1 AND processor_version = $2 AND input_key = $3", ) @@ -845,7 +845,7 @@ async fn refresh_materialized_coverage_count( .execute(&mut **transaction) .await; if let std::result::Result::Err(error) = query_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres materialization coverage refresh failed: {error}" ))); } @@ -858,7 +858,7 @@ async fn upsert_ledger_terminal( status: &str, error_code: std::option::Option<&str>, error_message: std::option::Option<&str>, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let query_result = sqlx::query( "INSERT INTO kb_sol_ops_processing_ledger (stage, processor_name, processor_version, input_key, input_hash, status, attempt_count, started_at, finished_at, error_code, error_message) VALUES ($1, $2, $3, $4, $5, $6, 1, NOW(), NOW(), $7, $8) ON CONFLICT (stage, processor_name, processor_version, input_key) DO UPDATE SET input_hash = EXCLUDED.input_hash, status = EXCLUDED.status, attempt_count = kb_sol_ops_processing_ledger.attempt_count + 1, started_at = NOW(), finished_at = NOW(), error_code = EXCLUDED.error_code, error_message = EXCLUDED.error_message, updated_at = NOW()", ) @@ -873,7 +873,7 @@ async fn upsert_ledger_terminal( .execute(&mut **transaction) .await; if let std::result::Result::Err(error) = query_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode processing ledger upsert failed: {error}" ))); } @@ -882,7 +882,7 @@ async fn upsert_ledger_terminal( fn map_coverage_summary_row( row: &sqlx::postgres::PgRow, -) -> kb_core::Result { +) -> ks_core::Result { let processor_name_result = row.try_get::("processor_name"); let processor_name = match processor_name_result { std::result::Result::Ok(value) => value, @@ -984,7 +984,7 @@ fn map_coverage_summary_row( }); } -fn read_i64(row: &sqlx::postgres::PgRow, column: &str) -> kb_core::Result { +fn read_i64(row: &sqlx::postgres::PgRow, column: &str) -> ks_core::Result { let result = row.try_get::(column); return match result { std::result::Result::Ok(value) => std::result::Result::Ok(value), @@ -994,8 +994,8 @@ fn read_i64(row: &sqlx::postgres::PgRow, column: &str) -> kb_core::Result { }; } -fn map_error(column: &str, error: sqlx::Error) -> kb_core::Result { - return std::result::Result::Err(kb_core::Error::db(format!( +fn map_error(column: &str, error: sqlx::Error) -> ks_core::Result { + return std::result::Result::Err(ks_core::Error::db(format!( "postgres decode coverage column {column} mapping failed: {error}" ))); } diff --git a/kb-store/src/postgres/query/health_queries.rs b/ks-store/src/postgres/query/health_queries.rs similarity index 84% rename from kb-store/src/postgres/query/health_queries.rs rename to ks-store/src/postgres/query/health_queries.rs index ea37473..e71f0e1 100644 --- a/kb-store/src/postgres/query/health_queries.rs +++ b/ks-store/src/postgres/query/health_queries.rs @@ -1,13 +1,13 @@ -// file: kb-store/src/postgres/query/health_queries.rs -// version: 1 +// file: ks-store/src/postgres/query/health_queries.rs +// version: 2 //! PostgreSQL health and diagnostic SQL queries. -pub(in crate::postgres) async fn run_health_check(pool: &sqlx::PgPool) -> kb_core::Result<()> { +pub(in crate::postgres) async fn run_health_check(pool: &sqlx::PgPool) -> ks_core::Result<()> { let query_result = sqlx::query_scalar::("SELECT 1").fetch_one(pool).await; return match query_result { std::result::Result::Ok(_value) => std::result::Result::Ok(()), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!( "postgres healthcheck failed: {error}" ))), }; @@ -15,14 +15,14 @@ pub(in crate::postgres) async fn run_health_check(pool: &sqlx::PgPool) -> kb_cor pub(in crate::postgres) async fn load_current_schema( pool: &sqlx::PgPool, -) -> kb_core::Result { +) -> ks_core::Result { let query_result = sqlx::query_scalar::("SELECT current_schema()") .fetch_one(pool) .await; return match query_result { std::result::Result::Ok(schema) => std::result::Result::Ok(schema), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!( "postgres current schema query failed: {error}" ))), }; @@ -30,14 +30,14 @@ pub(in crate::postgres) async fn load_current_schema( pub(in crate::postgres) async fn load_server_version( pool: &sqlx::PgPool, -) -> kb_core::Result { +) -> ks_core::Result { let query_result = sqlx::query_scalar::("SELECT version()") .fetch_one(pool) .await; return match query_result { std::result::Result::Ok(version) => std::result::Result::Ok(version), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!( "postgres version query failed: {error}" ))), }; @@ -45,7 +45,7 @@ pub(in crate::postgres) async fn load_server_version( pub(in crate::postgres) async fn load_migration_table_name( pool: &sqlx::PgPool, -) -> kb_core::Result> { +) -> ks_core::Result> { let query_result = sqlx::query_scalar::>( "SELECT to_regclass('_sqlx_migrations')::text", @@ -54,7 +54,7 @@ pub(in crate::postgres) async fn load_migration_table_name( .await; return match query_result { std::result::Result::Ok(table_name) => std::result::Result::Ok(table_name), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!( "postgres migration table query failed: {error}" ))), }; @@ -62,7 +62,7 @@ pub(in crate::postgres) async fn load_migration_table_name( pub(in crate::postgres) async fn load_latest_migration_version( pool: &sqlx::PgPool, -) -> kb_core::Result> { +) -> ks_core::Result> { let query_result = sqlx::query_scalar::>( "SELECT version::text FROM _sqlx_migrations WHERE success = true ORDER BY version DESC LIMIT 1", ) @@ -70,7 +70,7 @@ pub(in crate::postgres) async fn load_latest_migration_version( .await; return match query_result { std::result::Result::Ok(version) => std::result::Result::Ok(version.flatten()), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!( "postgres latest migration query failed: {error}" ))), }; diff --git a/kb-store/src/postgres/query/raw_queries.rs b/ks-store/src/postgres/query/raw_queries.rs similarity index 93% rename from kb-store/src/postgres/query/raw_queries.rs rename to ks-store/src/postgres/query/raw_queries.rs index 2ebc134..53b5d74 100644 --- a/kb-store/src/postgres/query/raw_queries.rs +++ b/ks-store/src/postgres/query/raw_queries.rs @@ -1,11 +1,11 @@ -// file: kb-store/src/postgres/query/raw_queries.rs -// version: 2 +// file: ks-store/src/postgres/query/raw_queries.rs +// version: 3 //! PostgreSQL canonical transaction and acquisition observation SQL queries. pub(in crate::postgres) async fn apply_raw_store_schema( pool: &sqlx::PgPool, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let validation_result = crate::validate_raw_store_table_names(); if let std::result::Result::Err(error) = validation_result { return std::result::Result::Err(error); @@ -14,7 +14,7 @@ pub(in crate::postgres) async fn apply_raw_store_schema( let mut transaction = match transaction_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres canonical raw store schema transaction failed: {error}" ))); }, @@ -24,21 +24,21 @@ pub(in crate::postgres) async fn apply_raw_store_schema( .execute(&mut *transaction) .await; if let std::result::Result::Err(error) = lock_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres canonical raw store schema advisory lock failed: {error}" ))); } for statement in crate::raw_store_schema_statements() { let execution_result = sqlx::query(statement).execute(&mut *transaction).await; if let std::result::Result::Err(error) = execution_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres canonical raw store schema statement failed: {error}" ))); } } let commit_result = transaction.commit().await; if let std::result::Result::Err(error) = commit_result { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres canonical raw store schema commit failed: {error}" ))); } @@ -48,7 +48,7 @@ pub(in crate::postgres) async fn apply_raw_store_schema( pub(in crate::postgres) async fn has_raw_transaction_signature( pool: &sqlx::PgPool, signature: &str, -) -> kb_core::Result { +) -> ks_core::Result { let validation_result = crate::postgres::query::raw_queries::validate_required_text( signature, "canonical raw transaction signature must not be empty", @@ -64,7 +64,7 @@ pub(in crate::postgres) async fn has_raw_transaction_signature( .await; return match query_result { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!( "postgres canonical transaction signature lookup failed: {error}" ))), }; @@ -73,7 +73,7 @@ pub(in crate::postgres) async fn has_raw_transaction_signature( pub(in crate::postgres) async fn has_transaction_observation_key( pool: &sqlx::PgPool, observation_key: &str, -) -> kb_core::Result { +) -> ks_core::Result { let validation_result = crate::postgres::query::raw_queries::validate_required_text( observation_key, "transaction observation key must not be empty", @@ -89,7 +89,7 @@ pub(in crate::postgres) async fn has_transaction_observation_key( .await; return match query_result { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!( "postgres transaction observation lookup failed: {error}" ))), }; @@ -98,7 +98,7 @@ pub(in crate::postgres) async fn has_transaction_observation_key( pub(in crate::postgres) async fn insert_raw_transaction( pool: &sqlx::PgPool, input: &crate::RawTransactionInsert, -) -> kb_core::Result { +) -> ks_core::Result { let slot_result = crate::postgres::query::raw_queries::sql_slot_from_u64(input.slot); let slot = match slot_result { std::result::Result::Ok(value) => value, @@ -108,7 +108,7 @@ pub(in crate::postgres) async fn insert_raw_transaction( let canonical_format_version = match version_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "canonical transaction format version does not fit into SQL INTEGER: {error}" ))); }, @@ -130,7 +130,7 @@ pub(in crate::postgres) async fn insert_raw_transaction( std::result::Result::Ok(std::option::Option::None) => { std::result::Result::Ok(crate::InsertOutcome::new(0, 0, 1)) }, - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!( "postgres canonical transaction insert failed: {error}" ))), }; @@ -139,7 +139,7 @@ pub(in crate::postgres) async fn insert_raw_transaction( pub(in crate::postgres) async fn insert_transaction_observation( pool: &sqlx::PgPool, input: &crate::TransactionObservationInsert, -) -> kb_core::Result { +) -> ks_core::Result { let slot_result = crate::postgres::query::raw_queries::optional_sql_slot_from_u64(input.slot); let slot = match slot_result { std::result::Result::Ok(value) => value, @@ -187,7 +187,7 @@ pub(in crate::postgres) async fn insert_transaction_observation( std::result::Result::Ok(std::option::Option::None) => { std::result::Result::Ok(crate::InsertOutcome::new(0, 0, 1)) }, - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!( "postgres transaction observation insert failed: {error}" ))), }; @@ -196,9 +196,9 @@ pub(in crate::postgres) async fn insert_transaction_observation( pub(in crate::postgres) async fn update_raw_payload_lifecycle( pool: &sqlx::PgPool, mark: &crate::RawPayloadLifecycleMark, -) -> kb_core::Result { +) -> ks_core::Result { if mark.raw_table_name != crate::RAW_TRANSACTIONS_TABLE_NAME { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "raw lifecycle table name is not supported by the PostgreSQL canonical raw store", )); } @@ -249,11 +249,11 @@ fn transaction_observation_status_to_sql( }; } -fn sql_slot_from_u64(slot: u64) -> kb_core::Result { +fn sql_slot_from_u64(slot: u64) -> ks_core::Result { let conversion_result = i64::try_from(slot); return match conversion_result { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!( "Solana slot does not fit into PostgreSQL BIGINT: {error}" ))), }; @@ -261,13 +261,13 @@ fn sql_slot_from_u64(slot: u64) -> kb_core::Result { fn optional_sql_slot_from_u64( slot: std::option::Option, -) -> kb_core::Result> { +) -> ks_core::Result> { return crate::postgres::query::raw_queries::optional_sql_bigint_from_u64(slot); } fn optional_sql_bigint_from_u64( value: std::option::Option, -) -> kb_core::Result> { +) -> ks_core::Result> { return match value { std::option::Option::Some(raw_value) => { let conversion_result = i64::try_from(raw_value); @@ -275,7 +275,7 @@ fn optional_sql_bigint_from_u64( std::result::Result::Ok(converted) => { std::result::Result::Ok(std::option::Option::Some(converted)) }, - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db( format!("unsigned value does not fit into PostgreSQL BIGINT: {error}"), )), } @@ -284,9 +284,9 @@ fn optional_sql_bigint_from_u64( }; } -fn validate_required_text(value: &str, message: &str) -> kb_core::Result<()> { +fn validate_required_text(value: &str, message: &str) -> ks_core::Result<()> { if value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db(message)); + return std::result::Result::Err(ks_core::Error::db(message)); } return std::result::Result::Ok(()); } @@ -294,7 +294,7 @@ fn validate_required_text(value: &str, message: &str) -> kb_core::Result<()> { async fn update_raw_transaction_lifecycle( pool: &sqlx::PgPool, mark: &crate::RawPayloadLifecycleMark, -) -> kb_core::Result { +) -> ks_core::Result { let retention_state = crate::postgres::query::raw_queries::raw_retention_state_to_sql(mark.retention_state); let processing_state = @@ -317,7 +317,7 @@ async fn update_raw_transaction_lifecycle( fn outcome_from_update_result( query_result: std::result::Result, error_prefix: &str, -) -> kb_core::Result { +) -> ks_core::Result { return match query_result { std::result::Result::Ok(result) => { let rows_affected = result.rows_affected(); @@ -327,7 +327,7 @@ fn outcome_from_update_result( std::result::Result::Ok(crate::InsertOutcome::new(0, rows_affected, 0)) }, std::result::Result::Err(error) => { - std::result::Result::Err(kb_core::Error::db(format!("{error_prefix}: {error}"))) + std::result::Result::Err(ks_core::Error::db(format!("{error_prefix}: {error}"))) }, }; } @@ -420,7 +420,7 @@ mod tests { assert_eq!(duplicate_outcome.skipped_count, 1); let has_result = crate::RawTransactionStore::has_raw_transaction_signature( &store, - &kb_lib::MdSignature(signature.clone()), + &ks_lib::MdSignature(signature.clone()), ) .await; let has_signature = match has_result { diff --git a/kb-store/src/postgres/query/replay_candidate_queries.rs b/ks-store/src/postgres/query/replay_candidate_queries.rs similarity index 97% rename from kb-store/src/postgres/query/replay_candidate_queries.rs rename to ks-store/src/postgres/query/replay_candidate_queries.rs index fd9f649..b408f76 100644 --- a/kb-store/src/postgres/query/replay_candidate_queries.rs +++ b/ks-store/src/postgres/query/replay_candidate_queries.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/postgres/query/replay_candidate_queries.rs -// version: 2 +// file: ks-store/src/postgres/query/replay_candidate_queries.rs +// version: 3 //! Read-only PostgreSQL queries for replay candidate discovery. @@ -45,7 +45,7 @@ struct ReplayEntitySummaryRow { pub(in crate::postgres) async fn list_replay_transaction_candidates( pool: &sqlx::PgPool, filter: &crate::PostgresReplayTransactionFilter, -) -> kb_core::Result> { +) -> ks_core::Result> { let min_slot_result = crate::postgres::query::replay_candidate_queries::optional_sql_bigint(filter.min_slot); let min_slot = match min_slot_result { @@ -86,7 +86,7 @@ pub(in crate::postgres) async fn list_replay_transaction_candidates( let rows = match query_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres replay transaction candidate query failed: {error}" ))); }, @@ -116,7 +116,7 @@ pub(in crate::postgres) async fn list_replay_transaction_candidates( pub(in crate::postgres) async fn list_replay_program_summaries( pool: &sqlx::PgPool, filter: &crate::PostgresReplayProgramFilter, -) -> kb_core::Result> { +) -> ks_core::Result> { let query_result = sqlx::query_as::( r#"WITH occurrences AS ( SELECT program_id, signature, slot, 'outer'::TEXT AS scope FROM kb_sol_core_instructions @@ -145,7 +145,7 @@ pub(in crate::postgres) async fn list_replay_program_summaries( let rows = match query_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres replay program summary query failed: {error}" ))); }, @@ -168,7 +168,7 @@ pub(in crate::postgres) async fn list_replay_program_summaries( pub(in crate::postgres) async fn list_replay_entity_summaries( pool: &sqlx::PgPool, filter: &crate::PostgresReplayEntityFilter, -) -> kb_core::Result> { +) -> ks_core::Result> { let entity_kind = filter.entity_kind.as_sql(); let query_result = sqlx::query_as::< sqlx::Postgres, @@ -207,7 +207,7 @@ pub(in crate::postgres) async fn list_replay_entity_summaries( let rows = match query_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres replay entity summary query failed: {error}" ))); }, @@ -375,7 +375,7 @@ fn transaction_candidate_sql(order: &str) -> &'static str { fn optional_sql_bigint( value: std::option::Option, -) -> kb_core::Result> { +) -> ks_core::Result> { return match value { std::option::Option::Some(raw_value) => { let conversion_result = i64::try_from(raw_value); @@ -383,7 +383,7 @@ fn optional_sql_bigint( std::result::Result::Ok(converted) => { std::result::Result::Ok(std::option::Option::Some(converted)) }, - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db( format!("replay candidate slot does not fit into PostgreSQL BIGINT: {error}"), )), } diff --git a/kb-store/src/postgres/query/table_diagnostics_queries.rs b/ks-store/src/postgres/query/table_diagnostics_queries.rs similarity index 91% rename from kb-store/src/postgres/query/table_diagnostics_queries.rs rename to ks-store/src/postgres/query/table_diagnostics_queries.rs index 61d1a5f..05314ca 100644 --- a/kb-store/src/postgres/query/table_diagnostics_queries.rs +++ b/ks-store/src/postgres/query/table_diagnostics_queries.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/postgres/query/table_diagnostics_queries.rs -// version: 2 +// file: ks-store/src/postgres/query/table_diagnostics_queries.rs +// version: 3 //! Read-only PostgreSQL diagnostics for known Solana store tables. @@ -8,7 +8,7 @@ use sqlx::Row; // rust-rules: trait-import pub(in crate::postgres) async fn table_exists( pool: &sqlx::PgPool, table_name: &str, -) -> kb_core::Result { +) -> ks_core::Result { let query_result = sqlx::query_scalar::("SELECT to_regclass($1)::text IS NOT NULL") .bind(table_name) @@ -16,7 +16,7 @@ pub(in crate::postgres) async fn table_exists( .await; return match query_result { std::result::Result::Ok(value) => std::result::Result::Ok(value), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db(format!( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db(format!( "postgres table existence diagnostic failed for '{table_name}': {error}" ))), }; @@ -25,7 +25,7 @@ pub(in crate::postgres) async fn table_exists( pub(in crate::postgres) async fn load_table_statistics( pool: &sqlx::PgPool, table_name: &str, -) -> kb_core::Result { +) -> ks_core::Result { return match table_name { crate::RAW_TRANSACTIONS_TABLE_NAME => { crate::postgres::query::table_diagnostics_queries::load_table_statistics_from_sql( @@ -131,7 +131,7 @@ pub(in crate::postgres) async fn load_table_statistics( ) .await }, - _ => std::result::Result::Err(kb_core::Error::db(format!( + _ => std::result::Result::Err(ks_core::Error::db(format!( "postgres table statistics are not supported for '{table_name}'" ))), }; @@ -141,12 +141,12 @@ async fn load_table_statistics_from_sql( pool: &sqlx::PgPool, sql: &'static str, table_name: &str, -) -> kb_core::Result { +) -> ks_core::Result { let query_result = sqlx::query(sql).fetch_one(pool).await; let row = match query_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres table statistics failed for '{table_name}': {error}" ))); }, @@ -155,7 +155,7 @@ async fn load_table_statistics_from_sql( let row_count = match row_count_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres table row_count mapping failed for '{table_name}': {error}" ))); }, @@ -164,7 +164,7 @@ async fn load_table_statistics_from_sql( let min_slot = match min_slot_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres table min_slot mapping failed for '{table_name}': {error}" ))); }, @@ -173,7 +173,7 @@ async fn load_table_statistics_from_sql( let max_slot = match max_slot_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres table max_slot mapping failed for '{table_name}': {error}" ))); }, @@ -183,7 +183,7 @@ async fn load_table_statistics_from_sql( let latest_created_at = match latest_created_at_result { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "postgres table latest_created_at mapping failed for '{table_name}': {error}" ))); }, diff --git a/kb-store/src/postgres/replay_candidates.rs b/ks-store/src/postgres/replay_candidates.rs similarity index 96% rename from kb-store/src/postgres/replay_candidates.rs rename to ks-store/src/postgres/replay_candidates.rs index 8de07a4..04a1d8f 100644 --- a/kb-store/src/postgres/replay_candidates.rs +++ b/ks-store/src/postgres/replay_candidates.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/postgres/replay_candidates.rs -// version: 2 +// file: ks-store/src/postgres/replay_candidates.rs +// version: 3 //! Read-only replay candidate filters and PostgreSQL result rows. @@ -95,7 +95,7 @@ impl PostgresReplayTransactionFilter { entity_value: std::option::Option, limit: u32, newest_first: bool, - ) -> kb_core::Result { + ) -> ks_core::Result { let signature_contains_value = trim_optional_text(signature_contains); let raw_processing_state_value = trim_optional_text(raw_processing_state); let ledger_status_value = trim_optional_text(ledger_status); @@ -126,7 +126,7 @@ impl PostgresReplayTransactionFilter { return std::result::Result::Err(error); } if entity_kind.is_some() != entity_value_value.is_some() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "replay entity kind and value must either both be present or both be absent", )); } @@ -193,7 +193,7 @@ impl PostgresReplayProgramFilter { pub fn new( program_id_contains: std::option::Option, limit: u32, - ) -> kb_core::Result { + ) -> ks_core::Result { let limit_result = validate_limit(limit); if let std::result::Result::Err(error) = limit_result { return std::result::Result::Err(error); @@ -241,7 +241,7 @@ impl PostgresReplayEntityFilter { entity_kind: crate::PostgresReplayEntityKind, entity_value_contains: std::option::Option, limit: u32, - ) -> kb_core::Result { + ) -> ks_core::Result { let limit_result = validate_limit(limit); if let std::result::Result::Err(error) = limit_result { return std::result::Result::Err(error); @@ -289,12 +289,12 @@ fn trim_optional_text( fn validate_slot_range( min_slot: std::option::Option, max_slot: std::option::Option, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { if let (std::option::Option::Some(minimum), std::option::Option::Some(maximum)) = (min_slot, max_slot) { if minimum > maximum { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "replay candidate minimum slot must not exceed maximum slot", )); } @@ -302,9 +302,9 @@ fn validate_slot_range( return std::result::Result::Ok(()); } -fn validate_limit(limit: u32) -> kb_core::Result<()> { +fn validate_limit(limit: u32) -> ks_core::Result<()> { if limit == 0 || limit > crate::MAX_REPLAY_CANDIDATE_ROWS { - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "replay candidate limit must be between 1 and {}", crate::MAX_REPLAY_CANDIDATE_ROWS ))); @@ -316,7 +316,7 @@ fn validate_optional_code( value: std::option::Option<&str>, allowed: &[&str], label: &str, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let selected = match value { std::option::Option::Some(code) => code, std::option::Option::None => return std::result::Result::Ok(()), @@ -326,7 +326,7 @@ fn validate_optional_code( return std::result::Result::Ok(()); } } - return std::result::Result::Err(kb_core::Error::db(format!( + return std::result::Result::Err(ks_core::Error::db(format!( "unsupported {label}: {selected}" ))); } diff --git a/kb-store/src/postgres/repository.rs b/ks-store/src/postgres/repository.rs similarity index 77% rename from kb-store/src/postgres/repository.rs rename to ks-store/src/postgres/repository.rs index e975d77..8ff7000 100644 --- a/kb-store/src/postgres/repository.rs +++ b/ks-store/src/postgres/repository.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/postgres/repository.rs -// version: 1 +// file: ks-store/src/postgres/repository.rs +// version: 2 //! PostgreSQL repository implementations. diff --git a/kb-store/src/postgres/repository/core_extraction_repository.rs b/ks-store/src/postgres/repository/core_extraction_repository.rs similarity index 86% rename from kb-store/src/postgres/repository/core_extraction_repository.rs rename to ks-store/src/postgres/repository/core_extraction_repository.rs index 9ddf285..950babb 100644 --- a/kb-store/src/postgres/repository/core_extraction_repository.rs +++ b/ks-store/src/postgres/repository/core_extraction_repository.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/postgres/repository/core_extraction_repository.rs -// version: 1 +// file: ks-store/src/postgres/repository/core_extraction_repository.rs +// version: 2 //! PostgreSQL atomic canonical transaction to core extraction repository. @@ -12,7 +12,7 @@ impl crate::CoreExtractionStore for crate::PostgresStore { async fn list_raw_transactions_for_core_extraction( &self, filter: &crate::CoreExtractionSelectionFilter, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return crate::postgres::query::list_raw_transactions_for_core_extraction( self.pool(), filter, @@ -27,7 +27,7 @@ impl crate::CoreExtractionStore for crate::PostgresStore { async fn is_core_extraction_current( &self, identity: &crate::ProcessingLedgerIdentity, - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::is_core_extraction_current(self.pool(), identity).await; } @@ -39,7 +39,7 @@ impl crate::CoreExtractionStore for crate::PostgresStore { &self, bundle: &crate::CoreExtractionBundle, force_replay: bool, - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::persist_core_extraction(self.pool(), bundle, force_replay) .await; } @@ -51,7 +51,7 @@ impl crate::CoreExtractionStore for crate::PostgresStore { async fn mark_core_extraction_failed( &self, failure: &crate::CoreExtractionFailure, - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::mark_core_extraction_failed(self.pool(), failure).await; } } diff --git a/kb-store/src/postgres/repository/core_transaction_repository.rs b/ks-store/src/postgres/repository/core_transaction_repository.rs similarity index 86% rename from kb-store/src/postgres/repository/core_transaction_repository.rs rename to ks-store/src/postgres/repository/core_transaction_repository.rs index 4e4ff84..b4a9681 100644 --- a/kb-store/src/postgres/repository/core_transaction_repository.rs +++ b/ks-store/src/postgres/repository/core_transaction_repository.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/postgres/repository/core_transaction_repository.rs -// version: 1 +// file: ks-store/src/postgres/repository/core_transaction_repository.rs +// version: 2 //! PostgreSQL core Solana repository implementation. @@ -12,7 +12,7 @@ impl crate::CoreTransactionStore for crate::PostgresStore { async fn insert_core_transaction( &self, input: &crate::CoreTransactionInsert, - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::insert_core_transaction(self.pool(), input).await; } @@ -23,7 +23,7 @@ impl crate::CoreTransactionStore for crate::PostgresStore { async fn insert_core_account_keys( &self, inputs: &[crate::CoreAccountKeyInsert], - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::insert_core_account_keys(self.pool(), inputs).await; } @@ -34,7 +34,7 @@ impl crate::CoreTransactionStore for crate::PostgresStore { async fn insert_core_instructions( &self, inputs: &[crate::CoreInstructionInsert], - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::insert_core_instructions(self.pool(), inputs).await; } @@ -45,7 +45,7 @@ impl crate::CoreTransactionStore for crate::PostgresStore { async fn insert_core_inner_instructions( &self, inputs: &[crate::CoreInnerInstructionInsert], - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::insert_core_inner_instructions(self.pool(), inputs).await; } @@ -56,7 +56,7 @@ impl crate::CoreTransactionStore for crate::PostgresStore { async fn insert_core_logs( &self, inputs: &[crate::CoreLogInsert], - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::insert_core_logs(self.pool(), inputs).await; } @@ -67,7 +67,7 @@ impl crate::CoreTransactionStore for crate::PostgresStore { async fn insert_core_balance_changes( &self, inputs: &[crate::CoreBalanceChangeInsert], - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::insert_core_balance_changes(self.pool(), inputs).await; } @@ -79,7 +79,7 @@ impl crate::CoreTransactionStore for crate::PostgresStore { &self, filter: &crate::CoreInstructionReplayFilter, page_request: &crate::PageRequest, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return crate::postgres::query::list_core_instructions_for_replay( self.pool(), filter, @@ -96,7 +96,7 @@ impl crate::CoreTransactionStore for crate::PostgresStore { &self, filter: &crate::CoreInstructionReplayFilter, page_request: &crate::PageRequest, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return crate::postgres::query::list_core_instruction_replay_inputs( self.pool(), filter, @@ -112,7 +112,7 @@ impl crate::CoreTransactionStore for crate::PostgresStore { async fn mark_core_instruction_lifecycle( &self, mark: &crate::CoreInstructionLifecycleMark, - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::update_core_instruction_lifecycle(self.pool(), mark).await; } } diff --git a/kb-store/src/postgres/repository/decode_pipeline_repository.rs b/ks-store/src/postgres/repository/decode_pipeline_repository.rs similarity index 87% rename from kb-store/src/postgres/repository/decode_pipeline_repository.rs rename to ks-store/src/postgres/repository/decode_pipeline_repository.rs index 489d668..a54bed9 100644 --- a/kb-store/src/postgres/repository/decode_pipeline_repository.rs +++ b/ks-store/src/postgres/repository/decode_pipeline_repository.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/postgres/repository/decode_pipeline_repository.rs -// version: 1 +// file: ks-store/src/postgres/repository/decode_pipeline_repository.rs +// version: 2 //! PostgreSQL contextual decode and materialization repository. @@ -12,7 +12,7 @@ impl crate::DecodePipelineStore for crate::PostgresStore { async fn list_decode_inputs( &self, filter: &crate::DecodeSelectionFilter, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return crate::postgres::query::list_decode_inputs(self.pool(), filter).await; } @@ -23,7 +23,7 @@ impl crate::DecodePipelineStore for crate::PostgresStore { async fn is_decode_current( &self, identity: &crate::ProcessingLedgerIdentity, - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::is_decode_current(self.pool(), identity).await; } @@ -34,7 +34,7 @@ impl crate::DecodePipelineStore for crate::PostgresStore { async fn persist_decode_coverage_declarations( &self, declarations: &[crate::DecodeCoverageDeclarationInsert], - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::persist_decode_coverage_declarations( self.pool(), declarations, @@ -50,7 +50,7 @@ impl crate::DecodePipelineStore for crate::PostgresStore { &self, bundle: &crate::DecodePersistenceBundle, force_replay: bool, - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::persist_decode_result(self.pool(), bundle, force_replay) .await; } @@ -62,7 +62,7 @@ impl crate::DecodePipelineStore for crate::PostgresStore { async fn mark_decode_failed( &self, failure: &crate::DecodeFailure, - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::mark_decode_failed(self.pool(), failure).await; } @@ -74,7 +74,7 @@ impl crate::DecodePipelineStore for crate::PostgresStore { &self, bundle: &crate::MaterializationPersistenceBundle, force_replay: bool, - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::persist_materialization_result( self.pool(), bundle, @@ -92,7 +92,7 @@ impl crate::DecodePipelineStore for crate::PostgresStore { processor_name: std::option::Option<&str>, processor_version: std::option::Option<&str>, limit: u32, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return crate::postgres::query::list_decode_coverage_summary( self.pool(), processor_name, @@ -109,7 +109,7 @@ impl crate::DecodePipelineStore for crate::PostgresStore { async fn list_materialized_events( &self, filter: &crate::MaterializedEventFilter, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return crate::postgres::query::list_materialized_events(self.pool(), filter).await; } } diff --git a/kb-store/src/postgres/repository/raw_transaction_repository.rs b/ks-store/src/postgres/repository/raw_transaction_repository.rs similarity index 86% rename from kb-store/src/postgres/repository/raw_transaction_repository.rs rename to ks-store/src/postgres/repository/raw_transaction_repository.rs index f7a0cde..f735ea3 100644 --- a/kb-store/src/postgres/repository/raw_transaction_repository.rs +++ b/ks-store/src/postgres/repository/raw_transaction_repository.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/postgres/repository/raw_transaction_repository.rs -// version: 1 +// file: ks-store/src/postgres/repository/raw_transaction_repository.rs +// version: 2 //! PostgreSQL canonical transaction and acquisition observation repository implementation. @@ -11,8 +11,8 @@ impl crate::RawTransactionStore for crate::PostgresStore { )] async fn has_raw_transaction_signature( &self, - signature: &kb_lib::MdSignature, - ) -> kb_core::Result { + signature: &ks_lib::MdSignature, + ) -> ks_core::Result { return crate::postgres::query::has_raw_transaction_signature( self.pool(), signature.0.as_str(), @@ -27,7 +27,7 @@ impl crate::RawTransactionStore for crate::PostgresStore { async fn has_transaction_observation_key( &self, observation_key: &str, - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::has_transaction_observation_key( self.pool(), observation_key, @@ -42,7 +42,7 @@ impl crate::RawTransactionStore for crate::PostgresStore { async fn insert_raw_transaction( &self, input: &crate::RawTransactionInsert, - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::insert_raw_transaction(self.pool(), input).await; } @@ -53,7 +53,7 @@ impl crate::RawTransactionStore for crate::PostgresStore { async fn insert_transaction_observation( &self, input: &crate::TransactionObservationInsert, - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::insert_transaction_observation(self.pool(), input).await; } @@ -64,7 +64,7 @@ impl crate::RawTransactionStore for crate::PostgresStore { async fn mark_raw_payload_lifecycle( &self, mark: &crate::RawPayloadLifecycleMark, - ) -> kb_core::Result { + ) -> ks_core::Result { return crate::postgres::query::update_raw_payload_lifecycle(self.pool(), mark).await; } } diff --git a/kb-store/src/postgres/repository/store_health_repository.rs b/ks-store/src/postgres/repository/store_health_repository.rs similarity index 77% rename from kb-store/src/postgres/repository/store_health_repository.rs rename to ks-store/src/postgres/repository/store_health_repository.rs index 7eba30f..4a08e3b 100644 --- a/kb-store/src/postgres/repository/store_health_repository.rs +++ b/ks-store/src/postgres/repository/store_health_repository.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/postgres/repository/store_health_repository.rs -// version: 1 +// file: ks-store/src/postgres/repository/store_health_repository.rs +// version: 2 //! PostgreSQL store health repository implementation. @@ -9,7 +9,7 @@ impl crate::StoreHealthStore for crate::PostgresStore { clippy::implicit_return, reason = "async_trait expansion triggers implicit_return on generated async trait methods." )] - async fn backend_descriptor(&self) -> kb_core::Result { + async fn backend_descriptor(&self) -> ks_core::Result { return crate::PostgresStore::backend_descriptor(self).await; } @@ -17,7 +17,7 @@ impl crate::StoreHealthStore for crate::PostgresStore { clippy::implicit_return, reason = "async_trait expansion triggers implicit_return on generated async trait methods." )] - async fn health_snapshot(&self) -> kb_core::Result { + async fn health_snapshot(&self) -> ks_core::Result { return crate::PostgresStore::health_snapshot(self).await; } @@ -25,7 +25,7 @@ impl crate::StoreHealthStore for crate::PostgresStore { clippy::implicit_return, reason = "async_trait expansion triggers implicit_return on generated async trait methods." )] - async fn migration_snapshot(&self) -> kb_core::Result { + async fn migration_snapshot(&self) -> ks_core::Result { return crate::PostgresStore::migration_snapshot(self).await; } } diff --git a/kb-store/src/postgres/store.rs b/ks-store/src/postgres/store.rs similarity index 93% rename from kb-store/src/postgres/store.rs rename to ks-store/src/postgres/store.rs index cf0a6ef..0d00c14 100644 --- a/kb-store/src/postgres/store.rs +++ b/ks-store/src/postgres/store.rs @@ -1,7 +1,7 @@ -// file: kb-store/src/postgres/store.rs -// version: 2 +// file: ks-store/src/postgres/store.rs +// version: 3 -//! Store implementation scaffold for the `kb-store` crate. +//! Store implementation scaffold for the `ks-store` crate. /// PostgreSQL store connection options. #[derive(Clone, Debug, Eq, PartialEq)] @@ -23,20 +23,20 @@ impl PostgresStoreOptions { max_connections: u32, connect_timeout_ms: u64, auto_initialize_schema: bool, - ) -> kb_core::Result { + ) -> ks_core::Result { let database_url_value = database_url.into(); if database_url_value.trim().is_empty() { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "postgres database url must not be empty", )); } if max_connections == 0 { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "postgres max_connections must be greater than zero", )); } if connect_timeout_ms == 0 { - return std::result::Result::Err(kb_core::Error::db( + return std::result::Result::Err(ks_core::Error::db( "postgres connect_timeout_ms must be greater than zero", )); } @@ -104,7 +104,7 @@ pub struct PostgresStore { impl PostgresStore { /// Connects to PostgreSQL from typed store options. - pub async fn connect(options: crate::PostgresStoreOptions) -> kb_core::Result { + pub async fn connect(options: crate::PostgresStoreOptions) -> ks_core::Result { let pool_options = sqlx::postgres::PgPoolOptions::new() .max_connections(options.max_connections) .acquire_timeout(std::time::Duration::from_millis(options.connect_timeout_ms)); @@ -120,7 +120,7 @@ impl PostgresStore { } std::result::Result::Ok(store) }, - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::db( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::db( format!("postgres connection failed: {error}"), )), }; @@ -142,7 +142,7 @@ impl PostgresStore { } /// Applies each idempotent store schema once per invocation in dependency order. - pub async fn initialize_store_schema(&self) -> kb_core::Result<()> { + pub async fn initialize_store_schema(&self) -> ks_core::Result<()> { let raw_result = crate::postgres::query::apply_raw_store_schema(&self.pool).await; if let std::result::Result::Err(error) = raw_result { return std::result::Result::Err(error); @@ -155,12 +155,12 @@ impl PostgresStore { } /// Applies the idempotent minimal raw Solana store schema. - pub async fn initialize_raw_store_schema(&self) -> kb_core::Result<()> { + pub async fn initialize_raw_store_schema(&self) -> ks_core::Result<()> { return crate::postgres::query::apply_raw_store_schema(&self.pool).await; } /// Applies the idempotent minimal core Solana store schema. - pub async fn initialize_core_store_schema(&self) -> kb_core::Result<()> { + pub async fn initialize_core_store_schema(&self) -> ks_core::Result<()> { let raw_result = self.initialize_raw_store_schema().await; if let std::result::Result::Err(error) = raw_result { return std::result::Result::Err(error); @@ -169,7 +169,7 @@ impl PostgresStore { } /// Applies the idempotent common decode and materialization store schema. - pub async fn initialize_decode_store_schema(&self) -> kb_core::Result<()> { + pub async fn initialize_decode_store_schema(&self) -> ks_core::Result<()> { let core_result = self.initialize_core_store_schema().await; if let std::result::Result::Err(error) = core_result { return std::result::Result::Err(error); @@ -178,7 +178,7 @@ impl PostgresStore { } /// Reads a UI-safe backend descriptor. - pub async fn backend_descriptor(&self) -> kb_core::Result { + pub async fn backend_descriptor(&self) -> ks_core::Result { let schema_result = crate::postgres::query::load_current_schema(&self.pool).await; return match schema_result { std::result::Result::Ok(schema) => crate::StoreBackendDescriptor::new( @@ -192,7 +192,7 @@ impl PostgresStore { } /// Reads a PostgreSQL health snapshot. - pub async fn health_snapshot(&self) -> kb_core::Result { + pub async fn health_snapshot(&self) -> ks_core::Result { let health_result = crate::postgres::query::run_health_check(&self.pool).await; return match health_result { std::result::Result::Ok(()) => crate::StoreHealthSnapshot::new( @@ -209,7 +209,7 @@ impl PostgresStore { } /// Reads a non-destructive migration snapshot. - pub async fn migration_snapshot(&self) -> kb_core::Result { + pub async fn migration_snapshot(&self) -> ks_core::Result { let migration_table_result = crate::postgres::query::load_migration_table_name(&self.pool).await; return match migration_table_result { @@ -231,7 +231,7 @@ impl PostgresStore { } /// Reads a complete PostgreSQL diagnostic snapshot. - pub async fn backend_diagnostics(&self) -> kb_core::Result { + pub async fn backend_diagnostics(&self) -> ks_core::Result { let descriptor_result = self.backend_descriptor().await; let descriptor = match descriptor_result { std::result::Result::Ok(value) => value, @@ -263,7 +263,7 @@ impl PostgresStore { pub async fn replay_transaction_candidates( &self, filter: &crate::PostgresReplayTransactionFilter, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return crate::postgres::query::list_replay_transaction_candidates(&self.pool, filter) .await; } @@ -272,7 +272,7 @@ impl PostgresStore { pub async fn replay_program_summaries( &self, filter: &crate::PostgresReplayProgramFilter, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return crate::postgres::query::list_replay_program_summaries(&self.pool, filter).await; } @@ -280,14 +280,14 @@ impl PostgresStore { pub async fn replay_entity_summaries( &self, filter: &crate::PostgresReplayEntityFilter, - ) -> kb_core::Result> { + ) -> ks_core::Result> { return crate::postgres::query::list_replay_entity_summaries(&self.pool, filter).await; } /// Reads diagnostics for raw Solana store tables without changing the schema. pub async fn raw_table_diagnostics( &self, - ) -> kb_core::Result> { + ) -> ks_core::Result> { let specs = crate::raw_store_table_diagnostic_specs(); return self.table_diagnostics(&specs).await; } @@ -295,7 +295,7 @@ impl PostgresStore { /// Reads diagnostics for core Solana store tables without changing the schema. pub async fn core_table_diagnostics( &self, - ) -> kb_core::Result> { + ) -> ks_core::Result> { let specs = crate::core_store_table_diagnostic_specs(); return self.table_diagnostics(&specs).await; } @@ -303,7 +303,7 @@ impl PostgresStore { /// Reads diagnostics for decode and materialization store tables without changing the schema. pub async fn decode_table_diagnostics( &self, - ) -> kb_core::Result> { + ) -> ks_core::Result> { let specs = crate::decode_store_table_diagnostic_specs(); return self.table_diagnostics(&specs).await; } @@ -311,7 +311,7 @@ impl PostgresStore { /// Reads diagnostics for every known raw/core/decode Solana store table. pub async fn known_table_diagnostics( &self, - ) -> kb_core::Result> { + ) -> ks_core::Result> { let mut diagnostics = std::vec::Vec::new(); let raw_result = self.raw_table_diagnostics().await; let raw_tables = match raw_result { @@ -343,7 +343,7 @@ impl PostgresStore { async fn table_diagnostics( &self, specs: &[crate::PostgresTableDiagnosticSpec], - ) -> kb_core::Result> { + ) -> ks_core::Result> { let mut diagnostics = std::vec::Vec::new(); for spec in specs { let exists_result = @@ -376,7 +376,7 @@ impl PostgresStore { async fn migration_snapshot_from_existing_table( &self, - ) -> kb_core::Result { + ) -> ks_core::Result { let version_result = crate::postgres::query::load_latest_migration_version(&self.pool).await; return match version_result { diff --git a/kb-store/src/postgres/test_serial.rs b/ks-store/src/postgres/test_serial.rs similarity index 90% rename from kb-store/src/postgres/test_serial.rs rename to ks-store/src/postgres/test_serial.rs index 0e68400..fd125bd 100644 --- a/kb-store/src/postgres/test_serial.rs +++ b/ks-store/src/postgres/test_serial.rs @@ -1,5 +1,5 @@ -// file: kb-store/src/postgres/test_serial.rs -// version: 1 +// file: ks-store/src/postgres/test_serial.rs +// version: 2 //! Test-only serialization helpers for optional real PostgreSQL tests. diff --git a/kb-wallet/CHANGELOG.md b/ks-wallet/CHANGELOG.md similarity index 81% rename from kb-wallet/CHANGELOG.md rename to ks-wallet/CHANGELOG.md index 89b66a6..b619c86 100644 --- a/kb-wallet/CHANGELOG.md +++ b/ks-wallet/CHANGELOG.md @@ -1,7 +1,12 @@ - - + + -# CHANGELOG — kb-wallet +# CHANGELOG — ks-wallet + +## `0.5.1-pre.002` + +- renomme `kb-wallet` en `ks-wallet` et `kb_wallet` en `ks_wallet` ; +- aligne le target racine de tracing et les consommateurs sans modifier le format persistant des wallets, réservé à `0.5.2`. ## `0.5.0-pre.002` @@ -32,7 +37,7 @@ ## 0.1.0-pre.062 -- migration et renommage du wallet temporaire vers `kb-wallet` ; +- migration et renommage du wallet temporaire vers `ks-wallet` ; - conservation des alias validés, keypairs temporaires et stockage local ; - ajout des contrôles de permissions, type de fichier et effacement des buffers secrets ; - adaptation aux normes Rust 2024 et Khadhroony bot3. diff --git a/kb-wallet/Cargo.toml b/ks-wallet/Cargo.toml similarity index 79% rename from kb-wallet/Cargo.toml rename to ks-wallet/Cargo.toml index 6115858..e2cc4ad 100644 --- a/kb-wallet/Cargo.toml +++ b/ks-wallet/Cargo.toml @@ -1,15 +1,15 @@ -# file: kb-wallet/Cargo.toml -# version: 2 +# file: ks-wallet/Cargo.toml +# version: 3 [package] -name = "kb-wallet" +name = "ks-wallet" version.workspace = true edition.workspace = true license.workspace = true publish.workspace = true [dependencies] -kb-core = { path = "../kb-core" } +ks-core = { path = "../ks-core" } serde_json.workspace = true solana-keypair.workspace = true solana-signer.workspace = true diff --git a/kb-wallet/README.md b/ks-wallet/README.md similarity index 81% rename from kb-wallet/README.md rename to ks-wallet/README.md index 18a1735..05c9cdd 100644 --- a/kb-wallet/README.md +++ b/ks-wallet/README.md @@ -1,9 +1,9 @@ - - + + -# kb-wallet +# ks-wallet -`kb-wallet` fournit actuellement une frontière locale minimale de portefeuille pour les démonstrations et tests d’intégration. +`ks-wallet` fournit actuellement une frontière locale minimale de portefeuille pour les démonstrations et tests d’intégration. ## État actuel @@ -36,7 +36,7 @@ Les fonctions suivantes ne sont pas encore implémentées : ## Relations -`kb-wallet` fournit un signer. Les limites de dépense, la simulation, l’autorisation opérateur et l’envoi sont gérés par `kb-lib`, `kb-pipeline-demo-scenarios` et les applications. +`ks-wallet` fournit un signer. Les limites de dépense, la simulation, l’autorisation opérateur et l’envoi sont gérés par `ks-lib`, `ks-pipeline-demo-scenarios` et les applications. ## Documentation diff --git a/kb-wallet/TODO.md b/ks-wallet/TODO.md similarity index 94% rename from kb-wallet/TODO.md rename to ks-wallet/TODO.md index 655a461..0ac1540 100644 --- a/kb-wallet/TODO.md +++ b/ks-wallet/TODO.md @@ -1,7 +1,7 @@ - - + + -# TODO — kb-wallet +# TODO — ks-wallet ## Série `0.5.x` diff --git a/kb-wallet/USAGE.md b/ks-wallet/USAGE.md similarity index 91% rename from kb-wallet/USAGE.md rename to ks-wallet/USAGE.md index bb797cf..dfdf5b0 100644 --- a/kb-wallet/USAGE.md +++ b/ks-wallet/USAGE.md @@ -1,7 +1,7 @@ - - + + -# Utilisation de kb-wallet +# Utilisation de ks-wallet ## Objectif @@ -10,7 +10,7 @@ La crate fournit des wallets temporaires en mémoire ou persistés localement po ## Valider un alias ```rust -let alias = match kb_wallet::WalletAlias::parse( +let alias = match ks_wallet::WalletAlias::parse( "devnet-operator", ) { std::result::Result::Ok(value) => value, @@ -27,7 +27,7 @@ Un alias doit contenir entre 1 et 64 octets, commencer par un caractère alphanu ## Générer un wallet en mémoire ```rust -let alias = match kb_wallet::WalletAlias::parse( +let alias = match ks_wallet::WalletAlias::parse( "ephemeral", ) { std::result::Result::Ok(value) => value, @@ -37,7 +37,7 @@ let alias = match kb_wallet::WalletAlias::parse( }; let wallet = - kb_wallet::TemporaryWallet::generate(alias); + ks_wallet::TemporaryWallet::generate(alias); let summary = wallet.summary(); assert!(summary.storage_path.is_none()); @@ -66,7 +66,7 @@ Pour une API async qui conserve la référence au travers d’un `await` et impo ## Créer un stockage local ```rust -let store = match kb_wallet::TemporaryWalletStore::new( +let store = match ks_wallet::TemporaryWalletStore::new( "./data/wallets", ) { std::result::Result::Ok(value) => value, @@ -84,7 +84,7 @@ println!( ## Créer un wallet persistant ```rust -let alias = match kb_wallet::WalletAlias::parse( +let alias = match ks_wallet::WalletAlias::parse( "devnet-payer", ) { std::result::Result::Ok(value) => value, @@ -109,7 +109,7 @@ assert!(summary.storage_path.is_some()); ## Charger ou créer atomiquement ```rust -let alias = match kb_wallet::WalletAlias::parse( +let alias = match ks_wallet::WalletAlias::parse( "shared-devnet", ) { std::result::Result::Ok(value) => value, @@ -145,7 +145,7 @@ println!("path={}, exists={exists}", path.display()); ## Politique non secrète ```rust -let policy = kb_wallet::WalletPolicy { +let policy = ks_wallet::WalletPolicy { signing_enabled: true, lamport_spend_limit: std::option::Option::Some( 1_000_000, diff --git a/kb-wallet/src/constants.rs b/ks-wallet/src/constants.rs similarity index 53% rename from kb-wallet/src/constants.rs rename to ks-wallet/src/constants.rs index e44dd07..fce342d 100644 --- a/kb-wallet/src/constants.rs +++ b/ks-wallet/src/constants.rs @@ -1,9 +1,9 @@ -// file: kb-wallet/src/constants.rs -// version: 1 +// file: ks-wallet/src/constants.rs +// version: 2 -//! Local constants for the `kb-wallet` crate. +//! Local constants for the `ks-wallet` crate. /// Canonical tracing target for this crate. -pub(crate) const TRACING_TARGET: &str = "kb-wallet"; +pub(crate) const TRACING_TARGET: &str = "ks-wallet"; /// Number of bytes stored by the standard Solana keypair JSON format. pub(crate) const SOLANA_KEYPAIR_LENGTH: usize = 64; diff --git a/kb-wallet/src/lib.rs b/ks-wallet/src/lib.rs similarity index 94% rename from kb-wallet/src/lib.rs rename to ks-wallet/src/lib.rs index 54ceddd..5f72fa6 100644 --- a/kb-wallet/src/lib.rs +++ b/ks-wallet/src/lib.rs @@ -1,5 +1,5 @@ -// file: kb-wallet/src/lib.rs -// version: 2 +// file: ks-wallet/src/lib.rs +// version: 3 //! Wallet boundary for local key storage and transaction signing. #![warn(missing_docs)] diff --git a/kb-wallet/src/wallet.rs b/ks-wallet/src/wallet.rs similarity index 92% rename from kb-wallet/src/wallet.rs rename to ks-wallet/src/wallet.rs index 71208a3..83c4b9c 100644 --- a/kb-wallet/src/wallet.rs +++ b/ks-wallet/src/wallet.rs @@ -1,5 +1,5 @@ -// file: kb-wallet/src/wallet.rs -// version: 9 +// file: ks-wallet/src/wallet.rs +// version: 10 //! Local wallet storage and signing primitives. @@ -12,10 +12,10 @@ pub struct WalletAlias(std::string::String); impl crate::WalletAlias { /// Parses and validates a wallet alias. - pub fn parse(value: impl std::convert::Into) -> kb_core::Result { + pub fn parse(value: impl std::convert::Into) -> ks_core::Result { let value = value.into(); if value.is_empty() || value.len() > 64 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_alias_length_invalid", "wallet alias length must be between 1 and 64 bytes", )); @@ -23,7 +23,7 @@ impl crate::WalletAlias { if !value.bytes().enumerate().all(|(index, byte)| { return byte.is_ascii_alphanumeric() || (index > 0 && (byte == b'_' || byte == b'-')); }) { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_alias_invalid", "wallet alias must start with an ASCII letter or digit and contain only ASCII letters, digits, '_' or '-'", )); @@ -110,11 +110,11 @@ impl crate::TemporaryWallet { } /// Signs arbitrary message bytes and returns the base58 signature. - pub fn sign_message(&self, message: &[u8]) -> kb_core::Result { + pub fn sign_message(&self, message: &[u8]) -> ks_core::Result { let signature = match self.keypair.try_sign_message(message) { std::result::Result::Ok(signature) => signature, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_message_sign_failed", error.to_string(), )); @@ -140,10 +140,10 @@ pub struct TemporaryWalletStore { impl crate::TemporaryWalletStore { /// Creates a wallet store rooted at the supplied directory. - pub fn new(directory: impl std::convert::Into) -> kb_core::Result { + pub fn new(directory: impl std::convert::Into) -> ks_core::Result { let directory = directory.into(); if directory.as_os_str().is_empty() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_directory_empty", "wallet directory must not be empty", )); @@ -162,11 +162,11 @@ impl crate::TemporaryWalletStore { } /// Returns whether a persistent wallet exists for an alias. - pub async fn exists(&self, alias: &crate::WalletAlias) -> kb_core::Result { + pub async fn exists(&self, alias: &crate::WalletAlias) -> ks_core::Result { let path = self.wallet_path(alias); return match tokio::fs::try_exists(&path).await { std::result::Result::Ok(exists) => std::result::Result::Ok(exists), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "wallet_file_exists_check_failed", format!("{}: {error}", path.display()), )), @@ -177,7 +177,7 @@ impl crate::TemporaryWalletStore { pub async fn create( &self, alias: crate::WalletAlias, - ) -> kb_core::Result { + ) -> ks_core::Result { match prepare_wallet_directory(&self.directory).await { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -204,7 +204,7 @@ impl crate::TemporaryWalletStore { } /// Loads and validates an existing persistent wallet. - pub async fn load(&self, alias: crate::WalletAlias) -> kb_core::Result { + pub async fn load(&self, alias: crate::WalletAlias) -> ks_core::Result { let path = self.wallet_path(&alias); let keypair = match read_keypair(&path).await { std::result::Result::Ok(keypair) => keypair, @@ -229,7 +229,7 @@ impl crate::TemporaryWalletStore { pub async fn load_or_create( &self, alias: crate::WalletAlias, - ) -> kb_core::Result { + ) -> ks_core::Result { let exists = match self.exists(&alias).await { std::result::Result::Ok(exists) => exists, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -248,11 +248,11 @@ impl crate::TemporaryWalletStore { } } -async fn prepare_wallet_directory(directory: &std::path::Path) -> kb_core::Result<()> { +async fn prepare_wallet_directory(directory: &std::path::Path) -> ks_core::Result<()> { match tokio::fs::create_dir_all(directory).await { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_directory_create_failed", format!("{}: {error}", directory.display()), )); @@ -265,7 +265,7 @@ async fn prepare_wallet_directory(directory: &std::path::Path) -> kb_core::Resul match tokio::fs::set_permissions(directory, permissions).await { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_directory_permissions_failed", format!("{}: {error}", directory.display()), )); @@ -278,13 +278,13 @@ async fn prepare_wallet_directory(directory: &std::path::Path) -> kb_core::Resul async fn write_new_keypair( path: std::path::PathBuf, keypair: &solana_keypair::Keypair, -) -> kb_core::Result<()> { +) -> ks_core::Result<()> { let mut keypair_bytes = keypair.to_bytes(); let mut encoded = match serde_json::to_vec(keypair_bytes.as_slice()) { std::result::Result::Ok(encoded) => encoded, std::result::Result::Err(error) => { keypair_bytes.zeroize(); - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_keypair_serialize_failed", error.to_string(), )); @@ -310,7 +310,7 @@ async fn write_new_keypair( } else { "wallet_file_create_failed" }; - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( code, format!("{}: {error}", task_path.display()), )); @@ -319,7 +319,7 @@ async fn write_new_keypair( if let std::result::Result::Err(error) = file.write_all(encoded.as_slice()) { encoded.zeroize(); let _ = std::fs::remove_file(&task_path); - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_file_write_failed", format!("{}: {error}", task_path.display()), )); @@ -327,7 +327,7 @@ async fn write_new_keypair( encoded.zeroize(); if let std::result::Result::Err(error) = file.sync_all() { let _ = std::fs::remove_file(&task_path); - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_file_sync_failed", format!("{}: {error}", task_path.display()), )); @@ -337,14 +337,14 @@ async fn write_new_keypair( .await; return match task_result { std::result::Result::Ok(result) => result, - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "wallet_file_task_failed", format!("{}: {error}", path.display()), )), }; } -async fn read_keypair(path: &std::path::Path) -> kb_core::Result { +async fn read_keypair(path: &std::path::Path) -> ks_core::Result { match validate_wallet_file_metadata(path).await { std::result::Result::Ok(()) => {}, std::result::Result::Err(error) => return std::result::Result::Err(error), @@ -352,7 +352,7 @@ async fn read_keypair(path: &std::path::Path) -> kb_core::Result encoded, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_file_read_failed", format!("{}: {error}", path.display()), )); @@ -363,7 +363,7 @@ async fn read_keypair(path: &std::path::Path) -> kb_core::Result keypair_bytes, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_keypair_json_invalid", format!("{}: {error}", path.display()), )); @@ -372,7 +372,7 @@ async fn read_keypair(path: &std::path::Path) -> kb_core::Result kb_core::Result std::result::Result::Ok(keypair), - std::result::Result::Err(error) => std::result::Result::Err(kb_core::Error::new( + std::result::Result::Err(error) => std::result::Result::Err(ks_core::Error::new( "wallet_keypair_invalid", format!("{}: {error}", path.display()), )), }; } -async fn validate_wallet_file_metadata(path: &std::path::Path) -> kb_core::Result<()> { +async fn validate_wallet_file_metadata(path: &std::path::Path) -> ks_core::Result<()> { let metadata = match tokio::fs::symlink_metadata(path).await { std::result::Result::Ok(metadata) => metadata, std::result::Result::Err(error) => { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_file_metadata_failed", format!("{}: {error}", path.display()), )); }, }; if metadata.file_type().is_symlink() || !metadata.is_file() { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_file_type_invalid", format!("{} must be a regular file and not a symlink", path.display()), )); @@ -413,7 +413,7 @@ async fn validate_wallet_file_metadata(path: &std::path::Path) -> kb_core::Resul use std::os::unix::fs::PermissionsExt; // rust-rules: trait-import let mode = metadata.permissions().mode() & 0o777; if mode & 0o077 != 0 { - return std::result::Result::Err(kb_core::Error::new( + return std::result::Result::Err(ks_core::Error::new( "wallet_file_permissions_too_open", format!("{} has mode {mode:o}; expected no group or other access", path.display()), )); diff --git a/scripts/audit_khadhroony_workspace_rules.py b/scripts/audit_khadhroony_workspace_rules.py index f12020e..8798382 100755 --- a/scripts/audit_khadhroony_workspace_rules.py +++ b/scripts/audit_khadhroony_workspace_rules.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # file: scripts/audit_khadhroony_workspace_rules.py -# version: 17 +# version: 18 """Audit mechanically verifiable rules specific to khadhroony-bot3.""" @@ -51,7 +51,7 @@ def audit_tracing(root: pathlib.Path) -> list[Violation]: violations: list[Violation] = [] for cargo in sorted(root.glob("*/Cargo.toml")): crate = cargo.parent - if crate.name == "kb-lib": + if crate.name == "ks-lib": continue if not relevant_tracing_crate(crate): continue @@ -82,11 +82,11 @@ def audit_tracing(root: pathlib.Path) -> list[Violation]: return violations -def audit_kb_lib_tracing(root: pathlib.Path) -> list[Violation]: - """Audit hierarchical tracing targets owned by operational kb-lib components.""" +def audit_ks_lib_tracing(root: pathlib.Path) -> list[Violation]: + """Audit hierarchical tracing targets owned by operational ks-lib components.""" violations: list[Violation] = [] - crate = root / "kb-lib" + crate = root / "ks-lib" crate_root = crate / "src/lib.rs" if not crate_root.exists(): return violations @@ -177,8 +177,8 @@ def audit_solana_types(root: pathlib.Path) -> list[Violation]: return violations -def audit_kb_lib_symbol_prefixes(root: pathlib.Path) -> list[Violation]: - """Require stable family prefixes on non-method kb-lib declarations.""" +def audit_ks_lib_symbol_prefixes(root: pathlib.Path) -> list[Violation]: + """Require stable family prefixes on non-method ks-lib declarations.""" violations: list[Violation] = [] families = { @@ -194,7 +194,7 @@ def audit_kb_lib_symbol_prefixes(root: pathlib.Path) -> list[Violation]: r"([A-Za-z_][A-Za-z0-9_]*)" ) for family, prefixes in families.items(): - family_root = root / "kb-lib/src" / family + family_root = root / "ks-lib/src" / family paths = [family_root.with_suffix(".rs")] if family_root.is_dir(): paths.extend(sorted(family_root.rglob("*.rs"))) @@ -227,7 +227,7 @@ def audit_reserved_decoder_scaffolds(root: pathlib.Path) -> list[Violation]: """Reject incomplete reserved decoder contracts.""" violations: list[Violation] = [] - decoder_root = root / "kb-lib/src/decoder" + decoder_root = root / "ks-lib/src/decoder" forbidden = ( "MIGRATION_BOUNDARIES", "LEGACY_CRATE", @@ -298,7 +298,7 @@ def audit_reserved_materializer_scaffolds(root: pathlib.Path) -> list[Violation] """Reject incomplete reserved materializer contracts.""" violations: list[Violation] = [] - materializer_root = root / "kb-lib/src/materializer" + materializer_root = root / "ks-lib/src/materializer" forbidden = ( "MIGRATION_BOUNDARIES", "LEGACY_CRATE", @@ -437,7 +437,7 @@ def audit_materializer_conventions(root: pathlib.Path) -> list[Violation]: """Audit materializer names, constants and component facade structure.""" violations: list[Violation] = [] - materializer_root = root / "kb-lib/src/materializer" + materializer_root = root / "ks-lib/src/materializer" component_pattern = re.compile( r'pub\(crate\) const (MT_[A-Z0-9_]+)_COMPONENT_NAME: &str\s*=\s*"([^"]+)";' ) @@ -524,7 +524,7 @@ def audit_materializer_conventions(root: pathlib.Path) -> list[Violation]: violations.append( Violation( "KH_MT017", - "kb-lib/src/materializer", + "ks-lib/src/materializer", 1, "materializer component names must be unique", ) @@ -533,7 +533,7 @@ def audit_materializer_conventions(root: pathlib.Path) -> list[Violation]: violations.append( Violation( "KH_MT018", - "kb-lib/src/materializer", + "ks-lib/src/materializer", 1, "materializer processor names must be unique", ) @@ -699,7 +699,7 @@ def audit_reserved_executor_scaffolds(root: pathlib.Path) -> list[Violation]: """Reject incomplete reserved executor contracts.""" violations: list[Violation] = [] - executor_root = root / "kb-lib/src/executor" + executor_root = root / "ks-lib/src/executor" forbidden = ( "MIGRATION_BOUNDARIES", "LEGACY_CRATE", @@ -778,7 +778,7 @@ def audit_reserved_executor_scaffolds(root: pathlib.Path) -> list[Violation]: violations.append( Violation( "KH_EX007", - "kb-lib/src/executor", + "ks-lib/src/executor", 1, f"expected 103 reserved executor boundaries, found {reserved_count}", ) @@ -801,7 +801,7 @@ def audit_token_2022_naming(root: pathlib.Path) -> list[Violation]: root / "docs/rules/RULES_GENERAL.md", root / "docs/rules/RULES_RUST.md", root / "docs/rules/RULES_SPECIFIC_KHADHROONY.md", - root / "kb-lib/README.md", + root / "ks-lib/README.md", ] candidates.extend(sorted((root / "docs").glob("*.md"))) for path in candidates: @@ -822,8 +822,8 @@ def audit_token_2022_naming(root: pathlib.Path) -> list[Violation]: return violations -def audit_private_kb_lib_paths_in_active_docs(root: pathlib.Path) -> list[Violation]: - """Reject documentation that presents private kb-lib modules as public APIs.""" +def audit_private_ks_lib_paths_in_active_docs(root: pathlib.Path) -> list[Violation]: + """Reject documentation that presents private ks-lib modules as public APIs.""" violations: list[Violation] = [] candidates = [ @@ -833,12 +833,12 @@ def audit_private_kb_lib_paths_in_active_docs(root: pathlib.Path) -> list[Violat root / "docs/rules/RULES_GENERAL.md", root / "docs/rules/RULES_RUST.md", root / "docs/rules/RULES_SPECIFIC_KHADHROONY.md", - root / "kb-lib/README.md", - root / "kb-program-ids/README.md", + root / "ks-lib/README.md", + root / "ks-program-ids/README.md", ] candidates.extend(sorted((root / "docs").glob("*.md"))) candidates.extend(sorted((root / "docs").glob("*.json"))) - pattern = re.compile(r"kb_lib::(?:decoder|executor|materializer|model)::") + pattern = re.compile(r"ks_lib::(?:decoder|executor|materializer|model)::") for path in candidates: if not path.is_file(): continue @@ -851,7 +851,7 @@ def audit_private_kb_lib_paths_in_active_docs(root: pathlib.Path) -> list[Violat "KH_API001", relative, index, - f"private kb-lib module path `{match.group(0)}` is forbidden in active documentation", + f"private ks-lib module path `{match.group(0)}` is forbidden in active documentation", ) ) return violations @@ -930,14 +930,14 @@ def main() -> int: root = pathlib.Path(arguments.root).resolve() violations = ( audit_tracing(root) - +audit_kb_lib_tracing(root) - +audit_kb_lib_symbol_prefixes(root) + +audit_ks_lib_tracing(root) + +audit_ks_lib_symbol_prefixes(root) +audit_reserved_decoder_scaffolds(root) +audit_reserved_materializer_scaffolds(root) +audit_materializer_conventions(root) +audit_reserved_executor_scaffolds(root) +audit_token_2022_naming(root) - +audit_private_kb_lib_paths_in_active_docs(root) + +audit_private_ks_lib_paths_in_active_docs(root) +audit_solana_types(root) +audit_wincode_resolution(root) ) diff --git a/scripts/audit_rust_general_rules.py b/scripts/audit_rust_general_rules.py index 7640186..1031024 100755 --- a/scripts/audit_rust_general_rules.py +++ b/scripts/audit_rust_general_rules.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # file: scripts/audit_rust_general_rules.py -# version: 9 +# version: 10 """Audit mechanically verifiable Rust rules shared by all Rust projects.""" @@ -117,8 +117,8 @@ def audit_file(root: pathlib.Path, path: pathlib.Path) -> list[Violation]: previous_export_key: tuple[object, ...] | None = None blank_since_export = False crate_visibility_seen = False - enforce_visibility_order = relative == "kb-lib/src/lib.rs" or relative.startswith( - "kb-lib/src/executor" + enforce_visibility_order = relative == "ks-lib/src/lib.rs" or relative.startswith( + "ks-lib/src/executor" ) for index, line in enumerate(lines, 1): if not line.strip(): diff --git a/test-fixtures/contract-matrices/METADATA_SOLANA_PROGRAM_PIPELINE_MATRIX.json b/test-fixtures/contract-matrices/METADATA_SOLANA_PROGRAM_PIPELINE_MATRIX.json index db7ba6c..321b7af 100644 --- a/test-fixtures/contract-matrices/METADATA_SOLANA_PROGRAM_PIPELINE_MATRIX.json +++ b/test-fixtures/contract-matrices/METADATA_SOLANA_PROGRAM_PIPELINE_MATRIX.json @@ -1,8 +1,8 @@ { "schemaVersion": 1, "programId": "ProgM6JCCvbYkfKqJYHePx4xxSUSqJp7rh8Lyv7nk7S", - "pipelineCrate": "kb-pipeline", - "demoScenarioCrate": "kb-pipeline-demo-scenarios", + "pipelineCrate": "ks-pipeline", + "demoScenarioCrate": "ks-pipeline-demo-scenarios", "historicalValidationFlow": [ "demo_backfill", "core_extraction", diff --git a/test-fixtures/contract-matrices/METAPLEX_TOKEN_METADATA_MATRIX.json b/test-fixtures/contract-matrices/METAPLEX_TOKEN_METADATA_MATRIX.json index b38db55..082437c 100644 --- a/test-fixtures/contract-matrices/METAPLEX_TOKEN_METADATA_MATRIX.json +++ b/test-fixtures/contract-matrices/METAPLEX_TOKEN_METADATA_MATRIX.json @@ -357,7 +357,7 @@ } ], "wire": "official_borsh_mpl_token_metadata_5_1_1", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.003", @@ -396,7 +396,7 @@ ], "wire": "single_u8_discriminator_official_mpl_token_metadata_5_1_1", "account_contract": "ordered_required_accounts_plus_optional_collection_authority_record_and_bounded_remaining_accounts", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.004", @@ -435,7 +435,7 @@ ], "wire": "single_u8_discriminator_official_mpl_token_metadata_5_1_1", "account_contract": "ordered_required_accounts_plus_optional_collection_authority_record; collection metadata is writable and collection authority is readonly signer", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.005", @@ -636,7 +636,7 @@ "wire": "u8 discriminator + historical DataV2 + bool is_mutable using Borsh 0.10", "account_contract": "metadata, mint, mint_authority signer, payer writable signer, update_authority, system_program, optional rent", "provenance": "historical Metaplex Token Metadata instruction surface; current SDK DataV2 type reused only for exact compatible wire fields", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.010", @@ -667,7 +667,7 @@ ], "wire": "u8 discriminator + historical Data/Option fields using Borsh 0.10", "provenance": "historical generated Metaplex Token Metadata surface", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.011", @@ -697,7 +697,7 @@ ], "wire": "CreateMasterEditionV3: u8 discriminator + Option max_supply; conversion: u8 discriminator only", "account_contract": "exact generated Rust SDK account order and signer/writable flags; optional rent accepted for CreateMasterEditionV3", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.012", @@ -727,7 +727,7 @@ "wire": "u8 discriminator + MintNewEditionFromMasterEditionViaTokenArgs { edition: u64 }", "account_contract": "exact generated Rust SDK account order and signer/writable flags; optional rent accepted after the required program accounts", "edition_marker_contract": "edition marker PDA is writable and corresponds to floor(edition / EDITION_MARKER_BIT_SIZE); PDA derivation validation remains planned with account decoding", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.013", @@ -757,7 +757,7 @@ "wire": "u8 discriminator + SetCollectionSizeArgs { size: u64 }", "account_contract": "exact generated Rust SDK account order and signer/writable flags; optional collection authority record accepted", "provenance_boundary": "BubblegumSetCollectionSize is decoded as a Token Metadata bridge instruction and does not claim complete Bubblegum coverage", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.014", @@ -786,7 +786,7 @@ ], "wire": "u8 discriminator + DelegateArgs or RevokeArgs Borsh enum; DelegateArgs may contain optional AuthorizationData", "account_contract": "14 positional accounts with Metaplex program placeholders for absent optional accounts; exact signer/writable invariants on authority, payer, metadata and optional writable records", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.015", @@ -845,7 +845,7 @@ ], "wire": "Borsh enums TransferArgs/LockArgs/UnlockArgs/BurnArgs; CloseAccounts discriminator only", "account_contract": "exact generated Rust SDK positional accounts and signer/writable invariants; Metaplex program placeholders accepted for absent optional programmable accounts", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.016", @@ -877,7 +877,7 @@ "wire": "u8 discriminator only", "account_contract": "delegate writable signer, token account writable, edition/mint/token program readonly", "inventory_audit": "official generated Rust SDK instruction module index audited; remaining modules are tracked before account-state decoding", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.017", @@ -918,7 +918,7 @@ ], "wire": "u8 discriminator only", "account_contract": "exact generated Rust SDK positional signer/writable contracts; BurnNft collection metadata, deprecated printing-token reservation list are optional trailing accounts", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.018", @@ -967,7 +967,7 @@ ], "wire": "Create/Close/Collect discriminator only; TransferOutOfEscrow discriminator + amount u64", "account_contract": "exact generated Rust SDK signer/writable contracts with optional trailing authority on create and transfer", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.019", @@ -986,7 +986,7 @@ ], "wire": "u8 discriminator + CreateArgs enum", "account_contract": "nine positional accounts with Metaplex placeholders for optional master edition and SPL Token Program", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.020", @@ -1005,7 +1005,7 @@ ], "wire": "u8 discriminator + MintArgs::V1 { amount: u64, authorization_data: Option }", "account_contract": "fifteen positional accounts with Metaplex placeholders for optional token owner, master edition, token record, delegate record and authorization-rule accounts", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.021", @@ -1028,7 +1028,7 @@ ], "wire": "u8 discriminator + PrintArgs::{V1,V2} { edition: u64 }", "account_contract": "eighteen positional accounts with a Metaplex placeholder or writable Token Record at position 6", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.022", @@ -1058,7 +1058,7 @@ ], "wire": "u8 discriminator + UpdateArgs enum", "account_contract": "eleven positional accounts with Metaplex placeholders for optional delegate record, token, edition and authorization-rule accounts", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.023", @@ -1108,7 +1108,7 @@ ], "wire": "u8 discriminator + UseArgs or VerificationArgs enum", "account_contract": "twelve positional accounts for Use; eight positional accounts for Verify and seven for Unverify, with Metaplex placeholders for optional accounts", - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "pre_release": "0.4.7-pre.024", @@ -1198,7 +1198,7 @@ ], "wire": "u8 discriminator only", "account_contract": "exact IDL/generated positional signer and writable flags", - "runtime_registration": "enabled_in_kb_lib_pre_009", + "runtime_registration": "enabled_in_ks_lib_pre_009", "inventory_proof": { "covered_discriminators": [ 0, @@ -1284,7 +1284,7 @@ "uri_bytes": 200, "creators": 5 }, - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "group": "edition_and_master_edition_accounts", @@ -1347,7 +1347,7 @@ "bit_order": "most_significant_bit_first" } }, - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "group": "token_record_account", @@ -1386,7 +1386,7 @@ "LockedTransfer", "Migration" ], - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "group": "delegate_and_authority_records", @@ -1449,7 +1449,7 @@ "holder_delegate_role_seeds": [ "print_delegate" ], - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "group": "token_owned_escrow_account", @@ -1491,7 +1491,7 @@ "Migrate": "may create or update related programmable records; correlation pending", "Resize": "changes allocated account bytes without changing canonical identity" }, - "runtime_registration": "enabled_in_kb_lib_pre_009" + "runtime_registration": "enabled_in_ks_lib_pre_009" }, { "group": "historical_reservation_lists", diff --git a/test-fixtures/contract-matrices/NATIVE_SOLANA_DECODER_MATRIX.json b/test-fixtures/contract-matrices/NATIVE_SOLANA_DECODER_MATRIX.json index da9b1e5..83c1f56 100644 --- a/test-fixtures/contract-matrices/NATIVE_SOLANA_DECODER_MATRIX.json +++ b/test-fixtures/contract-matrices/NATIVE_SOLANA_DECODER_MATRIX.json @@ -4,7 +4,7 @@ "release": "0.4.2-pre.023", "surface_count": 18, "coverage_entry_count": 121, - "registry_contract": "Exact equality with kb_program_ids::native_program_ids and SolanaCoreDecoder::surfaces", + "registry_contract": "Exact equality with ks_program_ids::native_program_ids and SolanaCoreDecoder::surfaces", "completeness_contract": "Each surface has exact declared coverage count plus a dedicated official-enum or audited-wire completeness test", "surfaces": [ { diff --git a/test-fixtures/contract-matrices/OPERATION_NAMING_MATRIX.json b/test-fixtures/contract-matrices/OPERATION_NAMING_MATRIX.json index 4fe72a7..31e6991 100644 --- a/test-fixtures/contract-matrices/OPERATION_NAMING_MATRIX.json +++ b/test-fixtures/contract-matrices/OPERATION_NAMING_MATRIX.json @@ -18,7 +18,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "AddressLookupTab1e1111111111111111111111111", @@ -29,7 +29,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "AddressLookupTab1e1111111111111111111111111", @@ -40,7 +40,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "AddressLookupTab1e1111111111111111111111111", @@ -51,7 +51,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "AddressLookupTab1e1111111111111111111111111", @@ -62,7 +62,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "ComputeBudget111111111111111111111111111111", @@ -73,7 +73,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "ComputeBudget111111111111111111111111111111", @@ -84,7 +84,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "ComputeBudget111111111111111111111111111111", @@ -95,7 +95,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "ComputeBudget111111111111111111111111111111", @@ -106,7 +106,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Config1111111111111111111111111111111111111", @@ -117,7 +117,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Config1111111111111111111111111111111111111", @@ -128,7 +128,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Ed25519SigVerify111111111111111111111111111", @@ -139,7 +139,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Ed25519SigVerify111111111111111111111111111", @@ -150,7 +150,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Feature111111111111111111111111111111111111", @@ -161,7 +161,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Feature111111111111111111111111111111111111", @@ -172,7 +172,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "BPFLoaderUpgradeab1e11111111111111111111111", @@ -183,7 +183,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "BPFLoaderUpgradeab1e11111111111111111111111", @@ -194,7 +194,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "BPFLoaderUpgradeab1e11111111111111111111111", @@ -205,7 +205,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "BPFLoaderUpgradeab1e11111111111111111111111", @@ -216,7 +216,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "BPFLoaderUpgradeab1e11111111111111111111111", @@ -227,7 +227,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "BPFLoaderUpgradeab1e11111111111111111111111", @@ -238,7 +238,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "BPFLoaderUpgradeab1e11111111111111111111111", @@ -249,7 +249,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "BPFLoaderUpgradeab1e11111111111111111111111", @@ -260,7 +260,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "BPFLoaderUpgradeab1e11111111111111111111111", @@ -271,7 +271,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "BPFLoaderUpgradeab1e11111111111111111111111", @@ -282,7 +282,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "BPFLoaderUpgradeab1e11111111111111111111111", @@ -293,7 +293,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "LoaderV411111111111111111111111111111111111", @@ -304,7 +304,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "LoaderV411111111111111111111111111111111111", @@ -315,7 +315,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "LoaderV411111111111111111111111111111111111", @@ -326,7 +326,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "LoaderV411111111111111111111111111111111111", @@ -337,7 +337,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "LoaderV411111111111111111111111111111111111", @@ -348,7 +348,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "LoaderV411111111111111111111111111111111111", @@ -359,7 +359,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "LoaderV411111111111111111111111111111111111", @@ -370,7 +370,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "LoaderV411111111111111111111111111111111111", @@ -381,7 +381,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "LoaderV411111111111111111111111111111111111", @@ -392,7 +392,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "KeccakSecp256k11111111111111111111111111111", @@ -403,7 +403,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "KeccakSecp256k11111111111111111111111111111", @@ -414,7 +414,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Secp256r1SigVerify1111111111111111111111111", @@ -425,7 +425,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Secp256r1SigVerify1111111111111111111111111", @@ -436,7 +436,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "S1ashing11111111111111111111111111111111111", @@ -447,7 +447,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "S1ashing11111111111111111111111111111111111", @@ -458,7 +458,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -469,7 +469,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -480,7 +480,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -491,7 +491,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -502,7 +502,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -513,7 +513,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -524,7 +524,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -535,7 +535,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -546,7 +546,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -557,7 +557,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -568,7 +568,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -579,7 +579,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -590,7 +590,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -601,7 +601,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -612,7 +612,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -623,7 +623,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -634,7 +634,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -645,7 +645,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -656,7 +656,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -667,7 +667,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -678,7 +678,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -689,7 +689,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -700,7 +700,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -711,7 +711,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Stake11111111111111111111111111111111111111", @@ -722,7 +722,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -733,7 +733,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -744,7 +744,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -755,7 +755,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -766,7 +766,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -777,7 +777,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -788,7 +788,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -799,7 +799,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -810,7 +810,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -821,7 +821,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -832,7 +832,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -843,7 +843,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -854,7 +854,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -865,7 +865,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -876,7 +876,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -887,7 +887,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -898,7 +898,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "11111111111111111111111111111111", @@ -909,7 +909,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -920,7 +920,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -931,7 +931,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -942,7 +942,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -953,7 +953,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -964,7 +964,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -975,7 +975,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -986,7 +986,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -997,7 +997,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -1008,7 +1008,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -1019,7 +1019,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -1030,7 +1030,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -1041,7 +1041,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -1052,7 +1052,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -1063,7 +1063,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -1074,7 +1074,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -1085,7 +1085,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -1096,7 +1096,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -1107,7 +1107,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -1118,7 +1118,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -1129,7 +1129,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -1140,7 +1140,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -1151,7 +1151,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -1162,7 +1162,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "Vote111111111111111111111111111111111111111", @@ -1173,7 +1173,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "ZkE1Gama1Proof11111111111111111111111111111", @@ -1184,7 +1184,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "ZkE1Gama1Proof11111111111111111111111111111", @@ -1195,7 +1195,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "ZkE1Gama1Proof11111111111111111111111111111", @@ -1206,7 +1206,7 @@ "executorName": "kb-lib.executor.solana.core", "decoderName": "kb-lib.decoder.solana.core", "status": "implemented", - "source": "kb-lib/src/executor/solana/core/intent.rs" + "source": "ks-lib/src/executor/solana/core/intent.rs" }, { "programId": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", @@ -1217,7 +1217,7 @@ "executorName": "kb-lib.executor.spl.associated_token_account", "decoderName": "kb-lib.decoder.spl.associated_token_account", "status": "implemented", - "source": "kb-lib/src/executor/spl/associated_token_account/intent.rs" + "source": "ks-lib/src/executor/spl/associated_token_account/intent.rs" }, { "programId": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", @@ -1228,7 +1228,7 @@ "executorName": "kb-lib.executor.spl.associated_token_account", "decoderName": "kb-lib.decoder.spl.associated_token_account", "status": "implemented", - "source": "kb-lib/src/executor/spl/associated_token_account/intent.rs" + "source": "ks-lib/src/executor/spl/associated_token_account/intent.rs" }, { "programId": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", @@ -1239,7 +1239,7 @@ "executorName": "kb-lib.executor.spl.associated_token_account", "decoderName": "kb-lib.decoder.spl.associated_token_account", "status": "implemented", - "source": "kb-lib/src/executor/spl/associated_token_account/intent.rs" + "source": "ks-lib/src/executor/spl/associated_token_account/intent.rs" }, { "programId": "regVYJW7tcT8zipN5YiBvHsvR5jXW1uLFxaHSbugABg", @@ -1250,7 +1250,7 @@ "executorName": "kb-lib.executor.spl.elgamal_registry", "decoderName": "kb-lib.decoder.spl.elgamal_registry", "status": "implemented", - "source": "kb-lib/src/executor/spl/elgamal_registry/intent.rs" + "source": "ks-lib/src/executor/spl/elgamal_registry/intent.rs" }, { "programId": "regVYJW7tcT8zipN5YiBvHsvR5jXW1uLFxaHSbugABg", @@ -1261,7 +1261,7 @@ "executorName": "kb-lib.executor.spl.elgamal_registry", "decoderName": "kb-lib.decoder.spl.elgamal_registry", "status": "implemented", - "source": "kb-lib/src/executor/spl/elgamal_registry/intent.rs" + "source": "ks-lib/src/executor/spl/elgamal_registry/intent.rs" }, { "programId": "Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo", @@ -1272,7 +1272,7 @@ "executorName": null, "decoderName": "kb-lib.decoder.spl.memo", "status": "decode_only", - "source": "kb-lib/src/decoder/spl/memo" + "source": "ks-lib/src/decoder/spl/memo" }, { "programId": "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr", @@ -1283,7 +1283,7 @@ "executorName": null, "decoderName": "kb-lib.decoder.spl.memo", "status": "decode_only", - "source": "kb-lib/src/decoder/spl/memo" + "source": "ks-lib/src/decoder/spl/memo" }, { "programId": "Memo4c2pN8afCj432Lb7RMVKi9PbQnnW7ewFFaV3oAH", @@ -1294,7 +1294,7 @@ "executorName": "kb-lib.executor.spl.memo", "decoderName": "kb-lib.decoder.spl.memo", "status": "implemented", - "source": "kb-lib/src/executor/spl/memo/intent.rs" + "source": "ks-lib/src/executor/spl/memo/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1305,7 +1305,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1316,7 +1316,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1327,7 +1327,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1338,7 +1338,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1349,7 +1349,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1360,7 +1360,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1371,7 +1371,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1382,7 +1382,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1393,7 +1393,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1404,7 +1404,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1415,7 +1415,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1426,7 +1426,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1437,7 +1437,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1448,7 +1448,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1459,7 +1459,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1470,7 +1470,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1481,7 +1481,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1492,7 +1492,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1503,7 +1503,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1514,7 +1514,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1525,7 +1525,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1536,7 +1536,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1547,7 +1547,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", @@ -1558,7 +1558,7 @@ "executorName": "kb-lib.executor.spl.token", "decoderName": "kb-lib.decoder.spl.token", "status": "implemented", - "source": "kb-lib/src/executor/spl/token/intent.rs" + "source": "ks-lib/src/executor/spl/token/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1569,7 +1569,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1580,7 +1580,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1591,7 +1591,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1602,7 +1602,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1613,7 +1613,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1624,7 +1624,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1635,7 +1635,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1646,7 +1646,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1657,7 +1657,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1668,7 +1668,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1679,7 +1679,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1690,7 +1690,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1701,7 +1701,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1712,7 +1712,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1723,7 +1723,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1734,7 +1734,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1745,7 +1745,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1756,7 +1756,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1767,7 +1767,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1778,7 +1778,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1789,7 +1789,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1800,7 +1800,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1811,7 +1811,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1822,7 +1822,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1833,7 +1833,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1844,7 +1844,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1855,7 +1855,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1866,7 +1866,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1877,7 +1877,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1888,7 +1888,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1899,7 +1899,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1910,7 +1910,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1921,7 +1921,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1932,7 +1932,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1943,7 +1943,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1954,7 +1954,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1965,7 +1965,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1976,7 +1976,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1987,7 +1987,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -1998,7 +1998,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2009,7 +2009,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2020,7 +2020,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2031,7 +2031,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2042,7 +2042,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2053,7 +2053,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2064,7 +2064,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2075,7 +2075,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2086,7 +2086,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2097,7 +2097,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2108,7 +2108,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2119,7 +2119,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2130,7 +2130,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2141,7 +2141,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2152,7 +2152,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2163,7 +2163,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2174,7 +2174,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2185,7 +2185,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2196,7 +2196,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2207,7 +2207,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2218,7 +2218,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2229,7 +2229,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2240,7 +2240,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2251,7 +2251,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2262,7 +2262,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2273,7 +2273,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2284,7 +2284,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2295,7 +2295,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2306,7 +2306,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2317,7 +2317,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2328,7 +2328,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2339,7 +2339,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2350,7 +2350,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2361,7 +2361,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2372,7 +2372,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2383,7 +2383,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2394,7 +2394,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2405,7 +2405,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2416,7 +2416,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2427,7 +2427,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2438,7 +2438,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2449,7 +2449,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2460,7 +2460,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2471,7 +2471,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2482,7 +2482,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2493,7 +2493,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2504,7 +2504,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2515,7 +2515,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2526,7 +2526,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2537,7 +2537,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2548,7 +2548,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2559,7 +2559,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2570,7 +2570,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", @@ -2581,7 +2581,7 @@ "executorName": "kb-lib.executor.spl.token_2022", "decoderName": "kb-lib.decoder.spl.token_2022", "status": "implemented", - "source": "kb-lib/src/executor/spl/token_2022/intent.rs" + "source": "ks-lib/src/executor/spl/token_2022/intent.rs" }, { "programId": "ProgM6JCCvbYkfKqJYHePx4xxSUSqJp7rh8Lyv7nk7S", @@ -2592,7 +2592,7 @@ "executorName": "kb-lib.executor.metadata.solana_program_metadata", "decoderName": "kb-lib.decoder.metadata.solana_program_metadata", "status": "implemented", - "source": "kb-lib/src/executor/metadata/solana_program_metadata/constants.rs" + "source": "ks-lib/src/executor/metadata/solana_program_metadata/constants.rs" }, { "programId": "ProgM6JCCvbYkfKqJYHePx4xxSUSqJp7rh8Lyv7nk7S", @@ -2603,7 +2603,7 @@ "executorName": "kb-lib.executor.metadata.solana_program_metadata", "decoderName": "kb-lib.decoder.metadata.solana_program_metadata", "status": "implemented", - "source": "kb-lib/src/executor/metadata/solana_program_metadata/constants.rs" + "source": "ks-lib/src/executor/metadata/solana_program_metadata/constants.rs" }, { "programId": "ProgM6JCCvbYkfKqJYHePx4xxSUSqJp7rh8Lyv7nk7S", @@ -2614,7 +2614,7 @@ "executorName": "kb-lib.executor.metadata.solana_program_metadata", "decoderName": "kb-lib.decoder.metadata.solana_program_metadata", "status": "implemented", - "source": "kb-lib/src/executor/metadata/solana_program_metadata/constants.rs" + "source": "ks-lib/src/executor/metadata/solana_program_metadata/constants.rs" }, { "programId": "ProgM6JCCvbYkfKqJYHePx4xxSUSqJp7rh8Lyv7nk7S", @@ -2625,7 +2625,7 @@ "executorName": "kb-lib.executor.metadata.solana_program_metadata", "decoderName": "kb-lib.decoder.metadata.solana_program_metadata", "status": "implemented", - "source": "kb-lib/src/executor/metadata/solana_program_metadata/constants.rs" + "source": "ks-lib/src/executor/metadata/solana_program_metadata/constants.rs" }, { "programId": "ProgM6JCCvbYkfKqJYHePx4xxSUSqJp7rh8Lyv7nk7S", @@ -2636,7 +2636,7 @@ "executorName": "kb-lib.executor.metadata.solana_program_metadata", "decoderName": "kb-lib.decoder.metadata.solana_program_metadata", "status": "implemented", - "source": "kb-lib/src/executor/metadata/solana_program_metadata/constants.rs" + "source": "ks-lib/src/executor/metadata/solana_program_metadata/constants.rs" }, { "programId": "ProgM6JCCvbYkfKqJYHePx4xxSUSqJp7rh8Lyv7nk7S", @@ -2647,7 +2647,7 @@ "executorName": "kb-lib.executor.metadata.solana_program_metadata", "decoderName": "kb-lib.decoder.metadata.solana_program_metadata", "status": "implemented", - "source": "kb-lib/src/executor/metadata/solana_program_metadata/constants.rs" + "source": "ks-lib/src/executor/metadata/solana_program_metadata/constants.rs" }, { "programId": "ProgM6JCCvbYkfKqJYHePx4xxSUSqJp7rh8Lyv7nk7S", @@ -2658,7 +2658,7 @@ "executorName": "kb-lib.executor.metadata.solana_program_metadata", "decoderName": "kb-lib.decoder.metadata.solana_program_metadata", "status": "implemented", - "source": "kb-lib/src/executor/metadata/solana_program_metadata/constants.rs" + "source": "ks-lib/src/executor/metadata/solana_program_metadata/constants.rs" }, { "programId": "ProgM6JCCvbYkfKqJYHePx4xxSUSqJp7rh8Lyv7nk7S", @@ -2669,7 +2669,7 @@ "executorName": "kb-lib.executor.metadata.solana_program_metadata", "decoderName": "kb-lib.decoder.metadata.solana_program_metadata", "status": "implemented", - "source": "kb-lib/src/executor/metadata/solana_program_metadata/constants.rs" + "source": "ks-lib/src/executor/metadata/solana_program_metadata/constants.rs" }, { "programId": "ProgM6JCCvbYkfKqJYHePx4xxSUSqJp7rh8Lyv7nk7S", @@ -2680,7 +2680,7 @@ "executorName": "kb-lib.executor.metadata.solana_program_metadata", "decoderName": "kb-lib.decoder.metadata.solana_program_metadata", "status": "implemented", - "source": "kb-lib/src/executor/metadata/solana_program_metadata/constants.rs" + "source": "ks-lib/src/executor/metadata/solana_program_metadata/constants.rs" } ] } diff --git a/test-fixtures/contract-matrices/SOLANA_STANDARD_RPC_MATRIX.json b/test-fixtures/contract-matrices/SOLANA_STANDARD_RPC_MATRIX.json index 82ab144..0f0d6d7 100644 --- a/test-fixtures/contract-matrices/SOLANA_STANDARD_RPC_MATRIX.json +++ b/test-fixtures/contract-matrices/SOLANA_STANDARD_RPC_MATRIX.json @@ -26,7 +26,7 @@ "method": "getLargestAccounts", "category": "accounts", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getMinimumBalanceForRentExemption", @@ -38,43 +38,43 @@ "method": "getMultipleAccounts", "category": "accounts", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getProgramAccounts", "category": "accounts", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getTokenAccountBalance", "category": "tokens", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getTokenAccountsByDelegate", "category": "tokens", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getTokenAccountsByOwner", "category": "tokens", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getTokenLargestAccounts", "category": "tokens", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getTokenSupply", "category": "tokens", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getFeeForMessage", @@ -92,7 +92,7 @@ "method": "getRecentPrioritizationFees", "category": "transactions", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getSignaturesForAddress", @@ -116,13 +116,13 @@ "method": "getTransactionCount", "category": "transactions", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "isBlockhashValid", "category": "transactions", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "requestAirdrop", @@ -146,13 +146,13 @@ "method": "getBlock", "category": "blocks", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getBlockCommitment", "category": "blocks", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getBlockHeight", @@ -164,49 +164,49 @@ "method": "getBlockProduction", "category": "blocks", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getBlocks", "category": "blocks", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getBlocksWithLimit", "category": "blocks", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getBlockTime", "category": "blocks", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getFirstAvailableBlock", "category": "blocks", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getRecentPerformanceSamples", "category": "blocks", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "minimumLedgerSlot", "category": "blocks", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getClusterNodes", "category": "cluster", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getEpochInfo", @@ -218,7 +218,7 @@ "method": "getEpochSchedule", "category": "cluster", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getGenesisHash", @@ -230,97 +230,97 @@ "method": "getHealth", "category": "cluster", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getHighestSnapshotSlot", "category": "cluster", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getIdentity", "category": "cluster", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getLeaderSchedule", "category": "cluster", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getMaxRetransmitSlot", "category": "cluster", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getMaxShredInsertSlot", "category": "cluster", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getSlot", "category": "cluster", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getSlotLeader", "category": "cluster", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getSlotLeaders", "category": "cluster", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getVersion", "category": "cluster", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getVoteAccounts", "category": "cluster", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getInflationGovernor", "category": "economics", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getInflationRate", "category": "economics", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getInflationReward", "category": "economics", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getStakeMinimumDelegation", "category": "economics", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" }, { "method": "getSupply", "category": "economics", "contract": "typed_adapter", - "implementation": "configurable kb_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" + "implementation": "configurable ks_onchain_transport request/result contract plus typed HttpClient/HttpEndpointPool transport" } ], "ws_subscriptions": [ @@ -331,7 +331,7 @@ "stability": "stable", "request_contract": "typed_adapter", "persistent_runtime": true, - "library_runtime": "kb_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", + "library_runtime": "ks_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", "notification_contract": "typed_adapter", "explicit_capability_required": false }, @@ -342,7 +342,7 @@ "stability": "unstable", "request_contract": "typed_adapter", "persistent_runtime": true, - "library_runtime": "kb_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", + "library_runtime": "ks_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", "notification_contract": "typed_adapter", "explicit_capability_required": true }, @@ -353,7 +353,7 @@ "stability": "stable", "request_contract": "typed_adapter", "persistent_runtime": true, - "library_runtime": "kb_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", + "library_runtime": "ks_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", "notification_contract": "typed_adapter", "explicit_capability_required": false }, @@ -364,7 +364,7 @@ "stability": "stable", "request_contract": "typed_adapter", "persistent_runtime": true, - "library_runtime": "kb_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", + "library_runtime": "ks_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", "notification_contract": "typed_adapter", "explicit_capability_required": false }, @@ -375,7 +375,7 @@ "stability": "stable", "request_contract": "typed_adapter", "persistent_runtime": true, - "library_runtime": "kb_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", + "library_runtime": "ks_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", "notification_contract": "typed_adapter", "explicit_capability_required": false }, @@ -386,7 +386,7 @@ "stability": "stable", "request_contract": "typed_adapter", "persistent_runtime": true, - "library_runtime": "kb_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", + "library_runtime": "ks_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", "notification_contract": "typed_adapter", "explicit_capability_required": false }, @@ -397,7 +397,7 @@ "stability": "stable", "request_contract": "typed_adapter", "persistent_runtime": true, - "library_runtime": "kb_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", + "library_runtime": "ks_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", "notification_contract": "typed_adapter", "explicit_capability_required": false }, @@ -408,7 +408,7 @@ "stability": "unstable", "request_contract": "typed_adapter", "persistent_runtime": true, - "library_runtime": "kb_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", + "library_runtime": "ks_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", "notification_contract": "typed_adapter", "explicit_capability_required": true }, @@ -419,7 +419,7 @@ "stability": "unstable", "request_contract": "typed_adapter", "persistent_runtime": true, - "library_runtime": "kb_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", + "library_runtime": "ks_onchain_transport::WsSession multiplexing, explicit unsubscribe, bounded reconnect and resubscription", "notification_contract": "typed_adapter", "explicit_capability_required": true } diff --git a/test-fixtures/contract-matrices/SPL_ASSOCIATED_TOKEN_ACCOUNT_MATRIX.json b/test-fixtures/contract-matrices/SPL_ASSOCIATED_TOKEN_ACCOUNT_MATRIX.json index 668869e..8513cf2 100644 --- a/test-fixtures/contract-matrices/SPL_ASSOCIATED_TOKEN_ACCOUNT_MATRIX.json +++ b/test-fixtures/contract-matrices/SPL_ASSOCIATED_TOKEN_ACCOUNT_MATRIX.json @@ -9,8 +9,8 @@ "preservedDifferentialTests": 10, "materializerPorted": true, "publicMaterializers": [ - "kb_lib::TokenAccountsMaterializer", - "kb_lib::RiskMaterializer" + "ks_lib::TokenAccountsMaterializer", + "ks_lib::RiskMaterializer" ], "executorPorted": false, "pipelinePorted": false @@ -159,7 +159,7 @@ "idempotenceIdentity": "signature + instruction_path + program_id + normalized_operation + ata", "projectionOwners": [ { - "crate": "kb-lib", + "crate": "ks-lib", "component": "materializer.token.accounts", "facts": [ "ata_created", @@ -169,7 +169,7 @@ "justification": "ATA creation and recovery are stable token-account lifecycle facts; this crate already owns instruction-level token-account mutations." }, { - "crate": "kb-lib", + "crate": "ks-lib", "component": "materializer.risk", "facts": [ "nested_ata_anti_pattern_recovered" @@ -179,17 +179,17 @@ ], "explicitNoProjection": [ { - "crate": "kb-lib", + "crate": "ks-lib", "component": "materializer.lifecycle", "reason": "Native program lifecycle remains owned here; duplicating ATA lifecycle would overlap the token-account materializer." }, { - "crate": "kb-lib", + "crate": "ks-lib", "component": "materializer.admin", "reason": "ATA instructions do not change a mint authority, freeze authority, close authority or multisig configuration." }, { - "crate": "kb-lib", + "crate": "ks-lib", "component": "materializer.fees", "reason": "ATA wire does not prove an exact rent or network-fee amount; core balance changes and execution validation retain those facts." } diff --git a/test-fixtures/contract-matrices/SPL_MEMO_MATRIX.json b/test-fixtures/contract-matrices/SPL_MEMO_MATRIX.json index 82ebbe4..4185761 100644 --- a/test-fixtures/contract-matrices/SPL_MEMO_MATRIX.json +++ b/test-fixtures/contract-matrices/SPL_MEMO_MATRIX.json @@ -4,10 +4,10 @@ "matrixVersion": 4, "scope": "SPL Memo v1, v3 et v4", "bot3Migration": { - "decoderModule": "kb-lib/src/decoder/spl/memo", - "publicDecoder": "kb_lib::DcSplMemoDecoder", + "decoderModule": "ks-lib/src/decoder/spl/memo", + "publicDecoder": "ks_lib::DcSplMemoDecoder", "decoderStatus": "ported_in_0.1.0-pre.005", - "publicMaterializer": "kb_lib::MtTransactionAnnotationMaterializer", + "publicMaterializer": "ks_lib::MtTransactionAnnotationMaterializer", "materializerStatus": "ported_in_0.1.0-pre.011", "executorStatus": "pending_later_tranche" }, @@ -114,7 +114,7 @@ "unknownProgramProducesObservation": false }, "materializationContract": { - "crate": "kb-lib", + "crate": "ks-lib", "component": "materializer.transaction.annotations", "processorName": "materializer.transaction.annotations", "materializedFamily": "transaction_annotation", diff --git a/test-fixtures/contract-matrices/SPL_TOKEN_2022_MATRIX.json b/test-fixtures/contract-matrices/SPL_TOKEN_2022_MATRIX.json index 5511ca1..88286ca 100644 --- a/test-fixtures/contract-matrices/SPL_TOKEN_2022_MATRIX.json +++ b/test-fixtures/contract-matrices/SPL_TOKEN_2022_MATRIX.json @@ -66,11 +66,11 @@ "metadataVersionDriftStatus": "unpack_hardening_only_wire_and_builders_unchanged_by_source_diff" }, "operatorCommandsRequired": [ - "cargo tree -p kb-lib -e features", + "cargo tree -p ks-lib -e features", "cargo tree -i spl-token-2022-interface -e features", "cargo tree -i spl-elgamal-registry-interface -e features", "cargo metadata --format-version 1 --locked", - "cargo test -p kb-lib", + "cargo test -p ks-lib", "cargo clippy --all-targets" ], "sourceCommit": "e18f9c6f9bf6044b934f48e3090e8e59e4820f02", @@ -80,9 +80,9 @@ "operatorValidation": { "date": "2026-07-28", "cargoTestPackage": { - "command": "cargo test -p kb-lib", + "command": "cargo test -p ks-lib", "status": "passed", - "scope": "whole_kb_lib_package_non_structural_evidence", + "scope": "whole_ks_lib_package_non_structural_evidence", "passedAtEvidence": 625, "failedAtEvidence": 0, "rule": "Informational operator evidence only. Structural matrix tests must derive counts from matrix rows and compiled registries, never from this volatile package total." diff --git a/test-fixtures/contract-matrices/SPL_TOKEN_2022_VALIDATION_MATRIX.json b/test-fixtures/contract-matrices/SPL_TOKEN_2022_VALIDATION_MATRIX.json index 5a717fa..0ae4821 100644 --- a/test-fixtures/contract-matrices/SPL_TOKEN_2022_VALIDATION_MATRIX.json +++ b/test-fixtures/contract-matrices/SPL_TOKEN_2022_VALIDATION_MATRIX.json @@ -22,7 +22,7 @@ "evidence": [ { "kind": "test_suite", - "value": "kb_pipeline 120/120" + "value": "ks_pipeline 120/120" }, { "kind": "test_suite",