diff --git a/.pydevproject b/.pydevproject
new file mode 100644
index 0000000..2b04565
--- /dev/null
+++ b/.pydevproject
@@ -0,0 +1,5 @@
+
+
+ Default
+ python interpreter
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 556dd40..9c50060 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+
+
+
# CHANGELOG
## 0.1.0-pre.001
@@ -19,5 +22,10 @@
- Portage des contrats complets de `kb_decoder_api` dans `kb-lib::decoder::api`.
- Portage des contrats complets de `kb_materializer_api` dans `kb-lib::materializer::api`.
- Portage des contrats complets de `kb_execution_api` dans `kb-lib::executor::api`.
-- Ajout du contrat neutre `CoreInstructionReplayInput` dans `kb-lib` pour éviter une dépendance cyclique avec `kb-store`.
+- Ajout du contrat neutre `MdCoreInstructionReplayInput` dans `kb-lib` pour éviter une dépendance cyclique avec `kb-store`.
- `kb-lib/src/lib.rs` reste une façade de modules et de réexports.
+
+## 0.1.0-pre.010
+
+- Portage des matérialisateurs natifs lifecycle, administration, compliance et staking.
+- Conservation de leurs 50 tests historiques et ajout du premier test aval de matérialisation.
diff --git a/README.md b/README.md
index 12cb6da..17067a1 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-
+
# Khadhroony Bot3
@@ -63,9 +63,19 @@ cargo clippy --workspace --all-targets
`0.1.0-pre.010` porte les quatre matérialisateurs Solana natifs dans `kb-lib` :
-- `LifecycleMaterializer` pour les comptes System, nonces, ALT, loaders, Feature Gate, contextes ZK et rapports Slashing ;
-- `AdminMaterializer` pour les assignations, configurations et autorités, avec ses projections stateful Token‑2022 et registre ElGamal ;
-- `ComplianceAuditMaterializer` pour les écritures et copies bornées de bytecode ;
-- `StakingMaterializer` pour les transitions Stake et Vote commitées.
+- `MtLifecycleMaterializer` pour les comptes System, nonces, ALT, loaders, Feature Gate, contextes ZK et rapports Slashing ;
+- `MtAdminMaterializer` pour les assignations, configurations et autorités, avec ses projections stateful Token‑2022 et registre ElGamal ;
+- `MtComplianceAuditMaterializer` pour les écritures et copies bornées de bytecode ;
+- `MtStakingMaterializer` pour les transitions Stake et Vote commitées.
-Les identités historiques des processors sont conservées pour la compatibilité des replays, tandis que les targets de tracing suivent désormais la hiérarchie `kb-lib.materializer.*`. Le contrat public `EventMaterializer`, ses modèles d’entrée et ses résultats restent réexportés à la racine de `kb-lib`, afin qu’un futur crate externe puisse fournir un matérialiseur sans dépendre d’une implémentation interne.
+Les identités historiques des processors sont conservées pour la compatibilité des replays, tandis que les targets de tracing suivent désormais la hiérarchie `kb-lib.materializer.*`. Le contrat public `MtApiEventMaterializer`, ses modèles d’entrée et ses résultats restent réexportés à la racine de `kb-lib`, afin qu’un futur crate externe puisse fournir un matérialiseur sans dépendre d’une implémentation interne.
+
+`0.1.0-pre.011` termine le port des matérialisateurs réellement implémentés dans bot2 :
+
+- `MtTransactionAnnotationMaterializer` pour les Memo commitées ;
+- `MtTokenAccountsMaterializer` pour les mutations SPL Token, le lifecycle ATA et les snapshots Token‑2022 ;
+- `MtFeesMaterializer` pour les frais publics et confidentiels Token‑2022, sans prétendre déchiffrer les valeurs confidentielles ;
+- `MtRiskMaterializer` pour les faits de risque SPL Token et ATA sans score arbitraire ;
+- `MtMetadataMaterializer` pour les snapshots descriptifs Token‑2022 et Metaplex, sans fetch off-chain.
+
+Les modules de matérialisation sont privés. Tous les contrats, types concrets et helpers destinés aux consommateurs externes sont exposés exclusivement par `kb-lib/src/lib.rs`. Des tests aval distincts protègent les contrats d’extension `DcApiProtocolDecoder`, `MtApiEventMaterializer` et `ExApiInstructionExecutor`.
diff --git a/ROADMAP.md b/ROADMAP.md
index c3f5d49..56e5610 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -1,5 +1,5 @@
-
+
# ROADMAP — khadhroony-bot3
@@ -13,8 +13,8 @@
- [x] Porter exactement les contrats publics de `kb_decoder_api`.
- [x] Porter exactement les contrats publics des APIs d’exécution et de matérialisation.
- [x] Porter les modèles de `kb_model` vers `kb-lib`.
-- [~] Porter les décodeurs Solana core, SPL et Metaplex.
-- [~] Porter leurs matérialisateurs.
+- [x] Porter les décodeurs Solana core, SPL et Metaplex déjà implémentés dans bot2.
+- [x] Porter leurs matérialisateurs déjà implémentés dans bot2.
- [ ] Porter leurs exécuteurs.
- [x] Fusionner `kb_store_core` et `kb_store_pg` dans `kb-store`.
- [ ] Adapter `kb-pipeline` aux nouveaux chemins publics.
@@ -37,7 +37,7 @@
- [x] Remplacer le scaffold par une architecture intégrée contrats/adaptateurs.
- [x] Porter les DTO, entités, traits et validations store-neutral.
- [x] Porter l’adaptateur PostgreSQL, ses requêtes, diagnostics et initialisations idempotentes.
-- [x] Conserver `CoreInstructionReplayInput` dans `kb-lib` et le réexporter depuis `kb-store`.
+- [x] Conserver `MdCoreInstructionReplayInput` dans `kb-lib` et le réexporter depuis `kb-store`.
- [x] Supprimer la dépendance directe de `kb-store` vers `kb-config`.
- [x] Adapter les règles bot2 devenues incompatibles avec l’architecture bot3.
- [x] Valider `cargo check`, les 84 tests et Clippy pour `kb-store`, puis `cargo check --workspace`.
@@ -90,7 +90,7 @@
### 0.1.0-pre.008 — Décodeurs Token‑2022 et registre ElGamal dans `kb-lib`
-- [x] Remplacer les scaffolds `token_2022` et `elgamal_registry` par les décodeurs exacts validés de bot2.
+- [x] Remplacer les scaffolds `token2022` et `elgamal_registry` par les décodeurs exacts validés de bot2.
- [x] Conserver les 48 enveloppes Token‑2022, les sous-instructions d’extensions identifiables et les interfaces Metadata/Group incorporées.
- [x] Porter le parseur borné des états Mint, Account et Multisig avec leurs entrées TLV ordonnées.
- [x] Maintenir le registre ElGamal comme programme indépendant avec ses deux instructions et son état de compte exact de 64 octets.
@@ -117,12 +117,25 @@
### 0.1.0-pre.010 — Matérialisateurs Solana natifs dans `kb-lib`
-- [x] Porter `LifecycleMaterializer`, `AdminMaterializer`, `ComplianceAuditMaterializer` et `StakingMaterializer` dans les modules consolidés de `kb-lib`.
+- [x] Porter `MtLifecycleMaterializer`, `MtAdminMaterializer`, `MtComplianceAuditMaterializer` et `MtStakingMaterializer` dans les modules consolidés de `kb-lib`.
- [x] Conserver leurs 50 tests de projections natives, de politique de transaction et d’idempotence.
- [x] Réexporter les types concrets et les fonctions stateful publiques depuis la façade de `kb-lib`.
-- [x] Ajouter un test d’intégration aval prouvant qu’un futur crate externe peut implémenter `EventMaterializer` avec la seule API publique.
+- [x] Ajouter un test d’intégration aval prouvant qu’un futur crate externe peut implémenter `MtApiEventMaterializer` avec la seule API publique.
- [x] Porter les targets vers `kb-lib.materializer.admin`, `kb-lib.materializer.compliance`, `kb-lib.materializer.lifecycle` et `kb-lib.materializer.staking`.
- [x] Conserver les identités de processor historiques afin de préserver les clés de replay et d’idempotence existantes.
- [x] Ajouter la règle d’ordre et d’absence de ligne vide interne dans les blocs de réexports publics.
-- [ ] Valider les 371 tests attendus de `kb-lib`, Clippy et le workspace avec Cargo sur la machine de développement.
-- [ ] Poursuivre avec les matérialisateurs Memo, SPL Token, ATA, Token‑2022, registre ElGamal et Metaplex.
+- [x] Valider les 370 tests unitaires et le test d’intégration de `kb-lib`, Clippy et le workspace avec Cargo sur la machine de développement.
+- [x] Poursuivre avec les matérialisateurs Memo, SPL Token, ATA, Token‑2022, registre ElGamal et Metaplex.
+
+### 0.1.0-pre.011 — Matérialisateurs SPL et Metaplex dans `kb-lib`
+
+- [x] Porter `MtTransactionAnnotationMaterializer`, `MtTokenAccountsMaterializer`, `MtFeesMaterializer`, `MtRiskMaterializer` et `MtMetadataMaterializer`.
+- [x] Conserver leurs 45 tests historiques, en plus des 370 tests unitaires déjà validés.
+- [x] Réexporter à la racine les cinq types concrets, les fonctions de snapshots Token‑2022/Metaplex et les types canoniques Metaplex nécessaires à leurs signatures publiques.
+- [x] Rendre privée toute l’arborescence `kb-lib::materializer` et interdire mécaniquement tout nouveau `pub mod` dans cette frontière.
+- [x] Étendre les tests aval aux trois contrats d’extension publics : `DcApiProtocolDecoder`, `MtApiEventMaterializer` et `ExApiInstructionExecutor`.
+- [x] Étendre l’audit aux lignes vides internes des blocs homogènes `pub use` et `pub(crate) use`.
+- [x] Porter les targets de risque, comptes Token et annotations vers `kb-lib.materializer.risk`, `kb-lib.materializer.token` et `kb-lib.materializer.transaction` dans les trois profils.
+- [x] Maintenir le fetch HTTP/IPFS/Arweave hors de `kb-lib`, dans une future crate off-chain dédiée.
+- [ ] Valider les 415 tests unitaires et les trois tests d’intégration de `kb-lib`, Clippy et le workspace avec Cargo sur la machine de développement.
+- [ ] Poursuivre avec les exécuteurs déjà implémentés dans bot2.
diff --git a/RULES.md b/RULES.md
index 005e90b..91450e0 100644
--- a/RULES.md
+++ b/RULES.md
@@ -138,7 +138,7 @@ Aucun renommage massif de modules n'est autorisé sans étape de contrôle dédi
- 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.
- 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` est le nom exact du package Cargo.
+- Hors `kb-lib`, la valeur canonique de `DC_METADATA_MTM_TRACING_TARGET` 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.
- 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`.
@@ -152,14 +152,14 @@ Aucun renommage massif de modules n'est autorisé sans étape de contrôle dédi
- Chaque profil doit router les événements vers les sorties globales `debug.log`, `info.log`, `error.jsonl` et `app.log`, puis vers `debug.log`, `info.log` et `error.jsonl` dans un répertoire propre à chaque crate utilisant `tracing`.
- L’ajout ou la suppression de `tracing.workspace = true` dans une crate impose la mise à jour simultanée de la matrice de routes, de ses tests et de `docs/TRACING_CONTRACT.md`.
- Le contrat détaillé est défini dans `docs/TRACING_CONTRACT.md`.
-- L’audit mécanique spécifique au projet est exécuté par `python3 scripts/audit_khadhroony_workspace_rules.py`. Il couvre notamment `TRACING_TARGET` et l’usage obligatoire de `solana_pubkey::Pubkey` à la place de `solana_address::Address`.
+- L’audit mécanique spécifique au projet est exécuté par `python3 scripts/audit_khadhroony_workspace_rules.py`. Il couvre notamment `DC_METADATA_MTM_TRACING_TARGET` et l’usage obligatoire de `solana_pubkey::Pubkey` à la place de `solana_address::Address`.
## Règles de réutilisation des interfaces Solana et SPL
- 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 `EventMaterializer` 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 `EventMaterializer` 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 `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 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`.
@@ -244,7 +244,7 @@ Les `program_id` connus doivent être définis une seule fois dans `kb-program-i
- 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 `CoreInstructionReplayInput`, appartiennent à `kb-lib`; `kb-store` les consomme et les réexporte sans les dupliquer.
+- 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.
- Les adaptateurs concrets implémentent les mêmes traits neutres et ne font pas fuiter leurs types de connexion dans les contrats.
diff --git a/config/example.config.json b/config/example.config.json
index 6868e17..54c1db3 100644
--- a/config/example.config.json
+++ b/config/example.config.json
@@ -28,7 +28,7 @@
"kb-lib.decoder.spl.elgamal_registry",
"kb-lib.decoder.spl.memo",
"kb-lib.decoder.spl.token",
- "kb-lib.decoder.spl.token_2022",
+ "kb-lib.decoder.spl.token2022",
"kb_execution_solana",
"kb_executor_metadata_metaplex_token_metadata",
"kb_executor_metadata_spl_name_service",
@@ -40,15 +40,15 @@
"kb_executor_spl_noop",
"kb_executor_spl_single_pool",
"kb_executor_spl_token",
- "kb_executor_spl_token_2022",
+ "kb_executor_spl_token2022",
"kb-logging",
"kb-lib.materializer.admin",
"kb-lib.materializer.compliance",
"kb-lib.materializer.lifecycle",
- "kb_materializer_risk",
+ "kb-lib.materializer.risk",
"kb-lib.materializer.staking",
- "kb_materializer_token_accounts",
- "kb_materializer_transaction_annotations",
+ "kb-lib.materializer.token",
+ "kb-lib.materializer.transaction",
"kb_pipeline",
"kb_rpc",
"kb-store",
@@ -810,42 +810,42 @@
]
},
{
- "name": "file_kb_materializer_transaction_annotations_debug",
+ "name": "file_kb_lib_materializer_transaction_debug",
"enabled": true,
"sink": "file",
"level": "debug",
- "path": "logs/devnet/kb_materializer_transaction_annotations/debug.log",
+ "path": "logs/devnet/kb-lib/materializer/transaction/debug.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_transaction_annotations"
+ "kb-lib.materializer.transaction"
]
},
{
- "name": "file_kb_materializer_transaction_annotations_info",
+ "name": "file_kb_lib_materializer_transaction_info",
"enabled": true,
"sink": "file",
"level": "info",
- "path": "logs/devnet/kb_materializer_transaction_annotations/info.log",
+ "path": "logs/devnet/kb-lib/materializer/transaction/info.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_transaction_annotations"
+ "kb-lib.materializer.transaction"
]
},
{
- "name": "file_kb_materializer_transaction_annotations_error",
+ "name": "file_kb_lib_materializer_transaction_error",
"enabled": true,
"sink": "file",
"level": "error",
- "path": "logs/devnet/kb_materializer_transaction_annotations/error.jsonl",
+ "path": "logs/devnet/kb-lib/materializer/transaction/error.jsonl",
"rotation": "daily",
"format": "json",
"ansi": false,
"targets": [
- "kb_materializer_transaction_annotations"
+ "kb-lib.materializer.transaction"
]
},
{
@@ -1044,120 +1044,120 @@
]
},
{
- "name": "file_kb_materializer_token_accounts_debug",
+ "name": "file_kb_lib_materializer_token_debug",
"enabled": true,
"sink": "file",
"level": "debug",
- "path": "logs/devnet/kb_materializer_token_accounts/debug.log",
+ "path": "logs/devnet/kb-lib/materializer/token/debug.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_token_accounts"
+ "kb-lib.materializer.token"
]
},
{
- "name": "file_kb_materializer_token_accounts_info",
+ "name": "file_kb_lib_materializer_token_info",
"enabled": true,
"sink": "file",
"level": "info",
- "path": "logs/devnet/kb_materializer_token_accounts/info.log",
+ "path": "logs/devnet/kb-lib/materializer/token/info.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_token_accounts"
+ "kb-lib.materializer.token"
]
},
{
- "name": "file_kb_materializer_token_accounts_error",
+ "name": "file_kb_lib_materializer_token_error",
"enabled": true,
"sink": "file",
"level": "error",
- "path": "logs/devnet/kb_materializer_token_accounts/error.jsonl",
+ "path": "logs/devnet/kb-lib/materializer/token/error.jsonl",
"rotation": "daily",
"format": "json",
"ansi": false,
"targets": [
- "kb_materializer_token_accounts"
+ "kb-lib.materializer.token"
]
},
{
- "name": "file_kb_materializer_risk_debug",
+ "name": "file_kb_lib_materializer_risk_debug",
"enabled": true,
"sink": "file",
"level": "debug",
- "path": "logs/devnet/kb_materializer_risk/debug.log",
+ "path": "logs/devnet/kb-lib/materializer/risk/debug.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_risk"
+ "kb-lib.materializer.risk"
]
},
{
- "name": "file_kb_materializer_risk_info",
+ "name": "file_kb_lib_materializer_risk_info",
"enabled": true,
"sink": "file",
"level": "info",
- "path": "logs/devnet/kb_materializer_risk/info.log",
+ "path": "logs/devnet/kb-lib/materializer/risk/info.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_risk"
+ "kb-lib.materializer.risk"
]
},
{
- "name": "file_kb_materializer_risk_error",
+ "name": "file_kb_lib_materializer_risk_error",
"enabled": true,
"sink": "file",
"level": "error",
- "path": "logs/devnet/kb_materializer_risk/error.jsonl",
+ "path": "logs/devnet/kb-lib/materializer/risk/error.jsonl",
"rotation": "daily",
"format": "json",
"ansi": false,
"targets": [
- "kb_materializer_risk"
+ "kb-lib.materializer.risk"
]
},
{
- "name": "file_kb_lib_decoder_spl_token_2022_debug",
+ "name": "file_kb_lib_decoder_spl_token2022_debug",
"enabled": true,
"sink": "file",
"level": "debug",
- "path": "logs/devnet/kb_lib_decoder_spl_token_2022/debug.log",
+ "path": "logs/devnet/kb_lib_decoder_spl_token2022/debug.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb-lib.decoder.spl.token_2022"
+ "kb-lib.decoder.spl.token2022"
]
},
{
- "name": "file_kb_lib_decoder_spl_token_2022_info",
+ "name": "file_kb_lib_decoder_spl_token2022_info",
"enabled": true,
"sink": "file",
"level": "info",
- "path": "logs/devnet/kb_lib_decoder_spl_token_2022/info.log",
+ "path": "logs/devnet/kb_lib_decoder_spl_token2022/info.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb-lib.decoder.spl.token_2022"
+ "kb-lib.decoder.spl.token2022"
]
},
{
- "name": "file_kb_lib_decoder_spl_token_2022_error",
+ "name": "file_kb_lib_decoder_spl_token2022_error",
"enabled": true,
"sink": "file",
"level": "error",
- "path": "logs/devnet/kb_lib_decoder_spl_token_2022/error.jsonl",
+ "path": "logs/devnet/kb_lib_decoder_spl_token2022/error.jsonl",
"rotation": "daily",
"format": "json",
"ansi": false,
"targets": [
- "kb-lib.decoder.spl.token_2022"
+ "kb-lib.decoder.spl.token2022"
]
},
{
@@ -1317,42 +1317,42 @@
]
},
{
- "name": "file_kb_executor_spl_token_2022_debug",
+ "name": "file_kb_executor_spl_token2022_debug",
"enabled": true,
"sink": "file",
"level": "debug",
- "path": "logs/devnet/kb_executor_spl_token_2022/debug.log",
+ "path": "logs/devnet/kb_executor_spl_token2022/debug.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_executor_spl_token_2022"
+ "kb_executor_spl_token2022"
]
},
{
- "name": "file_kb_executor_spl_token_2022_info",
+ "name": "file_kb_executor_spl_token2022_info",
"enabled": true,
"sink": "file",
"level": "info",
- "path": "logs/devnet/kb_executor_spl_token_2022/info.log",
+ "path": "logs/devnet/kb_executor_spl_token2022/info.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_executor_spl_token_2022"
+ "kb_executor_spl_token2022"
]
},
{
- "name": "file_kb_executor_spl_token_2022_error",
+ "name": "file_kb_executor_spl_token2022_error",
"enabled": true,
"sink": "file",
"level": "error",
- "path": "logs/devnet/kb_executor_spl_token_2022/error.jsonl",
+ "path": "logs/devnet/kb_executor_spl_token2022/error.jsonl",
"rotation": "daily",
"format": "json",
"ansi": false,
"targets": [
- "kb_executor_spl_token_2022"
+ "kb_executor_spl_token2022"
]
}
],
@@ -1630,7 +1630,7 @@
"kb-lib.decoder.spl.elgamal_registry",
"kb-lib.decoder.spl.memo",
"kb-lib.decoder.spl.token",
- "kb-lib.decoder.spl.token_2022",
+ "kb-lib.decoder.spl.token2022",
"kb_execution_solana",
"kb_executor_metadata_metaplex_token_metadata",
"kb_executor_metadata_spl_name_service",
@@ -1642,15 +1642,15 @@
"kb_executor_spl_noop",
"kb_executor_spl_single_pool",
"kb_executor_spl_token",
- "kb_executor_spl_token_2022",
+ "kb_executor_spl_token2022",
"kb-logging",
"kb-lib.materializer.admin",
"kb-lib.materializer.compliance",
"kb-lib.materializer.lifecycle",
- "kb_materializer_risk",
+ "kb-lib.materializer.risk",
"kb-lib.materializer.staking",
- "kb_materializer_token_accounts",
- "kb_materializer_transaction_annotations",
+ "kb-lib.materializer.token",
+ "kb-lib.materializer.transaction",
"kb_pipeline",
"kb_rpc",
"kb-store",
@@ -2412,42 +2412,42 @@
]
},
{
- "name": "file_kb_materializer_transaction_annotations_debug",
+ "name": "file_kb_lib_materializer_transaction_debug",
"enabled": true,
"sink": "file",
"level": "debug",
- "path": "logs/mainnet_research/kb_materializer_transaction_annotations/debug.log",
+ "path": "logs/mainnet_research/kb-lib/materializer/transaction/debug.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_transaction_annotations"
+ "kb-lib.materializer.transaction"
]
},
{
- "name": "file_kb_materializer_transaction_annotations_info",
+ "name": "file_kb_lib_materializer_transaction_info",
"enabled": true,
"sink": "file",
"level": "info",
- "path": "logs/mainnet_research/kb_materializer_transaction_annotations/info.log",
+ "path": "logs/mainnet_research/kb-lib/materializer/transaction/info.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_transaction_annotations"
+ "kb-lib.materializer.transaction"
]
},
{
- "name": "file_kb_materializer_transaction_annotations_error",
+ "name": "file_kb_lib_materializer_transaction_error",
"enabled": true,
"sink": "file",
"level": "error",
- "path": "logs/mainnet_research/kb_materializer_transaction_annotations/error.jsonl",
+ "path": "logs/mainnet_research/kb-lib/materializer/transaction/error.jsonl",
"rotation": "daily",
"format": "json",
"ansi": false,
"targets": [
- "kb_materializer_transaction_annotations"
+ "kb-lib.materializer.transaction"
]
},
{
@@ -2646,120 +2646,120 @@
]
},
{
- "name": "file_kb_materializer_token_accounts_debug",
+ "name": "file_kb_lib_materializer_token_debug",
"enabled": true,
"sink": "file",
"level": "debug",
- "path": "logs/mainnet_research/kb_materializer_token_accounts/debug.log",
+ "path": "logs/mainnet_research/kb-lib/materializer/token/debug.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_token_accounts"
+ "kb-lib.materializer.token"
]
},
{
- "name": "file_kb_materializer_token_accounts_info",
+ "name": "file_kb_lib_materializer_token_info",
"enabled": true,
"sink": "file",
"level": "info",
- "path": "logs/mainnet_research/kb_materializer_token_accounts/info.log",
+ "path": "logs/mainnet_research/kb-lib/materializer/token/info.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_token_accounts"
+ "kb-lib.materializer.token"
]
},
{
- "name": "file_kb_materializer_token_accounts_error",
+ "name": "file_kb_lib_materializer_token_error",
"enabled": true,
"sink": "file",
"level": "error",
- "path": "logs/mainnet_research/kb_materializer_token_accounts/error.jsonl",
+ "path": "logs/mainnet_research/kb-lib/materializer/token/error.jsonl",
"rotation": "daily",
"format": "json",
"ansi": false,
"targets": [
- "kb_materializer_token_accounts"
+ "kb-lib.materializer.token"
]
},
{
- "name": "file_kb_materializer_risk_debug",
+ "name": "file_kb_lib_materializer_risk_debug",
"enabled": true,
"sink": "file",
"level": "debug",
- "path": "logs/mainnet_research/kb_materializer_risk/debug.log",
+ "path": "logs/mainnet_research/kb-lib/materializer/risk/debug.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_risk"
+ "kb-lib.materializer.risk"
]
},
{
- "name": "file_kb_materializer_risk_info",
+ "name": "file_kb_lib_materializer_risk_info",
"enabled": true,
"sink": "file",
"level": "info",
- "path": "logs/mainnet_research/kb_materializer_risk/info.log",
+ "path": "logs/mainnet_research/kb-lib/materializer/risk/info.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_risk"
+ "kb-lib.materializer.risk"
]
},
{
- "name": "file_kb_materializer_risk_error",
+ "name": "file_kb_lib_materializer_risk_error",
"enabled": true,
"sink": "file",
"level": "error",
- "path": "logs/mainnet_research/kb_materializer_risk/error.jsonl",
+ "path": "logs/mainnet_research/kb-lib/materializer/risk/error.jsonl",
"rotation": "daily",
"format": "json",
"ansi": false,
"targets": [
- "kb_materializer_risk"
+ "kb-lib.materializer.risk"
]
},
{
- "name": "file_kb_lib_decoder_spl_token_2022_debug",
+ "name": "file_kb_lib_decoder_spl_token2022_debug",
"enabled": true,
"sink": "file",
"level": "debug",
- "path": "logs/mainnet_research/kb_lib_decoder_spl_token_2022/debug.log",
+ "path": "logs/mainnet_research/kb_lib_decoder_spl_token2022/debug.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb-lib.decoder.spl.token_2022"
+ "kb-lib.decoder.spl.token2022"
]
},
{
- "name": "file_kb_lib_decoder_spl_token_2022_info",
+ "name": "file_kb_lib_decoder_spl_token2022_info",
"enabled": true,
"sink": "file",
"level": "info",
- "path": "logs/mainnet_research/kb_lib_decoder_spl_token_2022/info.log",
+ "path": "logs/mainnet_research/kb_lib_decoder_spl_token2022/info.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb-lib.decoder.spl.token_2022"
+ "kb-lib.decoder.spl.token2022"
]
},
{
- "name": "file_kb_lib_decoder_spl_token_2022_error",
+ "name": "file_kb_lib_decoder_spl_token2022_error",
"enabled": true,
"sink": "file",
"level": "error",
- "path": "logs/mainnet_research/kb_lib_decoder_spl_token_2022/error.jsonl",
+ "path": "logs/mainnet_research/kb_lib_decoder_spl_token2022/error.jsonl",
"rotation": "daily",
"format": "json",
"ansi": false,
"targets": [
- "kb-lib.decoder.spl.token_2022"
+ "kb-lib.decoder.spl.token2022"
]
},
{
@@ -2919,42 +2919,42 @@
]
},
{
- "name": "file_kb_executor_spl_token_2022_debug",
+ "name": "file_kb_executor_spl_token2022_debug",
"enabled": true,
"sink": "file",
"level": "debug",
- "path": "logs/mainnet_research/kb_executor_spl_token_2022/debug.log",
+ "path": "logs/mainnet_research/kb_executor_spl_token2022/debug.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_executor_spl_token_2022"
+ "kb_executor_spl_token2022"
]
},
{
- "name": "file_kb_executor_spl_token_2022_info",
+ "name": "file_kb_executor_spl_token2022_info",
"enabled": true,
"sink": "file",
"level": "info",
- "path": "logs/mainnet_research/kb_executor_spl_token_2022/info.log",
+ "path": "logs/mainnet_research/kb_executor_spl_token2022/info.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_executor_spl_token_2022"
+ "kb_executor_spl_token2022"
]
},
{
- "name": "file_kb_executor_spl_token_2022_error",
+ "name": "file_kb_executor_spl_token2022_error",
"enabled": true,
"sink": "file",
"level": "error",
- "path": "logs/mainnet_research/kb_executor_spl_token_2022/error.jsonl",
+ "path": "logs/mainnet_research/kb_executor_spl_token2022/error.jsonl",
"rotation": "daily",
"format": "json",
"ansi": false,
"targets": [
- "kb_executor_spl_token_2022"
+ "kb_executor_spl_token2022"
]
}
],
@@ -3432,7 +3432,7 @@
"kb-lib.decoder.spl.elgamal_registry",
"kb-lib.decoder.spl.memo",
"kb-lib.decoder.spl.token",
- "kb-lib.decoder.spl.token_2022",
+ "kb-lib.decoder.spl.token2022",
"kb_execution_solana",
"kb_executor_metadata_metaplex_token_metadata",
"kb_executor_metadata_spl_name_service",
@@ -3444,15 +3444,15 @@
"kb_executor_spl_noop",
"kb_executor_spl_single_pool",
"kb_executor_spl_token",
- "kb_executor_spl_token_2022",
+ "kb_executor_spl_token2022",
"kb-logging",
"kb-lib.materializer.admin",
"kb-lib.materializer.compliance",
"kb-lib.materializer.lifecycle",
- "kb_materializer_risk",
+ "kb-lib.materializer.risk",
"kb-lib.materializer.staking",
- "kb_materializer_token_accounts",
- "kb_materializer_transaction_annotations",
+ "kb-lib.materializer.token",
+ "kb-lib.materializer.transaction",
"kb_pipeline",
"kb_rpc",
"kb-store",
@@ -4214,42 +4214,42 @@
]
},
{
- "name": "file_kb_materializer_transaction_annotations_debug",
+ "name": "file_kb_lib_materializer_transaction_debug",
"enabled": true,
"sink": "file",
"level": "debug",
- "path": "logs/mainnet/kb_materializer_transaction_annotations/debug.log",
+ "path": "logs/mainnet/kb-lib/materializer/transaction/debug.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_transaction_annotations"
+ "kb-lib.materializer.transaction"
]
},
{
- "name": "file_kb_materializer_transaction_annotations_info",
+ "name": "file_kb_lib_materializer_transaction_info",
"enabled": true,
"sink": "file",
"level": "info",
- "path": "logs/mainnet/kb_materializer_transaction_annotations/info.log",
+ "path": "logs/mainnet/kb-lib/materializer/transaction/info.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_transaction_annotations"
+ "kb-lib.materializer.transaction"
]
},
{
- "name": "file_kb_materializer_transaction_annotations_error",
+ "name": "file_kb_lib_materializer_transaction_error",
"enabled": true,
"sink": "file",
"level": "error",
- "path": "logs/mainnet/kb_materializer_transaction_annotations/error.jsonl",
+ "path": "logs/mainnet/kb-lib/materializer/transaction/error.jsonl",
"rotation": "daily",
"format": "json",
"ansi": false,
"targets": [
- "kb_materializer_transaction_annotations"
+ "kb-lib.materializer.transaction"
]
},
{
@@ -4448,120 +4448,120 @@
]
},
{
- "name": "file_kb_materializer_token_accounts_debug",
+ "name": "file_kb_lib_materializer_token_debug",
"enabled": true,
"sink": "file",
"level": "debug",
- "path": "logs/mainnet/kb_materializer_token_accounts/debug.log",
+ "path": "logs/mainnet/kb-lib/materializer/token/debug.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_token_accounts"
+ "kb-lib.materializer.token"
]
},
{
- "name": "file_kb_materializer_token_accounts_info",
+ "name": "file_kb_lib_materializer_token_info",
"enabled": true,
"sink": "file",
"level": "info",
- "path": "logs/mainnet/kb_materializer_token_accounts/info.log",
+ "path": "logs/mainnet/kb-lib/materializer/token/info.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_token_accounts"
+ "kb-lib.materializer.token"
]
},
{
- "name": "file_kb_materializer_token_accounts_error",
+ "name": "file_kb_lib_materializer_token_error",
"enabled": true,
"sink": "file",
"level": "error",
- "path": "logs/mainnet/kb_materializer_token_accounts/error.jsonl",
+ "path": "logs/mainnet/kb-lib/materializer/token/error.jsonl",
"rotation": "daily",
"format": "json",
"ansi": false,
"targets": [
- "kb_materializer_token_accounts"
+ "kb-lib.materializer.token"
]
},
{
- "name": "file_kb_materializer_risk_debug",
+ "name": "file_kb_lib_materializer_risk_debug",
"enabled": true,
"sink": "file",
"level": "debug",
- "path": "logs/mainnet/kb_materializer_risk/debug.log",
+ "path": "logs/mainnet/kb-lib/materializer/risk/debug.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_risk"
+ "kb-lib.materializer.risk"
]
},
{
- "name": "file_kb_materializer_risk_info",
+ "name": "file_kb_lib_materializer_risk_info",
"enabled": true,
"sink": "file",
"level": "info",
- "path": "logs/mainnet/kb_materializer_risk/info.log",
+ "path": "logs/mainnet/kb-lib/materializer/risk/info.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_materializer_risk"
+ "kb-lib.materializer.risk"
]
},
{
- "name": "file_kb_materializer_risk_error",
+ "name": "file_kb_lib_materializer_risk_error",
"enabled": true,
"sink": "file",
"level": "error",
- "path": "logs/mainnet/kb_materializer_risk/error.jsonl",
+ "path": "logs/mainnet/kb-lib/materializer/risk/error.jsonl",
"rotation": "daily",
"format": "json",
"ansi": false,
"targets": [
- "kb_materializer_risk"
+ "kb-lib.materializer.risk"
]
},
{
- "name": "file_kb_lib_decoder_spl_token_2022_debug",
+ "name": "file_kb_lib_decoder_spl_token2022_debug",
"enabled": true,
"sink": "file",
"level": "debug",
- "path": "logs/mainnet/kb_lib_decoder_spl_token_2022/debug.log",
+ "path": "logs/mainnet/kb_lib_decoder_spl_token2022/debug.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb-lib.decoder.spl.token_2022"
+ "kb-lib.decoder.spl.token2022"
]
},
{
- "name": "file_kb_lib_decoder_spl_token_2022_info",
+ "name": "file_kb_lib_decoder_spl_token2022_info",
"enabled": true,
"sink": "file",
"level": "info",
- "path": "logs/mainnet/kb_lib_decoder_spl_token_2022/info.log",
+ "path": "logs/mainnet/kb_lib_decoder_spl_token2022/info.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb-lib.decoder.spl.token_2022"
+ "kb-lib.decoder.spl.token2022"
]
},
{
- "name": "file_kb_lib_decoder_spl_token_2022_error",
+ "name": "file_kb_lib_decoder_spl_token2022_error",
"enabled": true,
"sink": "file",
"level": "error",
- "path": "logs/mainnet/kb_lib_decoder_spl_token_2022/error.jsonl",
+ "path": "logs/mainnet/kb_lib_decoder_spl_token2022/error.jsonl",
"rotation": "daily",
"format": "json",
"ansi": false,
"targets": [
- "kb-lib.decoder.spl.token_2022"
+ "kb-lib.decoder.spl.token2022"
]
},
{
@@ -4721,42 +4721,42 @@
]
},
{
- "name": "file_kb_executor_spl_token_2022_debug",
+ "name": "file_kb_executor_spl_token2022_debug",
"enabled": true,
"sink": "file",
"level": "debug",
- "path": "logs/mainnet/kb_executor_spl_token_2022/debug.log",
+ "path": "logs/mainnet/kb_executor_spl_token2022/debug.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_executor_spl_token_2022"
+ "kb_executor_spl_token2022"
]
},
{
- "name": "file_kb_executor_spl_token_2022_info",
+ "name": "file_kb_executor_spl_token2022_info",
"enabled": true,
"sink": "file",
"level": "info",
- "path": "logs/mainnet/kb_executor_spl_token_2022/info.log",
+ "path": "logs/mainnet/kb_executor_spl_token2022/info.log",
"rotation": "daily",
"format": "human",
"ansi": false,
"targets": [
- "kb_executor_spl_token_2022"
+ "kb_executor_spl_token2022"
]
},
{
- "name": "file_kb_executor_spl_token_2022_error",
+ "name": "file_kb_executor_spl_token2022_error",
"enabled": true,
"sink": "file",
"level": "error",
- "path": "logs/mainnet/kb_executor_spl_token_2022/error.jsonl",
+ "path": "logs/mainnet/kb_executor_spl_token2022/error.jsonl",
"rotation": "daily",
"format": "json",
"ansi": false,
"targets": [
- "kb_executor_spl_token_2022"
+ "kb_executor_spl_token2022"
]
}
],
diff --git a/docs/CORE_EXTRACTION_CONTRACTS.md b/docs/CORE_EXTRACTION_CONTRACTS.md
index 1a06582..7c86a12 100644
--- a/docs/CORE_EXTRACTION_CONTRACTS.md
+++ b/docs/CORE_EXTRACTION_CONTRACTS.md
@@ -1,5 +1,5 @@
-
+
# Contrats d’extraction core Solana
@@ -38,8 +38,8 @@ L’extraction refuse explicitement :
- un `canonical_json` absent ;
- un `canonical_json_hash` absent ;
-- une version différente de `CANONICAL_TRANSACTION_FORMAT_VERSION` ;
-- un JSON non désérialisable en `CanonicalTransaction` ;
+- une version différente de `MD_CANONICAL_TRANSACTION_FORMAT_VERSION` ;
+- un JSON non désérialisable en `MdCanonicalTransaction` ;
- une signature ou un slot différent de la ligne raw ;
- un hash recalculé différent du hash stocké ;
- un indice de programme ou de compte hors de l’espace résolu.
diff --git a/docs/CORE_PROGRAM_IDS.md b/docs/CORE_PROGRAM_IDS.md
index 7374b9b..14798f3 100644
--- a/docs/CORE_PROGRAM_IDS.md
+++ b/docs/CORE_PROGRAM_IDS.md
@@ -14,50 +14,50 @@ Ce fichier sépare les identifiants primitifs Solana/SPL du registre des surface
## Table de contrôle
-| Canonique | Program ID | Source | Type | Crate cible | Statut |
-|--------------------------------------------|------------------------------------------------|-----------------------------------|----------------------|-------------------------------------------|-------------------------------------|
-| `core_solana_address_lookup_table_v1` | `AddressLookupTab1e1111111111111111111111111` | `address_lookup_table` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_bpf_loader_deprecated_v1` | `BPFLoader1111111111111111111111111111111111` | `bpf_loader_deprecated` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_bpf_loader_v2` | `BPFLoader2111111111111111111111111111111111` | `bpf_loader` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_bpf_loader_upgradeable_v1` | `BPFLoaderUpgradeab1e11111111111111111111111` | `bpf_loader_upgradeable` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_compute_budget_v1` | `ComputeBudget111111111111111111111111111111` | `compute_budget` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_config_v1` | `Config1111111111111111111111111111111111111` | `config` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_ed25519_v1` | `Ed25519SigVerify111111111111111111111111111` | `ed25519` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_feature_v1` | `Feature111111111111111111111111111111111111` | `feature` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_incinerator_v1` | `1nc1nerator11111111111111111111111111111111` | `incinerator` | `well_known_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_loader_v4` | `LoaderV411111111111111111111111111111111111` | `loader_v4` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_native_loader_v1` | `NativeLoader1111111111111111111111111111111` | `native_loader` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_secp256k1_v1` | `KeccakSecp256k11111111111111111111111111111` | `secp256k1` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_secp256r1_v1` | `Secp256r1SigVerify1111111111111111111111111` | `secp256r1` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_slashing_v1` | `S1ashing11111111111111111111111111111111111` | `slashing` | `stateless_program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_stake_config_v1` | `StakeConfig11111111111111111111111111111111` | `stake_config` | `well_known_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_stake_v1` | `Stake11111111111111111111111111111111111111` | `stake` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_system_v1` | `11111111111111111111111111111111` | `system` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_sysvar_clock_v1` | `SysvarC1ock11111111111111111111111111111111` | `sysvar_clock` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_epoch_rewards_v1` | `SysvarEpochRewards1111111111111111111111111` | `sysvar_epoch_rewards` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_epoch_schedule_v1` | `SysvarEpochSchedu1e111111111111111111111111` | `sysvar_epoch_schedule` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_fees_v1` | `SysvarFees111111111111111111111111111111111` | `sysvar_fees` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_instructions_v1` | `Sysvar1nstructions1111111111111111111111111` | `sysvar_instructions` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_last_restart_slot_v1` | `SysvarLastRestartS1ot1111111111111111111111` | `sysvar_last_restart_slot` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_recent_blockhashes_v1` | `SysvarRecentB1ockHashes11111111111111111111` | `sysvar_recent_blockhashes` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_rent_v1` | `SysvarRent111111111111111111111111111111111` | `sysvar_rent` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_rewards_v1` | `SysvarRewards111111111111111111111111111111` | `sysvar_rewards` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_slot_hashes_v1` | `SysvarS1otHashes111111111111111111111111111` | `sysvar_slot_hashes` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_slot_history_v1` | `SysvarS1otHistory11111111111111111111111111` | `sysvar_slot_history` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_stake_history_v1` | `SysvarStakeHistory1111111111111111111111111` | `sysvar_stake_history` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_v1` | `Sysvar1111111111111111111111111111111111111` | `sysvar` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_vote_v1` | `Vote111111111111111111111111111111111111111` | `vote` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_zk_elgamal_proof_v1` | `ZkE1Gama1Proof11111111111111111111111111111` | `zk_elgamal_proof` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_zk_token_proof_v1` | `ZkTokenProof1111111111111111111111111111111` | `zk_token_proof` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_spl_associated_token_account_v1` | `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL` | `associated_token_account` | `program` | `kb_decoder_spl_associated_token_account` | `core_handled` |
-| `core_spl_account_compression_v1` | `cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK` | `spl_account_compression` | `program` | `kb_decoder_spl_account_compression` | `core_specialized_reserved_current` |
-| `core_spl_memo_v1` | `Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo` | `spl_memo_v1` | `program` | `kb_decoder_spl_memo` | `core_specialized_reserved_current` |
-| `core_spl_memo_v3` | `MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr` | `spl_memo_v3` | `program` | `kb_decoder_spl_memo` | `core_specialized_reserved_current` |
-| `core_spl_memo_v4` | `Memo4c2pN8afCj432Lb7RMVKi9PbQnnW7ewFFaV3oAH` | `spl_memo_v4` | `program` | `kb_decoder_spl_memo` | `core_specialized_reserved_current` |
-| `core_spl_noop_v1` | `noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV` | `spl_noop` | `program` | `kb_decoder_spl_noop` | `core_specialized_reserved_current` |
-| `core_spl_single_pool_v1` | `SVSPxpvHdN29nkVg9rPapPNDddN5DipNLRUFhyjFThE` | `spl_single_pool` | `program` | `kb_decoder_spl_single_pool` | `core_specialized_reserved_current` |
-| `core_spl_name_service_v1` | `namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX` | `spl_name_service` | `program` | `kb_decoder_metadata_spl_name_service` | `core_specialized_reserved_current` |
-| `core_spl_stake_pool_v1` | `SPoo1Ku8WFXoNDMHPsrGSTSG1Y47rzgn41SLUNakuHy` | `stake_pool` | `program` | `kb_decoder_spl_stake_pool` | `core_specialized_reserved_current` |
-| `core_spl_token_2022_v2022` | `TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb` | `token_2022` | `program` | `kb_decoder_spl_token_2022` | `core_handled` |
-| `core_spl_token_2022_elgamal_registry_v1` | `regVYJW7tcT8zipN5YiBvHsvR5jXW1uLFxaHSbugABg` | `spl_token_2022_elgamal_registry` | `program` | `kb_decoder_spl_token_2022` | `core_specialized_reserved_current` |
-| `core_spl_token_v1` | `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA` | `token` | `program` | `kb_decoder_spl_token` | `core_handled` |
+| Canonique | Program ID | Source | Type | Crate cible | Statut |
+|--------------------------------------------|------------------------------------------------|----------------------------------|----------------------|-------------------------------------------|-------------------------------------|
+| `core_solana_address_lookup_table_v1` | `AddressLookupTab1e1111111111111111111111111` | `address_lookup_table` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_bpf_loader_deprecated_v1` | `BPFLoader1111111111111111111111111111111111` | `bpf_loader_deprecated` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_bpf_loader_v2` | `BPFLoader2111111111111111111111111111111111` | `bpf_loader` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_bpf_loader_upgradeable_v1` | `BPFLoaderUpgradeab1e11111111111111111111111` | `bpf_loader_upgradeable` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_compute_budget_v1` | `ComputeBudget111111111111111111111111111111` | `compute_budget` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_config_v1` | `Config1111111111111111111111111111111111111` | `config` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_ed25519_v1` | `Ed25519SigVerify111111111111111111111111111` | `ed25519` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_feature_v1` | `Feature111111111111111111111111111111111111` | `feature` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_incinerator_v1` | `1nc1nerator11111111111111111111111111111111` | `incinerator` | `well_known_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_loader_v4` | `LoaderV411111111111111111111111111111111111` | `loader_v4` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_native_loader_v1` | `NativeLoader1111111111111111111111111111111` | `native_loader` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_secp256k1_v1` | `KeccakSecp256k11111111111111111111111111111` | `secp256k1` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_secp256r1_v1` | `Secp256r1SigVerify1111111111111111111111111` | `secp256r1` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_slashing_v1` | `S1ashing11111111111111111111111111111111111` | `slashing` | `stateless_program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_stake_config_v1` | `StakeConfig11111111111111111111111111111111` | `stake_config` | `well_known_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_stake_v1` | `Stake11111111111111111111111111111111111111` | `stake` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_system_v1` | `11111111111111111111111111111111` | `system` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_sysvar_clock_v1` | `SysvarC1ock11111111111111111111111111111111` | `sysvar_clock` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_epoch_rewards_v1` | `SysvarEpochRewards1111111111111111111111111` | `sysvar_epoch_rewards` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_epoch_schedule_v1` | `SysvarEpochSchedu1e111111111111111111111111` | `sysvar_epoch_schedule` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_fees_v1` | `SysvarFees111111111111111111111111111111111` | `sysvar_fees` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_instructions_v1` | `Sysvar1nstructions1111111111111111111111111` | `sysvar_instructions` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_last_restart_slot_v1` | `SysvarLastRestartS1ot1111111111111111111111` | `sysvar_last_restart_slot` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_recent_blockhashes_v1` | `SysvarRecentB1ockHashes11111111111111111111` | `sysvar_recent_blockhashes` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_rent_v1` | `SysvarRent111111111111111111111111111111111` | `sysvar_rent` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_rewards_v1` | `SysvarRewards111111111111111111111111111111` | `sysvar_rewards` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_slot_hashes_v1` | `SysvarS1otHashes111111111111111111111111111` | `sysvar_slot_hashes` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_slot_history_v1` | `SysvarS1otHistory11111111111111111111111111` | `sysvar_slot_history` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_stake_history_v1` | `SysvarStakeHistory1111111111111111111111111` | `sysvar_stake_history` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_v1` | `Sysvar1111111111111111111111111111111111111` | `sysvar` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_vote_v1` | `Vote111111111111111111111111111111111111111` | `vote` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_zk_elgamal_proof_v1` | `ZkE1Gama1Proof11111111111111111111111111111` | `zk_elgamal_proof` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_zk_token_proof_v1` | `ZkTokenProof1111111111111111111111111111111` | `zk_token_proof` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_spl_associated_token_account_v1` | `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL` | `associated_token_account` | `program` | `kb_decoder_spl_associated_token_account` | `core_handled` |
+| `core_spl_account_compression_v1` | `cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK` | `spl_account_compression` | `program` | `kb_decoder_spl_account_compression` | `core_specialized_reserved_current` |
+| `core_spl_memo_v1` | `Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo` | `spl_memo_v1` | `program` | `kb_decoder_spl_memo` | `core_specialized_reserved_current` |
+| `core_spl_memo_v3` | `MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr` | `spl_memo_v3` | `program` | `kb_decoder_spl_memo` | `core_specialized_reserved_current` |
+| `core_spl_memo_v4` | `Memo4c2pN8afCj432Lb7RMVKi9PbQnnW7ewFFaV3oAH` | `spl_memo_v4` | `program` | `kb_decoder_spl_memo` | `core_specialized_reserved_current` |
+| `core_spl_noop_v1` | `noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV` | `spl_noop` | `program` | `kb_decoder_spl_noop` | `core_specialized_reserved_current` |
+| `core_spl_single_pool_v1` | `SVSPxpvHdN29nkVg9rPapPNDddN5DipNLRUFhyjFThE` | `spl_single_pool` | `program` | `kb_decoder_spl_single_pool` | `core_specialized_reserved_current` |
+| `core_spl_name_service_v1` | `namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX` | `spl_name_service` | `program` | `kb_decoder_metadata_spl_name_service` | `core_specialized_reserved_current` |
+| `core_spl_stake_pool_v1` | `SPoo1Ku8WFXoNDMHPsrGSTSG1Y47rzgn41SLUNakuHy` | `stake_pool` | `program` | `kb_decoder_spl_stake_pool` | `core_specialized_reserved_current` |
+| `core_spl_token_2022_v2022` | `TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb` | `token2022` | `program` | `kb_decoder_spl_token_2022` | `core_handled` |
+| `core_spl_token_2022_elgamal_registry_v1` | `regVYJW7tcT8zipN5YiBvHsvR5jXW1uLFxaHSbugABg` | `spl_token2022_elgamal_registry` | `program` | `kb_decoder_spl_token_2022` | `core_specialized_reserved_current` |
+| `core_spl_token_v1` | `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA` | `token` | `program` | `kb_decoder_spl_token` | `core_handled` |
diff --git a/docs/DECODER_MATERIALIZATION_CONTRACTS.md b/docs/DECODER_MATERIALIZATION_CONTRACTS.md
index a50fc64..8b428d9 100644
--- a/docs/DECODER_MATERIALIZATION_CONTRACTS.md
+++ b/docs/DECODER_MATERIALIZATION_CONTRACTS.md
@@ -20,7 +20,7 @@ core instruction contextualisée
## Input contextualisé
-`CoreInstructionReplayInput` reste l’unique contrat d’entrée commun. Son contrat passe à la version `2` dans `0.4.1-pre.014`. Il contient la signature, le slot, le statut et l’erreur on-chain, le chemin stable de l’instruction, le program ID, les comptes résolus dans leur ordre original, le payload brut déterministe et son hash, toutes les instructions outer ordonnées par index numérique, les inner instructions descendantes, les logs reliés prudemment, les changements de balances et la version du contrat core.
+`MdCoreInstructionReplayInput` reste l’unique contrat d’entrée commun. Son contrat passe à la version `2` dans `0.4.1-pre.014`. Il contient la signature, le slot, le statut et l’erreur on-chain, le chemin stable de l’instruction, le program ID, les comptes résolus dans leur ordre original, le payload brut déterministe et son hash, toutes les instructions outer ordonnées par index numérique, les inner instructions descendantes, les logs reliés prudemment, les changements de balances et la version du contrat core.
`outer_instructions_json` est un tableau stable dont chaque entrée contient `instructionIndex`, `instructionPath`, `programId`, `payloadJson` et `payloadHash`. L’instruction cible est incluse. Cette projection provient des tables core existantes et ne nécessite aucune migration SQL.
@@ -30,7 +30,7 @@ Le passage au contrat `2` modifie légitimement les hashes existants, car les pa
## Contrat de décodeur
-`InstructionDecoder` expose :
+`DcApiInstructionDecoder` expose :
- une identité stable `name/version` ;
- les programmes et surfaces supportés ;
@@ -58,7 +58,7 @@ observation_committed
`observation_committed` doit être faux lorsque la transaction a été annulée. Ces observations peuvent décrire une instruction tentée, un événement loggé avant l’erreur, une classification d’échec, une consommation de compute ou une surface appelée.
-Elles ne peuvent pas produire automatiquement un trade réussi, une modification de liquidité réussie, un changement confirmé de catalogue ou une candle normale. `EventMaterializer` applique une politique explicite par famille. Les familles `trade`, `liquidity` et `lifecycle` sont refusées avant l’appel au matérialiseur lorsque la source est échouée ou non commitée. Une seconde barrière valide ensuite les familles de sortie et n’autorise, dans ce contexte, que les matérialisations d’audit ou de risque.
+Elles ne peuvent pas produire automatiquement un trade réussi, une modification de liquidité réussie, un changement confirmé de catalogue ou une candle normale. `MtApiEventMaterializer` applique une politique explicite par famille. Les familles `trade`, `liquidity` et `lifecycle` sont refusées avant l’appel au matérialiseur lorsque la source est échouée ou non commitée. Une seconde barrière valide ensuite les familles de sortie et n’autorise, dans ce contexte, que les matérialisations d’audit ou de risque.
## Persistance
diff --git a/docs/EXECUTION_MODEL.md b/docs/EXECUTION_MODEL.md
index 95cc292..700fd63 100644
--- a/docs/EXECUTION_MODEL.md
+++ b/docs/EXECUTION_MODEL.md
@@ -77,11 +77,11 @@ Le genesis hash sert à classifier les clusters publics connus. Le réseau de pr
La simulation accepte une transaction base64 non signée lorsque `sigVerify = false`; `replaceRecentBlockhash = true` permet au nœud de remplacer le blockhash avant simulation. Les erreurs runtime restent un résultat de simulation typé et ne sont pas confondues avec une erreur HTTP ou JSON-RPC.
-`kb_rpc` ne fabrique pas le contexte de sécurité : cluster attendu, âge du blockhash, nonce account et nonce authority sont fournis explicitement lors de la conversion vers `ExecutionSimulationResult`. Depuis `pre.013`, `getAccountInfo` possède aussi un mode données complètes borné : le mode metadata-only conserve `dataSlice.length = 0`, tandis que `confirmed_with_data(max_data_bytes)` exige un tuple base64 complet dont la longueur décodée égale `space`.
+`kb_rpc` ne fabrique pas le contexte de sécurité : cluster attendu, âge du blockhash, nonce account et nonce authority sont fournis explicitement lors de la conversion vers `ExApiExecutionSimulationResult`. Depuis `pre.013`, `getAccountInfo` possède aussi un mode données complètes borné : le mode metadata-only conserve `dataSlice.length = 0`, tandis que `confirmed_with_data(max_data_bytes)` exige un tuple base64 complet dont la longueur décodée égale `space`.
## Assemblage et signature Solana
-`0.4.2-pre.005` introduit `kb_execution_solana`, frontière commune entre les exécuteurs et les adaptateurs RPC. La crate convertit les `PlannedInstruction` en instructions SDK, compile le message avec son fee payer et sa source de blockhash, puis vérifie que les signataires réellement compilés correspondent exactement au contrat du plan.
+`0.4.2-pre.005` introduit `kb_execution_solana`, frontière commune entre les exécuteurs et les adaptateurs RPC. La crate convertit les `ExApiPlannedInstruction` en instructions SDK, compile le message avec son fee payer et sa source de blockhash, puis vérifie que les signataires réellement compilés correspondent exactement au contrat du plan.
La transaction non signée fournit deux sorties distinctes :
diff --git a/docs/INSTRUCTION_REPLAY_CONTRACTS.md b/docs/INSTRUCTION_REPLAY_CONTRACTS.md
index 6204d21..1a9d148 100644
--- a/docs/INSTRUCTION_REPLAY_CONTRACTS.md
+++ b/docs/INSTRUCTION_REPLAY_CONTRACTS.md
@@ -50,7 +50,7 @@ Certains protocoles Solana exigent de lire :
- des séquences de logs liées à un CPI ;
- des instructions voisines de la même transaction.
-`CoreInstructionReplayInput` représente ce contrat de lecture : une instruction ciblée plus un contexte extrait depuis les tables `core`. Depuis le contrat `2`, ce contexte inclut également toutes les instructions outer de la signature, ordonnées numériquement et munies de leur payload retenu et de son hash.
+`MdCoreInstructionReplayInput` représente ce contrat de lecture : une instruction ciblée plus un contexte extrait depuis les tables `core`. Depuis le contrat `2`, ce contexte inclut également toutes les instructions outer de la signature, ordonnées numériquement et munies de leur payload retenu et de son hash.
## Sélection de replay
@@ -68,7 +68,7 @@ program_id = programme ciblé par le décodeur
plage de slots = optionnelle
```
-Le repository charge les logs, balances, account keys et instructions outer nécessaires pour retourner `CoreInstructionReplayInput`. La liste outer inclut la cible et utilise les champs stables `instructionIndex`, `instructionPath`, `programId`, `payloadJson` et `payloadHash`. Cette extension lit les tables existantes et ne demande aucune migration.
+Le repository charge les logs, balances, account keys et instructions outer nécessaires pour retourner `MdCoreInstructionReplayInput`. La liste outer inclut la cible et utilise les champs stables `instructionIndex`, `instructionPath`, `programId`, `payloadJson` et `payloadHash`. Cette extension lit les tables existantes et ne demande aucune migration.
## Marquage de cycle de vie
diff --git a/docs/MATERIALIZATIONS.md b/docs/MATERIALIZATIONS.md
index 7914f97..46c12ab 100644
--- a/docs/MATERIALIZATIONS.md
+++ b/docs/MATERIALIZATIONS.md
@@ -1,5 +1,5 @@
-
+
# Catalogue des matérialisations
@@ -36,16 +36,26 @@ La famille décodée n'impose pas à elle seule la famille matérialisée. `auth
`kb_lib::AdminMaterializer` produit des sorties `Admin` pour les assignations System, les écritures Config opaques et les changements d’autorité Loader. `kb_lib::ComplianceAuditMaterializer` produit des sorties `ComplianceAudit` pour les écritures/copies de bytecode Loader. `kb_lib::StakingMaterializer` produit les projections instructionnelles Stake/Vote commitées : comptes stake/vote, autorités, lockup, délégation, vote state, retraits et dépôt de rewards. Les données complètes ne sont jamais recopiées : seules les clés, autorités, offsets, tailles, hashes, préfixes et paramètres bornés disponibles sont conservés.
-Les quatre implémentations résident respectivement dans `kb_lib::materializer::lifecycle`, `admin`, `compliance` et `staking`, mais sont réexportées à la racine de `kb-lib`. Les identités de processor historiques restent stables pour les replays ; les targets de tracing utilisent la hiérarchie consolidée `kb-lib.materializer.*`.
+Les implémentations résident dans des modules privés et sont réexportées uniquement à la racine de `kb-lib`. Les identités de processor historiques restent stables pour les replays ; les targets de tracing utilisent la hiérarchie consolidée `kb-lib.materializer.*`.
Le retrait d'un nonce account conserve une sémantique conditionnelle : le runtime ferme le compte uniquement lorsque la totalité du solde est retirée. La projection décrit l'opération commitée et ne prétend pas reconstruire l'état final transactionnel du compte. Les deltas SOL restent la responsabilité du graphe core.
Une preuve ZK n'est jamais matérialisée. Seul le lifecycle du compte de contexte est projeté lorsqu'il existe. Un rapport Slashing conserve le signal de violation et son lifecycle, mais pas le contenu du compte de preuve externe ; `penaltyAppliedByProgram` reste faux car le programme ne retire pas lui-même du stake. L'ancien ZK Token Proof Program reste en decode/audit, car le runtime actuel est sans effet et aucun historique mainnet fiable n'a été observé.
+## Projections SPL et Metaplex portées
+
+- `MtTransactionAnnotationMaterializer` accepte uniquement les observations Memo exactes, réussies et commitées, puis produit une annotation idempotente bornée avec texte, hash, génération et signataires vérifiés.
+- `MtTokenAccountsMaterializer` projette les mutations SPL Token classique et Token‑2022, possède le lifecycle ATA et peut produire un snapshot borné Mint/Account/Multisig Token‑2022 à partir de l’état parsé.
+- `MtFeesMaterializer` projette les instructions et snapshots de frais Token‑2022 publics ou confidentiels. Les blobs confidentiels restent opaques et `confidentialValuesDecrypted` demeure faux.
+- `MtRiskMaterializer` produit uniquement des faits structurels SPL Token/ATA : délégation, freeze/thaw, autorités révoquées, multisig faible et récupération d’ATA imbriquée. Aucun score arbitraire n’est inventé.
+- `MtMetadataMaterializer` projette les metadata incorporées Token‑2022 et les comptes Metaplex canoniques, avec provenance et lifecycle explicites. `externalUriFetched` reste faux.
+
+Le registre ElGamal ne possède pas un matérialiseur autonome : ses snapshots administratifs sont la responsabilité de `MtAdminMaterializer`. Le fetch HTTP/IPFS/Arweave des URI est off-chain et reste réservé à une future crate dédiée.
+
## Matérialisations spécialisées à prévoir
- `nft` : NFT classiques, programmables et compressés.
-- `metadata` : metadata Metaplex, creators, collection, update authority, URI et symbol.
+- `metadata` avancée : fetch off-chain borné, réconciliation de provenance et historique des changements.
- `oracle` : prix, publisher, confidence, staleness et sources d'oracle.
- `lending` : borrow, repay, collateral, liquidation et health factor.
- `staking` avancé : snapshots de comptes Stake/Vote avant/après, activation par epoch, crédits Vote cumulés et réconciliation avec sysvars.
diff --git a/docs/METAPLEX_TOKEN_METADATA_MATRIX.json b/docs/METAPLEX_TOKEN_METADATA_MATRIX.json
index e0c5070..b1e9b41 100644
--- a/docs/METAPLEX_TOKEN_METADATA_MATRIX.json
+++ b/docs/METAPLEX_TOKEN_METADATA_MATRIX.json
@@ -313,7 +313,7 @@
],
"provenance_boundaries": [
"metaplex_token_metadata",
- "token_2022_embedded_metadata",
+ "token2022_embedded_metadata",
"metaplex_core",
"metaplex_bubblegum"
],
diff --git a/docs/NATIVE_SOLANA_MATERIALIZATION_AUDIT.md b/docs/NATIVE_SOLANA_MATERIALIZATION_AUDIT.md
index c428a89..f5745b0 100644
--- a/docs/NATIVE_SOLANA_MATERIALIZATION_AUDIT.md
+++ b/docs/NATIVE_SOLANA_MATERIALIZATION_AUDIT.md
@@ -11,21 +11,21 @@ Les sorties ne sont pas des snapshots finaux de comptes ou de runtime. Les état
## Projections actives par matérialiseur
-| Matérialiseur | Surfaces | Projection |
-|------------------------------------|----------------------|---------------------------------------------------------------------------------------------------------------------|
-| `LifecycleMaterializer` | Address Lookup Table | lifecycle create/freeze/extend/deactivate/close |
-| `LifecycleMaterializer` | Feature | révocation de feature gate |
-| `LifecycleMaterializer` | Loaders | déploiement, finalisation et transitions lifecycle stables |
-| `LifecycleMaterializer` | System | durable nonce, create account et allocate |
-| `LifecycleMaterializer` | ZK ElGamal | création ou fermeture d’un compte de contexte |
-| `LifecycleMaterializer` | Slashing | initialisation ou fermeture d’un rapport de violation |
-| `AdminMaterializer` | System | assign et assign with seed |
-| `AdminMaterializer` | Config | écriture opaque bornée avec clés, taille, SHA-256 et préfixe |
-| `AdminMaterializer` | Loaders | changements d’autorité |
-| `ComplianceAuditMaterializer` | Loaders | écritures/copies de bytecode bornées par offsets, tailles, SHA-256 et préfixes |
-| `ComplianceAuditMaterializer` | Compute Budget | profil transactionnel agrégé, last-write-wins, une seule sortie par transaction |
-| `StakingMaterializer` | Stake | compte, délégation, désactivation, split, merge, withdraw, move stake/lamports, autorités et lockup instructionnels |
-| `StakingMaterializer` | Vote | compte, autorités, identité, commission, vote state, retraits et dépôt de rewards instructionnels |
+| Matérialiseur | Surfaces | Projection |
+|---------------------------------|----------------------|---------------------------------------------------------------------------------------------------------------------|
+| `MtLifecycleMaterializer` | Address Lookup Table | lifecycle create/freeze/extend/deactivate/close |
+| `MtLifecycleMaterializer` | Feature | révocation de feature gate |
+| `MtLifecycleMaterializer` | Loaders | déploiement, finalisation et transitions lifecycle stables |
+| `MtLifecycleMaterializer` | System | durable nonce, create account et allocate |
+| `MtLifecycleMaterializer` | ZK ElGamal | création ou fermeture d’un compte de contexte |
+| `MtLifecycleMaterializer` | Slashing | initialisation ou fermeture d’un rapport de violation |
+| `MtAdminMaterializer` | System | assign et assign with seed |
+| `MtAdminMaterializer` | Config | écriture opaque bornée avec clés, taille, SHA-256 et préfixe |
+| `MtAdminMaterializer` | Loaders | changements d’autorité |
+| `MtComplianceAuditMaterializer` | Loaders | écritures/copies de bytecode bornées par offsets, tailles, SHA-256 et préfixes |
+| `MtComplianceAuditMaterializer` | Compute Budget | profil transactionnel agrégé, last-write-wins, une seule sortie par transaction |
+| `MtStakingMaterializer` | Stake | compte, délégation, désactivation, split, merge, withdraw, move stake/lamports, autorités et lockup instructionnels |
+| `MtStakingMaterializer` | Vote | compte, autorités, identité, commission, vote state, retraits et dépôt de rewards instructionnels |
## Politique des transactions échouées
diff --git a/docs/PROGRAM_REGISTRY_CONTROL.md b/docs/PROGRAM_REGISTRY_CONTROL.md
index 036c144..8dfb277 100644
--- a/docs/PROGRAM_REGISTRY_CONTROL.md
+++ b/docs/PROGRAM_REGISTRY_CONTROL.md
@@ -54,52 +54,52 @@ Nouvelle règle :
Ces identifiants sont détaillés dans `docs/CORE_PROGRAM_IDS.md`. Ils sont couverts par les décodeurs core/primitifs ou par des crates spécialisées SPL futures, pas par une crate DEX dédiée.
-| Canonique | Program ID | Source | Type | Crate cible | Statut |
-|--------------------------------------------|------------------------------------------------|-----------------------------------|----------------------|-------------------------------------------|-------------------------------------|
-| `core_solana_address_lookup_table_v1` | `AddressLookupTab1e1111111111111111111111111` | `address_lookup_table` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_bpf_loader_deprecated_v1` | `BPFLoader1111111111111111111111111111111111` | `bpf_loader_deprecated` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_bpf_loader_v2` | `BPFLoader2111111111111111111111111111111111` | `bpf_loader` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_bpf_loader_upgradeable_v1` | `BPFLoaderUpgradeab1e11111111111111111111111` | `bpf_loader_upgradeable` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_compute_budget_v1` | `ComputeBudget111111111111111111111111111111` | `compute_budget` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_config_v1` | `Config1111111111111111111111111111111111111` | `config` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_ed25519_v1` | `Ed25519SigVerify111111111111111111111111111` | `ed25519` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_feature_v1` | `Feature111111111111111111111111111111111111` | `feature` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_incinerator_v1` | `1nc1nerator11111111111111111111111111111111` | `incinerator` | `well_known_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_loader_v4` | `LoaderV411111111111111111111111111111111111` | `loader_v4` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_native_loader_v1` | `NativeLoader1111111111111111111111111111111` | `native_loader` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_secp256k1_v1` | `KeccakSecp256k11111111111111111111111111111` | `secp256k1` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_secp256r1_v1` | `Secp256r1SigVerify1111111111111111111111111` | `secp256r1` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_stake_config_v1` | `StakeConfig11111111111111111111111111111111` | `stake_config` | `well_known_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_stake_v1` | `Stake11111111111111111111111111111111111111` | `stake` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_system_v1` | `11111111111111111111111111111111` | `system` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_sysvar_clock_v1` | `SysvarC1ock11111111111111111111111111111111` | `sysvar_clock` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_epoch_rewards_v1` | `SysvarEpochRewards1111111111111111111111111` | `sysvar_epoch_rewards` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_epoch_schedule_v1` | `SysvarEpochSchedu1e111111111111111111111111` | `sysvar_epoch_schedule` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_fees_v1` | `SysvarFees111111111111111111111111111111111` | `sysvar_fees` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_instructions_v1` | `Sysvar1nstructions1111111111111111111111111` | `sysvar_instructions` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_last_restart_slot_v1` | `SysvarLastRestartS1ot1111111111111111111111` | `sysvar_last_restart_slot` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_recent_blockhashes_v1` | `SysvarRecentB1ockHashes11111111111111111111` | `sysvar_recent_blockhashes` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_rent_v1` | `SysvarRent111111111111111111111111111111111` | `sysvar_rent` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_rewards_v1` | `SysvarRewards111111111111111111111111111111` | `sysvar_rewards` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_slot_hashes_v1` | `SysvarS1otHashes111111111111111111111111111` | `sysvar_slot_hashes` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_slot_history_v1` | `SysvarS1otHistory11111111111111111111111111` | `sysvar_slot_history` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_stake_history_v1` | `SysvarStakeHistory1111111111111111111111111` | `sysvar_stake_history` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_sysvar_v1` | `Sysvar1111111111111111111111111111111111111` | `sysvar` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
-| `core_solana_vote_v1` | `Vote111111111111111111111111111111111111111` | `vote` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_zk_elgamal_proof_v1` | `ZkE1Gama1Proof11111111111111111111111111111` | `zk_elgamal_proof` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_solana_zk_token_proof_v1` | `ZkTokenProof1111111111111111111111111111111` | `zk_token_proof` | `program` | `kb_decoder_solana_core` | `core_handled` |
-| `core_spl_associated_token_account_v1` | `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL` | `associated_token_account` | `program` | `kb_decoder_spl_associated_token_account` | `core_handled` |
-| `core_spl_account_compression_v1` | `cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK` | `spl_account_compression` | `program` | `kb_decoder_spl_account_compression` | `core_specialized_reserved_current` |
-| `core_spl_memo_v1` | `Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo` | `spl_memo_v1` | `program` | `kb_decoder_spl_memo` | `core_specialized_reserved_current` |
-| `core_spl_memo_v3` | `MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr` | `spl_memo_v3` | `program` | `kb_decoder_spl_memo` | `core_specialized_reserved_current` |
-| `core_spl_memo_v4` | `Memo4c2pN8afCj432Lb7RMVKi9PbQnnW7ewFFaV3oAH` | `spl_memo_v4` | `program` | `kb_decoder_spl_memo` | `core_specialized_reserved_current` |
-| `core_spl_noop_v1` | `noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV` | `spl_noop` | `program` | `kb_decoder_spl_noop` | `core_specialized_reserved_current` |
-| `core_spl_single_pool_v1` | `SVSPxpvHdN29nkVg9rPapPNDddN5DipNLRUFhyjFThE` | `spl_single_pool` | `program` | `kb_decoder_spl_single_pool` | `core_specialized_reserved_current` |
-| `core_spl_name_service_v1` | `namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX` | `spl_name_service` | `program` | `kb_decoder_metadata_spl_name_service` | `core_specialized_reserved_current` |
-| `core_spl_stake_pool_v1` | `SPoo1Ku8WFXoNDMHPsrGSTSG1Y47rzgn41SLUNakuHy` | `stake_pool` | `program` | `kb_decoder_spl_stake_pool` | `core_specialized_reserved_current` |
-| `core_spl_token_2022_v2022` | `TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb` | `token_2022` | `program` | `kb_decoder_spl_token_2022` | `core_handled` |
-| `core_spl_token_2022_elgamal_registry_v1` | `regVYJW7tcT8zipN5YiBvHsvR5jXW1uLFxaHSbugABg` | `spl_token_2022_elgamal_registry` | `program` | `kb_decoder_spl_token_2022` | `core_specialized_reserved_current` |
-| `core_spl_token_v1` | `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA` | `token` | `program` | `kb_decoder_spl_token` | `core_handled` |
+| Canonique | Program ID | Source | Type | Crate cible | Statut |
+|--------------------------------------------|------------------------------------------------|----------------------------------|----------------------|-------------------------------------------|-------------------------------------|
+| `core_solana_address_lookup_table_v1` | `AddressLookupTab1e1111111111111111111111111` | `address_lookup_table` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_bpf_loader_deprecated_v1` | `BPFLoader1111111111111111111111111111111111` | `bpf_loader_deprecated` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_bpf_loader_v2` | `BPFLoader2111111111111111111111111111111111` | `bpf_loader` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_bpf_loader_upgradeable_v1` | `BPFLoaderUpgradeab1e11111111111111111111111` | `bpf_loader_upgradeable` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_compute_budget_v1` | `ComputeBudget111111111111111111111111111111` | `compute_budget` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_config_v1` | `Config1111111111111111111111111111111111111` | `config` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_ed25519_v1` | `Ed25519SigVerify111111111111111111111111111` | `ed25519` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_feature_v1` | `Feature111111111111111111111111111111111111` | `feature` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_incinerator_v1` | `1nc1nerator11111111111111111111111111111111` | `incinerator` | `well_known_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_loader_v4` | `LoaderV411111111111111111111111111111111111` | `loader_v4` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_native_loader_v1` | `NativeLoader1111111111111111111111111111111` | `native_loader` | `loader_program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_secp256k1_v1` | `KeccakSecp256k11111111111111111111111111111` | `secp256k1` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_secp256r1_v1` | `Secp256r1SigVerify1111111111111111111111111` | `secp256r1` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_stake_config_v1` | `StakeConfig11111111111111111111111111111111` | `stake_config` | `well_known_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_stake_v1` | `Stake11111111111111111111111111111111111111` | `stake` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_system_v1` | `11111111111111111111111111111111` | `system` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_sysvar_clock_v1` | `SysvarC1ock11111111111111111111111111111111` | `sysvar_clock` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_epoch_rewards_v1` | `SysvarEpochRewards1111111111111111111111111` | `sysvar_epoch_rewards` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_epoch_schedule_v1` | `SysvarEpochSchedu1e111111111111111111111111` | `sysvar_epoch_schedule` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_fees_v1` | `SysvarFees111111111111111111111111111111111` | `sysvar_fees` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_instructions_v1` | `Sysvar1nstructions1111111111111111111111111` | `sysvar_instructions` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_last_restart_slot_v1` | `SysvarLastRestartS1ot1111111111111111111111` | `sysvar_last_restart_slot` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_recent_blockhashes_v1` | `SysvarRecentB1ockHashes11111111111111111111` | `sysvar_recent_blockhashes` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_rent_v1` | `SysvarRent111111111111111111111111111111111` | `sysvar_rent` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_rewards_v1` | `SysvarRewards111111111111111111111111111111` | `sysvar_rewards` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_slot_hashes_v1` | `SysvarS1otHashes111111111111111111111111111` | `sysvar_slot_hashes` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_slot_history_v1` | `SysvarS1otHistory11111111111111111111111111` | `sysvar_slot_history` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_stake_history_v1` | `SysvarStakeHistory1111111111111111111111111` | `sysvar_stake_history` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_sysvar_v1` | `Sysvar1111111111111111111111111111111111111` | `sysvar` | `sysvar_account` | `kb_decoder_solana_core` | `core_recognized_account` |
+| `core_solana_vote_v1` | `Vote111111111111111111111111111111111111111` | `vote` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_zk_elgamal_proof_v1` | `ZkE1Gama1Proof11111111111111111111111111111` | `zk_elgamal_proof` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_solana_zk_token_proof_v1` | `ZkTokenProof1111111111111111111111111111111` | `zk_token_proof` | `program` | `kb_decoder_solana_core` | `core_handled` |
+| `core_spl_associated_token_account_v1` | `ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL` | `associated_token_account` | `program` | `kb_decoder_spl_associated_token_account` | `core_handled` |
+| `core_spl_account_compression_v1` | `cmtDvXumGCrqC1Age74AVPhSRVXJMd8PJS91L8KbNCK` | `spl_account_compression` | `program` | `kb_decoder_spl_account_compression` | `core_specialized_reserved_current` |
+| `core_spl_memo_v1` | `Memo1UhkJRfHyvLMcVucJwxXeuD728EqVDDwQDxFMNo` | `spl_memo_v1` | `program` | `kb_decoder_spl_memo` | `core_specialized_reserved_current` |
+| `core_spl_memo_v3` | `MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr` | `spl_memo_v3` | `program` | `kb_decoder_spl_memo` | `core_specialized_reserved_current` |
+| `core_spl_memo_v4` | `Memo4c2pN8afCj432Lb7RMVKi9PbQnnW7ewFFaV3oAH` | `spl_memo_v4` | `program` | `kb_decoder_spl_memo` | `core_specialized_reserved_current` |
+| `core_spl_noop_v1` | `noopb9bkMVfRPU8AsbpTUg8AQkHtKwMYZiFUjNRtMmV` | `spl_noop` | `program` | `kb_decoder_spl_noop` | `core_specialized_reserved_current` |
+| `core_spl_single_pool_v1` | `SVSPxpvHdN29nkVg9rPapPNDddN5DipNLRUFhyjFThE` | `spl_single_pool` | `program` | `kb_decoder_spl_single_pool` | `core_specialized_reserved_current` |
+| `core_spl_name_service_v1` | `namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX` | `spl_name_service` | `program` | `kb_decoder_metadata_spl_name_service` | `core_specialized_reserved_current` |
+| `core_spl_stake_pool_v1` | `SPoo1Ku8WFXoNDMHPsrGSTSG1Y47rzgn41SLUNakuHy` | `stake_pool` | `program` | `kb_decoder_spl_stake_pool` | `core_specialized_reserved_current` |
+| `core_spl_token_2022_v2022` | `TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb` | `token2022` | `program` | `kb_decoder_spl_token_2022` | `core_handled` |
+| `core_spl_token_2022_elgamal_registry_v1` | `regVYJW7tcT8zipN5YiBvHsvR5jXW1uLFxaHSbugABg` | `spl_token2022_elgamal_registry` | `program` | `kb_decoder_spl_token_2022` | `core_specialized_reserved_current` |
+| `core_spl_token_v1` | `TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA` | `token` | `program` | `kb_decoder_spl_token` | `core_handled` |
## DEX, AMM, CPMM, CLMM, DLMM, stable swap, weighted swap et orderbooks
@@ -245,15 +245,15 @@ Ces identifiants sont détaillés dans `docs/CORE_PROGRAM_IDS.md`. Ils sont couv
## NFT, metadata, admin, governance et locks
-| Canonique | Program ID | Source | Normalisé | Crate actuelle | Crate cible | Statut |
-|------------------------------------|------------------------------------------------|---------------------------|---------------------------|------------------------|-----------------------------------------------|--------------------|
-| `lock_raydium_lp` | `LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE` | `raydium_lock_lp` | `raydium_lock_lp` | `-` | `kb_decoder_lock_raydium_lp` | `reserved_missing` |
-| `admin_jupiter_lock` | `LocpQgucEQHbqNABEYvBvwoxCPsSbG91A1QaQhQQqjn` | `jupiter_lock` | `jupiter_lock` | `-` | `kb_decoder_admin_jupiter_lock` | `reserved_missing` |
-| `admin_pump_fees` | `pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ` | `pump_fees` | `pump_fees` | `kb_decoder_pump_fees` | `kb_decoder_admin_pump_fees` | `current_alias` |
+| Canonique | Program ID | Source | Normalisé | Crate actuelle | Crate cible | Statut |
+|------------------------------------|------------------------------------------------|---------------------------|---------------------------|------------------------|------------------------------------------------------|--------------------|
+| `lock_raydium_lp` | `LockrWmn6K5twhz3y9w1dQERbmgSaRkfnTeTKbpofwE` | `raydium_lock_lp` | `raydium_lock_lp` | `-` | `kb_decoder_lock_raydium_lp` | `reserved_missing` |
+| `admin_jupiter_lock` | `LocpQgucEQHbqNABEYvBvwoxCPsSbG91A1QaQhQQqjn` | `jupiter_lock` | `jupiter_lock` | `-` | `kb_decoder_admin_jupiter_lock` | `reserved_missing` |
+| `admin_pump_fees` | `pfeeUxB6jkeY1Hxd7CsFCAjcbHA9rWtchMGdZ6VojVZ` | `pump_fees` | `pump_fees` | `kb_decoder_pump_fees` | `kb_decoder_admin_pump_fees` | `current_alias` |
| `metadata_metaplex_token_metadata` | `metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s` | `metaplex_token_metadata` | `metaplex_token_metadata` | `-` | `kb_lib::decoder::metadata::metaplex_token_metadata` | `current_migrated` |
-| `metadata_name_service` | `namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX` | `name_service` | `name_service` | `-` | `kb_decoder_metadata_spl_name_service` | `reserved_missing` |
-| `nft_metaplex_bubblegum` | `BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY` | `bubblegum` | `bubblegum` | `-` | `kb_decoder_nft_metaplex_bubblegum` | `reserved_missing` |
-| `nft_metaplex_mpl_core` | `CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d` | `mpl_core` | `mpl_core` | `-` | `kb_decoder_nft_metaplex_mpl_core` | `reserved_missing` |
+| `metadata_name_service` | `namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX` | `name_service` | `name_service` | `-` | `kb_decoder_metadata_spl_name_service` | `reserved_missing` |
+| `nft_metaplex_bubblegum` | `BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY` | `bubblegum` | `bubblegum` | `-` | `kb_decoder_nft_metaplex_bubblegum` | `reserved_missing` |
+| `nft_metaplex_mpl_core` | `CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d` | `mpl_core` | `mpl_core` | `-` | `kb_decoder_nft_metaplex_mpl_core` | `reserved_missing` |
## Surfaces à classifier
diff --git a/docs/RUST_WORKSPACE_RULE_AUDIT.md b/docs/RUST_WORKSPACE_RULE_AUDIT.md
index 83206a2..8be870f 100644
--- a/docs/RUST_WORKSPACE_RULE_AUDIT.md
+++ b/docs/RUST_WORKSPACE_RULE_AUDIT.md
@@ -229,7 +229,7 @@ La mise en conformité est découpée avant toute nouvelle prérelease :
1. `pre.035-delta-fix-002` : séparation des règles et audit automatisé reproductible ;
2. correctifs suivants : points d'entrée de crates, réexports `pub`/`pub(crate)`, rustdocs et chemins `crate::...` ;
3. correctifs suivants : imports de traits et suppression des imports ordinaires/groupés ;
-4. correctifs suivants : `TRACING_TARGET`, dépendances `tracing`, macros et matrice de routes ;
+4. correctifs suivants : `DC_METADATA_MTM_TRACING_TARGET`, dépendances `tracing`, macros et matrice de routes ;
5. correctifs suivants : helpers dupliqués et mutualisation inter-crates ;
6. fermeture : `cargo fmt --all`, audit strict, tests workspace et Clippy global.
diff --git a/docs/SOLANA_INTERFACE_DEPENDENCIES.md b/docs/SOLANA_INTERFACE_DEPENDENCIES.md
index 96b1062..2cbefa7 100644
--- a/docs/SOLANA_INTERFACE_DEPENDENCIES.md
+++ b/docs/SOLANA_INTERFACE_DEPENDENCIES.md
@@ -71,7 +71,7 @@ Le message à signer provient de `solana_transaction::Transaction::message_data(
## Identifiants natifs, Vote et loaders dans l’exécuteur
-`solana-sdk-ids` est conservé intentionnellement comme registre officiel modulaire des adresses natives et sysvars. Les chemins `solana_sdk_ids::sysvar::{clock,rent,slot_hashes,instructions}` ne constituent pas un retour au SDK monolithique : ils fournissent uniquement des `Pubkey` canoniques. `solana-instructions-sysvar` ne doit être ajouté que lorsqu’une crate appelle réellement ses fonctions d’introspection d’instructions, pas pour remplacer un simple ID officiel.
+`solana-sdk-ids` est conservé intentionnellement comme registre officiel modulaire des adresses natives et sysvars. Les chemins `solana_sdk_ids::sysvar::{clock,rent,slot_hashes,instructions}` ne constituent pas un retour au SDK monolithique : ils fournissent uniquement des `MdPubkey` canoniques. `solana-instructions-sysvar` ne doit être ajouté que lorsqu’une crate appelle réellement ses fonctions d’introspection d’instructions, pas pour remplacer un simple ID officiel.
`kb_executor_solana_core` consomme `solana-vote-interface ^6.0` avec `serde` et `wincode` pour construire les vingt variantes wire Vote actuelles. Il utilise `solana-instruction` pour `Instruction`/`AccountMeta`, `solana-pubkey::Pubkey` pour les adresses publiques, `solana-hash::Hash` pour les hashes et `solana-sdk-ids` pour Rent, Clock et SlotHashes. Les quatre créations composées utilisent `solana-system-interface`; aucune dépendance `solana-sdk` ni feature `bincode` n’est ajoutée à la crate.
@@ -214,7 +214,7 @@ longueurs de chaînes de `Initialize`, `UpdateField` et `RemoveKey`. Cette garde
normative pour le décodeur ; `UpdateAuthority` et `Emit` restent sans chaîne.
La migration `0.1.0-pre.008` conserve ces contrats dans
-`kb_lib::decoder::spl::token_2022` et isole le registre dans
+`kb_lib::decoder::spl::token2022` et isole le registre dans
`kb_lib::decoder::spl::elgamal_registry`. Les targets de tracing, matrices et Program IDs restent
distincts ; aucun pointeur TLV n’est interprété comme une preuve de l’état du programme externe
pointé.
diff --git a/docs/SPL_ASSOCIATED_TOKEN_ACCOUNT_MATRIX.json b/docs/SPL_ASSOCIATED_TOKEN_ACCOUNT_MATRIX.json
index da78d8b..2d5f70f 100644
--- a/docs/SPL_ASSOCIATED_TOKEN_ACCOUNT_MATRIX.json
+++ b/docs/SPL_ASSOCIATED_TOKEN_ACCOUNT_MATRIX.json
@@ -1,13 +1,17 @@
{
"file": "docs/SPL_ASSOCIATED_TOKEN_ACCOUNT_MATRIX.json",
- "version": 10,
+ "version": 11,
"schemaVersion": 1,
"bot3Migration": {
"target": "kb-lib.decoder.spl.associated_token_account",
- "status": "ported_pending_operator_cargo_validation",
+ "status": "decoder_operator_validated_materializers_ported",
"prerelease": "0.1.0-pre.007",
"preservedDifferentialTests": 10,
- "materializerPorted": false,
+ "materializerPorted": true,
+ "publicMaterializers": [
+ "kb_lib::TokenAccountsMaterializer",
+ "kb_lib::RiskMaterializer"
+ ],
"executorPorted": false,
"pipelinePorted": false
},
@@ -15,7 +19,7 @@
"systemProgramId": "11111111111111111111111111111111",
"supportedTokenPrograms": [
{"code": "spl_token", "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", "scope": "classic_token_account_lifecycle_only"},
- {"code": "spl_token_2022", "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", "scope": "ata_lifecycle_only_without_general_token_2022_instruction_or_extension_decode"}
+ {"code": "spl_token2022", "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", "scope": "ata_lifecycle_only_without_general_token2022_instruction_or_extension_decode"}
],
"interface": {
"workspaceConstraint": "^2.0",
@@ -85,10 +89,10 @@
"runtimeRules": ["fails if the associated account already exists", "funding account pays rent and creation cost", "mint and created account must be coherent with the selected token program"],
"event": "spl_associated_token_account.create",
"authorizedProjections": ["token_accounts:ata_created"],
- "forbiddenProjections": ["token_balance_snapshot", "duplicate_spl_token_initialize_account_cpi", "token_2022_extension_fact"],
+ "forbiddenProjections": ["token_balance_snapshot", "duplicate_spl_token_initialize_account_cpi", "token2022_extension_fact"],
"officialBuilder": {"available": true, "function": "create_associated_token_account", "canonicalWireOnly": true},
"executorSupport": {"status": "supported", "operationCode": "spl_associated_token_account.create", "builder": "create_associated_token_account", "simulation": "required", "defaultMode": "dry_run"},
- "proofs": {"synthetic": ["canonical_00", "legacy_empty", "classic_token_program", "token_2022_program", "wrong_ata", "missing_account", "extra_account", "duplicate_account", "wrong_flags", "unknown_suffix", "outer", "inner_cpi", "committed", "failed_intent"], "localnet": "not_tested", "devnet": "not_tested", "mainnetSignatures": []}
+ "proofs": {"synthetic": ["canonical_00", "legacy_empty", "classic_token_program", "token2022_program", "wrong_ata", "missing_account", "extra_account", "duplicate_account", "wrong_flags", "unknown_suffix", "outer", "inner_cpi", "committed", "failed_intent"], "localnet": "not_tested", "devnet": "not_tested", "mainnetSignatures": []}
},
{
"name": "create_idempotent",
@@ -109,10 +113,10 @@
"runtimeRules": ["creates when absent", "succeeds without recreating when an initialized compatible ATA already exists", "fails when an existing account has a different wallet owner, mint or account owner program"],
"event": "spl_associated_token_account.create_idempotent",
"authorizedProjections": ["token_accounts:ata_created_or_reused_idempotently"],
- "forbiddenProjections": ["token_balance_snapshot", "duplicate_spl_token_initialize_account_cpi", "token_2022_extension_fact"],
+ "forbiddenProjections": ["token_balance_snapshot", "duplicate_spl_token_initialize_account_cpi", "token2022_extension_fact"],
"officialBuilder": {"available": true, "function": "create_associated_token_account_idempotent", "canonicalWireOnly": true},
"executorSupport": {"status": "supported", "operationCode": "spl_associated_token_account.create_idempotent", "builder": "create_associated_token_account_idempotent", "simulation": "required", "defaultMode": "dry_run"},
- "proofs": {"synthetic": ["canonical_01", "absent_account", "compatible_existing_account", "conflicting_existing_owner", "conflicting_existing_mint", "conflicting_existing_program", "classic_token_program", "token_2022_program", "wrong_ata", "wrong_flags", "unexpected_suffix", "outer", "inner_cpi", "committed", "failed_intent"], "localnet": "not_tested", "devnet": ["5Vw4QFpMa8oJ8MsLrvDg4RFzxqUh27mTFRFzzwJFoA4uAry8rZQc6GP92aidzWugn3CeZ5NYNxDp7tZ6bh8XyN1P", "2H9VfhDySdXMteazm2P3s2fTttJBQzMJinQtKqsLtkjDg7zbFFgiWG81UxRQF4va3bbR2pUV4QGo2qErisR8CPbP", "3wWTkx45LoDR3UaU8VUfsWxwHuLFyJyhrnDrmijCa7pXPdmJKz3rQ1LdyDvb78dvNRiKqw5ee7HuZ6Gjj1Gpfv6q", "bMMjoHcwbaTvLXerdQ4kbGXGb7wydiTyvSEwwmoKKLQcRWWBzqGUMYHZztonNnER1iWZ7yKp9p3neeMhypX4QAJ", "4RZKA3KwEbSqgU8UnemTgvd3fBgJmoSK2nmaaTNP8nJGTVh6DrFwrHVZYCBvLFvhvzUdi9p1KRFe4hHqYt7JbVSG"], "mainnetSignatures": ["2F9RvuCkevfJN7ju252hAWoCE58wagCXCWHQF9Wsdtsxvp3HcuNJQFCwU7zGqe3z3b8pv3vPp4xY5EH7KLcaHQCY"], "realCorpusStatus": "controlled classic and Token-2022 CreateIdempotent creation then compatible-existing reuse confirmed, materialized once per signature and replayed idempotently; search-discovered Token-2022 outer transaction remains additional corpus"}
+ "proofs": {"synthetic": ["canonical_01", "absent_account", "compatible_existing_account", "conflicting_existing_owner", "conflicting_existing_mint", "conflicting_existing_program", "classic_token_program", "token2022_program", "wrong_ata", "wrong_flags", "unexpected_suffix", "outer", "inner_cpi", "committed", "failed_intent"], "localnet": "not_tested", "devnet": ["5Vw4QFpMa8oJ8MsLrvDg4RFzxqUh27mTFRFzzwJFoA4uAry8rZQc6GP92aidzWugn3CeZ5NYNxDp7tZ6bh8XyN1P", "2H9VfhDySdXMteazm2P3s2fTttJBQzMJinQtKqsLtkjDg7zbFFgiWG81UxRQF4va3bbR2pUV4QGo2qErisR8CPbP", "3wWTkx45LoDR3UaU8VUfsWxwHuLFyJyhrnDrmijCa7pXPdmJKz3rQ1LdyDvb78dvNRiKqw5ee7HuZ6Gjj1Gpfv6q", "bMMjoHcwbaTvLXerdQ4kbGXGb7wydiTyvSEwwmoKKLQcRWWBzqGUMYHZztonNnER1iWZ7yKp9p3neeMhypX4QAJ", "4RZKA3KwEbSqgU8UnemTgvd3fBgJmoSK2nmaaTNP8nJGTVh6DrFwrHVZYCBvLFvhvzUdi9p1KRFe4hHqYt7JbVSG"], "mainnetSignatures": ["2F9RvuCkevfJN7ju252hAWoCE58wagCXCWHQF9Wsdtsxvp3HcuNJQFCwU7zGqe3z3b8pv3vPp4xY5EH7KLcaHQCY"], "realCorpusStatus": "controlled classic and Token-2022 CreateIdempotent creation then compatible-existing reuse confirmed, materialized once per signature and replayed idempotently; search-discovered Token-2022 outer transaction remains additional corpus"}
},
{
"name": "recover_nested",
@@ -134,16 +138,16 @@
"runtimeRules": ["all three derived addresses must match their observed accounts", "owner and nested token accounts must be initialized and coherent with their respective mints", "wallet owner must sign", "complete nested token balance is moved to the wallet destination ATA", "nested account is closed and its lamports are returned to the wallet"],
"event": "spl_associated_token_account.recover_nested",
"authorizedProjections": ["token_accounts:nested_ata_recovered", "risk:nested_ata_anti_pattern_recovered"],
- "forbiddenProjections": ["duplicate_spl_token_transfer_cpi", "duplicate_spl_token_close_account_cpi", "token_balance_snapshot", "token_2022_extension_fact"],
+ "forbiddenProjections": ["duplicate_spl_token_transfer_cpi", "duplicate_spl_token_close_account_cpi", "token_balance_snapshot", "token2022_extension_fact"],
"officialBuilder": {"available": true, "function": "recover_nested", "canonicalWireOnly": true},
"executorSupport": {"status": "supported", "operationCode": "spl_associated_token_account.recover_nested", "builder": "recover_nested", "simulation": "required", "defaultMode": "dry_run"},
- "proofs": {"synthetic": ["canonical_02", "classic_token_program", "token_2022_program", "valid_three_pda_relationships", "wrong_nested_ata", "wrong_destination_ata", "wrong_owner_ata", "owner_and_nested_mints_not_inverted", "missing_account", "extra_account", "duplicate_account", "wrong_flags", "unexpected_suffix", "outer", "inner_cpi", "committed", "failed_intent"], "localnet": "not_tested", "devnet": ["37LG6GdMRp5ECG8qf1RSYxmriJk75UtCwqwzXZWpArebkKo6BQvGhYEnbDh2A6KWiUaHK28Zy1gGGZ5zihvrHskM"], "mainnetSignatures": [], "realCorpusStatus": "controlled classic RecoverNested confirmed with positive raw balance transfer, nested ATA closure, owner and destination post-validation, two distinct ATA lifecycle and risk projections, and idempotent second replay", "controlledDevnetFixture": {"walletOwner": "DwuAapPLg6pEJ4QhmxvPg8rzkavmYdg5FW4dfEMcg8B2", "ownerMint": "So11111111111111111111111111111111111111112", "ownerAssociatedTokenAccount": "3tdXq1W7vEbbkxQmT1r2fc349uYti98zpwLKhp7FFbF5", "nestedMint": "3fd5CqP1w4Y1xeMoAe3apA7Jf5SbL3vboxv7ihyXhC9A", "nestedAssociatedTokenAccount": "AAyvGeKpq6i3kxMcScJLcN2u5iyAsspr731LhgXygti5", "walletNestedMintAssociatedTokenAccount": "69TP2QoSx2inueFAEb6npjumH5o3wGJQDSwwAJLLfyWp", "rawAmountTransferred": "1000000000", "nestedAccountClosed": true, "destinationUiBalanceAfter": "1", "materializedOutputCount": 2}}
+ "proofs": {"synthetic": ["canonical_02", "classic_token_program", "token2022_program", "valid_three_pda_relationships", "wrong_nested_ata", "wrong_destination_ata", "wrong_owner_ata", "owner_and_nested_mints_not_inverted", "missing_account", "extra_account", "duplicate_account", "wrong_flags", "unexpected_suffix", "outer", "inner_cpi", "committed", "failed_intent"], "localnet": "not_tested", "devnet": ["37LG6GdMRp5ECG8qf1RSYxmriJk75UtCwqwzXZWpArebkKo6BQvGhYEnbDh2A6KWiUaHK28Zy1gGGZ5zihvrHskM"], "mainnetSignatures": [], "realCorpusStatus": "controlled classic RecoverNested confirmed with positive raw balance transfer, nested ATA closure, owner and destination post-validation, two distinct ATA lifecycle and risk projections, and idempotent second replay", "controlledDevnetFixture": {"walletOwner": "DwuAapPLg6pEJ4QhmxvPg8rzkavmYdg5FW4dfEMcg8B2", "ownerMint": "So11111111111111111111111111111111111111112", "ownerAssociatedTokenAccount": "3tdXq1W7vEbbkxQmT1r2fc349uYti98zpwLKhp7FFbF5", "nestedMint": "3fd5CqP1w4Y1xeMoAe3apA7Jf5SbL3vboxv7ihyXhC9A", "nestedAssociatedTokenAccount": "AAyvGeKpq6i3kxMcScJLcN2u5iyAsspr731LhgXygti5", "walletNestedMintAssociatedTokenAccount": "69TP2QoSx2inueFAEb6npjumH5o3wGJQDSwwAJLLfyWp", "rawAmountTransferred": "1000000000", "nestedAccountClosed": true, "destinationUiBalanceAfter": "1", "materializedOutputCount": 2}}
}
],
"offlineCorpus": {
"status": "implemented_and_operator_validated_in_decoder_unit_tests",
"wire": ["create_00", "legacy_empty_create", "create_idempotent_01", "recover_nested_02", "unknown_tag", "rejected_suffix"],
- "tokenPrograms": ["spl_token_classic", "token_2022"],
+ "tokenPrograms": ["spl_token_classic", "token2022"],
"locations": ["outer", "inner_cpi"],
"transactionOutcomes": ["committed", "failed_uncommitted_intent"],
"accountShapes": ["canonical", "missing", "extra", "duplicate", "wrong_flags", "wrong_derived_address", "unsupported_token_program", "wrong_system_program"],
@@ -155,7 +159,8 @@
"idempotenceIdentity": "signature + instruction_path + program_id + normalized_operation + ata",
"projectionOwners": [
{
- "crate": "kb_materializer_token_accounts",
+ "crate": "kb-lib",
+ "component": "materializer.token.accounts",
"facts": [
"ata_created",
"ata_created_or_reused_idempotently",
@@ -164,7 +169,8 @@
"justification": "ATA creation and recovery are stable token-account lifecycle facts; this crate already owns instruction-level token-account mutations."
},
{
- "crate": "kb_materializer_risk",
+ "crate": "kb-lib",
+ "component": "materializer.risk",
"facts": [
"nested_ata_anti_pattern_recovered"
],
@@ -173,15 +179,18 @@
],
"explicitNoProjection": [
{
- "crate": "kb_materializer_lifecycle",
- "reason": "Native program lifecycle remains owned here; duplicating ATA lifecycle would overlap kb_materializer_token_accounts."
+ "crate": "kb-lib",
+ "component": "materializer.lifecycle",
+ "reason": "Native program lifecycle remains owned here; duplicating ATA lifecycle would overlap the token-account materializer."
},
{
- "crate": "kb_materializer_admin",
+ "crate": "kb-lib",
+ "component": "materializer.admin",
"reason": "ATA instructions do not change a mint authority, freeze authority, close authority or multisig configuration."
},
{
- "crate": "kb_materializer_fees",
+ "crate": "kb-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."
}
],
@@ -195,7 +204,7 @@
"deploymentAudit": {
"localnet": {"status": "not_tested", "evidence": []},
"devnet": {"status": "classic and Token-2022 CreateIdempotent creation and compatible-existing reuse confirmed; classic RecoverNested positive-balance recovery confirmed", "evidence": ["5Vw4QFpMa8oJ8MsLrvDg4RFzxqUh27mTFRFzzwJFoA4uAry8rZQc6GP92aidzWugn3CeZ5NYNxDp7tZ6bh8XyN1P", "2H9VfhDySdXMteazm2P3s2fTttJBQzMJinQtKqsLtkjDg7zbFFgiWG81UxRQF4va3bbR2pUV4QGo2qErisR8CPbP", "3wWTkx45LoDR3UaU8VUfsWxwHuLFyJyhrnDrmijCa7pXPdmJKz3rQ1LdyDvb78dvNRiKqw5ee7HuZ6Gjj1Gpfv6q", "bMMjoHcwbaTvLXerdQ4kbGXGb7wydiTyvSEwwmoKKLQcRWWBzqGUMYHZztonNnER1iWZ7yKp9p3neeMhypX4QAJ", "4RZKA3KwEbSqgU8UnemTgvd3fBgJmoSK2nmaaTNP8nJGTVh6DrFwrHVZYCBvLFvhvzUdi9p1KRFe4hHqYt7JbVSG", "37LG6GdMRp5ECG8qf1RSYxmriJk75UtCwqwzXZWpArebkKo6BQvGhYEnbDh2A6KWiUaHK28Zy1gGGZ5zihvrHskM"], "controlledToken2022Fixture": {"mint": "3DxKAUfCZkR9oRfMXeRNpiVL464eKbTieymBrVhsoKTE", "mintOwner": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb", "mintBaseLength": 82, "walletOwner": "DwuAapPLg6pEJ4QhmxvPg8rzkavmYdg5FW4dfEMcg8B2", "associatedTokenAccount": "6WfCJPt7GZQyMJAUS1AMHJrD7Vid8e9xUEQVgi5Q9C9Y", "accountLength": 170, "accountExtension": "immutable_owner", "creationSlot": 476702448, "existingReuseSlot": 476703343}},
- "mainnet": {"status": "search_discovered_token_2022_create_idempotent_not_yet_replayed", "evidence": ["2F9RvuCkevfJN7ju252hAWoCE58wagCXCWHQF9Wsdtsxvp3HcuNJQFCwU7zGqe3z3b8pv3vPp4xY5EH7KLcaHQCY"]},
+ "mainnet": {"status": "search_discovered_token2022_create_idempotent_not_yet_replayed", "evidence": ["2F9RvuCkevfJN7ju252hAWoCE58wagCXCWHQF9Wsdtsxvp3HcuNJQFCwU7zGqe3z3b8pv3vPp4xY5EH7KLcaHQCY"]},
"rateLimitRecovery": "preserve confirmed signatures and resume bounded hydration; never recreate accounts blindly after HTTP 429"
},
"nonClaims": [
diff --git a/docs/SPL_MEMO_MATRIX.json b/docs/SPL_MEMO_MATRIX.json
index 34a4b6b..1436b18 100644
--- a/docs/SPL_MEMO_MATRIX.json
+++ b/docs/SPL_MEMO_MATRIX.json
@@ -1,13 +1,14 @@
{
"file": "docs/SPL_MEMO_MATRIX.json",
- "version": 9,
+ "version": 10,
"matrixVersion": 4,
"scope": "SPL Memo v1, v3 et v4",
"bot3Migration": {
"decoderModule": "kb_lib::decoder::spl::memo",
"publicDecoder": "kb_lib::SplMemoDecoder",
"decoderStatus": "ported_in_0.1.0-pre.005",
- "materializerStatus": "pending_later_tranche",
+ "publicMaterializer": "kb_lib::TransactionAnnotationMaterializer",
+ "materializerStatus": "ported_in_0.1.0-pre.011",
"executorStatus": "pending_later_tranche"
},
"interface": {
@@ -113,7 +114,8 @@
"unknownProgramProducesObservation": false
},
"materializationContract": {
- "crate": "kb_materializer_transaction_annotations",
+ "crate": "kb-lib",
+ "component": "materializer.transaction.annotations",
"processorName": "transaction_annotations",
"materializedFamily": "transaction_annotation",
"acceptedEntries": ["add_memo", "memo_intent", "invalid_memo_attempt"],
diff --git a/docs/SPL_TOKEN_2022_CONFIDENTIAL_EXECUTION_AUDIT.md b/docs/SPL_TOKEN2022_CONFIDENTIAL_EXECUTION_AUDIT.md
similarity index 99%
rename from docs/SPL_TOKEN_2022_CONFIDENTIAL_EXECUTION_AUDIT.md
rename to docs/SPL_TOKEN2022_CONFIDENTIAL_EXECUTION_AUDIT.md
index f7670fa..125ae37 100644
--- a/docs/SPL_TOKEN_2022_CONFIDENTIAL_EXECUTION_AUDIT.md
+++ b/docs/SPL_TOKEN2022_CONFIDENTIAL_EXECUTION_AUDIT.md
@@ -1,4 +1,4 @@
-
+
# Audit d’exécution Confidential Transfer Token-2022
diff --git a/docs/SPL_TOKEN_2022_MATRIX.json b/docs/SPL_TOKEN2022_MATRIX.json
similarity index 99%
rename from docs/SPL_TOKEN_2022_MATRIX.json
rename to docs/SPL_TOKEN2022_MATRIX.json
index e492d21..ff28f44 100644
--- a/docs/SPL_TOKEN_2022_MATRIX.json
+++ b/docs/SPL_TOKEN2022_MATRIX.json
@@ -1,5 +1,5 @@
{
- "file": "docs/SPL_TOKEN_2022_MATRIX.json",
+ "file": "docs/SPL_TOKEN2022_MATRIX.json",
"version": "0.1.0-pre.008",
"schemaVersion": 1,
"matrixStatus": "exact_decoder_leaf_coverage_proven_pending_materialization_executor_preflight_and_cluster_corpus_completion",
@@ -30,7 +30,7 @@
"default",
"serde"
],
- "leafConsumer": "kb-lib.decoder.spl.token_2022",
+ "leafConsumer": "kb-lib.decoder.spl.token2022",
"operatorEvidence": "cargo tree -i spl-token-2022-interface -e features",
"publishedCandidateAudited": "3.1.1",
"publishedCandidateStatus": "matches_confirmed_workspace_resolution",
@@ -2060,7 +2060,7 @@
"stable_fact_only_no_score"
],
"lifecycle": [
- "no_token_2022_claim_until_non_overlap_is_proven"
+ "no_token2022_claim_until_non_overlap_is_proven"
]
},
"forbiddenClaims": [
diff --git a/docs/SPL_TOKEN_2022_SOURCE_AUDIT.md b/docs/SPL_TOKEN2022_SOURCE_AUDIT.md
similarity index 99%
rename from docs/SPL_TOKEN_2022_SOURCE_AUDIT.md
rename to docs/SPL_TOKEN2022_SOURCE_AUDIT.md
index 00d2b2a..1127df3 100644
--- a/docs/SPL_TOKEN_2022_SOURCE_AUDIT.md
+++ b/docs/SPL_TOKEN2022_SOURCE_AUDIT.md
@@ -1,4 +1,4 @@
-
+
# Audit des sources Token-2022 résolues
diff --git a/docs/SPL_TOKEN_2022_VALIDATION_MATRIX.json b/docs/SPL_TOKEN2022_VALIDATION_MATRIX.json
similarity index 98%
rename from docs/SPL_TOKEN_2022_VALIDATION_MATRIX.json
rename to docs/SPL_TOKEN2022_VALIDATION_MATRIX.json
index 8cedd27..2bea77b 100644
--- a/docs/SPL_TOKEN_2022_VALIDATION_MATRIX.json
+++ b/docs/SPL_TOKEN2022_VALIDATION_MATRIX.json
@@ -39,7 +39,7 @@
]
},
{
- "id": "token_2022_public_devnet",
+ "id": "token2022_public_devnet",
"environment": "devnet",
"status": "not_run",
"requiredEvidence": [
diff --git a/docs/TRACING_CONTRACT.md b/docs/TRACING_CONTRACT.md
index e0fae05..006643a 100644
--- a/docs/TRACING_CONTRACT.md
+++ b/docs/TRACING_CONTRACT.md
@@ -1,5 +1,5 @@
-
+
# Contrat de tracing par crate et composant
@@ -62,11 +62,14 @@ kb-lib.decoder.spl.associated_token_account
kb-lib.decoder.spl.elgamal_registry
kb-lib.decoder.spl.memo
kb-lib.decoder.spl.token
-kb-lib.decoder.spl.token_2022
+kb-lib.decoder.spl.token2022
kb-lib.materializer.admin
kb-lib.materializer.compliance
kb-lib.materializer.lifecycle
+kb-lib.materializer.risk
kb-lib.materializer.staking
+kb-lib.materializer.token
+kb-lib.materializer.transaction
kb-logging
kb-store
```
diff --git a/docs/legacy-khadhroony-bot2/CHANGELOG.md b/docs/legacy-khadhroony-bot2/CHANGELOG.md
index b08dcc6..9414f72 100644
--- a/docs/legacy-khadhroony-bot2/CHANGELOG.md
+++ b/docs/legacy-khadhroony-bot2/CHANGELOG.md
@@ -35,7 +35,7 @@ Validation du jalon de cadrage stockage : conventions PostgreSQL définies autou
## 0.2.1 — contrats `kb_store_core` et replay instruction-level
-Validation du jalon de contrats storage : `kb_store_core` expose les types communs backend-agnostiques pour pagination, healthcheck, migrations, erreurs de stockage, DTOs applicatifs, entities proches SQL et traits repositories sans implémentation PostgreSQL. Les contrats couvrent le raw RPC et WebSocket, le cycle de vie raw `Full` / `Compacted` / `Archived` / `Purged`, les états de traitement raw, la signature optionnelle des notifications WebSocket, la déduplication par `notification_key`, le lien futur optionnel notification vers transaction canonique, ainsi que le replay par instruction. Le replay est défini comme un scheduling au niveau instruction, mais le décodage reçoit un contexte extrait complet via `CoreInstructionReplayInput` : instruction ciblée, account keys, logs, balance changes et contexte transactionnel minimal. Les repositories restent abstraits et ne créent encore ni pool PostgreSQL, ni migration SQL réelle. Validation locale effectuée : `cargo test -p kb_store_core` avec 28 tests passés et `cargo clippy --all-targets` sans avertissement. Les validations précédentes du jalon ont également confirmé `kb_store_pg` sans test actif, `kb_config` avec 35 tests passés et `kb_app_demo` avec 28 tests passés.
+Validation du jalon de contrats storage : `kb_store_core` expose les types communs backend-agnostiques pour pagination, healthcheck, migrations, erreurs de stockage, DTOs applicatifs, entities proches SQL et traits repositories sans implémentation PostgreSQL. Les contrats couvrent le raw RPC et WebSocket, le cycle de vie raw `Full` / `Compacted` / `Archived` / `Purged`, les états de traitement raw, la signature optionnelle des notifications WebSocket, la déduplication par `notification_key`, le lien futur optionnel notification vers transaction canonique, ainsi que le replay par instruction. Le replay est défini comme un scheduling au niveau instruction, mais le décodage reçoit un contexte extrait complet via `MdCoreInstructionReplayInput` : instruction ciblée, account keys, logs, balance changes et contexte transactionnel minimal. Les repositories restent abstraits et ne créent encore ni pool PostgreSQL, ni migration SQL réelle. Validation locale effectuée : `cargo test -p kb_store_core` avec 28 tests passés et `cargo clippy --all-targets` sans avertissement. Les validations précédentes du jalon ont également confirmé `kb_store_pg` sans test actif, `kb_config` avec 35 tests passés et `kb_app_demo` avec 28 tests passés.
## 0.2.2 — infrastructure PostgreSQL minimale
@@ -47,7 +47,7 @@ Validation du jalon raw store minimal : `kb_store_pg` crée et initialise les de
## 0.2.4 — core Solana normalisé minimal
-Validation du jalon core store minimal : `kb_store_pg` crée et initialise maintenant les tables core `kb_sol_core_transactions`, `kb_sol_core_account_keys`, `kb_sol_core_instructions`, `kb_sol_core_inner_instructions`, `kb_sol_core_logs` et `kb_sol_core_balance_changes`, en complément du raw store `0.2.3`, sans schema PostgreSQL applicatif explicite. Les migrations et l'initializer utilisent des noms SQL préfixés et explicites pour les contraintes et index : `pk_`, `fk_`, `ck_`, `ux_` et `ix_`. L'initialisation raw/core est sérialisée par un verrou PostgreSQL `pg_advisory_xact_lock` afin d'éviter les courses concurrentes pendant les tests ou les démarrages parallèles. `CoreTransactionStore` dispose de l'implémentation PostgreSQL minimale pour insérer les transactions core, account keys, instructions, inner instructions, logs et deltas de balances, puis reconstruire `CoreInstructionReplayInput` pour les futurs décodeurs. Le script de maintenance `kb_store_pg/maintenance/drop_raw_core_store.sql` permet de réinitialiser explicitement les tables raw/core locales dans l'ordre inverse des dépendances. Validation locale effectuée : `KB_POSTGRES_TEST_URL=postgres://solana:solana@localhost:5432/solana cargo test -p kb_store_pg -- --nocapture` avec 30 tests passés, création vérifiée des 8 tables dans PostgreSQL, réinitialisation validée via le script de maintenance, puis `cargo clippy --all-targets` sans avertissement. Le worker d'extraction raw RPC vers core, les observations et le ledger ops sont conservés pour les jalons suivants.
+Validation du jalon core store minimal : `kb_store_pg` crée et initialise maintenant les tables core `kb_sol_core_transactions`, `kb_sol_core_account_keys`, `kb_sol_core_instructions`, `kb_sol_core_inner_instructions`, `kb_sol_core_logs` et `kb_sol_core_balance_changes`, en complément du raw store `0.2.3`, sans schema PostgreSQL applicatif explicite. Les migrations et l'initializer utilisent des noms SQL préfixés et explicites pour les contraintes et index : `pk_`, `fk_`, `ck_`, `ux_` et `ix_`. L'initialisation raw/core est sérialisée par un verrou PostgreSQL `pg_advisory_xact_lock` afin d'éviter les courses concurrentes pendant les tests ou les démarrages parallèles. `CoreTransactionStore` dispose de l'implémentation PostgreSQL minimale pour insérer les transactions core, account keys, instructions, inner instructions, logs et deltas de balances, puis reconstruire `MdCoreInstructionReplayInput` pour les futurs décodeurs. Le script de maintenance `kb_store_pg/maintenance/drop_raw_core_store.sql` permet de réinitialiser explicitement les tables raw/core locales dans l'ordre inverse des dépendances. Validation locale effectuée : `KB_POSTGRES_TEST_URL=postgres://solana:solana@localhost:5432/solana cargo test -p kb_store_pg -- --nocapture` avec 30 tests passés, création vérifiée des 8 tables dans PostgreSQL, réinitialisation validée via le script de maintenance, puis `cargo clippy --all-targets` sans avertissement. Le worker d'extraction raw RPC vers core, les observations et le ledger ops sont conservés pour les jalons suivants.
## 0.2.5 — diagnostics SQL PostgreSQL dans `kb_app_demo`
diff --git a/docs/legacy-khadhroony-bot2/ROADMAP.md b/docs/legacy-khadhroony-bot2/ROADMAP.md
index f21cd46..a49aa0b 100644
--- a/docs/legacy-khadhroony-bot2/ROADMAP.md
+++ b/docs/legacy-khadhroony-bot2/ROADMAP.md
@@ -172,7 +172,7 @@ Ce fichier contient les changements futurs et le phasage prévu. Il ne remplace
- [x] Ajouter les types communs : pagination, tri, limites, healthcheck, statut migration.
- [x] Ajouter les premiers DTO génériques : raw RPC transaction, raw WS notification, core transaction, core instruction.
- [x] Ajouter les contrats core pour account keys, logs et balance changes extraits.
-- [x] Ajouter `CoreInstructionReplayInput` pour fournir aux décodeurs une instruction avec contexte extrait.
+- [x] Ajouter `MdCoreInstructionReplayInput` pour fournir aux décodeurs une instruction avec contexte extrait.
- [x] Ajouter les contrats de cycle de vie raw : état de rétention, état de traitement et mark lifecycle.
- [x] Ajouter les contrats de replay par instruction : état instruction, filtre de replay et lifecycle mark.
- [x] Ajouter les premiers traits repository sans implémentation SQL.
@@ -229,7 +229,7 @@ Ce fichier contient les changements futurs et le phasage prévu. Il ne remplace
### 0.2.4 — core Solana normalisé minimal
- [x] Créer les tables core minimales : `kb_sol_core_transactions`, `kb_sol_core_account_keys`, `kb_sol_core_instructions`, `kb_sol_core_inner_instructions`, `kb_sol_core_logs`, `kb_sol_core_balance_changes`.
-- [x] Construire `CoreInstructionReplayInput` depuis les tables `core` pour les décodeurs.
+- [x] Construire `MdCoreInstructionReplayInput` depuis les tables `core` pour les décodeurs.
- [x] Marquer les instructions insérées comme `Pending` pour permettre un replay instruction-level.
- [x] Préparer le replay partiel par état, slot et program id via `CoreInstructionReplayFilter`.
- [x] Ajouter une initialisation idempotente raw/core via `PostgresStore::initialize_store_schema()`.
@@ -460,7 +460,7 @@ Les contrôles autrefois prévus dans `0.3.5` sont reclassés ainsi : la stabili
- [x] Auditer les crates utilisant `tracing.workspace = true` et couvrir les treize crates alors actives par un test de constante canonique et par les routes des trois profils.
- [x] Ajouter le tracing propriétaire manquant sur les clients/pools HTTP et WebSocket ainsi que sur le backfill ; promouvoir les inputs decode unmatched, statuts failed/unsupported et échecs de matérialisation/persistance au niveau `error`.
- [x] Formaliser dans `docs/SOLANA_INTERFACE_DEPENDENCIES.md` la politique d’interfaces officielles : dépendance seulement au point de consommation, priorité `wincode` puis Borsh, parser borné lorsque l’interface n’expose que `bincode`.
-- [x] Passer `CoreInstructionReplayInput` au contrat `2` avec une liste stable et numériquement ordonnée des instructions outer, sans migration SQL, afin de résoudre les références inter-instructions des précompiles.
+- [x] Passer `MdCoreInstructionReplayInput` au contrat `2` avec une liste stable et numériquement ordonnée des instructions outer, sans migration SQL, afin de résoudre les références inter-instructions des précompiles.
- [x] Décoder `zk_elgamal_proof` dans `pre.015` selon `solana-zk-elgamal-proof-interface ^0.1` et le runtime Agave : treize discriminants, preuves inline ou référencées par compte, contexte optionnel et fermeture du contexte, sans recalcul cryptographique.
- [x] Décoder dans `pre.016` l’ancien `zk_token_proof` comme compatibilité historique, puis retirer dans `pre.019` la dépendance dépréciée `solana-zk-token-sdk` au profit d’un miroir wire local borné des dix-sept discriminants et tailles auditées.
- [x] Décoder les loaders `native_loader`, `bpf_loader_deprecated`, `bpf_loader`, `bpf_loader_upgradeable` et `loader_v4` ; classer l’invocation Native Loader opaque comme `ignored` sans sémantique inventée.
@@ -532,14 +532,14 @@ Les contrôles autrefois prévus dans `0.3.5` sont reclassés ainsi : la stabili
#### Suite d’orchestration
-- [x] `pre.004` : ajouter dans `kb_rpc` les adaptateurs typés `getGenesisHash`, `getLatestBlockhash`, `getFeeForMessage` et `simulateTransaction`, avec routage par rôle, classification des clusters publics, diagnostics runtime et conversion vers `ExecutionSimulationResult`, sans signature ni envoi.
+- [x] `pre.004` : ajouter dans `kb_rpc` les adaptateurs typés `getGenesisHash`, `getLatestBlockhash`, `getFeeForMessage` et `simulateTransaction`, avec routage par rôle, classification des clusters publics, diagnostics runtime et conversion vers `ExApiExecutionSimulationResult`, sans signature ni envoi.
- [x] `pre.004` : documenter dans `kb_executor_solana_core/README.md` chaque fonction publique, les six opérations constructibles, leurs paramètres, résultats, effets et frontières.
- [x] Valider localement `pre.004` : `kb_rpc` 63 tests, `kb_execution_api` 21 tests, `kb_execution_safety` 13 tests, `kb_executor_solana_core` 10 tests, `kb_config` 40 tests et Clippy global propre.
- [x] `pre.005` : ajouter `kb_execution_solana` pour assembler les instructions planifiées en transaction legacy, produire les payloads base64 de frais/simulation, lier la simulation au hash exact du message, résoudre exactement les signataires requis via l’interface Solana `Signer` et signer séparément hors Tauri.
- [x] `pre.005` : renommer la constante interne en `MAINNET_GENESIS_HASH` sans changer sa valeur ; conserver `mainnet-beta` seulement comme alias historique des endpoints/CLI et renommer le variant public en `Mainnet` sérialisé `mainnet`.
- [x] `pre.005` : distinguer la simulation exacte de la simulation avec remplacement de blockhash et interdire qu’un résultat `replaceRecentBlockhash=true` autorise la signature du message original.
- [x] Valider localement les tests ciblés de `pre.005`/`pre.006` : `kb_execution_solana` 7 tests, `kb_execution_api` 22 tests, `kb_execution_safety` 15 tests, `kb_rpc` 63 tests, `kb_executor_solana_core` 10 tests, `kb_wallet` 6 tests et `kb_config` 40 tests.
-- [x] `pre.006` : corriger la compilation croisée de `pre.005`, supprimer l’avertissement TS-rs sur l’alias historique `mainnet_beta`, utiliser le trait public `TypedInstructionExecutor` dans les tests d’assemblage, resynchroniser le contrat de simulation RPC et rendre les erreurs de routage tracing explicites.
+- [x] `pre.006` : corriger la compilation croisée de `pre.005`, supprimer l’avertissement TS-rs sur l’alias historique `mainnet_beta`, utiliser le trait public `ExApiTypedInstructionExecutor` dans les tests d’assemblage, resynchroniser le contrat de simulation RPC et rendre les erreurs de routage tracing explicites.
- [x] `pre.007` : supprimer le dernier opérateur `?` introduit dans un chemin de production de `kb_execution_api`, le remplacer par un `match` avec propagation explicite et auditer les fichiers d’exécution `0.4.2` contre `?`, `unwrap` et `expect` de production.
- [x] Valider localement `pre.007` : `kb_execution_api` 22 tests et Clippy global propre.
- [x] `pre.008` : ajouter les contrats RPC typés `getBalance`, `requestAirdrop`, `sendTransaction`, `getSignatureStatuses` et `getBlockHeight`, avec routage par rôle, préflight obligatoire, contrôle de la signature retournée et confirmation bornée jusqu’à succès, échec, expiration ou timeout.
@@ -603,7 +603,7 @@ Les contrôles autrefois prévus dans `0.3.5` sont reclassés ainsi : la stabili
- [x] Valider localement `pre.019` : `kb_executor_solana_core` 70 tests, `kb_execution_api` 22, `kb_execution_safety` 15, `kb_execution_solana` 12, `kb_rpc` 70 et Clippy global propre.
- [x] `pre.020` : onze opérations Loader v3 et neuf opérations Loader v4 réellement constructibles, avec déploiement/upgrade/autorités/fermeture hors UI; BPF Loader v1/v2 restent historiques `decode-only` et Native Loader est classé sans instruction client.
- [x] Valider localement `pre.020` : `kb_executor_solana_core` 81 tests, `kb_decoder_solana_core` 115, `kb_execution_api` 22, `kb_execution_safety` 15, `kb_execution_solana` 12 et `kb_rpc` 70.
-- [x] `pre.021` : centraliser dans un module privé les parsers `Pubkey`/program ID et les validations communes de longueur, montant positif, comptes distincts, dérivation seedée et erreurs partagées ; supprimer les implémentations de production identiques sans modifier les 109 opérations ni leur wire.
+- [x] `pre.021` : centraliser dans un module privé les parsers `MdPubkey`/program ID et les validations communes de longueur, montant positif, comptes distincts, dérivation seedée et erreurs partagées ; supprimer les implémentations de production identiques sans modifier les 109 opérations ni leur wire.
- [x] Valider localement `pre.021` après `fix.001` : `kb_executor_solana_core` 86 tests et `cargo clippy --all-targets` propre ; ce Clippy couvre également les changements Loader de `pre.020`.
- [x] `pre.022` : implémenter le préflight stateful Localnet/Devnet pour ALT, Config, Feature, Slashing et contextes ZK ElGamal ; ajouter `getEpochInfo` typé et la matrice machine-readable complète des 18 surfaces natives avec classification de toute opération non invocable.
- [x] Valider localement `pre.022` : `kb_executor_solana_core` 87 tests, `kb_pipeline` 56 tests, `kb_rpc` 71 tests, `kb_execution_api` 22 tests, `kb_execution_safety` 15 tests, `kb_execution_solana` 12 tests, validateur de matrice réussi et `cargo clippy --all-targets` propre.
diff --git a/docs/legacy-khadhroony-bot2/RULES.md b/docs/legacy-khadhroony-bot2/RULES.md
index e0aeec2..245e53a 100644
--- a/docs/legacy-khadhroony-bot2/RULES.md
+++ b/docs/legacy-khadhroony-bot2/RULES.md
@@ -138,7 +138,7 @@ Aucun renommage massif de crates n'est autorisé sans étape de contrôle dédi
- Une crate est opérationnelle lorsqu’elle 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`.
-- La valeur canonique de `TRACING_TARGET` est le nom exact du package Cargo. Les targets historiques `khbot.*`, les suffixes de module et les targets de fenêtre sont interdits dans les nouvelles modifications.
+- La valeur canonique de `DC_METADATA_MTM_TRACING_TARGET` est le nom exact du package Cargo. Les targets historiques `khbot.*`, les suffixes de module 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.
- Il est interdit d’ajouter `tracing` sans événement réel ou de conserver un faux target uniquement consommé par `let _target`.
@@ -150,14 +150,14 @@ Aucun renommage massif de crates n'est autorisé sans étape de contrôle dédi
- Chaque profil doit router les événements vers les sorties globales `debug.log`, `info.log`, `error.jsonl` et `app.log`, puis vers `debug.log`, `info.log` et `error.jsonl` dans un répertoire propre à chaque crate utilisant `tracing`.
- L’ajout ou la suppression de `tracing.workspace = true` dans une crate impose la mise à jour simultanée de la matrice de routes, de ses tests et de `docs/TRACING_CONTRACT.md`.
- Le contrat détaillé est défini dans `docs/TRACING_CONTRACT.md`.
-- L’audit mécanique spécifique au projet est exécuté par `python3 scripts/audit_khadhroony_workspace_rules.py`. Il couvre notamment `TRACING_TARGET` et l’usage obligatoire de `solana_pubkey::Pubkey` à la place de `solana_address::Address`.
+- L’audit mécanique spécifique au projet est exécuté par `python3 scripts/audit_khadhroony_workspace_rules.py`. Il couvre notamment `DC_METADATA_MTM_TRACING_TARGET` et l’usage obligatoire de `solana_pubkey::Pubkey` à la place de `solana_address::Address`.
## Règles de réutilisation des interfaces Solana et SPL
- 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 `EventMaterializer` 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 `EventMaterializer` 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 `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 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`.
diff --git a/kb-core/src/lib.rs b/kb-core/src/lib.rs
index 84fddc9..6c42af2 100644
--- a/kb-core/src/lib.rs
+++ b/kb-core/src/lib.rs
@@ -10,12 +10,12 @@ mod error;
mod module;
/// Workspace-wide explicit error type.
-pub use crate::error::Error;
+pub use self::error::Error;
/// Workspace-wide result alias.
-pub use crate::error::Result;
+pub use self::error::Result;
/// Processing module category.
-pub use crate::module::ModuleKind;
+pub use self::module::ModuleKind;
/// Stable module name.
-pub use crate::module::ModuleName;
+pub use self::module::ModuleName;
/// Stable semantic module version.
-pub use crate::module::ModuleVersion;
+pub use self::module::ModuleVersion;
diff --git a/kb-lib/README.md b/kb-lib/README.md
index c34730b..57b1064 100644
--- a/kb-lib/README.md
+++ b/kb-lib/README.md
@@ -7,7 +7,7 @@
## Décodeur Solana Core
-`SolanaCoreDecoder` est le premier décodeur concret porté depuis bot2. Il implémente `InstructionDecoder` et `ProtocolDecoder` sans dépendre de PostgreSQL, du RPC, de Tauri ou du wallet.
+`DcSolanaCoreDecoder` est le premier décodeur concret porté depuis bot2. Il implémente `DcApiInstructionDecoder` et `DcApiProtocolDecoder` sans dépendre de PostgreSQL, du RPC, de Tauri ou du wallet.
Il couvre les 18 surfaces natives suivantes :
@@ -25,13 +25,13 @@ La matrice `docs/NATIVE_SOLANA_DECODER_MATRIX.json` reste la source machine-read
## Décodeur SPL Memo
-`SplMemoDecoder` couvre exactement les générations v1, v3 et v4. Le payload est lu comme un message brut sans discriminator, borné à 4 096 octets, puis projeté avec son texte UTF-8 complet, sa longueur, son SHA-256, les comptes ordonnés et le statut de commit.
+`DcSplMemoDecoder` couvre exactement les générations v1, v3 et v4. Le payload est lu comme un message brut sans discriminator, borné à 4 096 octets, puis projeté avec son texte UTF-8 complet, sa longueur, son SHA-256, les comptes ordonnés et le statut de commit.
Memo v1 ignore les comptes lors de la validation runtime. Memo v3 et v4 exigent que chaque compte fourni soit signer. Les transactions échouées restent des intentions non commitées et les payloads UTF-8 invalides ou signatures manquantes deviennent des tentatives invalides explicites. La matrice normative est `docs/SPL_MEMO_MATRIX.json`.
## Décodeur SPL Token classique
-`SplTokenDecoder` couvre exclusivement le Program ID classique
+`DcSplTokenDecoder` couvre exclusivement le Program ID classique
`TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`. Il publie 28 déclarations de couverture pour
les tags `0..24`, `38`, `45` et `255`, y compris les variantes historiques, checked,
`WithdrawExcessLamports`, `UnwrapLamports` et `Batch`.
@@ -45,7 +45,7 @@ normative est `docs/SPL_TOKEN_MATRIX.json`.
## Décodeur SPL Associated Token Account
-`SplAssociatedTokenAccountDecoder` couvre exclusivement
+`DcSplAssociatedTokenAccountDecoder` couvre exclusivement
`ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL`. Il reconnaît les trois variantes publiées
`Create`, `CreateIdempotent` et `RecoverNested`, ainsi que l’encodage historique vide de `Create`.
@@ -58,7 +58,7 @@ Program ID sans reconstruire leur état ni interpréter leurs extensions. La mat
## Décodeur SPL Token‑2022
-`SplToken2022Decoder` couvre exclusivement
+`DcSplToken2022Decoder` couvre exclusivement
`TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb`. Il conserve les 48 enveloppes de premier niveau,
les sous-instructions d’extensions dont le wire est officiellement identifiable, les interfaces
Token Metadata et Token Group exécutées directement par Token‑2022, ainsi que `Batch` sans batch
@@ -67,22 +67,22 @@ imbriqué.
Le décodeur borne les payloads, les chaînes de metadata, le nombre d’enfants et les comptes
cumulés. Les comptes, autorités, offsets de preuve, suffixes et chemins outer/inner restent
ordonnés et exacts. Une transaction échouée produit une intention non commitée. Le parseur public
-`parse_token_2022_state()` distingue Mint, Account et Multisig, conserve la base exacte et expose
+`decoder_spl_token2022_parse_token2022_state()` distingue Mint, Account et Multisig, conserve la base exacte et expose
les entrées TLV ordonnées sans inventer l’état d’un programme externe pointé. La matrice normative
est `docs/SPL_TOKEN_2022_MATRIX.json`.
## Décodeur du registre ElGamal
-`SplElgamalRegistryDecoder` couvre le programme indépendant
+`DcSplElgamalRegistryDecoder` couvre le programme indépendant
`regVYJW7tcT8zipN5YiBvHsvR5jXW1uLFxaHSbugABg`. Il décode exactement `CreateRegistry` et
`UpdateRegistry`, conserve l’offset relatif de preuve et ne prétend jamais vérifier la preuve ZK.
-`parse_elgamal_registry_state()` exige exactement 64 octets et restitue le wallet propriétaire, la
+`decoder_spl_elgamal_registry_parse_elgamal_registry_state()` exige exactement 64 octets et restitue le wallet propriétaire, la
clé publique ElGamal et le wire complet. La matrice normative est
`docs/SPL_ELGAMAL_REGISTRY_MATRIX.json`.
## Décodeur Metaplex Token Metadata
-`MetadataMetaplexTokenMetadataDecoder` couvre exclusivement
+`DcMetadataMetaplexTokenMetadataDecoder` couvre exclusivement
`metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s`. Il inventorie exactement les 58
discriminateurs `0..=57`, conserve les arguments Borsh, les comptes positionnels,
les placeholders optionnels, les chemins outer/CPI et les transactions échouées
@@ -100,22 +100,22 @@ politique d’exécution définitivement interdite. La matrice normative est
## API publique utile
-- `EventMaterializer`, `MaterializerIdentity`, `MaterializationTransactionPolicy`, `MaterializerExecutionResult` et `MaterializedOutput` : contrat complet utilisable par un matérialiseur interne ou externe ;
-- `LifecycleMaterializer`, `AdminMaterializer`, `ComplianceAuditMaterializer` et `StakingMaterializer` : matérialisateurs Solana natifs concrets ;
-- `materialize_token_2022_admin_state_snapshots()` et `materialize_elgamal_registry_state_snapshot()` : projections stateful d’administration déjà exposées ;
-- `SolanaCoreDecoder` : décodeur concret natif ;
-- `SplMemoDecoder` : décodeur exact des trois générations SPL Memo ;
-- `SplTokenDecoder` : décodeur exact du programme SPL Token classique ;
-- `SplAssociatedTokenAccountDecoder` : décodeur exact du programme Associated Token Account ;
-- `SplToken2022Decoder` : décodeur exact des instructions Token‑2022 ;
-- `Token2022State`, `Token2022StateKind`, `Token2022TlvEntry` et `parse_token_2022_state()` : API publique de lecture d’état Token‑2022 ;
-- `SplElgamalRegistryDecoder`, `ElGamalRegistryState` et `parse_elgamal_registry_state()` : API publique du registre ElGamal ;
-- `MetadataMetaplexTokenMetadataDecoder` : décodeur exact du programme Metaplex Token Metadata ;
+- `MtApiEventMaterializer`, `MtApiMaterializerIdentity`, `MtApiMaterializationTransactionPolicy`, `MtApiMaterializerExecutionResult` et `MtApiMaterializedOutput` : contrat complet utilisable par un matérialiseur interne ou externe ;
+- `MtLifecycleMaterializer`, `MtAdminMaterializer`, `MtComplianceAuditMaterializer` et `MtStakingMaterializer` : matérialisateurs Solana natifs concrets ;
+- `materialize_token2022_admin_state_snapshots()` et `materialize_elgamal_registry_state_snapshot()` : projections stateful d’administration déjà exposées ;
+- `DcSolanaCoreDecoder` : décodeur concret natif ;
+- `DcSplMemoDecoder` : décodeur exact des trois générations SPL Memo ;
+- `DcSplTokenDecoder` : décodeur exact du programme SPL Token classique ;
+- `DcSplAssociatedTokenAccountDecoder` : décodeur exact du programme Associated Token Account ;
+- `DcSplToken2022Decoder` : décodeur exact des instructions Token‑2022 ;
+- `DcToken2022State`, `DcToken2022StateKind`, `DcToken2022TlvEntry` et `decoder_spl_token2022_token2022_state()` : API publique de lecture d’état Token‑2022 ;
+- `DcSplElgamalRegistryDecoder`, `DcSplElGamalRegistryState` et `decoder_spl_elgamal_registry_parse_elgamal_registry_state()` : API publique du registre ElGamal ;
+- `DcMetadataMetaplexTokenMetadataDecoder` : décodeur exact du programme Metaplex Token Metadata ;
- `kb_lib::decoder::metadata::metaplex_token_metadata` : parseurs et snapshots publics des comptes Metaplex ;
-- `InstructionDecoder` : contrat de reconnaissance, couverture et décodage contextualisé ;
-- `ProtocolDecoder` : contrat de compatibilité avec les observations historiques ;
-- `CoreInstructionReplayInput` : input source-neutral produit par l’extraction core ;
-- `DecoderExecutionResult`, `DecoderRecognition` et `DecoderCoverageDeclaration` : résultats typés du pipeline ;
+- `DcApiInstructionDecoder` : contrat de reconnaissance, couverture et décodage contextualisé ;
+- `DcApiProtocolDecoder` : contrat de compatibilité avec les observations historiques ;
+- `MdCoreInstructionReplayInput` : input source-neutral produit par l’extraction core ;
+- `DcApiDecoderExecutionResult`, `DcApiDecoderRecognition` et `DcApiDecoderCoverageDeclaration` : résultats typés du pipeline ;
- modèles canoniques et nomenclature réexportés depuis la façade.
Les helpers, constantes wire et types intermédiaires de chaque composant restent internes. Leurs noms sont préfixés au niveau de la façade interne afin d’éviter les collisions lors de la fusion des anciens crates.
diff --git a/kb-lib/src/decoder.rs b/kb-lib/src/decoder.rs
index f1d889a..cede0e6 100644
--- a/kb-lib/src/decoder.rs
+++ b/kb-lib/src/decoder.rs
@@ -3,164 +3,498 @@
//! Consolidated decoder modules.
-pub mod adapter;
-pub mod admin;
-pub mod amm;
-pub mod anchor;
-pub mod api;
-pub mod bridge;
-pub mod clmm;
-pub mod cpmm;
-pub mod dlmm;
-pub mod fees;
-pub mod governance;
-pub mod launchpad;
-pub mod lending;
-pub mod lock;
-pub mod metadata;
-pub mod nft;
-pub mod orderbook;
-pub mod perpetuals;
-pub mod router;
-pub mod rwa;
-pub mod solana;
-pub mod spl;
-pub mod stable;
-pub mod staking;
-pub mod treasury;
-pub mod vault;
-pub mod vesting;
-pub mod wallet;
-pub mod weighted;
+mod adapter;
+mod admin;
+mod amm;
+mod anchor;
+mod api;
+mod bridge;
+mod clmm;
+mod cpmm;
+mod dlmm;
+mod fees;
+mod governance;
+mod launchpad;
+mod lending;
+mod lock;
+mod metadata;
+mod nft;
+mod orderbook;
+mod perpetuals;
+mod router;
+mod rwa;
+mod solana;
+mod spl;
+mod stable;
+mod staking;
+mod treasury;
+mod vault;
+mod vesting;
+mod wallet;
+mod weighted;
-/// One parsed SPL ElGamal registry instruction.
-pub(crate) use self::spl::ParsedRegistryInstruction;
+/// Approve Collection Authority discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_APPROVE_COLLECTION_AUTHORITY_DISCRIMINATOR;
+/// Approve Use Authority discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_APPROVE_USE_AUTHORITY_DISCRIMINATOR;
+/// Bubblegum Set Collection Size discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_BUBBLEGUM_SET_COLLECTION_SIZE_DISCRIMINATOR;
+/// Burn discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_BURN_DISCRIMINATOR;
+/// Historical Burn Edition NFT discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_BURN_EDITION_NFT_DISCRIMINATOR;
+/// Historical Burn NFT discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_BURN_NFT_DISCRIMINATOR;
+/// Close Accounts discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_CLOSE_ACCOUNTS_DISCRIMINATOR;
+/// Close Escrow Account discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_CLOSE_ESCROW_ACCOUNT_DISCRIMINATOR;
+/// Collect discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_COLLECT_DISCRIMINATOR;
+/// Convert Master Edition V1 to V2 discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_CONVERT_MASTER_EDITION_V1_TO_V2_DISCRIMINATOR;
+/// Modern Create discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_CREATE_DISCRIMINATOR;
+/// Create Escrow Account discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_CREATE_ESCROW_ACCOUNT_DISCRIMINATOR;
+/// Historical Create Master Edition discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_CREATE_MASTER_EDITION_DISCRIMINATOR;
+/// Create Master Edition V3 discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_CREATE_MASTER_EDITION_V3_DISCRIMINATOR;
+/// Historical Create Metadata Account discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_DISCRIMINATOR;
+/// Historical Create Metadata Account V2 discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_V2_DISCRIMINATOR;
+/// Create Metadata Account V3 discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_V3_DISCRIMINATOR;
+/// Delegate discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_DELEGATE_DISCRIMINATOR;
+/// Deprecated Create Master Edition discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_DEPRECATED_CREATE_MASTER_EDITION_DISCRIMINATOR;
+/// Deprecated Create Reservation List discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_DEPRECATED_CREATE_RESERVATION_LIST_DISCRIMINATOR;
+/// Deprecated printing-token mint-new-edition discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_DEPRECATED_MINT_NEW_EDITION_VIA_PRINTING_TOKEN_DISCRIMINATOR;
+/// Deprecated Mint Printing Tokens discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_DEPRECATED_MINT_PRINTING_TOKENS_DISCRIMINATOR;
+/// Deprecated Mint Printing Tokens Via Token discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_DEPRECATED_MINT_PRINTING_TOKENS_VIA_TOKEN_DISCRIMINATOR;
+/// Deprecated Set Reservation List discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_DEPRECATED_SET_RESERVATION_LIST_DISCRIMINATOR;
+/// Number of bytes retained in malformed-wire diagnostics.
+pub(crate) use self::metadata::DC_METADATA_MTM_DIAGNOSTIC_PREFIX_BYTES;
+/// Stable event payload contract version.
+pub(crate) use self::metadata::DC_METADATA_MTM_EVENT_VERSION;
+/// Freeze Delegated Account discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_FREEZE_DELEGATED_ACCOUNT_DISCRIMINATOR;
+/// Current pre-release instruction inventory.
+pub(crate) use self::metadata::DC_METADATA_MTM_INSTRUCTION_ENTRIES;
+/// Lock discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_LOCK_DISCRIMINATOR;
+/// Maximum encoded base64 instruction payload size.
+pub(crate) use self::metadata::DC_METADATA_MTM_MAX_BASE64_BYTES;
+/// Maximum number of instruction accounts accepted by this decoder.
+pub(crate) use self::metadata::DC_METADATA_MTM_MAX_INSTRUCTION_ACCOUNTS;
+/// Tracing target for this decoder.
+/// Maximum retained instruction payload size.
+pub(crate) use self::metadata::DC_METADATA_MTM_MAX_INSTRUCTION_BYTES;
+/// Migrate discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_MIGRATE_DISCRIMINATOR;
+/// Modern Mint discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_MINT_DISCRIMINATOR;
+/// Mint New Edition From Master Edition Via Token discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR;
+/// Mint New Edition From Master Edition Via Vault Proxy discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_DISCRIMINATOR;
+/// Modern Print discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_PRINT_DISCRIMINATOR;
+/// Puff Metadata discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_PUFF_METADATA_DISCRIMINATOR;
+/// Remove Creator Verification discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_REMOVE_CREATOR_VERIFICATION_DISCRIMINATOR;
+/// Resize discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_RESIZE_DISCRIMINATOR;
+/// Revoke Collection Authority discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_REVOKE_COLLECTION_AUTHORITY_DISCRIMINATOR;
+/// Revoke discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_REVOKE_DISCRIMINATOR;
+/// Revoke Use Authority discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_REVOKE_USE_AUTHORITY_DISCRIMINATOR;
+/// Set And Verify Collection discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_SET_AND_VERIFY_COLLECTION_DISCRIMINATOR;
+/// Set And Verify Sized Collection Item discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_SET_AND_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR;
+/// Set Collection Size discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_SET_COLLECTION_SIZE_DISCRIMINATOR;
+/// Set Token Standard discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_SET_TOKEN_STANDARD_DISCRIMINATOR;
+/// Sign Metadata discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_SIGN_METADATA_DISCRIMINATOR;
+/// Stable decoder surface code.
+pub(crate) use self::metadata::DC_METADATA_MTM_SURFACE_CODE;
+/// Thaw Delegated Account discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_THAW_DELEGATED_ACCOUNT_DISCRIMINATOR;
+/// Canonical tracing target for this crate.
+pub(crate) use self::metadata::DC_METADATA_MTM_TRACING_TARGET;
+/// Transfer discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_TRANSFER_DISCRIMINATOR;
+/// Transfer Out Of Escrow discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_TRANSFER_OUT_OF_ESCROW_DISCRIMINATOR;
+/// Unlock discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_UNLOCK_DISCRIMINATOR;
+/// Unverify Collection discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_UNVERIFY_COLLECTION_DISCRIMINATOR;
+/// Modern Unverify discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_UNVERIFY_DISCRIMINATOR;
+/// Unverify Sized Collection Item discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_UNVERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR;
+/// Modern Update discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_UPDATE_DISCRIMINATOR;
+/// Historical Update Metadata Account discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_UPDATE_METADATA_ACCOUNT_DISCRIMINATOR;
+/// Update Metadata Account V2 discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_UPDATE_METADATA_ACCOUNT_V2_DISCRIMINATOR;
+/// Update Primary Sale Happened Via Token discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_DISCRIMINATOR;
+/// Modern Use discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_USE_DISCRIMINATOR;
+/// Utilize discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_UTILIZE_DISCRIMINATOR;
+/// Verify Collection discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_VERIFY_COLLECTION_DISCRIMINATOR;
+/// Modern Verify discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_VERIFY_DISCRIMINATOR;
+/// Verify Sized Collection Item discriminator.
+pub(crate) use self::metadata::DC_METADATA_MTM_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR;
+/// Crate-root access to `decode` from `instruction`.
+pub(crate) use self::metadata::decoder_metadata_metaplex_token_metadata_decode;
+/// Crate-root access to `entry_for_discriminator` from `instruction`.
+pub(crate) use self::metadata::decoder_metadata_metaplex_token_metadata_entry_for_discriminator;
+/// Crate-root access to `payload_discriminator` from `instruction`.
+pub(crate) use self::metadata::decoder_metadata_metaplex_token_metadata_payload_discriminator;
+pub(crate) use self::solana::DC_SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_BPF_LOADER_DEPRECATED_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_BPF_LOADER_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_CONFIG_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES;
+pub(crate) use self::solana::DC_SOLANA_CORE_ED25519_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_FEATURE_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_LOADER_V4_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES;
+pub(crate) use self::solana::DC_SOLANA_CORE_NATIVE_EVENT_VERSION;
+pub(crate) use self::solana::DC_SOLANA_CORE_NATIVE_LOADER_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_PRECOMPILE_COMPONENT_PREFIX_BYTES;
+pub(crate) use self::solana::DC_SOLANA_CORE_PROTOCOL_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES;
+pub(crate) use self::solana::DC_SOLANA_CORE_SECP256K1_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_SECP256R1_MAX_SIGNATURES;
+pub(crate) use self::solana::DC_SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES;
+pub(crate) use self::solana::DC_SOLANA_CORE_SECP256R1_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_SIGNATURE_BYTES;
+pub(crate) use self::solana::DC_SOLANA_CORE_SLASHING_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_STAKE_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_SYSTEM_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_TRACING_TARGET;
+pub(crate) use self::solana::DC_SOLANA_CORE_U8_OFFSETS_BYTES;
+pub(crate) use self::solana::DC_SOLANA_CORE_U16_OFFSETS_BYTES;
+pub(crate) use self::solana::DC_SOLANA_CORE_VOTE_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE;
+pub(crate) use self::solana::DC_SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE;
+pub(crate) use self::solana::DcSolanaCoreAccountRole;
+pub(crate) use self::solana::DcSolanaCoreResolvedInstructionPayload;
+pub(crate) use self::solana::decoder_solana_core_address_lookup_table_coverage;
+pub(crate) use self::solana::decoder_solana_core_address_lookup_table_decode;
+pub(crate) use self::solana::decoder_solana_core_address_lookup_table_recognize;
+pub(crate) use self::solana::decoder_solana_core_bounded_hexadecimal_prefix;
+pub(crate) use self::solana::decoder_solana_core_bounded_slice;
+pub(crate) use self::solana::decoder_solana_core_compute_budget_coverage;
+pub(crate) use self::solana::decoder_solana_core_compute_budget_decode;
+pub(crate) use self::solana::decoder_solana_core_compute_budget_recognize;
+pub(crate) use self::solana::decoder_solana_core_config_coverage;
+pub(crate) use self::solana::decoder_solana_core_config_decode;
+pub(crate) use self::solana::decoder_solana_core_config_recognize;
+pub(crate) use self::solana::decoder_solana_core_decode_instruction_data;
+pub(crate) use self::solana::decoder_solana_core_decoded_payload_length;
+pub(crate) use self::solana::decoder_solana_core_decoded_payload_sha256;
+pub(crate) use self::solana::decoder_solana_core_decoded_result;
+pub(crate) use self::solana::decoder_solana_core_failed_result;
+pub(crate) use self::solana::decoder_solana_core_feature_coverage;
+pub(crate) use self::solana::decoder_solana_core_feature_decode;
+pub(crate) use self::solana::decoder_solana_core_feature_recognize;
+pub(crate) use self::solana::decoder_solana_core_hash_bytes;
+pub(crate) use self::solana::decoder_solana_core_hexadecimal_prefix;
+pub(crate) use self::solana::decoder_solana_core_loaders_coverage;
+pub(crate) use self::solana::decoder_solana_core_loaders_decode;
+pub(crate) use self::solana::decoder_solana_core_loaders_recognize;
+pub(crate) use self::solana::decoder_solana_core_payload_hash;
+pub(crate) use self::solana::decoder_solana_core_precompiles_coverage;
+pub(crate) use self::solana::decoder_solana_core_precompiles_decode;
+pub(crate) use self::solana::decoder_solana_core_precompiles_recognize;
+pub(crate) use self::solana::decoder_solana_core_read_u32_le;
+pub(crate) use self::solana::decoder_solana_core_read_u64_le;
+pub(crate) use self::solana::decoder_solana_core_resolve_accounts;
+pub(crate) use self::solana::decoder_solana_core_resolve_u8_instruction_payload;
+pub(crate) use self::solana::decoder_solana_core_resolve_u16_instruction_payload;
+pub(crate) use self::solana::decoder_solana_core_slashing_coverage;
+pub(crate) use self::solana::decoder_solana_core_slashing_decode;
+pub(crate) use self::solana::decoder_solana_core_slashing_recognize;
+pub(crate) use self::solana::decoder_solana_core_stake_coverage;
+pub(crate) use self::solana::decoder_solana_core_stake_decode;
+pub(crate) use self::solana::decoder_solana_core_stake_recognize;
+pub(crate) use self::solana::decoder_solana_core_system_coverage;
+pub(crate) use self::solana::decoder_solana_core_system_decode;
+pub(crate) use self::solana::decoder_solana_core_system_recognize;
+pub(crate) use self::solana::decoder_solana_core_target_outer_instruction_index;
+pub(crate) use self::solana::decoder_solana_core_unsupported_result;
+pub(crate) use self::solana::decoder_solana_core_vote_coverage;
+pub(crate) use self::solana::decoder_solana_core_vote_decode;
+pub(crate) use self::solana::decoder_solana_core_vote_recognize;
+pub(crate) use self::solana::decoder_solana_core_zk_elgamal_coverage;
+pub(crate) use self::solana::decoder_solana_core_zk_elgamal_decode;
+pub(crate) use self::solana::decoder_solana_core_zk_elgamal_recognize;
+pub(crate) use self::solana::decoder_solana_core_zk_token_proof_coverage;
+pub(crate) use self::solana::decoder_solana_core_zk_token_proof_decode;
+pub(crate) use self::solana::decoder_solana_core_zk_token_proof_recognize;
/// Current stable Associated Token Account decoded event contract version.
-pub(crate) use self::spl::SPL_ASSOCIATED_TOKEN_ACCOUNT_EVENT_VERSION;
+pub(crate) use self::spl::DC_SPL_ATA_EVENT_VERSION;
/// Exact Associated Token Account instructions published by the official interface.
-pub(crate) use self::spl::SPL_ASSOCIATED_TOKEN_ACCOUNT_INSTRUCTION_ENTRIES;
+pub(crate) use self::spl::DC_SPL_ATA_INSTRUCTION_ENTRIES;
/// Maximum retained account-key text length for the Associated Token Account decoder.
-pub(crate) use self::spl::SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_ACCOUNT_KEY_BYTES;
+pub(crate) use self::spl::DC_SPL_ATA_MAX_ACCOUNT_KEY_BYTES;
/// Maximum retained instruction account count for the Associated Token Account decoder.
-pub(crate) use self::spl::SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_ACCOUNTS;
+pub(crate) use self::spl::DC_SPL_ATA_MAX_ACCOUNTS;
/// Maximum retained semantic diagnostic count for the Associated Token Account decoder.
-pub(crate) use self::spl::SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_DIAGNOSTICS;
+pub(crate) use self::spl::DC_SPL_ATA_MAX_DIAGNOSTICS;
/// Maximum retained Associated Token Account instruction payload size.
-pub(crate) use self::spl::SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_INSTRUCTION_BYTES;
+pub(crate) use self::spl::DC_SPL_ATA_MAX_INSTRUCTION_BYTES;
/// Maximum retained transaction account-key count for the Associated Token Account decoder.
-pub(crate) use self::spl::SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_TRANSACTION_KEYS;
+pub(crate) use self::spl::DC_SPL_ATA_MAX_TRANSACTION_KEYS;
/// Stable protocol and surface code for the Associated Token Account program.
-pub(crate) use self::spl::SPL_ASSOCIATED_TOKEN_ACCOUNT_SURFACE_CODE;
+pub(crate) use self::spl::DC_SPL_ATA_SURFACE_CODE;
/// Canonical tracing target for the Associated Token Account decoder.
-pub(crate) use self::spl::SPL_ASSOCIATED_TOKEN_ACCOUNT_TRACING_TARGET;
+pub(crate) use self::spl::DC_SPL_ATA_TRACING_TARGET;
/// Current stable SPL ElGamal registry event contract version.
-pub(crate) use self::spl::SPL_ELGAMAL_REGISTRY_EVENT_VERSION;
+pub(crate) use self::spl::DC_SPL_ELGAMAL_REGISTRY_EVENT_VERSION;
/// Maximum retained SPL ElGamal registry instruction payload size.
-pub(crate) use self::spl::SPL_ELGAMAL_REGISTRY_MAX_INSTRUCTION_BYTES;
+pub(crate) use self::spl::DC_SPL_ELGAMAL_REGISTRY_MAX_INSTRUCTION_BYTES;
/// Stable SPL ElGamal registry surface code.
-pub(crate) use self::spl::SPL_ELGAMAL_REGISTRY_SURFACE_CODE;
+pub(crate) use self::spl::DC_SPL_ELGAMAL_REGISTRY_SURFACE_CODE;
/// Canonical tracing target for the SPL ElGamal registry decoder.
-pub(crate) use self::spl::SPL_ELGAMAL_REGISTRY_TRACING_TARGET;
+pub(crate) use self::spl::DC_SPL_ELGAMAL_REGISTRY_TRACING_TARGET;
/// Maximum payload prefix retained for bounded diagnostics.
-pub(crate) use self::spl::SPL_MEMO_DIAGNOSTIC_PREFIX_BYTES;
+pub(crate) use self::spl::DC_SPL_MEMO_DIAGNOSTIC_PREFIX_BYTES;
/// Current stable Memo decoded event contract version.
-pub(crate) use self::spl::SPL_MEMO_EVENT_VERSION;
+pub(crate) use self::spl::DC_SPL_MEMO_EVENT_VERSION;
/// Maximum decoded instruction data retained as a complete Memo payload.
-pub(crate) use self::spl::SPL_MEMO_MAX_PAYLOAD_BYTES;
+pub(crate) use self::spl::DC_SPL_MEMO_MAX_PAYLOAD_BYTES;
/// Stable protocol code shared by Memo generations.
-pub(crate) use self::spl::SPL_MEMO_PROTOCOL_CODE;
+pub(crate) use self::spl::DC_SPL_MEMO_PROTOCOL_CODE;
/// Canonical tracing target for the SPL Memo decoder.
-pub(crate) use self::spl::SPL_MEMO_TRACING_TARGET;
+pub(crate) use self::spl::DC_SPL_MEMO_TRACING_TARGET;
/// Stable Memo v1 surface code.
-pub(crate) use self::spl::SPL_MEMO_V1_SURFACE_CODE;
+pub(crate) use self::spl::DC_SPL_MEMO_V1_SURFACE_CODE;
/// Stable Memo v3 surface code.
-pub(crate) use self::spl::SPL_MEMO_V3_SURFACE_CODE;
+pub(crate) use self::spl::DC_SPL_MEMO_V3_SURFACE_CODE;
/// Stable Memo v4 surface code.
-pub(crate) use self::spl::SPL_MEMO_V4_SURFACE_CODE;
-/// Maximum prefix retained in bounded Token-2022 diagnostics.
-pub(crate) use self::spl::SPL_TOKEN_2022_DIAGNOSTIC_PREFIX_BYTES;
-/// Current stable Token-2022 decoded event contract version.
-pub(crate) use self::spl::SPL_TOKEN_2022_EVENT_VERSION;
-/// Exact top-level instruction inventory published by the resolved Token-2022 interface.
-pub(crate) use self::spl::SPL_TOKEN_2022_INSTRUCTION_ENTRIES;
-/// Maximum total account metas consumed by one Token-2022 batch.
-pub(crate) use self::spl::SPL_TOKEN_2022_MAX_BATCH_ACCOUNTS;
-/// Maximum decoded sub-instructions in one Token-2022 batch.
-pub(crate) use self::spl::SPL_TOKEN_2022_MAX_BATCH_INSTRUCTIONS;
-/// Maximum retained Token-2022 instruction payload size.
-pub(crate) use self::spl::SPL_TOKEN_2022_MAX_INSTRUCTION_BYTES;
-/// Maximum retained UTF-8 string size for embedded Token Metadata instructions.
-pub(crate) use self::spl::SPL_TOKEN_2022_MAX_METADATA_STRING_BYTES;
-/// Stable Token-2022 surface code.
-pub(crate) use self::spl::SPL_TOKEN_2022_SURFACE_CODE;
-/// Canonical tracing target for the Token-2022 decoder.
-pub(crate) use self::spl::SPL_TOKEN_2022_TRACING_TARGET;
+pub(crate) use self::spl::DC_SPL_MEMO_V4_SURFACE_CODE;
/// Maximum prefix retained in bounded classic SPL Token diagnostics.
-pub(crate) use self::spl::SPL_TOKEN_DIAGNOSTIC_PREFIX_BYTES;
+pub(crate) use self::spl::DC_SPL_TOKEN_DIAGNOSTIC_PREFIX_BYTES;
/// Current stable classic SPL Token decoded event contract version.
-pub(crate) use self::spl::SPL_TOKEN_EVENT_VERSION;
+pub(crate) use self::spl::DC_SPL_TOKEN_EVENT_VERSION;
/// One exact classic SPL Token instruction entry published by the official interface.
-pub(crate) use self::spl::SPL_TOKEN_INSTRUCTION_ENTRIES;
+pub(crate) use self::spl::DC_SPL_TOKEN_INSTRUCTION_ENTRIES;
/// Maximum total account metas consumed by one classic SPL Token batch.
-pub(crate) use self::spl::SPL_TOKEN_MAX_BATCH_ACCOUNTS;
+pub(crate) use self::spl::DC_SPL_TOKEN_MAX_BATCH_ACCOUNTS;
/// Maximum decoded sub-instructions in one classic SPL Token batch.
-pub(crate) use self::spl::SPL_TOKEN_MAX_BATCH_INSTRUCTIONS;
+pub(crate) use self::spl::DC_SPL_TOKEN_MAX_BATCH_INSTRUCTIONS;
/// Maximum retained classic SPL Token instruction payload size.
-pub(crate) use self::spl::SPL_TOKEN_MAX_INSTRUCTION_BYTES;
+pub(crate) use self::spl::DC_SPL_TOKEN_MAX_INSTRUCTION_BYTES;
/// Stable protocol and surface code for the classic SPL Token program.
-pub(crate) use self::spl::SPL_TOKEN_SURFACE_CODE;
+pub(crate) use self::spl::DC_SPL_TOKEN_SURFACE_CODE;
/// Canonical tracing target for the classic SPL Token decoder.
-pub(crate) use self::spl::SPL_TOKEN_TRACING_TARGET;
+pub(crate) use self::spl::DC_SPL_TOKEN_TRACING_TARGET;
+/// Maximum prefix retained in bounded Token-2022 diagnostics.
+pub(crate) use self::spl::DC_SPL_TOKEN2022_DIAGNOSTIC_PREFIX_BYTES;
+/// Current stable Token-2022 decoded event contract version.
+pub(crate) use self::spl::DC_SPL_TOKEN2022_EVENT_VERSION;
+/// Exact top-level instruction inventory published by the resolved Token-2022 interface.
+pub(crate) use self::spl::DC_SPL_TOKEN2022_INSTRUCTION_ENTRIES;
+/// Maximum total account metas consumed by one Token-2022 batch.
+pub(crate) use self::spl::DC_SPL_TOKEN2022_MAX_BATCH_ACCOUNTS;
+/// Maximum decoded sub-instructions in one Token-2022 batch.
+pub(crate) use self::spl::DC_SPL_TOKEN2022_MAX_BATCH_INSTRUCTIONS;
+/// Maximum retained Token-2022 instruction payload size.
+pub(crate) use self::spl::DC_SPL_TOKEN2022_MAX_INSTRUCTION_BYTES;
+/// Maximum retained UTF-8 string size for embedded Token Metadata instructions.
+pub(crate) use self::spl::DC_SPL_TOKEN2022_MAX_METADATA_STRING_BYTES;
+/// Stable Token-2022 surface code.
+pub(crate) use self::spl::DC_SPL_TOKEN2022_SURFACE_CODE;
+/// Canonical tracing target for the Token-2022 decoder.
+pub(crate) use self::spl::DC_SPL_TOKEN2022_TRACING_TARGET;
+/// One parsed SPL ElGamal registry instruction.
+pub(crate) use self::spl::DcSplElGamalRegistryParsedRegistryInstruction;
/// Decodes one bounded Associated Token Account instruction.
-pub(crate) use self::spl::spl_associated_token_account_decode;
+pub(crate) use self::spl::decoder_spl_associated_token_account_decode;
/// Returns the exact entry matching an Associated Token Account wire.
-pub(crate) use self::spl::spl_associated_token_account_entry;
+pub(crate) use self::spl::decoder_spl_associated_token_account_entry;
/// Reads one bounded Associated Token Account payload.
-pub(crate) use self::spl::spl_associated_token_account_payload;
+pub(crate) use self::spl::decoder_spl_associated_token_account_payload;
/// Decodes one bounded SPL ElGamal registry instruction.
-pub(crate) use self::spl::spl_elgamal_registry_decode;
+pub(crate) use self::spl::decoder_spl_elgamal_registry_decode;
/// Decodes one bounded SPL ElGamal registry instruction payload.
-pub(crate) use self::spl::spl_elgamal_registry_decode_payload;
+pub(crate) use self::spl::decoder_spl_elgamal_registry_decode_payload;
/// Parses one exact SPL ElGamal registry instruction.
-pub(crate) use self::spl::spl_elgamal_registry_parse;
+pub(crate) use self::spl::decoder_spl_elgamal_registry_parse;
/// Decodes one bounded SPL Memo instruction.
-pub(crate) use self::spl::spl_memo_decode;
-/// Decodes one bounded Token-2022 instruction.
-pub(crate) use self::spl::spl_token_2022_decode;
-/// Returns the exact entry matching one Token-2022 tag.
-pub(crate) use self::spl::spl_token_2022_entry_for_tag;
-/// Returns the first byte of one retained Token-2022 payload.
-pub(crate) use self::spl::spl_token_2022_payload_tag;
+pub(crate) use self::spl::decoder_spl_memo_decode;
/// Decodes one bounded classic SPL Token instruction.
-pub(crate) use self::spl::spl_token_decode;
+pub(crate) use self::spl::decoder_spl_token_decode;
/// Returns the published entry matching one classic SPL Token tag.
-pub(crate) use self::spl::spl_token_entry_for_tag;
+pub(crate) use self::spl::decoder_spl_token_entry_for_tag;
/// Returns the first byte of one retained classic SPL Token payload.
-pub(crate) use self::spl::spl_token_payload_tag;
+pub(crate) use self::spl::decoder_spl_token_payload_tag;
+/// Decodes one bounded Token-2022 instruction.
+pub(crate) use self::spl::decoder_spl_token2022_decode;
+/// Returns the exact entry matching one Token-2022 tag.
+pub(crate) use self::spl::decoder_spl_token2022_entry_for_tag;
+/// Returns the first byte of one retained Token-2022 payload.
+pub(crate) use self::spl::decoder_spl_token2022_payload_tag;
+/// Current contextual core instruction input contract version.
+pub use self::api::DC_API_CORE_INSTRUCTION_INPUT_CONTRACT_VERSION;
+/// Stable contextual decoded observation.
+pub use self::api::DcApiDecodedObservation;
+/// Machine-readable decoder coverage declaration.
+pub use self::api::DcApiDecoderCoverageDeclaration;
+/// Declared decoder coverage entry kind.
+pub use self::api::DcApiDecoderCoverageEntryKind;
+/// Structured decoder diagnostic.
+pub use self::api::DcApiDecoderDiagnostic;
+/// Complete decoder execution result.
+pub use self::api::DcApiDecoderExecutionResult;
+/// Stable decoder identity.
+pub use self::api::DcApiDecoderIdentity;
+/// Decoder terminal result status.
+pub use self::api::DcApiDecoderOutcomeStatus;
+/// Explicit decoding proof.
+pub use self::api::DcApiDecoderProof;
+/// Decoding proof category.
+pub use self::api::DcApiDecoderProofKind;
+/// Deterministic decoder recognition result.
+pub use self::api::DcApiDecoderRecognition;
+/// Exposes the decoder support level.
+pub use self::api::DcApiDecoderSupport;
+/// One statically declared decoder surface.
+pub use self::api::DcApiDecoderSurface;
+/// Initial decoder implementation placeholder for API-level tests.
+pub use self::api::DcApiInitialDecoder;
+/// Contextual instruction decoder contract.
+pub use self::api::DcApiInstructionDecoder;
+/// Exposes the common protocol decoder trait.
+pub use self::api::DcApiProtocolDecoder;
+/// Computes the deterministic contextual input hash.
+pub use self::api::decoder_api_decoder_api_contextual_input_hash;
+/// Returns true when a decoder declares the exact program id.
+pub use self::api::decoder_api_decoder_handles_program_id;
+/// Computes a deterministic lowercase SHA-256 hash for one JSON value.
+pub use self::api::decoder_api_deterministic_json_hash;
+/// Extracts the first eight payload bytes as hexadecimal when available.
+pub use self::api::decoder_api_discriminator_8_hex;
+/// Exhaustive published Metaplex account-key inventory.
+pub use self::metadata::DC_METADATA_MTM_METADATA_ACCOUNT_LAYOUT_AUDIT;
/// Exact decoder for the Metaplex Token Metadata program.
-pub use self::metadata::MetadataMetaplexTokenMetadataDecoder;
+pub use self::metadata::DcMetadataMetaplexTokenMetadataDecoder;
+/// Canonical projection shared by Collection and Use Authority records.
+pub use self::metadata::DcMetadataMtmAuthorityRecordAccountSnapshot;
+/// Stable identity and policy of one canonical account snapshot.
+pub use self::metadata::DcMetadataMtmCanonicalAccountIdentity;
+/// Lifecycle class of one canonical account layout.
+pub use self::metadata::DcMetadataMtmCanonicalAccountLifecycle;
+/// Provenance retained for one canonical account observation.
+pub use self::metadata::DcMetadataMtmCanonicalAccountProvenance;
+/// Execution policy separated from historical materialization.
+pub use self::metadata::DcMetadataMtmCanonicalExecutionPolicy;
+/// Materialization policy for active or historical state.
+pub use self::metadata::DcMetadataMtmCanonicalMaterializationPolicy;
+/// Canonical account envelope used by materializers and replay.
+pub use self::metadata::DcMetadataMtmCanonicalMetadataAccountSnapshot;
+/// Typed canonical Metaplex account state.
+pub use self::metadata::DcMetadataMtmCanonicalMetadataAccountState;
+/// Origin of one canonical account observation.
+pub use self::metadata::DcMetadataMtmCanonicalObservationSource;
+/// Canonical projection shared by Metadata and Holder delegate records.
+pub use self::metadata::DcMetadataMtmDelegateRecordAccountSnapshot;
+/// Supported edition account layout.
+pub use self::metadata::DcMetadataMtmEditionAccountKind;
+/// Canonical bounded projection of one edition or master-edition account.
+pub use self::metadata::DcMetadataMtmEditionAccountSnapshot;
+/// Supported Edition Marker account layout.
+pub use self::metadata::DcMetadataMtmEditionMarkerAccountKind;
+/// Canonical bounded projection of one Edition Marker account.
+pub use self::metadata::DcMetadataMtmEditionMarkerAccountSnapshot;
+/// Bounded error returned while decoding a Metadata account.
+pub use self::metadata::DcMetadataMtmMetadataAccountDecodeError;
+/// One entry in the exhaustive published account-key audit.
+pub use self::metadata::DcMetadataMtmMetadataAccountLayoutAuditEntry;
+/// Canonical bounded projection of one Metadata account.
+pub use self::metadata::DcMetadataMtmMetadataAccountSnapshot;
+/// One bounded historical reservation entry.
+pub use self::metadata::DcMetadataMtmReservationEntrySnapshot;
+/// Historical Reservation List account generation.
+pub use self::metadata::DcMetadataMtmReservationListAccountKind;
+/// Canonical decode-only projection of a historical Reservation List account.
+pub use self::metadata::DcMetadataMtmReservationListAccountSnapshot;
+/// Canonical projection of one Token Owned Escrow account.
+pub use self::metadata::DcMetadataMtmTokenOwnedEscrowAccountSnapshot;
+/// Authority form used by one Token Owned Escrow account.
+pub use self::metadata::DcMetadataMtmTokenOwnedEscrowAuthorityKind;
+/// Canonical bounded projection of one programmable Token Record account.
+pub use self::metadata::DcMetadataMtmTokenRecordAccountSnapshot;
+/// Decodes one Collection Authority Record account.
+pub use self::metadata::decoder_metadata_metaplex_token_metadata_decode_collection_authority_record_account;
+/// Decodes and validates one edition or master-edition account snapshot.
+pub use self::metadata::decoder_metadata_metaplex_token_metadata_decode_edition_account;
+/// Decodes and validates one Edition Marker account snapshot.
+pub use self::metadata::decoder_metadata_metaplex_token_metadata_decode_edition_marker_account;
+/// Decodes one Holder Delegate Record account.
+pub use self::metadata::decoder_metadata_metaplex_token_metadata_decode_holder_delegate_record_account;
+/// Decodes and validates one canonical Metadata account snapshot.
+pub use self::metadata::decoder_metadata_metaplex_token_metadata_decode_metadata_account;
+/// Decodes one Metadata Delegate Record account.
+pub use self::metadata::decoder_metadata_metaplex_token_metadata_decode_metadata_delegate_record_account;
+/// Decodes one historical Reservation List V1 or V2 account.
+pub use self::metadata::decoder_metadata_metaplex_token_metadata_decode_reservation_list_account;
+/// Decodes one Token Owned Escrow account.
+pub use self::metadata::decoder_metadata_metaplex_token_metadata_decode_token_owned_escrow_account;
+/// Decodes and validates one programmable Token Record account snapshot.
+pub use self::metadata::decoder_metadata_metaplex_token_metadata_decode_token_record_account;
+/// Decodes one Use Authority Record account.
+pub use self::metadata::decoder_metadata_metaplex_token_metadata_decode_use_authority_record_account;
+/// Runtime-native Solana decoder with phased maximal native coverage.
+pub use self::solana::DcSolanaCoreDecoder;
/// Exact byte length of one SPL ElGamal registry account.
-pub use self::spl::ELGAMAL_REGISTRY_ACCOUNT_LEN;
-/// Parsed SPL ElGamal public-key registry account.
-pub use self::spl::ElGamalRegistryState;
+pub use self::spl::DC_SPL_ELGAMAL_REGISTRY_ACCOUNT_LEN;
/// Exact decoder for the SPL Associated Token Account program.
-pub use self::spl::SplAssociatedTokenAccountDecoder;
+pub use self::spl::DcSplAssociatedTokenAccountDecoder;
+/// Parsed SPL ElGamal public-key registry account.
+pub use self::spl::DcSplElGamalRegistryState;
/// Exact decoder for the SPL ElGamal registry program.
-pub use self::spl::SplElgamalRegistryDecoder;
+pub use self::spl::DcSplElgamalRegistryDecoder;
/// Exact decoder for the three registered SPL Memo generations.
-pub use self::spl::SplMemoDecoder;
+pub use self::spl::DcSplMemoDecoder;
/// Exact decoder for the Token-2022 program.
-pub use self::spl::SplToken2022Decoder;
+pub use self::spl::DcSplToken2022Decoder;
/// Exact decoder for the classic SPL Token program.
-pub use self::spl::SplTokenDecoder;
+pub use self::spl::DcSplTokenDecoder;
/// Parsed Token-2022 Mint, Account, or Multisig state.
-pub use self::spl::Token2022State;
+pub use self::spl::DcToken2022State;
/// Exact Token-2022 base account state kind.
-pub use self::spl::Token2022StateKind;
+pub use self::spl::DcToken2022StateKind;
/// One exact Token-2022 TLV entry.
-pub use self::spl::Token2022TlvEntry;
+pub use self::spl::DcToken2022TlvEntry;
/// Parses one exact SPL ElGamal registry account.
-pub use self::spl::parse_elgamal_registry_state;
+pub use self::spl::decoder_spl_elgamal_registry_parse_elgamal_registry_state;
/// Parses one Token-2022 Mint, Account, or Multisig state.
-pub use self::spl::parse_token_2022_state;
+pub use self::spl::decoder_spl_token2022_parse_token2022_state;
diff --git a/kb-lib/src/decoder/adapter.rs b/kb-lib/src/decoder/adapter.rs
index ca70eed..f6d1336 100644
--- a/kb-lib/src/decoder/adapter.rs
+++ b/kb-lib/src/decoder/adapter.rs
@@ -3,4 +3,4 @@
//! `adapter` decoder family.
-pub mod saber_decimal_wrapper;
+mod saber_decimal_wrapper;
diff --git a/kb-lib/src/decoder/adapter/saber_decimal_wrapper.rs b/kb-lib/src/decoder/adapter/saber_decimal_wrapper.rs
index 00d06f4..348f001 100644
--- a/kb-lib/src/decoder/adapter/saber_decimal_wrapper.rs
+++ b/kb-lib/src/decoder/adapter/saber_decimal_wrapper.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_adapter_saber_decimal_wrapper`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_adapter_saber_decimal_wrapper";
+const LEGACY_CRATE: &str = "kb_decoder_adapter_saber_decimal_wrapper";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/admin.rs b/kb-lib/src/decoder/admin.rs
index 9ccca03..671be3c 100644
--- a/kb-lib/src/decoder/admin.rs
+++ b/kb-lib/src/decoder/admin.rs
@@ -3,5 +3,5 @@
//! `admin` decoder family.
-pub mod jupiter_lock;
-pub mod pump_fees;
+mod jupiter_lock;
+mod pump_fees;
diff --git a/kb-lib/src/decoder/admin/jupiter_lock.rs b/kb-lib/src/decoder/admin/jupiter_lock.rs
index 8895fbf..1364b72 100644
--- a/kb-lib/src/decoder/admin/jupiter_lock.rs
+++ b/kb-lib/src/decoder/admin/jupiter_lock.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_admin_jupiter_lock`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_admin_jupiter_lock";
+const LEGACY_CRATE: &str = "kb_decoder_admin_jupiter_lock";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/admin/pump_fees.rs b/kb-lib/src/decoder/admin/pump_fees.rs
index da344e1..c94c4cb 100644
--- a/kb-lib/src/decoder/admin/pump_fees.rs
+++ b/kb-lib/src/decoder/admin/pump_fees.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_admin_pump_fees`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_admin_pump_fees";
+const LEGACY_CRATE: &str = "kb_decoder_admin_pump_fees";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm.rs b/kb-lib/src/decoder/amm.rs
index 74d2d79..9560350 100644
--- a/kb-lib/src/decoder/amm.rs
+++ b/kb-lib/src/decoder/amm.rs
@@ -3,29 +3,29 @@
//! `amm` decoder family.
-pub mod aldrin_v1;
-pub mod aldrin_v2;
-pub mod alphaq;
-pub mod believe;
-pub mod bonk_swap;
-pub mod fluxbeam;
-pub mod goon_fi;
-pub mod goosefx_gamma;
-pub mod goosefx_v2;
-pub mod guac_swap;
-pub mod lifinity_swap_v2;
-pub mod metadao_futarchy_amm;
-pub mod metadao_v0_5;
-pub mod meteora_damm_v1;
-pub mod meteora_damm_v2;
-pub mod obric_v2;
-pub mod one_dex;
-pub mod pump_swap;
-pub mod raydium_lp_v4;
-pub mod solfi;
-pub mod solfi_v2;
-pub mod vertigo;
-pub mod virtuals;
-pub mod woofi;
-pub mod zero_fi;
-pub mod zora;
+mod aldrin_v1;
+mod aldrin_v2;
+mod alphaq;
+mod believe;
+mod bonk_swap;
+mod fluxbeam;
+mod goon_fi;
+mod goosefx_gamma;
+mod goosefx_v2;
+mod guac_swap;
+mod lifinity_swap_v2;
+mod metadao_futarchy_amm;
+mod metadao_v0_5;
+mod meteora_damm_v1;
+mod meteora_damm_v2;
+mod obric_v2;
+mod one_dex;
+mod pump_swap;
+mod raydium_lp_v4;
+mod solfi;
+mod solfi_v2;
+mod vertigo;
+mod virtuals;
+mod woofi;
+mod zero_fi;
+mod zora;
diff --git a/kb-lib/src/decoder/amm/aldrin_v1.rs b/kb-lib/src/decoder/amm/aldrin_v1.rs
index 35b6c97..c59f5da 100644
--- a/kb-lib/src/decoder/amm/aldrin_v1.rs
+++ b/kb-lib/src/decoder/amm/aldrin_v1.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_aldrin_v1`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_aldrin_v1";
+const LEGACY_CRATE: &str = "kb_decoder_amm_aldrin_v1";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/aldrin_v2.rs b/kb-lib/src/decoder/amm/aldrin_v2.rs
index da05b00..c9f848b 100644
--- a/kb-lib/src/decoder/amm/aldrin_v2.rs
+++ b/kb-lib/src/decoder/amm/aldrin_v2.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_aldrin_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_aldrin_v2";
+const LEGACY_CRATE: &str = "kb_decoder_amm_aldrin_v2";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/alphaq.rs b/kb-lib/src/decoder/amm/alphaq.rs
index 3be8b6f..6dda808 100644
--- a/kb-lib/src/decoder/amm/alphaq.rs
+++ b/kb-lib/src/decoder/amm/alphaq.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_alphaq`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_alphaq";
+const LEGACY_CRATE: &str = "kb_decoder_amm_alphaq";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/believe.rs b/kb-lib/src/decoder/amm/believe.rs
index 4f0aef3..9681f27 100644
--- a/kb-lib/src/decoder/amm/believe.rs
+++ b/kb-lib/src/decoder/amm/believe.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_believe`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_believe";
+const LEGACY_CRATE: &str = "kb_decoder_amm_believe";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/bonk_swap.rs b/kb-lib/src/decoder/amm/bonk_swap.rs
index 73cd749..2411554 100644
--- a/kb-lib/src/decoder/amm/bonk_swap.rs
+++ b/kb-lib/src/decoder/amm/bonk_swap.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_bonk_swap`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_bonk_swap";
+const LEGACY_CRATE: &str = "kb_decoder_amm_bonk_swap";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/fluxbeam.rs b/kb-lib/src/decoder/amm/fluxbeam.rs
index c9e1561..14bd937 100644
--- a/kb-lib/src/decoder/amm/fluxbeam.rs
+++ b/kb-lib/src/decoder/amm/fluxbeam.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_fluxbeam`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_fluxbeam";
+const LEGACY_CRATE: &str = "kb_decoder_amm_fluxbeam";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/goon_fi.rs b/kb-lib/src/decoder/amm/goon_fi.rs
index de23f47..c1b3d05 100644
--- a/kb-lib/src/decoder/amm/goon_fi.rs
+++ b/kb-lib/src/decoder/amm/goon_fi.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_goon_fi`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_goon_fi";
+const LEGACY_CRATE: &str = "kb_decoder_amm_goon_fi";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/goosefx_gamma.rs b/kb-lib/src/decoder/amm/goosefx_gamma.rs
index deee864..a6d4dc0 100644
--- a/kb-lib/src/decoder/amm/goosefx_gamma.rs
+++ b/kb-lib/src/decoder/amm/goosefx_gamma.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_goosefx_gamma`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_goosefx_gamma";
+const LEGACY_CRATE: &str = "kb_decoder_amm_goosefx_gamma";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/goosefx_v2.rs b/kb-lib/src/decoder/amm/goosefx_v2.rs
index caf2c50..436909b 100644
--- a/kb-lib/src/decoder/amm/goosefx_v2.rs
+++ b/kb-lib/src/decoder/amm/goosefx_v2.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_goosefx_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_goosefx_v2";
+const LEGACY_CRATE: &str = "kb_decoder_amm_goosefx_v2";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/guac_swap.rs b/kb-lib/src/decoder/amm/guac_swap.rs
index e312008..f5766ea 100644
--- a/kb-lib/src/decoder/amm/guac_swap.rs
+++ b/kb-lib/src/decoder/amm/guac_swap.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_guac_swap`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_guac_swap";
+const LEGACY_CRATE: &str = "kb_decoder_amm_guac_swap";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/lifinity_swap_v2.rs b/kb-lib/src/decoder/amm/lifinity_swap_v2.rs
index 938cfe8..229c16c 100644
--- a/kb-lib/src/decoder/amm/lifinity_swap_v2.rs
+++ b/kb-lib/src/decoder/amm/lifinity_swap_v2.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_lifinity_swap_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_lifinity_swap_v2";
+const LEGACY_CRATE: &str = "kb_decoder_amm_lifinity_swap_v2";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/metadao_futarchy_amm.rs b/kb-lib/src/decoder/amm/metadao_futarchy_amm.rs
index b859227..ae60d50 100644
--- a/kb-lib/src/decoder/amm/metadao_futarchy_amm.rs
+++ b/kb-lib/src/decoder/amm/metadao_futarchy_amm.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_metadao_futarchy_amm`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_metadao_futarchy_amm";
+const LEGACY_CRATE: &str = "kb_decoder_amm_metadao_futarchy_amm";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/metadao_v0_5.rs b/kb-lib/src/decoder/amm/metadao_v0_5.rs
index f1e0619..d45301b 100644
--- a/kb-lib/src/decoder/amm/metadao_v0_5.rs
+++ b/kb-lib/src/decoder/amm/metadao_v0_5.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_metadao_v0_5`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_metadao_v0_5";
+const LEGACY_CRATE: &str = "kb_decoder_amm_metadao_v0_5";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/meteora_damm_v1.rs b/kb-lib/src/decoder/amm/meteora_damm_v1.rs
index 97a5f68..ed3e442 100644
--- a/kb-lib/src/decoder/amm/meteora_damm_v1.rs
+++ b/kb-lib/src/decoder/amm/meteora_damm_v1.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_meteora_damm_v1`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_meteora_damm_v1";
+const LEGACY_CRATE: &str = "kb_decoder_amm_meteora_damm_v1";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/meteora_damm_v2.rs b/kb-lib/src/decoder/amm/meteora_damm_v2.rs
index a451730..e2f5a78 100644
--- a/kb-lib/src/decoder/amm/meteora_damm_v2.rs
+++ b/kb-lib/src/decoder/amm/meteora_damm_v2.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_meteora_damm_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_meteora_damm_v2";
+const LEGACY_CRATE: &str = "kb_decoder_amm_meteora_damm_v2";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/obric_v2.rs b/kb-lib/src/decoder/amm/obric_v2.rs
index 6af2996..1019ce1 100644
--- a/kb-lib/src/decoder/amm/obric_v2.rs
+++ b/kb-lib/src/decoder/amm/obric_v2.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_obric_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_obric_v2";
+const LEGACY_CRATE: &str = "kb_decoder_amm_obric_v2";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/one_dex.rs b/kb-lib/src/decoder/amm/one_dex.rs
index c1007a4..3d3033d 100644
--- a/kb-lib/src/decoder/amm/one_dex.rs
+++ b/kb-lib/src/decoder/amm/one_dex.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_one_dex`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_one_dex";
+const LEGACY_CRATE: &str = "kb_decoder_amm_one_dex";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/pump_swap.rs b/kb-lib/src/decoder/amm/pump_swap.rs
index a32b64c..79a7c8c 100644
--- a/kb-lib/src/decoder/amm/pump_swap.rs
+++ b/kb-lib/src/decoder/amm/pump_swap.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_pump_swap`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_pump_swap";
+const LEGACY_CRATE: &str = "kb_decoder_amm_pump_swap";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/raydium_lp_v4.rs b/kb-lib/src/decoder/amm/raydium_lp_v4.rs
index e0d50ee..7d7157f 100644
--- a/kb-lib/src/decoder/amm/raydium_lp_v4.rs
+++ b/kb-lib/src/decoder/amm/raydium_lp_v4.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_raydium_lp_v4`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_raydium_lp_v4";
+const LEGACY_CRATE: &str = "kb_decoder_amm_raydium_lp_v4";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/solfi.rs b/kb-lib/src/decoder/amm/solfi.rs
index 4e3fb65..4a5803b 100644
--- a/kb-lib/src/decoder/amm/solfi.rs
+++ b/kb-lib/src/decoder/amm/solfi.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_solfi`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_solfi";
+const LEGACY_CRATE: &str = "kb_decoder_amm_solfi";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/solfi_v2.rs b/kb-lib/src/decoder/amm/solfi_v2.rs
index 2901585..8469ecf 100644
--- a/kb-lib/src/decoder/amm/solfi_v2.rs
+++ b/kb-lib/src/decoder/amm/solfi_v2.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_solfi_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_solfi_v2";
+const LEGACY_CRATE: &str = "kb_decoder_amm_solfi_v2";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/vertigo.rs b/kb-lib/src/decoder/amm/vertigo.rs
index 20d79ab..03573d3 100644
--- a/kb-lib/src/decoder/amm/vertigo.rs
+++ b/kb-lib/src/decoder/amm/vertigo.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_vertigo`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_vertigo";
+const LEGACY_CRATE: &str = "kb_decoder_amm_vertigo";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/virtuals.rs b/kb-lib/src/decoder/amm/virtuals.rs
index f7515c0..c4085fa 100644
--- a/kb-lib/src/decoder/amm/virtuals.rs
+++ b/kb-lib/src/decoder/amm/virtuals.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_virtuals`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_virtuals";
+const LEGACY_CRATE: &str = "kb_decoder_amm_virtuals";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/woofi.rs b/kb-lib/src/decoder/amm/woofi.rs
index 2e31857..26f7cd3 100644
--- a/kb-lib/src/decoder/amm/woofi.rs
+++ b/kb-lib/src/decoder/amm/woofi.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_woofi`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_woofi";
+const LEGACY_CRATE: &str = "kb_decoder_amm_woofi";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/zero_fi.rs b/kb-lib/src/decoder/amm/zero_fi.rs
index 031e0c1..89dcde4 100644
--- a/kb-lib/src/decoder/amm/zero_fi.rs
+++ b/kb-lib/src/decoder/amm/zero_fi.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_zero_fi`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_zero_fi";
+const LEGACY_CRATE: &str = "kb_decoder_amm_zero_fi";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/amm/zora.rs b/kb-lib/src/decoder/amm/zora.rs
index a204a63..c70003e 100644
--- a/kb-lib/src/decoder/amm/zora.rs
+++ b/kb-lib/src/decoder/amm/zora.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_amm_zora`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_amm_zora";
+const LEGACY_CRATE: &str = "kb_decoder_amm_zora";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/anchor.rs b/kb-lib/src/decoder/anchor.rs
index e775a2c..2a52d7a 100644
--- a/kb-lib/src/decoder/anchor.rs
+++ b/kb-lib/src/decoder/anchor.rs
@@ -3,4 +3,4 @@
//! `anchor` decoder family.
-pub mod core;
+mod core;
diff --git a/kb-lib/src/decoder/anchor/core.rs b/kb-lib/src/decoder/anchor/core.rs
index 4c2eaaa..5f8aced 100644
--- a/kb-lib/src/decoder/anchor/core.rs
+++ b/kb-lib/src/decoder/anchor/core.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_anchor`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_anchor";
+const LEGACY_CRATE: &str = "kb_decoder_anchor";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/api.rs b/kb-lib/src/decoder/api.rs
index 0a95548..5553a24 100644
--- a/kb-lib/src/decoder/api.rs
+++ b/kb-lib/src/decoder/api.rs
@@ -3,45 +3,46 @@
//! Decoder contracts consolidated from `kb_decoder_api`.
-pub mod contracts;
-pub mod decoder;
+mod contracts;
+mod decoder;
+
/// Current contextual core instruction input contract version.
-pub use crate::decoder::api::contracts::CORE_INSTRUCTION_INPUT_CONTRACT_VERSION;
+pub use self::contracts::DC_API_CORE_INSTRUCTION_INPUT_CONTRACT_VERSION;
/// Stable contextual decoded observation.
-pub use crate::decoder::api::contracts::DecodedObservation;
+pub use self::contracts::DcApiDecodedObservation;
/// Machine-readable decoder coverage declaration.
-pub use crate::decoder::api::contracts::DecoderCoverageDeclaration;
+pub use self::contracts::DcApiDecoderCoverageDeclaration;
/// Declared decoder coverage entry kind.
-pub use crate::decoder::api::contracts::DecoderCoverageEntryKind;
+pub use self::contracts::DcApiDecoderCoverageEntryKind;
/// Structured decoder diagnostic.
-pub use crate::decoder::api::contracts::DecoderDiagnostic;
+pub use self::contracts::DcApiDecoderDiagnostic;
/// Complete decoder execution result.
-pub use crate::decoder::api::contracts::DecoderExecutionResult;
+pub use self::contracts::DcApiDecoderExecutionResult;
/// Stable decoder identity.
-pub use crate::decoder::api::contracts::DecoderIdentity;
+pub use self::contracts::DcApiDecoderIdentity;
/// Decoder terminal result status.
-pub use crate::decoder::api::contracts::DecoderOutcomeStatus;
+pub use self::contracts::DcApiDecoderOutcomeStatus;
/// Explicit decoding proof.
-pub use crate::decoder::api::contracts::DecoderProof;
+pub use self::contracts::DcApiDecoderProof;
/// Decoding proof category.
-pub use crate::decoder::api::contracts::DecoderProofKind;
+pub use self::contracts::DcApiDecoderProofKind;
/// Deterministic decoder recognition result.
-pub use crate::decoder::api::contracts::DecoderRecognition;
+pub use self::contracts::DcApiDecoderRecognition;
/// One statically declared decoder surface.
-pub use crate::decoder::api::contracts::DecoderSurface;
+pub use self::contracts::DcApiDecoderSurface;
/// Contextual instruction decoder contract.
-pub use crate::decoder::api::contracts::InstructionDecoder;
+pub use self::contracts::DcApiInstructionDecoder;
/// Computes the deterministic contextual input hash.
-pub use crate::decoder::api::contracts::contextual_input_hash;
+pub use self::contracts::decoder_api_decoder_api_contextual_input_hash;
/// Returns true when a decoder declares the exact program id.
-pub use crate::decoder::api::contracts::decoder_handles_program_id;
+pub use self::contracts::decoder_api_decoder_handles_program_id;
/// Computes a deterministic lowercase SHA-256 hash for one JSON value.
-pub use crate::decoder::api::contracts::deterministic_json_hash;
+pub use self::contracts::decoder_api_deterministic_json_hash;
/// Extracts the first eight payload bytes as hexadecimal when available.
-pub use crate::decoder::api::contracts::discriminator_8_hex;
+pub use self::contracts::decoder_api_discriminator_8_hex;
/// Exposes the decoder support level.
-pub use crate::decoder::api::decoder::DecoderSupport;
+pub use self::decoder::DcApiDecoderSupport;
/// Initial decoder implementation placeholder for API-level tests.
-pub use crate::decoder::api::decoder::InitialDecoder;
+pub use self::decoder::DcApiInitialDecoder;
/// Exposes the common protocol decoder trait.
-pub use crate::decoder::api::decoder::ProtocolDecoder;
+pub use self::decoder::DcApiProtocolDecoder;
diff --git a/kb-lib/src/decoder/api/contracts.rs b/kb-lib/src/decoder/api/contracts.rs
index b7d4fb0..7e31de3 100644
--- a/kb-lib/src/decoder/api/contracts.rs
+++ b/kb-lib/src/decoder/api/contracts.rs
@@ -6,18 +6,19 @@
use sha2::Digest; // rust-rules: trait-import
/// Current contextual core instruction input contract version.
-pub const CORE_INSTRUCTION_INPUT_CONTRACT_VERSION: u32 = crate::CORE_REPLAY_INPUT_CONTRACT_VERSION;
+pub const DC_API_CORE_INSTRUCTION_INPUT_CONTRACT_VERSION: u32 =
+ crate::MD_CORE_REPLAY_INPUT_CONTRACT_VERSION;
/// Stable identity of one contextual instruction decoder.
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
-pub struct DecoderIdentity {
+pub struct DcApiDecoderIdentity {
/// Stable lower snake case processor name.
pub name: std::string::String,
/// Semantic or deterministic implementation version.
pub version: std::string::String,
}
-impl DecoderIdentity {
+impl DcApiDecoderIdentity {
/// Builds a validated decoder identity.
pub fn new(
name: impl std::convert::Into,
@@ -38,7 +39,7 @@ impl DecoderIdentity {
/// One statically declared Solana surface supported by a decoder.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
-pub struct DecoderSurface {
+pub struct DcApiDecoderSurface {
/// Exact Solana program identifier.
pub program_id: &'static str,
/// Stable surface code.
@@ -49,7 +50,7 @@ pub struct DecoderSurface {
/// Declared decoder coverage entry kind.
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
-pub enum DecoderCoverageEntryKind {
+pub enum DcApiDecoderCoverageEntryKind {
/// Program instruction entry.
Instruction,
/// Program event entry.
@@ -60,13 +61,13 @@ pub enum DecoderCoverageEntryKind {
/// Machine-readable decoder coverage declaration.
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
-pub struct DecoderCoverageDeclaration {
+pub struct DcApiDecoderCoverageDeclaration {
/// Solana program identifier.
pub program_id: std::string::String,
/// Optional stable surface code.
pub surface_code: std::option::Option,
/// Entry kind.
- pub entry_kind: DecoderCoverageEntryKind,
+ pub entry_kind: DcApiDecoderCoverageEntryKind,
/// Stable instruction, event or discriminator code.
pub entry_code: std::string::String,
/// Optional normalized lowercase hexadecimal discriminator.
@@ -75,12 +76,12 @@ pub struct DecoderCoverageDeclaration {
pub historical: bool,
}
-impl DecoderCoverageDeclaration {
+impl DcApiDecoderCoverageDeclaration {
/// Builds a validated coverage declaration.
pub fn new(
program_id: impl std::convert::Into,
surface_code: std::option::Option,
- entry_kind: DecoderCoverageEntryKind,
+ entry_kind: DcApiDecoderCoverageEntryKind,
entry_code: impl std::convert::Into,
discriminator_hex: std::option::Option,
historical: bool,
@@ -122,7 +123,7 @@ impl DecoderCoverageDeclaration {
/// Deterministic recognition result used by dispatch.
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
-pub struct DecoderRecognition {
+pub struct DcApiDecoderRecognition {
/// Whether the decoder is compatible with the input.
pub compatible: bool,
/// Whether recognition is exact rather than program-only.
@@ -137,7 +138,7 @@ pub struct DecoderRecognition {
pub discriminator_hex: std::option::Option,
}
-impl DecoderRecognition {
+impl DcApiDecoderRecognition {
/// Builds a non-compatible recognition result.
pub fn incompatible() -> Self {
return Self {
@@ -171,7 +172,7 @@ impl DecoderRecognition {
/// Decoder terminal result status.
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
-pub enum DecoderOutcomeStatus {
+pub enum DcApiDecoderOutcomeStatus {
/// At least one stable decoded observation was produced.
Decoded,
/// The decoder intentionally ignored a recognized input.
@@ -184,7 +185,7 @@ pub enum DecoderOutcomeStatus {
/// Proof category attached to one decoded observation.
#[derive(Clone, Copy, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
-pub enum DecoderProofKind {
+pub enum DcApiDecoderProofKind {
/// Exact instruction discriminator match.
ExactDiscriminator,
/// Exact binary layout decode.
@@ -207,18 +208,18 @@ pub enum DecoderProofKind {
/// Explicit proof attached to one decoded observation.
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
-pub struct DecoderProof {
+pub struct DcApiDecoderProof {
/// Proof category.
- pub kind: DecoderProofKind,
+ pub kind: DcApiDecoderProofKind,
/// Decoder confidence.
- pub confidence: crate::DecoderConfidence,
+ pub confidence: crate::MdDecoderConfidence,
/// Stable evidence strings, hashes or classifier codes.
pub evidence: std::vec::Vec,
}
/// Structured decoder diagnostic without third-party error wrappers.
#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
-pub struct DecoderDiagnostic {
+pub struct DcApiDecoderDiagnostic {
/// Stable machine-readable diagnostic code.
pub code: std::string::String,
/// Human-readable diagnostic message.
@@ -227,7 +228,7 @@ pub struct DecoderDiagnostic {
pub retriable: bool,
}
-impl DecoderDiagnostic {
+impl DcApiDecoderDiagnostic {
/// Builds a validated decoder diagnostic.
pub fn new(
code: impl std::convert::Into,
@@ -250,11 +251,11 @@ impl DecoderDiagnostic {
/// Stable contextual decoded observation persisted by the decode pipeline.
#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
-pub struct DecodedObservation {
+pub struct DcApiDecodedObservation {
/// Stable processor-owned event key within one input.
pub event_key: std::string::String,
/// Shared typed protocol event identity.
- pub event: crate::DecodedProtocolEvent,
+ pub event: crate::MdDecodedProtocolEvent,
/// Typed event payload serialized as deterministic JSON.
pub payload_json: serde_json::Value,
/// Whether the source transaction failed on-chain.
@@ -264,10 +265,10 @@ pub struct DecodedObservation {
/// Whether the observed state mutation was committed on-chain.
pub observation_committed: bool,
/// Explicit decoding proof.
- pub proof: DecoderProof,
+ pub proof: DcApiDecoderProof,
}
-impl DecodedObservation {
+impl DcApiDecodedObservation {
/// Validates failed transaction commit semantics and stable identity fields.
pub fn validate(&self) -> kb_core::Result<()> {
if self.event_key.trim().is_empty() {
@@ -295,22 +296,22 @@ impl DecodedObservation {
/// Complete explicit result produced by one decoder invocation.
#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
-pub struct DecoderExecutionResult {
+pub struct DcApiDecoderExecutionResult {
/// Terminal decoder status.
- pub status: DecoderOutcomeStatus,
+ pub status: DcApiDecoderOutcomeStatus,
/// Optional recognized instruction or discriminator code.
pub recognized_entry_code: std::option::Option,
/// Decoded observations.
- pub observations: std::vec::Vec,
+ pub observations: std::vec::Vec,
/// Structured diagnostics.
- pub diagnostics: std::vec::Vec,
+ pub diagnostics: std::vec::Vec,
}
-impl DecoderExecutionResult {
+impl DcApiDecoderExecutionResult {
/// Builds an unsupported result with no false decoded observation.
pub fn unsupported(entry_code: std::option::Option) -> Self {
return Self {
- status: DecoderOutcomeStatus::Unsupported,
+ status: DcApiDecoderOutcomeStatus::Unsupported,
recognized_entry_code: entry_code,
observations: std::vec::Vec::new(),
diagnostics: std::vec::Vec::new(),
@@ -320,7 +321,7 @@ impl DecoderExecutionResult {
/// Builds an ignored result.
pub fn ignored(entry_code: std::option::Option) -> Self {
return Self {
- status: DecoderOutcomeStatus::Ignored,
+ status: DcApiDecoderOutcomeStatus::Ignored,
recognized_entry_code: entry_code,
observations: std::vec::Vec::new(),
diagnostics: std::vec::Vec::new(),
@@ -329,17 +330,17 @@ impl DecoderExecutionResult {
/// Validates status and observation consistency.
pub fn validate(&self) -> kb_core::Result<()> {
- if self.status == DecoderOutcomeStatus::Decoded && self.observations.is_empty() {
+ if self.status == DcApiDecoderOutcomeStatus::Decoded && self.observations.is_empty() {
return std::result::Result::Err(kb_core::Error::invalid_state(
"decoded status requires at least one observation",
));
}
- if self.status != DecoderOutcomeStatus::Decoded && !self.observations.is_empty() {
+ if self.status != DcApiDecoderOutcomeStatus::Decoded && !self.observations.is_empty() {
return std::result::Result::Err(kb_core::Error::invalid_state(
"non-decoded status must not contain observations",
));
}
- if self.status == DecoderOutcomeStatus::Failed && self.diagnostics.is_empty() {
+ if self.status == DcApiDecoderOutcomeStatus::Failed && self.diagnostics.is_empty() {
return std::result::Result::Err(kb_core::Error::invalid_state(
"failed decoder status requires at least one diagnostic",
));
@@ -355,21 +356,24 @@ impl DecoderExecutionResult {
}
/// Contextual instruction decoder contract used by the common pipeline.
-pub trait InstructionDecoder: std::marker::Send + std::marker::Sync {
+pub trait DcApiInstructionDecoder: std::marker::Send + std::marker::Sync {
/// Returns the stable decoder identity.
- fn identity(&self) -> DecoderIdentity;
+ fn identity(&self) -> DcApiDecoderIdentity;
/// Returns every exact Solana surface supported by the decoder.
- fn surfaces(&self) -> &'static [DecoderSurface];
+ fn surfaces(&self) -> &'static [DcApiDecoderSurface];
/// Returns the machine-readable declared coverage matrix.
- fn coverage(&self) -> std::vec::Vec;
+ fn coverage(&self) -> std::vec::Vec;
/// Recognizes one contextual core instruction for deterministic dispatch.
- fn recognize(&self, input: &crate::CoreInstructionReplayInput) -> DecoderRecognition;
+ fn recognize(&self, input: &crate::MdCoreInstructionReplayInput) -> DcApiDecoderRecognition;
/// Decodes one recognized contextual core instruction.
- fn decode(&self, input: &crate::CoreInstructionReplayInput) -> DecoderExecutionResult;
+ fn decode(&self, input: &crate::MdCoreInstructionReplayInput) -> DcApiDecoderExecutionResult;
}
/// Returns true when a decoder declares the exact program id.
-pub fn decoder_handles_program_id(decoder: &dyn InstructionDecoder, program_id: &str) -> bool {
+pub fn decoder_api_decoder_handles_program_id(
+ decoder: &dyn DcApiInstructionDecoder,
+ program_id: &str,
+) -> bool {
for surface in decoder.surfaces() {
if surface.program_id == program_id {
return true;
@@ -379,8 +383,8 @@ pub fn decoder_handles_program_id(decoder: &dyn InstructionDecoder, program_id:
}
/// Computes a deterministic lowercase SHA-256 hash for one contextual input.
-pub fn contextual_input_hash(
- input: &crate::CoreInstructionReplayInput,
+pub fn decoder_api_decoder_api_contextual_input_hash(
+ input: &crate::MdCoreInstructionReplayInput,
) -> kb_core::Result {
let serialization_result = serde_json::to_value(input);
let mut value = match serialization_result {
@@ -391,11 +395,11 @@ pub fn contextual_input_hash(
)));
},
};
- return crate::deterministic_json_hash(&mut value);
+ return crate::decoder_api_deterministic_json_hash(&mut value);
}
/// Computes a deterministic lowercase SHA-256 hash for one JSON value.
-pub fn deterministic_json_hash(
+pub fn decoder_api_deterministic_json_hash(
value: &mut serde_json::Value,
) -> kb_core::Result {
sort_json_value(value);
@@ -417,8 +421,8 @@ pub fn deterministic_json_hash(
}
/// Extracts the first eight payload bytes as normalized lowercase hexadecimal when available.
-pub fn discriminator_8_hex(
- input: &crate::CoreInstructionReplayInput,
+pub fn decoder_api_discriminator_8_hex(
+ input: &crate::MdCoreInstructionReplayInput,
) -> std::option::Option {
let payload = match &input.instruction_payload_json {
std::option::Option::Some(value) => value,
@@ -465,8 +469,8 @@ fn sort_json_value(value: &mut serde_json::Value) {
#[cfg(test)]
mod tests {
- fn replay_input() -> crate::CoreInstructionReplayInput {
- let result = crate::CoreInstructionReplayInput::new(
+ fn replay_input() -> crate::MdCoreInstructionReplayInput {
+ let result = crate::MdCoreInstructionReplayInput::new(
"signature:0",
"signature",
42,
@@ -497,8 +501,8 @@ mod tests {
#[test]
fn contextual_input_hash_is_stable() {
- let first = crate::contextual_input_hash(&replay_input());
- let second = crate::contextual_input_hash(&replay_input());
+ let first = crate::decoder_api_decoder_api_contextual_input_hash(&replay_input());
+ let second = crate::decoder_api_decoder_api_contextual_input_hash(&replay_input());
assert!(first.is_ok());
assert_eq!(first, second);
}
@@ -514,8 +518,8 @@ mod tests {
"payloadJson": {"dataBase64": "CAcGBQQDAgE="},
"payloadHash": "different-payload-hash"
}]);
- let first_hash = crate::contextual_input_hash(&first);
- let second_hash = crate::contextual_input_hash(&second);
+ let first_hash = crate::decoder_api_decoder_api_contextual_input_hash(&first);
+ let second_hash = crate::decoder_api_decoder_api_contextual_input_hash(&second);
assert!(first_hash.is_ok());
assert!(second_hash.is_ok());
assert_ne!(first_hash, second_hash);
@@ -538,26 +542,26 @@ mod tests {
#[test]
fn discriminator_uses_first_eight_bytes() {
- let value = crate::discriminator_8_hex(&replay_input());
+ let value = crate::decoder_api_discriminator_8_hex(&replay_input());
assert_eq!(value.as_deref(), std::option::Option::Some("0102030405060708"));
}
#[test]
fn failed_observation_cannot_be_committed() {
- let observation = crate::DecodedObservation {
+ let observation = crate::DcApiDecodedObservation {
event_key: "event".to_string(),
- event: crate::DecodedProtocolEvent {
- signature: crate::Signature("signature".to_string()),
- slot: crate::Slot(42),
- instruction_path: crate::InstructionPath("0".to_string()),
- program_id: crate::ProgramId("program".to_string()),
- protocol_code: crate::ProtocolCode("solana".to_string()),
- surface_code: crate::SurfaceCode("system_program".to_string()),
- event_code: crate::EventCode("system_program.attempt".to_string()),
- event_name: crate::EventName("attempt".to_string()),
- event_family: crate::EventFamily::Audit,
- source_kind: crate::EventSourceKind::Instruction,
- confidence: crate::DecoderConfidence::Exact,
+ event: crate::MdDecodedProtocolEvent {
+ signature: crate::MdSignature("signature".to_string()),
+ slot: crate::MdSlot(42),
+ instruction_path: crate::MdInstructionPath("0".to_string()),
+ program_id: crate::MdProgramId("program".to_string()),
+ protocol_code: crate::MdProtocolCode("solana".to_string()),
+ surface_code: crate::MdSurfaceCode("system_program".to_string()),
+ event_code: crate::MdEventCode("system_program.attempt".to_string()),
+ event_name: crate::MdEventName("attempt".to_string()),
+ event_family: crate::MdEventFamily::Audit,
+ source_kind: crate::MdEventSourceKind::Instruction,
+ confidence: crate::MdDecoderConfidence::Exact,
},
payload_json: serde_json::json!({}),
transaction_failed: true,
@@ -565,9 +569,9 @@ mod tests {
serde_json::json!({"InstructionError": [0, "Custom"]}),
),
observation_committed: true,
- proof: crate::DecoderProof {
- kind: crate::DecoderProofKind::ExactLayout,
- confidence: crate::DecoderConfidence::Exact,
+ proof: crate::DcApiDecoderProof {
+ kind: crate::DcApiDecoderProofKind::ExactLayout,
+ confidence: crate::MdDecoderConfidence::Exact,
evidence: std::vec!["layout".to_string()],
},
};
diff --git a/kb-lib/src/decoder/api/decoder.rs b/kb-lib/src/decoder/api/decoder.rs
index 85a1acf..ec4cbd6 100644
--- a/kb-lib/src/decoder/api/decoder.rs
+++ b/kb-lib/src/decoder/api/decoder.rs
@@ -5,7 +5,7 @@
/// Decoder support level for a program observation.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
-pub enum DecoderSupport {
+pub enum DcApiDecoderSupport {
/// The decoder does not support the observation.
No,
/// The decoder may support the observation after deeper inspection.
@@ -15,7 +15,7 @@ pub enum DecoderSupport {
}
/// Common trait implemented by every protocol decoder crate.
-pub trait ProtocolDecoder {
+pub trait DcApiProtocolDecoder {
/// Returns the stable decoder name.
fn decoder_name(&self) -> &'static str;
/// Returns the decoder implementation version.
@@ -23,7 +23,7 @@ pub trait ProtocolDecoder {
/// Returns the Solana program ids handled by this decoder.
fn program_ids(&self) -> &'static [&'static str];
/// Checks whether the decoder handles a program id.
- fn handles_program_id(&self, program_id: &crate::ProgramId) -> bool {
+ fn handles_program_id(&self, program_id: &crate::MdProgramId) -> bool {
for candidate in self.program_ids() {
if program_id.0.as_str() == *candidate {
return true;
@@ -32,19 +32,22 @@ pub trait ProtocolDecoder {
return false;
}
/// Checks whether the decoder supports a generic program observation.
- fn supports_observation(&self, observation: &crate::ProgramObservation) -> DecoderSupport;
+ fn supports_observation(
+ &self,
+ observation: &crate::MdProgramObservation,
+ ) -> DcApiDecoderSupport;
/// Decodes a generic program observation into protocol events.
fn decode_observation(
&self,
- observation: &crate::ProgramObservation,
- ) -> kb_core::Result>;
+ observation: &crate::MdProgramObservation,
+ ) -> kb_core::Result>;
}
/// Initial decoder implementation placeholder for API-level tests.
#[derive(Clone, Debug, Default)]
-pub struct InitialDecoder;
+pub struct DcApiInitialDecoder;
-impl ProtocolDecoder for InitialDecoder {
+impl DcApiProtocolDecoder for DcApiInitialDecoder {
fn decoder_name(&self) -> &'static str {
return "kb_decoder_api";
}
@@ -57,17 +60,20 @@ impl ProtocolDecoder for InitialDecoder {
return &[];
}
- fn supports_observation(&self, observation: &crate::ProgramObservation) -> DecoderSupport {
- if ProtocolDecoder::handles_program_id(self, &observation.program_id) {
- return DecoderSupport::Maybe;
+ fn supports_observation(
+ &self,
+ observation: &crate::MdProgramObservation,
+ ) -> DcApiDecoderSupport {
+ if DcApiProtocolDecoder::handles_program_id(self, &observation.program_id) {
+ return DcApiDecoderSupport::Maybe;
}
- return DecoderSupport::No;
+ return DcApiDecoderSupport::No;
}
fn decode_observation(
&self,
- _observation: &crate::ProgramObservation,
- ) -> kb_core::Result> {
+ _observation: &crate::MdProgramObservation,
+ ) -> kb_core::Result> {
return std::result::Result::Ok(std::vec::Vec::new());
}
}
diff --git a/kb-lib/src/decoder/bridge.rs b/kb-lib/src/decoder/bridge.rs
index 762d024..1d688ec 100644
--- a/kb-lib/src/decoder/bridge.rs
+++ b/kb-lib/src/decoder/bridge.rs
@@ -3,7 +3,7 @@
//! `bridge` decoder family.
-pub mod circle_cctp_token_messenger_minter;
-pub mod circle_cctp_token_messenger_minter_v2;
-pub mod layer_zero_endpoint;
-pub mod layer_zero_executor;
+mod circle_cctp_token_messenger_minter;
+mod circle_cctp_token_messenger_minter_v2;
+mod layer_zero_endpoint;
+mod layer_zero_executor;
diff --git a/kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter.rs b/kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter.rs
index 3bd5c51..6ac6abd 100644
--- a/kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter.rs
+++ b/kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_bridge_circle_cctp_token_messenger_minter`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_bridge_circle_cctp_token_messenger_minter";
+const LEGACY_CRATE: &str = "kb_decoder_bridge_circle_cctp_token_messenger_minter";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter_v2.rs b/kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter_v2.rs
index ad1880a..97ca630 100644
--- a/kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter_v2.rs
+++ b/kb-lib/src/decoder/bridge/circle_cctp_token_messenger_minter_v2.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_bridge_circle_cctp_token_messenger_minter_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_bridge_circle_cctp_token_messenger_minter_v2";
+const LEGACY_CRATE: &str = "kb_decoder_bridge_circle_cctp_token_messenger_minter_v2";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/bridge/layer_zero_endpoint.rs b/kb-lib/src/decoder/bridge/layer_zero_endpoint.rs
index 9482c28..1a2815b 100644
--- a/kb-lib/src/decoder/bridge/layer_zero_endpoint.rs
+++ b/kb-lib/src/decoder/bridge/layer_zero_endpoint.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_bridge_layer_zero_endpoint`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_bridge_layer_zero_endpoint";
+const LEGACY_CRATE: &str = "kb_decoder_bridge_layer_zero_endpoint";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/bridge/layer_zero_executor.rs b/kb-lib/src/decoder/bridge/layer_zero_executor.rs
index 16a1b6c..59c5f19 100644
--- a/kb-lib/src/decoder/bridge/layer_zero_executor.rs
+++ b/kb-lib/src/decoder/bridge/layer_zero_executor.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_bridge_layer_zero_executor`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_bridge_layer_zero_executor";
+const LEGACY_CRATE: &str = "kb_decoder_bridge_layer_zero_executor";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/clmm.rs b/kb-lib/src/decoder/clmm.rs
index e9c1013..3052e29 100644
--- a/kb-lib/src/decoder/clmm.rs
+++ b/kb-lib/src/decoder/clmm.rs
@@ -3,9 +3,9 @@
//! `clmm` decoder family.
-pub mod byreal;
-pub mod fusion;
-pub mod orca_whirlpool;
-pub mod pancake_swap;
-pub mod raydium;
-pub mod stabble;
+mod byreal;
+mod fusion;
+mod orca_whirlpool;
+mod pancake_swap;
+mod raydium;
+mod stabble;
diff --git a/kb-lib/src/decoder/clmm/byreal.rs b/kb-lib/src/decoder/clmm/byreal.rs
index fcf0022..efddb16 100644
--- a/kb-lib/src/decoder/clmm/byreal.rs
+++ b/kb-lib/src/decoder/clmm/byreal.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_clmm_byreal`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_clmm_byreal";
+const LEGACY_CRATE: &str = "kb_decoder_clmm_byreal";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/clmm/fusion.rs b/kb-lib/src/decoder/clmm/fusion.rs
index f0e0438..462ed4d 100644
--- a/kb-lib/src/decoder/clmm/fusion.rs
+++ b/kb-lib/src/decoder/clmm/fusion.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_clmm_fusion`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_clmm_fusion";
+const LEGACY_CRATE: &str = "kb_decoder_clmm_fusion";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/clmm/orca_whirlpool.rs b/kb-lib/src/decoder/clmm/orca_whirlpool.rs
index 52ee4e9..f883d91 100644
--- a/kb-lib/src/decoder/clmm/orca_whirlpool.rs
+++ b/kb-lib/src/decoder/clmm/orca_whirlpool.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_clmm_orca_whirlpool`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_clmm_orca_whirlpool";
+const LEGACY_CRATE: &str = "kb_decoder_clmm_orca_whirlpool";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/clmm/pancake_swap.rs b/kb-lib/src/decoder/clmm/pancake_swap.rs
index 1652ec2..e5b6747 100644
--- a/kb-lib/src/decoder/clmm/pancake_swap.rs
+++ b/kb-lib/src/decoder/clmm/pancake_swap.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_clmm_pancake_swap`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_clmm_pancake_swap";
+const LEGACY_CRATE: &str = "kb_decoder_clmm_pancake_swap";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/clmm/raydium.rs b/kb-lib/src/decoder/clmm/raydium.rs
index a5063e6..d430148 100644
--- a/kb-lib/src/decoder/clmm/raydium.rs
+++ b/kb-lib/src/decoder/clmm/raydium.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_clmm_raydium`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_clmm_raydium";
+const LEGACY_CRATE: &str = "kb_decoder_clmm_raydium";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/clmm/stabble.rs b/kb-lib/src/decoder/clmm/stabble.rs
index 3165488..35aaef1 100644
--- a/kb-lib/src/decoder/clmm/stabble.rs
+++ b/kb-lib/src/decoder/clmm/stabble.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_clmm_stabble`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_clmm_stabble";
+const LEGACY_CRATE: &str = "kb_decoder_clmm_stabble";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/cpmm.rs b/kb-lib/src/decoder/cpmm.rs
index 1210730..3895c9e 100644
--- a/kb-lib/src/decoder/cpmm.rs
+++ b/kb-lib/src/decoder/cpmm.rs
@@ -3,4 +3,4 @@
//! `cpmm` decoder family.
-pub mod raydium;
+mod raydium;
diff --git a/kb-lib/src/decoder/cpmm/raydium.rs b/kb-lib/src/decoder/cpmm/raydium.rs
index d8b4bc5..fe83f3c 100644
--- a/kb-lib/src/decoder/cpmm/raydium.rs
+++ b/kb-lib/src/decoder/cpmm/raydium.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_cpmm_raydium`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_cpmm_raydium";
+const LEGACY_CRATE: &str = "kb_decoder_cpmm_raydium";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/dlmm.rs b/kb-lib/src/decoder/dlmm.rs
index 5a5e9cf..b878ca3 100644
--- a/kb-lib/src/decoder/dlmm.rs
+++ b/kb-lib/src/decoder/dlmm.rs
@@ -3,4 +3,4 @@
//! `dlmm` decoder family.
-pub mod meteora;
+mod meteora;
diff --git a/kb-lib/src/decoder/dlmm/meteora.rs b/kb-lib/src/decoder/dlmm/meteora.rs
index e9f251c..73a2b50 100644
--- a/kb-lib/src/decoder/dlmm/meteora.rs
+++ b/kb-lib/src/decoder/dlmm/meteora.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_dlmm_meteora`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_dlmm_meteora";
+const LEGACY_CRATE: &str = "kb_decoder_dlmm_meteora";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/fees.rs b/kb-lib/src/decoder/fees.rs
index a095265..e99509e 100644
--- a/kb-lib/src/decoder/fees.rs
+++ b/kb-lib/src/decoder/fees.rs
@@ -3,5 +3,5 @@
//! `fees` decoder family.
-pub mod bags_fee_share_v1;
-pub mod bags_fee_share_v2;
+mod bags_fee_share_v1;
+mod bags_fee_share_v2;
diff --git a/kb-lib/src/decoder/fees/bags_fee_share_v1.rs b/kb-lib/src/decoder/fees/bags_fee_share_v1.rs
index 70ea157..8f1ab4f 100644
--- a/kb-lib/src/decoder/fees/bags_fee_share_v1.rs
+++ b/kb-lib/src/decoder/fees/bags_fee_share_v1.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_fees_bags_fee_share_v1`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_fees_bags_fee_share_v1";
+const LEGACY_CRATE: &str = "kb_decoder_fees_bags_fee_share_v1";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/fees/bags_fee_share_v2.rs b/kb-lib/src/decoder/fees/bags_fee_share_v2.rs
index eec53f8..a669c83 100644
--- a/kb-lib/src/decoder/fees/bags_fee_share_v2.rs
+++ b/kb-lib/src/decoder/fees/bags_fee_share_v2.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_fees_bags_fee_share_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_fees_bags_fee_share_v2";
+const LEGACY_CRATE: &str = "kb_decoder_fees_bags_fee_share_v2";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/governance.rs b/kb-lib/src/decoder/governance.rs
index efce434..d0a2e40 100644
--- a/kb-lib/src/decoder/governance.rs
+++ b/kb-lib/src/decoder/governance.rs
@@ -3,4 +3,4 @@
//! `governance` decoder family.
-pub mod metadao_bid_wall;
+mod metadao_bid_wall;
diff --git a/kb-lib/src/decoder/governance/metadao_bid_wall.rs b/kb-lib/src/decoder/governance/metadao_bid_wall.rs
index b8eabe2..c9ea897 100644
--- a/kb-lib/src/decoder/governance/metadao_bid_wall.rs
+++ b/kb-lib/src/decoder/governance/metadao_bid_wall.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_governance_metadao_bid_wall`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_governance_metadao_bid_wall";
+const LEGACY_CRATE: &str = "kb_decoder_governance_metadao_bid_wall";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/launchpad.rs b/kb-lib/src/decoder/launchpad.rs
index 508b611..0c30872 100644
--- a/kb-lib/src/decoder/launchpad.rs
+++ b/kb-lib/src/decoder/launchpad.rs
@@ -3,12 +3,12 @@
//! `launchpad` decoder family.
-pub mod boop_fun;
-pub mod metadao_ico;
-pub mod meteora_dbc;
-pub mod moonit;
-pub mod orca_wavebreak;
-pub mod printr;
-pub mod pump_fun;
-pub mod pump_pumpup_ai;
-pub mod raydium_launchlab;
+mod boop_fun;
+mod metadao_ico;
+mod meteora_dbc;
+mod moonit;
+mod orca_wavebreak;
+mod printr;
+mod pump_fun;
+mod pump_pumpup_ai;
+mod raydium_launchlab;
diff --git a/kb-lib/src/decoder/launchpad/boop_fun.rs b/kb-lib/src/decoder/launchpad/boop_fun.rs
index ceb2683..452d8dc 100644
--- a/kb-lib/src/decoder/launchpad/boop_fun.rs
+++ b/kb-lib/src/decoder/launchpad/boop_fun.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_launchpad_boop_fun`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_boop_fun";
+const LEGACY_CRATE: &str = "kb_decoder_launchpad_boop_fun";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/launchpad/metadao_ico.rs b/kb-lib/src/decoder/launchpad/metadao_ico.rs
index edc4d37..b954102 100644
--- a/kb-lib/src/decoder/launchpad/metadao_ico.rs
+++ b/kb-lib/src/decoder/launchpad/metadao_ico.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_launchpad_metadao_ico`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_metadao_ico";
+const LEGACY_CRATE: &str = "kb_decoder_launchpad_metadao_ico";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/launchpad/meteora_dbc.rs b/kb-lib/src/decoder/launchpad/meteora_dbc.rs
index 920ad2d..1ea5fc1 100644
--- a/kb-lib/src/decoder/launchpad/meteora_dbc.rs
+++ b/kb-lib/src/decoder/launchpad/meteora_dbc.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_launchpad_meteora_dbc`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_meteora_dbc";
+const LEGACY_CRATE: &str = "kb_decoder_launchpad_meteora_dbc";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/launchpad/moonit.rs b/kb-lib/src/decoder/launchpad/moonit.rs
index 301a630..1cb1e4d 100644
--- a/kb-lib/src/decoder/launchpad/moonit.rs
+++ b/kb-lib/src/decoder/launchpad/moonit.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_launchpad_moonit`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_moonit";
+const LEGACY_CRATE: &str = "kb_decoder_launchpad_moonit";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/launchpad/orca_wavebreak.rs b/kb-lib/src/decoder/launchpad/orca_wavebreak.rs
index 3daea74..2aefc1c 100644
--- a/kb-lib/src/decoder/launchpad/orca_wavebreak.rs
+++ b/kb-lib/src/decoder/launchpad/orca_wavebreak.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_launchpad_orca_wavebreak`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_orca_wavebreak";
+const LEGACY_CRATE: &str = "kb_decoder_launchpad_orca_wavebreak";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/launchpad/printr.rs b/kb-lib/src/decoder/launchpad/printr.rs
index 00b719c..c21d092 100644
--- a/kb-lib/src/decoder/launchpad/printr.rs
+++ b/kb-lib/src/decoder/launchpad/printr.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_launchpad_printr`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_printr";
+const LEGACY_CRATE: &str = "kb_decoder_launchpad_printr";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/launchpad/pump_fun.rs b/kb-lib/src/decoder/launchpad/pump_fun.rs
index 51282e7..2aa8db6 100644
--- a/kb-lib/src/decoder/launchpad/pump_fun.rs
+++ b/kb-lib/src/decoder/launchpad/pump_fun.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_launchpad_pump_fun`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_pump_fun";
+const LEGACY_CRATE: &str = "kb_decoder_launchpad_pump_fun";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/launchpad/pump_pumpup_ai.rs b/kb-lib/src/decoder/launchpad/pump_pumpup_ai.rs
index edf05fa..97e7381 100644
--- a/kb-lib/src/decoder/launchpad/pump_pumpup_ai.rs
+++ b/kb-lib/src/decoder/launchpad/pump_pumpup_ai.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_launchpad_pump_pumpup_ai`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_pump_pumpup_ai";
+const LEGACY_CRATE: &str = "kb_decoder_launchpad_pump_pumpup_ai";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/launchpad/raydium_launchlab.rs b/kb-lib/src/decoder/launchpad/raydium_launchlab.rs
index 39702b8..a477d45 100644
--- a/kb-lib/src/decoder/launchpad/raydium_launchlab.rs
+++ b/kb-lib/src/decoder/launchpad/raydium_launchlab.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_launchpad_raydium_launchlab`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_launchpad_raydium_launchlab";
+const LEGACY_CRATE: &str = "kb_decoder_launchpad_raydium_launchlab";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/lending.rs b/kb-lib/src/decoder/lending.rs
index f943cd0..e6734b9 100644
--- a/kb-lib/src/decoder/lending.rs
+++ b/kb-lib/src/decoder/lending.rs
@@ -3,10 +3,10 @@
//! `lending` decoder family.
-pub mod clone;
-pub mod jupiter_lend_borrow;
-pub mod jupiter_lend_earn;
-pub mod jupiter_lend_flash_loan;
-pub mod jupiter_lend_liquidity;
-pub mod kamino;
-pub mod marginfi_v2;
+mod clone;
+mod jupiter_lend_borrow;
+mod jupiter_lend_earn;
+mod jupiter_lend_flash_loan;
+mod jupiter_lend_liquidity;
+mod kamino;
+mod marginfi_v2;
diff --git a/kb-lib/src/decoder/lending/clone.rs b/kb-lib/src/decoder/lending/clone.rs
index 88b796b..2dabd03 100644
--- a/kb-lib/src/decoder/lending/clone.rs
+++ b/kb-lib/src/decoder/lending/clone.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_lending_clone`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_lending_clone";
+const LEGACY_CRATE: &str = "kb_decoder_lending_clone";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/lending/jupiter_lend_borrow.rs b/kb-lib/src/decoder/lending/jupiter_lend_borrow.rs
index 58cf9b7..ee5c08d 100644
--- a/kb-lib/src/decoder/lending/jupiter_lend_borrow.rs
+++ b/kb-lib/src/decoder/lending/jupiter_lend_borrow.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_lending_jupiter_lend_borrow`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_lending_jupiter_lend_borrow";
+const LEGACY_CRATE: &str = "kb_decoder_lending_jupiter_lend_borrow";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/lending/jupiter_lend_earn.rs b/kb-lib/src/decoder/lending/jupiter_lend_earn.rs
index 02d5aeb..eec4405 100644
--- a/kb-lib/src/decoder/lending/jupiter_lend_earn.rs
+++ b/kb-lib/src/decoder/lending/jupiter_lend_earn.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_lending_jupiter_lend_earn`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_lending_jupiter_lend_earn";
+const LEGACY_CRATE: &str = "kb_decoder_lending_jupiter_lend_earn";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/lending/jupiter_lend_flash_loan.rs b/kb-lib/src/decoder/lending/jupiter_lend_flash_loan.rs
index 2cce758..b5df193 100644
--- a/kb-lib/src/decoder/lending/jupiter_lend_flash_loan.rs
+++ b/kb-lib/src/decoder/lending/jupiter_lend_flash_loan.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_lending_jupiter_lend_flash_loan`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_lending_jupiter_lend_flash_loan";
+const LEGACY_CRATE: &str = "kb_decoder_lending_jupiter_lend_flash_loan";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/lending/jupiter_lend_liquidity.rs b/kb-lib/src/decoder/lending/jupiter_lend_liquidity.rs
index 56f13c6..f4bf409 100644
--- a/kb-lib/src/decoder/lending/jupiter_lend_liquidity.rs
+++ b/kb-lib/src/decoder/lending/jupiter_lend_liquidity.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_lending_jupiter_lend_liquidity`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_lending_jupiter_lend_liquidity";
+const LEGACY_CRATE: &str = "kb_decoder_lending_jupiter_lend_liquidity";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/lending/kamino.rs b/kb-lib/src/decoder/lending/kamino.rs
index cf79836..6635f29 100644
--- a/kb-lib/src/decoder/lending/kamino.rs
+++ b/kb-lib/src/decoder/lending/kamino.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_lending_kamino`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_lending_kamino";
+const LEGACY_CRATE: &str = "kb_decoder_lending_kamino";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/lending/marginfi_v2.rs b/kb-lib/src/decoder/lending/marginfi_v2.rs
index ef173b9..2cd4ee2 100644
--- a/kb-lib/src/decoder/lending/marginfi_v2.rs
+++ b/kb-lib/src/decoder/lending/marginfi_v2.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_lending_marginfi_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_lending_marginfi_v2";
+const LEGACY_CRATE: &str = "kb_decoder_lending_marginfi_v2";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/lock.rs b/kb-lib/src/decoder/lock.rs
index 4e47726..160fc6c 100644
--- a/kb-lib/src/decoder/lock.rs
+++ b/kb-lib/src/decoder/lock.rs
@@ -3,4 +3,4 @@
//! `lock` decoder family.
-pub mod raydium_lp;
+mod raydium_lp;
diff --git a/kb-lib/src/decoder/lock/raydium_lp.rs b/kb-lib/src/decoder/lock/raydium_lp.rs
index 0b387d4..15be905 100644
--- a/kb-lib/src/decoder/lock/raydium_lp.rs
+++ b/kb-lib/src/decoder/lock/raydium_lp.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_lock_raydium_lp`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_lock_raydium_lp";
+const LEGACY_CRATE: &str = "kb_decoder_lock_raydium_lp";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/metadata.rs b/kb-lib/src/decoder/metadata.rs
index dfbd5af..8270576 100644
--- a/kb-lib/src/decoder/metadata.rs
+++ b/kb-lib/src/decoder/metadata.rs
@@ -3,8 +3,216 @@
//! `metadata` decoder family.
-pub mod metaplex_token_metadata;
-pub mod spl_name_service;
+mod metaplex_token_metadata;
+mod spl_name_service;
+/// Approve Collection Authority discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_APPROVE_COLLECTION_AUTHORITY_DISCRIMINATOR;
+/// Approve Use Authority discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_APPROVE_USE_AUTHORITY_DISCRIMINATOR;
+/// Bubblegum Set Collection Size discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_BUBBLEGUM_SET_COLLECTION_SIZE_DISCRIMINATOR;
+/// Burn discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_BURN_DISCRIMINATOR;
+/// Historical Burn Edition NFT discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_BURN_EDITION_NFT_DISCRIMINATOR;
+/// Historical Burn NFT discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_BURN_NFT_DISCRIMINATOR;
+/// Close Accounts discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_CLOSE_ACCOUNTS_DISCRIMINATOR;
+/// Close Escrow Account discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_CLOSE_ESCROW_ACCOUNT_DISCRIMINATOR;
+/// Collect discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_COLLECT_DISCRIMINATOR;
+/// Convert Master Edition V1 to V2 discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_CONVERT_MASTER_EDITION_V1_TO_V2_DISCRIMINATOR;
+/// Modern Create discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_CREATE_DISCRIMINATOR;
+/// Create Escrow Account discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_CREATE_ESCROW_ACCOUNT_DISCRIMINATOR;
+/// Historical Create Master Edition discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_CREATE_MASTER_EDITION_DISCRIMINATOR;
+/// Create Master Edition V3 discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_CREATE_MASTER_EDITION_V3_DISCRIMINATOR;
+/// Historical Create Metadata Account discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_DISCRIMINATOR;
+/// Historical Create Metadata Account V2 discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_V2_DISCRIMINATOR;
+/// Create Metadata Account V3 discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_V3_DISCRIMINATOR;
+/// Delegate discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_DELEGATE_DISCRIMINATOR;
+/// Deprecated Create Master Edition discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_DEPRECATED_CREATE_MASTER_EDITION_DISCRIMINATOR;
+/// Deprecated Create Reservation List discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_DEPRECATED_CREATE_RESERVATION_LIST_DISCRIMINATOR;
+/// Deprecated printing-token mint-new-edition discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_DEPRECATED_MINT_NEW_EDITION_VIA_PRINTING_TOKEN_DISCRIMINATOR;
+/// Deprecated Mint Printing Tokens discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_DEPRECATED_MINT_PRINTING_TOKENS_DISCRIMINATOR;
+/// Deprecated Mint Printing Tokens Via Token discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_DEPRECATED_MINT_PRINTING_TOKENS_VIA_TOKEN_DISCRIMINATOR;
+/// Deprecated Set Reservation List discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_DEPRECATED_SET_RESERVATION_LIST_DISCRIMINATOR;
+/// Number of bytes retained in malformed-wire diagnostics.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_DIAGNOSTIC_PREFIX_BYTES;
+/// Stable event payload contract version.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_EVENT_VERSION;
+/// Freeze Delegated Account discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_FREEZE_DELEGATED_ACCOUNT_DISCRIMINATOR;
+/// Current pre-release instruction inventory.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_INSTRUCTION_ENTRIES;
+/// Lock discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_LOCK_DISCRIMINATOR;
+/// Maximum encoded base64 instruction payload size.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_MAX_BASE64_BYTES;
+/// Maximum number of instruction accounts accepted by this decoder.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_MAX_INSTRUCTION_ACCOUNTS;
+/// Tracing target for this decoder.
+/// Maximum retained instruction payload size.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_MAX_INSTRUCTION_BYTES;
+/// Migrate discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_MIGRATE_DISCRIMINATOR;
+/// Modern Mint discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_MINT_DISCRIMINATOR;
+/// Mint New Edition From Master Edition Via Token discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR;
+/// Mint New Edition From Master Edition Via Vault Proxy discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_DISCRIMINATOR;
+/// Modern Print discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_PRINT_DISCRIMINATOR;
+/// Puff Metadata discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_PUFF_METADATA_DISCRIMINATOR;
+/// Remove Creator Verification discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_REMOVE_CREATOR_VERIFICATION_DISCRIMINATOR;
+/// Resize discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_RESIZE_DISCRIMINATOR;
+/// Revoke Collection Authority discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_REVOKE_COLLECTION_AUTHORITY_DISCRIMINATOR;
+/// Revoke discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_REVOKE_DISCRIMINATOR;
+/// Revoke Use Authority discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_REVOKE_USE_AUTHORITY_DISCRIMINATOR;
+/// Set And Verify Collection discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_SET_AND_VERIFY_COLLECTION_DISCRIMINATOR;
+/// Set And Verify Sized Collection Item discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_SET_AND_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR;
+/// Set Collection Size discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_SET_COLLECTION_SIZE_DISCRIMINATOR;
+/// Set Token Standard discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_SET_TOKEN_STANDARD_DISCRIMINATOR;
+/// Sign Metadata discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_SIGN_METADATA_DISCRIMINATOR;
+/// Stable decoder surface code.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_SURFACE_CODE;
+/// Thaw Delegated Account discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_THAW_DELEGATED_ACCOUNT_DISCRIMINATOR;
+/// Canonical tracing target for this crate.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_TRACING_TARGET;
+/// Transfer discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_TRANSFER_DISCRIMINATOR;
+/// Transfer Out Of Escrow discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_TRANSFER_OUT_OF_ESCROW_DISCRIMINATOR;
+/// Unlock discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_UNLOCK_DISCRIMINATOR;
+/// Unverify Collection discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_UNVERIFY_COLLECTION_DISCRIMINATOR;
+/// Modern Unverify discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_UNVERIFY_DISCRIMINATOR;
+/// Unverify Sized Collection Item discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_UNVERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR;
+/// Modern Update discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_UPDATE_DISCRIMINATOR;
+/// Historical Update Metadata Account discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_UPDATE_METADATA_ACCOUNT_DISCRIMINATOR;
+/// Update Metadata Account V2 discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_UPDATE_METADATA_ACCOUNT_V2_DISCRIMINATOR;
+/// Update Primary Sale Happened Via Token discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_DISCRIMINATOR;
+/// Modern Use discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_USE_DISCRIMINATOR;
+/// Utilize discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_UTILIZE_DISCRIMINATOR;
+/// Verify Collection discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_VERIFY_COLLECTION_DISCRIMINATOR;
+/// Modern Verify discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_VERIFY_DISCRIMINATOR;
+/// Verify Sized Collection Item discriminator.
+pub(crate) use self::metaplex_token_metadata::DC_METADATA_MTM_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR;
+/// Crate-root access to `decode` from `instruction`.
+pub(crate) use self::metaplex_token_metadata::decoder_metadata_metaplex_token_metadata_decode;
+/// Crate-root access to `entry_for_discriminator` from `instruction`.
+pub(crate) use self::metaplex_token_metadata::decoder_metadata_metaplex_token_metadata_entry_for_discriminator;
+/// Crate-root access to `payload_discriminator` from `instruction`.
+pub(crate) use self::metaplex_token_metadata::decoder_metadata_metaplex_token_metadata_payload_discriminator;
+
+/// Exhaustive published Metaplex account-key inventory.
+pub use self::metaplex_token_metadata::DC_METADATA_MTM_METADATA_ACCOUNT_LAYOUT_AUDIT;
/// Exact decoder for the Metaplex Token Metadata program.
-pub use self::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
+pub use self::metaplex_token_metadata::DcMetadataMetaplexTokenMetadataDecoder;
+/// Canonical projection shared by Collection and Use Authority records.
+pub use self::metaplex_token_metadata::DcMetadataMtmAuthorityRecordAccountSnapshot;
+/// Stable identity and policy of one canonical account snapshot.
+pub use self::metaplex_token_metadata::DcMetadataMtmCanonicalAccountIdentity;
+/// Lifecycle class of one canonical account layout.
+pub use self::metaplex_token_metadata::DcMetadataMtmCanonicalAccountLifecycle;
+/// Provenance retained for one canonical account observation.
+pub use self::metaplex_token_metadata::DcMetadataMtmCanonicalAccountProvenance;
+/// Execution policy separated from historical materialization.
+pub use self::metaplex_token_metadata::DcMetadataMtmCanonicalExecutionPolicy;
+/// Materialization policy for active or historical state.
+pub use self::metaplex_token_metadata::DcMetadataMtmCanonicalMaterializationPolicy;
+/// Canonical account envelope used by materializers and replay.
+pub use self::metaplex_token_metadata::DcMetadataMtmCanonicalMetadataAccountSnapshot;
+/// Typed canonical Metaplex account state.
+pub use self::metaplex_token_metadata::DcMetadataMtmCanonicalMetadataAccountState;
+/// Origin of one canonical account observation.
+pub use self::metaplex_token_metadata::DcMetadataMtmCanonicalObservationSource;
+/// Canonical projection shared by Metadata and Holder delegate records.
+pub use self::metaplex_token_metadata::DcMetadataMtmDelegateRecordAccountSnapshot;
+/// Supported edition account layout.
+pub use self::metaplex_token_metadata::DcMetadataMtmEditionAccountKind;
+/// Canonical bounded projection of one edition or master-edition account.
+pub use self::metaplex_token_metadata::DcMetadataMtmEditionAccountSnapshot;
+/// Supported Edition Marker account layout.
+pub use self::metaplex_token_metadata::DcMetadataMtmEditionMarkerAccountKind;
+/// Canonical bounded projection of one Edition Marker account.
+pub use self::metaplex_token_metadata::DcMetadataMtmEditionMarkerAccountSnapshot;
+/// Bounded error returned while decoding a Metadata account.
+pub use self::metaplex_token_metadata::DcMetadataMtmMetadataAccountDecodeError;
+/// One entry in the exhaustive published account-key audit.
+pub use self::metaplex_token_metadata::DcMetadataMtmMetadataAccountLayoutAuditEntry;
+/// Canonical bounded projection of one Metadata account.
+pub use self::metaplex_token_metadata::DcMetadataMtmMetadataAccountSnapshot;
+/// One bounded historical reservation entry.
+pub use self::metaplex_token_metadata::DcMetadataMtmReservationEntrySnapshot;
+/// Historical Reservation List account generation.
+pub use self::metaplex_token_metadata::DcMetadataMtmReservationListAccountKind;
+/// Canonical decode-only projection of a historical Reservation List account.
+pub use self::metaplex_token_metadata::DcMetadataMtmReservationListAccountSnapshot;
+/// Canonical projection of one Token Owned Escrow account.
+pub use self::metaplex_token_metadata::DcMetadataMtmTokenOwnedEscrowAccountSnapshot;
+/// Authority form used by one Token Owned Escrow account.
+pub use self::metaplex_token_metadata::DcMetadataMtmTokenOwnedEscrowAuthorityKind;
+/// Canonical bounded projection of one programmable Token Record account.
+pub use self::metaplex_token_metadata::DcMetadataMtmTokenRecordAccountSnapshot;
+/// Decodes one Collection Authority Record account.
+pub use self::metaplex_token_metadata::decoder_metadata_metaplex_token_metadata_decode_collection_authority_record_account;
+/// Decodes and validates one edition or master-edition account snapshot.
+pub use self::metaplex_token_metadata::decoder_metadata_metaplex_token_metadata_decode_edition_account;
+/// Decodes and validates one Edition Marker account snapshot.
+pub use self::metaplex_token_metadata::decoder_metadata_metaplex_token_metadata_decode_edition_marker_account;
+/// Decodes one Holder Delegate Record account.
+pub use self::metaplex_token_metadata::decoder_metadata_metaplex_token_metadata_decode_holder_delegate_record_account;
+/// Decodes and validates one canonical Metadata account snapshot.
+pub use self::metaplex_token_metadata::decoder_metadata_metaplex_token_metadata_decode_metadata_account;
+/// Decodes one Metadata Delegate Record account.
+pub use self::metaplex_token_metadata::decoder_metadata_metaplex_token_metadata_decode_metadata_delegate_record_account;
+/// Decodes one historical Reservation List V1 or V2 account.
+pub use self::metaplex_token_metadata::decoder_metadata_metaplex_token_metadata_decode_reservation_list_account;
+/// Decodes one Token Owned Escrow account.
+pub use self::metaplex_token_metadata::decoder_metadata_metaplex_token_metadata_decode_token_owned_escrow_account;
+/// Decodes and validates one programmable Token Record account snapshot.
+pub use self::metaplex_token_metadata::decoder_metadata_metaplex_token_metadata_decode_token_record_account;
+/// Decodes one Use Authority Record account.
+pub use self::metaplex_token_metadata::decoder_metadata_metaplex_token_metadata_decode_use_authority_record_account;
diff --git a/kb-lib/src/decoder/metadata/metaplex_token_metadata.rs b/kb-lib/src/decoder/metadata/metaplex_token_metadata.rs
index acdc764..136668b 100644
--- a/kb-lib/src/decoder/metadata/metaplex_token_metadata.rs
+++ b/kb-lib/src/decoder/metadata/metaplex_token_metadata.rs
@@ -10,214 +10,212 @@ mod decoder;
mod instruction;
/// Approve Collection Authority discriminator.
-pub(crate) use self::constants::APPROVE_COLLECTION_AUTHORITY_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_APPROVE_COLLECTION_AUTHORITY_DISCRIMINATOR;
/// Approve Use Authority discriminator.
-pub(crate) use self::constants::APPROVE_USE_AUTHORITY_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_APPROVE_USE_AUTHORITY_DISCRIMINATOR;
/// Bubblegum Set Collection Size discriminator.
-pub(crate) use self::constants::BUBBLEGUM_SET_COLLECTION_SIZE_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_BUBBLEGUM_SET_COLLECTION_SIZE_DISCRIMINATOR;
/// Burn discriminator.
-pub(crate) use self::constants::BURN_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_BURN_DISCRIMINATOR;
/// Historical Burn Edition NFT discriminator.
-pub(crate) use self::constants::BURN_EDITION_NFT_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_BURN_EDITION_NFT_DISCRIMINATOR;
/// Historical Burn NFT discriminator.
-pub(crate) use self::constants::BURN_NFT_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_BURN_NFT_DISCRIMINATOR;
/// Close Accounts discriminator.
-pub(crate) use self::constants::CLOSE_ACCOUNTS_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_CLOSE_ACCOUNTS_DISCRIMINATOR;
/// Close Escrow Account discriminator.
-pub(crate) use self::constants::CLOSE_ESCROW_ACCOUNT_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_CLOSE_ESCROW_ACCOUNT_DISCRIMINATOR;
/// Collect discriminator.
-pub(crate) use self::constants::COLLECT_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_COLLECT_DISCRIMINATOR;
/// Convert Master Edition V1 to V2 discriminator.
-pub(crate) use self::constants::CONVERT_MASTER_EDITION_V1_TO_V2_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_CONVERT_MASTER_EDITION_V1_TO_V2_DISCRIMINATOR;
/// Modern Create discriminator.
-pub(crate) use self::constants::CREATE_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_CREATE_DISCRIMINATOR;
/// Create Escrow Account discriminator.
-pub(crate) use self::constants::CREATE_ESCROW_ACCOUNT_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_CREATE_ESCROW_ACCOUNT_DISCRIMINATOR;
/// Historical Create Master Edition discriminator.
-pub(crate) use self::constants::CREATE_MASTER_EDITION_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_CREATE_MASTER_EDITION_DISCRIMINATOR;
/// Create Master Edition V3 discriminator.
-pub(crate) use self::constants::CREATE_MASTER_EDITION_V3_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_CREATE_MASTER_EDITION_V3_DISCRIMINATOR;
/// Historical Create Metadata Account discriminator.
-pub(crate) use self::constants::CREATE_METADATA_ACCOUNT_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_DISCRIMINATOR;
/// Historical Create Metadata Account V2 discriminator.
-pub(crate) use self::constants::CREATE_METADATA_ACCOUNT_V2_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_V2_DISCRIMINATOR;
/// Create Metadata Account V3 discriminator.
-pub(crate) use self::constants::CREATE_METADATA_ACCOUNT_V3_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_V3_DISCRIMINATOR;
/// Delegate discriminator.
-pub(crate) use self::constants::DELEGATE_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_DELEGATE_DISCRIMINATOR;
/// Deprecated Create Master Edition discriminator.
-pub(crate) use self::constants::DEPRECATED_CREATE_MASTER_EDITION_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_DEPRECATED_CREATE_MASTER_EDITION_DISCRIMINATOR;
/// Deprecated Create Reservation List discriminator.
-pub(crate) use self::constants::DEPRECATED_CREATE_RESERVATION_LIST_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_DEPRECATED_CREATE_RESERVATION_LIST_DISCRIMINATOR;
/// Deprecated printing-token mint-new-edition discriminator.
-pub(crate) use self::constants::DEPRECATED_MINT_NEW_EDITION_VIA_PRINTING_TOKEN_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_DEPRECATED_MINT_NEW_EDITION_VIA_PRINTING_TOKEN_DISCRIMINATOR;
/// Deprecated Mint Printing Tokens discriminator.
-pub(crate) use self::constants::DEPRECATED_MINT_PRINTING_TOKENS_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_DEPRECATED_MINT_PRINTING_TOKENS_DISCRIMINATOR;
/// Deprecated Mint Printing Tokens Via Token discriminator.
-pub(crate) use self::constants::DEPRECATED_MINT_PRINTING_TOKENS_VIA_TOKEN_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_DEPRECATED_MINT_PRINTING_TOKENS_VIA_TOKEN_DISCRIMINATOR;
/// Deprecated Set Reservation List discriminator.
-pub(crate) use self::constants::DEPRECATED_SET_RESERVATION_LIST_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_DEPRECATED_SET_RESERVATION_LIST_DISCRIMINATOR;
/// Number of bytes retained in malformed-wire diagnostics.
-pub(crate) use self::constants::DIAGNOSTIC_PREFIX_BYTES;
+pub(crate) use self::constants::DC_METADATA_MTM_DIAGNOSTIC_PREFIX_BYTES;
/// Stable event payload contract version.
-pub(crate) use self::constants::EVENT_VERSION;
+pub(crate) use self::constants::DC_METADATA_MTM_EVENT_VERSION;
/// Freeze Delegated Account discriminator.
-pub(crate) use self::constants::FREEZE_DELEGATED_ACCOUNT_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_FREEZE_DELEGATED_ACCOUNT_DISCRIMINATOR;
/// Current pre-release instruction inventory.
-pub(crate) use self::constants::INSTRUCTION_ENTRIES;
+pub(crate) use self::constants::DC_METADATA_MTM_INSTRUCTION_ENTRIES;
/// Lock discriminator.
-pub(crate) use self::constants::LOCK_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_LOCK_DISCRIMINATOR;
/// Maximum encoded base64 instruction payload size.
-pub(crate) use self::constants::MAX_BASE64_BYTES;
+pub(crate) use self::constants::DC_METADATA_MTM_MAX_BASE64_BYTES;
/// Maximum number of instruction accounts accepted by this decoder.
-pub(crate) use self::constants::MAX_INSTRUCTION_ACCOUNTS;
+pub(crate) use self::constants::DC_METADATA_MTM_MAX_INSTRUCTION_ACCOUNTS;
/// Tracing target for this decoder.
/// Maximum retained instruction payload size.
-pub(crate) use self::constants::MAX_INSTRUCTION_BYTES;
+pub(crate) use self::constants::DC_METADATA_MTM_MAX_INSTRUCTION_BYTES;
/// Migrate discriminator.
-pub(crate) use self::constants::MIGRATE_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_MIGRATE_DISCRIMINATOR;
/// Modern Mint discriminator.
-pub(crate) use self::constants::MINT_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_MINT_DISCRIMINATOR;
/// Mint New Edition From Master Edition Via Token discriminator.
-pub(crate) use self::constants::MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR;
/// Mint New Edition From Master Edition Via Vault Proxy discriminator.
-pub(crate) use self::constants::MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_DISCRIMINATOR;
/// Modern Print discriminator.
-pub(crate) use self::constants::PRINT_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_PRINT_DISCRIMINATOR;
/// Puff Metadata discriminator.
-pub(crate) use self::constants::PUFF_METADATA_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_PUFF_METADATA_DISCRIMINATOR;
/// Remove Creator Verification discriminator.
-pub(crate) use self::constants::REMOVE_CREATOR_VERIFICATION_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_REMOVE_CREATOR_VERIFICATION_DISCRIMINATOR;
/// Resize discriminator.
-pub(crate) use self::constants::RESIZE_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_RESIZE_DISCRIMINATOR;
/// Revoke Collection Authority discriminator.
-pub(crate) use self::constants::REVOKE_COLLECTION_AUTHORITY_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_REVOKE_COLLECTION_AUTHORITY_DISCRIMINATOR;
/// Revoke discriminator.
-pub(crate) use self::constants::REVOKE_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_REVOKE_DISCRIMINATOR;
/// Revoke Use Authority discriminator.
-pub(crate) use self::constants::REVOKE_USE_AUTHORITY_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_REVOKE_USE_AUTHORITY_DISCRIMINATOR;
/// Set And Verify Collection discriminator.
-pub(crate) use self::constants::SET_AND_VERIFY_COLLECTION_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_SET_AND_VERIFY_COLLECTION_DISCRIMINATOR;
/// Set And Verify Sized Collection Item discriminator.
-pub(crate) use self::constants::SET_AND_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_SET_AND_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR;
/// Set Collection Size discriminator.
-pub(crate) use self::constants::SET_COLLECTION_SIZE_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_SET_COLLECTION_SIZE_DISCRIMINATOR;
/// Set Token Standard discriminator.
-pub(crate) use self::constants::SET_TOKEN_STANDARD_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_SET_TOKEN_STANDARD_DISCRIMINATOR;
/// Sign Metadata discriminator.
-pub(crate) use self::constants::SIGN_METADATA_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_SIGN_METADATA_DISCRIMINATOR;
/// Stable decoder surface code.
-pub(crate) use self::constants::SURFACE_CODE;
+pub(crate) use self::constants::DC_METADATA_MTM_SURFACE_CODE;
/// Thaw Delegated Account discriminator.
-pub(crate) use self::constants::THAW_DELEGATED_ACCOUNT_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_THAW_DELEGATED_ACCOUNT_DISCRIMINATOR;
/// Canonical tracing target for this crate.
-pub(crate) use self::constants::TRACING_TARGET;
+pub(crate) use self::constants::DC_METADATA_MTM_TRACING_TARGET;
/// Transfer discriminator.
-pub(crate) use self::constants::TRANSFER_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_TRANSFER_DISCRIMINATOR;
/// Transfer Out Of Escrow discriminator.
-pub(crate) use self::constants::TRANSFER_OUT_OF_ESCROW_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_TRANSFER_OUT_OF_ESCROW_DISCRIMINATOR;
/// Unlock discriminator.
-pub(crate) use self::constants::UNLOCK_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_UNLOCK_DISCRIMINATOR;
/// Unverify Collection discriminator.
-pub(crate) use self::constants::UNVERIFY_COLLECTION_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_UNVERIFY_COLLECTION_DISCRIMINATOR;
/// Modern Unverify discriminator.
-pub(crate) use self::constants::UNVERIFY_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_UNVERIFY_DISCRIMINATOR;
/// Unverify Sized Collection Item discriminator.
-pub(crate) use self::constants::UNVERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_UNVERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR;
/// Modern Update discriminator.
-pub(crate) use self::constants::UPDATE_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_UPDATE_DISCRIMINATOR;
/// Historical Update Metadata Account discriminator.
-pub(crate) use self::constants::UPDATE_METADATA_ACCOUNT_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_UPDATE_METADATA_ACCOUNT_DISCRIMINATOR;
/// Update Metadata Account V2 discriminator.
-pub(crate) use self::constants::UPDATE_METADATA_ACCOUNT_V2_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_UPDATE_METADATA_ACCOUNT_V2_DISCRIMINATOR;
/// Update Primary Sale Happened Via Token discriminator.
-pub(crate) use self::constants::UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_DISCRIMINATOR;
/// Modern Use discriminator.
-pub(crate) use self::constants::USE_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_USE_DISCRIMINATOR;
/// Utilize discriminator.
-pub(crate) use self::constants::UTILIZE_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_UTILIZE_DISCRIMINATOR;
/// Verify Collection discriminator.
-pub(crate) use self::constants::VERIFY_COLLECTION_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_VERIFY_COLLECTION_DISCRIMINATOR;
/// Modern Verify discriminator.
-pub(crate) use self::constants::VERIFY_DISCRIMINATOR;
+pub(crate) use self::constants::DC_METADATA_MTM_VERIFY_DISCRIMINATOR;
/// Verify Sized Collection Item discriminator.
-pub(crate) use self::constants::VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR;
-/// Crate-root access to `ParsedInstruction` from `instruction`.
-pub(crate) use self::instruction::ParsedInstruction;
+pub(crate) use self::constants::DC_METADATA_MTM_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR;
/// Crate-root access to `decode` from `instruction`.
-pub(crate) use self::instruction::decode;
+pub(crate) use self::instruction::decoder_metadata_metaplex_token_metadata_decode;
/// Crate-root access to `entry_for_discriminator` from `instruction`.
-pub(crate) use self::instruction::entry_for_discriminator;
+pub(crate) use self::instruction::decoder_metadata_metaplex_token_metadata_entry_for_discriminator;
/// Crate-root access to `payload_discriminator` from `instruction`.
-pub(crate) use self::instruction::payload_discriminator;
+pub(crate) use self::instruction::decoder_metadata_metaplex_token_metadata_payload_discriminator;
-/// Canonical projection shared by Collection and Use Authority records.
-pub use self::account::AuthorityRecordAccountSnapshot;
-/// Canonical projection shared by Metadata and Holder delegate records.
-pub use self::account::DelegateRecordAccountSnapshot;
-/// Supported edition account layout.
-pub use self::account::EditionAccountKind;
-/// Canonical bounded projection of one edition or master-edition account.
-pub use self::account::EditionAccountSnapshot;
-/// Supported Edition Marker account layout.
-pub use self::account::EditionMarkerAccountKind;
-/// Canonical bounded projection of one Edition Marker account.
-pub use self::account::EditionMarkerAccountSnapshot;
/// Exhaustive published Metaplex account-key inventory.
-pub use self::account::METADATA_ACCOUNT_LAYOUT_AUDIT;
+pub use self::account::DC_METADATA_MTM_METADATA_ACCOUNT_LAYOUT_AUDIT;
+/// Canonical projection shared by Collection and Use Authority records.
+pub use self::account::DcMetadataMtmAuthorityRecordAccountSnapshot;
+/// Canonical projection shared by Metadata and Holder delegate records.
+pub use self::account::DcMetadataMtmDelegateRecordAccountSnapshot;
+/// Supported edition account layout.
+pub use self::account::DcMetadataMtmEditionAccountKind;
+/// Canonical bounded projection of one edition or master-edition account.
+pub use self::account::DcMetadataMtmEditionAccountSnapshot;
+/// Supported Edition Marker account layout.
+pub use self::account::DcMetadataMtmEditionMarkerAccountKind;
+/// Canonical bounded projection of one Edition Marker account.
+pub use self::account::DcMetadataMtmEditionMarkerAccountSnapshot;
/// Bounded error returned while decoding a Metadata account.
-pub use self::account::MetadataAccountDecodeError;
+pub use self::account::DcMetadataMtmMetadataAccountDecodeError;
/// One entry in the exhaustive published account-key audit.
-pub use self::account::MetadataAccountLayoutAuditEntry;
+pub use self::account::DcMetadataMtmMetadataAccountLayoutAuditEntry;
/// Canonical bounded projection of one Metadata account.
-pub use self::account::MetadataAccountSnapshot;
+pub use self::account::DcMetadataMtmMetadataAccountSnapshot;
/// One bounded historical reservation entry.
-pub use self::account::ReservationEntrySnapshot;
+pub use self::account::DcMetadataMtmReservationEntrySnapshot;
/// Historical Reservation List account generation.
-pub use self::account::ReservationListAccountKind;
+pub use self::account::DcMetadataMtmReservationListAccountKind;
/// Canonical decode-only projection of a historical Reservation List account.
-pub use self::account::ReservationListAccountSnapshot;
+pub use self::account::DcMetadataMtmReservationListAccountSnapshot;
/// Canonical projection of one Token Owned Escrow account.
-pub use self::account::TokenOwnedEscrowAccountSnapshot;
+pub use self::account::DcMetadataMtmTokenOwnedEscrowAccountSnapshot;
/// Authority form used by one Token Owned Escrow account.
-pub use self::account::TokenOwnedEscrowAuthorityKind;
+pub use self::account::DcMetadataMtmTokenOwnedEscrowAuthorityKind;
/// Canonical bounded projection of one programmable Token Record account.
-pub use self::account::TokenRecordAccountSnapshot;
+pub use self::account::DcMetadataMtmTokenRecordAccountSnapshot;
/// Decodes one Collection Authority Record account.
-pub use self::account::decode_collection_authority_record_account;
+pub use self::account::decoder_metadata_metaplex_token_metadata_decode_collection_authority_record_account;
/// Decodes and validates one edition or master-edition account snapshot.
-pub use self::account::decode_edition_account;
+pub use self::account::decoder_metadata_metaplex_token_metadata_decode_edition_account;
/// Decodes and validates one Edition Marker account snapshot.
-pub use self::account::decode_edition_marker_account;
+pub use self::account::decoder_metadata_metaplex_token_metadata_decode_edition_marker_account;
/// Decodes one Holder Delegate Record account.
-pub use self::account::decode_holder_delegate_record_account;
+pub use self::account::decoder_metadata_metaplex_token_metadata_decode_holder_delegate_record_account;
/// Decodes and validates one canonical Metadata account snapshot.
-pub use self::account::decode_metadata_account;
+pub use self::account::decoder_metadata_metaplex_token_metadata_decode_metadata_account;
/// Decodes one Metadata Delegate Record account.
-pub use self::account::decode_metadata_delegate_record_account;
+pub use self::account::decoder_metadata_metaplex_token_metadata_decode_metadata_delegate_record_account;
/// Decodes one historical Reservation List V1 or V2 account.
-pub use self::account::decode_reservation_list_account;
+pub use self::account::decoder_metadata_metaplex_token_metadata_decode_reservation_list_account;
/// Decodes one Token Owned Escrow account.
-pub use self::account::decode_token_owned_escrow_account;
+pub use self::account::decoder_metadata_metaplex_token_metadata_decode_token_owned_escrow_account;
/// Decodes and validates one programmable Token Record account snapshot.
-pub use self::account::decode_token_record_account;
+pub use self::account::decoder_metadata_metaplex_token_metadata_decode_token_record_account;
/// Decodes one Use Authority Record account.
-pub use self::account::decode_use_authority_record_account;
+pub use self::account::decoder_metadata_metaplex_token_metadata_decode_use_authority_record_account;
/// Stable identity and policy of one canonical account snapshot.
-pub use self::canonical::CanonicalAccountIdentity;
+pub use self::canonical::DcMetadataMtmCanonicalAccountIdentity;
/// Lifecycle class of one canonical account layout.
-pub use self::canonical::CanonicalAccountLifecycle;
+pub use self::canonical::DcMetadataMtmCanonicalAccountLifecycle;
/// Provenance retained for one canonical account observation.
-pub use self::canonical::CanonicalAccountProvenance;
+pub use self::canonical::DcMetadataMtmCanonicalAccountProvenance;
/// Execution policy separated from historical materialization.
-pub use self::canonical::CanonicalExecutionPolicy;
+pub use self::canonical::DcMetadataMtmCanonicalExecutionPolicy;
/// Materialization policy for active or historical state.
-pub use self::canonical::CanonicalMaterializationPolicy;
+pub use self::canonical::DcMetadataMtmCanonicalMaterializationPolicy;
/// Canonical account envelope used by materializers and replay.
-pub use self::canonical::CanonicalMetadataAccountSnapshot;
+pub use self::canonical::DcMetadataMtmCanonicalMetadataAccountSnapshot;
/// Typed canonical Metaplex account state.
-pub use self::canonical::CanonicalMetadataAccountState;
+pub use self::canonical::DcMetadataMtmCanonicalMetadataAccountState;
/// Origin of one canonical account observation.
-pub use self::canonical::CanonicalObservationSource;
+pub use self::canonical::DcMetadataMtmCanonicalObservationSource;
/// Exact Metaplex Token Metadata decoder.
-pub use self::decoder::MetadataMetaplexTokenMetadataDecoder;
+pub use self::decoder::DcMetadataMetaplexTokenMetadataDecoder;
diff --git a/kb-lib/src/decoder/metadata/metaplex_token_metadata/account.rs b/kb-lib/src/decoder/metadata/metaplex_token_metadata/account.rs
index ffc6854..29f8807 100644
--- a/kb-lib/src/decoder/metadata/metaplex_token_metadata/account.rs
+++ b/kb-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: 11
+// version: 12
//! Bounded decoding and PDA validation for Metaplex Token Metadata accounts.
@@ -13,7 +13,7 @@ const MAX_EDITION_MARKER_V2_LEDGER_BYTES: usize = 1_048_576;
/// Bounded error returned while decoding a Metadata account.
#[derive(Clone, Debug, Eq, PartialEq)]
-pub enum MetadataAccountDecodeError {
+pub enum DcMetadataMtmMetadataAccountDecodeError {
/// The account key is not a valid Solana public key.
InvalidAccountKey,
/// The account owner is not a valid Solana public key.
@@ -56,7 +56,7 @@ pub enum MetadataAccountDecodeError {
ProjectionFailed,
}
-impl std::fmt::Display for MetadataAccountDecodeError {
+impl std::fmt::Display for DcMetadataMtmMetadataAccountDecodeError {
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let message = match self {
Self::InvalidAccountKey => "metadata account key is invalid",
@@ -90,11 +90,11 @@ impl std::fmt::Display for MetadataAccountDecodeError {
}
}
-impl std::error::Error for MetadataAccountDecodeError {}
+impl std::error::Error for DcMetadataMtmMetadataAccountDecodeError {}
/// One audited Metaplex account-key layout.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
-pub struct MetadataAccountLayoutAuditEntry {
+pub struct DcMetadataMtmMetadataAccountLayoutAuditEntry {
/// Published `Key` variant name.
pub key_name: &'static str,
/// Exact Borsh discriminant byte.
@@ -106,92 +106,93 @@ pub struct MetadataAccountLayoutAuditEntry {
}
/// Exhaustive inventory of every published Metaplex Token Metadata `Key` variant.
-pub const METADATA_ACCOUNT_LAYOUT_AUDIT: &[MetadataAccountLayoutAuditEntry] = &[
- MetadataAccountLayoutAuditEntry {
+pub const DC_METADATA_MTM_METADATA_ACCOUNT_LAYOUT_AUDIT:
+ &[DcMetadataMtmMetadataAccountLayoutAuditEntry] = &[
+ DcMetadataMtmMetadataAccountLayoutAuditEntry {
key_name: "Uninitialized",
discriminant: 0,
decoder: "reject_uninitialized",
lifecycle: "sentinel",
},
- MetadataAccountLayoutAuditEntry {
+ DcMetadataMtmMetadataAccountLayoutAuditEntry {
key_name: "EditionV1",
discriminant: 1,
decoder: "decode_edition_account",
lifecycle: "active",
},
- MetadataAccountLayoutAuditEntry {
+ DcMetadataMtmMetadataAccountLayoutAuditEntry {
key_name: "MasterEditionV1",
discriminant: 2,
decoder: "decode_edition_account",
lifecycle: "historical_materializable",
},
- MetadataAccountLayoutAuditEntry {
+ DcMetadataMtmMetadataAccountLayoutAuditEntry {
key_name: "ReservationListV1",
discriminant: 3,
decoder: "decode_reservation_list_account",
lifecycle: "historical_materializable",
},
- MetadataAccountLayoutAuditEntry {
+ DcMetadataMtmMetadataAccountLayoutAuditEntry {
key_name: "MetadataV1",
discriminant: 4,
decoder: "decode_metadata_account",
lifecycle: "active",
},
- MetadataAccountLayoutAuditEntry {
+ DcMetadataMtmMetadataAccountLayoutAuditEntry {
key_name: "ReservationListV2",
discriminant: 5,
decoder: "decode_reservation_list_account",
lifecycle: "historical_materializable",
},
- MetadataAccountLayoutAuditEntry {
+ DcMetadataMtmMetadataAccountLayoutAuditEntry {
key_name: "MasterEditionV2",
discriminant: 6,
decoder: "decode_edition_account",
lifecycle: "active",
},
- MetadataAccountLayoutAuditEntry {
+ DcMetadataMtmMetadataAccountLayoutAuditEntry {
key_name: "EditionMarker",
discriminant: 7,
decoder: "decode_edition_marker_account",
lifecycle: "active",
},
- MetadataAccountLayoutAuditEntry {
+ DcMetadataMtmMetadataAccountLayoutAuditEntry {
key_name: "UseAuthorityRecord",
discriminant: 8,
decoder: "decode_use_authority_record_account",
lifecycle: "active",
},
- MetadataAccountLayoutAuditEntry {
+ DcMetadataMtmMetadataAccountLayoutAuditEntry {
key_name: "CollectionAuthorityRecord",
discriminant: 9,
decoder: "decode_collection_authority_record_account",
lifecycle: "active",
},
- MetadataAccountLayoutAuditEntry {
+ DcMetadataMtmMetadataAccountLayoutAuditEntry {
key_name: "TokenOwnedEscrow",
discriminant: 10,
decoder: "decode_token_owned_escrow_account",
lifecycle: "active",
},
- MetadataAccountLayoutAuditEntry {
+ DcMetadataMtmMetadataAccountLayoutAuditEntry {
key_name: "TokenRecord",
discriminant: 11,
decoder: "decode_token_record_account",
lifecycle: "active",
},
- MetadataAccountLayoutAuditEntry {
+ DcMetadataMtmMetadataAccountLayoutAuditEntry {
key_name: "MetadataDelegate",
discriminant: 12,
decoder: "decode_metadata_delegate_record_account",
lifecycle: "active",
},
- MetadataAccountLayoutAuditEntry {
+ DcMetadataMtmMetadataAccountLayoutAuditEntry {
key_name: "EditionMarkerV2",
discriminant: 13,
decoder: "decode_edition_marker_account",
lifecycle: "active_experimental",
},
- MetadataAccountLayoutAuditEntry {
+ DcMetadataMtmMetadataAccountLayoutAuditEntry {
key_name: "HolderDelegate",
discriminant: 14,
decoder: "decode_holder_delegate_record_account",
@@ -201,7 +202,7 @@ pub const METADATA_ACCOUNT_LAYOUT_AUDIT: &[MetadataAccountLayoutAuditEntry] = &[
/// Canonical bounded projection of one Metadata account.
#[derive(Clone, Debug, PartialEq)]
-pub struct MetadataAccountSnapshot {
+pub struct DcMetadataMtmMetadataAccountSnapshot {
/// Canonical account address.
pub account: String,
/// Canonical Metadata PDA bump.
@@ -227,21 +228,26 @@ pub struct MetadataAccountSnapshot {
}
/// Decodes one Metadata account after validating owner, bounds and canonical PDA.
-pub fn decode_metadata_account(
+pub fn decoder_metadata_metaplex_token_metadata_decode_metadata_account(
account: &str,
owner: &str,
data: &[u8],
-) -> std::result::Result {
+) -> std::result::Result<
+ DcMetadataMtmMetadataAccountSnapshot,
+ DcMetadataMtmMetadataAccountDecodeError,
+> {
let account_key = match ::from_str(account) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
let owner_key = match ::from_str(owner) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::InvalidOwner);
},
};
let expected_owner = match ::from_str(
@@ -249,48 +255,62 @@ pub fn decode_metadata_account(
) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::InvalidOwner);
},
};
if owner_key != expected_owner {
- return std::result::Result::Err(MetadataAccountDecodeError::ForeignOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::ForeignOwner);
}
if data.is_empty() || data.len() > MAX_METADATA_ACCOUNT_BYTES {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidDataLength);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength,
+ );
}
let metadata = match mpl_token_metadata::accounts::Metadata::from_bytes(data) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
if metadata.key != mpl_token_metadata::types::Key::MetadataV1 {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataKey,
+ );
}
let name = metadata.name.trim_end_matches('\0').to_string();
let symbol = metadata.symbol.trim_end_matches('\0').to_string();
let uri = metadata.uri.trim_end_matches('\0').to_string();
if name.len() > MAX_NAME_BYTES || symbol.len() > MAX_SYMBOL_BYTES || uri.len() > MAX_URI_BYTES {
- return std::result::Result::Err(MetadataAccountDecodeError::MetadataBoundsExceeded);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::MetadataBoundsExceeded,
+ );
}
if metadata
.creators
.as_ref()
.is_some_and(|creators| return creators.len() > MAX_CREATORS)
{
- return std::result::Result::Err(MetadataAccountDecodeError::MetadataBoundsExceeded);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::MetadataBoundsExceeded,
+ );
}
let (expected_pda, bump) = mpl_token_metadata::accounts::Metadata::find_pda(&metadata.mint);
if account_key.to_string() != expected_pda.to_string() {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataPda);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataPda,
+ );
}
let payload_json = match serde_json::to_value(&metadata) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::ProjectionFailed);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::ProjectionFailed,
+ );
},
};
- return std::result::Result::Ok(MetadataAccountSnapshot {
+ return std::result::Result::Ok(DcMetadataMtmMetadataAccountSnapshot {
account: account_key.to_string(),
bump,
mint: metadata.mint.to_string(),
@@ -307,7 +327,7 @@ pub fn decode_metadata_account(
/// Supported edition account layout.
#[derive(Clone, Debug, Eq, PartialEq)]
-pub enum EditionAccountKind {
+pub enum DcMetadataMtmEditionAccountKind {
/// Historical Master Edition V1 layout.
MasterEditionV1,
/// Current Master Edition V2 layout.
@@ -318,7 +338,7 @@ pub enum EditionAccountKind {
/// Canonical bounded projection of one edition or master-edition account.
#[derive(Clone, Debug, PartialEq)]
-pub struct EditionAccountSnapshot {
+pub struct DcMetadataMtmEditionAccountSnapshot {
/// Canonical account address.
pub account: String,
/// Canonical edition PDA bump.
@@ -326,7 +346,7 @@ pub struct EditionAccountSnapshot {
/// Mint used to derive the edition PDA.
pub mint: String,
/// Decoded account layout.
- pub kind: EditionAccountKind,
+ pub kind: DcMetadataMtmEditionAccountKind,
/// Current printed supply for a master edition.
pub supply: std::option::Option,
/// Optional maximum supply for a master edition.
@@ -344,22 +364,25 @@ pub struct EditionAccountSnapshot {
}
/// Decodes one MasterEditionV1, MasterEditionV2 or Edition account with exact owner and PDA validation.
-pub fn decode_edition_account(
+pub fn decoder_metadata_metaplex_token_metadata_decode_edition_account(
account: &str,
owner: &str,
mint: &str,
data: &[u8],
-) -> std::result::Result {
+) -> std::result::Result
+{
let account_key = match ::from_str(account) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
let owner_key = match ::from_str(owner) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::InvalidOwner);
},
};
let expected_owner = match ::from_str(
@@ -367,25 +390,31 @@ pub fn decode_edition_account(
) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::InvalidOwner);
},
};
if owner_key != expected_owner {
- return std::result::Result::Err(MetadataAccountDecodeError::ForeignOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::ForeignOwner);
}
if data.is_empty() || data.len() > 128 {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidDataLength);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength,
+ );
}
let (expected_pda, bump) = match mint.parse() {
std::result::Result::Ok(mint_key) => {
mpl_token_metadata::accounts::MasterEdition::find_pda(&mint_key)
},
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
if account_key.to_string() != expected_pda.to_string() {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataPda);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataPda,
+ );
}
let key = data[0];
if key == mpl_token_metadata::types::Key::MasterEditionV1 as u8 {
@@ -393,20 +422,24 @@ pub fn decode_edition_account(
{
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
let payload_json = match serde_json::to_value(&value) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::ProjectionFailed);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::ProjectionFailed,
+ );
},
};
- return std::result::Result::Ok(EditionAccountSnapshot {
+ return std::result::Result::Ok(DcMetadataMtmEditionAccountSnapshot {
account: account_key.to_string(),
bump,
mint: mint.to_string(),
- kind: EditionAccountKind::MasterEditionV1,
+ kind: DcMetadataMtmEditionAccountKind::MasterEditionV1,
supply: std::option::Option::Some(value.supply),
max_supply: value.max_supply,
parent: std::option::Option::None,
@@ -422,20 +455,24 @@ pub fn decode_edition_account(
let value = match mpl_token_metadata::accounts::MasterEdition::from_bytes(data) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
let payload_json = match serde_json::to_value(&value) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::ProjectionFailed);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::ProjectionFailed,
+ );
},
};
- return std::result::Result::Ok(EditionAccountSnapshot {
+ return std::result::Result::Ok(DcMetadataMtmEditionAccountSnapshot {
account: account_key.to_string(),
bump,
mint: mint.to_string(),
- kind: EditionAccountKind::MasterEditionV2,
+ kind: DcMetadataMtmEditionAccountKind::MasterEditionV2,
supply: std::option::Option::Some(value.supply),
max_supply: value.max_supply,
parent: std::option::Option::None,
@@ -447,25 +484,31 @@ pub fn decode_edition_account(
}
if key == mpl_token_metadata::types::Key::EditionV1 as u8 {
if data.len() != mpl_token_metadata::accounts::Edition::LEN {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidDataLength);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength,
+ );
}
let value = match mpl_token_metadata::accounts::Edition::from_bytes(data) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
let payload_json = match serde_json::to_value(&value) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::ProjectionFailed);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::ProjectionFailed,
+ );
},
};
- return std::result::Result::Ok(EditionAccountSnapshot {
+ return std::result::Result::Ok(DcMetadataMtmEditionAccountSnapshot {
account: account_key.to_string(),
bump,
mint: mint.to_string(),
- kind: EditionAccountKind::EditionV1,
+ kind: DcMetadataMtmEditionAccountKind::EditionV1,
supply: std::option::Option::None,
max_supply: std::option::Option::None,
parent: std::option::Option::Some(value.parent.to_string()),
@@ -475,12 +518,12 @@ pub fn decode_edition_account(
payload_json,
});
}
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataKey);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataKey);
}
/// Supported Edition Marker account layout.
#[derive(Clone, Debug, Eq, PartialEq)]
-pub enum EditionMarkerAccountKind {
+pub enum DcMetadataMtmEditionMarkerAccountKind {
/// Fixed 248-edition historical/current marker layout.
EditionMarkerV1,
/// Extensible marker layout with one PDA per mint.
@@ -489,7 +532,7 @@ pub enum EditionMarkerAccountKind {
/// Canonical bounded projection of one Edition Marker account.
#[derive(Clone, Debug, PartialEq)]
-pub struct EditionMarkerAccountSnapshot {
+pub struct DcMetadataMtmEditionMarkerAccountSnapshot {
/// Canonical account address.
pub account: String,
/// Canonical PDA bump.
@@ -497,7 +540,7 @@ pub struct EditionMarkerAccountSnapshot {
/// Mint used to derive the marker PDA.
pub mint: String,
/// Decoded marker layout.
- pub kind: EditionMarkerAccountKind,
+ pub kind: DcMetadataMtmEditionMarkerAccountKind,
/// V1 group number (`edition / 248`), absent for V2.
pub marker_group: std::option::Option,
/// Requested edition used to inspect the bitmap.
@@ -515,23 +558,28 @@ pub struct EditionMarkerAccountSnapshot {
}
/// Decodes EditionMarker or EditionMarkerV2 with exact owner, bounds, bitmap and PDA validation.
-pub fn decode_edition_marker_account(
+pub fn decoder_metadata_metaplex_token_metadata_decode_edition_marker_account(
account: &str,
owner: &str,
mint: &str,
edition: u64,
data: &[u8],
-) -> std::result::Result {
+) -> std::result::Result<
+ DcMetadataMtmEditionMarkerAccountSnapshot,
+ DcMetadataMtmMetadataAccountDecodeError,
+> {
let account_key = match ::from_str(account) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
let owner_key = match ::from_str(owner) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::InvalidOwner);
},
};
let program_key = match ::from_str(
@@ -539,24 +587,30 @@ pub fn decode_edition_marker_account(
) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::InvalidOwner);
},
};
if owner_key != program_key {
- return std::result::Result::Err(MetadataAccountDecodeError::ForeignOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::ForeignOwner);
}
let mint_key = match ::from_str(mint) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
if data.is_empty() {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidDataLength);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength,
+ );
}
if data[0] == mpl_token_metadata::types::Key::EditionMarker as u8 {
if data.len() != mpl_token_metadata::accounts::EditionMarker::LEN {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidDataLength);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength,
+ );
}
let marker_group = edition / EDITION_MARKER_V1_BITS;
let marker_seed = marker_group.to_string();
@@ -571,12 +625,16 @@ pub fn decode_edition_marker_account(
&program_key,
);
if account_key != expected_pda {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidEditionMarkerPda);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidEditionMarkerPda,
+ );
}
let value = match mpl_token_metadata::accounts::EditionMarker::from_bytes(data) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
let offset = (edition % EDITION_MARKER_V1_BITS) as usize;
@@ -585,14 +643,16 @@ pub fn decode_edition_marker_account(
let payload_json = match serde_json::to_value(&value) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::ProjectionFailed);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::ProjectionFailed,
+ );
},
};
- return std::result::Result::Ok(EditionMarkerAccountSnapshot {
+ return std::result::Result::Ok(DcMetadataMtmEditionMarkerAccountSnapshot {
account: account_key.to_string(),
bump,
mint: mint_key.to_string(),
- kind: EditionMarkerAccountKind::EditionMarkerV1,
+ kind: DcMetadataMtmEditionMarkerAccountKind::EditionMarkerV1,
marker_group: std::option::Option::Some(marker_group),
edition,
byte_index,
@@ -604,35 +664,43 @@ pub fn decode_edition_marker_account(
}
if data[0] == mpl_token_metadata::types::Key::EditionMarkerV2 as u8 {
if data.len() < 5 || data.len() > MAX_EDITION_MARKER_V2_LEDGER_BYTES + 5 {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidDataLength);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength,
+ );
}
let (expected_pda, bump) = solana_pubkey::Pubkey::find_program_address(
&[b"metadata", program_key.as_ref(), mint_key.as_ref(), b"edition", b"marker"],
&program_key,
);
if account_key != expected_pda {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidEditionMarkerPda);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidEditionMarkerPda,
+ );
}
let value = match mpl_token_metadata::accounts::EditionMarkerV2::from_bytes(data) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
if value.ledger.len() > MAX_EDITION_MARKER_V2_LEDGER_BYTES {
return std::result::Result::Err(
- MetadataAccountDecodeError::EditionMarkerBoundsExceeded,
+ DcMetadataMtmMetadataAccountDecodeError::EditionMarkerBoundsExceeded,
);
}
if data.len() != value.ledger.len() + 5 {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidDataLength);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength,
+ );
}
let byte_index_u64 = edition / 8;
let byte_index = match usize::try_from(byte_index_u64) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
return std::result::Result::Err(
- MetadataAccountDecodeError::EditionMarkerBoundsExceeded,
+ DcMetadataMtmMetadataAccountDecodeError::EditionMarkerBoundsExceeded,
);
},
};
@@ -642,14 +710,16 @@ pub fn decode_edition_marker_account(
let payload_json = match serde_json::to_value(&value) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::ProjectionFailed);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::ProjectionFailed,
+ );
},
};
- return std::result::Result::Ok(EditionMarkerAccountSnapshot {
+ return std::result::Result::Ok(DcMetadataMtmEditionMarkerAccountSnapshot {
account: account_key.to_string(),
bump,
mint: mint_key.to_string(),
- kind: EditionMarkerAccountKind::EditionMarkerV2,
+ kind: DcMetadataMtmEditionMarkerAccountKind::EditionMarkerV2,
marker_group: std::option::Option::None,
edition,
byte_index,
@@ -659,12 +729,12 @@ pub fn decode_edition_marker_account(
payload_json,
});
}
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataKey);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataKey);
}
/// Canonical bounded projection of one programmable Token Record account.
#[derive(Clone, Debug, PartialEq)]
-pub struct TokenRecordAccountSnapshot {
+pub struct DcMetadataMtmTokenRecordAccountSnapshot {
/// Canonical Token Record account address.
pub account: String,
/// Canonical Token Record PDA bump computed from mint and token account.
@@ -692,23 +762,28 @@ pub struct TokenRecordAccountSnapshot {
}
/// Decodes one Token Record account after exact owner, length, discriminant and PDA validation.
-pub fn decode_token_record_account(
+pub fn decoder_metadata_metaplex_token_metadata_decode_token_record_account(
account: &str,
owner: &str,
mint: &str,
token: &str,
data: &[u8],
-) -> std::result::Result {
+) -> std::result::Result<
+ DcMetadataMtmTokenRecordAccountSnapshot,
+ DcMetadataMtmMetadataAccountDecodeError,
+> {
let account_key = match ::from_str(account) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
let owner_key = match ::from_str(owner) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::InvalidOwner);
},
};
let expected_owner = match ::from_str(
@@ -716,25 +791,31 @@ pub fn decode_token_record_account(
) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::InvalidOwner);
},
};
if owner_key != expected_owner {
- return std::result::Result::Err(MetadataAccountDecodeError::ForeignOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::ForeignOwner);
}
if data.len() != mpl_token_metadata::accounts::TokenRecord::LEN {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidDataLength);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength,
+ );
}
let mint_key = match ::from_str(mint) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
let token_key = match ::from_str(token) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
let (expected_pda, bump) = solana_pubkey::Pubkey::find_program_address(
@@ -748,30 +829,40 @@ pub fn decode_token_record_account(
&expected_owner,
);
if account_key != expected_pda {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidTokenRecordPda);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidTokenRecordPda,
+ );
}
let value = match mpl_token_metadata::accounts::TokenRecord::from_bytes(data) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
if value.key != mpl_token_metadata::types::Key::TokenRecord {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidTokenRecordKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidTokenRecordKey,
+ );
}
if value.bump != bump {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidTokenRecordPda);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidTokenRecordPda,
+ );
}
let payload_json = match serde_json::to_value(&value) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::ProjectionFailed);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::ProjectionFailed,
+ );
},
};
let state = format!("{:?}", value.state);
let delegate_role = value.delegate_role.as_ref().map(|role| return format!("{role:?}"));
let locked = value.state == mpl_token_metadata::types::TokenState::Locked;
- return std::result::Result::Ok(TokenRecordAccountSnapshot {
+ return std::result::Result::Ok(DcMetadataMtmTokenRecordAccountSnapshot {
account: account_key.to_string(),
bump,
mint: mint_key.to_string(),
@@ -791,7 +882,7 @@ pub fn decode_token_record_account(
/// Canonical projection shared by Metadata and Holder delegate records.
#[derive(Clone, Debug, PartialEq)]
-pub struct DelegateRecordAccountSnapshot {
+pub struct DcMetadataMtmDelegateRecordAccountSnapshot {
/// Canonical delegate-record account address.
pub account: String,
/// Canonical PDA bump.
@@ -817,18 +908,22 @@ pub struct DelegateRecordAccountSnapshot {
fn parse_record_boundary(
account: &str,
owner: &str,
-) -> std::result::Result<(solana_pubkey::Pubkey, solana_pubkey::Pubkey), MetadataAccountDecodeError>
-{
+) -> std::result::Result<
+ (solana_pubkey::Pubkey, solana_pubkey::Pubkey),
+ DcMetadataMtmMetadataAccountDecodeError,
+> {
let account_key = match ::from_str(account) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
let owner_key = match ::from_str(owner) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::InvalidOwner);
},
};
let expected_owner = match ::from_str(
@@ -836,44 +931,55 @@ fn parse_record_boundary(
) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::InvalidOwner);
},
};
if owner_key != expected_owner {
- return std::result::Result::Err(MetadataAccountDecodeError::ForeignOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::ForeignOwner);
}
return std::result::Result::Ok((account_key, expected_owner));
}
/// Decodes a Metadata Delegate Record with exact role, authority, delegate and bump validation.
-pub fn decode_metadata_delegate_record_account(
+pub fn decoder_metadata_metaplex_token_metadata_decode_metadata_delegate_record_account(
account: &str,
owner: &str,
role: mpl_token_metadata::types::MetadataDelegateRole,
data: &[u8],
-) -> std::result::Result {
+) -> std::result::Result<
+ DcMetadataMtmDelegateRecordAccountSnapshot,
+ DcMetadataMtmMetadataAccountDecodeError,
+> {
let (account_key, program) = match parse_record_boundary(account, owner) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
if data.len() != mpl_token_metadata::accounts::MetadataDelegateRecord::LEN {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidDataLength);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength,
+ );
}
let value = match mpl_token_metadata::accounts::MetadataDelegateRecord::from_bytes(data) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
if value.key != mpl_token_metadata::types::Key::MetadataDelegate {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAuthorityRecordKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAuthorityRecordKey,
+ );
}
let role_seed = role.to_string();
let mint = match ::from_str(&value.mint.to_string())
{
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
let authority = match ::from_str(
@@ -881,14 +987,18 @@ pub fn decode_metadata_delegate_record_account(
) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
let delegate =
match ::from_str(&value.delegate.to_string()) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
let (expected_pda, bump) = solana_pubkey::Pubkey::find_program_address(
@@ -903,15 +1013,19 @@ pub fn decode_metadata_delegate_record_account(
&program,
);
if account_key != expected_pda || value.bump != bump {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAuthorityRecordPda);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAuthorityRecordPda,
+ );
}
let payload_json = match serde_json::to_value(&value) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::ProjectionFailed);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::ProjectionFailed,
+ );
},
};
- return std::result::Result::Ok(DelegateRecordAccountSnapshot {
+ return std::result::Result::Ok(DcMetadataMtmDelegateRecordAccountSnapshot {
account: account_key.to_string(),
bump,
kind: "MetadataDelegateRecord".to_string(),
@@ -926,33 +1040,44 @@ pub fn decode_metadata_delegate_record_account(
}
/// Decodes a Holder Delegate Record with exact role, holder, delegate and bump validation.
-pub fn decode_holder_delegate_record_account(
+pub fn decoder_metadata_metaplex_token_metadata_decode_holder_delegate_record_account(
account: &str,
owner: &str,
holder: &str,
role: mpl_token_metadata::types::HolderDelegateRole,
data: &[u8],
-) -> std::result::Result {
+) -> std::result::Result<
+ DcMetadataMtmDelegateRecordAccountSnapshot,
+ DcMetadataMtmMetadataAccountDecodeError,
+> {
let (account_key, program) = match parse_record_boundary(account, owner) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
if data.len() != mpl_token_metadata::accounts::HolderDelegateRecord::LEN {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidDataLength);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength,
+ );
}
let value = match mpl_token_metadata::accounts::HolderDelegateRecord::from_bytes(data) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
if value.key != mpl_token_metadata::types::Key::HolderDelegate {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAuthorityRecordKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAuthorityRecordKey,
+ );
}
let holder_key = match ::from_str(holder) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
let role_seed = role.to_string();
@@ -960,14 +1085,18 @@ pub fn decode_holder_delegate_record_account(
{
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
let delegate =
match ::from_str(&value.delegate.to_string()) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
let (expected_pda, bump) = solana_pubkey::Pubkey::find_program_address(
@@ -982,15 +1111,19 @@ pub fn decode_holder_delegate_record_account(
&program,
);
if account_key != expected_pda || value.bump != bump {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAuthorityRecordPda);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAuthorityRecordPda,
+ );
}
let payload_json = match serde_json::to_value(&value) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::ProjectionFailed);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::ProjectionFailed,
+ );
},
};
- return std::result::Result::Ok(DelegateRecordAccountSnapshot {
+ return std::result::Result::Ok(DcMetadataMtmDelegateRecordAccountSnapshot {
account: account_key.to_string(),
bump,
kind: "HolderDelegateRecord".to_string(),
@@ -1006,7 +1139,7 @@ pub fn decode_holder_delegate_record_account(
/// Canonical projection of Collection Authority and Use Authority records.
#[derive(Clone, Debug, PartialEq)]
-pub struct AuthorityRecordAccountSnapshot {
+pub struct DcMetadataMtmAuthorityRecordAccountSnapshot {
/// Canonical record account address.
pub account: String,
/// Canonical PDA bump.
@@ -1028,30 +1161,39 @@ pub struct AuthorityRecordAccountSnapshot {
}
/// Decodes a Collection Authority Record with exact PDA and bump validation.
-pub fn decode_collection_authority_record_account(
+pub fn decoder_metadata_metaplex_token_metadata_decode_collection_authority_record_account(
account: &str,
owner: &str,
mint: &str,
authority: &str,
data: &[u8],
-) -> std::result::Result {
+) -> std::result::Result<
+ DcMetadataMtmAuthorityRecordAccountSnapshot,
+ DcMetadataMtmMetadataAccountDecodeError,
+> {
let (account_key, program) = match parse_record_boundary(account, owner) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
if data.len() != 3 && data.len() != 35 {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidDataLength);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength,
+ );
}
let mint_key = match ::from_str(mint) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
let authority_key = match ::from_str(authority) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
let (expected_pda, bump) = solana_pubkey::Pubkey::find_program_address(
@@ -1065,27 +1207,37 @@ pub fn decode_collection_authority_record_account(
&program,
);
if account_key != expected_pda {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAuthorityRecordPda);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAuthorityRecordPda,
+ );
}
let value = match mpl_token_metadata::accounts::CollectionAuthorityRecord::from_bytes(data) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
if value.key != mpl_token_metadata::types::Key::CollectionAuthorityRecord {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAuthorityRecordKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAuthorityRecordKey,
+ );
}
if value.bump != bump {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAuthorityRecordPda);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAuthorityRecordPda,
+ );
}
let payload_json = match serde_json::to_value(&value) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::ProjectionFailed);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::ProjectionFailed,
+ );
},
};
- return std::result::Result::Ok(AuthorityRecordAccountSnapshot {
+ return std::result::Result::Ok(DcMetadataMtmAuthorityRecordAccountSnapshot {
account: account_key.to_string(),
bump,
kind: "CollectionAuthorityRecord".to_string(),
@@ -1099,30 +1251,39 @@ pub fn decode_collection_authority_record_account(
}
/// Decodes a Use Authority Record with exact length, PDA and bump validation.
-pub fn decode_use_authority_record_account(
+pub fn decoder_metadata_metaplex_token_metadata_decode_use_authority_record_account(
account: &str,
owner: &str,
mint: &str,
authority: &str,
data: &[u8],
-) -> std::result::Result {
+) -> std::result::Result<
+ DcMetadataMtmAuthorityRecordAccountSnapshot,
+ DcMetadataMtmMetadataAccountDecodeError,
+> {
let (account_key, program) = match parse_record_boundary(account, owner) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
if data.len() != mpl_token_metadata::accounts::UseAuthorityRecord::LEN {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidDataLength);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength,
+ );
}
let mint_key = match ::from_str(mint) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
let authority_key = match ::from_str(authority) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
let (expected_pda, bump) = solana_pubkey::Pubkey::find_program_address(
@@ -1136,27 +1297,37 @@ pub fn decode_use_authority_record_account(
&program,
);
if account_key != expected_pda {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAuthorityRecordPda);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAuthorityRecordPda,
+ );
}
let value = match mpl_token_metadata::accounts::UseAuthorityRecord::from_bytes(data) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
if value.key != mpl_token_metadata::types::Key::UseAuthorityRecord {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAuthorityRecordKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAuthorityRecordKey,
+ );
}
if value.bump != bump {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAuthorityRecordPda);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAuthorityRecordPda,
+ );
}
let payload_json = match serde_json::to_value(&value) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::ProjectionFailed);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::ProjectionFailed,
+ );
},
};
- return std::result::Result::Ok(AuthorityRecordAccountSnapshot {
+ return std::result::Result::Ok(DcMetadataMtmAuthorityRecordAccountSnapshot {
account: account_key.to_string(),
bump,
kind: "UseAuthorityRecord".to_string(),
@@ -1171,7 +1342,7 @@ pub fn decode_use_authority_record_account(
/// Authority form used by one Token Owned Escrow account.
#[derive(Clone, Debug, Eq, PartialEq)]
-pub enum TokenOwnedEscrowAuthorityKind {
+pub enum DcMetadataMtmTokenOwnedEscrowAuthorityKind {
/// Escrow controlled by the owner of the base token.
TokenOwner,
/// Escrow controlled by an explicit creator key.
@@ -1180,7 +1351,7 @@ pub enum TokenOwnedEscrowAuthorityKind {
/// Canonical bounded projection of one Token Owned Escrow account.
#[derive(Clone, Debug, PartialEq)]
-pub struct TokenOwnedEscrowAccountSnapshot {
+pub struct DcMetadataMtmTokenOwnedEscrowAccountSnapshot {
/// Canonical escrow account address.
pub account: String,
/// Canonical PDA bump.
@@ -1188,7 +1359,7 @@ pub struct TokenOwnedEscrowAccountSnapshot {
/// Base token mint stored by the account.
pub base_token: String,
/// Authority form encoded by the account.
- pub authority_kind: TokenOwnedEscrowAuthorityKind,
+ pub authority_kind: DcMetadataMtmTokenOwnedEscrowAuthorityKind,
/// Optional creator authority.
pub creator: std::option::Option,
/// Bump stored by the account.
@@ -1198,33 +1369,44 @@ pub struct TokenOwnedEscrowAccountSnapshot {
}
/// Decodes one Token Owned Escrow account with exact owner, layout, authority seeds and bump validation.
-pub fn decode_token_owned_escrow_account(
+pub fn decoder_metadata_metaplex_token_metadata_decode_token_owned_escrow_account(
account: &str,
owner: &str,
data: &[u8],
-) -> std::result::Result {
+) -> std::result::Result<
+ DcMetadataMtmTokenOwnedEscrowAccountSnapshot,
+ DcMetadataMtmMetadataAccountDecodeError,
+> {
let (account_key, program) = match parse_record_boundary(account, owner) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
if data.len() != 35 && data.len() != 67 {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidDataLength);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength,
+ );
}
let value = match mpl_token_metadata::accounts::TokenOwnedEscrow::from_bytes(data) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
if value.key != mpl_token_metadata::types::Key::TokenOwnedEscrow {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidTokenOwnedEscrowKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidTokenOwnedEscrowKey,
+ );
}
let base_token =
match ::from_str(&value.base_token.to_string())
{
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
let (authority_kind, creator, expected_pda, bump) = match &value.authority {
@@ -1234,7 +1416,7 @@ pub fn decode_token_owned_escrow_account(
&program,
);
(
- TokenOwnedEscrowAuthorityKind::TokenOwner,
+ DcMetadataMtmTokenOwnedEscrowAuthorityKind::TokenOwner,
std::option::Option::None,
expected_pda,
bump,
@@ -1247,7 +1429,7 @@ pub fn decode_token_owned_escrow_account(
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
return std::result::Result::Err(
- MetadataAccountDecodeError::InvalidAccountKey,
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
);
},
};
@@ -1263,7 +1445,7 @@ pub fn decode_token_owned_escrow_account(
&program,
);
(
- TokenOwnedEscrowAuthorityKind::Creator,
+ DcMetadataMtmTokenOwnedEscrowAuthorityKind::Creator,
std::option::Option::Some(creator_text),
expected_pda,
bump,
@@ -1271,15 +1453,19 @@ pub fn decode_token_owned_escrow_account(
},
};
if account_key != expected_pda || value.bump != bump {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidTokenOwnedEscrowPda);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidTokenOwnedEscrowPda,
+ );
}
let payload_json = match serde_json::to_value(&value) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::ProjectionFailed);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::ProjectionFailed,
+ );
},
};
- return std::result::Result::Ok(TokenOwnedEscrowAccountSnapshot {
+ return std::result::Result::Ok(DcMetadataMtmTokenOwnedEscrowAccountSnapshot {
account: account_key.to_string(),
bump,
base_token: value.base_token.to_string(),
@@ -1292,7 +1478,7 @@ pub fn decode_token_owned_escrow_account(
/// Historical Reservation List account generation.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
-pub enum ReservationListAccountKind {
+pub enum DcMetadataMtmReservationListAccountKind {
/// Legacy layout with `u8` spot counters.
V1,
/// Later historical layout with `u64` spot counters and cached totals.
@@ -1301,7 +1487,7 @@ pub enum ReservationListAccountKind {
/// One bounded historical reservation entry.
#[derive(Clone, Debug, Eq, PartialEq)]
-pub struct ReservationEntrySnapshot {
+pub struct DcMetadataMtmReservationEntrySnapshot {
/// Reserved address.
pub address: String,
/// Spots still available for the address.
@@ -1312,13 +1498,13 @@ pub struct ReservationEntrySnapshot {
/// Canonical decode-only projection of a historical Reservation List account.
#[derive(Clone, Debug, PartialEq)]
-pub struct ReservationListAccountSnapshot {
+pub struct DcMetadataMtmReservationListAccountSnapshot {
/// Canonical account address.
pub account: String,
/// Canonical Reservation List PDA bump.
pub bump: u8,
/// Historical account generation.
- pub kind: ReservationListAccountKind,
+ pub kind: DcMetadataMtmReservationListAccountKind,
/// Master Edition stored by the account.
pub master_edition: String,
/// Resource key used by the PDA derivation.
@@ -1326,7 +1512,7 @@ pub struct ReservationListAccountSnapshot {
/// Master Edition supply captured when reservations were created.
pub supply_snapshot: std::option::Option,
/// Bounded reservation entries.
- pub reservations: std::vec::Vec,
+ pub reservations: std::vec::Vec,
/// Total reservation spots. V1 derives this value from entries.
pub total_reservation_spots: u64,
/// Current reservation spots. V1 derives this value from entries.
@@ -1373,31 +1559,38 @@ fn read_reservation_pubkey(
}
/// Decodes a historical Reservation List V1 or V2 account as decode-only state.
-pub fn decode_reservation_list_account(
+pub fn decoder_metadata_metaplex_token_metadata_decode_reservation_list_account(
account: &str,
owner: &str,
resource: &str,
data: &[u8],
-) -> std::result::Result {
+) -> std::result::Result<
+ DcMetadataMtmReservationListAccountSnapshot,
+ DcMetadataMtmMetadataAccountDecodeError,
+> {
const MAX_RESERVATIONS: usize = 200;
const MAX_V1_BYTES: usize = 6_949;
const MAX_V2_BYTES: usize = 9_749;
let account_key = match ::from_str(account) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
let owner_key = match ::from_str(owner) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::InvalidOwner);
},
};
let resource_key = match ::from_str(resource) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidAccountKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidAccountKey,
+ );
},
};
let program_key = match ::from_str(
@@ -1405,39 +1598,49 @@ pub fn decode_reservation_list_account(
) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::InvalidOwner);
},
};
if owner_key != program_key {
- return std::result::Result::Err(MetadataAccountDecodeError::ForeignOwner);
+ return std::result::Result::Err(DcMetadataMtmMetadataAccountDecodeError::ForeignOwner);
}
let key = match data.first() {
std::option::Option::Some(value) => *value,
std::option::Option::None => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidDataLength);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength,
+ );
},
};
let (kind, maximum, entry_bytes) = match key {
- 3 => (ReservationListAccountKind::V1, MAX_V1_BYTES, 34usize),
- 5 => (ReservationListAccountKind::V2, MAX_V2_BYTES, 48usize),
+ 3 => (DcMetadataMtmReservationListAccountKind::V1, MAX_V1_BYTES, 34usize),
+ 5 => (DcMetadataMtmReservationListAccountKind::V2, MAX_V2_BYTES, 48usize),
_ => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidReservationListKey);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidReservationListKey,
+ );
},
};
if data.len() > maximum {
- return std::result::Result::Err(MetadataAccountDecodeError::ReservationListBoundsExceeded);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::ReservationListBoundsExceeded,
+ );
}
let mut offset = 1usize;
let master_edition = match read_reservation_pubkey(data, &mut offset) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
let option_tag = match data.get(offset) {
std::option::Option::Some(value) => *value,
std::option::Option::None => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
offset += 1;
@@ -1446,60 +1649,78 @@ pub fn decode_reservation_list_account(
1 => match read_reservation_u64(data, &mut offset) {
std::option::Option::Some(value) => std::option::Option::Some(value),
std::option::Option::None => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
},
- _ => return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout),
+ _ => {
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
+ },
};
let count_end = match offset.checked_add(4) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
let count_bytes = match data.get(offset..count_end) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
let count_array = match <[u8; 4]>::try_from(count_bytes) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_) => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
let count = u32::from_le_bytes(count_array) as usize;
offset = count_end;
if count > MAX_RESERVATIONS {
- return std::result::Result::Err(MetadataAccountDecodeError::ReservationListBoundsExceeded);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::ReservationListBoundsExceeded,
+ );
}
let required_entries = match count.checked_mul(entry_bytes) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
return std::result::Result::Err(
- MetadataAccountDecodeError::ReservationListBoundsExceeded,
+ DcMetadataMtmMetadataAccountDecodeError::ReservationListBoundsExceeded,
);
},
};
if data.len().saturating_sub(offset) < required_entries {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
}
let mut reservations = std::vec::Vec::with_capacity(count);
for _ in 0..count {
let address = match read_reservation_pubkey(data, &mut offset) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
},
};
let (spots_remaining, total_spots) = match kind {
- ReservationListAccountKind::V1 => {
+ DcMetadataMtmReservationListAccountKind::V1 => {
let remaining = match data.get(offset) {
std::option::Option::Some(value) => *value as u64,
std::option::Option::None => {
return std::result::Result::Err(
- MetadataAccountDecodeError::InvalidMetadataLayout,
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
);
},
};
@@ -1507,19 +1728,19 @@ pub fn decode_reservation_list_account(
std::option::Option::Some(value) => *value as u64,
std::option::Option::None => {
return std::result::Result::Err(
- MetadataAccountDecodeError::InvalidMetadataLayout,
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
);
},
};
offset += 2;
(remaining, total)
},
- ReservationListAccountKind::V2 => {
+ DcMetadataMtmReservationListAccountKind::V2 => {
let remaining = match read_reservation_u64(data, &mut offset) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
return std::result::Result::Err(
- MetadataAccountDecodeError::InvalidMetadataLayout,
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
);
},
};
@@ -1527,14 +1748,14 @@ pub fn decode_reservation_list_account(
std::option::Option::Some(value) => value,
std::option::Option::None => {
return std::result::Result::Err(
- MetadataAccountDecodeError::InvalidMetadataLayout,
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
);
},
};
(remaining, total)
},
};
- reservations.push(ReservationEntrySnapshot {
+ reservations.push(DcMetadataMtmReservationEntrySnapshot {
address: address.to_string(),
spots_remaining,
total_spots,
@@ -1544,13 +1765,13 @@ pub fn decode_reservation_list_account(
.iter()
.fold(0u64, |sum, entry| return sum.saturating_add(entry.total_spots));
let (total_reservation_spots, current_reservation_spots) = match kind {
- ReservationListAccountKind::V1 => (derived_total, derived_total),
- ReservationListAccountKind::V2 => {
+ DcMetadataMtmReservationListAccountKind::V1 => (derived_total, derived_total),
+ DcMetadataMtmReservationListAccountKind::V2 => {
let total = match read_reservation_u64(data, &mut offset) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
return std::result::Result::Err(
- MetadataAccountDecodeError::InvalidMetadataLayout,
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
);
},
};
@@ -1558,7 +1779,7 @@ pub fn decode_reservation_list_account(
std::option::Option::Some(value) => value,
std::option::Option::None => {
return std::result::Result::Err(
- MetadataAccountDecodeError::InvalidMetadataLayout,
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
);
},
};
@@ -1569,7 +1790,9 @@ pub fn decode_reservation_list_account(
.get(offset..)
.is_some_and(|suffix| return suffix.iter().any(|byte| return *byte != 0))
{
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidMetadataLayout);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout,
+ );
}
let (expected_pda, bump) = solana_pubkey::Pubkey::find_program_address(
&[
@@ -1582,10 +1805,12 @@ pub fn decode_reservation_list_account(
&program_key,
);
if account_key != expected_pda {
- return std::result::Result::Err(MetadataAccountDecodeError::InvalidReservationListPda);
+ return std::result::Result::Err(
+ DcMetadataMtmMetadataAccountDecodeError::InvalidReservationListPda,
+ );
}
let payload_json = serde_json::json!({
- "kind": match kind { ReservationListAccountKind::V1 => "reservation_list_v1", ReservationListAccountKind::V2 => "reservation_list_v2" },
+ "kind": match kind { DcMetadataMtmReservationListAccountKind::V1 => "reservation_list_v1", DcMetadataMtmReservationListAccountKind::V2 => "reservation_list_v2" },
"master_edition": master_edition.to_string(),
"resource": resource_key.to_string(),
"supply_snapshot": supply_snapshot,
@@ -1593,7 +1818,7 @@ pub fn decode_reservation_list_account(
"total_reservation_spots": total_reservation_spots,
"current_reservation_spots": current_reservation_spots,
});
- return std::result::Result::Ok(ReservationListAccountSnapshot {
+ return std::result::Result::Ok(DcMetadataMtmReservationListAccountSnapshot {
account: account_key.to_string(),
bump,
kind,
@@ -1639,15 +1864,14 @@ mod tests {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => panic!("metadata serialization failed: {error}"),
};
- let snapshot =
- match crate::decoder::metadata::metaplex_token_metadata::decode_metadata_account(
- &account.to_string(),
- kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
- &data,
- ) {
- std::result::Result::Ok(value) => value,
- std::result::Result::Err(error) => panic!("metadata decode failed: {error}"),
- };
+ let snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_metadata_account(
+ &account.to_string(),
+ kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
+ &data,
+ ) {
+ std::result::Result::Ok(value) => value,
+ std::result::Result::Err(error) => panic!("metadata decode failed: {error}"),
+ };
assert_eq!(snapshot.bump, expected_bump);
assert_eq!(snapshot.mint, metadata.mint.to_string());
assert_eq!(snapshot.name, "Khadhroony");
@@ -1666,28 +1890,32 @@ mod tests {
std::result::Result::Err(error) => panic!("metadata serialization failed: {error}"),
};
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_metadata_account(
+ crate::decoder_metadata_metaplex_token_metadata_decode_metadata_account(
&account.to_string(),
&solana_pubkey::Pubkey::new_unique().to_string(),
&data
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::ForeignOwner),
+ std::result::Result::Err(crate::DcMetadataMtmMetadataAccountDecodeError::ForeignOwner),
);
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_metadata_account(
+ 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,
&data
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidMetadataPda),
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataPda
+ ),
);
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_metadata_account(
+ crate::decoder_metadata_metaplex_token_metadata_decode_metadata_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&[]
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidDataLength),
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength
+ ),
);
}
@@ -1707,7 +1935,7 @@ mod tests {
},
};
let master_v2_snapshot =
- match crate::decoder::metadata::metaplex_token_metadata::decode_edition_account(
+ match crate::decoder_metadata_metaplex_token_metadata_decode_edition_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&mint.to_string(),
@@ -1719,7 +1947,7 @@ mod tests {
assert_eq!(master_v2_snapshot.bump, expected_bump);
assert_eq!(
master_v2_snapshot.kind,
- crate::decoder::metadata::metaplex_token_metadata::EditionAccountKind::MasterEditionV2
+ crate::DcMetadataMtmEditionAccountKind::MasterEditionV2
);
assert_eq!(master_v2_snapshot.supply, std::option::Option::Some(7));
assert_eq!(master_v2_snapshot.max_supply, std::option::Option::Some(100));
@@ -1733,7 +1961,7 @@ mod tests {
std::result::Result::Err(error) => panic!("edition serialization failed: {error}"),
};
let edition_snapshot =
- match crate::decoder::metadata::metaplex_token_metadata::decode_edition_account(
+ match crate::decoder_metadata_metaplex_token_metadata_decode_edition_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&mint.to_string(),
@@ -1742,10 +1970,7 @@ mod tests {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => panic!("edition decode failed: {error}"),
};
- assert_eq!(
- edition_snapshot.kind,
- crate::decoder::metadata::metaplex_token_metadata::EditionAccountKind::EditionV1
- );
+ assert_eq!(edition_snapshot.kind, crate::DcMetadataMtmEditionAccountKind::EditionV1);
assert_eq!(edition_snapshot.parent, std::option::Option::Some(account.to_string()));
assert_eq!(edition_snapshot.edition, std::option::Option::Some(u64::MAX));
}
@@ -1767,43 +1992,43 @@ mod tests {
panic!("historical master edition serialization failed: {error}")
},
};
- let snapshot =
- match crate::decoder::metadata::metaplex_token_metadata::decode_edition_account(
- &account.to_string(),
- kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
- &mint.to_string(),
- &data,
- ) {
- std::result::Result::Ok(value) => value,
- std::result::Result::Err(error) => {
- panic!("historical master edition decode failed: {error}")
- },
- };
- assert_eq!(
- snapshot.kind,
- crate::decoder::metadata::metaplex_token_metadata::EditionAccountKind::MasterEditionV1
- );
+ let snapshot = match crate::decoder_metadata_metaplex_token_metadata_decode_edition_account(
+ &account.to_string(),
+ kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
+ &mint.to_string(),
+ &data,
+ ) {
+ std::result::Result::Ok(value) => value,
+ std::result::Result::Err(error) => {
+ panic!("historical master edition decode failed: {error}")
+ },
+ };
+ assert_eq!(snapshot.kind, crate::DcMetadataMtmEditionAccountKind::MasterEditionV1);
assert_eq!(
snapshot.printing_mint,
std::option::Option::Some(mpl_token_metadata::ID.to_string())
);
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_edition_account(
+ 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,
&mint.to_string(),
&data
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidMetadataPda),
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataPda
+ ),
);
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_edition_account(
+ crate::decoder_metadata_metaplex_token_metadata_decode_edition_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&mint.to_string(),
&[255]
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidMetadataKey),
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataKey
+ ),
);
}
@@ -1846,7 +2071,7 @@ mod tests {
},
};
let snapshot =
- match crate::decoder::metadata::metaplex_token_metadata::decode_edition_marker_account(
+ match crate::decoder_metadata_metaplex_token_metadata_decode_edition_marker_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&mint,
@@ -1856,7 +2081,7 @@ mod tests {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => panic!("edition marker decode failed: {error}"),
};
- assert_eq!(snapshot.kind, crate::decoder::metadata::metaplex_token_metadata::EditionMarkerAccountKind::EditionMarkerV1);
+ assert_eq!(snapshot.kind, crate::DcMetadataMtmEditionMarkerAccountKind::EditionMarkerV1);
assert_eq!(snapshot.bump, expected_bump);
assert_eq!(snapshot.marker_group, std::option::Option::Some(1));
assert_eq!(snapshot.byte_index, 0);
@@ -1892,7 +2117,7 @@ mod tests {
},
};
let snapshot =
- match crate::decoder::metadata::metaplex_token_metadata::decode_edition_marker_account(
+ match crate::decoder_metadata_metaplex_token_metadata_decode_edition_marker_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&mint,
@@ -1904,7 +2129,7 @@ mod tests {
panic!("edition marker v2 decode failed: {error}")
},
};
- assert_eq!(snapshot.kind, crate::decoder::metadata::metaplex_token_metadata::EditionMarkerAccountKind::EditionMarkerV2);
+ assert_eq!(snapshot.kind, crate::DcMetadataMtmEditionMarkerAccountKind::EditionMarkerV2);
assert_eq!(snapshot.bump, expected_bump);
assert_eq!(snapshot.marker_group, std::option::Option::None);
assert_eq!(snapshot.byte_index, 1);
@@ -1913,24 +2138,28 @@ mod tests {
let mut suffixed = data.clone();
suffixed.push(0);
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_edition_marker_account(
+ crate::decoder_metadata_metaplex_token_metadata_decode_edition_marker_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&mint,
9,
&suffixed
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidDataLength),
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength
+ ),
);
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_edition_marker_account(
+ 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,
&mint,
9,
&data
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidEditionMarkerPda),
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidEditionMarkerPda
+ ),
);
}
@@ -1965,7 +2194,7 @@ mod tests {
};
data.resize(mpl_token_metadata::accounts::TokenRecord::LEN, 0);
let snapshot =
- match crate::decoder::metadata::metaplex_token_metadata::decode_token_record_account(
+ match crate::decoder_metadata_metaplex_token_metadata_decode_token_record_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&mint.to_string(),
@@ -2026,57 +2255,65 @@ mod tests {
};
let data = make_data(mpl_token_metadata::types::Key::TokenRecord, bump);
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_token_record_account(
+ crate::decoder_metadata_metaplex_token_metadata_decode_token_record_account(
&account.to_string(),
&solana_pubkey::Pubkey::new_unique().to_string(),
&mint.to_string(),
&token.to_string(),
&data
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::ForeignOwner),
+ std::result::Result::Err(crate::DcMetadataMtmMetadataAccountDecodeError::ForeignOwner),
);
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_token_record_account(
+ 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,
&mint.to_string(),
&token.to_string(),
&data
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidTokenRecordPda),
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidTokenRecordPda
+ ),
);
let wrong_bump =
make_data(mpl_token_metadata::types::Key::TokenRecord, bump.wrapping_add(1));
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_token_record_account(
+ crate::decoder_metadata_metaplex_token_metadata_decode_token_record_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&mint.to_string(),
&token.to_string(),
&wrong_bump
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidTokenRecordPda),
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidTokenRecordPda
+ ),
);
let wrong_key = make_data(mpl_token_metadata::types::Key::MetadataV1, bump);
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_token_record_account(
+ crate::decoder_metadata_metaplex_token_metadata_decode_token_record_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&mint.to_string(),
&token.to_string(),
&wrong_key
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidTokenRecordKey),
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidTokenRecordKey
+ ),
);
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_token_record_account(
+ crate::decoder_metadata_metaplex_token_metadata_decode_token_record_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&mint.to_string(),
&token.to_string(),
&data[..data.len() - 1]
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidDataLength),
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength
+ ),
);
}
@@ -2118,7 +2355,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(
+ 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,
role,
@@ -2155,7 +2392,7 @@ mod tests {
panic!("holder delegate serialization failed: {error}")
},
};
- let holder_snapshot = match crate::decoder::metadata::metaplex_token_metadata::decode_holder_delegate_record_account(
+ 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,
&authority.to_string(),
@@ -2200,7 +2437,7 @@ mod tests {
panic!("collection authority serialization failed: {error}")
},
};
- let collection_snapshot = match crate::decoder::metadata::metaplex_token_metadata::decode_collection_authority_record_account(
+ 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,
&mint.to_string(),
@@ -2231,7 +2468,7 @@ mod tests {
panic!("use authority serialization failed: {error}")
},
};
- let use_snapshot = match crate::decoder::metadata::metaplex_token_metadata::decode_use_authority_record_account(
+ 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,
&mint.to_string(),
@@ -2243,24 +2480,28 @@ mod tests {
};
assert_eq!(use_snapshot.allowed_uses, std::option::Option::Some(u64::MAX));
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_use_authority_record_account(
+ 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,
&mint.to_string(),
&authority.to_string(),
&use_data
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidAuthorityRecordPda)
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidAuthorityRecordPda
+ )
);
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_use_authority_record_account(
+ crate::decoder_metadata_metaplex_token_metadata_decode_use_authority_record_account(
&use_account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&mint.to_string(),
&authority.to_string(),
&use_data[..9]
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidDataLength)
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength
+ )
);
}
@@ -2289,15 +2530,19 @@ mod tests {
std::result::Result::Err(error) => panic!("escrow serialization failed: {error}"),
};
assert_eq!(owner_data.len(), 35);
- 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,
- &owner_data,
- ) {
- std::result::Result::Ok(value) => value,
- std::result::Result::Err(error) => panic!("escrow decode failed: {error}"),
- };
- assert_eq!(owner_snapshot.authority_kind, crate::decoder::metadata::metaplex_token_metadata::TokenOwnedEscrowAuthorityKind::TokenOwner);
+ 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,
+ &owner_data,
+ ) {
+ std::result::Result::Ok(value) => value,
+ std::result::Result::Err(error) => panic!("escrow decode failed: {error}"),
+ };
+ assert_eq!(
+ owner_snapshot.authority_kind,
+ crate::DcMetadataMtmTokenOwnedEscrowAuthorityKind::TokenOwner
+ );
assert_eq!(owner_snapshot.creator, std::option::Option::None);
let creator = mpl_token_metadata::ID;
let (creator_account, creator_bump) = solana_pubkey::Pubkey::find_program_address(
@@ -2324,15 +2569,19 @@ mod tests {
},
};
assert_eq!(creator_data.len(), 67);
- 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,
- &creator_data,
- ) {
- std::result::Result::Ok(value) => value,
- std::result::Result::Err(error) => panic!("creator escrow decode failed: {error}"),
- };
- assert_eq!(creator_snapshot.authority_kind, crate::decoder::metadata::metaplex_token_metadata::TokenOwnedEscrowAuthorityKind::Creator);
+ 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,
+ &creator_data,
+ ) {
+ std::result::Result::Ok(value) => value,
+ std::result::Result::Err(error) => panic!("creator escrow decode failed: {error}"),
+ };
+ assert_eq!(
+ creator_snapshot.authority_kind,
+ crate::DcMetadataMtmTokenOwnedEscrowAuthorityKind::Creator
+ );
assert_eq!(
creator_snapshot.creator,
std::option::Option::Some(mpl_token_metadata::ID.to_string())
@@ -2365,39 +2614,47 @@ mod tests {
};
let data = make(mpl_token_metadata::types::Key::TokenOwnedEscrow, bump);
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_token_owned_escrow_account(
+ 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,
&data
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidTokenOwnedEscrowPda)
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidTokenOwnedEscrowPda
+ )
);
let wrong_bump =
make(mpl_token_metadata::types::Key::TokenOwnedEscrow, bump.wrapping_add(1));
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_token_owned_escrow_account(
+ crate::decoder_metadata_metaplex_token_metadata_decode_token_owned_escrow_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&wrong_bump
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidTokenOwnedEscrowPda)
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidTokenOwnedEscrowPda
+ )
);
let wrong_key = make(mpl_token_metadata::types::Key::MetadataV1, bump);
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_token_owned_escrow_account(
+ crate::decoder_metadata_metaplex_token_metadata_decode_token_owned_escrow_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&wrong_key
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidTokenOwnedEscrowKey)
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidTokenOwnedEscrowKey
+ )
);
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_token_owned_escrow_account(
+ crate::decoder_metadata_metaplex_token_metadata_decode_token_owned_escrow_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&data[..34]
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidDataLength)
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidDataLength
+ )
);
}
@@ -2431,7 +2688,7 @@ mod tests {
v1.push(2);
v1.push(3);
let snapshot =
- match crate::decoder::metadata::metaplex_token_metadata::decode_reservation_list_account(
+ match crate::decoder_metadata_metaplex_token_metadata_decode_reservation_list_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&resource.to_string(),
@@ -2440,10 +2697,7 @@ mod tests {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => panic!("reservation v1 decode failed: {error}"),
};
- assert_eq!(
- snapshot.kind,
- crate::decoder::metadata::metaplex_token_metadata::ReservationListAccountKind::V1
- );
+ assert_eq!(snapshot.kind, crate::DcMetadataMtmReservationListAccountKind::V1);
assert_eq!(snapshot.supply_snapshot, std::option::Option::Some(9));
assert_eq!(snapshot.total_reservation_spots, 3);
let mut v2 = vec![5u8];
@@ -2456,7 +2710,7 @@ mod tests {
v2.extend_from_slice(&11u64.to_le_bytes());
v2.extend_from_slice(&5u64.to_le_bytes());
let snapshot =
- match crate::decoder::metadata::metaplex_token_metadata::decode_reservation_list_account(
+ match crate::decoder_metadata_metaplex_token_metadata_decode_reservation_list_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&resource.to_string(),
@@ -2465,10 +2719,7 @@ mod tests {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => panic!("reservation v2 decode failed: {error}"),
};
- assert_eq!(
- snapshot.kind,
- crate::decoder::metadata::metaplex_token_metadata::ReservationListAccountKind::V2
- );
+ assert_eq!(snapshot.kind, crate::DcMetadataMtmReservationListAccountKind::V2);
assert_eq!(snapshot.reservations[0].spots_remaining, u64::MAX);
assert_eq!(snapshot.total_reservation_spots, 11);
assert_eq!(snapshot.current_reservation_spots, 5);
@@ -2493,19 +2744,14 @@ mod tests {
mpl_token_metadata::types::Key::EditionMarkerV2,
mpl_token_metadata::types::Key::HolderDelegate,
];
- assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::METADATA_ACCOUNT_LAYOUT_AUDIT.len(),
- variants.len()
- );
+ assert_eq!(crate::DC_METADATA_MTM_METADATA_ACCOUNT_LAYOUT_AUDIT.len(), variants.len());
for (index, variant) in variants.iter().enumerate() {
let bytes = match borsh_0_10::to_vec(variant) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => panic!("key serialization failed: {error}"),
};
assert_eq!(bytes, vec![index as u8]);
- let entry =
- crate::decoder::metadata::metaplex_token_metadata::METADATA_ACCOUNT_LAYOUT_AUDIT
- [index];
+ let entry = crate::DC_METADATA_MTM_METADATA_ACCOUNT_LAYOUT_AUDIT[index];
assert_eq!(entry.discriminant, index as u8);
assert!(!entry.key_name.is_empty());
assert!(!entry.decoder.is_empty());
@@ -2517,9 +2763,7 @@ mod tests {
fn account_audit_matrix_covers_every_key_without_duplicate_discriminants() {
let mut discriminants = std::collections::BTreeSet::new();
let mut names = std::collections::BTreeSet::new();
- for entry in
- crate::decoder::metadata::metaplex_token_metadata::METADATA_ACCOUNT_LAYOUT_AUDIT
- {
+ for entry in crate::DC_METADATA_MTM_METADATA_ACCOUNT_LAYOUT_AUDIT {
assert!(discriminants.insert(entry.discriminant));
assert!(names.insert(entry.key_name));
if entry.discriminant == 0 {
@@ -2539,10 +2783,7 @@ mod tests {
std::option::Option::Some(value) => value,
std::option::Option::None => panic!("account_key_inventory missing"),
};
- assert_eq!(
- inventory.len(),
- crate::decoder::metadata::metaplex_token_metadata::METADATA_ACCOUNT_LAYOUT_AUDIT.len()
- );
+ assert_eq!(inventory.len(), crate::DC_METADATA_MTM_METADATA_ACCOUNT_LAYOUT_AUDIT.len());
for (index, item) in inventory.iter().enumerate() {
assert_eq!(
item.get("discriminant").and_then(serde_json::Value::as_u64),
@@ -2550,11 +2791,15 @@ mod tests {
);
assert_eq!(
item.get("key").and_then(serde_json::Value::as_str),
- std::option::Option::Some(crate::decoder::metadata::metaplex_token_metadata::METADATA_ACCOUNT_LAYOUT_AUDIT[index].key_name)
+ std::option::Option::Some(
+ crate::DC_METADATA_MTM_METADATA_ACCOUNT_LAYOUT_AUDIT[index].key_name
+ )
);
assert_eq!(
item.get("decoder").and_then(serde_json::Value::as_str),
- std::option::Option::Some(crate::decoder::metadata::metaplex_token_metadata::METADATA_ACCOUNT_LAYOUT_AUDIT[index].decoder)
+ std::option::Option::Some(
+ crate::DC_METADATA_MTM_METADATA_ACCOUNT_LAYOUT_AUDIT[index].decoder
+ )
);
}
}
@@ -2584,48 +2829,54 @@ mod tests {
data.push(0);
data.extend_from_slice(&0u32.to_le_bytes());
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_reservation_list_account(
+ 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,
&resource.to_string(),
&data
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidReservationListPda)
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidReservationListPda
+ )
);
let mut wrong_key = data.clone();
wrong_key[0] = 4;
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_reservation_list_account(
+ crate::decoder_metadata_metaplex_token_metadata_decode_reservation_list_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&resource.to_string(),
&wrong_key
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidReservationListKey)
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidReservationListKey
+ )
);
let mut too_many = data.clone();
too_many[34..38].copy_from_slice(&201u32.to_le_bytes());
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_reservation_list_account(
+ crate::decoder_metadata_metaplex_token_metadata_decode_reservation_list_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&resource.to_string(),
&too_many
),
std::result::Result::Err(
- crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::ReservationListBoundsExceeded
+ crate::DcMetadataMtmMetadataAccountDecodeError::ReservationListBoundsExceeded
)
);
let mut suffix = data.clone();
suffix.push(1);
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::decode_reservation_list_account(
+ crate::decoder_metadata_metaplex_token_metadata_decode_reservation_list_account(
&account.to_string(),
kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
&resource.to_string(),
&suffix
),
- std::result::Result::Err(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountDecodeError::InvalidMetadataLayout)
+ std::result::Result::Err(
+ crate::DcMetadataMtmMetadataAccountDecodeError::InvalidMetadataLayout
+ )
);
}
}
diff --git a/kb-lib/src/decoder/metadata/metaplex_token_metadata/canonical.rs b/kb-lib/src/decoder/metadata/metaplex_token_metadata/canonical.rs
index 702ec94..bf350e7 100644
--- a/kb-lib/src/decoder/metadata/metaplex_token_metadata/canonical.rs
+++ b/kb-lib/src/decoder/metadata/metaplex_token_metadata/canonical.rs
@@ -5,7 +5,7 @@
/// Lifecycle class of one decoded Metaplex account layout.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
-pub enum CanonicalAccountLifecycle {
+pub enum DcMetadataMtmCanonicalAccountLifecycle {
/// Current account layout used by supported runtime flows.
Active,
/// Published account layout whose runtime surface is still experimental.
@@ -16,7 +16,7 @@ pub enum CanonicalAccountLifecycle {
/// Materialization policy attached to one canonical account snapshot.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
-pub enum CanonicalMaterializationPolicy {
+pub enum DcMetadataMtmCanonicalMaterializationPolicy {
/// Materialize the latest committed state of an active account.
ActiveState,
/// Materialize historical state with explicit lifecycle provenance.
@@ -25,7 +25,7 @@ pub enum CanonicalMaterializationPolicy {
/// Execution policy attached to one canonical account layout.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
-pub enum CanonicalExecutionPolicy {
+pub enum DcMetadataMtmCanonicalExecutionPolicy {
/// The layout belongs to current operations that may later be executable.
CurrentCandidate,
/// The layout belongs to an experimental operation requiring explicit activation.
@@ -36,7 +36,7 @@ pub enum CanonicalExecutionPolicy {
/// Origin of one canonical account observation.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
-pub enum CanonicalObservationSource {
+pub enum DcMetadataMtmCanonicalObservationSource {
/// Account observed from a live subscription or direct live read.
Live,
/// Account reconstructed while replaying already stored transactions.
@@ -51,9 +51,9 @@ pub enum CanonicalObservationSource {
/// Provenance retained for one canonical account observation.
#[derive(Clone, Debug, Eq, PartialEq)]
-pub struct CanonicalAccountProvenance {
+pub struct DcMetadataMtmCanonicalAccountProvenance {
/// Observation source.
- pub source: CanonicalObservationSource,
+ pub source: DcMetadataMtmCanonicalObservationSource,
/// Slot associated with the account state when known.
pub slot: std::option::Option,
/// Provider write version when available.
@@ -70,7 +70,7 @@ pub struct CanonicalAccountProvenance {
/// Stable identity and policy of one canonical Metaplex account snapshot.
#[derive(Clone, Debug, Eq, PartialEq)]
-pub struct CanonicalAccountIdentity {
+pub struct DcMetadataMtmCanonicalAccountIdentity {
/// Stable identity formed from program id and canonical account address.
pub stable_id: String,
/// Canonical Metaplex Token Metadata program id.
@@ -84,74 +84,73 @@ pub struct CanonicalAccountIdentity {
/// Internal canonical-model version.
pub canonical_version: u16,
/// Published lifecycle class.
- pub lifecycle: CanonicalAccountLifecycle,
+ pub lifecycle: DcMetadataMtmCanonicalAccountLifecycle,
/// Materialization policy, including historical backfill state.
- pub materialization: CanonicalMaterializationPolicy,
+ pub materialization: DcMetadataMtmCanonicalMaterializationPolicy,
/// Execution policy separated from materialization.
- pub execution: CanonicalExecutionPolicy,
+ pub execution: DcMetadataMtmCanonicalExecutionPolicy,
}
/// Typed state carried by one canonical Metaplex account snapshot.
#[derive(Clone, Debug, PartialEq)]
-pub enum CanonicalMetadataAccountState {
+pub enum DcMetadataMtmCanonicalMetadataAccountState {
/// Metadata account state.
- Metadata(crate::decoder::metadata::metaplex_token_metadata::MetadataAccountSnapshot),
+ Metadata(crate::DcMetadataMtmMetadataAccountSnapshot),
/// Master Edition or printed Edition state.
- Edition(crate::decoder::metadata::metaplex_token_metadata::EditionAccountSnapshot),
+ Edition(crate::DcMetadataMtmEditionAccountSnapshot),
/// Edition Marker state.
- EditionMarker(crate::decoder::metadata::metaplex_token_metadata::EditionMarkerAccountSnapshot),
+ EditionMarker(crate::DcMetadataMtmEditionMarkerAccountSnapshot),
/// Programmable Token Record state.
- TokenRecord(crate::decoder::metadata::metaplex_token_metadata::TokenRecordAccountSnapshot),
+ TokenRecord(crate::DcMetadataMtmTokenRecordAccountSnapshot),
/// Metadata or holder delegate state.
- DelegateRecord(
- crate::decoder::metadata::metaplex_token_metadata::DelegateRecordAccountSnapshot,
- ),
+ DelegateRecord(crate::DcMetadataMtmDelegateRecordAccountSnapshot),
/// Collection or use authority state.
- AuthorityRecord(
- crate::decoder::metadata::metaplex_token_metadata::AuthorityRecordAccountSnapshot,
- ),
+ AuthorityRecord(crate::DcMetadataMtmAuthorityRecordAccountSnapshot),
/// Token-owned escrow state.
- TokenOwnedEscrow(
- crate::decoder::metadata::metaplex_token_metadata::TokenOwnedEscrowAccountSnapshot,
- ),
+ TokenOwnedEscrow(crate::DcMetadataMtmTokenOwnedEscrowAccountSnapshot),
/// Historical Reservation List state.
- ReservationList(
- crate::decoder::metadata::metaplex_token_metadata::ReservationListAccountSnapshot,
- ),
+ ReservationList(crate::DcMetadataMtmReservationListAccountSnapshot),
}
/// Canonical envelope used by future materializers and stateful replay.
#[derive(Clone, Debug, PartialEq)]
-pub struct CanonicalMetadataAccountSnapshot {
+pub struct DcMetadataMtmCanonicalMetadataAccountSnapshot {
/// Stable identity and lifecycle policy.
- pub identity: CanonicalAccountIdentity,
+ pub identity: DcMetadataMtmCanonicalAccountIdentity,
/// Observation provenance.
- pub provenance: CanonicalAccountProvenance,
+ pub provenance: DcMetadataMtmCanonicalAccountProvenance,
/// Typed bounded state.
- pub state: CanonicalMetadataAccountState,
+ pub state: DcMetadataMtmCanonicalMetadataAccountState,
}
fn canonical_identity(
account: &str,
layout: &str,
discriminant: u8,
- lifecycle: CanonicalAccountLifecycle,
-) -> CanonicalAccountIdentity {
+ lifecycle: DcMetadataMtmCanonicalAccountLifecycle,
+) -> DcMetadataMtmCanonicalAccountIdentity {
let program_id = kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID.to_string();
let materialization = match lifecycle {
- CanonicalAccountLifecycle::Historical => CanonicalMaterializationPolicy::HistoricalState,
- CanonicalAccountLifecycle::Active | CanonicalAccountLifecycle::ActiveExperimental => {
- CanonicalMaterializationPolicy::ActiveState
+ DcMetadataMtmCanonicalAccountLifecycle::Historical => {
+ DcMetadataMtmCanonicalMaterializationPolicy::HistoricalState
+ },
+ DcMetadataMtmCanonicalAccountLifecycle::Active
+ | DcMetadataMtmCanonicalAccountLifecycle::ActiveExperimental => {
+ DcMetadataMtmCanonicalMaterializationPolicy::ActiveState
},
};
let execution = match lifecycle {
- CanonicalAccountLifecycle::Historical => CanonicalExecutionPolicy::NeverHistorical,
- CanonicalAccountLifecycle::Active => CanonicalExecutionPolicy::CurrentCandidate,
- CanonicalAccountLifecycle::ActiveExperimental => {
- CanonicalExecutionPolicy::ExperimentalCandidate
+ DcMetadataMtmCanonicalAccountLifecycle::Historical => {
+ DcMetadataMtmCanonicalExecutionPolicy::NeverHistorical
+ },
+ DcMetadataMtmCanonicalAccountLifecycle::Active => {
+ DcMetadataMtmCanonicalExecutionPolicy::CurrentCandidate
+ },
+ DcMetadataMtmCanonicalAccountLifecycle::ActiveExperimental => {
+ DcMetadataMtmCanonicalExecutionPolicy::ExperimentalCandidate
},
};
- return CanonicalAccountIdentity {
+ return DcMetadataMtmCanonicalAccountIdentity {
stable_id: format!("{program_id}:{account}"),
program_id,
account: account.to_string(),
@@ -164,102 +163,102 @@ fn canonical_identity(
};
}
-impl CanonicalMetadataAccountSnapshot {
+impl DcMetadataMtmCanonicalMetadataAccountSnapshot {
/// Wraps one Metadata account snapshot with stable identity and provenance.
pub fn from_metadata(
- snapshot: crate::decoder::metadata::metaplex_token_metadata::MetadataAccountSnapshot,
- provenance: CanonicalAccountProvenance,
+ snapshot: crate::DcMetadataMtmMetadataAccountSnapshot,
+ provenance: DcMetadataMtmCanonicalAccountProvenance,
) -> Self {
let identity = canonical_identity(
&snapshot.account,
"MetadataV1",
mpl_token_metadata::types::Key::MetadataV1 as u8,
- CanonicalAccountLifecycle::Active,
+ DcMetadataMtmCanonicalAccountLifecycle::Active,
);
return Self {
identity,
provenance,
- state: CanonicalMetadataAccountState::Metadata(snapshot),
+ state: DcMetadataMtmCanonicalMetadataAccountState::Metadata(snapshot),
};
}
/// Wraps one Edition or Master Edition snapshot with exact lifecycle policy.
pub fn from_edition(
- snapshot: crate::decoder::metadata::metaplex_token_metadata::EditionAccountSnapshot,
- provenance: CanonicalAccountProvenance,
+ snapshot: crate::DcMetadataMtmEditionAccountSnapshot,
+ provenance: DcMetadataMtmCanonicalAccountProvenance,
) -> Self {
let (layout, discriminant, lifecycle) = match snapshot.kind {
- crate::decoder::metadata::metaplex_token_metadata::EditionAccountKind::MasterEditionV1 => (
+ crate::DcMetadataMtmEditionAccountKind::MasterEditionV1 => (
"MasterEditionV1",
mpl_token_metadata::types::Key::MasterEditionV1 as u8,
- CanonicalAccountLifecycle::Historical,
+ DcMetadataMtmCanonicalAccountLifecycle::Historical,
),
- crate::decoder::metadata::metaplex_token_metadata::EditionAccountKind::MasterEditionV2 => (
+ crate::DcMetadataMtmEditionAccountKind::MasterEditionV2 => (
"MasterEditionV2",
mpl_token_metadata::types::Key::MasterEditionV2 as u8,
- CanonicalAccountLifecycle::Active,
+ DcMetadataMtmCanonicalAccountLifecycle::Active,
),
- crate::decoder::metadata::metaplex_token_metadata::EditionAccountKind::EditionV1 => (
+ crate::DcMetadataMtmEditionAccountKind::EditionV1 => (
"EditionV1",
mpl_token_metadata::types::Key::EditionV1 as u8,
- CanonicalAccountLifecycle::Active,
+ DcMetadataMtmCanonicalAccountLifecycle::Active,
),
};
let identity = canonical_identity(&snapshot.account, layout, discriminant, lifecycle);
return Self {
identity,
provenance,
- state: CanonicalMetadataAccountState::Edition(snapshot),
+ state: DcMetadataMtmCanonicalMetadataAccountState::Edition(snapshot),
};
}
/// Wraps one Edition Marker snapshot with exact lifecycle policy.
pub fn from_edition_marker(
- snapshot: crate::decoder::metadata::metaplex_token_metadata::EditionMarkerAccountSnapshot,
- provenance: CanonicalAccountProvenance,
+ snapshot: crate::DcMetadataMtmEditionMarkerAccountSnapshot,
+ provenance: DcMetadataMtmCanonicalAccountProvenance,
) -> Self {
let (layout, discriminant, lifecycle) = match snapshot.kind {
- crate::decoder::metadata::metaplex_token_metadata::EditionMarkerAccountKind::EditionMarkerV1 => (
+ crate::DcMetadataMtmEditionMarkerAccountKind::EditionMarkerV1 => (
"EditionMarker",
mpl_token_metadata::types::Key::EditionMarker as u8,
- CanonicalAccountLifecycle::Active,
+ DcMetadataMtmCanonicalAccountLifecycle::Active,
),
- crate::decoder::metadata::metaplex_token_metadata::EditionMarkerAccountKind::EditionMarkerV2 => (
+ crate::DcMetadataMtmEditionMarkerAccountKind::EditionMarkerV2 => (
"EditionMarkerV2",
mpl_token_metadata::types::Key::EditionMarkerV2 as u8,
- CanonicalAccountLifecycle::ActiveExperimental,
+ DcMetadataMtmCanonicalAccountLifecycle::ActiveExperimental,
),
};
let identity = canonical_identity(&snapshot.account, layout, discriminant, lifecycle);
return Self {
identity,
provenance,
- state: CanonicalMetadataAccountState::EditionMarker(snapshot),
+ state: DcMetadataMtmCanonicalMetadataAccountState::EditionMarker(snapshot),
};
}
/// Wraps one Token Record snapshot.
pub fn from_token_record(
- snapshot: crate::decoder::metadata::metaplex_token_metadata::TokenRecordAccountSnapshot,
- provenance: CanonicalAccountProvenance,
+ snapshot: crate::DcMetadataMtmTokenRecordAccountSnapshot,
+ provenance: DcMetadataMtmCanonicalAccountProvenance,
) -> Self {
let identity = canonical_identity(
&snapshot.account,
"TokenRecord",
mpl_token_metadata::types::Key::TokenRecord as u8,
- CanonicalAccountLifecycle::Active,
+ DcMetadataMtmCanonicalAccountLifecycle::Active,
);
return Self {
identity,
provenance,
- state: CanonicalMetadataAccountState::TokenRecord(snapshot),
+ state: DcMetadataMtmCanonicalMetadataAccountState::TokenRecord(snapshot),
};
}
/// Wraps one Metadata or Holder Delegate snapshot.
pub fn from_delegate_record(
- snapshot: crate::decoder::metadata::metaplex_token_metadata::DelegateRecordAccountSnapshot,
- provenance: CanonicalAccountProvenance,
+ snapshot: crate::DcMetadataMtmDelegateRecordAccountSnapshot,
+ provenance: DcMetadataMtmCanonicalAccountProvenance,
) -> Self {
let (layout, discriminant) = if snapshot.kind == "MetadataDelegateRecord" {
("MetadataDelegate", mpl_token_metadata::types::Key::MetadataDelegate as u8)
@@ -270,19 +269,19 @@ impl CanonicalMetadataAccountSnapshot {
&snapshot.account,
layout,
discriminant,
- CanonicalAccountLifecycle::Active,
+ DcMetadataMtmCanonicalAccountLifecycle::Active,
);
return Self {
identity,
provenance,
- state: CanonicalMetadataAccountState::DelegateRecord(snapshot),
+ state: DcMetadataMtmCanonicalMetadataAccountState::DelegateRecord(snapshot),
};
}
/// Wraps one Collection or Use Authority snapshot.
pub fn from_authority_record(
- snapshot: crate::decoder::metadata::metaplex_token_metadata::AuthorityRecordAccountSnapshot,
- provenance: CanonicalAccountProvenance,
+ snapshot: crate::DcMetadataMtmAuthorityRecordAccountSnapshot,
+ provenance: DcMetadataMtmCanonicalAccountProvenance,
) -> Self {
let (layout, discriminant) = if snapshot.kind == "CollectionAuthorityRecord" {
(
@@ -296,43 +295,43 @@ impl CanonicalMetadataAccountSnapshot {
&snapshot.account,
layout,
discriminant,
- CanonicalAccountLifecycle::Active,
+ DcMetadataMtmCanonicalAccountLifecycle::Active,
);
return Self {
identity,
provenance,
- state: CanonicalMetadataAccountState::AuthorityRecord(snapshot),
+ state: DcMetadataMtmCanonicalMetadataAccountState::AuthorityRecord(snapshot),
};
}
/// Wraps one Token Owned Escrow snapshot.
pub fn from_token_owned_escrow(
- snapshot: crate::decoder::metadata::metaplex_token_metadata::TokenOwnedEscrowAccountSnapshot,
- provenance: CanonicalAccountProvenance,
+ snapshot: crate::DcMetadataMtmTokenOwnedEscrowAccountSnapshot,
+ provenance: DcMetadataMtmCanonicalAccountProvenance,
) -> Self {
let identity = canonical_identity(
&snapshot.account,
"TokenOwnedEscrow",
mpl_token_metadata::types::Key::TokenOwnedEscrow as u8,
- CanonicalAccountLifecycle::Active,
+ DcMetadataMtmCanonicalAccountLifecycle::Active,
);
return Self {
identity,
provenance,
- state: CanonicalMetadataAccountState::TokenOwnedEscrow(snapshot),
+ state: DcMetadataMtmCanonicalMetadataAccountState::TokenOwnedEscrow(snapshot),
};
}
/// Wraps one historical Reservation List snapshot as materializable historical state.
pub fn from_reservation_list(
- snapshot: crate::decoder::metadata::metaplex_token_metadata::ReservationListAccountSnapshot,
- provenance: CanonicalAccountProvenance,
+ snapshot: crate::DcMetadataMtmReservationListAccountSnapshot,
+ provenance: DcMetadataMtmCanonicalAccountProvenance,
) -> Self {
let (layout, discriminant) = match snapshot.kind {
- crate::decoder::metadata::metaplex_token_metadata::ReservationListAccountKind::V1 => {
+ crate::DcMetadataMtmReservationListAccountKind::V1 => {
("ReservationListV1", mpl_token_metadata::types::Key::ReservationListV1 as u8)
},
- crate::decoder::metadata::metaplex_token_metadata::ReservationListAccountKind::V2 => {
+ crate::DcMetadataMtmReservationListAccountKind::V2 => {
("ReservationListV2", mpl_token_metadata::types::Key::ReservationListV2 as u8)
},
};
@@ -340,12 +339,12 @@ impl CanonicalMetadataAccountSnapshot {
&snapshot.account,
layout,
discriminant,
- CanonicalAccountLifecycle::Historical,
+ DcMetadataMtmCanonicalAccountLifecycle::Historical,
);
return Self {
identity,
provenance,
- state: CanonicalMetadataAccountState::ReservationList(snapshot),
+ state: DcMetadataMtmCanonicalMetadataAccountState::ReservationList(snapshot),
};
}
}
@@ -354,10 +353,10 @@ impl CanonicalMetadataAccountSnapshot {
mod tests {
#[test]
fn historical_state_is_materializable_but_never_executable() {
- let snapshot = crate::decoder::metadata::metaplex_token_metadata::ReservationListAccountSnapshot {
+ let snapshot = crate::DcMetadataMtmReservationListAccountSnapshot {
account: "reservation-account".to_string(),
bump: 1,
- kind: crate::decoder::metadata::metaplex_token_metadata::ReservationListAccountKind::V1,
+ kind: crate::DcMetadataMtmReservationListAccountKind::V1,
master_edition: "master-edition".to_string(),
resource: "resource".to_string(),
supply_snapshot: std::option::Option::Some(7),
@@ -366,8 +365,8 @@ mod tests {
current_reservation_spots: 0,
payload_json: serde_json::json!({}),
};
- let provenance = super::CanonicalAccountProvenance {
- source: super::CanonicalObservationSource::Backfill,
+ let provenance = super::DcMetadataMtmCanonicalAccountProvenance {
+ source: super::DcMetadataMtmCanonicalObservationSource::Backfill,
slot: std::option::Option::Some(42),
write_version: std::option::Option::None,
signature: std::option::Option::Some("historical-signature".to_string()),
@@ -375,21 +374,31 @@ mod tests {
inner_instruction_index: std::option::Option::None,
committed: true,
};
- let canonical =
- super::CanonicalMetadataAccountSnapshot::from_reservation_list(snapshot, provenance);
- assert_eq!(canonical.identity.lifecycle, super::CanonicalAccountLifecycle::Historical);
+ let canonical = super::DcMetadataMtmCanonicalMetadataAccountSnapshot::from_reservation_list(
+ snapshot, provenance,
+ );
+ assert_eq!(
+ canonical.identity.lifecycle,
+ super::DcMetadataMtmCanonicalAccountLifecycle::Historical
+ );
assert_eq!(
canonical.identity.materialization,
- super::CanonicalMaterializationPolicy::HistoricalState
+ super::DcMetadataMtmCanonicalMaterializationPolicy::HistoricalState
+ );
+ assert_eq!(
+ canonical.identity.execution,
+ super::DcMetadataMtmCanonicalExecutionPolicy::NeverHistorical
+ );
+ assert_eq!(
+ canonical.provenance.source,
+ super::DcMetadataMtmCanonicalObservationSource::Backfill
);
- assert_eq!(canonical.identity.execution, super::CanonicalExecutionPolicy::NeverHistorical);
- assert_eq!(canonical.provenance.source, super::CanonicalObservationSource::Backfill);
assert!(canonical.identity.stable_id.ends_with(":reservation-account"));
}
#[test]
fn active_and_experimental_layouts_keep_distinct_policies() {
- let metadata = crate::decoder::metadata::metaplex_token_metadata::MetadataAccountSnapshot {
+ let metadata = crate::DcMetadataMtmMetadataAccountSnapshot {
account: "metadata-account".to_string(),
bump: 1,
mint: "mint".to_string(),
@@ -402,8 +411,8 @@ mod tests {
is_mutable: true,
payload_json: serde_json::json!({}),
};
- let provenance = super::CanonicalAccountProvenance {
- source: super::CanonicalObservationSource::Live,
+ let provenance = super::DcMetadataMtmCanonicalAccountProvenance {
+ source: super::DcMetadataMtmCanonicalObservationSource::Live,
slot: std::option::Option::Some(1),
write_version: std::option::Option::Some(2),
signature: std::option::Option::None,
@@ -411,14 +420,21 @@ mod tests {
inner_instruction_index: std::option::Option::None,
committed: true,
};
- let canonical =
- super::CanonicalMetadataAccountSnapshot::from_metadata(metadata, provenance);
- assert_eq!(canonical.identity.lifecycle, super::CanonicalAccountLifecycle::Active);
+ let canonical = super::DcMetadataMtmCanonicalMetadataAccountSnapshot::from_metadata(
+ metadata, provenance,
+ );
+ assert_eq!(
+ canonical.identity.lifecycle,
+ super::DcMetadataMtmCanonicalAccountLifecycle::Active
+ );
assert_eq!(
canonical.identity.materialization,
- super::CanonicalMaterializationPolicy::ActiveState
+ super::DcMetadataMtmCanonicalMaterializationPolicy::ActiveState
+ );
+ assert_eq!(
+ canonical.identity.execution,
+ super::DcMetadataMtmCanonicalExecutionPolicy::CurrentCandidate
);
- assert_eq!(canonical.identity.execution, super::CanonicalExecutionPolicy::CurrentCandidate);
assert_eq!(canonical.identity.discriminant, 4);
assert_eq!(canonical.identity.canonical_version, 1);
}
diff --git a/kb-lib/src/decoder/metadata/metaplex_token_metadata/constants.rs b/kb-lib/src/decoder/metadata/metaplex_token_metadata/constants.rs
index e169601..a8bcb59 100644
--- a/kb-lib/src/decoder/metadata/metaplex_token_metadata/constants.rs
+++ b/kb-lib/src/decoder/metadata/metaplex_token_metadata/constants.rs
@@ -4,254 +4,325 @@
//! Internal constants for Metaplex Token Metadata decoding.
/// Stable decoder surface code.
-pub(crate) const SURFACE_CODE: &str = "metadata_metaplex_token_metadata";
+pub(crate) const DC_METADATA_MTM_SURFACE_CODE: &str = "metadata_metaplex_token_metadata";
/// Maximum retained instruction payload size.
-pub(crate) const MAX_INSTRUCTION_BYTES: usize = 16_384;
+pub(crate) const DC_METADATA_MTM_MAX_INSTRUCTION_BYTES: usize = 16_384;
/// Maximum encoded base64 instruction payload size.
-pub(crate) const MAX_BASE64_BYTES: usize = 21_852;
+pub(crate) const DC_METADATA_MTM_MAX_BASE64_BYTES: usize = 21_852;
/// Maximum number of instruction accounts accepted by this decoder.
-pub(crate) const MAX_INSTRUCTION_ACCOUNTS: usize = 64;
+pub(crate) const DC_METADATA_MTM_MAX_INSTRUCTION_ACCOUNTS: usize = 64;
/// Number of bytes retained in malformed-wire diagnostics.
-pub(crate) const DIAGNOSTIC_PREFIX_BYTES: usize = 32;
+pub(crate) const DC_METADATA_MTM_DIAGNOSTIC_PREFIX_BYTES: usize = 32;
/// Stable event payload contract version.
-pub(crate) const EVENT_VERSION: u32 = 1;
+pub(crate) const DC_METADATA_MTM_EVENT_VERSION: u32 = 1;
/// Deprecated Create Master Edition discriminator.
-pub(crate) const DEPRECATED_CREATE_MASTER_EDITION_DISCRIMINATOR: u8 = 2;
+pub(crate) const DC_METADATA_MTM_DEPRECATED_CREATE_MASTER_EDITION_DISCRIMINATOR: u8 = 2;
/// Deprecated Set Reservation List discriminator.
-pub(crate) const DEPRECATED_SET_RESERVATION_LIST_DISCRIMINATOR: u8 = 5;
+pub(crate) const DC_METADATA_MTM_DEPRECATED_SET_RESERVATION_LIST_DISCRIMINATOR: u8 = 5;
/// Deprecated Create Reservation List discriminator.
-pub(crate) const DEPRECATED_CREATE_RESERVATION_LIST_DISCRIMINATOR: u8 = 6;
+pub(crate) const DC_METADATA_MTM_DEPRECATED_CREATE_RESERVATION_LIST_DISCRIMINATOR: u8 = 6;
/// Deprecated Mint Printing Tokens Via Token discriminator.
-pub(crate) const DEPRECATED_MINT_PRINTING_TOKENS_VIA_TOKEN_DISCRIMINATOR: u8 = 8;
+pub(crate) const DC_METADATA_MTM_DEPRECATED_MINT_PRINTING_TOKENS_VIA_TOKEN_DISCRIMINATOR: u8 = 8;
/// Deprecated Mint Printing Tokens discriminator.
-pub(crate) const DEPRECATED_MINT_PRINTING_TOKENS_DISCRIMINATOR: u8 = 9;
+pub(crate) const DC_METADATA_MTM_DEPRECATED_MINT_PRINTING_TOKENS_DISCRIMINATOR: u8 = 9;
/// Historical Create Master Edition discriminator.
-pub(crate) const CREATE_MASTER_EDITION_DISCRIMINATOR: u8 = 10;
+pub(crate) const DC_METADATA_MTM_CREATE_MASTER_EDITION_DISCRIMINATOR: u8 = 10;
/// Deprecated printing-token mint-new-edition discriminator.
-pub(crate) const DEPRECATED_MINT_NEW_EDITION_VIA_PRINTING_TOKEN_DISCRIMINATOR: u8 = 3;
+pub(crate) const DC_METADATA_MTM_DEPRECATED_MINT_NEW_EDITION_VIA_PRINTING_TOKEN_DISCRIMINATOR: u8 =
+ 3;
/// Historical Create Metadata Account discriminator.
-pub(crate) const CREATE_METADATA_ACCOUNT_DISCRIMINATOR: u8 = 0;
+pub(crate) const DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_DISCRIMINATOR: u8 = 0;
/// Historical Update Metadata Account discriminator.
-pub(crate) const UPDATE_METADATA_ACCOUNT_DISCRIMINATOR: u8 = 1;
+pub(crate) const DC_METADATA_MTM_UPDATE_METADATA_ACCOUNT_DISCRIMINATOR: u8 = 1;
/// Historical Create Metadata Account V2 discriminator.
-pub(crate) const CREATE_METADATA_ACCOUNT_V2_DISCRIMINATOR: u8 = 16;
+pub(crate) const DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_V2_DISCRIMINATOR: u8 = 16;
/// Create Metadata Account V3 discriminator.
-pub(crate) const CREATE_METADATA_ACCOUNT_V3_DISCRIMINATOR: u8 = 33;
+pub(crate) const DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_V3_DISCRIMINATOR: u8 = 33;
/// Update Metadata Account V2 discriminator.
-pub(crate) const UPDATE_METADATA_ACCOUNT_V2_DISCRIMINATOR: u8 = 15;
+pub(crate) const DC_METADATA_MTM_UPDATE_METADATA_ACCOUNT_V2_DISCRIMINATOR: u8 = 15;
/// Verify Collection discriminator.
-pub(crate) const VERIFY_COLLECTION_DISCRIMINATOR: u8 = 18;
+pub(crate) const DC_METADATA_MTM_VERIFY_COLLECTION_DISCRIMINATOR: u8 = 18;
/// Unverify Collection discriminator.
-pub(crate) const UNVERIFY_COLLECTION_DISCRIMINATOR: u8 = 22;
+pub(crate) const DC_METADATA_MTM_UNVERIFY_COLLECTION_DISCRIMINATOR: u8 = 22;
/// Set And Verify Collection discriminator.
-pub(crate) const SET_AND_VERIFY_COLLECTION_DISCRIMINATOR: u8 = 25;
+pub(crate) const DC_METADATA_MTM_SET_AND_VERIFY_COLLECTION_DISCRIMINATOR: u8 = 25;
/// Approve Collection Authority discriminator.
-pub(crate) const APPROVE_COLLECTION_AUTHORITY_DISCRIMINATOR: u8 = 23;
+pub(crate) const DC_METADATA_MTM_APPROVE_COLLECTION_AUTHORITY_DISCRIMINATOR: u8 = 23;
/// Revoke Collection Authority discriminator.
-pub(crate) const REVOKE_COLLECTION_AUTHORITY_DISCRIMINATOR: u8 = 24;
+pub(crate) const DC_METADATA_MTM_REVOKE_COLLECTION_AUTHORITY_DISCRIMINATOR: u8 = 24;
/// Verify Sized Collection Item discriminator.
-pub(crate) const VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR: u8 = 30;
+pub(crate) const DC_METADATA_MTM_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR: u8 = 30;
/// Unverify Sized Collection Item discriminator.
-pub(crate) const UNVERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR: u8 = 31;
+pub(crate) const DC_METADATA_MTM_UNVERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR: u8 = 31;
/// Set And Verify Sized Collection Item discriminator.
-pub(crate) const SET_AND_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR: u8 = 32;
+pub(crate) const DC_METADATA_MTM_SET_AND_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR: u8 = 32;
/// Sign Metadata discriminator.
-pub(crate) const SIGN_METADATA_DISCRIMINATOR: u8 = 7;
+pub(crate) const DC_METADATA_MTM_SIGN_METADATA_DISCRIMINATOR: u8 = 7;
/// Update Primary Sale Happened Via Token discriminator.
-pub(crate) const UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_DISCRIMINATOR: u8 = 4;
+pub(crate) const DC_METADATA_MTM_UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_DISCRIMINATOR: u8 = 4;
/// Utilize discriminator.
-pub(crate) const UTILIZE_DISCRIMINATOR: u8 = 19;
+pub(crate) const DC_METADATA_MTM_UTILIZE_DISCRIMINATOR: u8 = 19;
/// Approve Use Authority discriminator.
-pub(crate) const APPROVE_USE_AUTHORITY_DISCRIMINATOR: u8 = 20;
+pub(crate) const DC_METADATA_MTM_APPROVE_USE_AUTHORITY_DISCRIMINATOR: u8 = 20;
/// Revoke Use Authority discriminator.
-pub(crate) const REVOKE_USE_AUTHORITY_DISCRIMINATOR: u8 = 21;
+pub(crate) const DC_METADATA_MTM_REVOKE_USE_AUTHORITY_DISCRIMINATOR: u8 = 21;
/// Puff Metadata discriminator.
-pub(crate) const PUFF_METADATA_DISCRIMINATOR: u8 = 14;
+pub(crate) const DC_METADATA_MTM_PUFF_METADATA_DISCRIMINATOR: u8 = 14;
/// Freeze Delegated Account discriminator.
-pub(crate) const FREEZE_DELEGATED_ACCOUNT_DISCRIMINATOR: u8 = 26;
+pub(crate) const DC_METADATA_MTM_FREEZE_DELEGATED_ACCOUNT_DISCRIMINATOR: u8 = 26;
/// Thaw Delegated Account discriminator.
-pub(crate) const THAW_DELEGATED_ACCOUNT_DISCRIMINATOR: u8 = 27;
+pub(crate) const DC_METADATA_MTM_THAW_DELEGATED_ACCOUNT_DISCRIMINATOR: u8 = 27;
/// Remove Creator Verification discriminator.
-pub(crate) const REMOVE_CREATOR_VERIFICATION_DISCRIMINATOR: u8 = 28;
+pub(crate) const DC_METADATA_MTM_REMOVE_CREATOR_VERIFICATION_DISCRIMINATOR: u8 = 28;
/// Set Token Standard discriminator.
-pub(crate) const SET_TOKEN_STANDARD_DISCRIMINATOR: u8 = 35;
+pub(crate) const DC_METADATA_MTM_SET_TOKEN_STANDARD_DISCRIMINATOR: u8 = 35;
/// Mint New Edition From Master Edition Via Token discriminator.
-pub(crate) const MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR: u8 = 11;
+pub(crate) const DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR: u8 =
+ 11;
/// Mint New Edition From Master Edition Via Vault Proxy discriminator.
-pub(crate) const MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_DISCRIMINATOR: u8 = 13;
+pub(crate) const DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_DISCRIMINATOR: u8 = 13;
/// Convert Master Edition V1 to V2 discriminator.
-pub(crate) const CONVERT_MASTER_EDITION_V1_TO_V2_DISCRIMINATOR: u8 = 12;
+pub(crate) const DC_METADATA_MTM_CONVERT_MASTER_EDITION_V1_TO_V2_DISCRIMINATOR: u8 = 12;
/// Create Master Edition V3 discriminator.
-pub(crate) const CREATE_MASTER_EDITION_V3_DISCRIMINATOR: u8 = 17;
+pub(crate) const DC_METADATA_MTM_CREATE_MASTER_EDITION_V3_DISCRIMINATOR: u8 = 17;
/// Set Collection Size discriminator.
-pub(crate) const SET_COLLECTION_SIZE_DISCRIMINATOR: u8 = 34;
+pub(crate) const DC_METADATA_MTM_SET_COLLECTION_SIZE_DISCRIMINATOR: u8 = 34;
/// Bubblegum Set Collection Size discriminator.
-pub(crate) const BUBBLEGUM_SET_COLLECTION_SIZE_DISCRIMINATOR: u8 = 36;
+pub(crate) const DC_METADATA_MTM_BUBBLEGUM_SET_COLLECTION_SIZE_DISCRIMINATOR: u8 = 36;
/// Create Escrow Account discriminator.
-pub(crate) const CREATE_ESCROW_ACCOUNT_DISCRIMINATOR: u8 = 38;
+pub(crate) const DC_METADATA_MTM_CREATE_ESCROW_ACCOUNT_DISCRIMINATOR: u8 = 38;
/// Close Escrow Account discriminator.
-pub(crate) const CLOSE_ESCROW_ACCOUNT_DISCRIMINATOR: u8 = 39;
+pub(crate) const DC_METADATA_MTM_CLOSE_ESCROW_ACCOUNT_DISCRIMINATOR: u8 = 39;
/// Transfer Out Of Escrow discriminator.
-pub(crate) const TRANSFER_OUT_OF_ESCROW_DISCRIMINATOR: u8 = 40;
+pub(crate) const DC_METADATA_MTM_TRANSFER_OUT_OF_ESCROW_DISCRIMINATOR: u8 = 40;
/// Collect discriminator.
-pub(crate) const COLLECT_DISCRIMINATOR: u8 = 54;
+pub(crate) const DC_METADATA_MTM_COLLECT_DISCRIMINATOR: u8 = 54;
/// Historical Burn NFT discriminator.
-pub(crate) const BURN_NFT_DISCRIMINATOR: u8 = 29;
+pub(crate) const DC_METADATA_MTM_BURN_NFT_DISCRIMINATOR: u8 = 29;
/// Historical Burn Edition NFT discriminator.
-pub(crate) const BURN_EDITION_NFT_DISCRIMINATOR: u8 = 37;
+pub(crate) const DC_METADATA_MTM_BURN_EDITION_NFT_DISCRIMINATOR: u8 = 37;
/// Burn discriminator.
-pub(crate) const BURN_DISCRIMINATOR: u8 = 41;
+pub(crate) const DC_METADATA_MTM_BURN_DISCRIMINATOR: u8 = 41;
/// Lock discriminator.
-pub(crate) const LOCK_DISCRIMINATOR: u8 = 46;
+pub(crate) const DC_METADATA_MTM_LOCK_DISCRIMINATOR: u8 = 46;
/// Unlock discriminator.
-pub(crate) const UNLOCK_DISCRIMINATOR: u8 = 47;
+pub(crate) const DC_METADATA_MTM_UNLOCK_DISCRIMINATOR: u8 = 47;
/// Transfer discriminator.
-pub(crate) const TRANSFER_DISCRIMINATOR: u8 = 49;
+pub(crate) const DC_METADATA_MTM_TRANSFER_DISCRIMINATOR: u8 = 49;
/// Close Accounts discriminator.
-pub(crate) const CLOSE_ACCOUNTS_DISCRIMINATOR: u8 = 57;
+pub(crate) const DC_METADATA_MTM_CLOSE_ACCOUNTS_DISCRIMINATOR: u8 = 57;
/// Modern Create discriminator.
-pub(crate) const CREATE_DISCRIMINATOR: u8 = 42;
+pub(crate) const DC_METADATA_MTM_CREATE_DISCRIMINATOR: u8 = 42;
/// Modern Mint discriminator.
-pub(crate) const MINT_DISCRIMINATOR: u8 = 43;
+pub(crate) const DC_METADATA_MTM_MINT_DISCRIMINATOR: u8 = 43;
/// Modern Print discriminator.
-pub(crate) const PRINT_DISCRIMINATOR: u8 = 55;
+pub(crate) const DC_METADATA_MTM_PRINT_DISCRIMINATOR: u8 = 55;
/// Modern Update discriminator.
-pub(crate) const UPDATE_DISCRIMINATOR: u8 = 50;
+pub(crate) const DC_METADATA_MTM_UPDATE_DISCRIMINATOR: u8 = 50;
/// Modern Use discriminator.
-pub(crate) const USE_DISCRIMINATOR: u8 = 51;
+pub(crate) const DC_METADATA_MTM_USE_DISCRIMINATOR: u8 = 51;
/// Modern Verify discriminator.
-pub(crate) const VERIFY_DISCRIMINATOR: u8 = 52;
+pub(crate) const DC_METADATA_MTM_VERIFY_DISCRIMINATOR: u8 = 52;
/// Modern Unverify discriminator.
-pub(crate) const UNVERIFY_DISCRIMINATOR: u8 = 53;
+pub(crate) const DC_METADATA_MTM_UNVERIFY_DISCRIMINATOR: u8 = 53;
/// Migrate discriminator.
-pub(crate) const MIGRATE_DISCRIMINATOR: u8 = 48;
+pub(crate) const DC_METADATA_MTM_MIGRATE_DISCRIMINATOR: u8 = 48;
/// Resize discriminator.
-pub(crate) const RESIZE_DISCRIMINATOR: u8 = 56;
+pub(crate) const DC_METADATA_MTM_RESIZE_DISCRIMINATOR: u8 = 56;
/// Delegate discriminator.
-pub(crate) const DELEGATE_DISCRIMINATOR: u8 = 44;
+pub(crate) const DC_METADATA_MTM_DELEGATE_DISCRIMINATOR: u8 = 44;
/// Revoke discriminator.
-pub(crate) const REVOKE_DISCRIMINATOR: u8 = 45;
+pub(crate) const DC_METADATA_MTM_REVOKE_DISCRIMINATOR: u8 = 45;
/// Current pre-release instruction inventory.
-pub(crate) const INSTRUCTION_ENTRIES: &[(u8, &str, bool)] = &[
- (CREATE_METADATA_ACCOUNT_DISCRIMINATOR, "create_metadata_account", true),
+pub(crate) const DC_METADATA_MTM_INSTRUCTION_ENTRIES: &[(u8, &str, bool)] = &[
(
- DEPRECATED_CREATE_MASTER_EDITION_DISCRIMINATOR,
+ DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_DISCRIMINATOR,
+ "create_metadata_account",
+ true,
+ ),
+ (
+ DC_METADATA_MTM_DEPRECATED_CREATE_MASTER_EDITION_DISCRIMINATOR,
"deprecated_create_master_edition",
true,
),
(
- DEPRECATED_MINT_NEW_EDITION_VIA_PRINTING_TOKEN_DISCRIMINATOR,
+ DC_METADATA_MTM_DEPRECATED_MINT_NEW_EDITION_VIA_PRINTING_TOKEN_DISCRIMINATOR,
"deprecated_mint_new_edition_from_master_edition_via_printing_token",
true,
),
- (UPDATE_METADATA_ACCOUNT_DISCRIMINATOR, "update_metadata_account", true),
(
- UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_DISCRIMINATOR,
+ DC_METADATA_MTM_UPDATE_METADATA_ACCOUNT_DISCRIMINATOR,
+ "update_metadata_account",
+ true,
+ ),
+ (
+ DC_METADATA_MTM_UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_DISCRIMINATOR,
"update_primary_sale_happened_via_token",
false,
),
(
- DEPRECATED_SET_RESERVATION_LIST_DISCRIMINATOR,
+ DC_METADATA_MTM_DEPRECATED_SET_RESERVATION_LIST_DISCRIMINATOR,
"deprecated_set_reservation_list",
true,
),
(
- DEPRECATED_CREATE_RESERVATION_LIST_DISCRIMINATOR,
+ DC_METADATA_MTM_DEPRECATED_CREATE_RESERVATION_LIST_DISCRIMINATOR,
"deprecated_create_reservation_list",
true,
),
- (SIGN_METADATA_DISCRIMINATOR, "sign_metadata", false),
+ (DC_METADATA_MTM_SIGN_METADATA_DISCRIMINATOR, "sign_metadata", false),
(
- DEPRECATED_MINT_PRINTING_TOKENS_VIA_TOKEN_DISCRIMINATOR,
+ DC_METADATA_MTM_DEPRECATED_MINT_PRINTING_TOKENS_VIA_TOKEN_DISCRIMINATOR,
"deprecated_mint_printing_tokens_via_token",
true,
),
(
- DEPRECATED_MINT_PRINTING_TOKENS_DISCRIMINATOR,
+ DC_METADATA_MTM_DEPRECATED_MINT_PRINTING_TOKENS_DISCRIMINATOR,
"deprecated_mint_printing_tokens",
true,
),
- (CREATE_MASTER_EDITION_DISCRIMINATOR, "create_master_edition", true),
- (PUFF_METADATA_DISCRIMINATOR, "puff_metadata", false),
(
- MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR,
+ DC_METADATA_MTM_CREATE_MASTER_EDITION_DISCRIMINATOR,
+ "create_master_edition",
+ true,
+ ),
+ (DC_METADATA_MTM_PUFF_METADATA_DISCRIMINATOR, "puff_metadata", false),
+ (
+ DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR,
"mint_new_edition_from_master_edition_via_token",
false,
),
(
- MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_DISCRIMINATOR,
+ DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_DISCRIMINATOR,
"mint_new_edition_from_master_edition_via_vault_proxy",
true,
),
(
- CONVERT_MASTER_EDITION_V1_TO_V2_DISCRIMINATOR,
+ DC_METADATA_MTM_CONVERT_MASTER_EDITION_V1_TO_V2_DISCRIMINATOR,
"convert_master_edition_v1_to_v2",
true,
),
- (UPDATE_METADATA_ACCOUNT_V2_DISCRIMINATOR, "update_metadata_account_v2", false),
- (CREATE_METADATA_ACCOUNT_V2_DISCRIMINATOR, "create_metadata_account_v2", true),
- (CREATE_MASTER_EDITION_V3_DISCRIMINATOR, "create_master_edition_v3", false),
- (CREATE_METADATA_ACCOUNT_V3_DISCRIMINATOR, "create_metadata_account_v3", false),
- (VERIFY_COLLECTION_DISCRIMINATOR, "verify_collection", false),
- (UNVERIFY_COLLECTION_DISCRIMINATOR, "unverify_collection", false),
- (SET_AND_VERIFY_COLLECTION_DISCRIMINATOR, "set_and_verify_collection", false),
(
- APPROVE_COLLECTION_AUTHORITY_DISCRIMINATOR,
+ DC_METADATA_MTM_UPDATE_METADATA_ACCOUNT_V2_DISCRIMINATOR,
+ "update_metadata_account_v2",
+ false,
+ ),
+ (
+ DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_V2_DISCRIMINATOR,
+ "create_metadata_account_v2",
+ true,
+ ),
+ (
+ DC_METADATA_MTM_CREATE_MASTER_EDITION_V3_DISCRIMINATOR,
+ "create_master_edition_v3",
+ false,
+ ),
+ (
+ DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_V3_DISCRIMINATOR,
+ "create_metadata_account_v3",
+ false,
+ ),
+ (DC_METADATA_MTM_VERIFY_COLLECTION_DISCRIMINATOR, "verify_collection", false),
+ (DC_METADATA_MTM_UNVERIFY_COLLECTION_DISCRIMINATOR, "unverify_collection", false),
+ (
+ DC_METADATA_MTM_SET_AND_VERIFY_COLLECTION_DISCRIMINATOR,
+ "set_and_verify_collection",
+ false,
+ ),
+ (
+ DC_METADATA_MTM_APPROVE_COLLECTION_AUTHORITY_DISCRIMINATOR,
"approve_collection_authority",
false,
),
- (REVOKE_COLLECTION_AUTHORITY_DISCRIMINATOR, "revoke_collection_authority", false),
(
- VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR,
+ DC_METADATA_MTM_REVOKE_COLLECTION_AUTHORITY_DISCRIMINATOR,
+ "revoke_collection_authority",
+ false,
+ ),
+ (
+ DC_METADATA_MTM_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR,
"verify_sized_collection_item",
false,
),
(
- UNVERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR,
+ DC_METADATA_MTM_UNVERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR,
"unverify_sized_collection_item",
false,
),
(
- SET_AND_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR,
+ DC_METADATA_MTM_SET_AND_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR,
"set_and_verify_sized_collection_item",
false,
),
- (UTILIZE_DISCRIMINATOR, "utilize", false),
- (APPROVE_USE_AUTHORITY_DISCRIMINATOR, "approve_use_authority", false),
- (REVOKE_USE_AUTHORITY_DISCRIMINATOR, "revoke_use_authority", false),
- (FREEZE_DELEGATED_ACCOUNT_DISCRIMINATOR, "freeze_delegated_account", true),
- (THAW_DELEGATED_ACCOUNT_DISCRIMINATOR, "thaw_delegated_account", true),
- (REMOVE_CREATOR_VERIFICATION_DISCRIMINATOR, "remove_creator_verification", false),
- (SET_TOKEN_STANDARD_DISCRIMINATOR, "set_token_standard", false),
- (SET_COLLECTION_SIZE_DISCRIMINATOR, "set_collection_size", false),
+ (DC_METADATA_MTM_UTILIZE_DISCRIMINATOR, "utilize", false),
(
- BUBBLEGUM_SET_COLLECTION_SIZE_DISCRIMINATOR,
+ DC_METADATA_MTM_APPROVE_USE_AUTHORITY_DISCRIMINATOR,
+ "approve_use_authority",
+ false,
+ ),
+ (
+ DC_METADATA_MTM_REVOKE_USE_AUTHORITY_DISCRIMINATOR,
+ "revoke_use_authority",
+ false,
+ ),
+ (
+ DC_METADATA_MTM_FREEZE_DELEGATED_ACCOUNT_DISCRIMINATOR,
+ "freeze_delegated_account",
+ true,
+ ),
+ (
+ DC_METADATA_MTM_THAW_DELEGATED_ACCOUNT_DISCRIMINATOR,
+ "thaw_delegated_account",
+ true,
+ ),
+ (
+ DC_METADATA_MTM_REMOVE_CREATOR_VERIFICATION_DISCRIMINATOR,
+ "remove_creator_verification",
+ false,
+ ),
+ (DC_METADATA_MTM_SET_TOKEN_STANDARD_DISCRIMINATOR, "set_token_standard", false),
+ (DC_METADATA_MTM_SET_COLLECTION_SIZE_DISCRIMINATOR, "set_collection_size", false),
+ (
+ DC_METADATA_MTM_BUBBLEGUM_SET_COLLECTION_SIZE_DISCRIMINATOR,
"bubblegum_set_collection_size",
false,
),
- (CREATE_ESCROW_ACCOUNT_DISCRIMINATOR, "create_escrow_account", false),
- (CLOSE_ESCROW_ACCOUNT_DISCRIMINATOR, "close_escrow_account", false),
- (TRANSFER_OUT_OF_ESCROW_DISCRIMINATOR, "transfer_out_of_escrow", false),
- (BURN_NFT_DISCRIMINATOR, "burn_nft", true),
- (BURN_EDITION_NFT_DISCRIMINATOR, "burn_edition_nft", true),
- (BURN_DISCRIMINATOR, "burn", false),
- (CREATE_DISCRIMINATOR, "create", false),
- (MINT_DISCRIMINATOR, "mint", false),
- (LOCK_DISCRIMINATOR, "lock", false),
- (UNLOCK_DISCRIMINATOR, "unlock", false),
- (TRANSFER_DISCRIMINATOR, "transfer", false),
- (COLLECT_DISCRIMINATOR, "collect", false),
- (PRINT_DISCRIMINATOR, "print", false),
- (UPDATE_DISCRIMINATOR, "update", false),
- (USE_DISCRIMINATOR, "use", false),
- (VERIFY_DISCRIMINATOR, "verify", false),
- (UNVERIFY_DISCRIMINATOR, "unverify", false),
- (MIGRATE_DISCRIMINATOR, "migrate", false),
- (RESIZE_DISCRIMINATOR, "resize", false),
- (CLOSE_ACCOUNTS_DISCRIMINATOR, "close_accounts", false),
- (DELEGATE_DISCRIMINATOR, "delegate", false),
- (REVOKE_DISCRIMINATOR, "revoke", false),
+ (
+ DC_METADATA_MTM_CREATE_ESCROW_ACCOUNT_DISCRIMINATOR,
+ "create_escrow_account",
+ false,
+ ),
+ (
+ DC_METADATA_MTM_CLOSE_ESCROW_ACCOUNT_DISCRIMINATOR,
+ "close_escrow_account",
+ false,
+ ),
+ (
+ DC_METADATA_MTM_TRANSFER_OUT_OF_ESCROW_DISCRIMINATOR,
+ "transfer_out_of_escrow",
+ false,
+ ),
+ (DC_METADATA_MTM_BURN_NFT_DISCRIMINATOR, "burn_nft", true),
+ (DC_METADATA_MTM_BURN_EDITION_NFT_DISCRIMINATOR, "burn_edition_nft", true),
+ (DC_METADATA_MTM_BURN_DISCRIMINATOR, "burn", false),
+ (DC_METADATA_MTM_CREATE_DISCRIMINATOR, "create", false),
+ (DC_METADATA_MTM_MINT_DISCRIMINATOR, "mint", false),
+ (DC_METADATA_MTM_LOCK_DISCRIMINATOR, "lock", false),
+ (DC_METADATA_MTM_UNLOCK_DISCRIMINATOR, "unlock", false),
+ (DC_METADATA_MTM_TRANSFER_DISCRIMINATOR, "transfer", false),
+ (DC_METADATA_MTM_COLLECT_DISCRIMINATOR, "collect", false),
+ (DC_METADATA_MTM_PRINT_DISCRIMINATOR, "print", false),
+ (DC_METADATA_MTM_UPDATE_DISCRIMINATOR, "update", false),
+ (DC_METADATA_MTM_USE_DISCRIMINATOR, "use", false),
+ (DC_METADATA_MTM_VERIFY_DISCRIMINATOR, "verify", false),
+ (DC_METADATA_MTM_UNVERIFY_DISCRIMINATOR, "unverify", false),
+ (DC_METADATA_MTM_MIGRATE_DISCRIMINATOR, "migrate", false),
+ (DC_METADATA_MTM_RESIZE_DISCRIMINATOR, "resize", false),
+ (DC_METADATA_MTM_CLOSE_ACCOUNTS_DISCRIMINATOR, "close_accounts", false),
+ (DC_METADATA_MTM_DELEGATE_DISCRIMINATOR, "delegate", false),
+ (DC_METADATA_MTM_REVOKE_DISCRIMINATOR, "revoke", false),
];
/// Canonical tracing target for this decoder.
-pub(crate) const TRACING_TARGET: &str = "kb-lib.decoder.metadata.metaplex_token_metadata";
+pub(crate) const DC_METADATA_MTM_TRACING_TARGET: &str =
+ "kb-lib.decoder.metadata.metaplex_token_metadata";
diff --git a/kb-lib/src/decoder/metadata/metaplex_token_metadata/decoder.rs b/kb-lib/src/decoder/metadata/metaplex_token_metadata/decoder.rs
index abd637f..b9080cf 100644
--- a/kb-lib/src/decoder/metadata/metaplex_token_metadata/decoder.rs
+++ b/kb-lib/src/decoder/metadata/metaplex_token_metadata/decoder.rs
@@ -3,9 +3,9 @@
//! Exact contextual dispatch for Metaplex Token Metadata.
-const SURFACES: &[crate::DecoderSurface] = &[crate::DecoderSurface {
+const SURFACES: &[crate::DcApiDecoderSurface] = &[crate::DcApiDecoderSurface {
program_id: kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID,
- surface_code: crate::decoder::metadata::metaplex_token_metadata::SURFACE_CODE,
+ surface_code: crate::DC_METADATA_MTM_SURFACE_CODE,
priority: 100,
}];
@@ -13,11 +13,9 @@ const PROGRAM_IDS: &[&str] = &[kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_
/// Exact decoder for the Metaplex Token Metadata program.
#[derive(Clone, Debug, Default)]
-pub struct MetadataMetaplexTokenMetadataDecoder;
+pub struct DcMetadataMetaplexTokenMetadataDecoder;
-impl crate::ProtocolDecoder
- for crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder
-{
+impl crate::DcApiProtocolDecoder for crate::DcMetadataMetaplexTokenMetadataDecoder {
fn decoder_name(&self) -> &'static str {
return "kb_decoder_metadata_metaplex_token_metadata";
}
@@ -32,48 +30,46 @@ impl crate::ProtocolDecoder
fn supports_observation(
&self,
- observation: &crate::ProgramObservation,
- ) -> crate::DecoderSupport {
- return if crate::ProtocolDecoder::handles_program_id(self, &observation.program_id) {
- crate::DecoderSupport::Yes
+ observation: &crate::MdProgramObservation,
+ ) -> crate::DcApiDecoderSupport {
+ return if crate::DcApiProtocolDecoder::handles_program_id(self, &observation.program_id) {
+ crate::DcApiDecoderSupport::Yes
} else {
- crate::DecoderSupport::No
+ crate::DcApiDecoderSupport::No
};
}
fn decode_observation(
&self,
- _observation: &crate::ProgramObservation,
- ) -> kb_core::Result> {
+ _observation: &crate::MdProgramObservation,
+ ) -> kb_core::Result> {
return std::result::Result::Ok(std::vec::Vec::new());
}
}
-impl crate::InstructionDecoder
- for crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder
-{
- fn identity(&self) -> crate::DecoderIdentity {
- return crate::DecoderIdentity {
- name: crate::decoder::metadata::metaplex_token_metadata::SURFACE_CODE.to_string(),
+impl crate::DcApiInstructionDecoder for crate::DcMetadataMetaplexTokenMetadataDecoder {
+ fn identity(&self) -> crate::DcApiDecoderIdentity {
+ return crate::DcApiDecoderIdentity {
+ name: crate::DC_METADATA_MTM_SURFACE_CODE.to_string(),
version: env!("CARGO_PKG_VERSION").to_string(),
};
}
- fn surfaces(&self) -> &'static [crate::DecoderSurface] {
+ fn surfaces(&self) -> &'static [crate::DcApiDecoderSurface] {
return SURFACES;
}
- fn coverage(&self) -> std::vec::Vec {
- return crate::decoder::metadata::metaplex_token_metadata::INSTRUCTION_ENTRIES
+ fn coverage(&self) -> std::vec::Vec {
+ return crate::DC_METADATA_MTM_INSTRUCTION_ENTRIES
.iter()
.map(|(discriminator, code, historical)| {
- return crate::DecoderCoverageDeclaration {
+ return crate::DcApiDecoderCoverageDeclaration {
program_id: kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID
.to_string(),
surface_code: std::option::Option::Some(
- crate::decoder::metadata::metaplex_token_metadata::SURFACE_CODE.to_string(),
+ crate::DC_METADATA_MTM_SURFACE_CODE.to_string(),
),
- entry_kind: crate::DecoderCoverageEntryKind::Instruction,
+ entry_kind: crate::DcApiDecoderCoverageEntryKind::Instruction,
entry_code: (*code).to_string(),
discriminator_hex: std::option::Option::Some(format!("{discriminator:02x}")),
historical: *historical,
@@ -82,42 +78,47 @@ impl crate::InstructionDecoder
.collect();
}
- fn recognize(&self, input: &crate::CoreInstructionReplayInput) -> crate::DecoderRecognition {
+ fn recognize(
+ &self,
+ input: &crate::MdCoreInstructionReplayInput,
+ ) -> crate::DcApiDecoderRecognition {
if input.program_id != kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID {
- return crate::DecoderRecognition::incompatible();
+ return crate::DcApiDecoderRecognition::incompatible();
}
let discriminator =
- crate::decoder::metadata::metaplex_token_metadata::payload_discriminator(input);
+ crate::decoder_metadata_metaplex_token_metadata_payload_discriminator(input);
let entry = discriminator
- .and_then(crate::decoder::metadata::metaplex_token_metadata::entry_for_discriminator);
- return crate::DecoderRecognition::compatible(
+ .and_then(crate::decoder_metadata_metaplex_token_metadata_entry_for_discriminator);
+ return crate::DcApiDecoderRecognition::compatible(
entry.is_some(),
100,
- std::option::Option::Some(
- crate::decoder::metadata::metaplex_token_metadata::SURFACE_CODE.to_string(),
- ),
+ std::option::Option::Some(crate::DC_METADATA_MTM_SURFACE_CODE.to_string()),
entry.map(|(_, code, _)| return code.to_string()),
discriminator.map(|value| return format!("{value:02x}")),
);
}
- fn decode(&self, input: &crate::CoreInstructionReplayInput) -> crate::DecoderExecutionResult {
+ fn decode(
+ &self,
+ input: &crate::MdCoreInstructionReplayInput,
+ ) -> crate::DcApiDecoderExecutionResult {
if input.program_id != kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID {
- return crate::DecoderExecutionResult::unsupported(std::option::Option::None);
+ return crate::DcApiDecoderExecutionResult::unsupported(std::option::Option::None);
}
- let result = crate::decoder::metadata::metaplex_token_metadata::decode(input);
+ let result = crate::decoder_metadata_metaplex_token_metadata_decode(input);
if matches!(
result.status,
- crate::DecoderOutcomeStatus::Failed | crate::DecoderOutcomeStatus::Unsupported
+ crate::DcApiDecoderOutcomeStatus::Failed
+ | crate::DcApiDecoderOutcomeStatus::Unsupported
) {
tracing::error!(
- target: crate::decoder::metadata::metaplex_token_metadata::TRACING_TARGET,
+ target: crate::DC_METADATA_MTM_TRACING_TARGET,
action = "decode_failure",
signature = %input.signature,
slot = input.slot,
instruction_path = %input.instruction_path,
program_id = %input.program_id,
- processor_name = crate::decoder::metadata::metaplex_token_metadata::SURFACE_CODE,
+ processor_name = crate::DC_METADATA_MTM_SURFACE_CODE,
processor_version = env!("CARGO_PKG_VERSION"),
input_key = %input.replay_input_key,
result_status = ?result.status,
@@ -126,7 +127,7 @@ impl crate::InstructionDecoder
);
}
tracing::debug!(
- target: crate::decoder::metadata::metaplex_token_metadata::TRACING_TARGET,
+ target: crate::DC_METADATA_MTM_TRACING_TARGET,
action = "decode",
signature = %input.signature,
instruction_path = %input.instruction_path,
@@ -155,7 +156,7 @@ mod tests {
account_count: usize,
failed: bool,
path: &str,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
let keys = (0..account_count).map(|position| return serde_json::json!({
"accountIndex": position,
"accountKey": format!("account{position}"),
@@ -171,7 +172,7 @@ mod tests {
});
})
.collect::>();
- let result = crate::CoreInstructionReplayInput::new(
+ let result = crate::MdCoreInstructionReplayInput::new(
format!("signature:{path}"),
"signature",
42,
@@ -205,7 +206,7 @@ mod tests {
flags: &[(bool, bool)],
failed: bool,
path: &str,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
let keys = flags
.iter()
.enumerate()
@@ -229,7 +230,7 @@ mod tests {
});
})
.collect::>();
- let result = crate::CoreInstructionReplayInput::new(
+ let result = crate::MdCoreInstructionReplayInput::new(
format!("signature:{path}"),
"signature",
42,
@@ -280,7 +281,7 @@ mod tests {
is_mutable: true,
collection_details: std::option::Option::None,
};
- let mut wire = std::vec![crate::decoder::metadata::metaplex_token_metadata::CREATE_METADATA_ACCOUNT_V3_DISCRIMINATOR];
+ let mut wire = std::vec![crate::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_V3_DISCRIMINATOR];
let encoded = borsh_0_10::to_vec(&args);
match encoded {
std::result::Result::Ok(mut value) => wire.append(&mut value),
@@ -298,7 +299,7 @@ mod tests {
primary_sale_happened: std::option::Option::Some(true),
is_mutable: std::option::Option::Some(false),
};
- let mut wire = std::vec![crate::decoder::metadata::metaplex_token_metadata::UPDATE_METADATA_ACCOUNT_V2_DISCRIMINATOR];
+ let mut wire = std::vec![crate::DC_METADATA_MTM_UPDATE_METADATA_ACCOUNT_V2_DISCRIMINATOR];
let encoded = borsh_0_10::to_vec(&args);
match encoded {
std::result::Result::Ok(mut value) => wire.append(&mut value),
@@ -312,9 +313,7 @@ mod tests {
fn approve_use_authority_wire(number_of_uses: u64) -> std::vec::Vec {
let args =
mpl_token_metadata::instructions::ApproveUseAuthorityInstructionArgs { number_of_uses };
- let mut wire = std::vec![
- crate::decoder::metadata::metaplex_token_metadata::APPROVE_USE_AUTHORITY_DISCRIMINATOR
- ];
+ let mut wire = std::vec![crate::DC_METADATA_MTM_APPROVE_USE_AUTHORITY_DISCRIMINATOR];
let encoded = borsh_0_10::to_vec(&args);
match encoded {
std::result::Result::Ok(mut value) => wire.append(&mut value),
@@ -325,8 +324,7 @@ mod tests {
fn utilize_wire(number_of_uses: u64) -> std::vec::Vec {
let args = mpl_token_metadata::instructions::UtilizeInstructionArgs { number_of_uses };
- let mut wire =
- std::vec![crate::decoder::metadata::metaplex_token_metadata::UTILIZE_DISCRIMINATOR];
+ let mut wire = std::vec![crate::DC_METADATA_MTM_UTILIZE_DISCRIMINATOR];
let encoded = borsh_0_10::to_vec(&args);
match encoded {
std::result::Result::Ok(mut value) => wire.append(&mut value),
@@ -346,7 +344,7 @@ mod tests {
}
fn historical_create_v1_wire() -> std::vec::Vec {
- let mut wire = std::vec![crate::decoder::metadata::metaplex_token_metadata::CREATE_METADATA_ACCOUNT_DISCRIMINATOR];
+ let mut wire = std::vec![crate::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_DISCRIMINATOR];
match borsh_0_10::to_vec(&historical_data()) {
std::result::Result::Ok(mut value) => wire.append(&mut value),
std::result::Result::Err(error) => {
@@ -363,7 +361,7 @@ mod tests {
}
fn historical_update_v1_wire() -> std::vec::Vec {
- let mut wire = std::vec![crate::decoder::metadata::metaplex_token_metadata::UPDATE_METADATA_ACCOUNT_DISCRIMINATOR];
+ let mut wire = std::vec![crate::DC_METADATA_MTM_UPDATE_METADATA_ACCOUNT_DISCRIMINATOR];
let data = std::option::Option::Some(historical_data());
let authority = std::option::Option::Some([7_u8; 32]);
let primary_sale = std::option::Option::Some(true);
@@ -392,7 +390,7 @@ mod tests {
collection: std::option::Option::None,
uses: std::option::Option::None,
};
- let mut wire = std::vec![crate::decoder::metadata::metaplex_token_metadata::CREATE_METADATA_ACCOUNT_V2_DISCRIMINATOR];
+ let mut wire = std::vec![crate::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_V2_DISCRIMINATOR];
let encoded_data = borsh_0_10::to_vec(&data);
match encoded_data {
std::result::Result::Ok(mut value) => wire.append(&mut value),
@@ -425,7 +423,7 @@ mod tests {
}
fn create_master_edition_v3_wire(max_supply: std::option::Option) -> std::vec::Vec {
- let mut wire = std::vec![crate::decoder::metadata::metaplex_token_metadata::CREATE_MASTER_EDITION_V3_DISCRIMINATOR];
+ let mut wire = std::vec![crate::DC_METADATA_MTM_CREATE_MASTER_EDITION_V3_DISCRIMINATOR];
let encoded = borsh_0_10::to_vec(&max_supply);
match encoded {
std::result::Result::Ok(mut value) => wire.append(&mut value),
@@ -465,8 +463,7 @@ mod tests {
}
fn delegate_wire(args: &mpl_token_metadata::types::DelegateArgs) -> std::vec::Vec {
- let mut wire =
- std::vec![crate::decoder::metadata::metaplex_token_metadata::DELEGATE_DISCRIMINATOR];
+ let mut wire = std::vec![crate::DC_METADATA_MTM_DELEGATE_DISCRIMINATOR];
let encoded = match borsh_0_10::BorshSerialize::try_to_vec(args) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
@@ -478,8 +475,7 @@ mod tests {
}
fn revoke_wire(args: &mpl_token_metadata::types::RevokeArgs) -> std::vec::Vec {
- let mut wire =
- std::vec![crate::decoder::metadata::metaplex_token_metadata::REVOKE_DISCRIMINATOR];
+ let mut wire = std::vec![crate::DC_METADATA_MTM_REVOKE_DISCRIMINATOR];
let encoded = match borsh_0_10::BorshSerialize::try_to_vec(args) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
@@ -492,32 +488,30 @@ mod tests {
#[test]
fn decoder_identity_program_boundary_and_coverage_are_exact() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
assert_eq!(
- crate::ProtocolDecoder::decoder_name(&decoder),
+ crate::DcApiProtocolDecoder::decoder_name(&decoder),
"kb_decoder_metadata_metaplex_token_metadata"
);
assert_eq!(
- crate::ProtocolDecoder::program_ids(&decoder),
+ crate::DcApiProtocolDecoder::program_ids(&decoder),
&[kb_program_ids::METADATA_METAPLEX_TOKEN_METADATA_PROGRAM_ID]
);
assert_eq!(
- crate::decoder::metadata::metaplex_token_metadata::TRACING_TARGET,
+ crate::DC_METADATA_MTM_TRACING_TARGET,
"kb-lib.decoder.metadata.metaplex_token_metadata"
);
- assert_eq!(crate::InstructionDecoder::coverage(&decoder).len(), 58);
+ assert_eq!(crate::DcApiInstructionDecoder::coverage(&decoder).len(), 58);
}
#[test]
fn printed_edition_mint_variants_decode_exact_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let token = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let token = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
mint_new_edition_wire(
- crate::decoder::metadata::metaplex_token_metadata::MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR,
+ crate::DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR,
u64::MAX,
)
.as_slice(),
@@ -540,18 +534,18 @@ mod tests {
"printed_edition_token",
),
);
- assert_eq!(token.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(token.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
token.recognized_entry_code.as_deref(),
std::option::Option::Some("mint_new_edition_from_master_edition_via_token")
);
assert_eq!(token.observations[0].payload_json["parameters"]["edition"], u64::MAX);
assert_eq!(token.observations[0].payload_json["accounts"][4]["role"], "edition_marker");
- let vault = crate::InstructionDecoder::decode(
+ let vault = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
mint_new_edition_wire(
- crate::decoder::metadata::metaplex_token_metadata::MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_DISCRIMINATOR,
+ crate::DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_DISCRIMINATOR,
248,
)
.as_slice(),
@@ -577,7 +571,7 @@ mod tests {
"printed_edition_vault",
),
);
- assert_eq!(vault.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(vault.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
vault.recognized_entry_code.as_deref(),
std::option::Option::Some("mint_new_edition_from_master_edition_via_vault_proxy")
@@ -607,17 +601,13 @@ mod tests {
decimals: std::option::Option::None,
print_supply: std::option::Option::None,
};
- return programmable_wire(
- crate::decoder::metadata::metaplex_token_metadata::CREATE_DISCRIMINATOR,
- &args,
- );
+ return programmable_wire(crate::DC_METADATA_MTM_CREATE_DISCRIMINATOR, &args);
}
#[test]
fn modern_create_decodes_exact_contract() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let result = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let result = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
modern_create_wire().as_slice(),
@@ -636,7 +626,7 @@ mod tests {
"modern_create",
),
);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(result.recognized_entry_code.as_deref(), std::option::Option::Some("create"));
assert_eq!(result.observations[0].payload_json["accounts"][0]["role"], "metadata");
assert_eq!(
@@ -647,12 +637,11 @@ mod tests {
#[test]
fn modern_create_rejects_truncated_invalid_and_suffix_wires() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let truncated = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let truncated = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::CREATE_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_CREATE_DISCRIMINATOR],
&[
(false, true),
(false, true),
@@ -668,8 +657,8 @@ mod tests {
"modern_create_truncated",
),
);
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
- let invalid = crate::InstructionDecoder::decode(
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
modern_create_wire().as_slice(),
@@ -688,10 +677,10 @@ mod tests {
"modern_create_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
let mut suffix_wire = modern_create_wire();
suffix_wire.push(1);
- let suffix = crate::InstructionDecoder::decode(
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
suffix_wire.as_slice(),
@@ -710,7 +699,7 @@ mod tests {
"modern_create_suffix",
),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
fn modern_mint_wire(amount: u64) -> std::vec::Vec {
@@ -718,17 +707,13 @@ mod tests {
amount,
authorization_data: std::option::Option::None,
};
- return programmable_wire(
- crate::decoder::metadata::metaplex_token_metadata::MINT_DISCRIMINATOR,
- &args,
- );
+ return programmable_wire(crate::DC_METADATA_MTM_MINT_DISCRIMINATOR, &args);
}
#[test]
fn modern_mint_decodes_exact_contract() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let result = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let result = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
modern_mint_wire(u64::MAX).as_slice(),
@@ -753,7 +738,7 @@ mod tests {
"modern_mint",
),
);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(result.recognized_entry_code.as_deref(), std::option::Option::Some("mint"));
assert_eq!(result.observations[0].payload_json["parameters"]["V1"]["amount"], u64::MAX);
assert_eq!(result.observations[0].payload_json["accounts"][4]["role"], "token_record");
@@ -765,8 +750,7 @@ mod tests {
#[test]
fn modern_mint_rejects_truncated_invalid_and_suffix_wires() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
let flags = [
(false, true),
(false, false),
@@ -784,19 +768,19 @@ mod tests {
(false, false),
(false, false),
];
- let truncated = crate::InstructionDecoder::decode(
+ let truncated = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::MINT_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_MINT_DISCRIMINATOR],
&flags,
false,
"modern_mint_truncated",
),
);
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
let mut invalid_flags = flags;
invalid_flags[6] = (false, false);
- let invalid = crate::InstructionDecoder::decode(
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
modern_mint_wire(1).as_slice(),
@@ -805,36 +789,29 @@ mod tests {
"modern_mint_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
let mut suffix_wire = modern_mint_wire(2);
suffix_wire.push(1);
- let suffix = crate::InstructionDecoder::decode(
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(suffix_wire.as_slice(), &flags, false, "modern_mint_suffix"),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
fn modern_print_wire_v1(edition: u64) -> std::vec::Vec {
let args = mpl_token_metadata::types::PrintArgs::V1 { edition };
- return programmable_wire(
- crate::decoder::metadata::metaplex_token_metadata::PRINT_DISCRIMINATOR,
- &args,
- );
+ return programmable_wire(crate::DC_METADATA_MTM_PRINT_DISCRIMINATOR, &args);
}
fn modern_print_wire_v2(edition: u64) -> std::vec::Vec {
let args = mpl_token_metadata::types::PrintArgs::V2 { edition };
- return programmable_wire(
- crate::decoder::metadata::metaplex_token_metadata::PRINT_DISCRIMINATOR,
- &args,
- );
+ return programmable_wire(crate::DC_METADATA_MTM_PRINT_DISCRIMINATOR, &args);
}
#[test]
fn modern_print_v1_and_v2_decode_exact_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
let flags = [
(false, true),
(false, true),
@@ -855,7 +832,7 @@ mod tests {
(false, false),
(false, false),
];
- let v1 = crate::InstructionDecoder::decode(
+ let v1 = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
modern_print_wire_v1(u64::MAX).as_slice(),
@@ -864,23 +841,22 @@ mod tests {
"modern_print_v1",
),
);
- assert_eq!(v1.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(v1.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(v1.recognized_entry_code.as_deref(), std::option::Option::Some("print"));
assert_eq!(v1.observations[0].payload_json["parameters"]["V1"]["edition"], u64::MAX);
assert_eq!(v1.observations[0].payload_json["accounts"][8]["role"], "edition_marker_pda");
- let v2 = crate::InstructionDecoder::decode(
+ let v2 = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(modern_print_wire_v2(42).as_slice(), &flags, true, "modern_print_v2"),
);
- assert_eq!(v2.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(v2.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(v2.observations[0].payload_json["parameters"]["V2"]["edition"], 42);
assert!(!v2.observations[0].observation_committed);
}
#[test]
fn modern_print_rejects_truncated_invalid_and_suffix_wires() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
let flags = [
(false, true),
(false, true),
@@ -901,19 +877,19 @@ mod tests {
(false, false),
(false, false),
];
- let truncated = crate::InstructionDecoder::decode(
+ let truncated = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::PRINT_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_PRINT_DISCRIMINATOR],
&flags,
false,
"modern_print_truncated",
),
);
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
let mut invalid_flags = flags;
invalid_flags[10] = (false, false);
- let invalid = crate::InstructionDecoder::decode(
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
modern_print_wire_v1(1).as_slice(),
@@ -922,14 +898,14 @@ mod tests {
"modern_print_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
let mut suffix_wire = modern_print_wire_v2(2);
suffix_wire.push(1);
- let suffix = crate::InstructionDecoder::decode(
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(suffix_wire.as_slice(), &flags, false, "modern_print_suffix"),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
fn modern_update_wire() -> std::vec::Vec {
@@ -937,16 +913,12 @@ mod tests {
collection: mpl_token_metadata::types::CollectionToggle::None,
authorization_data: std::option::Option::None,
};
- return programmable_wire(
- crate::decoder::metadata::metaplex_token_metadata::UPDATE_DISCRIMINATOR,
- &args,
- );
+ return programmable_wire(crate::DC_METADATA_MTM_UPDATE_DISCRIMINATOR, &args);
}
#[test]
fn modern_update_variants_decode_exact_contract() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
let flags = [
(true, false),
(false, false),
@@ -960,11 +932,11 @@ mod tests {
(false, false),
(false, false),
];
- let result = crate::InstructionDecoder::decode(
+ let result = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(modern_update_wire().as_slice(), &flags, false, "modern_update"),
);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(result.recognized_entry_code.as_deref(), std::option::Option::Some("update"));
assert_eq!(
result.observations[0].payload_json["parameters"]["AsCollectionDelegateV2"]["collection"],
@@ -979,8 +951,7 @@ mod tests {
#[test]
fn modern_update_rejects_truncated_invalid_and_suffix_wires() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
let flags = [
(true, false),
(false, false),
@@ -994,19 +965,19 @@ mod tests {
(false, false),
(false, false),
];
- let truncated = crate::InstructionDecoder::decode(
+ let truncated = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::UPDATE_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_UPDATE_DISCRIMINATOR],
&flags,
false,
"modern_update_truncated",
),
);
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
let mut invalid_flags = flags;
invalid_flags[0] = (false, false);
- let invalid = crate::InstructionDecoder::decode(
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
modern_update_wire().as_slice(),
@@ -1015,24 +986,21 @@ mod tests {
"modern_update_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
let mut suffix_wire = modern_update_wire();
suffix_wire.push(1);
- let suffix = crate::InstructionDecoder::decode(
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(suffix_wire.as_slice(), &flags, false, "modern_update_suffix"),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
fn modern_use_wire() -> std::vec::Vec {
let args = mpl_token_metadata::types::UseArgs::V1 {
authorization_data: std::option::Option::None,
};
- return programmable_wire(
- crate::decoder::metadata::metaplex_token_metadata::USE_DISCRIMINATOR,
- &args,
- );
+ return programmable_wire(crate::DC_METADATA_MTM_USE_DISCRIMINATOR, &args);
}
fn modern_verification_wire(
@@ -1044,8 +1012,7 @@ mod tests {
#[test]
fn modern_use_verify_and_unverify_decode_exact_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
let use_flags = [
(true, false),
(false, true),
@@ -1060,11 +1027,11 @@ mod tests {
(false, false),
(false, false),
];
- let use_result = crate::InstructionDecoder::decode(
+ let use_result = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(modern_use_wire().as_slice(), &use_flags, false, "modern_use"),
);
- assert_eq!(use_result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(use_result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(use_result.recognized_entry_code.as_deref(), std::option::Option::Some("use"));
assert_eq!(
use_result.observations[0].payload_json["parameters"]["V1"]["authorization_data"],
@@ -1080,11 +1047,11 @@ mod tests {
(false, false),
(false, false),
];
- let verify = crate::InstructionDecoder::decode(
+ let verify = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
modern_verification_wire(
- crate::decoder::metadata::metaplex_token_metadata::VERIFY_DISCRIMINATOR,
+ crate::DC_METADATA_MTM_VERIFY_DISCRIMINATOR,
mpl_token_metadata::types::VerificationArgs::CollectionV1,
)
.as_slice(),
@@ -1093,13 +1060,13 @@ mod tests {
"modern_verify",
),
);
- assert_eq!(verify.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(verify.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(verify.observations[0].payload_json["parameters"], "CollectionV1");
- let unverify = crate::InstructionDecoder::decode(
+ let unverify = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
modern_verification_wire(
- crate::decoder::metadata::metaplex_token_metadata::UNVERIFY_DISCRIMINATOR,
+ crate::DC_METADATA_MTM_UNVERIFY_DISCRIMINATOR,
mpl_token_metadata::types::VerificationArgs::CreatorV1,
)
.as_slice(),
@@ -1108,7 +1075,7 @@ mod tests {
"modern_unverify",
),
);
- assert_eq!(unverify.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(unverify.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
unverify.recognized_entry_code.as_deref(),
std::option::Option::Some("unverify")
@@ -1118,8 +1085,7 @@ mod tests {
#[test]
fn modern_use_verify_and_unverify_reject_invalid_wires() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
let use_flags = [
(true, false),
(false, true),
@@ -1134,19 +1100,19 @@ mod tests {
(false, false),
(false, false),
];
- let truncated = crate::InstructionDecoder::decode(
+ let truncated = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::USE_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_USE_DISCRIMINATOR],
&use_flags,
false,
"modern_use_truncated",
),
);
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
let mut invalid_flags = use_flags;
invalid_flags[0] = (false, false);
- let invalid = crate::InstructionDecoder::decode(
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
modern_use_wire().as_slice(),
@@ -1155,7 +1121,7 @@ mod tests {
"modern_use_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
let verify_flags = [
(true, false),
(false, false),
@@ -1167,36 +1133,35 @@ mod tests {
(false, false),
];
let mut suffix_wire = modern_verification_wire(
- crate::decoder::metadata::metaplex_token_metadata::VERIFY_DISCRIMINATOR,
+ crate::DC_METADATA_MTM_VERIFY_DISCRIMINATOR,
mpl_token_metadata::types::VerificationArgs::CreatorV1,
);
suffix_wire.push(1);
- let suffix = crate::InstructionDecoder::decode(
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(suffix_wire.as_slice(), &verify_flags, false, "modern_verify_suffix"),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn printed_edition_mint_variants_reject_truncated_wire_invalid_flags_and_suffixes() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let truncated = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let truncated = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR],
&[(false, true); 13],
false,
"printed_edition_truncated",
),
);
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
- let invalid = crate::InstructionDecoder::decode(
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
mint_new_edition_wire(
- crate::decoder::metadata::metaplex_token_metadata::MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR,
+ crate::DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR,
1,
)
.as_slice(),
@@ -1219,13 +1184,13 @@ mod tests {
"printed_edition_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
let mut suffix_wire = mint_new_edition_wire(
- crate::decoder::metadata::metaplex_token_metadata::MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_DISCRIMINATOR,
+ crate::DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_DISCRIMINATOR,
2,
);
suffix_wire.push(1);
- let suffix = crate::InstructionDecoder::decode(
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
suffix_wire.as_slice(),
@@ -1251,14 +1216,13 @@ mod tests {
"printed_edition_suffix",
),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn master_edition_creation_and_conversion_decode_exact_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let create = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let create = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
create_master_edition_v3_wire(std::option::Option::Some(u64::MAX)).as_slice(),
@@ -1276,23 +1240,23 @@ mod tests {
"master_edition_create",
),
);
- assert_eq!(create.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(create.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
create.recognized_entry_code.as_deref(),
std::option::Option::Some("create_master_edition_v3")
);
assert_eq!(create.observations[0].payload_json["parameters"]["max_supply"], u64::MAX);
assert_eq!(create.observations[0].payload_json["accounts"][0]["role"], "master_edition");
- let convert = crate::InstructionDecoder::decode(
+ let convert = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::CONVERT_MASTER_EDITION_V1_TO_V2_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_CONVERT_MASTER_EDITION_V1_TO_V2_DISCRIMINATOR],
&[(false, true), (false, true), (false, true)],
true,
"master_edition_convert",
),
);
- assert_eq!(convert.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(convert.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
convert.recognized_entry_code.as_deref(),
std::option::Option::Some("convert_master_edition_v1_to_v2")
@@ -1302,12 +1266,11 @@ mod tests {
#[test]
fn master_edition_group_rejects_truncated_wire_invalid_flags_and_suffixes() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let truncated = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let truncated = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::CREATE_MASTER_EDITION_V3_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_CREATE_MASTER_EDITION_V3_DISCRIMINATOR],
&[
(false, true),
(false, true),
@@ -1322,8 +1285,8 @@ mod tests {
"master_edition_truncated",
),
);
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
- let invalid = crate::InstructionDecoder::decode(
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
create_master_edition_v3_wire(std::option::Option::None).as_slice(),
@@ -1341,24 +1304,23 @@ mod tests {
"master_edition_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
- let suffix = crate::InstructionDecoder::decode(
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::CONVERT_MASTER_EDITION_V1_TO_V2_DISCRIMINATOR, 1],
+ &[crate::DC_METADATA_MTM_CONVERT_MASTER_EDITION_V1_TO_V2_DISCRIMINATOR, 1],
&[(false, true), (false, true), (false, true)],
false,
"master_edition_suffix",
),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn historical_v1_create_and_update_decode_exact_wires() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let create = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let create = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
historical_create_v1_wire().as_slice(),
@@ -1375,13 +1337,13 @@ mod tests {
"legacy_create_v1",
),
);
- assert_eq!(create.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(create.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
create.recognized_entry_code.as_deref(),
std::option::Option::Some("create_metadata_account")
);
assert_eq!(create.observations[0].payload_json["parameters"]["data"]["name"], "Legacy V1");
- let update = crate::InstructionDecoder::decode(
+ let update = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
historical_update_v1_wire().as_slice(),
@@ -1390,7 +1352,7 @@ mod tests {
"legacy_update_v1",
),
);
- assert_eq!(update.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(update.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
update.recognized_entry_code.as_deref(),
std::option::Option::Some("update_metadata_account")
@@ -1404,19 +1366,18 @@ mod tests {
#[test]
fn historical_v1_wires_reject_truncation_and_invalid_accounts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let truncated = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let truncated = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::UPDATE_METADATA_ACCOUNT_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_UPDATE_METADATA_ACCOUNT_DISCRIMINATOR],
&[(false, true), (true, false)],
false,
"legacy_update_v1_truncated",
),
);
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
- let invalid = crate::InstructionDecoder::decode(
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
historical_create_v1_wire().as_slice(),
@@ -1433,14 +1394,13 @@ mod tests {
"legacy_create_v1_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn historical_create_metadata_account_v2_decodes_bounded_data_v2() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let result = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let result = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
historical_create_v2_wire().as_slice(),
@@ -1457,7 +1417,7 @@ mod tests {
"legacy_create_v2",
),
);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some("create_metadata_account_v2")
@@ -1471,12 +1431,11 @@ mod tests {
#[test]
fn historical_create_metadata_account_v2_rejects_truncated_wire_and_invalid_flags() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let truncated = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let truncated = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::CREATE_METADATA_ACCOUNT_V2_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_V2_DISCRIMINATOR],
&[
(false, true),
(false, false),
@@ -1489,8 +1448,8 @@ mod tests {
"legacy_create_v2_truncated",
),
);
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
- let invalid = crate::InstructionDecoder::decode(
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
historical_create_v2_wire().as_slice(),
@@ -1506,18 +1465,17 @@ mod tests {
"legacy_create_v2_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn create_metadata_account_v3_decodes_official_borsh_wire() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let result = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let result = crate::DcApiInstructionDecoder::decode(
&decoder,
&input(create_wire().as_slice(), 6, false, "0"),
);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some("create_metadata_account_v3")
@@ -1529,16 +1487,15 @@ mod tests {
#[test]
fn update_metadata_account_v2_preserves_failed_transaction_as_uncommitted() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let result = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let result = crate::DcApiInstructionDecoder::decode(
&decoder,
&input(update_wire().as_slice(), 2, true, "1/0"),
);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.observations[0].event.source_kind,
- crate::EventSourceKind::InnerInstruction
+ crate::MdEventSourceKind::InnerInstruction
);
assert!(!result.observations[0].observation_committed);
assert_eq!(
@@ -1549,12 +1506,11 @@ mod tests {
#[test]
fn collection_verification_family_decodes_exact_account_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let verify = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let verify = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::VERIFY_COLLECTION_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_VERIFY_COLLECTION_DISCRIMINATOR],
&[
(false, true),
(true, true),
@@ -1568,7 +1524,7 @@ mod tests {
"2/0",
),
);
- assert_eq!(verify.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(verify.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
verify.recognized_entry_code.as_deref(),
std::option::Option::Some("verify_collection")
@@ -1577,21 +1533,21 @@ mod tests {
verify.observations[0].payload_json["accounts"][6]["role"],
"collection_authority_record"
);
- let unverify = crate::InstructionDecoder::decode(
+ let unverify = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::UNVERIFY_COLLECTION_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_UNVERIFY_COLLECTION_DISCRIMINATOR],
&[(false, true), (true, true), (false, false), (false, false), (false, false)],
true,
"2/1",
),
);
- assert_eq!(unverify.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(unverify.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!unverify.observations[0].observation_committed);
- let set_and_verify = crate::InstructionDecoder::decode(
+ let set_and_verify = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::SET_AND_VERIFY_COLLECTION_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_SET_AND_VERIFY_COLLECTION_DISCRIMINATOR],
&[
(false, true),
(true, true),
@@ -1606,7 +1562,7 @@ mod tests {
"3",
),
);
- assert_eq!(set_and_verify.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(set_and_verify.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
set_and_verify.observations[0].payload_json["accounts"][3]["role"],
"update_authority"
@@ -1615,12 +1571,11 @@ mod tests {
#[test]
fn collection_authority_administration_decodes_exact_account_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let approve = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let approve = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::APPROVE_COLLECTION_AUTHORITY_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_APPROVE_COLLECTION_AUTHORITY_DISCRIMINATOR],
&[
(false, true),
(false, false),
@@ -1635,7 +1590,7 @@ mod tests {
"approve_collection_authority",
),
);
- assert_eq!(approve.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(approve.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
approve.recognized_entry_code.as_deref(),
std::option::Option::Some("approve_collection_authority")
@@ -1649,16 +1604,16 @@ mod tests {
"new_collection_authority"
);
assert_eq!(approve.observations[0].payload_json["accounts"][7]["role"], "rent");
- let revoke = crate::InstructionDecoder::decode(
+ let revoke = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::REVOKE_COLLECTION_AUTHORITY_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_REVOKE_COLLECTION_AUTHORITY_DISCRIMINATOR],
&[(false, true), (false, true), (true, true), (false, false), (false, false)],
true,
"4/0",
),
);
- assert_eq!(revoke.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(revoke.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!revoke.observations[0].observation_committed);
assert_eq!(
revoke.observations[0].payload_json["accounts"][1]["role"],
@@ -1669,12 +1624,11 @@ mod tests {
#[test]
fn collection_authority_administration_rejects_invalid_flags_and_suffixes() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let invalid = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::APPROVE_COLLECTION_AUTHORITY_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_APPROVE_COLLECTION_AUTHORITY_DISCRIMINATOR],
&[
(false, true),
(false, false),
@@ -1688,24 +1642,23 @@ mod tests {
"approve-invalid-flags",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
- let suffix = crate::InstructionDecoder::decode(
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::REVOKE_COLLECTION_AUTHORITY_DISCRIMINATOR, 0],
+ &[crate::DC_METADATA_MTM_REVOKE_COLLECTION_AUTHORITY_DISCRIMINATOR, 0],
&[(false, true), (false, true), (true, true), (false, false), (false, false)],
false,
"revoke-suffix",
),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn use_authority_family_decodes_parameters_and_exact_account_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let approve = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let approve = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
approve_use_authority_wire(u64::MAX).as_slice(),
@@ -1726,7 +1679,7 @@ mod tests {
"approve_use_authority",
),
);
- assert_eq!(approve.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(approve.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(approve.observations[0].payload_json["parameters"]["number_of_uses"], u64::MAX);
assert_eq!(
approve.observations[0].payload_json["accounts"][0]["role"],
@@ -1734,10 +1687,10 @@ mod tests {
);
assert_eq!(approve.observations[0].payload_json["accounts"][7]["role"], "burner");
assert_eq!(approve.observations[0].payload_json["accounts"][10]["role"], "rent");
- let revoke = crate::InstructionDecoder::decode(
+ let revoke = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::REVOKE_USE_AUTHORITY_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_REVOKE_USE_AUTHORITY_DISCRIMINATOR],
&[
(false, true),
(true, true),
@@ -1753,13 +1706,13 @@ mod tests {
"revoke_use_authority/0",
),
);
- assert_eq!(revoke.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(revoke.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!revoke.observations[0].observation_committed);
assert_eq!(
revoke.observations[0].payload_json["accounts"][3]["role"],
"owner_token_account"
);
- let utilize = crate::InstructionDecoder::decode(
+ let utilize = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
utilize_wire(3).as_slice(),
@@ -1780,7 +1733,7 @@ mod tests {
"utilize",
),
);
- assert_eq!(utilize.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(utilize.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(utilize.observations[0].payload_json["parameters"]["number_of_uses"], 3);
assert_eq!(
utilize.observations[0].payload_json["accounts"][9]["role"],
@@ -1791,19 +1744,18 @@ mod tests {
#[test]
fn use_authority_family_rejects_truncated_wire_invalid_flags_and_suffixes() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let truncated = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let truncated = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::APPROVE_USE_AUTHORITY_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_APPROVE_USE_AUTHORITY_DISCRIMINATOR],
&[(false, true); 10],
false,
"approve_use_authority_truncated",
),
);
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
- let invalid_flags = crate::InstructionDecoder::decode(
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let invalid_flags = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
utilize_wire(1).as_slice(),
@@ -1822,11 +1774,11 @@ mod tests {
"utilize_invalid_flags",
),
);
- assert_eq!(invalid_flags.status, crate::DecoderOutcomeStatus::Failed);
- let suffix = crate::InstructionDecoder::decode(
+ assert_eq!(invalid_flags.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::REVOKE_USE_AUTHORITY_DISCRIMINATOR, 0],
+ &[crate::DC_METADATA_MTM_REVOKE_USE_AUTHORITY_DISCRIMINATOR, 0],
&[
(false, true),
(true, true),
@@ -1841,35 +1793,34 @@ mod tests {
"revoke_use_authority_suffix",
),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn creator_signature_and_primary_sale_family_decode_exact_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let sign = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let sign = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::SIGN_METADATA_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_SIGN_METADATA_DISCRIMINATOR],
&[(false, true), (true, false)],
false,
"sign_metadata",
),
);
- assert_eq!(sign.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(sign.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(sign.observations[0].payload_json["accounts"][0]["role"], "metadata");
assert_eq!(sign.observations[0].payload_json["accounts"][1]["role"], "creator");
- let primary_sale = crate::InstructionDecoder::decode(
+ let primary_sale = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_DISCRIMINATOR],
&[(false, true), (true, false), (false, false)],
true,
"update_primary_sale_happened_via_token/0",
),
);
- assert_eq!(primary_sale.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(primary_sale.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!primary_sale.observations[0].observation_committed);
assert_eq!(primary_sale.observations[0].payload_json["accounts"][1]["role"], "owner");
assert_eq!(
@@ -1880,34 +1831,32 @@ mod tests {
#[test]
fn creator_signature_and_primary_sale_family_reject_invalid_flags_and_suffixes() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let invalid = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::SIGN_METADATA_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_SIGN_METADATA_DISCRIMINATOR],
&[(false, true), (false, false)],
false,
"sign_metadata_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
- let suffix = crate::InstructionDecoder::decode(
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_DISCRIMINATOR, 0],
+ &[crate::DC_METADATA_MTM_UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_DISCRIMINATOR, 0],
&[(false, true), (true, false), (false, false)],
false,
"primary_sale_suffix",
),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn sized_collection_verification_family_preserves_writable_collection_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
let flags = &[
(false, true),
(true, false),
@@ -1919,19 +1868,19 @@ mod tests {
];
for (discriminator, code) in [
(
- crate::decoder::metadata::metaplex_token_metadata::VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR,
+ crate::DC_METADATA_MTM_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR,
"verify_sized_collection_item",
),
(
- crate::decoder::metadata::metaplex_token_metadata::UNVERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR,
+ crate::DC_METADATA_MTM_UNVERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR,
"unverify_sized_collection_item",
),
] {
- let result = crate::InstructionDecoder::decode(
+ let result = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(&[discriminator], flags, false, code),
);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(result.recognized_entry_code.as_deref(), std::option::Option::Some(code));
assert_eq!(
result.observations[0].payload_json["accounts"][4]["role"],
@@ -1943,10 +1892,10 @@ mod tests {
"collection_authority_record"
);
}
- let set_and_verify = crate::InstructionDecoder::decode(
+ let set_and_verify = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::SET_AND_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_SET_AND_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR],
&[
(false, true),
(true, false),
@@ -1961,7 +1910,7 @@ mod tests {
"set_and_verify_sized_collection_item",
),
);
- assert_eq!(set_and_verify.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(set_and_verify.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!set_and_verify.observations[0].observation_committed);
assert_eq!(
set_and_verify.observations[0].payload_json["accounts"][3]["role"],
@@ -1972,12 +1921,11 @@ mod tests {
#[test]
fn sized_collection_verification_rejects_non_writable_collection_and_suffix() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let invalid_collection = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let invalid_collection = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR],
&[
(false, true),
(true, false),
@@ -1990,11 +1938,11 @@ mod tests {
"sized-invalid-flags",
),
);
- assert_eq!(invalid_collection.status, crate::DecoderOutcomeStatus::Failed);
- let suffix = crate::InstructionDecoder::decode(
+ assert_eq!(invalid_collection.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::UNVERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR, 0],
+ &[crate::DC_METADATA_MTM_UNVERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR, 0],
&[
(false, true),
(true, false),
@@ -2007,17 +1955,16 @@ mod tests {
"sized-suffix",
),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn collection_verification_rejects_invalid_flags_and_suffixes() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let invalid_flags = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let invalid_flags = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::VERIFY_COLLECTION_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_VERIFY_COLLECTION_DISCRIMINATOR],
&[
(false, true),
(false, true),
@@ -2030,40 +1977,47 @@ mod tests {
"4",
),
);
- assert_eq!(invalid_flags.status, crate::DecoderOutcomeStatus::Failed);
- let suffix = crate::InstructionDecoder::decode(
+ assert_eq!(invalid_flags.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::UNVERIFY_COLLECTION_DISCRIMINATOR, 0],
+ &[crate::DC_METADATA_MTM_UNVERIFY_COLLECTION_DISCRIMINATOR, 0],
&[(false, true), (true, true), (false, false), (false, false), (false, false)],
false,
"5",
),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn unknown_truncated_suffix_and_invalid_accounts_fail_closed() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let unknown = crate::InstructionDecoder::decode(&decoder, &input(&[254], 0, false, "0"));
- assert_eq!(unknown.status, crate::DecoderOutcomeStatus::Unsupported);
- let truncated = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let unknown =
+ crate::DcApiInstructionDecoder::decode(&decoder, &input(&[254], 0, false, "0"));
+ assert_eq!(unknown.status, crate::DcApiDecoderOutcomeStatus::Unsupported);
+ let truncated = crate::DcApiInstructionDecoder::decode(
&decoder,
- &input(&[crate::decoder::metadata::metaplex_token_metadata::CREATE_METADATA_ACCOUNT_V3_DISCRIMINATOR], 6, false, "0"),
+ &input(
+ &[crate::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_V3_DISCRIMINATOR],
+ 6,
+ false,
+ "0",
+ ),
);
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
let mut suffix = update_wire();
suffix.push(7);
- let suffix_result =
- crate::InstructionDecoder::decode(&decoder, &input(suffix.as_slice(), 2, false, "0"));
- assert_eq!(suffix_result.status, crate::DecoderOutcomeStatus::Failed);
- let accounts = crate::InstructionDecoder::decode(
+ let suffix_result = crate::DcApiInstructionDecoder::decode(
+ &decoder,
+ &input(suffix.as_slice(), 2, false, "0"),
+ );
+ assert_eq!(suffix_result.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let accounts = crate::DcApiInstructionDecoder::decode(
&decoder,
&input(create_wire().as_slice(), 2, false, "0"),
);
- assert_eq!(accounts.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(accounts.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
@@ -2095,114 +2049,114 @@ mod tests {
#[test]
fn metadata_normalization_and_creator_unverification_decode_exact_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let puff = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let puff = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::PUFF_METADATA_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_PUFF_METADATA_DISCRIMINATOR],
&[(false, true)],
false,
"puff_metadata",
),
);
- assert_eq!(puff.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(puff.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(puff.observations[0].payload_json["accounts"][0]["role"], "metadata");
- let remove = crate::InstructionDecoder::decode(
+ let remove = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::REMOVE_CREATOR_VERIFICATION_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_REMOVE_CREATOR_VERIFICATION_DISCRIMINATOR],
&[(false, true), (true, false)],
true,
"remove_creator_verification/0",
),
);
- assert_eq!(remove.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(remove.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!remove.observations[0].observation_committed);
assert_eq!(remove.observations[0].payload_json["accounts"][1]["role"], "creator");
- let token_standard = crate::InstructionDecoder::decode(
+ let token_standard = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::SET_TOKEN_STANDARD_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_SET_TOKEN_STANDARD_DISCRIMINATOR],
&[(false, true), (true, false), (false, false), (false, false)],
false,
"set_token_standard",
),
);
- assert_eq!(token_standard.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(token_standard.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(token_standard.observations[0].payload_json["accounts"][3]["role"], "edition");
}
#[test]
fn metadata_normalization_family_rejects_invalid_flags_and_suffixes() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let invalid = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::REMOVE_CREATOR_VERIFICATION_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_REMOVE_CREATOR_VERIFICATION_DISCRIMINATOR],
&[(false, true), (false, false)],
false,
"remove_creator_verification_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
- let suffix = crate::InstructionDecoder::decode(
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[
- crate::decoder::metadata::metaplex_token_metadata::PUFF_METADATA_DISCRIMINATOR,
- 0,
- ],
+ &[crate::DC_METADATA_MTM_PUFF_METADATA_DISCRIMINATOR, 0],
&[(false, true)],
false,
"puff_metadata_suffix",
),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
- let invalid_standard = crate::InstructionDecoder::decode(
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let invalid_standard = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::SET_TOKEN_STANDARD_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_SET_TOKEN_STANDARD_DISCRIMINATOR],
&[(false, true), (false, false), (false, false)],
false,
"set_token_standard_invalid",
),
);
- assert_eq!(invalid_standard.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(invalid_standard.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn collection_size_variants_decode_exact_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let direct = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let direct = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- set_collection_size_wire(crate::decoder::metadata::metaplex_token_metadata::SET_COLLECTION_SIZE_DISCRIMINATOR, u64::MAX)
- .as_slice(),
+ set_collection_size_wire(
+ crate::DC_METADATA_MTM_SET_COLLECTION_SIZE_DISCRIMINATOR,
+ u64::MAX,
+ )
+ .as_slice(),
&[(false, true), (true, true), (false, false), (false, false)],
false,
"set_collection_size",
),
);
- assert_eq!(direct.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(direct.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(direct.observations[0].payload_json["parameters"]["size"], u64::MAX);
assert_eq!(
direct.observations[0].payload_json["accounts"][3]["role"],
"collection_authority_record"
);
- let bubblegum = crate::InstructionDecoder::decode(
+ let bubblegum = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- set_collection_size_wire(crate::decoder::metadata::metaplex_token_metadata::BUBBLEGUM_SET_COLLECTION_SIZE_DISCRIMINATOR, 42)
- .as_slice(),
+ set_collection_size_wire(
+ crate::DC_METADATA_MTM_BUBBLEGUM_SET_COLLECTION_SIZE_DISCRIMINATOR,
+ 42,
+ )
+ .as_slice(),
&[(false, true), (true, false), (false, false), (true, false), (false, false)],
true,
"bubblegum_set_collection_size/0",
),
);
- assert_eq!(bubblegum.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(bubblegum.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(bubblegum.observations[0].payload_json["parameters"]["size"], 42);
assert_eq!(
bubblegum.observations[0].payload_json["accounts"][3]["role"],
@@ -2213,35 +2167,35 @@ mod tests {
#[test]
fn collection_size_variants_reject_truncated_wire_invalid_flags_and_suffixes() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let truncated = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let truncated = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::SET_COLLECTION_SIZE_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_SET_COLLECTION_SIZE_DISCRIMINATOR],
&[(false, true), (true, true), (false, false)],
false,
"set_collection_size_truncated",
),
);
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
- let invalid = crate::InstructionDecoder::decode(
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- set_collection_size_wire(crate::decoder::metadata::metaplex_token_metadata::BUBBLEGUM_SET_COLLECTION_SIZE_DISCRIMINATOR, 1)
- .as_slice(),
+ set_collection_size_wire(
+ crate::DC_METADATA_MTM_BUBBLEGUM_SET_COLLECTION_SIZE_DISCRIMINATOR,
+ 1,
+ )
+ .as_slice(),
&[(false, true), (true, true), (false, false), (true, false)],
false,
"bubblegum_set_collection_size_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
- let mut suffix_wire = set_collection_size_wire(
- crate::decoder::metadata::metaplex_token_metadata::SET_COLLECTION_SIZE_DISCRIMINATOR,
- 2,
- );
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let mut suffix_wire =
+ set_collection_size_wire(crate::DC_METADATA_MTM_SET_COLLECTION_SIZE_DISCRIMINATOR, 2);
suffix_wire.push(0);
- let suffix = crate::InstructionDecoder::decode(
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
suffix_wire.as_slice(),
@@ -2250,13 +2204,12 @@ mod tests {
"set_collection_size_suffix",
),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn programmable_delegate_and_revoke_decode_exact_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
let flags = &[
(false, true),
(false, false),
@@ -2273,7 +2226,7 @@ mod tests {
(false, false),
(false, false),
];
- let delegate = crate::InstructionDecoder::decode(
+ let delegate = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
delegate_wire(&mpl_token_metadata::types::DelegateArgs::StandardV1 {
@@ -2285,7 +2238,7 @@ mod tests {
"delegate",
),
);
- assert_eq!(delegate.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(delegate.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
delegate.observations[0].payload_json["parameters"]["StandardV1"]["amount"],
u64::MAX
@@ -2294,7 +2247,7 @@ mod tests {
delegate.observations[0].payload_json["accounts"][10]["role"],
"sysvar_instructions"
);
- let revoke = crate::InstructionDecoder::decode(
+ let revoke = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
revoke_wire(&mpl_token_metadata::types::RevokeArgs::StandardV1).as_slice(),
@@ -2303,15 +2256,14 @@ mod tests {
"revoke/0",
),
);
- assert_eq!(revoke.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(revoke.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!revoke.observations[0].observation_committed);
assert_eq!(revoke.observations[0].payload_json["parameters"], "StandardV1");
}
#[test]
fn programmable_delegate_and_revoke_reject_truncated_invalid_and_suffix_wires() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
let flags = &[
(false, false),
(false, false),
@@ -2328,19 +2280,19 @@ mod tests {
(false, false),
(false, false),
];
- let truncated = crate::InstructionDecoder::decode(
+ let truncated = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::DELEGATE_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_DELEGATE_DISCRIMINATOR],
flags,
false,
"delegate_truncated",
),
);
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
let mut invalid_flags = flags.to_vec();
invalid_flags[7] = (false, false);
- let invalid = crate::InstructionDecoder::decode(
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
revoke_wire(&mpl_token_metadata::types::RevokeArgs::TransferV1).as_slice(),
@@ -2349,23 +2301,22 @@ mod tests {
"revoke_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
let mut suffix_wire =
delegate_wire(&mpl_token_metadata::types::DelegateArgs::CollectionV1 {
authorization_data: std::option::Option::None,
});
suffix_wire.push(0);
- let suffix = crate::InstructionDecoder::decode(
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(suffix_wire.as_slice(), flags, false, "delegate_suffix"),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn programmable_lifecycle_transfer_lock_unlock_burn_and_close_decode_exact_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
let transfer_flags = &[
(false, true),
(false, false),
@@ -2385,11 +2336,11 @@ mod tests {
(false, false),
(false, false),
];
- let transfer = crate::InstructionDecoder::decode(
+ let transfer = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
programmable_wire(
- crate::decoder::metadata::metaplex_token_metadata::TRANSFER_DISCRIMINATOR,
+ crate::DC_METADATA_MTM_TRANSFER_DISCRIMINATOR,
&mpl_token_metadata::types::TransferArgs::V1 {
amount: u64::MAX,
authorization_data: std::option::Option::None,
@@ -2401,7 +2352,7 @@ mod tests {
"transfer",
),
);
- assert_eq!(transfer.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(transfer.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(transfer.observations[0].payload_json["parameters"]["V1"]["amount"], u64::MAX);
assert_eq!(
transfer.observations[0].payload_json["accounts"][8]["role"],
@@ -2422,11 +2373,11 @@ mod tests {
(false, false),
(false, false),
];
- let lock = crate::InstructionDecoder::decode(
+ let lock = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
programmable_wire(
- crate::decoder::metadata::metaplex_token_metadata::LOCK_DISCRIMINATOR,
+ crate::DC_METADATA_MTM_LOCK_DISCRIMINATOR,
&mpl_token_metadata::types::LockArgs::V1 {
authorization_data: std::option::Option::None,
},
@@ -2437,12 +2388,12 @@ mod tests {
"lock",
),
);
- assert_eq!(lock.status, crate::DecoderOutcomeStatus::Decoded);
- let unlock = crate::InstructionDecoder::decode(
+ assert_eq!(lock.status, crate::DcApiDecoderOutcomeStatus::Decoded);
+ let unlock = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
programmable_wire(
- crate::decoder::metadata::metaplex_token_metadata::UNLOCK_DISCRIMINATOR,
+ crate::DC_METADATA_MTM_UNLOCK_DISCRIMINATOR,
&mpl_token_metadata::types::UnlockArgs::V1 {
authorization_data: std::option::Option::None,
},
@@ -2453,7 +2404,7 @@ mod tests {
"unlock/0",
),
);
- assert_eq!(unlock.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(unlock.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!unlock.observations[0].observation_committed);
let burn_flags = &[
(true, true),
@@ -2471,11 +2422,11 @@ mod tests {
(false, false),
(false, false),
];
- let burn = crate::InstructionDecoder::decode(
+ let burn = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
programmable_wire(
- crate::decoder::metadata::metaplex_token_metadata::BURN_DISCRIMINATOR,
+ crate::DC_METADATA_MTM_BURN_DISCRIMINATOR,
&mpl_token_metadata::types::BurnArgs::V1 { amount: u64::MAX },
)
.as_slice(),
@@ -2484,40 +2435,39 @@ mod tests {
"burn",
),
);
- assert_eq!(burn.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(burn.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(burn.observations[0].payload_json["parameters"]["V1"]["amount"], u64::MAX);
- let close = crate::InstructionDecoder::decode(
+ let close = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::CLOSE_ACCOUNTS_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_CLOSE_ACCOUNTS_DISCRIMINATOR],
&[(false, true), (false, true), (false, true), (true, false), (false, true)],
false,
"close_accounts",
),
);
- assert_eq!(close.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(close.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(close.observations[0].payload_json["accounts"][4]["role"], "destination");
}
#[test]
fn programmable_lifecycle_rejects_truncated_invalid_and_suffix_wires() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let truncated = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let truncated = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::TRANSFER_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_TRANSFER_DISCRIMINATOR],
&[(false, true); 17],
false,
"transfer_truncated",
),
);
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
- let invalid = crate::InstructionDecoder::decode(
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
programmable_wire(
- crate::decoder::metadata::metaplex_token_metadata::BURN_DISCRIMINATOR,
+ crate::DC_METADATA_MTM_BURN_DISCRIMINATOR,
&mpl_token_metadata::types::BurnArgs::V1 { amount: 1 },
)
.as_slice(),
@@ -2541,86 +2491,80 @@ mod tests {
"burn_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
- let suffix = crate::InstructionDecoder::decode(
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[
- crate::decoder::metadata::metaplex_token_metadata::CLOSE_ACCOUNTS_DISCRIMINATOR,
- 0,
- ],
+ &[crate::DC_METADATA_MTM_CLOSE_ACCOUNTS_DISCRIMINATOR, 0],
&[(false, true), (false, true), (false, true), (true, false), (false, true)],
false,
"close_suffix",
),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn legacy_delegated_freeze_and_thaw_decode_exact_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
let flags = &[(true, true), (false, true), (false, false), (false, false), (false, false)];
- let freeze = crate::InstructionDecoder::decode(
+ let freeze = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::FREEZE_DELEGATED_ACCOUNT_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_FREEZE_DELEGATED_ACCOUNT_DISCRIMINATOR],
flags,
false,
"freeze_delegated_account",
),
);
- assert_eq!(freeze.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(freeze.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(freeze.observations[0].payload_json["accounts"][0]["role"], "delegate");
assert_eq!(freeze.observations[0].payload_json["accounts"][4]["role"], "token_program");
- let thaw = crate::InstructionDecoder::decode(
+ let thaw = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::THAW_DELEGATED_ACCOUNT_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_THAW_DELEGATED_ACCOUNT_DISCRIMINATOR],
flags,
true,
"thaw_delegated_account/0",
),
);
- assert_eq!(thaw.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(thaw.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!thaw.observations[0].observation_committed);
}
#[test]
fn legacy_delegated_freeze_and_thaw_reject_invalid_flags_and_suffixes() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let invalid = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::FREEZE_DELEGATED_ACCOUNT_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_FREEZE_DELEGATED_ACCOUNT_DISCRIMINATOR],
&[(false, true), (false, true), (false, false), (false, false), (false, false)],
false,
"freeze_delegated_account_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
- let suffix = crate::InstructionDecoder::decode(
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::THAW_DELEGATED_ACCOUNT_DISCRIMINATOR, 0],
+ &[crate::DC_METADATA_MTM_THAW_DELEGATED_ACCOUNT_DISCRIMINATOR, 0],
&[(true, true), (false, true), (false, false), (false, false), (false, false)],
false,
"thaw_delegated_account_suffix",
),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn legacy_nft_burn_and_printing_token_mint_decode_exact_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let burn_nft = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let burn_nft = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::BURN_NFT_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_BURN_NFT_DISCRIMINATOR],
&[
(false, true),
(true, true),
@@ -2634,15 +2578,15 @@ mod tests {
"burn_nft",
),
);
- assert_eq!(burn_nft.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(burn_nft.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
burn_nft.observations[0].payload_json["accounts"][6]["role"],
"collection_metadata"
);
- let burn_edition = crate::InstructionDecoder::decode(
+ let burn_edition = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::BURN_EDITION_NFT_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_BURN_EDITION_NFT_DISCRIMINATOR],
&[
(false, true),
(true, true),
@@ -2659,16 +2603,16 @@ mod tests {
"burn_edition_nft/0",
),
);
- assert_eq!(burn_edition.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(burn_edition.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!burn_edition.observations[0].observation_committed);
assert_eq!(
burn_edition.observations[0].payload_json["accounts"][8]["role"],
"edition_marker_account"
);
- let printing = crate::InstructionDecoder::decode(
+ let printing = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::DEPRECATED_MINT_NEW_EDITION_VIA_PRINTING_TOKEN_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_DEPRECATED_MINT_NEW_EDITION_VIA_PRINTING_TOKEN_DISCRIMINATOR],
&[
(false, true),
(false, true),
@@ -2691,7 +2635,7 @@ mod tests {
"deprecated_printing_token",
),
);
- assert_eq!(printing.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(printing.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
printing.observations[0].payload_json["accounts"][15]["role"],
"reservation_list"
@@ -2700,12 +2644,11 @@ mod tests {
#[test]
fn legacy_nft_burn_and_printing_token_mint_reject_invalid_flags_and_suffixes() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let invalid = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::BURN_NFT_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_BURN_NFT_DISCRIMINATOR],
&[
(false, true),
(false, true),
@@ -2718,11 +2661,11 @@ mod tests {
"burn_nft_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
- let suffix = crate::InstructionDecoder::decode(
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::BURN_EDITION_NFT_DISCRIMINATOR, 0],
+ &[crate::DC_METADATA_MTM_BURN_EDITION_NFT_DISCRIMINATOR, 0],
&[
(false, true),
(true, true),
@@ -2739,27 +2682,26 @@ mod tests {
"burn_edition_suffix",
),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
- let truncated_accounts = crate::InstructionDecoder::decode(
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let truncated_accounts = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::DEPRECATED_MINT_NEW_EDITION_VIA_PRINTING_TOKEN_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_DEPRECATED_MINT_NEW_EDITION_VIA_PRINTING_TOKEN_DISCRIMINATOR],
&[(false, true); 14],
false,
"deprecated_printing_token_truncated",
),
);
- assert_eq!(truncated_accounts.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(truncated_accounts.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn escrow_and_collect_family_decode_exact_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let create = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let create = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::CREATE_ESCROW_ACCOUNT_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_CREATE_ESCROW_ACCOUNT_DISCRIMINATOR],
&[
(false, true),
(false, true),
@@ -2775,12 +2717,12 @@ mod tests {
"create_escrow_account",
),
);
- assert_eq!(create.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(create.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(create.observations[0].payload_json["accounts"][8]["role"], "authority");
- let close = crate::InstructionDecoder::decode(
+ let close = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::CLOSE_ESCROW_ACCOUNT_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_CLOSE_ESCROW_ACCOUNT_DISCRIMINATOR],
&[
(false, true),
(false, true),
@@ -2795,13 +2737,11 @@ mod tests {
"close_escrow_account/0",
),
);
- assert_eq!(close.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(close.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!close.observations[0].observation_committed);
- let mut transfer_wire = vec![
- crate::decoder::metadata::metaplex_token_metadata::TRANSFER_OUT_OF_ESCROW_DISCRIMINATOR,
- ];
+ let mut transfer_wire = vec![crate::DC_METADATA_MTM_TRANSFER_OUT_OF_ESCROW_DISCRIMINATOR];
transfer_wire.extend_from_slice(&u64::MAX.to_le_bytes());
- let transfer = crate::InstructionDecoder::decode(
+ let transfer = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
transfer_wire.as_slice(),
@@ -2824,30 +2764,29 @@ mod tests {
"transfer_out_of_escrow",
),
);
- assert_eq!(transfer.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(transfer.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(transfer.observations[0].payload_json["parameters"]["amount"], u64::MAX);
assert_eq!(transfer.observations[0].payload_json["accounts"][12]["role"], "authority");
- let collect = crate::InstructionDecoder::decode(
+ let collect = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::COLLECT_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_COLLECT_DISCRIMINATOR],
&[(true, false), (false, false)],
false,
"collect",
),
);
- assert_eq!(collect.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(collect.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(collect.observations[0].payload_json["accounts"][1]["role"], "recipient");
}
#[test]
fn escrow_and_collect_family_reject_truncated_invalid_and_suffix_wires() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let truncated = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let truncated = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::TRANSFER_OUT_OF_ESCROW_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_TRANSFER_OUT_OF_ESCROW_DISCRIMINATOR],
&[
(false, false),
(false, true),
@@ -2866,11 +2805,11 @@ mod tests {
"transfer_out_of_escrow_truncated",
),
);
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
- let invalid = crate::InstructionDecoder::decode(
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::CREATE_ESCROW_ACCOUNT_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_CREATE_ESCROW_ACCOUNT_DISCRIMINATOR],
&[
(false, true),
(false, true),
@@ -2885,27 +2824,26 @@ mod tests {
"create_escrow_account_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
- let suffix = crate::InstructionDecoder::decode(
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::COLLECT_DISCRIMINATOR, 0],
+ &[crate::DC_METADATA_MTM_COLLECT_DISCRIMINATOR, 0],
&[(true, false), (false, false)],
false,
"collect_suffix",
),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn resize_and_migrate_decode_exact_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let resize = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let resize = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::RESIZE_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_RESIZE_DISCRIMINATOR],
&[
(false, true),
(false, true),
@@ -2919,12 +2857,12 @@ mod tests {
"resize",
),
);
- assert_eq!(resize.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(resize.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(resize.observations[0].payload_json["accounts"][4]["role"], "authority");
- let migrate = crate::InstructionDecoder::decode(
+ let migrate = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::MIGRATE_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_MIGRATE_DISCRIMINATOR],
&[
(false, true),
(false, true),
@@ -2946,19 +2884,18 @@ mod tests {
"migrate/0",
),
);
- assert_eq!(migrate.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(migrate.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!migrate.observations[0].observation_committed);
assert_eq!(migrate.observations[0].payload_json["accounts"][9]["role"], "token_record");
}
#[test]
fn resize_and_migrate_reject_invalid_wires() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let invalid_resize = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let invalid_resize = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::RESIZE_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_RESIZE_DISCRIMINATOR],
&[
(false, true),
(false, true),
@@ -2972,11 +2909,11 @@ mod tests {
"resize_invalid",
),
);
- assert_eq!(invalid_resize.status, crate::DecoderOutcomeStatus::Failed);
- let suffix = crate::InstructionDecoder::decode(
+ assert_eq!(invalid_resize.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::MIGRATE_DISCRIMINATOR, 0],
+ &[crate::DC_METADATA_MTM_MIGRATE_DISCRIMINATOR, 0],
&[
(false, true),
(false, true),
@@ -2998,17 +2935,16 @@ mod tests {
"migrate_suffix",
),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn omitted_historical_discriminators_decode_exact_contracts() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
type HistoricalCase<'a> = (&'a [u8], &'a [(bool, bool)], &'a str, usize, &'a str);
let cases: &[HistoricalCase<'_>] = &[
(
- &[crate::decoder::metadata::metaplex_token_metadata::DEPRECATED_CREATE_MASTER_EDITION_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_DEPRECATED_CREATE_MASTER_EDITION_DISCRIMINATOR],
&[
(false, true),
(false, true),
@@ -3029,14 +2965,14 @@ mod tests {
"one_time_printing_authorization_mint_authority",
),
(
- &[crate::decoder::metadata::metaplex_token_metadata::DEPRECATED_SET_RESERVATION_LIST_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_DEPRECATED_SET_RESERVATION_LIST_DISCRIMINATOR],
&[(false, true), (false, true), (true, false)],
"deprecated_set_reservation_list",
2,
"resource",
),
(
- &[crate::decoder::metadata::metaplex_token_metadata::DEPRECATED_CREATE_RESERVATION_LIST_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_DEPRECATED_CREATE_RESERVATION_LIST_DISCRIMINATOR],
&[
(false, true),
(true, false),
@@ -3052,7 +2988,7 @@ mod tests {
"resource",
),
(
- &[crate::decoder::metadata::metaplex_token_metadata::DEPRECATED_MINT_PRINTING_TOKENS_VIA_TOKEN_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_DEPRECATED_MINT_PRINTING_TOKENS_VIA_TOKEN_DISCRIMINATOR],
&[
(false, true),
(false, true),
@@ -3069,7 +3005,7 @@ mod tests {
"burn_authority",
),
(
- &[crate::decoder::metadata::metaplex_token_metadata::DEPRECATED_MINT_PRINTING_TOKENS_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_DEPRECATED_MINT_PRINTING_TOKENS_DISCRIMINATOR],
&[
(false, true),
(false, true),
@@ -3084,7 +3020,7 @@ mod tests {
"update_authority",
),
(
- &[crate::decoder::metadata::metaplex_token_metadata::CREATE_MASTER_EDITION_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_CREATE_MASTER_EDITION_DISCRIMINATOR],
&[
(false, true),
(false, true),
@@ -3102,11 +3038,11 @@ mod tests {
),
];
for (wire, flags, path, role_index, role) in cases {
- let decoded = crate::InstructionDecoder::decode(
+ let decoded = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(wire, flags, false, path),
);
- assert_eq!(decoded.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(decoded.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
decoded.observations[0].payload_json["accounts"][*role_index]["role"],
*role
@@ -3116,22 +3052,21 @@ mod tests {
#[test]
fn omitted_historical_discriminators_reject_invalid_wires() {
- let decoder =
- crate::decoder::metadata::metaplex_token_metadata::MetadataMetaplexTokenMetadataDecoder;
- let invalid = crate::InstructionDecoder::decode(
+ let decoder = crate::DcMetadataMetaplexTokenMetadataDecoder;
+ let invalid = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::DEPRECATED_SET_RESERVATION_LIST_DISCRIMINATOR],
+ &[crate::DC_METADATA_MTM_DEPRECATED_SET_RESERVATION_LIST_DISCRIMINATOR],
&[(false, true), (false, true), (false, false)],
false,
"deprecated_set_reservation_list_invalid",
),
);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
- let suffix = crate::InstructionDecoder::decode(
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let suffix = crate::DcApiInstructionDecoder::decode(
&decoder,
&input_with_flags(
- &[crate::decoder::metadata::metaplex_token_metadata::CREATE_MASTER_EDITION_DISCRIMINATOR, 0],
+ &[crate::DC_METADATA_MTM_CREATE_MASTER_EDITION_DISCRIMINATOR, 0],
&[
(false, true),
(false, true),
@@ -3147,6 +3082,6 @@ mod tests {
"create_master_edition_suffix",
),
);
- assert_eq!(suffix.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(suffix.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
}
diff --git a/kb-lib/src/decoder/metadata/metaplex_token_metadata/instruction.rs b/kb-lib/src/decoder/metadata/metaplex_token_metadata/instruction.rs
index 0815ff1..6c83882 100644
--- a/kb-lib/src/decoder/metadata/metaplex_token_metadata/instruction.rs
+++ b/kb-lib/src/decoder/metadata/metaplex_token_metadata/instruction.rs
@@ -6,7 +6,7 @@
use base64::Engine; // rust-rules: trait-import
use sha2::Digest; // rust-rules: trait-import
-pub(crate) struct ParsedInstruction {
+struct ParsedInstruction {
pub(crate) code: &'static str,
pub(crate) discriminator: u8,
pub(crate) parameters: serde_json::Value,
@@ -23,22 +23,24 @@ struct ResolvedAccount {
source: serde_json::Value,
}
-pub(crate) fn entry_for_discriminator(
+pub(crate) fn decoder_metadata_metaplex_token_metadata_entry_for_discriminator(
discriminator: u8,
) -> std::option::Option<(u8, &'static str, bool)> {
- return crate::decoder::metadata::metaplex_token_metadata::INSTRUCTION_ENTRIES
+ return crate::DC_METADATA_MTM_INSTRUCTION_ENTRIES
.iter()
.copied()
.find(|(candidate, _, _)| return *candidate == discriminator);
}
-pub(crate) fn payload_discriminator(
- input: &crate::CoreInstructionReplayInput,
+pub(crate) fn decoder_metadata_metaplex_token_metadata_payload_discriminator(
+ input: &crate::MdCoreInstructionReplayInput,
) -> std::option::Option {
return decode_payload(input).ok().and_then(|value| return value.first().copied());
}
-pub(crate) fn decode(input: &crate::CoreInstructionReplayInput) -> crate::DecoderExecutionResult {
+pub(crate) fn decoder_metadata_metaplex_token_metadata_decode(
+ input: &crate::MdCoreInstructionReplayInput,
+) -> crate::DcApiDecoderExecutionResult {
let bytes = match decode_payload(input) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
@@ -59,16 +61,16 @@ pub(crate) fn decode(input: &crate::CoreInstructionReplayInput) -> crate::Decode
);
},
};
- let entry = match crate::decoder::metadata::metaplex_token_metadata::entry_for_discriminator(
+ let entry = match crate::decoder_metadata_metaplex_token_metadata_entry_for_discriminator(
discriminator,
) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::DecoderExecutionResult {
- status: crate::DecoderOutcomeStatus::Unsupported,
+ return crate::DcApiDecoderExecutionResult {
+ status: crate::DcApiDecoderOutcomeStatus::Unsupported,
recognized_entry_code: std::option::Option::None,
observations: std::vec::Vec::new(),
- diagnostics: std::vec![crate::DecoderDiagnostic {
+ diagnostics: std::vec![crate::DcApiDecoderDiagnostic {
code: "unknown_metaplex_token_metadata_discriminator".to_string(),
message: format!(
"unknown Metaplex Token Metadata discriminator {discriminator}; payloadPrefixHex={}",
@@ -121,15 +123,17 @@ pub(crate) fn decode(input: &crate::CoreInstructionReplayInput) -> crate::Decode
project_accounts(parsed.code, accounts.as_slice()),
bytes.as_slice(),
);
- return crate::DecoderExecutionResult {
- status: crate::DecoderOutcomeStatus::Decoded,
+ return crate::DcApiDecoderExecutionResult {
+ status: crate::DcApiDecoderOutcomeStatus::Decoded,
recognized_entry_code: std::option::Option::Some(parsed.code.to_string()),
observations: std::vec![observation],
diagnostics: std::vec::Vec::new(),
};
}
-fn decode_payload(input: &crate::CoreInstructionReplayInput) -> kb_core::Result> {
+fn decode_payload(
+ input: &crate::MdCoreInstructionReplayInput,
+) -> kb_core::Result> {
let payload = match input.instruction_payload_json.as_ref() {
std::option::Option::Some(value) => value,
std::option::Option::None => {
@@ -146,10 +150,10 @@ fn decode_payload(input: &crate::CoreInstructionReplayInput) -> kb_core::Result<
));
},
};
- if encoded.len() > crate::decoder::metadata::metaplex_token_metadata::MAX_BASE64_BYTES {
+ if encoded.len() > crate::DC_METADATA_MTM_MAX_BASE64_BYTES {
return std::result::Result::Err(kb_core::Error::invalid_state(format!(
"Metaplex Token Metadata base64 payload exceeds {} bytes",
- crate::decoder::metadata::metaplex_token_metadata::MAX_BASE64_BYTES
+ crate::DC_METADATA_MTM_MAX_BASE64_BYTES
)));
}
let decoded = match base64::engine::general_purpose::STANDARD.decode(encoded.as_bytes()) {
@@ -160,21 +164,16 @@ fn decode_payload(input: &crate::CoreInstructionReplayInput) -> kb_core::Result<
)));
},
};
- if decoded.len() > crate::decoder::metadata::metaplex_token_metadata::MAX_INSTRUCTION_BYTES {
+ if decoded.len() > crate::DC_METADATA_MTM_MAX_INSTRUCTION_BYTES {
return std::result::Result::Err(kb_core::Error::invalid_state(format!(
"Metaplex Token Metadata payload exceeds {} decoded bytes",
- crate::decoder::metadata::metaplex_token_metadata::MAX_INSTRUCTION_BYTES
+ crate::DC_METADATA_MTM_MAX_INSTRUCTION_BYTES
)));
}
return std::result::Result::Ok(decoded);
}
-fn parse_instruction(
- bytes: &[u8],
-) -> std::result::Result<
- crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction,
- std::string::String,
-> {
+fn parse_instruction(bytes: &[u8]) -> std::result::Result {
let discriminator = match bytes.first().copied() {
std::option::Option::Some(value) => value,
std::option::Option::None => {
@@ -182,92 +181,92 @@ fn parse_instruction(
},
};
return match discriminator {
- crate::decoder::metadata::metaplex_token_metadata::DEPRECATED_CREATE_MASTER_EDITION_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ crate::DC_METADATA_MTM_DEPRECATED_CREATE_MASTER_EDITION_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "deprecated_create_master_edition",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::DEPRECATED_SET_RESERVATION_LIST_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_DEPRECATED_SET_RESERVATION_LIST_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "deprecated_set_reservation_list",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::DEPRECATED_CREATE_RESERVATION_LIST_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_DEPRECATED_CREATE_RESERVATION_LIST_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "deprecated_create_reservation_list",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::DEPRECATED_MINT_PRINTING_TOKENS_VIA_TOKEN_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_DEPRECATED_MINT_PRINTING_TOKENS_VIA_TOKEN_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "deprecated_mint_printing_tokens_via_token",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::DEPRECATED_MINT_PRINTING_TOKENS_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_DEPRECATED_MINT_PRINTING_TOKENS_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "deprecated_mint_printing_tokens",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::CREATE_MASTER_EDITION_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_CREATE_MASTER_EDITION_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "create_master_edition",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::DEPRECATED_MINT_NEW_EDITION_VIA_PRINTING_TOKEN_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_DEPRECATED_MINT_NEW_EDITION_VIA_PRINTING_TOKEN_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "deprecated_mint_new_edition_from_master_edition_via_printing_token",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR
- | crate::decoder::metadata::metaplex_token_metadata::MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR
+ | crate::DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_VAULT_PROXY_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(format!("MintNewEditionFromMasterEdition edition Borsh decode failed: {error}")),
};
let code = if discriminator
- == crate::decoder::metadata::metaplex_token_metadata::MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR
+ == crate::DC_METADATA_MTM_MINT_NEW_EDITION_FROM_MASTER_EDITION_VIA_TOKEN_DISCRIMINATOR
{
"mint_new_edition_from_master_edition_via_token"
} else {
"mint_new_edition_from_master_edition_via_vault_proxy"
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code,
discriminator,
parameters: serde_json::json!({"edition": args.edition}),
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::CONVERT_MASTER_EDITION_V1_TO_V2_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_CONVERT_MASTER_EDITION_V1_TO_V2_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "convert_master_edition_v1_to_v2",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::CREATE_MASTER_EDITION_V3_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_CREATE_MASTER_EDITION_V3_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let max_supply =
match as borsh_0_10::BorshDeserialize>::deserialize(
@@ -280,50 +279,50 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "create_master_edition_v3",
discriminator,
parameters: serde_json::json!({"max_supply": max_supply}),
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_UPDATE_PRIMARY_SALE_HAPPENED_VIA_TOKEN_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "update_primary_sale_happened_via_token",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::SIGN_METADATA_DISCRIMINATOR => std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_SIGN_METADATA_DISCRIMINATOR => std::result::Result::Ok(ParsedInstruction {
code: "sign_metadata",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
}),
- crate::decoder::metadata::metaplex_token_metadata::PUFF_METADATA_DISCRIMINATOR => std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ crate::DC_METADATA_MTM_PUFF_METADATA_DISCRIMINATOR => std::result::Result::Ok(ParsedInstruction {
code: "puff_metadata",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
}),
- crate::decoder::metadata::metaplex_token_metadata::REMOVE_CREATOR_VERIFICATION_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ crate::DC_METADATA_MTM_REMOVE_CREATOR_VERIFICATION_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "remove_creator_verification",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::SET_TOKEN_STANDARD_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_SET_TOKEN_STANDARD_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "set_token_standard",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::CREATE_METADATA_ACCOUNT_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let data =
match ::deserialize(
@@ -357,14 +356,14 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "create_metadata_account",
discriminator,
parameters: serde_json::json!({"data": data_json, "is_mutable": is_mutable}),
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::UPDATE_METADATA_ACCOUNT_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_UPDATE_METADATA_ACCOUNT_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let data = match as borsh_0_10::BorshDeserialize>::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -407,14 +406,14 @@ fn parse_instruction(
},
};
let authority_json = new_update_authority.map(|value| return hex_bytes(&value));
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "update_metadata_account",
discriminator,
parameters: serde_json::json!({"data": data_json, "new_update_authority_hex": authority_json, "primary_sale_happened": primary_sale_happened}),
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::CREATE_METADATA_ACCOUNT_V2_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_V2_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let data = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -441,7 +440,7 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "create_metadata_account_v2",
discriminator,
parameters: serde_json::json!({
@@ -450,8 +449,8 @@ fn parse_instruction(
}),
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::CREATE_METADATA_ACCOUNT_V3_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_CREATE_METADATA_ACCOUNT_V3_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -469,14 +468,14 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "create_metadata_account_v3",
discriminator,
parameters,
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::TRANSFER_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_TRANSFER_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -490,14 +489,14 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "transfer",
discriminator,
parameters,
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::LOCK_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_LOCK_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -511,14 +510,14 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "lock",
discriminator,
parameters,
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::UNLOCK_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_UNLOCK_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -532,30 +531,30 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "unlock",
discriminator,
parameters,
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::CREATE_ESCROW_ACCOUNT_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_CREATE_ESCROW_ACCOUNT_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "create_escrow_account",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::CLOSE_ESCROW_ACCOUNT_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_CLOSE_ESCROW_ACCOUNT_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "close_escrow_account",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::TRANSFER_OUT_OF_ESCROW_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_TRANSFER_OUT_OF_ESCROW_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let amount = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -565,34 +564,34 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "transfer_out_of_escrow",
discriminator,
parameters: serde_json::json!({"amount": amount}),
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::COLLECT_DISCRIMINATOR => std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_COLLECT_DISCRIMINATOR => std::result::Result::Ok(ParsedInstruction {
code: "collect",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
}),
- crate::decoder::metadata::metaplex_token_metadata::BURN_NFT_DISCRIMINATOR => std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ crate::DC_METADATA_MTM_BURN_NFT_DISCRIMINATOR => std::result::Result::Ok(ParsedInstruction {
code: "burn_nft",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
}),
- crate::decoder::metadata::metaplex_token_metadata::BURN_EDITION_NFT_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ crate::DC_METADATA_MTM_BURN_EDITION_NFT_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "burn_edition_nft",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::CREATE_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_CREATE_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -606,14 +605,14 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "create",
discriminator,
parameters,
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::MINT_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_MINT_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -627,14 +626,14 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "mint",
discriminator,
parameters,
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::PRINT_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_PRINT_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -648,26 +647,26 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "print",
discriminator,
parameters,
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::MIGRATE_DISCRIMINATOR => std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_MIGRATE_DISCRIMINATOR => std::result::Result::Ok(ParsedInstruction {
code: "migrate",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
}),
- crate::decoder::metadata::metaplex_token_metadata::RESIZE_DISCRIMINATOR => std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ crate::DC_METADATA_MTM_RESIZE_DISCRIMINATOR => std::result::Result::Ok(ParsedInstruction {
code: "resize",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
}),
- crate::decoder::metadata::metaplex_token_metadata::USE_DISCRIMINATOR => {
+ crate::DC_METADATA_MTM_USE_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -681,14 +680,14 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "use",
discriminator,
parameters,
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::VERIFY_DISCRIMINATOR | crate::decoder::metadata::metaplex_token_metadata::UNVERIFY_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_VERIFY_DISCRIMINATOR | crate::DC_METADATA_MTM_UNVERIFY_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -703,15 +702,15 @@ fn parse_instruction(
},
};
let code =
- if discriminator == crate::decoder::metadata::metaplex_token_metadata::VERIFY_DISCRIMINATOR { "verify" } else { "unverify" };
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ if discriminator == crate::DC_METADATA_MTM_VERIFY_DISCRIMINATOR { "verify" } else { "unverify" };
+ std::result::Result::Ok(ParsedInstruction {
code,
discriminator,
parameters,
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::UPDATE_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_UPDATE_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -725,14 +724,14 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "update",
discriminator,
parameters,
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::BURN_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_BURN_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -746,20 +745,20 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "burn",
discriminator,
parameters,
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::CLOSE_ACCOUNTS_DISCRIMINATOR => std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_CLOSE_ACCOUNTS_DISCRIMINATOR => std::result::Result::Ok(ParsedInstruction {
code: "close_accounts",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
}),
- crate::decoder::metadata::metaplex_token_metadata::DELEGATE_DISCRIMINATOR => {
+ crate::DC_METADATA_MTM_DELEGATE_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -773,14 +772,14 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "delegate",
discriminator,
parameters,
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::REVOKE_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_REVOKE_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -794,97 +793,97 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "revoke",
discriminator,
parameters,
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::SET_COLLECTION_SIZE_DISCRIMINATOR
- | crate::decoder::metadata::metaplex_token_metadata::BUBBLEGUM_SET_COLLECTION_SIZE_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_SET_COLLECTION_SIZE_DISCRIMINATOR
+ | crate::DC_METADATA_MTM_BUBBLEGUM_SET_COLLECTION_SIZE_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(format!("SetCollectionSize Borsh decode failed: {error}")),
};
- let code = if discriminator == crate::decoder::metadata::metaplex_token_metadata::SET_COLLECTION_SIZE_DISCRIMINATOR {
+ let code = if discriminator == crate::DC_METADATA_MTM_SET_COLLECTION_SIZE_DISCRIMINATOR {
"set_collection_size"
} else {
"bubblegum_set_collection_size"
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code,
discriminator,
parameters: serde_json::json!({"size": args.size}),
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::VERIFY_COLLECTION_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_VERIFY_COLLECTION_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "verify_collection",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::UNVERIFY_COLLECTION_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_UNVERIFY_COLLECTION_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "unverify_collection",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::SET_AND_VERIFY_COLLECTION_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_SET_AND_VERIFY_COLLECTION_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "set_and_verify_collection",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::APPROVE_COLLECTION_AUTHORITY_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_APPROVE_COLLECTION_AUTHORITY_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "approve_collection_authority",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::REVOKE_COLLECTION_AUTHORITY_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_REVOKE_COLLECTION_AUTHORITY_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "revoke_collection_authority",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "verify_sized_collection_item",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::UNVERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_UNVERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "unverify_sized_collection_item",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::SET_AND_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_SET_AND_VERIFY_SIZED_COLLECTION_ITEM_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "set_and_verify_sized_collection_item",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::UTILIZE_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_UTILIZE_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -898,14 +897,14 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "utilize",
discriminator,
parameters,
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::APPROVE_USE_AUTHORITY_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_APPROVE_USE_AUTHORITY_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -919,38 +918,38 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "approve_use_authority",
discriminator,
parameters,
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
- crate::decoder::metadata::metaplex_token_metadata::REVOKE_USE_AUTHORITY_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_REVOKE_USE_AUTHORITY_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "revoke_use_authority",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::FREEZE_DELEGATED_ACCOUNT_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_FREEZE_DELEGATED_ACCOUNT_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "freeze_delegated_account",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::THAW_DELEGATED_ACCOUNT_DISCRIMINATOR => {
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ }
+ crate::DC_METADATA_MTM_THAW_DELEGATED_ACCOUNT_DISCRIMINATOR => {
+ std::result::Result::Ok(ParsedInstruction {
code: "thaw_delegated_account",
discriminator,
parameters: serde_json::json!({}),
consumed: 1,
})
- },
- crate::decoder::metadata::metaplex_token_metadata::UPDATE_METADATA_ACCOUNT_V2_DISCRIMINATOR => {
+ }
+ crate::DC_METADATA_MTM_UPDATE_METADATA_ACCOUNT_V2_DISCRIMINATOR => {
let mut remaining = &bytes[1..];
let args = match ::deserialize(&mut remaining) {
std::result::Result::Ok(value) => value,
@@ -970,13 +969,13 @@ fn parse_instruction(
));
},
};
- std::result::Result::Ok(crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction {
+ std::result::Result::Ok(ParsedInstruction {
code: "update_metadata_account_v2",
discriminator,
parameters,
consumed: bytes.len().saturating_sub(remaining.len()),
})
- },
+ }
_ => std::result::Result::Err(format!("unsupported discriminator {discriminator}")),
};
}
@@ -1032,7 +1031,7 @@ fn validate_data_v2(
}
fn resolve_accounts(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
) -> kb_core::Result> {
let instruction_accounts = match input.instruction_accounts_json.as_array() {
std::option::Option::Some(value) => value,
@@ -1042,9 +1041,7 @@ fn resolve_accounts(
));
},
};
- if instruction_accounts.len()
- > crate::decoder::metadata::metaplex_token_metadata::MAX_INSTRUCTION_ACCOUNTS
- {
+ if instruction_accounts.len() > crate::DC_METADATA_MTM_MAX_INSTRUCTION_ACCOUNTS {
return std::result::Result::Err(kb_core::Error::invalid_state(
"Metaplex Token Metadata instruction account count exceeds bound",
));
@@ -2642,43 +2639,39 @@ fn project_accounts(code: &str, accounts: &[ResolvedAccount]) -> serde_json::Val
}
fn observation(
- input: &crate::CoreInstructionReplayInput,
- parsed: &crate::decoder::metadata::metaplex_token_metadata::ParsedInstruction,
+ input: &crate::MdCoreInstructionReplayInput,
+ parsed: &ParsedInstruction,
accounts: serde_json::Value,
wire: &[u8],
-) -> crate::DecodedObservation {
+) -> crate::DcApiDecodedObservation {
let wire_hash = hash(wire);
let committed = !input.transaction_failed;
- let event = crate::DecodedProtocolEvent {
- signature: crate::Signature(input.signature.clone()),
- slot: crate::Slot(input.slot),
- instruction_path: crate::InstructionPath(input.instruction_path.clone()),
- program_id: crate::ProgramId(input.program_id.clone()),
- protocol_code: crate::ProtocolCode(
- crate::decoder::metadata::metaplex_token_metadata::SURFACE_CODE.to_string(),
- ),
- surface_code: crate::SurfaceCode(
- crate::decoder::metadata::metaplex_token_metadata::SURFACE_CODE.to_string(),
- ),
- event_code: crate::EventCode(format!(
+ let event = crate::MdDecodedProtocolEvent {
+ signature: crate::MdSignature(input.signature.clone()),
+ slot: crate::MdSlot(input.slot),
+ instruction_path: crate::MdInstructionPath(input.instruction_path.clone()),
+ program_id: crate::MdProgramId(input.program_id.clone()),
+ protocol_code: crate::MdProtocolCode(crate::DC_METADATA_MTM_SURFACE_CODE.to_string()),
+ surface_code: crate::MdSurfaceCode(crate::DC_METADATA_MTM_SURFACE_CODE.to_string()),
+ event_code: crate::MdEventCode(format!(
"{}.{}",
- crate::decoder::metadata::metaplex_token_metadata::SURFACE_CODE,
+ crate::DC_METADATA_MTM_SURFACE_CODE,
parsed.code
)),
- event_name: crate::EventName(parsed.code.to_string()),
- event_family: crate::EventFamily::Metadata,
+ event_name: crate::MdEventName(parsed.code.to_string()),
+ event_family: crate::MdEventFamily::Metadata,
source_kind: if input.instruction_path.contains('/') {
- crate::EventSourceKind::InnerInstruction
+ crate::MdEventSourceKind::InnerInstruction
} else {
- crate::EventSourceKind::Instruction
+ crate::MdEventSourceKind::Instruction
},
- confidence: crate::DecoderConfidence::ManualExact,
+ confidence: crate::MdDecoderConfidence::ManualExact,
};
- return crate::DecodedObservation {
+ return crate::DcApiDecodedObservation {
event_key: format!("metaplex_token_metadata:{}:0", parsed.code),
event,
payload_json: serde_json::json!({
- "eventVersion": crate::decoder::metadata::metaplex_token_metadata::EVENT_VERSION,
+ "eventVersion": crate::DC_METADATA_MTM_EVENT_VERSION,
"programId": input.program_id,
"instruction": parsed.code,
"wireDiscriminator": parsed.discriminator,
@@ -2695,9 +2688,9 @@ fn observation(
transaction_failed: input.transaction_failed,
transaction_error: input.transaction_err_json.clone(),
observation_committed: committed,
- proof: crate::DecoderProof {
- kind: crate::DecoderProofKind::Manual,
- confidence: crate::DecoderConfidence::ManualExact,
+ proof: crate::DcApiDecoderProof {
+ kind: crate::DcApiDecoderProofKind::Manual,
+ confidence: crate::MdDecoderConfidence::ManualExact,
evidence: std::vec![
"mpl_token_metadata_5_1_1_generated_wire".to_string(),
format!("wire_discriminator:{}", parsed.discriminator),
@@ -2717,10 +2710,7 @@ fn hash(bytes: &[u8]) -> std::string::String {
}
fn hex_prefix(bytes: &[u8]) -> std::string::String {
- let length = std::cmp::min(
- bytes.len(),
- crate::decoder::metadata::metaplex_token_metadata::DIAGNOSTIC_PREFIX_BYTES,
- );
+ let length = std::cmp::min(bytes.len(), crate::DC_METADATA_MTM_DIAGNOSTIC_PREFIX_BYTES);
let mut output = std::string::String::with_capacity(length.saturating_mul(2));
for byte in &bytes[..length] {
output.push_str(format!("{byte:02x}").as_str());
@@ -2732,12 +2722,12 @@ fn failed(
entry_code: std::option::Option<&str>,
code: &str,
message: std::string::String,
-) -> crate::DecoderExecutionResult {
- return crate::DecoderExecutionResult {
- status: crate::DecoderOutcomeStatus::Failed,
+) -> crate::DcApiDecoderExecutionResult {
+ return crate::DcApiDecoderExecutionResult {
+ status: crate::DcApiDecoderOutcomeStatus::Failed,
recognized_entry_code: entry_code.map(str::to_string),
observations: std::vec::Vec::new(),
- diagnostics: std::vec![crate::DecoderDiagnostic {
+ diagnostics: std::vec![crate::DcApiDecoderDiagnostic {
code: code.to_string(),
message,
retriable: false
diff --git a/kb-lib/src/decoder/metadata/spl_name_service.rs b/kb-lib/src/decoder/metadata/spl_name_service.rs
index 108c6e9..11dce57 100644
--- a/kb-lib/src/decoder/metadata/spl_name_service.rs
+++ b/kb-lib/src/decoder/metadata/spl_name_service.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_metadata_spl_name_service`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_metadata_spl_name_service";
+const LEGACY_CRATE: &str = "kb_decoder_metadata_spl_name_service";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/nft.rs b/kb-lib/src/decoder/nft.rs
index bdf5c67..96c59e8 100644
--- a/kb-lib/src/decoder/nft.rs
+++ b/kb-lib/src/decoder/nft.rs
@@ -3,4 +3,4 @@
//! `nft` decoder family.
-pub mod metaplex_bubblegum;
+mod metaplex_bubblegum;
diff --git a/kb-lib/src/decoder/nft/metaplex_bubblegum.rs b/kb-lib/src/decoder/nft/metaplex_bubblegum.rs
index 18fc116..182571b 100644
--- a/kb-lib/src/decoder/nft/metaplex_bubblegum.rs
+++ b/kb-lib/src/decoder/nft/metaplex_bubblegum.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_nft_metaplex_bubblegum`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_nft_metaplex_bubblegum";
+const LEGACY_CRATE: &str = "kb_decoder_nft_metaplex_bubblegum";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/orderbook.rs b/kb-lib/src/decoder/orderbook.rs
index fd86e45..c9204aa 100644
--- a/kb-lib/src/decoder/orderbook.rs
+++ b/kb-lib/src/decoder/orderbook.rs
@@ -3,6 +3,6 @@
//! `orderbook` decoder family.
-pub mod jupiter_limit_order;
-pub mod jupiter_limit_order_v2;
-pub mod openbook_v2;
+mod jupiter_limit_order;
+mod jupiter_limit_order_v2;
+mod openbook_v2;
diff --git a/kb-lib/src/decoder/orderbook/jupiter_limit_order.rs b/kb-lib/src/decoder/orderbook/jupiter_limit_order.rs
index 8d5c111..18ebf24 100644
--- a/kb-lib/src/decoder/orderbook/jupiter_limit_order.rs
+++ b/kb-lib/src/decoder/orderbook/jupiter_limit_order.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_orderbook_jupiter_limit_order`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_orderbook_jupiter_limit_order";
+const LEGACY_CRATE: &str = "kb_decoder_orderbook_jupiter_limit_order";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/orderbook/jupiter_limit_order_v2.rs b/kb-lib/src/decoder/orderbook/jupiter_limit_order_v2.rs
index 148be1d..4d9ebd7 100644
--- a/kb-lib/src/decoder/orderbook/jupiter_limit_order_v2.rs
+++ b/kb-lib/src/decoder/orderbook/jupiter_limit_order_v2.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_orderbook_jupiter_limit_order_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_orderbook_jupiter_limit_order_v2";
+const LEGACY_CRATE: &str = "kb_decoder_orderbook_jupiter_limit_order_v2";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/orderbook/openbook_v2.rs b/kb-lib/src/decoder/orderbook/openbook_v2.rs
index a01b635..5a40204 100644
--- a/kb-lib/src/decoder/orderbook/openbook_v2.rs
+++ b/kb-lib/src/decoder/orderbook/openbook_v2.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_orderbook_openbook_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_orderbook_openbook_v2";
+const LEGACY_CRATE: &str = "kb_decoder_orderbook_openbook_v2";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/perpetuals.rs b/kb-lib/src/decoder/perpetuals.rs
index 7e2f027..d60238b 100644
--- a/kb-lib/src/decoder/perpetuals.rs
+++ b/kb-lib/src/decoder/perpetuals.rs
@@ -3,6 +3,6 @@
//! `perpetuals` decoder family.
-pub mod drift_v2;
-pub mod jupiter;
-pub mod zeta;
+mod drift_v2;
+mod jupiter;
+mod zeta;
diff --git a/kb-lib/src/decoder/perpetuals/drift_v2.rs b/kb-lib/src/decoder/perpetuals/drift_v2.rs
index f0c503a..7cf6f36 100644
--- a/kb-lib/src/decoder/perpetuals/drift_v2.rs
+++ b/kb-lib/src/decoder/perpetuals/drift_v2.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_perpetuals_drift_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_perpetuals_drift_v2";
+const LEGACY_CRATE: &str = "kb_decoder_perpetuals_drift_v2";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/perpetuals/jupiter.rs b/kb-lib/src/decoder/perpetuals/jupiter.rs
index 3fd691c..6900b7e 100644
--- a/kb-lib/src/decoder/perpetuals/jupiter.rs
+++ b/kb-lib/src/decoder/perpetuals/jupiter.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_perpetuals_jupiter`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_perpetuals_jupiter";
+const LEGACY_CRATE: &str = "kb_decoder_perpetuals_jupiter";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/perpetuals/zeta.rs b/kb-lib/src/decoder/perpetuals/zeta.rs
index 04db283..9ed6d85 100644
--- a/kb-lib/src/decoder/perpetuals/zeta.rs
+++ b/kb-lib/src/decoder/perpetuals/zeta.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_perpetuals_zeta`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_perpetuals_zeta";
+const LEGACY_CRATE: &str = "kb_decoder_perpetuals_zeta";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/router.rs b/kb-lib/src/decoder/router.rs
index da9fb10..db89189 100644
--- a/kb-lib/src/decoder/router.rs
+++ b/kb-lib/src/decoder/router.rs
@@ -3,9 +3,9 @@
//! `router` decoder family.
-pub mod dflow_aggregator_v4;
-pub mod jupiter_aggregator_v4;
-pub mod jupiter_aggregator_v6;
-pub mod jupiter_dca;
-pub mod okx_labs_v1;
-pub mod okx_labs_v2;
+mod dflow_aggregator_v4;
+mod jupiter_aggregator_v4;
+mod jupiter_aggregator_v6;
+mod jupiter_dca;
+mod okx_labs_v1;
+mod okx_labs_v2;
diff --git a/kb-lib/src/decoder/router/dflow_aggregator_v4.rs b/kb-lib/src/decoder/router/dflow_aggregator_v4.rs
index 7150dc0..ea335f5 100644
--- a/kb-lib/src/decoder/router/dflow_aggregator_v4.rs
+++ b/kb-lib/src/decoder/router/dflow_aggregator_v4.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_router_dflow_aggregator_v4`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_router_dflow_aggregator_v4";
+const LEGACY_CRATE: &str = "kb_decoder_router_dflow_aggregator_v4";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/router/jupiter_aggregator_v4.rs b/kb-lib/src/decoder/router/jupiter_aggregator_v4.rs
index cac6b3b..15fac7c 100644
--- a/kb-lib/src/decoder/router/jupiter_aggregator_v4.rs
+++ b/kb-lib/src/decoder/router/jupiter_aggregator_v4.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_router_jupiter_aggregator_v4`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_router_jupiter_aggregator_v4";
+const LEGACY_CRATE: &str = "kb_decoder_router_jupiter_aggregator_v4";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/router/jupiter_aggregator_v6.rs b/kb-lib/src/decoder/router/jupiter_aggregator_v6.rs
index d59ea39..ee4d9c7 100644
--- a/kb-lib/src/decoder/router/jupiter_aggregator_v6.rs
+++ b/kb-lib/src/decoder/router/jupiter_aggregator_v6.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_router_jupiter_aggregator_v6`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_router_jupiter_aggregator_v6";
+const LEGACY_CRATE: &str = "kb_decoder_router_jupiter_aggregator_v6";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/router/jupiter_dca.rs b/kb-lib/src/decoder/router/jupiter_dca.rs
index 4ca27be..5c7cc29 100644
--- a/kb-lib/src/decoder/router/jupiter_dca.rs
+++ b/kb-lib/src/decoder/router/jupiter_dca.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_router_jupiter_dca`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_router_jupiter_dca";
+const LEGACY_CRATE: &str = "kb_decoder_router_jupiter_dca";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/router/okx_labs_v1.rs b/kb-lib/src/decoder/router/okx_labs_v1.rs
index 96e8576..0abbe74 100644
--- a/kb-lib/src/decoder/router/okx_labs_v1.rs
+++ b/kb-lib/src/decoder/router/okx_labs_v1.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_router_okx_labs_v1`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_router_okx_labs_v1";
+const LEGACY_CRATE: &str = "kb_decoder_router_okx_labs_v1";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/router/okx_labs_v2.rs b/kb-lib/src/decoder/router/okx_labs_v2.rs
index cdd22a9..59839ea 100644
--- a/kb-lib/src/decoder/router/okx_labs_v2.rs
+++ b/kb-lib/src/decoder/router/okx_labs_v2.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_router_okx_labs_v2`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_router_okx_labs_v2";
+const LEGACY_CRATE: &str = "kb_decoder_router_okx_labs_v2";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/rwa.rs b/kb-lib/src/decoder/rwa.rs
index 1099e82..007477d 100644
--- a/kb-lib/src/decoder/rwa.rs
+++ b/kb-lib/src/decoder/rwa.rs
@@ -3,4 +3,4 @@
//! `rwa` decoder family.
-pub mod ondo_global_markets;
+mod ondo_global_markets;
diff --git a/kb-lib/src/decoder/rwa/ondo_global_markets.rs b/kb-lib/src/decoder/rwa/ondo_global_markets.rs
index 68bfa69..446eb84 100644
--- a/kb-lib/src/decoder/rwa/ondo_global_markets.rs
+++ b/kb-lib/src/decoder/rwa/ondo_global_markets.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_rwa_ondo_global_markets`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_rwa_ondo_global_markets";
+const LEGACY_CRATE: &str = "kb_decoder_rwa_ondo_global_markets";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/solana.rs b/kb-lib/src/decoder/solana.rs
index caba2b8..3529201 100644
--- a/kb-lib/src/decoder/solana.rs
+++ b/kb-lib/src/decoder/solana.rs
@@ -5,91 +5,91 @@
mod core;
-pub(crate) use self::core::SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_BPF_LOADER_DEPRECATED_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_BPF_LOADER_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_CONFIG_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES;
-pub(crate) use self::core::SOLANA_CORE_ED25519_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_FEATURE_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_LOADER_V4_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES;
-pub(crate) use self::core::SOLANA_CORE_NATIVE_EVENT_VERSION;
-pub(crate) use self::core::SOLANA_CORE_NATIVE_LOADER_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_PRECOMPILE_COMPONENT_PREFIX_BYTES;
-pub(crate) use self::core::SOLANA_CORE_PROTOCOL_CODE;
-pub(crate) use self::core::SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES;
-pub(crate) use self::core::SOLANA_CORE_SECP256K1_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_SECP256R1_MAX_SIGNATURES;
-pub(crate) use self::core::SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES;
-pub(crate) use self::core::SOLANA_CORE_SECP256R1_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_SIGNATURE_BYTES;
-pub(crate) use self::core::SOLANA_CORE_SLASHING_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_STAKE_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_SYSTEM_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_TRACING_TARGET;
-pub(crate) use self::core::SOLANA_CORE_U8_OFFSETS_BYTES;
-pub(crate) use self::core::SOLANA_CORE_U16_OFFSETS_BYTES;
-pub(crate) use self::core::SOLANA_CORE_VOTE_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE;
-pub(crate) use self::core::SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE;
-pub(crate) use self::core::SolanaCoreAccountRole;
-pub(crate) use self::core::SolanaCoreResolvedInstructionPayload;
-pub(crate) use self::core::solana_core_address_lookup_table_coverage;
-pub(crate) use self::core::solana_core_address_lookup_table_decode;
-pub(crate) use self::core::solana_core_address_lookup_table_recognize;
-pub(crate) use self::core::solana_core_bounded_hexadecimal_prefix;
-pub(crate) use self::core::solana_core_bounded_slice;
-pub(crate) use self::core::solana_core_compute_budget_coverage;
-pub(crate) use self::core::solana_core_compute_budget_decode;
-pub(crate) use self::core::solana_core_compute_budget_recognize;
-pub(crate) use self::core::solana_core_config_coverage;
-pub(crate) use self::core::solana_core_config_decode;
-pub(crate) use self::core::solana_core_config_recognize;
-pub(crate) use self::core::solana_core_decode_instruction_data;
-pub(crate) use self::core::solana_core_decoded_payload_length;
-pub(crate) use self::core::solana_core_decoded_payload_sha256;
-pub(crate) use self::core::solana_core_decoded_result;
-pub(crate) use self::core::solana_core_failed_result;
-pub(crate) use self::core::solana_core_feature_coverage;
-pub(crate) use self::core::solana_core_feature_decode;
-pub(crate) use self::core::solana_core_feature_recognize;
-pub(crate) use self::core::solana_core_hash_bytes;
-pub(crate) use self::core::solana_core_hexadecimal_prefix;
-pub(crate) use self::core::solana_core_loaders_coverage;
-pub(crate) use self::core::solana_core_loaders_decode;
-pub(crate) use self::core::solana_core_loaders_recognize;
-pub(crate) use self::core::solana_core_payload_hash;
-pub(crate) use self::core::solana_core_precompiles_coverage;
-pub(crate) use self::core::solana_core_precompiles_decode;
-pub(crate) use self::core::solana_core_precompiles_recognize;
-pub(crate) use self::core::solana_core_read_u32_le;
-pub(crate) use self::core::solana_core_read_u64_le;
-pub(crate) use self::core::solana_core_resolve_accounts;
-pub(crate) use self::core::solana_core_resolve_u8_instruction_payload;
-pub(crate) use self::core::solana_core_resolve_u16_instruction_payload;
-pub(crate) use self::core::solana_core_slashing_coverage;
-pub(crate) use self::core::solana_core_slashing_decode;
-pub(crate) use self::core::solana_core_slashing_recognize;
-pub(crate) use self::core::solana_core_stake_coverage;
-pub(crate) use self::core::solana_core_stake_decode;
-pub(crate) use self::core::solana_core_stake_recognize;
-pub(crate) use self::core::solana_core_system_coverage;
-pub(crate) use self::core::solana_core_system_decode;
-pub(crate) use self::core::solana_core_system_recognize;
-pub(crate) use self::core::solana_core_target_outer_instruction_index;
-pub(crate) use self::core::solana_core_unsupported_result;
-pub(crate) use self::core::solana_core_vote_coverage;
-pub(crate) use self::core::solana_core_vote_decode;
-pub(crate) use self::core::solana_core_vote_recognize;
-pub(crate) use self::core::solana_core_zk_elgamal_coverage;
-pub(crate) use self::core::solana_core_zk_elgamal_decode;
-pub(crate) use self::core::solana_core_zk_elgamal_recognize;
-pub(crate) use self::core::solana_core_zk_token_proof_coverage;
-pub(crate) use self::core::solana_core_zk_token_proof_decode;
-pub(crate) use self::core::solana_core_zk_token_proof_recognize;
+pub(crate) use self::core::DC_SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_BPF_LOADER_DEPRECATED_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_BPF_LOADER_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_CONFIG_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES;
+pub(crate) use self::core::DC_SOLANA_CORE_ED25519_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_FEATURE_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_LOADER_V4_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES;
+pub(crate) use self::core::DC_SOLANA_CORE_NATIVE_EVENT_VERSION;
+pub(crate) use self::core::DC_SOLANA_CORE_NATIVE_LOADER_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_PRECOMPILE_COMPONENT_PREFIX_BYTES;
+pub(crate) use self::core::DC_SOLANA_CORE_PROTOCOL_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES;
+pub(crate) use self::core::DC_SOLANA_CORE_SECP256K1_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_SECP256R1_MAX_SIGNATURES;
+pub(crate) use self::core::DC_SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES;
+pub(crate) use self::core::DC_SOLANA_CORE_SECP256R1_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_SIGNATURE_BYTES;
+pub(crate) use self::core::DC_SOLANA_CORE_SLASHING_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_STAKE_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_SYSTEM_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_TRACING_TARGET;
+pub(crate) use self::core::DC_SOLANA_CORE_U8_OFFSETS_BYTES;
+pub(crate) use self::core::DC_SOLANA_CORE_U16_OFFSETS_BYTES;
+pub(crate) use self::core::DC_SOLANA_CORE_VOTE_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE;
+pub(crate) use self::core::DC_SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE;
+pub(crate) use self::core::DcSolanaCoreAccountRole;
+pub(crate) use self::core::DcSolanaCoreResolvedInstructionPayload;
+pub(crate) use self::core::decoder_solana_core_address_lookup_table_coverage;
+pub(crate) use self::core::decoder_solana_core_address_lookup_table_decode;
+pub(crate) use self::core::decoder_solana_core_address_lookup_table_recognize;
+pub(crate) use self::core::decoder_solana_core_bounded_hexadecimal_prefix;
+pub(crate) use self::core::decoder_solana_core_bounded_slice;
+pub(crate) use self::core::decoder_solana_core_compute_budget_coverage;
+pub(crate) use self::core::decoder_solana_core_compute_budget_decode;
+pub(crate) use self::core::decoder_solana_core_compute_budget_recognize;
+pub(crate) use self::core::decoder_solana_core_config_coverage;
+pub(crate) use self::core::decoder_solana_core_config_decode;
+pub(crate) use self::core::decoder_solana_core_config_recognize;
+pub(crate) use self::core::decoder_solana_core_decode_instruction_data;
+pub(crate) use self::core::decoder_solana_core_decoded_payload_length;
+pub(crate) use self::core::decoder_solana_core_decoded_payload_sha256;
+pub(crate) use self::core::decoder_solana_core_decoded_result;
+pub(crate) use self::core::decoder_solana_core_failed_result;
+pub(crate) use self::core::decoder_solana_core_feature_coverage;
+pub(crate) use self::core::decoder_solana_core_feature_decode;
+pub(crate) use self::core::decoder_solana_core_feature_recognize;
+pub(crate) use self::core::decoder_solana_core_hash_bytes;
+pub(crate) use self::core::decoder_solana_core_hexadecimal_prefix;
+pub(crate) use self::core::decoder_solana_core_loaders_coverage;
+pub(crate) use self::core::decoder_solana_core_loaders_decode;
+pub(crate) use self::core::decoder_solana_core_loaders_recognize;
+pub(crate) use self::core::decoder_solana_core_payload_hash;
+pub(crate) use self::core::decoder_solana_core_precompiles_coverage;
+pub(crate) use self::core::decoder_solana_core_precompiles_decode;
+pub(crate) use self::core::decoder_solana_core_precompiles_recognize;
+pub(crate) use self::core::decoder_solana_core_read_u32_le;
+pub(crate) use self::core::decoder_solana_core_read_u64_le;
+pub(crate) use self::core::decoder_solana_core_resolve_accounts;
+pub(crate) use self::core::decoder_solana_core_resolve_u8_instruction_payload;
+pub(crate) use self::core::decoder_solana_core_resolve_u16_instruction_payload;
+pub(crate) use self::core::decoder_solana_core_slashing_coverage;
+pub(crate) use self::core::decoder_solana_core_slashing_decode;
+pub(crate) use self::core::decoder_solana_core_slashing_recognize;
+pub(crate) use self::core::decoder_solana_core_stake_coverage;
+pub(crate) use self::core::decoder_solana_core_stake_decode;
+pub(crate) use self::core::decoder_solana_core_stake_recognize;
+pub(crate) use self::core::decoder_solana_core_system_coverage;
+pub(crate) use self::core::decoder_solana_core_system_decode;
+pub(crate) use self::core::decoder_solana_core_system_recognize;
+pub(crate) use self::core::decoder_solana_core_target_outer_instruction_index;
+pub(crate) use self::core::decoder_solana_core_unsupported_result;
+pub(crate) use self::core::decoder_solana_core_vote_coverage;
+pub(crate) use self::core::decoder_solana_core_vote_decode;
+pub(crate) use self::core::decoder_solana_core_vote_recognize;
+pub(crate) use self::core::decoder_solana_core_zk_elgamal_coverage;
+pub(crate) use self::core::decoder_solana_core_zk_elgamal_decode;
+pub(crate) use self::core::decoder_solana_core_zk_elgamal_recognize;
+pub(crate) use self::core::decoder_solana_core_zk_token_proof_coverage;
+pub(crate) use self::core::decoder_solana_core_zk_token_proof_decode;
+pub(crate) use self::core::decoder_solana_core_zk_token_proof_recognize;
/// Runtime-native Solana decoder with phased maximal native coverage.
-pub use self::core::SolanaCoreDecoder;
+pub use self::core::DcSolanaCoreDecoder;
diff --git a/kb-lib/src/decoder/solana/core.rs b/kb-lib/src/decoder/solana/core.rs
index c6203c6..86303b1 100644
--- a/kb-lib/src/decoder/solana/core.rs
+++ b/kb-lib/src/decoder/solana/core.rs
@@ -22,176 +22,176 @@ mod zk_elgamal;
mod zk_token_proof;
/// Expected role and privileges for one positional instruction account.
-pub(crate) use self::accounts::AccountRole as SolanaCoreAccountRole;
+pub(crate) use self::accounts::DcSolanaCoreAccountRole;
/// Resolves positional instruction accounts and validates their core indexes.
-pub(crate) use self::accounts::resolve_accounts as solana_core_resolve_accounts;
+pub(crate) use self::accounts::decoder_solana_core_resolve_accounts;
/// Returns declared Address Lookup Table instruction coverage.
-pub(crate) use self::address_lookup_table::address_lookup_table_coverage as solana_core_address_lookup_table_coverage;
+pub(crate) use self::address_lookup_table::decoder_solana_core_address_lookup_table_coverage;
/// Decodes one Address Lookup Table instruction.
-pub(crate) use self::address_lookup_table::address_lookup_table_decode as solana_core_address_lookup_table_decode;
+pub(crate) use self::address_lookup_table::decoder_solana_core_address_lookup_table_decode;
/// Recognizes one Address Lookup Table instruction without producing an event.
-pub(crate) use self::address_lookup_table::address_lookup_table_recognize as solana_core_address_lookup_table_recognize;
+pub(crate) use self::address_lookup_table::decoder_solana_core_address_lookup_table_recognize;
/// Returns declared Compute Budget instruction coverage.
-pub(crate) use self::compute_budget::compute_budget_coverage as solana_core_compute_budget_coverage;
+pub(crate) use self::compute_budget::decoder_solana_core_compute_budget_coverage;
/// Decodes one Compute Budget instruction.
-pub(crate) use self::compute_budget::compute_budget_decode as solana_core_compute_budget_decode;
+pub(crate) use self::compute_budget::decoder_solana_core_compute_budget_decode;
/// Recognizes one Compute Budget instruction without producing an event.
-pub(crate) use self::compute_budget::compute_budget_recognize as solana_core_compute_budget_recognize;
+pub(crate) use self::compute_budget::decoder_solana_core_compute_budget_recognize;
/// Returns declared Config Program instruction coverage.
-pub(crate) use self::config::config_coverage as solana_core_config_coverage;
+pub(crate) use self::config::decoder_solana_core_config_coverage;
/// Decodes one generic Config Program store instruction.
-pub(crate) use self::config::config_decode as solana_core_config_decode;
+pub(crate) use self::config::decoder_solana_core_config_decode;
/// Recognizes one generic Config Program store instruction.
-pub(crate) use self::config::config_recognize as solana_core_config_recognize;
+pub(crate) use self::config::decoder_solana_core_config_recognize;
/// Stable Address Lookup Table surface code.
-pub(crate) use self::constants::ADDRESS_LOOKUP_TABLE_SURFACE_CODE as SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE;
/// Stable deprecated immutable BPF Loader surface code.
-pub(crate) use self::constants::BPF_LOADER_DEPRECATED_SURFACE_CODE as SOLANA_CORE_BPF_LOADER_DEPRECATED_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_BPF_LOADER_DEPRECATED_SURFACE_CODE;
/// Stable immutable BPF Loader v2 surface code.
-pub(crate) use self::constants::BPF_LOADER_SURFACE_CODE as SOLANA_CORE_BPF_LOADER_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_BPF_LOADER_SURFACE_CODE;
/// Stable upgradeable BPF Loader surface code.
-pub(crate) use self::constants::BPF_LOADER_UPGRADEABLE_SURFACE_CODE as SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE;
/// Stable Compute Budget surface code.
-pub(crate) use self::constants::COMPUTE_BUDGET_SURFACE_CODE as SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE;
/// Stable Config Program surface code.
-pub(crate) use self::constants::CONFIG_SURFACE_CODE as SOLANA_CORE_CONFIG_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_CONFIG_SURFACE_CODE;
/// Byte length of an Ed25519 public key.
-pub(crate) use self::constants::ED25519_PUBLIC_KEY_BYTES as SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES;
+pub(crate) use self::constants::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES;
/// Stable Ed25519 signature precompile surface code.
-pub(crate) use self::constants::ED25519_SURFACE_CODE as SOLANA_CORE_ED25519_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_ED25519_SURFACE_CODE;
/// Stable Feature Gate surface code.
-pub(crate) use self::constants::FEATURE_SURFACE_CODE as SOLANA_CORE_FEATURE_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_FEATURE_SURFACE_CODE;
/// Stable Loader v4 surface code.
-pub(crate) use self::constants::LOADER_V4_SURFACE_CODE as SOLANA_CORE_LOADER_V4_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_LOADER_V4_SURFACE_CODE;
/// Maximum retained native instruction payload accepted by the first decoder phase.
-pub(crate) use self::constants::MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES as SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES;
+pub(crate) use self::constants::DC_SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES;
/// Current native event payload contract version.
-pub(crate) use self::constants::NATIVE_EVENT_VERSION as SOLANA_CORE_NATIVE_EVENT_VERSION;
+pub(crate) use self::constants::DC_SOLANA_CORE_NATIVE_EVENT_VERSION;
/// Stable Native Loader surface code.
-pub(crate) use self::constants::NATIVE_LOADER_SURFACE_CODE as SOLANA_CORE_NATIVE_LOADER_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_NATIVE_LOADER_SURFACE_CODE;
/// Maximum number of component bytes retained as a hexadecimal event prefix.
-pub(crate) use self::constants::PRECOMPILE_COMPONENT_PREFIX_BYTES as SOLANA_CORE_PRECOMPILE_COMPONENT_PREFIX_BYTES;
+pub(crate) use self::constants::DC_SOLANA_CORE_PRECOMPILE_COMPONENT_PREFIX_BYTES;
/// Stable protocol code shared by native Solana events.
-pub(crate) use self::constants::PROTOCOL_CODE as SOLANA_CORE_PROTOCOL_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_PROTOCOL_CODE;
/// Byte length of a secp256k1 Ethereum address.
-pub(crate) use self::constants::SECP256K1_ETHEREUM_ADDRESS_BYTES as SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES;
+pub(crate) use self::constants::DC_SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES;
/// Stable secp256k1 signature precompile surface code.
-pub(crate) use self::constants::SECP256K1_SURFACE_CODE as SOLANA_CORE_SECP256K1_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_SECP256K1_SURFACE_CODE;
/// Runtime maximum number of secp256r1 signatures in one precompile instruction.
-pub(crate) use self::constants::SECP256R1_MAX_SIGNATURES as SOLANA_CORE_SECP256R1_MAX_SIGNATURES;
+pub(crate) use self::constants::DC_SOLANA_CORE_SECP256R1_MAX_SIGNATURES;
/// Byte length of a compressed secp256r1 public key.
-pub(crate) use self::constants::SECP256R1_PUBLIC_KEY_BYTES as SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES;
+pub(crate) use self::constants::DC_SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES;
/// Stable secp256r1 signature precompile surface code.
-pub(crate) use self::constants::SECP256R1_SURFACE_CODE as SOLANA_CORE_SECP256R1_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_SECP256R1_SURFACE_CODE;
/// Byte length shared by compact Ed25519, secp256k1 and secp256r1 signatures.
-pub(crate) use self::constants::SIGNATURE_BYTES as SOLANA_CORE_SIGNATURE_BYTES;
+pub(crate) use self::constants::DC_SOLANA_CORE_SIGNATURE_BYTES;
/// Stable Slashing Program decoder surface code.
-pub(crate) use self::constants::SLASHING_SURFACE_CODE as SOLANA_CORE_SLASHING_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_SLASHING_SURFACE_CODE;
/// Stable Stake Program surface code.
-pub(crate) use self::constants::STAKE_SURFACE_CODE as SOLANA_CORE_STAKE_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_STAKE_SURFACE_CODE;
/// Stable System Program surface code.
-pub(crate) use self::constants::SYSTEM_SURFACE_CODE as SOLANA_CORE_SYSTEM_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_SYSTEM_SURFACE_CODE;
/// Canonical tracing target for the Solana Core decoder component.
-pub(crate) use self::constants::TRACING_TARGET as SOLANA_CORE_TRACING_TARGET;
+pub(crate) use self::constants::DC_SOLANA_CORE_TRACING_TARGET;
/// Byte length of one secp256k1 offsets entry.
-pub(crate) use self::constants::U8_OFFSETS_BYTES as SOLANA_CORE_U8_OFFSETS_BYTES;
+pub(crate) use self::constants::DC_SOLANA_CORE_U8_OFFSETS_BYTES;
/// Byte length of one Ed25519 or secp256r1 offsets entry.
-pub(crate) use self::constants::U16_OFFSETS_BYTES as SOLANA_CORE_U16_OFFSETS_BYTES;
+pub(crate) use self::constants::DC_SOLANA_CORE_U16_OFFSETS_BYTES;
/// Stable Vote Program surface code.
-pub(crate) use self::constants::VOTE_SURFACE_CODE as SOLANA_CORE_VOTE_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_VOTE_SURFACE_CODE;
/// Stable native ZK ElGamal Proof surface code.
-pub(crate) use self::constants::ZK_ELGAMAL_PROOF_SURFACE_CODE as SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE;
/// Stable historical ZK Token Proof surface code.
-pub(crate) use self::constants::ZK_TOKEN_PROOF_SURFACE_CODE as SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE;
+pub(crate) use self::constants::DC_SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE;
/// Builds one exact decoded native observation.
-pub(crate) use self::event::decoded_result as solana_core_decoded_result;
+pub(crate) use self::event::decoder_solana_core_decoded_result;
/// Builds one failed native decode result.
-pub(crate) use self::event::failed_result as solana_core_failed_result;
+pub(crate) use self::event::decoder_solana_core_failed_result;
/// Builds one unsupported native decode result with a bounded diagnostic.
-pub(crate) use self::event::unsupported_result as solana_core_unsupported_result;
+pub(crate) use self::event::decoder_solana_core_unsupported_result;
/// Returns declared Feature Gate instruction coverage.
-pub(crate) use self::feature::feature_coverage as solana_core_feature_coverage;
+pub(crate) use self::feature::decoder_solana_core_feature_coverage;
/// Decodes one Feature Gate instruction.
-pub(crate) use self::feature::feature_decode as solana_core_feature_decode;
+pub(crate) use self::feature::decoder_solana_core_feature_decode;
/// Recognizes one Feature Gate instruction without producing an event.
-pub(crate) use self::feature::feature_recognize as solana_core_feature_recognize;
+pub(crate) use self::feature::decoder_solana_core_feature_recognize;
/// Returns declared loader instruction coverage.
-pub(crate) use self::loaders::loaders_coverage as solana_core_loaders_coverage;
+pub(crate) use self::loaders::decoder_solana_core_loaders_coverage;
/// Decodes one loader instruction.
-pub(crate) use self::loaders::loaders_decode as solana_core_loaders_decode;
+pub(crate) use self::loaders::decoder_solana_core_loaders_decode;
/// Recognizes one loader instruction without producing an event.
-pub(crate) use self::loaders::loaders_recognize as solana_core_loaders_recognize;
+pub(crate) use self::loaders::decoder_solana_core_loaders_recognize;
/// One resolved outer instruction payload and its provenance relative to the target instruction.
-pub(crate) use self::payload::ResolvedInstructionPayload as SolanaCoreResolvedInstructionPayload;
+pub(crate) use self::payload::DcSolanaCoreResolvedInstructionPayload;
/// Returns a hexadecimal prefix no longer than the available byte slice.
-pub(crate) use self::payload::bounded_hexadecimal_prefix as solana_core_bounded_hexadecimal_prefix;
+pub(crate) use self::payload::decoder_solana_core_bounded_hexadecimal_prefix;
/// Extracts one exact bounded byte slice with checked arithmetic.
-pub(crate) use self::payload::bounded_slice as solana_core_bounded_slice;
+pub(crate) use self::payload::decoder_solana_core_bounded_slice;
/// Decodes one retained base64 instruction payload with an explicit byte limit.
-pub(crate) use self::payload::decode_instruction_data as solana_core_decode_instruction_data;
+pub(crate) use self::payload::decoder_solana_core_decode_instruction_data;
/// Returns the decoded target payload length when retained and valid.
-pub(crate) use self::payload::decoded_payload_length as solana_core_decoded_payload_length;
+pub(crate) use self::payload::decoder_solana_core_decoded_payload_length;
/// Returns the SHA-256 of the decoded target instruction data when available.
-pub(crate) use self::payload::decoded_payload_sha256 as solana_core_decoded_payload_sha256;
+pub(crate) use self::payload::decoder_solana_core_decoded_payload_sha256;
/// Returns the lowercase SHA-256 of one bounded byte slice.
-pub(crate) use self::payload::hash_bytes as solana_core_hash_bytes;
+pub(crate) use self::payload::decoder_solana_core_hash_bytes;
/// Returns a normalized lowercase hexadecimal prefix.
-pub(crate) use self::payload::hexadecimal_prefix as solana_core_hexadecimal_prefix;
+pub(crate) use self::payload::decoder_solana_core_hexadecimal_prefix;
/// Returns a stable payload hash from core or computes it from retained JSON.
-pub(crate) use self::payload::payload_hash as solana_core_payload_hash;
+pub(crate) use self::payload::decoder_solana_core_payload_hash;
/// Reads one little-endian `u32` from an exact byte range.
-pub(crate) use self::payload::read_u32_le as solana_core_read_u32_le;
+pub(crate) use self::payload::decoder_solana_core_read_u32_le;
/// Reads one little-endian `u64` from an exact byte range.
-pub(crate) use self::payload::read_u64_le as solana_core_read_u64_le;
+pub(crate) use self::payload::decoder_solana_core_read_u64_le;
/// Resolves a secp256k1 instruction reference. The runtime format has no current-instruction
/// sentinel: every `u8` value is an explicit outer instruction index.
-pub(crate) use self::payload::resolve_u8_instruction_payload as solana_core_resolve_u8_instruction_payload;
+pub(crate) use self::payload::decoder_solana_core_resolve_u8_instruction_payload;
/// Resolves an Ed25519 or secp256r1 instruction reference using the official `u16::MAX` sentinel.
-pub(crate) use self::payload::resolve_u16_instruction_payload as solana_core_resolve_u16_instruction_payload;
+pub(crate) use self::payload::decoder_solana_core_resolve_u16_instruction_payload;
/// Returns the numeric outer index of the target instruction.
-pub(crate) use self::payload::target_outer_instruction_index as solana_core_target_outer_instruction_index;
+pub(crate) use self::payload::decoder_solana_core_target_outer_instruction_index;
/// Returns declared signature precompile coverage.
-pub(crate) use self::precompiles::precompiles_coverage as solana_core_precompiles_coverage;
+pub(crate) use self::precompiles::decoder_solana_core_precompiles_coverage;
/// Decodes one signature precompile instruction structurally without cryptographic recomputation.
-pub(crate) use self::precompiles::precompiles_decode as solana_core_precompiles_decode;
+pub(crate) use self::precompiles::decoder_solana_core_precompiles_decode;
/// Recognizes one signature precompile instruction without resolving referenced data.
-pub(crate) use self::precompiles::precompiles_recognize as solana_core_precompiles_recognize;
+pub(crate) use self::precompiles::decoder_solana_core_precompiles_recognize;
/// Returns declared Slashing Program instruction coverage.
-pub(crate) use self::slashing::slashing_coverage as solana_core_slashing_coverage;
+pub(crate) use self::slashing::decoder_solana_core_slashing_coverage;
/// Decodes one Slashing Program instruction.
-pub(crate) use self::slashing::slashing_decode as solana_core_slashing_decode;
+pub(crate) use self::slashing::decoder_solana_core_slashing_decode;
/// Recognizes one Slashing Program instruction without producing an event.
-pub(crate) use self::slashing::slashing_recognize as solana_core_slashing_recognize;
+pub(crate) use self::slashing::decoder_solana_core_slashing_recognize;
/// Returns declared Stake Program instruction coverage.
-pub(crate) use self::stake::stake_coverage as solana_core_stake_coverage;
+pub(crate) use self::stake::decoder_solana_core_stake_coverage;
/// Decodes one Stake Program instruction.
-pub(crate) use self::stake::stake_decode as solana_core_stake_decode;
+pub(crate) use self::stake::decoder_solana_core_stake_decode;
/// Recognizes one Stake Program instruction without producing an event.
-pub(crate) use self::stake::stake_recognize as solana_core_stake_recognize;
+pub(crate) use self::stake::decoder_solana_core_stake_recognize;
/// Returns declared System Program instruction coverage.
-pub(crate) use self::system::system_coverage as solana_core_system_coverage;
+pub(crate) use self::system::decoder_solana_core_system_coverage;
/// Decodes one System Program instruction.
-pub(crate) use self::system::system_decode as solana_core_system_decode;
+pub(crate) use self::system::decoder_solana_core_system_decode;
/// Recognizes one System Program instruction without producing an event.
-pub(crate) use self::system::system_recognize as solana_core_system_recognize;
+pub(crate) use self::system::decoder_solana_core_system_recognize;
/// Returns declared Vote Program instruction coverage.
-pub(crate) use self::vote::vote_coverage as solana_core_vote_coverage;
+pub(crate) use self::vote::decoder_solana_core_vote_coverage;
/// Decodes one Vote Program instruction.
-pub(crate) use self::vote::vote_decode as solana_core_vote_decode;
+pub(crate) use self::vote::decoder_solana_core_vote_decode;
/// Recognizes one Vote Program instruction without producing an event.
-pub(crate) use self::vote::vote_recognize as solana_core_vote_recognize;
+pub(crate) use self::vote::decoder_solana_core_vote_recognize;
/// Returns declared ZK ElGamal Proof instruction coverage.
-pub(crate) use self::zk_elgamal::zk_elgamal_coverage as solana_core_zk_elgamal_coverage;
+pub(crate) use self::zk_elgamal::decoder_solana_core_zk_elgamal_coverage;
/// Decodes one native ZK ElGamal Proof instruction without recomputing the proof.
-pub(crate) use self::zk_elgamal::zk_elgamal_decode as solana_core_zk_elgamal_decode;
+pub(crate) use self::zk_elgamal::decoder_solana_core_zk_elgamal_decode;
/// Recognizes one native ZK ElGamal Proof instruction.
-pub(crate) use self::zk_elgamal::zk_elgamal_recognize as solana_core_zk_elgamal_recognize;
+pub(crate) use self::zk_elgamal::decoder_solana_core_zk_elgamal_recognize;
/// Returns declared historical and current ZK Token Proof coverage.
-pub(crate) use self::zk_token_proof::zk_token_proof_coverage as solana_core_zk_token_proof_coverage;
+pub(crate) use self::zk_token_proof::decoder_solana_core_zk_token_proof_coverage;
/// Decodes one historical ZK Token Proof layout without recomputing any proof.
-pub(crate) use self::zk_token_proof::zk_token_proof_decode as solana_core_zk_token_proof_decode;
+pub(crate) use self::zk_token_proof::decoder_solana_core_zk_token_proof_decode;
/// Recognizes one historical ZK Token Proof layout or the current no-op runtime fallback.
-pub(crate) use self::zk_token_proof::zk_token_proof_recognize as solana_core_zk_token_proof_recognize;
+pub(crate) use self::zk_token_proof::decoder_solana_core_zk_token_proof_recognize;
/// Runtime-native Solana decoder with phased maximal native coverage.
-pub use self::decoder::SolanaCoreDecoder;
+pub use self::decoder::DcSolanaCoreDecoder;
diff --git a/kb-lib/src/decoder/solana/core/accounts.rs b/kb-lib/src/decoder/solana/core/accounts.rs
index b991ef8..26d100f 100644
--- a/kb-lib/src/decoder/solana/core/accounts.rs
+++ b/kb-lib/src/decoder/solana/core/accounts.rs
@@ -5,7 +5,7 @@
/// Expected role and privileges for one positional instruction account.
#[derive(Clone, Copy, Debug)]
-pub(crate) struct AccountRole {
+pub(crate) struct DcSolanaCoreAccountRole {
/// Stable role code.
pub(crate) role: &'static str,
/// Whether the official instruction contract marks the account writable.
@@ -14,7 +14,7 @@ pub(crate) struct AccountRole {
pub(crate) expected_signer: std::option::Option,
}
-impl AccountRole {
+impl DcSolanaCoreAccountRole {
/// Builds one account role declaration.
pub(crate) const fn new(
role: &'static str,
@@ -39,9 +39,9 @@ impl AccountRole {
}
/// Resolves positional instruction accounts and validates their core indexes.
-pub(crate) fn resolve_accounts(
- input: &crate::CoreInstructionReplayInput,
- roles: &[crate::SolanaCoreAccountRole],
+pub(crate) fn decoder_solana_core_resolve_accounts(
+ input: &crate::MdCoreInstructionReplayInput,
+ roles: &[crate::DcSolanaCoreAccountRole],
minimum_count: usize,
maximum_count: std::option::Option,
) -> kb_core::Result {
diff --git a/kb-lib/src/decoder/solana/core/address_lookup_table.rs b/kb-lib/src/decoder/solana/core/address_lookup_table.rs
index 2ddd9aa..2b11763 100644
--- a/kb-lib/src/decoder/solana/core/address_lookup_table.rs
+++ b/kb-lib/src/decoder/solana/core/address_lookup_table.rs
@@ -6,30 +6,31 @@
const SOURCE: &str =
"solana-address-lookup-table-interface@3.1.0 ProgramInstruction wincode contract";
-const CREATE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("lookup_table", true, false),
- crate::SolanaCoreAccountRole::optional_signer("authority", false),
- crate::SolanaCoreAccountRole::new("payer", true, true),
- crate::SolanaCoreAccountRole::new("system_program", false, false),
+const CREATE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("lookup_table", true, false),
+ crate::DcSolanaCoreAccountRole::optional_signer("authority", false),
+ crate::DcSolanaCoreAccountRole::new("payer", true, true),
+ crate::DcSolanaCoreAccountRole::new("system_program", false, false),
];
-const AUTHORITY_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("lookup_table", true, false),
- crate::SolanaCoreAccountRole::new("authority", false, true),
+const AUTHORITY_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("lookup_table", true, false),
+ crate::DcSolanaCoreAccountRole::new("authority", false, true),
];
-const EXTEND_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("lookup_table", true, false),
- crate::SolanaCoreAccountRole::new("authority", false, true),
- crate::SolanaCoreAccountRole::new("payer", true, true),
- crate::SolanaCoreAccountRole::new("system_program", false, false),
+const EXTEND_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("lookup_table", true, false),
+ crate::DcSolanaCoreAccountRole::new("authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("payer", true, true),
+ crate::DcSolanaCoreAccountRole::new("system_program", false, false),
];
-const CLOSE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("lookup_table", true, false),
- crate::SolanaCoreAccountRole::new("authority", false, true),
- crate::SolanaCoreAccountRole::new("recipient", true, false),
+const CLOSE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("lookup_table", true, false),
+ crate::DcSolanaCoreAccountRole::new("authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("recipient", true, false),
];
/// Returns declared Address Lookup Table instruction coverage.
-pub(crate) fn address_lookup_table_coverage() -> std::vec::Vec {
+pub(crate) fn decoder_solana_core_address_lookup_table_coverage()
+-> std::vec::Vec {
return vec![
coverage_entry(
"create_lookup_table",
@@ -60,37 +61,37 @@ pub(crate) fn address_lookup_table_coverage() -> std::vec::Vec crate::DecoderRecognition {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+) -> crate::DcApiDecoderRecognition {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
std::option::Option::Some(
- crate::SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE.to_string(),
+ crate::DC_SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE.to_string(),
),
std::option::Option::Some("malformed_address_lookup_table_instruction".to_string()),
std::option::Option::None,
);
},
};
- let tag_result = crate::solana_core_read_u32_le(bytes.as_slice(), 0);
+ let tag_result = crate::decoder_solana_core_read_u32_le(bytes.as_slice(), 0);
let tag = match tag_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
std::option::Option::Some(
- crate::SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE.to_string(),
+ crate::DC_SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE.to_string(),
),
std::option::Option::Some("malformed_address_lookup_table_instruction".to_string()),
- crate::solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(4)),
+ crate::decoder_solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(4)),
);
},
};
@@ -103,39 +104,41 @@ pub(crate) fn address_lookup_table_recognize(
} else {
false
};
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
exact,
priority,
- std::option::Option::Some(crate::SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE.to_string()),
+ std::option::Option::Some(
+ crate::DC_SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE.to_string(),
+ ),
entry_code.map(str::to_string).or_else(|| {
return std::option::Option::Some(
"unknown_address_lookup_table_instruction".to_string(),
);
}),
- crate::solana_core_hexadecimal_prefix(bytes.as_slice(), 4),
+ crate::decoder_solana_core_hexadecimal_prefix(bytes.as_slice(), 4),
);
}
/// Decodes one Address Lookup Table instruction.
-pub(crate) fn address_lookup_table_decode(
- input: &crate::CoreInstructionReplayInput,
-) -> crate::DecoderExecutionResult {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+pub(crate) fn decoder_solana_core_address_lookup_table_decode(
+ input: &crate::MdCoreInstructionReplayInput,
+) -> crate::DcApiDecoderExecutionResult {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_address_lookup_table_instruction"),
"address_lookup_table_payload_invalid",
error.to_string(),
);
},
};
- let tag_result = crate::solana_core_read_u32_le(bytes.as_slice(), 0);
+ let tag_result = crate::decoder_solana_core_read_u32_le(bytes.as_slice(), 0);
let tag = match tag_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_address_lookup_table_instruction"),
"address_lookup_table_tag_truncated",
error.to_string(),
@@ -145,12 +148,12 @@ pub(crate) fn address_lookup_table_decode(
let entry_code = match entry_code(tag) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::solana_core_unsupported_result(
+ return crate::decoder_solana_core_unsupported_result(
"unknown_address_lookup_table_instruction",
"address_lookup_table_tag_unknown",
format!(
"unknown Address Lookup Table instruction tag {tag}; payload_sha256={}",
- crate::solana_core_payload_hash(input)
+ crate::decoder_solana_core_payload_hash(input)
),
);
},
@@ -161,7 +164,7 @@ pub(crate) fn address_lookup_table_decode(
let instruction = match instruction_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"address_lookup_table_wincode_invalid",
format!("cannot decode exact Address Lookup Table {entry_code}: {error}"),
@@ -172,9 +175,9 @@ pub(crate) fn address_lookup_table_decode(
}
fn decoded_instruction(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
instruction: solana_address_lookup_table_interface::instruction::ProgramInstruction,
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
return match instruction {
solana_address_lookup_table_interface::instruction::ProgramInstruction::CreateLookupTable {
recent_slot,
@@ -210,7 +213,7 @@ fn decoded_instruction(
.map(std::vec::Vec::len)
.unwrap_or(0);
if account_count != 2 && account_count != 4 {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("extend_lookup_table"),
"address_lookup_table_extend_accounts_invalid",
format!(
@@ -259,30 +262,30 @@ fn decoded_instruction(
}
fn build(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
entry_code: &str,
- roles: &[crate::SolanaCoreAccountRole],
+ roles: &[crate::DcSolanaCoreAccountRole],
minimum_count: usize,
maximum_count: std::option::Option,
parameters: serde_json::Value,
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
let accounts_result =
- crate::solana_core_resolve_accounts(input, roles, minimum_count, maximum_count);
+ crate::decoder_solana_core_resolve_accounts(input, roles, minimum_count, maximum_count);
let accounts = match accounts_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"address_lookup_table_accounts_invalid",
error.to_string(),
);
},
};
- return crate::solana_core_decoded_result(
+ return crate::decoder_solana_core_decoded_result(
input,
- crate::SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE,
entry_code,
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
false,
accounts,
parameters,
@@ -304,19 +307,19 @@ fn entry_code(tag: u32) -> std::option::Option<&'static str> {
fn coverage_entry(
entry_code: &str,
instruction: solana_address_lookup_table_interface::instruction::ProgramInstruction,
-) -> crate::DecoderCoverageDeclaration {
+) -> crate::DcApiDecoderCoverageDeclaration {
let discriminator_hex = match wincode::serialize(&instruction) {
std::result::Result::Ok(bytes) => {
- crate::solana_core_hexadecimal_prefix(bytes.as_slice(), 4)
+ crate::decoder_solana_core_hexadecimal_prefix(bytes.as_slice(), 4)
},
std::result::Result::Err(_error) => std::option::Option::None,
};
- return crate::DecoderCoverageDeclaration {
+ return crate::DcApiDecoderCoverageDeclaration {
program_id: kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID.to_string(),
surface_code: std::option::Option::Some(
- crate::SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE.to_string(),
+ crate::DC_SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE.to_string(),
),
- entry_kind: crate::DecoderCoverageEntryKind::Instruction,
+ entry_kind: crate::DcApiDecoderCoverageEntryKind::Instruction,
entry_code: entry_code.to_string(),
discriminator_hex,
historical: false,
@@ -331,7 +334,7 @@ mod tests {
instruction: &solana_address_lookup_table_interface::instruction::ProgramInstruction,
account_count: usize,
transaction_failed: bool,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
let bytes_result = wincode::serialize(instruction);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
@@ -344,7 +347,7 @@ mod tests {
bytes: &[u8],
account_count: usize,
transaction_failed: bool,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
let encoded = base64::engine::general_purpose::STANDARD.encode(bytes);
let account_keys = (0..account_count)
.map(|index| {
@@ -366,7 +369,7 @@ mod tests {
});
})
.collect::>();
- let result = crate::CoreInstructionReplayInput::new(
+ let result = crate::MdCoreInstructionReplayInput::new(
"signature:0",
"signature",
42,
@@ -429,12 +432,12 @@ mod tests {
),
];
for (instruction, account_count, expected) in fixtures {
- let result = crate::solana_core_address_lookup_table_decode(&replay_input(
+ let result = crate::decoder_solana_core_address_lookup_table_decode(&replay_input(
&instruction,
account_count,
false,
));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some(expected)
@@ -448,28 +451,30 @@ mod tests {
let instruction = solana_address_lookup_table_interface::instruction::ProgramInstruction::ExtendLookupTable {
new_addresses: std::vec::Vec::new(),
};
- let without_funding =
- crate::solana_core_address_lookup_table_decode(&replay_input(&instruction, 2, false));
- assert_eq!(without_funding.status, crate::DecoderOutcomeStatus::Decoded);
- let incomplete =
- crate::solana_core_address_lookup_table_decode(&replay_input(&instruction, 3, false));
- assert_eq!(incomplete.status, crate::DecoderOutcomeStatus::Failed);
+ let without_funding = crate::decoder_solana_core_address_lookup_table_decode(
+ &replay_input(&instruction, 2, false),
+ );
+ assert_eq!(without_funding.status, crate::DcApiDecoderOutcomeStatus::Decoded);
+ let incomplete = crate::decoder_solana_core_address_lookup_table_decode(&replay_input(
+ &instruction,
+ 3,
+ false,
+ ));
+ assert_eq!(incomplete.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn truncated_unknown_and_trailing_payloads_are_distinguished() {
- let truncated = crate::solana_core_address_lookup_table_decode(&replay_input_bytes(
- &[0, 0, 0],
- 4,
- false,
- ));
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
- let unknown = crate::solana_core_address_lookup_table_decode(&replay_input_bytes(
+ let truncated = crate::decoder_solana_core_address_lookup_table_decode(
+ &replay_input_bytes(&[0, 0, 0], 4, false),
+ );
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let unknown = crate::decoder_solana_core_address_lookup_table_decode(&replay_input_bytes(
&[255, 0, 0, 0],
0,
false,
));
- assert_eq!(unknown.status, crate::DecoderOutcomeStatus::Unsupported);
+ assert_eq!(unknown.status, crate::DcApiDecoderOutcomeStatus::Unsupported);
let mut valid = match wincode::serialize(
&solana_address_lookup_table_interface::instruction::ProgramInstruction::FreezeLookupTable,
) {
@@ -477,27 +482,30 @@ mod tests {
std::result::Result::Err(error) => panic!("ALT fixture serialization failed: {error}"),
};
valid.push(1);
- let trailing = crate::solana_core_address_lookup_table_decode(&replay_input_bytes(
+ let trailing = crate::decoder_solana_core_address_lookup_table_decode(&replay_input_bytes(
valid.as_slice(),
2,
false,
));
- assert_eq!(trailing.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(trailing.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn failed_transaction_is_decoded_as_uncommitted_lifecycle_intent() {
let instruction = solana_address_lookup_table_interface::instruction::ProgramInstruction::DeactivateLookupTable;
- let result =
- crate::solana_core_address_lookup_table_decode(&replay_input(&instruction, 2, true));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_address_lookup_table_decode(&replay_input(
+ &instruction,
+ 2,
+ true,
+ ));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!result.observations[0].observation_committed);
assert_eq!(result.observations[0].payload_json["transactionSucceeded"], false);
}
#[test]
fn coverage_uses_official_encoder_discriminants() {
- let coverage = crate::solana_core_address_lookup_table_coverage();
+ let coverage = crate::decoder_solana_core_address_lookup_table_coverage();
assert_eq!(coverage.len(), 5);
assert_eq!(coverage[0].discriminator_hex.as_deref(), std::option::Option::Some("00000000"));
assert_eq!(coverage[4].discriminator_hex.as_deref(), std::option::Option::Some("04000000"));
diff --git a/kb-lib/src/decoder/solana/core/compute_budget.rs b/kb-lib/src/decoder/solana/core/compute_budget.rs
index 9375122..589c740 100644
--- a/kb-lib/src/decoder/solana/core/compute_budget.rs
+++ b/kb-lib/src/decoder/solana/core/compute_budget.rs
@@ -10,7 +10,8 @@ const SOURCE_HISTORICAL: &str =
"solana-sdk compute_budget::ComputeBudgetInstruction RequestUnitsDeprecated";
/// Returns declared Compute Budget instruction coverage.
-pub(crate) fn compute_budget_coverage() -> std::vec::Vec {
+pub(crate) fn decoder_solana_core_compute_budget_coverage()
+-> std::vec::Vec {
return vec![
coverage_entry("unused_reserved", "00", false),
coverage_entry("request_units_deprecated", "00", true),
@@ -22,19 +23,19 @@ pub(crate) fn compute_budget_coverage() -> std::vec::Vec crate::DecoderRecognition {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+) -> crate::DcApiDecoderRecognition {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
std::option::Option::Some(
- crate::SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE.to_string(),
+ crate::DC_SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE.to_string(),
),
std::option::Option::Some("malformed_compute_budget_instruction".to_string()),
std::option::Option::None,
@@ -42,26 +43,26 @@ pub(crate) fn compute_budget_recognize(
},
};
let entry_code = entry_code(bytes.as_slice());
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
entry_code.is_some(),
priority,
- std::option::Option::Some(crate::SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE.to_string()),
entry_code.map(str::to_string).or_else(|| {
return std::option::Option::Some("unknown_compute_budget_instruction".to_string());
}),
- crate::solana_core_hexadecimal_prefix(bytes.as_slice(), 1),
+ crate::decoder_solana_core_hexadecimal_prefix(bytes.as_slice(), 1),
);
}
/// Decodes one Compute Budget instruction.
-pub(crate) fn compute_budget_decode(
- input: &crate::CoreInstructionReplayInput,
-) -> crate::DecoderExecutionResult {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+pub(crate) fn decoder_solana_core_compute_budget_decode(
+ input: &crate::MdCoreInstructionReplayInput,
+) -> crate::DcApiDecoderExecutionResult {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_compute_budget_instruction"),
"compute_budget_payload_invalid",
error.to_string(),
@@ -69,18 +70,18 @@ pub(crate) fn compute_budget_decode(
},
};
if bytes.is_empty() {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_compute_budget_instruction"),
"compute_budget_payload_empty",
"Compute Budget instruction payload is empty",
);
}
let accounts_result =
- crate::solana_core_resolve_accounts(input, &[], 0, std::option::Option::None);
+ crate::decoder_solana_core_resolve_accounts(input, &[], 0, std::option::Option::None);
let accounts = match accounts_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
entry_code(bytes.as_slice()),
"compute_budget_accounts_invalid",
error.to_string(),
@@ -88,26 +89,26 @@ pub(crate) fn compute_budget_decode(
},
};
return match bytes[0] {
- 0 if bytes.len() == 1 => crate::DecoderExecutionResult::ignored(std::option::Option::Some(
- "unused_reserved".to_string(),
- )),
+ 0 if bytes.len() == 1 => crate::DcApiDecoderExecutionResult::ignored(
+ std::option::Option::Some("unused_reserved".to_string()),
+ ),
0 if bytes.len() == 9 => {
- let units_result = crate::solana_core_read_u32_le(bytes.as_slice(), 1);
+ let units_result = crate::decoder_solana_core_read_u32_le(bytes.as_slice(), 1);
let units = match units_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("request_units_deprecated"),
"compute_budget_request_units_truncated",
error.to_string(),
);
},
};
- let additional_fee_result = crate::solana_core_read_u32_le(bytes.as_slice(), 5);
+ let additional_fee_result = crate::decoder_solana_core_read_u32_le(bytes.as_slice(), 5);
let additional_fee = match additional_fee_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("request_units_deprecated"),
"compute_budget_request_units_truncated",
error.to_string(),
@@ -118,18 +119,18 @@ pub(crate) fn compute_budget_decode(
parameters.insert("units".to_string(), serde_json::json!(units));
parameters.insert("additionalFee".to_string(), serde_json::json!(additional_fee));
append_transaction_profile(input, &mut parameters);
- crate::solana_core_decoded_result(
+ crate::decoder_solana_core_decoded_result(
input,
- crate::SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE,
"request_units_deprecated",
- crate::EventFamily::Audit,
+ crate::MdEventFamily::Audit,
true,
accounts,
serde_json::Value::Object(parameters),
SOURCE_HISTORICAL,
)
},
- 0 => crate::solana_core_failed_result(
+ 0 => crate::decoder_solana_core_failed_result(
std::option::Option::Some("request_units_deprecated"),
"compute_budget_request_units_size_invalid",
format!(
@@ -161,26 +162,26 @@ pub(crate) fn compute_budget_decode(
"set_loaded_accounts_data_size_limit",
"bytes",
),
- tag => crate::solana_core_unsupported_result(
+ tag => crate::decoder_solana_core_unsupported_result(
"unknown_compute_budget_instruction",
"compute_budget_tag_unknown",
format!(
"unknown Compute Budget instruction tag {tag}; payload_sha256={}",
- crate::solana_core_payload_hash(input)
+ crate::decoder_solana_core_payload_hash(input)
),
),
};
}
fn decode_u32_instruction(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
accounts: serde_json::Value,
entry_code: &str,
field_name: &str,
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
if bytes.len() < 5 {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"compute_budget_instruction_size_invalid",
format!(
@@ -189,11 +190,11 @@ fn decode_u32_instruction(
),
);
}
- let value_result = crate::solana_core_read_u32_le(bytes, 1);
+ let value_result = crate::decoder_solana_core_read_u32_le(bytes, 1);
let value = match value_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"compute_budget_instruction_truncated",
error.to_string(),
@@ -204,11 +205,11 @@ fn decode_u32_instruction(
parameters.insert(field_name.to_string(), serde_json::json!(value));
append_runtime_ignored_trailing_data(&mut parameters, bytes, 5);
append_transaction_profile(input, &mut parameters);
- return crate::solana_core_decoded_result(
+ return crate::decoder_solana_core_decoded_result(
input,
- crate::SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE,
entry_code,
- crate::EventFamily::Audit,
+ crate::MdEventFamily::Audit,
false,
accounts,
serde_json::Value::Object(parameters),
@@ -217,14 +218,14 @@ fn decode_u32_instruction(
}
fn decode_u64_instruction(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
accounts: serde_json::Value,
entry_code: &str,
field_name: &str,
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
if bytes.len() < 9 {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"compute_budget_instruction_size_invalid",
format!(
@@ -233,11 +234,11 @@ fn decode_u64_instruction(
),
);
}
- let value_result = crate::solana_core_read_u64_le(bytes, 1);
+ let value_result = crate::decoder_solana_core_read_u64_le(bytes, 1);
let value = match value_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"compute_budget_instruction_truncated",
error.to_string(),
@@ -248,11 +249,11 @@ fn decode_u64_instruction(
parameters.insert(field_name.to_string(), serde_json::json!(value));
append_runtime_ignored_trailing_data(&mut parameters, bytes, 9);
append_transaction_profile(input, &mut parameters);
- return crate::solana_core_decoded_result(
+ return crate::decoder_solana_core_decoded_result(
input,
- crate::SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE,
entry_code,
- crate::EventFamily::Audit,
+ crate::MdEventFamily::Audit,
false,
accounts,
serde_json::Value::Object(parameters),
@@ -261,13 +262,13 @@ fn decode_u64_instruction(
}
fn append_transaction_profile(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
parameters: &mut serde_json::Map,
) {
parameters.insert("transactionProfile".to_string(), transaction_profile(input));
}
-fn transaction_profile(input: &crate::CoreInstructionReplayInput) -> serde_json::Value {
+fn transaction_profile(input: &crate::MdCoreInstructionReplayInput) -> serde_json::Value {
let target_path = input.instruction_path.as_str();
let mut instruction_rows = std::vec::Vec::new();
let mut effective = serde_json::Map::new();
@@ -337,7 +338,7 @@ impl ComputeBudgetProfileRow {
}
fn compute_budget_outer_rows(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
) -> std::vec::Vec {
let mut rows = std::vec::Vec::new();
let outer_values = match input.outer_instructions_json.as_array() {
@@ -393,14 +394,14 @@ fn compute_budget_outer_rows(
));
}
if rows.is_empty() && input.program_id == kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
rows.push(profile_failure_row(
input.instruction_path.parse::().unwrap_or(0),
input.instruction_path.clone(),
- serde_json::Value::String(crate::solana_core_payload_hash(input)),
+ serde_json::Value::String(crate::decoder_solana_core_payload_hash(input)),
"payload_invalid",
error.to_string().as_str(),
));
@@ -410,7 +411,7 @@ fn compute_budget_outer_rows(
rows.push(profile_row_from_bytes(
input.instruction_path.parse::().unwrap_or(0),
input.instruction_path.clone(),
- serde_json::Value::String(crate::solana_core_payload_hash(input)),
+ serde_json::Value::String(crate::decoder_solana_core_payload_hash(input)),
bytes.as_slice(),
));
}
@@ -432,10 +433,14 @@ fn profile_row_from_bytes(
"unused_reserved" => {},
"request_units_deprecated" => {
if bytes.len() == 9 {
- if let std::result::Result::Ok(value) = crate::solana_core_read_u32_le(bytes, 1) {
+ if let std::result::Result::Ok(value) =
+ crate::decoder_solana_core_read_u32_le(bytes, 1)
+ {
parameters.insert("units".to_string(), serde_json::json!(value));
}
- if let std::result::Result::Ok(value) = crate::solana_core_read_u32_le(bytes, 5) {
+ if let std::result::Result::Ok(value) =
+ crate::decoder_solana_core_read_u32_le(bytes, 5)
+ {
parameters.insert("additionalFee".to_string(), serde_json::json!(value));
}
} else {
@@ -445,7 +450,9 @@ fn profile_row_from_bytes(
},
"request_heap_frame" | "set_compute_unit_limit" | "set_loaded_accounts_data_size_limit" => {
if bytes.len() >= 5 {
- if let std::result::Result::Ok(value) = crate::solana_core_read_u32_le(bytes, 1) {
+ if let std::result::Result::Ok(value) =
+ crate::decoder_solana_core_read_u32_le(bytes, 1)
+ {
let field_name = match entry {
"request_heap_frame" => "bytes",
"set_compute_unit_limit" => "computeUnitLimit",
@@ -461,7 +468,9 @@ fn profile_row_from_bytes(
},
"set_compute_unit_price" => {
if bytes.len() >= 9 {
- if let std::result::Result::Ok(value) = crate::solana_core_read_u64_le(bytes, 1) {
+ if let std::result::Result::Ok(value) =
+ crate::decoder_solana_core_read_u64_le(bytes, 1)
+ {
parameters.insert("microLamports".to_string(), serde_json::json!(value));
}
trailing_data_present = bytes.len() > 9;
@@ -515,7 +524,7 @@ fn decode_payload_json_for_profile(
return std::result::Result::Err("payload does not contain dataBase64".to_string());
},
};
- let maximum_encoded_length = crate::SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES
+ let maximum_encoded_length = crate::DC_SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES
.saturating_mul(4)
.saturating_div(3)
.saturating_add(4);
@@ -531,10 +540,10 @@ fn decode_payload_json_for_profile(
return std::result::Result::Err(format!("payload is not valid base64: {error}"));
},
};
- if decoded.len() > crate::SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES {
+ if decoded.len() > crate::DC_SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES {
return std::result::Result::Err(format!(
"payload exceeds {} decoded bytes",
- crate::SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES
+ crate::DC_SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES
));
}
return std::result::Result::Ok(decoded);
@@ -612,11 +621,11 @@ fn append_runtime_ignored_trailing_data(
parameters.insert("trailingDataByteLength".to_string(), serde_json::json!(trailing_data.len()));
parameters.insert(
"trailingDataSha256".to_string(),
- serde_json::json!(crate::solana_core_hash_bytes(trailing_data)),
+ serde_json::json!(crate::decoder_solana_core_hash_bytes(trailing_data)),
);
parameters.insert(
"trailingDataPrefixHex".to_string(),
- serde_json::json!(crate::solana_core_hexadecimal_prefix(
+ serde_json::json!(crate::decoder_solana_core_hexadecimal_prefix(
trailing_data,
trailing_data.len().min(16),
)),
@@ -647,13 +656,13 @@ fn coverage_entry(
entry_code: &str,
discriminator_hex: &str,
historical: bool,
-) -> crate::DecoderCoverageDeclaration {
- return crate::DecoderCoverageDeclaration {
+) -> crate::DcApiDecoderCoverageDeclaration {
+ return crate::DcApiDecoderCoverageDeclaration {
program_id: kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID.to_string(),
surface_code: std::option::Option::Some(
- crate::SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE.to_string(),
+ crate::DC_SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE.to_string(),
),
- entry_kind: crate::DecoderCoverageEntryKind::Instruction,
+ entry_kind: crate::DcApiDecoderCoverageEntryKind::Instruction,
entry_code: entry_code.to_string(),
discriminator_hex: std::option::Option::Some(discriminator_hex.to_string()),
historical,
@@ -664,9 +673,9 @@ fn coverage_entry(
mod tests {
use base64::Engine; // rust-rules: trait-import
- fn replay_input(bytes: &[u8], transaction_failed: bool) -> crate::CoreInstructionReplayInput {
+ fn replay_input(bytes: &[u8], transaction_failed: bool) -> crate::MdCoreInstructionReplayInput {
let encoded = base64::engine::general_purpose::STANDARD.encode(bytes);
- let result = crate::CoreInstructionReplayInput::new(
+ let result = crate::MdCoreInstructionReplayInput::new(
"signature:0",
"signature",
42,
@@ -697,9 +706,9 @@ mod tests {
bytes: &[u8],
instruction_path: &str,
outer_instructions_json: serde_json::Value,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
let encoded = base64::engine::general_purpose::STANDARD.encode(bytes);
- let result = crate::CoreInstructionReplayInput::new(
+ let result = crate::MdCoreInstructionReplayInput::new(
"signature:0",
"signature",
42,
@@ -761,12 +770,12 @@ mod tests {
&[2, 128, 132, 30, 0],
),
]);
- let result = crate::solana_core_compute_budget_decode(&replay_input_with_outer(
+ let result = crate::decoder_solana_core_compute_budget_decode(&replay_input_with_outer(
&[2, 64, 66, 15, 0],
"0",
outer,
));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
let profile = &result.observations[0].payload_json["parameters"]["transactionProfile"];
assert_eq!(profile["currentInstructionIsProfileEmitter"], true);
assert_eq!(profile["computeBudgetInstructionCount"], 3);
@@ -790,9 +799,11 @@ mod tests {
},
};
assert_eq!(bytes, [3, 7, 0, 0, 0, 0, 0, 0, 0]);
- let result =
- crate::solana_core_compute_budget_decode(&replay_input(bytes.as_slice(), false));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_compute_budget_decode(&replay_input(
+ bytes.as_slice(),
+ false,
+ ));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some("set_compute_unit_price")
@@ -808,9 +819,11 @@ mod tests {
(vec![4, 0, 0, 0, 1], "set_loaded_accounts_data_size_limit"),
];
for (bytes, expected) in fixtures {
- let result =
- crate::solana_core_compute_budget_decode(&replay_input(bytes.as_slice(), false));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_compute_budget_decode(&replay_input(
+ bytes.as_slice(),
+ false,
+ ));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some(expected)
@@ -821,11 +834,11 @@ mod tests {
#[test]
fn historical_request_units_is_decoded() {
- let result = crate::solana_core_compute_budget_decode(&replay_input(
+ let result = crate::decoder_solana_core_compute_budget_decode(&replay_input(
&[0, 64, 13, 3, 0, 7, 0, 0, 0],
false,
));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some("request_units_deprecated")
@@ -836,27 +849,28 @@ mod tests {
#[test]
fn reserved_unused_tag_is_ignored_without_false_event() {
- let result = crate::solana_core_compute_budget_decode(&replay_input(&[0], false));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Ignored);
+ let result = crate::decoder_solana_core_compute_budget_decode(&replay_input(&[0], false));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Ignored);
assert!(result.observations.is_empty());
}
#[test]
fn truncated_and_unknown_payloads_are_distinguished() {
- let truncated = crate::solana_core_compute_budget_decode(&replay_input(&[2, 1, 2], false));
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
+ let truncated =
+ crate::decoder_solana_core_compute_budget_decode(&replay_input(&[2, 1, 2], false));
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
let unknown =
- crate::solana_core_compute_budget_decode(&replay_input(&[255, 1, 2, 3], false));
- assert_eq!(unknown.status, crate::DecoderOutcomeStatus::Unsupported);
+ crate::decoder_solana_core_compute_budget_decode(&replay_input(&[255, 1, 2, 3], false));
+ assert_eq!(unknown.status, crate::DcApiDecoderOutcomeStatus::Unsupported);
}
#[test]
fn current_variants_accept_and_preserve_runtime_ignored_trailing_bytes() {
- let result = crate::solana_core_compute_budget_decode(&replay_input(
+ let result = crate::decoder_solana_core_compute_budget_decode(&replay_input(
&[2, 64, 13, 3, 0, 1, 2, 3, 4, 5, 6, 7],
true,
));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some("set_compute_unit_limit")
@@ -877,9 +891,11 @@ mod tests {
#[test]
fn failed_transaction_event_is_not_committed() {
- let result =
- crate::solana_core_compute_budget_decode(&replay_input(&[2, 64, 13, 3, 0], true));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_compute_budget_decode(&replay_input(
+ &[2, 64, 13, 3, 0],
+ true,
+ ));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(result.observations[0].transaction_failed);
assert!(!result.observations[0].observation_committed);
assert_eq!(result.observations[0].payload_json["transactionSucceeded"], false);
@@ -887,7 +903,7 @@ mod tests {
#[test]
fn coverage_declares_current_and_historical_entries() {
- let coverage = crate::solana_core_compute_budget_coverage();
+ let coverage = crate::decoder_solana_core_compute_budget_coverage();
assert_eq!(coverage.len(), 6);
assert!(coverage.iter().any(|entry| {
return entry.entry_code == "request_units_deprecated" && entry.historical;
diff --git a/kb-lib/src/decoder/solana/core/config.rs b/kb-lib/src/decoder/solana/core/config.rs
index a50ec7d..23c5fb8 100644
--- a/kb-lib/src/decoder/solana/core/config.rs
+++ b/kb-lib/src/decoder/solana/core/config.rs
@@ -14,11 +14,14 @@ struct ParsedConfigPayload {
}
/// Returns declared Config Program instruction coverage.
-pub(crate) fn config_coverage() -> std::vec::Vec {
- return vec![crate::DecoderCoverageDeclaration {
+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(),
- surface_code: std::option::Option::Some(crate::SOLANA_CORE_CONFIG_SURFACE_CODE.to_string()),
- entry_kind: crate::DecoderCoverageEntryKind::Instruction,
+ surface_code: std::option::Option::Some(
+ crate::DC_SOLANA_CORE_CONFIG_SURFACE_CODE.to_string(),
+ ),
+ entry_kind: crate::DcApiDecoderCoverageEntryKind::Instruction,
entry_code: "store".to_string(),
discriminator_hex: std::option::Option::None,
historical: false,
@@ -26,46 +29,46 @@ pub(crate) fn config_coverage() -> std::vec::Vec crate::DecoderRecognition {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+) -> crate::DcApiDecoderRecognition {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
- std::option::Option::Some(crate::SOLANA_CORE_CONFIG_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_CONFIG_SURFACE_CODE.to_string()),
std::option::Option::Some("malformed_config_store".to_string()),
std::option::Option::None,
);
},
};
let exact = parse_payload(bytes.as_slice()).is_ok();
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
exact,
priority,
- std::option::Option::Some(crate::SOLANA_CORE_CONFIG_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_CONFIG_SURFACE_CODE.to_string()),
std::option::Option::Some(if exact {
"store".to_string()
} else {
"malformed_config_store".to_string()
}),
- crate::solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(3)),
+ crate::decoder_solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(3)),
);
}
/// Decodes one generic Config Program store instruction.
-pub(crate) fn config_decode(
- input: &crate::CoreInstructionReplayInput,
-) -> crate::DecoderExecutionResult {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+pub(crate) fn decoder_solana_core_config_decode(
+ input: &crate::MdCoreInstructionReplayInput,
+) -> crate::DcApiDecoderExecutionResult {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_config_store"),
"config_payload_invalid",
error.to_string(),
@@ -76,7 +79,7 @@ pub(crate) fn config_decode(
let parsed = match parsed_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("store"),
"config_keys_invalid",
error.to_string(),
@@ -87,7 +90,7 @@ pub(crate) fn config_decode(
let accounts = match accounts_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("store"),
"config_accounts_invalid",
error.to_string(),
@@ -97,7 +100,7 @@ pub(crate) fn config_decode(
let data = match bytes.get(parsed.data_offset..) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("store"),
"config_data_offset_invalid",
"Config data offset exceeds retained payload",
@@ -112,11 +115,11 @@ pub(crate) fn config_decode(
})
.collect::>();
let signer_count = parsed.keys.iter().filter(|(_, signer)| return *signer).count();
- return crate::solana_core_decoded_result(
+ return crate::decoder_solana_core_decoded_result(
input,
- crate::SOLANA_CORE_CONFIG_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_CONFIG_SURFACE_CODE,
"store",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
false,
accounts,
serde_json::json!({
@@ -124,8 +127,8 @@ pub(crate) fn config_decode(
"configuredKeyCount": parsed.keys.len(),
"configuredSignerCount": signer_count,
"configDataByteLength": data.len(),
- "configDataSha256": crate::solana_core_hash_bytes(data),
- "configDataPrefixHex": crate::solana_core_hexadecimal_prefix(data, data.len().min(16)),
+ "configDataSha256": crate::decoder_solana_core_hash_bytes(data),
+ "configDataPrefixHex": crate::decoder_solana_core_hexadecimal_prefix(data, data.len().min(16)),
"configDataSemantics": "opaque_program_specific",
}),
SOURCE,
@@ -247,7 +250,7 @@ fn read_compact_u16(bytes: &[u8]) -> kb_core::Result<(u16, usize)> {
}
fn resolve_and_validate_accounts(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
parsed: &ParsedConfigPayload,
) -> kb_core::Result {
let instruction_accounts = match input.instruction_accounts_json.as_array() {
@@ -277,12 +280,12 @@ fn resolve_and_validate_accounts(
.map(|(pubkey, _signer)| return pubkey.as_str())
.collect::>();
let mut roles = std::vec::Vec::with_capacity(required_signers.len().saturating_add(1));
- roles.push(crate::SolanaCoreAccountRole::optional_signer("config_account", true));
+ roles.push(crate::DcSolanaCoreAccountRole::optional_signer("config_account", true));
for _signer in &required_signers {
- roles.push(crate::SolanaCoreAccountRole::new("configured_signer", true, true));
+ roles.push(crate::DcSolanaCoreAccountRole::new("configured_signer", true, true));
}
let minimum_count = required_signers.len().saturating_add(1);
- let accounts = match crate::solana_core_resolve_accounts(
+ let accounts = match crate::decoder_solana_core_resolve_accounts(
input,
roles.as_slice(),
minimum_count,
@@ -338,7 +341,7 @@ mod tests {
bytes: &[u8],
extra_accounts: &[std::string::String],
transaction_failed: bool,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
let mut keys = vec!["ConfigAccount1111111111111111111111111111".to_string()];
keys.extend_from_slice(extra_accounts);
let account_keys = keys
@@ -362,7 +365,7 @@ mod tests {
return serde_json::json!({"accountIndex": index, "accountKey": key});
})
.collect::>();
- let result = crate::CoreInstructionReplayInput::new(
+ let result = crate::MdCoreInstructionReplayInput::new(
"signature:0",
"signature",
42,
@@ -395,11 +398,12 @@ mod tests {
fn valid_generic_store_is_recognized_exactly() {
let payload = encode_payload(&[], &[1, 2, 3]);
let input = replay_input(payload.as_slice(), &[], false);
- let recognition = crate::solana_core_config_recognize(&input, 100);
+ let recognition = crate::decoder_solana_core_config_recognize(&input, 100);
assert!(recognition.compatible);
assert!(recognition.exact);
assert_eq!(recognition.entry_code.as_deref(), std::option::Option::Some("store"));
- let malformed = crate::solana_core_config_recognize(&replay_input(&[], &[], false), 100);
+ let malformed =
+ crate::decoder_solana_core_config_recognize(&replay_input(&[], &[], false), 100);
assert!(malformed.compatible);
assert!(!malformed.exact);
}
@@ -408,8 +412,8 @@ mod tests {
fn empty_key_set_and_opaque_data_decode_without_invented_semantics() {
let payload = encode_payload(&[], &[1, 2, 3, 4]);
let result =
- crate::solana_core_config_decode(&replay_input(payload.as_slice(), &[], false));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ crate::decoder_solana_core_config_decode(&replay_input(payload.as_slice(), &[], false));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(result.observations[0].payload_json["parameters"]["configuredKeyCount"], 0);
assert_eq!(result.observations[0].payload_json["parameters"]["configDataByteLength"], 4);
assert_eq!(
@@ -423,9 +427,12 @@ mod tests {
let signer_bytes = [7_u8; 32];
let signer = bs58::encode(signer_bytes).into_string();
let payload = encode_payload(&[([3_u8; 32], false), (signer_bytes, true)], &[9]);
- let result =
- crate::solana_core_config_decode(&replay_input(payload.as_slice(), &[signer], false));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_config_decode(&replay_input(
+ payload.as_slice(),
+ &[signer],
+ false,
+ ));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(result.observations[0].payload_json["parameters"]["configuredSignerCount"], 1);
assert_eq!(result.observations[0].payload_json["accounts"][1]["role"], "configured_signer");
}
@@ -452,9 +459,12 @@ mod tests {
value
},
] {
- let result =
- crate::solana_core_config_decode(&replay_input(payload.as_slice(), &[], false));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Failed);
+ let result = crate::decoder_solana_core_config_decode(&replay_input(
+ payload.as_slice(),
+ &[],
+ false,
+ ));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
}
@@ -463,27 +473,28 @@ mod tests {
let signer_bytes = [8_u8; 32];
let payload = encode_payload(&[(signer_bytes, true)], &[]);
let missing =
- crate::solana_core_config_decode(&replay_input(payload.as_slice(), &[], false));
- assert_eq!(missing.status, crate::DecoderOutcomeStatus::Failed);
- let mismatch = crate::solana_core_config_decode(&replay_input(
+ crate::decoder_solana_core_config_decode(&replay_input(payload.as_slice(), &[], false));
+ assert_eq!(missing.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let mismatch = crate::decoder_solana_core_config_decode(&replay_input(
payload.as_slice(),
&[bs58::encode([9_u8; 32]).into_string()],
false,
));
- assert_eq!(mismatch.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(mismatch.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn failed_config_store_is_decoded_as_uncommitted_intent() {
let payload = encode_payload(&[], &[5]);
- let result = crate::solana_core_config_decode(&replay_input(payload.as_slice(), &[], true));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result =
+ crate::decoder_solana_core_config_decode(&replay_input(payload.as_slice(), &[], true));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!result.observations[0].observation_committed);
}
#[test]
fn coverage_declares_one_generic_store_surface() {
- let coverage = crate::solana_core_config_coverage();
+ let coverage = crate::decoder_solana_core_config_coverage();
assert_eq!(coverage.len(), 1);
assert_eq!(coverage[0].entry_code, "store");
assert!(coverage[0].discriminator_hex.is_none());
diff --git a/kb-lib/src/decoder/solana/core/constants.rs b/kb-lib/src/decoder/solana/core/constants.rs
index e7fda41..38f0d09 100644
--- a/kb-lib/src/decoder/solana/core/constants.rs
+++ b/kb-lib/src/decoder/solana/core/constants.rs
@@ -4,63 +4,67 @@
//! Local constants for the Solana Core decoder component.
/// Stable protocol code shared by native Solana events.
-pub(crate) const PROTOCOL_CODE: &str = "solana_native";
+pub(crate) const DC_SOLANA_CORE_PROTOCOL_CODE: &str = "solana_native";
/// Stable System Program surface code.
-pub(crate) const SYSTEM_SURFACE_CODE: &str = "solana_native_system";
+pub(crate) const DC_SOLANA_CORE_SYSTEM_SURFACE_CODE: &str = "solana_native_system";
/// Stable deprecated immutable BPF Loader surface code.
-pub(crate) const BPF_LOADER_DEPRECATED_SURFACE_CODE: &str = "solana_native_bpf_loader_deprecated";
+pub(crate) const DC_SOLANA_CORE_BPF_LOADER_DEPRECATED_SURFACE_CODE: &str =
+ "solana_native_bpf_loader_deprecated";
/// Stable immutable BPF Loader v2 surface code.
-pub(crate) const BPF_LOADER_SURFACE_CODE: &str = "solana_native_bpf_loader";
+pub(crate) const DC_SOLANA_CORE_BPF_LOADER_SURFACE_CODE: &str = "solana_native_bpf_loader";
/// Stable upgradeable BPF Loader surface code.
-pub(crate) const BPF_LOADER_UPGRADEABLE_SURFACE_CODE: &str = "solana_native_bpf_loader_upgradeable";
+pub(crate) const DC_SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE: &str =
+ "solana_native_bpf_loader_upgradeable";
/// Stable Loader v4 surface code.
-pub(crate) const LOADER_V4_SURFACE_CODE: &str = "solana_native_loader_v4";
+pub(crate) const DC_SOLANA_CORE_LOADER_V4_SURFACE_CODE: &str = "solana_native_loader_v4";
/// Stable Native Loader surface code.
-pub(crate) const NATIVE_LOADER_SURFACE_CODE: &str = "solana_native_loader";
+pub(crate) const DC_SOLANA_CORE_NATIVE_LOADER_SURFACE_CODE: &str = "solana_native_loader";
/// Stable Compute Budget surface code.
-pub(crate) const COMPUTE_BUDGET_SURFACE_CODE: &str = "solana_native_compute_budget";
+pub(crate) const DC_SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE: &str = "solana_native_compute_budget";
/// Stable Address Lookup Table surface code.
-pub(crate) const ADDRESS_LOOKUP_TABLE_SURFACE_CODE: &str = "solana_native_address_lookup_table";
+pub(crate) const DC_SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE: &str =
+ "solana_native_address_lookup_table";
/// Stable Vote Program surface code.
-pub(crate) const VOTE_SURFACE_CODE: &str = "solana_native_vote";
+pub(crate) const DC_SOLANA_CORE_VOTE_SURFACE_CODE: &str = "solana_native_vote";
/// Stable Stake Program surface code.
-pub(crate) const STAKE_SURFACE_CODE: &str = "solana_native_stake";
+pub(crate) const DC_SOLANA_CORE_STAKE_SURFACE_CODE: &str = "solana_native_stake";
/// Stable Config Program surface code.
-pub(crate) const CONFIG_SURFACE_CODE: &str = "solana_native_config";
+pub(crate) const DC_SOLANA_CORE_CONFIG_SURFACE_CODE: &str = "solana_native_config";
/// Stable Feature Gate surface code.
-pub(crate) const FEATURE_SURFACE_CODE: &str = "solana_native_feature";
+pub(crate) const DC_SOLANA_CORE_FEATURE_SURFACE_CODE: &str = "solana_native_feature";
/// Stable Ed25519 signature precompile surface code.
-pub(crate) const ED25519_SURFACE_CODE: &str = "solana_native_ed25519";
+pub(crate) const DC_SOLANA_CORE_ED25519_SURFACE_CODE: &str = "solana_native_ed25519";
/// Stable secp256k1 signature precompile surface code.
-pub(crate) const SECP256K1_SURFACE_CODE: &str = "solana_native_secp256k1";
+pub(crate) const DC_SOLANA_CORE_SECP256K1_SURFACE_CODE: &str = "solana_native_secp256k1";
/// Stable secp256r1 signature precompile surface code.
-pub(crate) const SECP256R1_SURFACE_CODE: &str = "solana_native_secp256r1";
+pub(crate) const DC_SOLANA_CORE_SECP256R1_SURFACE_CODE: &str = "solana_native_secp256r1";
/// Stable native ZK ElGamal Proof surface code.
-pub(crate) const ZK_ELGAMAL_PROOF_SURFACE_CODE: &str = "solana_native_zk_elgamal_proof";
+pub(crate) const DC_SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE: &str =
+ "solana_native_zk_elgamal_proof";
/// Stable historical ZK Token Proof surface code.
-pub(crate) const ZK_TOKEN_PROOF_SURFACE_CODE: &str = "solana_native_zk_token_proof";
+pub(crate) const DC_SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE: &str = "solana_native_zk_token_proof";
/// Byte length shared by compact Ed25519, secp256k1 and secp256r1 signatures.
-pub(crate) const SIGNATURE_BYTES: usize = 64;
+pub(crate) const DC_SOLANA_CORE_SIGNATURE_BYTES: usize = 64;
/// Byte length of an Ed25519 public key.
-pub(crate) const ED25519_PUBLIC_KEY_BYTES: usize = 32;
+pub(crate) const DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES: usize = 32;
/// Byte length of a compressed secp256r1 public key.
-pub(crate) const SECP256R1_PUBLIC_KEY_BYTES: usize = 33;
+pub(crate) const DC_SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES: usize = 33;
/// Byte length of a secp256k1 Ethereum address.
-pub(crate) const SECP256K1_ETHEREUM_ADDRESS_BYTES: usize = 20;
+pub(crate) const DC_SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES: usize = 20;
/// Byte length of one Ed25519 or secp256r1 offsets entry.
-pub(crate) const U16_OFFSETS_BYTES: usize = 14;
+pub(crate) const DC_SOLANA_CORE_U16_OFFSETS_BYTES: usize = 14;
/// Byte length of one secp256k1 offsets entry.
-pub(crate) const U8_OFFSETS_BYTES: usize = 11;
+pub(crate) const DC_SOLANA_CORE_U8_OFFSETS_BYTES: usize = 11;
/// Stable Slashing Program decoder surface code.
-pub(crate) const SLASHING_SURFACE_CODE: &str = "solana_native_slashing";
+pub(crate) const DC_SOLANA_CORE_SLASHING_SURFACE_CODE: &str = "solana_native_slashing";
/// Runtime maximum number of secp256r1 signatures in one precompile instruction.
-pub(crate) const SECP256R1_MAX_SIGNATURES: usize = 8;
+pub(crate) const DC_SOLANA_CORE_SECP256R1_MAX_SIGNATURES: usize = 8;
/// Maximum number of component bytes retained as a hexadecimal event prefix.
-pub(crate) const PRECOMPILE_COMPONENT_PREFIX_BYTES: usize = 16;
+pub(crate) const DC_SOLANA_CORE_PRECOMPILE_COMPONENT_PREFIX_BYTES: usize = 16;
/// Maximum retained native instruction payload accepted by the first decoder phase.
-pub(crate) const MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES: usize = 4_096;
+pub(crate) const DC_SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES: usize = 4_096;
/// Current native event payload contract version.
-pub(crate) const NATIVE_EVENT_VERSION: u32 = 1;
+pub(crate) const DC_SOLANA_CORE_NATIVE_EVENT_VERSION: u32 = 1;
/// Canonical tracing target for the Solana Core decoder component.
-pub(crate) const TRACING_TARGET: &str = "kb-lib.decoder.solana.core";
+pub(crate) const DC_SOLANA_CORE_TRACING_TARGET: &str = "kb-lib.decoder.solana.core";
diff --git a/kb-lib/src/decoder/solana/core/decoder.rs b/kb-lib/src/decoder/solana/core/decoder.rs
index 01ab852..2471630 100644
--- a/kb-lib/src/decoder/solana/core/decoder.rs
+++ b/kb-lib/src/decoder/solana/core/decoder.rs
@@ -3,93 +3,93 @@
//! Runtime-native Solana program classifier for the common decode pipeline.
-const NATIVE_SURFACES: &[crate::DecoderSurface] = &[
- crate::DecoderSurface {
+const NATIVE_SURFACES: &[crate::DcApiDecoderSurface] = &[
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID,
surface_code: "solana_native_address_lookup_table",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID,
surface_code: "solana_native_bpf_loader_deprecated",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::BPF_LOADER_PROGRAM_ID,
surface_code: "solana_native_bpf_loader",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID,
surface_code: "solana_native_bpf_loader_upgradeable",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID,
surface_code: "solana_native_compute_budget",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::CONFIG_PROGRAM_ID,
surface_code: "solana_native_config",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::ED25519_PROGRAM_ID,
surface_code: "solana_native_ed25519",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::FEATURE_PROGRAM_ID,
surface_code: "solana_native_feature",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::LOADER_V4_PROGRAM_ID,
surface_code: "solana_native_loader_v4",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::NATIVE_LOADER_PROGRAM_ID,
surface_code: "solana_native_loader",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::SECP256K1_PROGRAM_ID,
surface_code: "solana_native_secp256k1",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::SECP256R1_PROGRAM_ID,
surface_code: "solana_native_secp256r1",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::SLASHING_PROGRAM_ID,
surface_code: "solana_native_slashing",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::STAKE_PROGRAM_ID,
surface_code: "solana_native_stake",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::SYSTEM_PROGRAM_ID,
surface_code: "solana_native_system",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::VOTE_PROGRAM_ID,
surface_code: "solana_native_vote",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID,
surface_code: "solana_native_zk_elgamal_proof",
priority: 100,
},
- crate::DecoderSurface {
+ crate::DcApiDecoderSurface {
program_id: kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID,
surface_code: "solana_native_zk_token_proof",
priority: 100,
@@ -119,9 +119,9 @@ const LEGACY_PROGRAM_IDS: &[&str] = &[
/// Runtime-native Solana decoder with phased maximal instruction coverage.
#[derive(Clone, Debug, Default)]
-pub struct SolanaCoreDecoder;
+pub struct DcSolanaCoreDecoder;
-impl crate::ProtocolDecoder for crate::SolanaCoreDecoder {
+impl crate::DcApiProtocolDecoder for crate::DcSolanaCoreDecoder {
fn decoder_name(&self) -> &'static str {
return "kb_decoder_solana_core";
}
@@ -136,49 +136,49 @@ impl crate::ProtocolDecoder for crate::SolanaCoreDecoder {
fn supports_observation(
&self,
- observation: &crate::ProgramObservation,
- ) -> crate::DecoderSupport {
- return if crate::ProtocolDecoder::handles_program_id(self, &observation.program_id) {
- crate::DecoderSupport::Maybe
+ observation: &crate::MdProgramObservation,
+ ) -> crate::DcApiDecoderSupport {
+ return if crate::DcApiProtocolDecoder::handles_program_id(self, &observation.program_id) {
+ crate::DcApiDecoderSupport::Maybe
} else {
- crate::DecoderSupport::No
+ crate::DcApiDecoderSupport::No
};
}
fn decode_observation(
&self,
- _observation: &crate::ProgramObservation,
- ) -> kb_core::Result> {
- tracing::debug!(target: crate::SOLANA_CORE_TRACING_TARGET, "legacy native decoder adapter classified an observation without maximal decoding");
+ _observation: &crate::MdProgramObservation,
+ ) -> kb_core::Result> {
+ tracing::debug!(target: crate::DC_SOLANA_CORE_TRACING_TARGET, "legacy native decoder adapter classified an observation without maximal decoding");
return std::result::Result::Ok(std::vec::Vec::new());
}
}
-impl crate::InstructionDecoder for crate::SolanaCoreDecoder {
- fn identity(&self) -> crate::DecoderIdentity {
- return crate::DecoderIdentity {
+impl crate::DcApiInstructionDecoder for crate::DcSolanaCoreDecoder {
+ fn identity(&self) -> crate::DcApiDecoderIdentity {
+ return crate::DcApiDecoderIdentity {
name: "solana_native_classifier".to_string(),
version: env!("CARGO_PKG_VERSION").to_string(),
};
}
- fn surfaces(&self) -> &'static [crate::DecoderSurface] {
+ fn surfaces(&self) -> &'static [crate::DcApiDecoderSurface] {
return NATIVE_SURFACES;
}
- fn coverage(&self) -> std::vec::Vec {
- let mut coverage = crate::solana_core_system_coverage();
- coverage.extend(crate::solana_core_compute_budget_coverage());
- coverage.extend(crate::solana_core_config_coverage());
- coverage.extend(crate::solana_core_feature_coverage());
- coverage.extend(crate::solana_core_vote_coverage());
- coverage.extend(crate::solana_core_stake_coverage());
- coverage.extend(crate::solana_core_address_lookup_table_coverage());
- coverage.extend(crate::solana_core_loaders_coverage());
- coverage.extend(crate::solana_core_precompiles_coverage());
- coverage.extend(crate::solana_core_slashing_coverage());
- coverage.extend(crate::solana_core_zk_elgamal_coverage());
- coverage.extend(crate::solana_core_zk_token_proof_coverage());
+ fn coverage(&self) -> std::vec::Vec {
+ let mut coverage = crate::decoder_solana_core_system_coverage();
+ coverage.extend(crate::decoder_solana_core_compute_budget_coverage());
+ coverage.extend(crate::decoder_solana_core_config_coverage());
+ coverage.extend(crate::decoder_solana_core_feature_coverage());
+ coverage.extend(crate::decoder_solana_core_vote_coverage());
+ coverage.extend(crate::decoder_solana_core_stake_coverage());
+ coverage.extend(crate::decoder_solana_core_address_lookup_table_coverage());
+ coverage.extend(crate::decoder_solana_core_loaders_coverage());
+ coverage.extend(crate::decoder_solana_core_precompiles_coverage());
+ coverage.extend(crate::decoder_solana_core_slashing_coverage());
+ 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
@@ -195,10 +195,10 @@ impl crate::InstructionDecoder for crate::SolanaCoreDecoder {
{
continue;
}
- coverage.push(crate::DecoderCoverageDeclaration {
+ coverage.push(crate::DcApiDecoderCoverageDeclaration {
program_id: surface.program_id.to_string(),
surface_code: std::option::Option::Some(surface.surface_code.to_string()),
- entry_kind: crate::DecoderCoverageEntryKind::Instruction,
+ entry_kind: crate::DcApiDecoderCoverageEntryKind::Instruction,
entry_code: "unclassified_native_instruction".to_string(),
discriminator_hex: std::option::Option::None,
historical: is_historical_native_program(surface.program_id),
@@ -207,91 +207,98 @@ impl crate::InstructionDecoder for crate::SolanaCoreDecoder {
return coverage;
}
- fn recognize(&self, input: &crate::CoreInstructionReplayInput) -> crate::DecoderRecognition {
- tracing::debug!(target: crate::SOLANA_CORE_TRACING_TARGET, action = "recognize", 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, "recognize native Solana contextual instruction");
+ fn recognize(
+ &self,
+ input: &crate::MdCoreInstructionReplayInput,
+ ) -> crate::DcApiDecoderRecognition {
+ tracing::debug!(target: crate::DC_SOLANA_CORE_TRACING_TARGET, action = "recognize", 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, "recognize native Solana contextual instruction");
let surface = NATIVE_SURFACES
.iter()
.find(|surface| return surface.program_id == input.program_id);
let surface = match surface {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- tracing::debug!(target: crate::SOLANA_CORE_TRACING_TARGET, action = "recognize", signature = %input.signature, instruction_path = %input.instruction_path, program_id = %input.program_id, compatible = false, "native Solana decoder does not support program id");
- return crate::DecoderRecognition::incompatible();
+ tracing::debug!(target: crate::DC_SOLANA_CORE_TRACING_TARGET, action = "recognize", signature = %input.signature, instruction_path = %input.instruction_path, program_id = %input.program_id, compatible = false, "native Solana decoder does not support program id");
+ return crate::DcApiDecoderRecognition::incompatible();
},
};
let recognition = if input.program_id == kb_program_ids::SYSTEM_PROGRAM_ID {
- crate::solana_core_system_recognize(input, surface.priority)
+ crate::decoder_solana_core_system_recognize(input, surface.priority)
} else if input.program_id == kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID {
- crate::solana_core_compute_budget_recognize(input, surface.priority)
+ crate::decoder_solana_core_compute_budget_recognize(input, surface.priority)
} else if input.program_id == kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID {
- crate::solana_core_address_lookup_table_recognize(input, surface.priority)
+ crate::decoder_solana_core_address_lookup_table_recognize(input, surface.priority)
} else if input.program_id == kb_program_ids::CONFIG_PROGRAM_ID {
- crate::solana_core_config_recognize(input, surface.priority)
+ crate::decoder_solana_core_config_recognize(input, surface.priority)
} else if input.program_id == kb_program_ids::FEATURE_PROGRAM_ID {
- crate::solana_core_feature_recognize(input, surface.priority)
+ crate::decoder_solana_core_feature_recognize(input, surface.priority)
} else if input.program_id == kb_program_ids::VOTE_PROGRAM_ID {
- crate::solana_core_vote_recognize(input, surface.priority)
+ crate::decoder_solana_core_vote_recognize(input, surface.priority)
} else if input.program_id == kb_program_ids::STAKE_PROGRAM_ID {
- crate::solana_core_stake_recognize(input, surface.priority)
+ crate::decoder_solana_core_stake_recognize(input, surface.priority)
} else if input.program_id == kb_program_ids::SLASHING_PROGRAM_ID {
- crate::solana_core_slashing_recognize(input, surface.priority)
+ crate::decoder_solana_core_slashing_recognize(input, surface.priority)
} else if is_signature_precompile(input.program_id.as_str()) {
- crate::solana_core_precompiles_recognize(input, surface.priority)
+ crate::decoder_solana_core_precompiles_recognize(input, surface.priority)
} else if input.program_id == kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID {
- crate::solana_core_zk_elgamal_recognize(input, surface.priority)
+ crate::decoder_solana_core_zk_elgamal_recognize(input, surface.priority)
} else if input.program_id == kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID {
- crate::solana_core_zk_token_proof_recognize(input, surface.priority)
+ crate::decoder_solana_core_zk_token_proof_recognize(input, surface.priority)
} else if is_loader_program(input.program_id.as_str()) {
- crate::solana_core_loaders_recognize(input, surface.priority)
+ crate::decoder_solana_core_loaders_recognize(input, surface.priority)
} else {
- crate::DecoderRecognition::compatible(
+ crate::DcApiDecoderRecognition::compatible(
false,
surface.priority,
std::option::Option::Some(surface.surface_code.to_string()),
std::option::Option::Some("unclassified_native_instruction".to_string()),
- crate::discriminator_8_hex(input),
+ crate::decoder_api_discriminator_8_hex(input),
)
};
- tracing::debug!(target: crate::SOLANA_CORE_TRACING_TARGET, action = "recognize", signature = %input.signature, instruction_path = %input.instruction_path, program_id = %input.program_id, surface_code = surface.surface_code, recognition = ?recognition, compatible = true, "native Solana decoder recognized contextual instruction");
+ tracing::debug!(target: crate::DC_SOLANA_CORE_TRACING_TARGET, action = "recognize", signature = %input.signature, instruction_path = %input.instruction_path, program_id = %input.program_id, surface_code = surface.surface_code, recognition = ?recognition, compatible = true, "native Solana decoder recognized contextual instruction");
return recognition;
}
- fn decode(&self, input: &crate::CoreInstructionReplayInput) -> crate::DecoderExecutionResult {
+ fn decode(
+ &self,
+ input: &crate::MdCoreInstructionReplayInput,
+ ) -> crate::DcApiDecoderExecutionResult {
let result = if input.program_id == kb_program_ids::SYSTEM_PROGRAM_ID {
- crate::solana_core_system_decode(input)
+ crate::decoder_solana_core_system_decode(input)
} else if input.program_id == kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID {
- crate::solana_core_compute_budget_decode(input)
+ crate::decoder_solana_core_compute_budget_decode(input)
} else if input.program_id == kb_program_ids::ADDRESS_LOOKUP_TABLE_PROGRAM_ID {
- crate::solana_core_address_lookup_table_decode(input)
+ crate::decoder_solana_core_address_lookup_table_decode(input)
} else if input.program_id == kb_program_ids::CONFIG_PROGRAM_ID {
- crate::solana_core_config_decode(input)
+ crate::decoder_solana_core_config_decode(input)
} else if input.program_id == kb_program_ids::FEATURE_PROGRAM_ID {
- crate::solana_core_feature_decode(input)
+ crate::decoder_solana_core_feature_decode(input)
} else if input.program_id == kb_program_ids::VOTE_PROGRAM_ID {
- crate::solana_core_vote_decode(input)
+ crate::decoder_solana_core_vote_decode(input)
} else if input.program_id == kb_program_ids::STAKE_PROGRAM_ID {
- crate::solana_core_stake_decode(input)
+ crate::decoder_solana_core_stake_decode(input)
} else if input.program_id == kb_program_ids::SLASHING_PROGRAM_ID {
- crate::solana_core_slashing_decode(input)
+ crate::decoder_solana_core_slashing_decode(input)
} else if is_signature_precompile(input.program_id.as_str()) {
- crate::solana_core_precompiles_decode(input)
+ crate::decoder_solana_core_precompiles_decode(input)
} else if input.program_id == kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID {
- crate::solana_core_zk_elgamal_decode(input)
+ crate::decoder_solana_core_zk_elgamal_decode(input)
} else if input.program_id == kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID {
- crate::solana_core_zk_token_proof_decode(input)
+ crate::decoder_solana_core_zk_token_proof_decode(input)
} else if is_loader_program(input.program_id.as_str()) {
- crate::solana_core_loaders_decode(input)
+ crate::decoder_solana_core_loaders_decode(input)
} else {
- crate::DecoderExecutionResult::unsupported(std::option::Option::Some(
+ crate::DcApiDecoderExecutionResult::unsupported(std::option::Option::Some(
"unclassified_native_instruction".to_string(),
))
};
if matches!(
result.status,
- crate::DecoderOutcomeStatus::Failed | crate::DecoderOutcomeStatus::Unsupported
+ crate::DcApiDecoderOutcomeStatus::Failed
+ | crate::DcApiDecoderOutcomeStatus::Unsupported
) {
tracing::error!(
- target: crate::SOLANA_CORE_TRACING_TARGET,
+ target: crate::DC_SOLANA_CORE_TRACING_TARGET,
action = "decode_failure",
signature = %input.signature,
slot = input.slot,
@@ -301,7 +308,7 @@ impl crate::InstructionDecoder for crate::SolanaCoreDecoder {
processor_version = env!("CARGO_PKG_VERSION"),
input_key = %input.replay_input_key,
payload_hash = ?input.instruction_payload_hash,
- payload_length = ?crate::solana_core_decoded_payload_length(input),
+ payload_length = ?crate::decoder_solana_core_decoded_payload_length(input),
transaction_failed = input.transaction_failed,
transaction_error = ?input.transaction_err_json,
result_status = ?result.status,
@@ -310,7 +317,7 @@ impl crate::InstructionDecoder for crate::SolanaCoreDecoder {
"native instruction was not decoded successfully"
);
}
- tracing::debug!(target: crate::SOLANA_CORE_TRACING_TARGET, action = "decode", signature = %input.signature, slot = input.slot, instruction_path = %input.instruction_path, program_id = %input.program_id, input_key = %input.replay_input_key, payload_hash = ?input.instruction_payload_hash, transaction_failed = input.transaction_failed, transaction_error = ?input.transaction_err_json, result_status = ?result.status, recognized_entry_code = ?result.recognized_entry_code, observation_count = result.observations.len(), diagnostic_count = result.diagnostics.len(), "native instruction decode completed");
+ tracing::debug!(target: crate::DC_SOLANA_CORE_TRACING_TARGET, action = "decode", signature = %input.signature, slot = input.slot, instruction_path = %input.instruction_path, program_id = %input.program_id, input_key = %input.replay_input_key, payload_hash = ?input.instruction_payload_hash, transaction_failed = input.transaction_failed, transaction_error = ?input.transaction_err_json, result_status = ?result.status, recognized_entry_code = ?result.recognized_entry_code, observation_count = result.observations.len(), diagnostic_count = result.diagnostics.len(), "native instruction decode completed");
return result;
}
}
@@ -337,8 +344,8 @@ fn is_historical_native_program(program_id: &str) -> bool {
#[cfg(test)]
mod tests {
- fn replay_input(program_id: &str) -> crate::CoreInstructionReplayInput {
- let result = crate::CoreInstructionReplayInput::new(
+ fn replay_input(program_id: &str) -> crate::MdCoreInstructionReplayInput {
+ let result = crate::MdCoreInstructionReplayInput::new(
"signature:0",
"signature",
42,
@@ -363,9 +370,9 @@ mod tests {
#[test]
fn vote_program_is_dispatched_without_false_decode_for_unknown_tag() {
- let decoder = crate::SolanaCoreDecoder;
+ let decoder = crate::DcSolanaCoreDecoder;
let input = replay_input(kb_program_ids::VOTE_PROGRAM_ID);
- let recognition = crate::InstructionDecoder::recognize(&decoder, &input);
+ let recognition = crate::DcApiInstructionDecoder::recognize(&decoder, &input);
assert!(recognition.compatible);
assert_eq!(
recognition.surface_code.as_deref(),
@@ -375,16 +382,16 @@ mod tests {
recognition.entry_code.as_deref(),
std::option::Option::Some("unknown_vote_instruction")
);
- let result = crate::InstructionDecoder::decode(&decoder, &input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Unsupported);
+ let result = crate::DcApiInstructionDecoder::decode(&decoder, &input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Unsupported);
assert!(result.observations.is_empty());
}
#[test]
fn stake_program_is_dispatched_without_false_decode_for_unknown_tag() {
- let decoder = crate::SolanaCoreDecoder;
+ let decoder = crate::DcSolanaCoreDecoder;
let input = replay_input(kb_program_ids::STAKE_PROGRAM_ID);
- let recognition = crate::InstructionDecoder::recognize(&decoder, &input);
+ let recognition = crate::DcApiInstructionDecoder::recognize(&decoder, &input);
assert!(recognition.compatible);
assert_eq!(
recognition.surface_code.as_deref(),
@@ -394,16 +401,16 @@ mod tests {
recognition.entry_code.as_deref(),
std::option::Option::Some("unknown_stake_instruction")
);
- let result = crate::InstructionDecoder::decode(&decoder, &input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Unsupported);
+ let result = crate::DcApiInstructionDecoder::decode(&decoder, &input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Unsupported);
assert!(result.observations.is_empty());
}
#[test]
fn zk_token_proof_program_dispatches_to_current_noop_fallback() {
- let decoder = crate::SolanaCoreDecoder;
+ let decoder = crate::DcSolanaCoreDecoder;
let input = replay_input(kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID);
- let recognition = crate::InstructionDecoder::recognize(&decoder, &input);
+ let recognition = crate::DcApiInstructionDecoder::recognize(&decoder, &input);
assert!(recognition.compatible);
assert_eq!(
recognition.surface_code.as_deref(),
@@ -413,8 +420,8 @@ mod tests {
recognition.entry_code.as_deref(),
std::option::Option::Some("current_runtime_noop_invocation")
);
- let result = crate::InstructionDecoder::decode(&decoder, &input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::DcApiInstructionDecoder::decode(&decoder, &input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some("current_runtime_noop_invocation")
@@ -424,8 +431,8 @@ mod tests {
#[test]
fn every_native_registry_program_has_one_surface() {
- let decoder = crate::SolanaCoreDecoder;
- let surfaces = crate::InstructionDecoder::surfaces(&decoder);
+ 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!(surfaces.iter().any(|surface| return surface.program_id == entry.program_id()));
@@ -434,9 +441,9 @@ mod tests {
#[test]
fn every_native_surface_has_declared_coverage_without_fallback_entries() {
- let decoder = crate::SolanaCoreDecoder;
- let surfaces = crate::InstructionDecoder::surfaces(&decoder);
- let coverage = crate::InstructionDecoder::coverage(&decoder);
+ let decoder = crate::DcSolanaCoreDecoder;
+ let surfaces = crate::DcApiInstructionDecoder::surfaces(&decoder);
+ let coverage = crate::DcApiInstructionDecoder::coverage(&decoder);
for surface in surfaces {
assert!(coverage.iter().any(|entry| {
return entry.program_id == surface.program_id
@@ -451,9 +458,9 @@ mod tests {
#[test]
fn coverage_entries_are_unique_and_reference_declared_surfaces() {
- let decoder = crate::SolanaCoreDecoder;
- let surfaces = crate::InstructionDecoder::surfaces(&decoder);
- let coverage = crate::InstructionDecoder::coverage(&decoder);
+ let decoder = crate::DcSolanaCoreDecoder;
+ let surfaces = crate::DcApiInstructionDecoder::surfaces(&decoder);
+ let coverage = crate::DcApiInstructionDecoder::coverage(&decoder);
let mut identities = std::collections::BTreeSet::new();
for entry in coverage {
let surface_code = match entry.surface_code.as_deref() {
@@ -473,9 +480,9 @@ mod tests {
#[test]
fn slashing_program_is_dispatched_to_exact_decoder() {
- let decoder = crate::SolanaCoreDecoder;
+ let decoder = crate::DcSolanaCoreDecoder;
let input = replay_input(kb_program_ids::SLASHING_PROGRAM_ID);
- let recognition = crate::InstructionDecoder::recognize(&decoder, &input);
+ let recognition = crate::DcApiInstructionDecoder::recognize(&decoder, &input);
assert!(recognition.compatible);
assert_eq!(
recognition.surface_code.as_deref(),
@@ -489,13 +496,13 @@ mod tests {
#[test]
fn deprecated_stake_config_account_is_not_an_instruction_surface() {
- let decoder = crate::SolanaCoreDecoder;
- let surfaces = crate::InstructionDecoder::surfaces(&decoder);
+ 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;
}));
let input = replay_input(kb_program_ids::STAKE_CONFIG_ACCOUNT_ID);
- let recognition = crate::InstructionDecoder::recognize(&decoder, &input);
+ let recognition = crate::DcApiInstructionDecoder::recognize(&decoder, &input);
assert!(!recognition.compatible);
}
@@ -517,8 +524,8 @@ mod tests {
parsed.get("surface_count").and_then(serde_json::Value::as_u64);
assert_eq!(declared_surface_count, std::option::Option::Some(18));
- let decoder = crate::SolanaCoreDecoder;
- let compiled_surfaces = crate::InstructionDecoder::surfaces(&decoder);
+ let decoder = crate::DcSolanaCoreDecoder;
+ let compiled_surfaces = crate::DcApiInstructionDecoder::surfaces(&decoder);
let compiled_surface_map = compiled_surfaces
.iter()
.map(|surface| {
@@ -533,7 +540,7 @@ mod tests {
.collect::>();
assert_eq!(native_registry.len(), 18);
- let coverage = crate::InstructionDecoder::coverage(&decoder);
+ let coverage = crate::DcApiInstructionDecoder::coverage(&decoder);
let mut compiled_coverage_counts = std::collections::BTreeMap::new();
for entry in &coverage {
let count = compiled_coverage_counts.entry(entry.program_id.clone()).or_insert(0_usize);
@@ -597,9 +604,9 @@ mod tests {
#[test]
fn unrelated_program_is_not_dispatched() {
- let decoder = crate::SolanaCoreDecoder;
+ let decoder = crate::DcSolanaCoreDecoder;
let input = replay_input(kb_program_ids::SPL_TOKEN_PROGRAM_ID);
- let recognition = crate::InstructionDecoder::recognize(&decoder, &input);
+ let recognition = crate::DcApiInstructionDecoder::recognize(&decoder, &input);
assert!(!recognition.compatible);
}
}
diff --git a/kb-lib/src/decoder/solana/core/event.rs b/kb-lib/src/decoder/solana/core/event.rs
index cb8ae8d..9363fac 100644
--- a/kb-lib/src/decoder/solana/core/event.rs
+++ b/kb-lib/src/decoder/solana/core/event.rs
@@ -4,39 +4,39 @@
//! Stable native event and decoder result builders.
/// Builds one exact decoded native observation.
-pub(crate) fn decoded_result(
- input: &crate::CoreInstructionReplayInput,
+pub(crate) fn decoder_solana_core_decoded_result(
+ input: &crate::MdCoreInstructionReplayInput,
surface_code: &str,
entry_code: &str,
- event_family: crate::EventFamily,
+ event_family: crate::MdEventFamily,
historical: bool,
accounts: serde_json::Value,
parameters: serde_json::Value,
source_evidence: &str,
-) -> crate::DecoderExecutionResult {
- let event = crate::DecodedProtocolEvent {
- signature: crate::Signature(input.signature.clone()),
- slot: crate::Slot(input.slot),
- instruction_path: crate::InstructionPath(input.instruction_path.clone()),
- program_id: crate::ProgramId(input.program_id.clone()),
- protocol_code: crate::ProtocolCode(crate::SOLANA_CORE_PROTOCOL_CODE.to_string()),
- surface_code: crate::SurfaceCode(surface_code.to_string()),
- event_code: crate::EventCode(format!("{surface_code}.{entry_code}")),
- event_name: crate::EventName(entry_code.to_string()),
+) -> crate::DcApiDecoderExecutionResult {
+ let event = crate::MdDecodedProtocolEvent {
+ signature: crate::MdSignature(input.signature.clone()),
+ slot: crate::MdSlot(input.slot),
+ instruction_path: crate::MdInstructionPath(input.instruction_path.clone()),
+ program_id: crate::MdProgramId(input.program_id.clone()),
+ protocol_code: crate::MdProtocolCode(crate::DC_SOLANA_CORE_PROTOCOL_CODE.to_string()),
+ surface_code: crate::MdSurfaceCode(surface_code.to_string()),
+ event_code: crate::MdEventCode(format!("{surface_code}.{entry_code}")),
+ event_name: crate::MdEventName(entry_code.to_string()),
event_family,
source_kind: if input.instruction_path.contains('/') {
- crate::EventSourceKind::InnerInstruction
+ crate::MdEventSourceKind::InnerInstruction
} else {
- crate::EventSourceKind::Instruction
+ crate::MdEventSourceKind::Instruction
},
- confidence: crate::DecoderConfidence::ManualExact,
+ confidence: crate::MdDecoderConfidence::ManualExact,
};
- let payload_hash = crate::solana_core_payload_hash(input);
- let observation = crate::DecodedObservation {
+ let payload_hash = crate::decoder_solana_core_payload_hash(input);
+ let observation = crate::DcApiDecodedObservation {
event_key: format!("{entry_code}:0"),
event,
payload_json: serde_json::json!({
- "eventVersion": crate::SOLANA_CORE_NATIVE_EVENT_VERSION,
+ "eventVersion": crate::DC_SOLANA_CORE_NATIVE_EVENT_VERSION,
"programId": input.program_id,
"surfaceCode": surface_code,
"entryCode": entry_code,
@@ -50,14 +50,14 @@ pub(crate) fn decoded_result(
transaction_failed: input.transaction_failed,
transaction_error: input.transaction_err_json.clone(),
observation_committed: !input.transaction_failed,
- proof: crate::DecoderProof {
- kind: crate::DecoderProofKind::Manual,
- confidence: crate::DecoderConfidence::ManualExact,
+ proof: crate::DcApiDecoderProof {
+ kind: crate::DcApiDecoderProofKind::Manual,
+ confidence: crate::MdDecoderConfidence::ManualExact,
evidence: vec![source_evidence.to_string(), format!("payload_sha256:{payload_hash}")],
},
};
- return crate::DecoderExecutionResult {
- status: crate::DecoderOutcomeStatus::Decoded,
+ return crate::DcApiDecoderExecutionResult {
+ status: crate::DcApiDecoderOutcomeStatus::Decoded,
recognized_entry_code: std::option::Option::Some(entry_code.to_string()),
observations: vec![observation],
diagnostics: std::vec::Vec::new(),
@@ -65,16 +65,16 @@ pub(crate) fn decoded_result(
}
/// Builds one failed native decode result.
-pub(crate) fn failed_result(
+pub(crate) fn decoder_solana_core_failed_result(
entry_code: std::option::Option<&str>,
code: &str,
message: impl std::convert::Into,
-) -> crate::DecoderExecutionResult {
- return crate::DecoderExecutionResult {
- status: crate::DecoderOutcomeStatus::Failed,
+) -> crate::DcApiDecoderExecutionResult {
+ return crate::DcApiDecoderExecutionResult {
+ status: crate::DcApiDecoderOutcomeStatus::Failed,
recognized_entry_code: entry_code.map(str::to_string),
observations: std::vec::Vec::new(),
- diagnostics: vec![crate::DecoderDiagnostic {
+ diagnostics: vec![crate::DcApiDecoderDiagnostic {
code: code.to_string(),
message: message.into(),
retriable: false,
@@ -83,16 +83,16 @@ pub(crate) fn failed_result(
}
/// Builds one unsupported native decode result with a bounded diagnostic.
-pub(crate) fn unsupported_result(
+pub(crate) fn decoder_solana_core_unsupported_result(
entry_code: &str,
code: &str,
message: impl std::convert::Into,
-) -> crate::DecoderExecutionResult {
- return crate::DecoderExecutionResult {
- status: crate::DecoderOutcomeStatus::Unsupported,
+) -> crate::DcApiDecoderExecutionResult {
+ return crate::DcApiDecoderExecutionResult {
+ status: crate::DcApiDecoderOutcomeStatus::Unsupported,
recognized_entry_code: std::option::Option::Some(entry_code.to_string()),
observations: std::vec::Vec::new(),
- diagnostics: vec![crate::DecoderDiagnostic {
+ diagnostics: vec![crate::DcApiDecoderDiagnostic {
code: code.to_string(),
message: message.into(),
retriable: false,
diff --git a/kb-lib/src/decoder/solana/core/feature.rs b/kb-lib/src/decoder/solana/core/feature.rs
index 2657a34..d0bde64 100644
--- a/kb-lib/src/decoder/solana/core/feature.rs
+++ b/kb-lib/src/decoder/solana/core/feature.rs
@@ -4,20 +4,21 @@
//! Exact Feature Gate instruction decoding from the official interface contract.
const SOURCE: &str = "solana-feature-gate-interface@4.0.0 revoke_pending_activation contract";
-const REVOKE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("feature_account", true, true),
- crate::SolanaCoreAccountRole::new("incinerator", true, false),
- crate::SolanaCoreAccountRole::new("system_program", false, false),
+const REVOKE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("feature_account", true, true),
+ crate::DcSolanaCoreAccountRole::new("incinerator", true, false),
+ crate::DcSolanaCoreAccountRole::new("system_program", false, false),
];
/// Returns declared Feature Gate instruction coverage.
-pub(crate) fn feature_coverage() -> std::vec::Vec {
- return vec![crate::DecoderCoverageDeclaration {
+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(),
surface_code: std::option::Option::Some(
- crate::SOLANA_CORE_FEATURE_SURFACE_CODE.to_string(),
+ crate::DC_SOLANA_CORE_FEATURE_SURFACE_CODE.to_string(),
),
- entry_kind: crate::DecoderCoverageEntryKind::Instruction,
+ entry_kind: crate::DcApiDecoderCoverageEntryKind::Instruction,
entry_code: "revoke_pending_activation".to_string(),
discriminator_hex: std::option::Option::Some("00".to_string()),
historical: false,
@@ -25,18 +26,18 @@ pub(crate) fn feature_coverage() -> std::vec::Vec crate::DecoderRecognition {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+) -> crate::DcApiDecoderRecognition {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
- std::option::Option::Some(crate::SOLANA_CORE_FEATURE_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_FEATURE_SURFACE_CODE.to_string()),
std::option::Option::Some("malformed_feature_instruction".to_string()),
std::option::Option::None,
);
@@ -47,24 +48,24 @@ pub(crate) fn feature_recognize(
std::option::Option::Some(_value) => "unknown_feature_instruction",
std::option::Option::None => "malformed_feature_instruction",
};
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
bytes.as_slice() == [0],
priority,
- std::option::Option::Some(crate::SOLANA_CORE_FEATURE_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_FEATURE_SURFACE_CODE.to_string()),
std::option::Option::Some(entry_code.to_string()),
- crate::solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(1)),
+ crate::decoder_solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(1)),
);
}
/// Decodes one Feature Gate instruction.
-pub(crate) fn feature_decode(
- input: &crate::CoreInstructionReplayInput,
-) -> crate::DecoderExecutionResult {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+pub(crate) fn decoder_solana_core_feature_decode(
+ input: &crate::MdCoreInstructionReplayInput,
+) -> crate::DcApiDecoderExecutionResult {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_feature_instruction"),
"feature_payload_invalid",
error.to_string(),
@@ -72,25 +73,25 @@ pub(crate) fn feature_decode(
},
};
if bytes.is_empty() {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_feature_instruction"),
"feature_payload_empty",
"Feature Gate instruction payload is empty",
);
}
if bytes[0] != 0 {
- return crate::solana_core_unsupported_result(
+ return crate::decoder_solana_core_unsupported_result(
"unknown_feature_instruction",
"feature_tag_unknown",
format!(
"unknown Feature Gate instruction tag {}; payload_sha256={}",
bytes[0],
- crate::solana_core_payload_hash(input)
+ crate::decoder_solana_core_payload_hash(input)
),
);
}
if bytes.len() != 1 {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("revoke_pending_activation"),
"feature_instruction_size_invalid",
format!(
@@ -99,12 +100,16 @@ pub(crate) fn feature_decode(
),
);
}
- let accounts_result =
- crate::solana_core_resolve_accounts(input, REVOKE_ROLES, 3, std::option::Option::Some(3));
+ let accounts_result = crate::decoder_solana_core_resolve_accounts(
+ input,
+ REVOKE_ROLES,
+ 3,
+ std::option::Option::Some(3),
+ );
let accounts = match accounts_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("revoke_pending_activation"),
"feature_accounts_invalid",
error.to_string(),
@@ -113,17 +118,17 @@ pub(crate) fn feature_decode(
};
let fixed_accounts_result = validate_fixed_accounts(&accounts);
if let std::result::Result::Err(error) = fixed_accounts_result {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("revoke_pending_activation"),
"feature_fixed_account_invalid",
error.to_string(),
);
}
- return crate::solana_core_decoded_result(
+ return crate::decoder_solana_core_decoded_result(
input,
- crate::SOLANA_CORE_FEATURE_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_FEATURE_SURFACE_CODE,
"revoke_pending_activation",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
false,
accounts,
serde_json::json!({
@@ -164,7 +169,7 @@ fn validate_fixed_accounts(accounts: &serde_json::Value) -> kb_core::Result<()>
mod tests {
use base64::Engine; // rust-rules: trait-import
- fn replay_input(bytes: &[u8], transaction_failed: bool) -> crate::CoreInstructionReplayInput {
+ fn replay_input(bytes: &[u8], transaction_failed: bool) -> crate::MdCoreInstructionReplayInput {
let keys = [
"FeatureAccount11111111111111111111111111111",
kb_program_ids::INCINERATOR_PROGRAM_ID,
@@ -191,7 +196,7 @@ mod tests {
return serde_json::json!({"accountIndex": index, "accountKey": key});
})
.collect::>();
- let result = crate::CoreInstructionReplayInput::new(
+ let result = crate::MdCoreInstructionReplayInput::new(
"signature:0",
"signature",
42,
@@ -223,22 +228,22 @@ mod tests {
#[test]
fn official_payload_is_recognized_exactly() {
let input = replay_input(&[0], false);
- let recognition = crate::solana_core_feature_recognize(&input, 100);
+ let recognition = crate::decoder_solana_core_feature_recognize(&input, 100);
assert!(recognition.compatible);
assert!(recognition.exact);
assert_eq!(
recognition.entry_code.as_deref(),
std::option::Option::Some("revoke_pending_activation")
);
- let unknown = crate::solana_core_feature_recognize(&replay_input(&[7], false), 100);
+ let unknown = crate::decoder_solana_core_feature_recognize(&replay_input(&[7], false), 100);
assert!(unknown.compatible);
assert!(!unknown.exact);
}
#[test]
fn revoke_pending_activation_decodes_exact_official_layout() {
- let result = crate::solana_core_feature_decode(&replay_input(&[0], false));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_feature_decode(&replay_input(&[0], false));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some("revoke_pending_activation")
@@ -248,29 +253,29 @@ mod tests {
#[test]
fn unknown_truncated_trailing_and_wrong_fixed_accounts_are_safe() {
- let empty = crate::solana_core_feature_decode(&replay_input(&[], false));
- assert_eq!(empty.status, crate::DecoderOutcomeStatus::Failed);
- let unknown = crate::solana_core_feature_decode(&replay_input(&[7], false));
- assert_eq!(unknown.status, crate::DecoderOutcomeStatus::Unsupported);
- let trailing = crate::solana_core_feature_decode(&replay_input(&[0, 1], false));
- assert_eq!(trailing.status, crate::DecoderOutcomeStatus::Failed);
+ let empty = crate::decoder_solana_core_feature_decode(&replay_input(&[], false));
+ assert_eq!(empty.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let unknown = crate::decoder_solana_core_feature_decode(&replay_input(&[7], false));
+ assert_eq!(unknown.status, crate::DcApiDecoderOutcomeStatus::Unsupported);
+ let trailing = crate::decoder_solana_core_feature_decode(&replay_input(&[0, 1], false));
+ assert_eq!(trailing.status, crate::DcApiDecoderOutcomeStatus::Failed);
let mut wrong = replay_input(&[0], false);
wrong.instruction_accounts_json[1]["accountKey"] = serde_json::json!("wrong");
wrong.account_keys_json[1]["accountKey"] = serde_json::json!("wrong");
- let invalid = crate::solana_core_feature_decode(&wrong);
- assert_eq!(invalid.status, crate::DecoderOutcomeStatus::Failed);
+ let invalid = crate::decoder_solana_core_feature_decode(&wrong);
+ assert_eq!(invalid.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn failed_feature_revoke_is_uncommitted() {
- let result = crate::solana_core_feature_decode(&replay_input(&[0], true));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_feature_decode(&replay_input(&[0], true));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!result.observations[0].observation_committed);
}
#[test]
fn coverage_declares_the_single_official_instruction() {
- let coverage = crate::solana_core_feature_coverage();
+ let coverage = crate::decoder_solana_core_feature_coverage();
assert_eq!(coverage.len(), 1);
assert_eq!(coverage[0].entry_code, "revoke_pending_activation");
assert_eq!(coverage[0].discriminator_hex.as_deref(), std::option::Option::Some("00"));
diff --git a/kb-lib/src/decoder/solana/core/loaders.rs b/kb-lib/src/decoder/solana/core/loaders.rs
index deb9121..86c25b7 100644
--- a/kb-lib/src/decoder/solana/core/loaders.rs
+++ b/kb-lib/src/decoder/solana/core/loaders.rs
@@ -8,101 +8,102 @@ const SOURCE_BPF_LOADER_V3: &str = "solana-loader-v3-interface@8.0.1";
const SOURCE_LOADER_V4: &str = "solana-loader-v4-interface@3.1.0";
const SOURCE_NATIVE_LOADER: &str = "Agave native_loader runtime dispatch";
-const IMMUTABLE_WRITE_ROLES: &[crate::SolanaCoreAccountRole] =
- &[crate::SolanaCoreAccountRole::new("program_account", true, true)];
-const IMMUTABLE_FINALIZE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("program_account", true, true),
- crate::SolanaCoreAccountRole::new("rent_sysvar", false, false),
+const IMMUTABLE_WRITE_ROLES: &[crate::DcSolanaCoreAccountRole] =
+ &[crate::DcSolanaCoreAccountRole::new("program_account", true, true)];
+const IMMUTABLE_FINALIZE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("program_account", true, true),
+ crate::DcSolanaCoreAccountRole::new("rent_sysvar", false, false),
];
-const UPGRADEABLE_INITIALIZE_BUFFER_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("buffer_account", true, false),
- crate::SolanaCoreAccountRole::new("buffer_authority", false, false),
+const UPGRADEABLE_INITIALIZE_BUFFER_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("buffer_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("buffer_authority", false, false),
];
-const UPGRADEABLE_WRITE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("buffer_account", true, false),
- crate::SolanaCoreAccountRole::new("buffer_authority", false, true),
+const UPGRADEABLE_WRITE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("buffer_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("buffer_authority", false, true),
];
-const UPGRADEABLE_DEPLOY_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("payer", true, true),
- crate::SolanaCoreAccountRole::new("programdata_account", true, false),
- crate::SolanaCoreAccountRole::new("program_account", true, false),
- crate::SolanaCoreAccountRole::new("buffer_account", true, false),
- crate::SolanaCoreAccountRole::new("rent_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("clock_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("system_program", false, false),
- crate::SolanaCoreAccountRole::new("upgrade_authority", false, true),
+const UPGRADEABLE_DEPLOY_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("payer", true, true),
+ crate::DcSolanaCoreAccountRole::new("programdata_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("program_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("buffer_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("rent_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("clock_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("system_program", false, false),
+ crate::DcSolanaCoreAccountRole::new("upgrade_authority", false, true),
];
-const UPGRADEABLE_UPGRADE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("programdata_account", true, false),
- crate::SolanaCoreAccountRole::new("program_account", true, false),
- crate::SolanaCoreAccountRole::new("buffer_account", true, false),
- crate::SolanaCoreAccountRole::new("spill_account", true, false),
- crate::SolanaCoreAccountRole::new("rent_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("clock_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("upgrade_authority", false, true),
+const UPGRADEABLE_UPGRADE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("programdata_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("program_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("buffer_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("spill_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("rent_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("clock_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("upgrade_authority", false, true),
];
-const UPGRADEABLE_SET_AUTHORITY_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("authority_target", true, false),
- crate::SolanaCoreAccountRole::new("current_authority", false, true),
- crate::SolanaCoreAccountRole::new("new_authority", false, false),
+const UPGRADEABLE_SET_AUTHORITY_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("authority_target", true, false),
+ crate::DcSolanaCoreAccountRole::new("current_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("new_authority", false, false),
];
-const UPGRADEABLE_CLOSE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("close_target", true, false),
- crate::SolanaCoreAccountRole::new("recipient", true, false),
- crate::SolanaCoreAccountRole::new("authority", false, true),
- crate::SolanaCoreAccountRole::new("associated_program", true, false),
+const UPGRADEABLE_CLOSE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("close_target", true, false),
+ crate::DcSolanaCoreAccountRole::new("recipient", true, false),
+ crate::DcSolanaCoreAccountRole::new("authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("associated_program", true, false),
];
-const UPGRADEABLE_EXTEND_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("programdata_account", true, false),
- crate::SolanaCoreAccountRole::new("program_account", true, false),
- crate::SolanaCoreAccountRole::new("system_program", false, false),
- crate::SolanaCoreAccountRole::new("payer", true, true),
+const UPGRADEABLE_EXTEND_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("programdata_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("program_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("system_program", false, false),
+ crate::DcSolanaCoreAccountRole::new("payer", true, true),
];
-const UPGRADEABLE_SET_AUTHORITY_CHECKED_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("authority_target", true, false),
- crate::SolanaCoreAccountRole::new("current_authority", false, true),
- crate::SolanaCoreAccountRole::new("new_authority", false, true),
+const UPGRADEABLE_SET_AUTHORITY_CHECKED_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("authority_target", true, false),
+ crate::DcSolanaCoreAccountRole::new("current_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("new_authority", false, true),
];
-const LOADER_V4_WRITE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("program_account", true, false),
- crate::SolanaCoreAccountRole::new("authority", false, true),
+const LOADER_V4_WRITE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("program_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("authority", false, true),
];
-const LOADER_V4_COPY_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("program_account", true, false),
- crate::SolanaCoreAccountRole::new("authority", false, true),
- crate::SolanaCoreAccountRole::new("source_program_account", false, false),
+const LOADER_V4_COPY_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("program_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("source_program_account", false, false),
];
-const LOADER_V4_SET_LENGTH_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("program_account", true, false),
- crate::SolanaCoreAccountRole::new("authority", false, true),
- crate::SolanaCoreAccountRole::new("recipient", true, false),
+const LOADER_V4_SET_LENGTH_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("program_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("recipient", true, false),
];
-const LOADER_V4_DEPLOY_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("program_account", true, false),
- crate::SolanaCoreAccountRole::new("authority", false, true),
- crate::SolanaCoreAccountRole::new("source_program_account", true, false),
+const LOADER_V4_DEPLOY_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("program_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("source_program_account", true, false),
];
-const LOADER_V4_AUTHORITY_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("program_account", true, false),
- crate::SolanaCoreAccountRole::new("authority", false, true),
+const LOADER_V4_AUTHORITY_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("program_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("authority", false, true),
];
-const LOADER_V4_TRANSFER_AUTHORITY_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("program_account", true, false),
- crate::SolanaCoreAccountRole::new("current_authority", false, true),
- crate::SolanaCoreAccountRole::new("new_authority", false, true),
+const LOADER_V4_TRANSFER_AUTHORITY_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("program_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("current_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("new_authority", false, true),
];
-const LOADER_V4_FINALIZE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("program_account", true, false),
- crate::SolanaCoreAccountRole::new("authority", false, true),
- crate::SolanaCoreAccountRole::new("next_version_program", false, false),
+const LOADER_V4_FINALIZE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("program_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("next_version_program", false, false),
];
/// Returns declared loader instruction coverage.
-pub(crate) fn loaders_coverage() -> std::vec::Vec {
+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,
- crate::SOLANA_CORE_NATIVE_LOADER_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_NATIVE_LOADER_SURFACE_CODE,
"direct_invocation_opaque",
std::option::Option::None,
true,
@@ -110,12 +111,12 @@ pub(crate) fn loaders_coverage() -> std::vec::Vec std::vec::Vec std::vec::Vec std::vec::Vec crate::DecoderRecognition {
+) -> crate::DcApiDecoderRecognition {
let surface_code = match surface_code(input.program_id.as_str()) {
std::option::Option::Some(value) => value,
- std::option::Option::None => return crate::DecoderRecognition::incompatible(),
+ std::option::Option::None => return crate::DcApiDecoderRecognition::incompatible(),
};
if input.program_id == kb_program_ids::NATIVE_LOADER_PROGRAM_ID {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
true,
priority,
std::option::Option::Some(surface_code.to_string()),
@@ -190,11 +191,11 @@ pub(crate) fn loaders_recognize(
std::option::Option::None,
);
}
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
std::option::Option::Some(surface_code.to_string()),
@@ -204,32 +205,32 @@ pub(crate) fn loaders_recognize(
},
};
let entry_code = entry_code(input.program_id.as_str(), bytes.as_slice());
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
entry_code.is_some(),
priority,
std::option::Option::Some(surface_code.to_string()),
entry_code.map(str::to_string).or_else(|| {
return std::option::Option::Some("unknown_loader_instruction".to_string());
}),
- crate::solana_core_hexadecimal_prefix(bytes.as_slice(), 4),
+ crate::decoder_solana_core_hexadecimal_prefix(bytes.as_slice(), 4),
);
}
/// Decodes one loader instruction.
-pub(crate) fn loaders_decode(
- input: &crate::CoreInstructionReplayInput,
-) -> crate::DecoderExecutionResult {
+pub(crate) fn decoder_solana_core_loaders_decode(
+ input: &crate::MdCoreInstructionReplayInput,
+) -> crate::DcApiDecoderExecutionResult {
if input.program_id == kb_program_ids::NATIVE_LOADER_PROGRAM_ID {
- tracing::debug!(target: crate::SOLANA_CORE_TRACING_TARGET, 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::DecoderExecutionResult::ignored(std::option::Option::Some(
+ tracing::debug!(target: crate::DC_SOLANA_CORE_TRACING_TARGET, 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(),
));
}
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_loader_instruction"),
"loader_payload_invalid",
error.to_string(),
@@ -247,7 +248,7 @@ pub(crate) fn loaders_decode(
if input.program_id == kb_program_ids::LOADER_V4_PROGRAM_ID {
return decode_v4(input, bytes.as_slice());
}
- return crate::solana_core_unsupported_result(
+ return crate::decoder_solana_core_unsupported_result(
"unknown_loader_instruction",
"loader_program_unknown",
format!("unsupported loader program id {}", input.program_id),
@@ -255,17 +256,17 @@ pub(crate) fn loaders_decode(
}
fn decode_immutable(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
let tag = match read_tag(bytes, "immutable_loader_tag_truncated") {
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 {
- crate::SOLANA_CORE_BPF_LOADER_DEPRECATED_SURFACE_CODE
+ crate::DC_SOLANA_CORE_BPF_LOADER_DEPRECATED_SURFACE_CODE
} else {
- crate::SOLANA_CORE_BPF_LOADER_SURFACE_CODE
+ crate::DC_SOLANA_CORE_BPF_LOADER_SURFACE_CODE
};
return match tag {
0 => decode_immutable_write(input, bytes, surface_code),
@@ -277,7 +278,7 @@ fn decode_immutable(
input,
surface_code,
"finalize",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
true,
IMMUTABLE_FINALIZE_ROLES,
2,
@@ -290,12 +291,12 @@ fn decode_immutable(
}
fn decode_immutable_write(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
surface_code: &str,
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
if bytes.len() < 12 {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("write"),
"loader_write_truncated",
format!(
@@ -304,10 +305,10 @@ fn decode_immutable_write(
),
);
}
- let offset = match crate::solana_core_read_u32_le(bytes, 4) {
+ let offset = match crate::decoder_solana_core_read_u32_le(bytes, 4) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("write"),
"loader_write_offset_truncated",
error.to_string(),
@@ -326,15 +327,15 @@ fn decode_immutable_write(
input,
surface_code,
"write",
- crate::EventFamily::Audit,
+ crate::MdEventFamily::Audit,
true,
IMMUTABLE_WRITE_ROLES,
1,
serde_json::json!({
"offset": offset,
"byteLength": byte_length,
- "bytesSha256": crate::solana_core_hash_bytes(written_bytes),
- "bytesPrefixHex": crate::solana_core_hexadecimal_prefix(
+ "bytesSha256": crate::decoder_solana_core_hash_bytes(written_bytes),
+ "bytesPrefixHex": crate::decoder_solana_core_hexadecimal_prefix(
written_bytes,
written_bytes.len().min(16),
),
@@ -344,9 +345,9 @@ fn decode_immutable_write(
}
fn decode_upgradeable(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
let tag = match read_tag(bytes, "upgradeable_loader_tag_truncated") {
std::result::Result::Ok(value) => value,
std::result::Result::Err(result) => return result,
@@ -370,7 +371,7 @@ fn decode_upgradeable(
{
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"upgradeable_loader_wincode_invalid",
format!("cannot decode exact Loader v3 {entry_code}: {error}"),
@@ -381,9 +382,9 @@ fn decode_upgradeable(
solana_loader_v3_interface::instruction::UpgradeableLoaderInstruction::InitializeBuffer => {
build(
input,
- crate::SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE,
"initialize_buffer",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
false,
UPGRADEABLE_INITIALIZE_BUFFER_ROLES,
1,
@@ -396,17 +397,17 @@ fn decode_upgradeable(
bytes: written_bytes,
} => build(
input,
- crate::SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE,
"write",
- crate::EventFamily::Audit,
+ crate::MdEventFamily::Audit,
false,
UPGRADEABLE_WRITE_ROLES,
2,
serde_json::json!({
"offset": offset,
"byteLength": written_bytes.len(),
- "bytesSha256": crate::solana_core_hash_bytes(written_bytes.as_slice()),
- "bytesPrefixHex": crate::solana_core_hexadecimal_prefix(
+ "bytesSha256": crate::decoder_solana_core_hash_bytes(written_bytes.as_slice()),
+ "bytesPrefixHex": crate::decoder_solana_core_hexadecimal_prefix(
written_bytes.as_slice(),
written_bytes.len().min(16),
),
@@ -418,9 +419,9 @@ fn decode_upgradeable(
close_buffer,
} => build(
input,
- crate::SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE,
"deploy_with_max_data_len",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
bytes.len() == 12,
UPGRADEABLE_DEPLOY_ROLES,
8,
@@ -435,9 +436,9 @@ fn decode_upgradeable(
close_buffer,
} => build(
input,
- crate::SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE,
"upgrade",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
bytes.len() == 4,
UPGRADEABLE_UPGRADE_ROLES,
7,
@@ -450,9 +451,9 @@ fn decode_upgradeable(
solana_loader_v3_interface::instruction::UpgradeableLoaderInstruction::SetAuthority => {
build(
input,
- crate::SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE,
"set_authority",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
false,
UPGRADEABLE_SET_AUTHORITY_ROLES,
2,
@@ -464,9 +465,9 @@ fn decode_upgradeable(
tombstone,
} => build(
input,
- crate::SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE,
"close",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
bytes.len() == 4,
UPGRADEABLE_CLOSE_ROLES,
2,
@@ -481,7 +482,7 @@ fn decode_upgradeable(
} => {
let account_count = account_count(input);
if account_count == 3 {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("extend_program"),
"upgradeable_loader_extend_accounts_invalid",
"extend_program requires either two accounts or the complete optional system/payer pair",
@@ -489,9 +490,9 @@ fn decode_upgradeable(
}
build(
input,
- crate::SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE,
"extend_program",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
false,
UPGRADEABLE_EXTEND_ROLES,
2,
@@ -505,9 +506,9 @@ fn decode_upgradeable(
solana_loader_v3_interface::instruction::UpgradeableLoaderInstruction::SetAuthorityChecked => {
build(
input,
- crate::SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE,
"set_authority_checked",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
false,
UPGRADEABLE_SET_AUTHORITY_CHECKED_ROLES,
3,
@@ -519,9 +520,9 @@ fn decode_upgradeable(
}
fn decode_v4(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
let tag = match read_tag(bytes, "loader_v4_tag_truncated") {
std::result::Result::Ok(value) => value,
std::result::Result::Err(result) => return result,
@@ -530,7 +531,7 @@ fn decode_v4(
0 => decode_write(
input,
bytes,
- crate::SOLANA_CORE_LOADER_V4_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_LOADER_V4_SURFACE_CODE,
false,
LOADER_V4_WRITE_ROLES,
2,
@@ -541,9 +542,9 @@ fn decode_v4(
3 => decode_unit(
input,
bytes,
- crate::SOLANA_CORE_LOADER_V4_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_LOADER_V4_SURFACE_CODE,
"deploy",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
LOADER_V4_DEPLOY_ROLES,
2,
SOURCE_LOADER_V4,
@@ -551,9 +552,9 @@ fn decode_v4(
4 => decode_unit(
input,
bytes,
- crate::SOLANA_CORE_LOADER_V4_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_LOADER_V4_SURFACE_CODE,
"retract",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
LOADER_V4_AUTHORITY_ROLES,
2,
SOURCE_LOADER_V4,
@@ -561,9 +562,9 @@ fn decode_v4(
5 => decode_unit(
input,
bytes,
- crate::SOLANA_CORE_LOADER_V4_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_LOADER_V4_SURFACE_CODE,
"transfer_authority",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
LOADER_V4_TRANSFER_AUTHORITY_ROLES,
3,
SOURCE_LOADER_V4,
@@ -571,9 +572,9 @@ fn decode_v4(
6 => decode_unit(
input,
bytes,
- crate::SOLANA_CORE_LOADER_V4_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_LOADER_V4_SURFACE_CODE,
"finalize",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
LOADER_V4_FINALIZE_ROLES,
3,
SOURCE_LOADER_V4,
@@ -583,25 +584,25 @@ fn decode_v4(
}
fn decode_write(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
surface_code: &str,
historical: bool,
- roles: &[crate::SolanaCoreAccountRole],
+ roles: &[crate::DcSolanaCoreAccountRole],
minimum_count: usize,
source: &str,
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
if bytes.len() < 16 {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("write"),
"loader_write_truncated",
format!("loader write requires at least 16 bytes but received {}", bytes.len()),
);
}
- let offset = match crate::solana_core_read_u32_le(bytes, 4) {
+ let offset = match crate::decoder_solana_core_read_u32_le(bytes, 4) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("write"),
"loader_write_offset_truncated",
error.to_string(),
@@ -620,15 +621,15 @@ fn decode_write(
input,
surface_code,
"write",
- crate::EventFamily::Audit,
+ crate::MdEventFamily::Audit,
historical,
roles,
minimum_count,
serde_json::json!({
"offset": offset,
"byteLength": byte_length,
- "bytesSha256": crate::solana_core_hash_bytes(written_bytes),
- "bytesPrefixHex": crate::solana_core_hexadecimal_prefix(
+ "bytesSha256": crate::decoder_solana_core_hash_bytes(written_bytes),
+ "bytesPrefixHex": crate::decoder_solana_core_hexadecimal_prefix(
written_bytes,
written_bytes.len().min(16),
),
@@ -638,36 +639,36 @@ fn decode_write(
}
fn decode_copy(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
if bytes.len() != 16 {
return size_failure("copy", 16, bytes.len());
}
- let destination_offset = match crate::solana_core_read_u32_le(bytes, 4) {
+ let destination_offset = match crate::decoder_solana_core_read_u32_le(bytes, 4) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("copy"),
"loader_v4_copy_truncated",
error.to_string(),
);
},
};
- let source_offset = match crate::solana_core_read_u32_le(bytes, 8) {
+ let source_offset = match crate::decoder_solana_core_read_u32_le(bytes, 8) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("copy"),
"loader_v4_copy_truncated",
error.to_string(),
);
},
};
- let length = match crate::solana_core_read_u32_le(bytes, 12) {
+ let length = match crate::decoder_solana_core_read_u32_le(bytes, 12) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("copy"),
"loader_v4_copy_truncated",
error.to_string(),
@@ -676,9 +677,9 @@ fn decode_copy(
};
return build(
input,
- crate::SOLANA_CORE_LOADER_V4_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_LOADER_V4_SURFACE_CODE,
"copy",
- crate::EventFamily::Audit,
+ crate::MdEventFamily::Audit,
false,
LOADER_V4_COPY_ROLES,
3,
@@ -692,16 +693,16 @@ fn decode_copy(
}
fn decode_set_program_length(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
if bytes.len() != 8 {
return size_failure("set_program_length", 8, bytes.len());
}
- let new_size = match crate::solana_core_read_u32_le(bytes, 4) {
+ let new_size = match crate::decoder_solana_core_read_u32_le(bytes, 4) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("set_program_length"),
"loader_v4_set_length_truncated",
error.to_string(),
@@ -710,9 +711,9 @@ fn decode_set_program_length(
};
return build(
input,
- crate::SOLANA_CORE_LOADER_V4_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_LOADER_V4_SURFACE_CODE,
"set_program_length",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
false,
LOADER_V4_SET_LENGTH_ROLES,
2,
@@ -725,15 +726,15 @@ fn decode_set_program_length(
}
fn decode_unit(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
surface_code: &str,
entry_code: &str,
- family: crate::EventFamily,
- roles: &[crate::SolanaCoreAccountRole],
+ family: crate::MdEventFamily,
+ roles: &[crate::DcSolanaCoreAccountRole],
minimum_count: usize,
source: &str,
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
if bytes.len() != 4 {
return size_failure(entry_code, 4, bytes.len());
}
@@ -751,29 +752,33 @@ fn decode_unit(
}
fn build(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
surface_code: &str,
entry_code: &str,
- family: crate::EventFamily,
+ family: crate::MdEventFamily,
historical: bool,
- roles: &[crate::SolanaCoreAccountRole],
+ roles: &[crate::DcSolanaCoreAccountRole],
minimum_count: usize,
parameters: serde_json::Value,
source: &str,
-) -> crate::DecoderExecutionResult {
- let accounts_result =
- crate::solana_core_resolve_accounts(input, roles, minimum_count, std::option::Option::None);
+) -> crate::DcApiDecoderExecutionResult {
+ let accounts_result = crate::decoder_solana_core_resolve_accounts(
+ input,
+ roles,
+ minimum_count,
+ std::option::Option::None,
+ );
let accounts = match accounts_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"loader_accounts_invalid",
error.to_string(),
);
},
};
- return crate::solana_core_decoded_result(
+ return crate::decoder_solana_core_decoded_result(
input,
surface_code,
entry_code,
@@ -785,12 +790,15 @@ fn build(
);
}
-fn read_tag(bytes: &[u8], code: &str) -> std::result::Result {
- let result = crate::solana_core_read_u32_le(bytes, 0);
+fn read_tag(
+ bytes: &[u8],
+ code: &str,
+) -> std::result::Result {
+ let result = crate::decoder_solana_core_read_u32_le(bytes, 0);
return match result {
std::result::Result::Ok(value) => std::result::Result::Ok(value),
std::result::Result::Err(error) => {
- std::result::Result::Err(crate::solana_core_failed_result(
+ std::result::Result::Err(crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_loader_instruction"),
code,
error.to_string(),
@@ -804,11 +812,11 @@ fn exact_u32_vector_length(
length_offset: usize,
data_offset: usize,
entry_code: &str,
-) -> std::result::Result {
- let encoded_length = match crate::solana_core_read_u32_le(bytes, length_offset) {
+) -> std::result::Result {
+ let encoded_length = match crate::decoder_solana_core_read_u32_le(bytes, length_offset) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return std::result::Result::Err(crate::solana_core_failed_result(
+ return std::result::Result::Err(crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"loader_vector_length_truncated",
error.to_string(),
@@ -818,7 +826,7 @@ fn exact_u32_vector_length(
let expected_length = encoded_length as usize;
let actual_length = bytes.len().saturating_sub(data_offset);
if bytes.len() < data_offset || actual_length != expected_length {
- return std::result::Result::Err(crate::solana_core_failed_result(
+ return std::result::Result::Err(crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"loader_vector_length_mismatch",
format!(
@@ -834,11 +842,11 @@ fn exact_vector_length(
length_offset: usize,
data_offset: usize,
entry_code: &str,
-) -> std::result::Result {
- let encoded_length = match crate::solana_core_read_u64_le(bytes, length_offset) {
+) -> std::result::Result {
+ let encoded_length = match crate::decoder_solana_core_read_u64_le(bytes, length_offset) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return std::result::Result::Err(crate::solana_core_failed_result(
+ return std::result::Result::Err(crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"loader_vector_length_truncated",
error.to_string(),
@@ -848,7 +856,7 @@ fn exact_vector_length(
let expected_length = match usize::try_from(encoded_length) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return std::result::Result::Err(crate::solana_core_failed_result(
+ return std::result::Result::Err(crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"loader_vector_length_overflow",
format!("loader vector length {encoded_length} does not fit usize"),
@@ -857,7 +865,7 @@ fn exact_vector_length(
};
let actual_length = bytes.len().saturating_sub(data_offset);
if bytes.len() < data_offset || actual_length != expected_length {
- return std::result::Result::Err(crate::solana_core_failed_result(
+ return std::result::Result::Err(crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"loader_vector_length_mismatch",
format!(
@@ -868,8 +876,12 @@ fn exact_vector_length(
return std::result::Result::Ok(expected_length);
}
-fn size_failure(entry_code: &str, expected: usize, actual: usize) -> crate::DecoderExecutionResult {
- return crate::solana_core_failed_result(
+fn size_failure(
+ entry_code: &str,
+ expected: usize,
+ actual: usize,
+) -> crate::DcApiDecoderExecutionResult {
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"loader_instruction_size_invalid",
format!("loader {entry_code} requires exactly {expected} bytes but received {actual}"),
@@ -877,31 +889,31 @@ fn size_failure(entry_code: &str, expected: usize, actual: usize) -> crate::Deco
}
fn unknown_tag(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
entry_code: &str,
tag: u32,
-) -> crate::DecoderExecutionResult {
- return crate::solana_core_unsupported_result(
+) -> crate::DcApiDecoderExecutionResult {
+ return crate::decoder_solana_core_unsupported_result(
entry_code,
"loader_tag_unknown",
format!(
"unknown loader instruction tag {tag}; payload_sha256={}",
- crate::solana_core_payload_hash(input)
+ crate::decoder_solana_core_payload_hash(input)
),
);
}
fn surface_code(program_id: &str) -> std::option::Option<&'static str> {
return if program_id == kb_program_ids::BPF_LOADER_DEPRECATED_PROGRAM_ID {
- std::option::Option::Some(crate::SOLANA_CORE_BPF_LOADER_DEPRECATED_SURFACE_CODE)
+ std::option::Option::Some(crate::DC_SOLANA_CORE_BPF_LOADER_DEPRECATED_SURFACE_CODE)
} else if program_id == kb_program_ids::BPF_LOADER_PROGRAM_ID {
- std::option::Option::Some(crate::SOLANA_CORE_BPF_LOADER_SURFACE_CODE)
+ std::option::Option::Some(crate::DC_SOLANA_CORE_BPF_LOADER_SURFACE_CODE)
} else if program_id == kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID {
- std::option::Option::Some(crate::SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE)
+ std::option::Option::Some(crate::DC_SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE)
} else if program_id == kb_program_ids::LOADER_V4_PROGRAM_ID {
- std::option::Option::Some(crate::SOLANA_CORE_LOADER_V4_SURFACE_CODE)
+ std::option::Option::Some(crate::DC_SOLANA_CORE_LOADER_V4_SURFACE_CODE)
} else if program_id == kb_program_ids::NATIVE_LOADER_PROGRAM_ID {
- std::option::Option::Some(crate::SOLANA_CORE_NATIVE_LOADER_SURFACE_CODE)
+ std::option::Option::Some(crate::DC_SOLANA_CORE_NATIVE_LOADER_SURFACE_CODE)
} else {
std::option::Option::None
};
@@ -911,7 +923,7 @@ fn entry_code(program_id: &str, bytes: &[u8]) -> std::option::Option<&'static st
if program_id == kb_program_ids::NATIVE_LOADER_PROGRAM_ID {
return std::option::Option::Some("direct_invocation_opaque");
}
- let tag = match crate::solana_core_read_u32_le(bytes, 0) {
+ 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,
};
@@ -952,7 +964,7 @@ fn entry_code(program_id: &str, bytes: &[u8]) -> std::option::Option<&'static st
return std::option::Option::None;
}
-fn account_count(input: &crate::CoreInstructionReplayInput) -> usize {
+fn account_count(input: &crate::MdCoreInstructionReplayInput) -> usize {
return input.instruction_accounts_json.as_array().map(std::vec::Vec::len).unwrap_or(0);
}
@@ -962,11 +974,11 @@ fn coverage_entry(
entry_code: &str,
discriminator_hex: std::option::Option,
historical: bool,
-) -> crate::DecoderCoverageDeclaration {
- return crate::DecoderCoverageDeclaration {
+) -> crate::DcApiDecoderCoverageDeclaration {
+ return crate::DcApiDecoderCoverageDeclaration {
program_id: program_id.to_string(),
surface_code: std::option::Option::Some(surface_code.to_string()),
- entry_kind: crate::DecoderCoverageEntryKind::Instruction,
+ entry_kind: crate::DcApiDecoderCoverageEntryKind::Instruction,
entry_code: entry_code.to_string(),
discriminator_hex,
historical,
@@ -987,7 +999,7 @@ mod tests {
bytes: &[u8],
account_count: usize,
transaction_failed: bool,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
let encoded = base64::engine::general_purpose::STANDARD.encode(bytes);
let account_keys = (0..account_count)
.map(|index| {
@@ -1009,7 +1021,7 @@ mod tests {
});
})
.collect::>();
- let result = crate::CoreInstructionReplayInput::new(
+ let result = crate::MdCoreInstructionReplayInput::new(
"signature:0",
"signature",
42,
@@ -1060,9 +1072,9 @@ mod tests {
program_id: &str,
bytes: &[u8],
account_count: usize,
- ) -> crate::DecoderExecutionResult {
+ ) -> crate::DcApiDecoderExecutionResult {
let input = replay_input(program_id, bytes, account_count, false);
- return crate::solana_core_loaders_decode(&input);
+ return crate::decoder_solana_core_loaders_decode(&input);
}
fn upgradeable(
@@ -1083,7 +1095,7 @@ mod tests {
kb_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::DecoderOutcomeStatus::Decoded);
+ assert_eq!(write_result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(write_result.observations[0].payload_json["parameters"]["offset"], 7);
assert_eq!(write_result.observations[0].payload_json["parameters"]["byteLength"], 3);
assert_eq!(
@@ -1092,7 +1104,7 @@ mod tests {
);
assert!(write_result.observations[0].payload_json["parameters"].get("bytes").is_none());
let finalize_result = decode(program_id, unit(1).as_slice(), 2);
- assert_eq!(finalize_result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(finalize_result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
}
}
@@ -1103,7 +1115,7 @@ mod tests {
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);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ 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);
}
@@ -1171,7 +1183,7 @@ mod tests {
bytes.as_slice(),
account_count,
);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some(entry_code)
@@ -1186,7 +1198,7 @@ mod tests {
);
bytes.push(0);
let result = decode(kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, bytes.as_slice(), 1);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Failed);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some("initialize_buffer")
@@ -1243,7 +1255,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);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some(entry_code)
@@ -1254,19 +1266,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);
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
+ 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);
- assert_eq!(mismatched_result.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(mismatched_result.status, crate::DcApiDecoderOutcomeStatus::Failed);
let unknown = decode(kb_program_ids::LOADER_V4_PROGRAM_ID, unit(99).as_slice(), 0);
- assert_eq!(unknown.status, crate::DecoderOutcomeStatus::Unsupported);
+ 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);
- assert_eq!(invalid_bool_result.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(invalid_bool_result.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
@@ -1275,18 +1287,18 @@ mod tests {
bytes.extend_from_slice(&128_u32.to_le_bytes());
let incomplete =
decode(kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, bytes.as_slice(), 3);
- assert_eq!(incomplete.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(incomplete.status, crate::DcApiDecoderOutcomeStatus::Failed);
let complete =
decode(kb_program_ids::BPF_LOADER_UPGRADEABLE_PROGRAM_ID, bytes.as_slice(), 4);
- assert_eq!(complete.status, crate::DecoderOutcomeStatus::Decoded);
+ 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 result = crate::solana_core_loaders_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_loaders_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(result.observations[0].transaction_failed);
assert!(!result.observations[0].observation_committed);
}
@@ -1294,14 +1306,14 @@ 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 result = crate::solana_core_loaders_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Ignored);
+ let result = crate::decoder_solana_core_loaders_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Ignored);
assert!(result.observations.is_empty());
}
#[test]
fn coverage_declares_every_loader_entry() {
- let coverage = crate::solana_core_loaders_coverage();
+ let coverage = crate::decoder_solana_core_loaders_coverage();
assert_eq!(coverage.len(), 20);
assert!(
coverage
diff --git a/kb-lib/src/decoder/solana/core/payload.rs b/kb-lib/src/decoder/solana/core/payload.rs
index 8b5507c..9a4ab8f 100644
--- a/kb-lib/src/decoder/solana/core/payload.rs
+++ b/kb-lib/src/decoder/solana/core/payload.rs
@@ -7,7 +7,7 @@ use base64::Engine; // rust-rules: trait-import
use sha2::Digest; // rust-rules: trait-import
/// One resolved outer instruction payload and its provenance relative to the target instruction.
-pub(crate) struct ResolvedInstructionPayload {
+pub(crate) struct DcSolanaCoreResolvedInstructionPayload {
/// Numeric outer instruction index in the transaction message.
pub(crate) instruction_index: usize,
/// Stable outer instruction path retained by the core store.
@@ -19,8 +19,8 @@ pub(crate) struct ResolvedInstructionPayload {
}
/// Decodes one retained base64 instruction payload with an explicit byte limit.
-pub(crate) fn decode_instruction_data(
- input: &crate::CoreInstructionReplayInput,
+pub(crate) fn decoder_solana_core_decode_instruction_data(
+ input: &crate::MdCoreInstructionReplayInput,
) -> kb_core::Result> {
let payload = match input.instruction_payload_json.as_ref() {
std::option::Option::Some(value) => value,
@@ -34,22 +34,22 @@ pub(crate) fn decode_instruction_data(
}
/// Resolves an Ed25519 or secp256r1 instruction reference using the official `u16::MAX` sentinel.
-pub(crate) fn resolve_u16_instruction_payload(
- input: &crate::CoreInstructionReplayInput,
+pub(crate) fn decoder_solana_core_resolve_u16_instruction_payload(
+ input: &crate::MdCoreInstructionReplayInput,
raw_instruction_index: u16,
-) -> kb_core::Result {
+) -> kb_core::Result {
if raw_instruction_index == u16::MAX {
- let target_index_result = crate::solana_core_target_outer_instruction_index(input);
+ let target_index_result = crate::decoder_solana_core_target_outer_instruction_index(input);
let target_index = match target_index_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- return std::result::Result::Ok(crate::SolanaCoreResolvedInstructionPayload {
+ return std::result::Result::Ok(crate::DcSolanaCoreResolvedInstructionPayload {
instruction_index: target_index,
instruction_path: input.instruction_path.clone(),
bytes,
@@ -61,16 +61,16 @@ pub(crate) fn resolve_u16_instruction_payload(
/// Resolves a secp256k1 instruction reference. The runtime format has no current-instruction
/// sentinel: every `u8` value is an explicit outer instruction index.
-pub(crate) fn resolve_u8_instruction_payload(
- input: &crate::CoreInstructionReplayInput,
+pub(crate) fn decoder_solana_core_resolve_u8_instruction_payload(
+ input: &crate::MdCoreInstructionReplayInput,
raw_instruction_index: u8,
-) -> kb_core::Result {
+) -> kb_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 target_outer_instruction_index(
- input: &crate::CoreInstructionReplayInput,
+pub(crate) fn decoder_solana_core_target_outer_instruction_index(
+ input: &crate::MdCoreInstructionReplayInput,
) -> kb_core::Result {
if input.instruction_path.contains('/') {
return std::result::Result::Err(kb_core::Error::invalid_state(
@@ -87,7 +87,7 @@ pub(crate) fn target_outer_instruction_index(
}
/// Extracts one exact bounded byte slice with checked arithmetic.
-pub(crate) fn bounded_slice<'a>(
+pub(crate) fn decoder_solana_core_bounded_slice<'a>(
bytes: &'a [u8],
offset: usize,
length: usize,
@@ -113,29 +113,31 @@ pub(crate) fn bounded_slice<'a>(
}
/// Returns the decoded target payload length when retained and valid.
-pub(crate) fn decoded_payload_length(
- input: &crate::CoreInstructionReplayInput,
+pub(crate) fn decoder_solana_core_decoded_payload_length(
+ input: &crate::MdCoreInstructionReplayInput,
) -> std::option::Option {
- return crate::solana_core_decode_instruction_data(input)
+ return crate::decoder_solana_core_decode_instruction_data(input)
.ok()
.map(|bytes| return bytes.len());
}
/// Returns the SHA-256 of the decoded target instruction data when available.
-pub(crate) fn decoded_payload_sha256(
- input: &crate::CoreInstructionReplayInput,
+pub(crate) fn decoder_solana_core_decoded_payload_sha256(
+ input: &crate::MdCoreInstructionReplayInput,
) -> std::option::Option {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
return match bytes_result {
std::result::Result::Ok(bytes) => {
- std::option::Option::Some(crate::solana_core_hash_bytes(bytes.as_slice()))
+ std::option::Option::Some(crate::decoder_solana_core_hash_bytes(bytes.as_slice()))
},
std::result::Result::Err(_error) => std::option::Option::None,
};
}
/// Returns a stable payload hash from core or computes it from retained JSON.
-pub(crate) fn payload_hash(input: &crate::CoreInstructionReplayInput) -> std::string::String {
+pub(crate) fn decoder_solana_core_payload_hash(
+ input: &crate::MdCoreInstructionReplayInput,
+) -> std::string::String {
if let std::option::Option::Some(value) = input.instruction_payload_hash.as_ref() {
return value.clone();
}
@@ -143,7 +145,7 @@ pub(crate) fn payload_hash(input: &crate::CoreInstructionReplayInput) -> std::st
std::option::Option::Some(value) => value,
std::option::Option::None => serde_json::Value::Null,
};
- let hash_result = crate::deterministic_json_hash(&mut value);
+ let hash_result = crate::decoder_api_deterministic_json_hash(&mut value);
return match hash_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => "payload_hash_unavailable".to_string(),
@@ -151,8 +153,9 @@ pub(crate) fn payload_hash(input: &crate::CoreInstructionReplayInput) -> std::st
}
/// Reads one little-endian `u32` from an exact byte range.
-pub(crate) fn read_u32_le(bytes: &[u8], offset: usize) -> kb_core::Result {
- let slice_result = crate::solana_core_bounded_slice(bytes, offset, 4, "native instruction u32");
+pub(crate) fn decoder_solana_core_read_u32_le(bytes: &[u8], offset: usize) -> kb_core::Result {
+ let slice_result =
+ crate::decoder_solana_core_bounded_slice(bytes, offset, 4, "native instruction u32");
let slice = match slice_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
@@ -167,8 +170,9 @@ pub(crate) fn read_u32_le(bytes: &[u8], offset: usize) -> kb_core::Result {
}
/// Reads one little-endian `u64` from an exact byte range.
-pub(crate) fn read_u64_le(bytes: &[u8], offset: usize) -> kb_core::Result {
- let slice_result = crate::solana_core_bounded_slice(bytes, offset, 8, "native instruction u64");
+pub(crate) fn decoder_solana_core_read_u64_le(bytes: &[u8], offset: usize) -> kb_core::Result {
+ let slice_result =
+ crate::decoder_solana_core_bounded_slice(bytes, offset, 8, "native instruction u64");
let slice = match slice_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
@@ -183,7 +187,7 @@ pub(crate) fn read_u64_le(bytes: &[u8], offset: usize) -> kb_core::Result {
}
/// Returns the lowercase SHA-256 of one bounded byte slice.
-pub(crate) fn hash_bytes(bytes: &[u8]) -> std::string::String {
+pub(crate) fn decoder_solana_core_hash_bytes(bytes: &[u8]) -> std::string::String {
let digest = sha2::Sha256::digest(bytes);
let mut output = std::string::String::with_capacity(digest.len().saturating_mul(2));
for byte in digest {
@@ -193,7 +197,7 @@ pub(crate) fn hash_bytes(bytes: &[u8]) -> std::string::String {
}
/// Returns a normalized lowercase hexadecimal prefix.
-pub(crate) fn hexadecimal_prefix(
+pub(crate) fn decoder_solana_core_hexadecimal_prefix(
bytes: &[u8],
count: usize,
) -> std::option::Option {
@@ -209,21 +213,21 @@ pub(crate) fn hexadecimal_prefix(
}
/// Returns a hexadecimal prefix no longer than the available byte slice.
-pub(crate) fn bounded_hexadecimal_prefix(
+pub(crate) fn decoder_solana_core_bounded_hexadecimal_prefix(
bytes: &[u8],
maximum_count: usize,
) -> std::string::String {
let count = std::cmp::min(bytes.len(), maximum_count);
- return match crate::solana_core_hexadecimal_prefix(bytes, count) {
+ return match crate::decoder_solana_core_hexadecimal_prefix(bytes, count) {
std::option::Option::Some(value) => value,
std::option::Option::None => std::string::String::new(),
};
}
fn resolve_explicit_outer_instruction(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
instruction_index: usize,
-) -> kb_core::Result {
+) -> kb_core::Result {
let entries = match input.outer_instructions_json.as_array() {
std::option::Option::Some(value) => value,
std::option::Option::None => {
@@ -232,7 +236,7 @@ fn resolve_explicit_outer_instruction(
));
},
};
- let target_index_result = crate::solana_core_target_outer_instruction_index(input);
+ let target_index_result = crate::decoder_solana_core_target_outer_instruction_index(input);
let target_index = match target_index_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
@@ -276,7 +280,7 @@ fn resolve_explicit_outer_instruction(
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- return std::result::Result::Ok(crate::SolanaCoreResolvedInstructionPayload {
+ return std::result::Result::Ok(crate::DcSolanaCoreResolvedInstructionPayload {
instruction_index,
instruction_path,
bytes,
@@ -300,7 +304,7 @@ fn decode_payload_json(
)));
},
};
- let maximum_encoded_length = crate::SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES
+ let maximum_encoded_length = crate::DC_SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES
.saturating_mul(4)
.saturating_div(3)
.saturating_add(4);
@@ -318,10 +322,10 @@ fn decode_payload_json(
)));
},
};
- if decoded.len() > crate::SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES {
+ if decoded.len() > crate::DC_SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES {
return std::result::Result::Err(kb_core::Error::invalid_state(format!(
"{label} payload exceeds {} decoded bytes",
- crate::SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES
+ crate::DC_SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES
)));
}
return std::result::Result::Ok(decoded);
diff --git a/kb-lib/src/decoder/solana/core/precompiles.rs b/kb-lib/src/decoder/solana/core/precompiles.rs
index 523b554..9335e7d 100644
--- a/kb-lib/src/decoder/solana/core/precompiles.rs
+++ b/kb-lib/src/decoder/solana/core/precompiles.rs
@@ -41,34 +41,38 @@ struct U16PrecompileSpec {
}
/// Returns declared signature precompile coverage.
-pub(crate) fn precompiles_coverage() -> std::vec::Vec {
+pub(crate) fn decoder_solana_core_precompiles_coverage()
+-> std::vec::Vec {
return vec![
- coverage_entry(kb_program_ids::ED25519_PROGRAM_ID, crate::SOLANA_CORE_ED25519_SURFACE_CODE),
+ coverage_entry(
+ kb_program_ids::ED25519_PROGRAM_ID,
+ crate::DC_SOLANA_CORE_ED25519_SURFACE_CODE,
+ ),
coverage_entry(
kb_program_ids::SECP256K1_PROGRAM_ID,
- crate::SOLANA_CORE_SECP256K1_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_SECP256K1_SURFACE_CODE,
),
coverage_entry(
kb_program_ids::SECP256R1_PROGRAM_ID,
- crate::SOLANA_CORE_SECP256R1_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_SECP256R1_SURFACE_CODE,
),
];
}
/// Recognizes one signature precompile instruction without resolving referenced data.
-pub(crate) fn precompiles_recognize(
- input: &crate::CoreInstructionReplayInput,
+pub(crate) fn decoder_solana_core_precompiles_recognize(
+ input: &crate::MdCoreInstructionReplayInput,
priority: u16,
-) -> crate::DecoderRecognition {
+) -> crate::DcApiDecoderRecognition {
let surface_code = match surface_code(input.program_id.as_str()) {
std::option::Option::Some(value) => value,
- std::option::Option::None => return crate::DecoderRecognition::incompatible(),
+ std::option::Option::None => return crate::DcApiDecoderRecognition::incompatible(),
};
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
std::option::Option::Some(surface_code.to_string()),
@@ -81,9 +85,9 @@ pub(crate) fn precompiles_recognize(
let discriminator_hex = if prefix_count == 0 {
std::option::Option::None
} else {
- crate::solana_core_hexadecimal_prefix(bytes.as_slice(), prefix_count)
+ crate::decoder_solana_core_hexadecimal_prefix(bytes.as_slice(), prefix_count)
};
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
true,
priority,
std::option::Option::Some(surface_code.to_string()),
@@ -93,16 +97,16 @@ pub(crate) fn precompiles_recognize(
}
/// Decodes one signature precompile instruction structurally without cryptographic recomputation.
-pub(crate) fn precompiles_decode(
- input: &crate::CoreInstructionReplayInput,
-) -> crate::DecoderExecutionResult {
+pub(crate) fn decoder_solana_core_precompiles_decode(
+ input: &crate::MdCoreInstructionReplayInput,
+) -> crate::DcApiDecoderExecutionResult {
if input.program_id == kb_program_ids::ED25519_PROGRAM_ID {
return decode_u16_precompile(
input,
&U16PrecompileSpec {
algorithm: "ed25519",
- surface_code: crate::SOLANA_CORE_ED25519_SURFACE_CODE,
- verification_key_size: crate::SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES,
+ surface_code: crate::DC_SOLANA_CORE_ED25519_SURFACE_CODE,
+ verification_key_size: crate::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES,
zero_signature_allowed: true,
maximum_signatures: usize::from(u8::MAX),
source: SOURCE_ED25519,
@@ -117,15 +121,15 @@ pub(crate) fn precompiles_decode(
input,
&U16PrecompileSpec {
algorithm: "secp256r1",
- surface_code: crate::SOLANA_CORE_SECP256R1_SURFACE_CODE,
- verification_key_size: crate::SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES,
+ surface_code: crate::DC_SOLANA_CORE_SECP256R1_SURFACE_CODE,
+ verification_key_size: crate::DC_SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES,
zero_signature_allowed: false,
- maximum_signatures: crate::SOLANA_CORE_SECP256R1_MAX_SIGNATURES,
+ maximum_signatures: crate::DC_SOLANA_CORE_SECP256R1_MAX_SIGNATURES,
source: SOURCE_SECP256R1,
},
);
}
- return crate::solana_core_unsupported_result(
+ return crate::decoder_solana_core_unsupported_result(
ENTRY_CODE,
"signature_precompile_program_unsupported",
"program id is not one of the three supported signature precompiles",
@@ -133,10 +137,10 @@ pub(crate) fn precompiles_decode(
}
fn decode_u16_precompile(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
spec: &U16PrecompileSpec,
-) -> crate::DecoderExecutionResult {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+) -> crate::DcApiDecoderExecutionResult {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
@@ -225,7 +229,7 @@ fn decode_u16_precompile(
format!("signatureCount={signature_count} exceeds maximum={}", spec.maximum_signatures),
);
}
- let table_bytes = match signature_count.checked_mul(crate::SOLANA_CORE_U16_OFFSETS_BYTES) {
+ let table_bytes = match signature_count.checked_mul(crate::DC_SOLANA_CORE_U16_OFFSETS_BYTES) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
return failed(
@@ -260,7 +264,8 @@ fn decode_u16_precompile(
}
let mut parameters = std::vec::Vec::with_capacity(signature_count);
for entry_index in 0..signature_count {
- let relative_offset = match entry_index.checked_mul(crate::SOLANA_CORE_U16_OFFSETS_BYTES) {
+ let relative_offset = match entry_index.checked_mul(crate::DC_SOLANA_CORE_U16_OFFSETS_BYTES)
+ {
std::option::Option::Some(value) => value,
std::option::Option::None => {
return failed(
@@ -315,8 +320,10 @@ fn decode_u16_precompile(
return decoded_result(input, spec.surface_code, spec.algorithm, spec.source, parameters);
}
-fn decode_secp256k1(input: &crate::CoreInstructionReplayInput) -> crate::DecoderExecutionResult {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+fn decode_secp256k1(
+ input: &crate::MdCoreInstructionReplayInput,
+) -> crate::DcApiDecoderExecutionResult {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
@@ -365,13 +372,13 @@ fn decode_secp256k1(input: &crate::CoreInstructionReplayInput) -> crate::Decoder
}
return decoded_result(
input,
- crate::SOLANA_CORE_SECP256K1_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_SECP256K1_SURFACE_CODE,
"secp256k1",
SOURCE_SECP256K1,
vec![zero_signature_parameters(input, "secp256k1", std::option::Option::None)],
);
}
- let table_bytes = match signature_count.checked_mul(crate::SOLANA_CORE_U8_OFFSETS_BYTES) {
+ let table_bytes = match signature_count.checked_mul(crate::DC_SOLANA_CORE_U8_OFFSETS_BYTES) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
return failed(
@@ -406,7 +413,8 @@ fn decode_secp256k1(input: &crate::CoreInstructionReplayInput) -> crate::Decoder
}
let mut parameters = std::vec::Vec::with_capacity(signature_count);
for entry_index in 0..signature_count {
- let relative_offset = match entry_index.checked_mul(crate::SOLANA_CORE_U8_OFFSETS_BYTES) {
+ let relative_offset = match entry_index.checked_mul(crate::DC_SOLANA_CORE_U8_OFFSETS_BYTES)
+ {
std::option::Option::Some(value) => value,
std::option::Option::None => {
return failed(
@@ -459,7 +467,7 @@ fn decode_secp256k1(input: &crate::CoreInstructionReplayInput) -> crate::Decoder
}
return decoded_result(
input,
- crate::SOLANA_CORE_SECP256K1_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_SECP256K1_SURFACE_CODE,
"secp256k1",
SOURCE_SECP256K1,
parameters,
@@ -467,14 +475,14 @@ fn decode_secp256k1(input: &crate::CoreInstructionReplayInput) -> crate::Decoder
}
fn resolve_u16_entry(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
spec: &U16PrecompileSpec,
signature_count: usize,
padding: u8,
entry_index: usize,
offsets: &U16SignatureOffsets,
) -> kb_core::Result {
- let signature_payload_result = crate::solana_core_resolve_u16_instruction_payload(
+ let signature_payload_result = crate::decoder_solana_core_resolve_u16_instruction_payload(
input,
offsets.signature_instruction_index,
);
@@ -482,15 +490,16 @@ fn resolve_u16_entry(
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let verification_key_payload_result = crate::solana_core_resolve_u16_instruction_payload(
- input,
- offsets.verification_key_instruction_index,
- );
+ let verification_key_payload_result =
+ crate::decoder_solana_core_resolve_u16_instruction_payload(
+ input,
+ offsets.verification_key_instruction_index,
+ );
let verification_key_payload = match verification_key_payload_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let message_payload_result = crate::solana_core_resolve_u16_instruction_payload(
+ let message_payload_result = crate::decoder_solana_core_resolve_u16_instruction_payload(
input,
offsets.message_instruction_index,
);
@@ -498,17 +507,17 @@ fn resolve_u16_entry(
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let signature_result = crate::solana_core_bounded_slice(
+ let signature_result = crate::decoder_solana_core_bounded_slice(
signature_payload.bytes.as_slice(),
usize::from(offsets.signature_offset),
- crate::SOLANA_CORE_SIGNATURE_BYTES,
+ crate::DC_SOLANA_CORE_SIGNATURE_BYTES,
"signature",
);
let signature = match signature_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let verification_key_result = crate::solana_core_bounded_slice(
+ let verification_key_result = crate::decoder_solana_core_bounded_slice(
verification_key_payload.bytes.as_slice(),
usize::from(offsets.verification_key_offset),
spec.verification_key_size,
@@ -518,7 +527,7 @@ fn resolve_u16_entry(
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let message_result = crate::solana_core_bounded_slice(
+ let message_result = crate::decoder_solana_core_bounded_slice(
message_payload.bytes.as_slice(),
usize::from(offsets.message_data_offset),
usize::from(offsets.message_data_size),
@@ -571,12 +580,12 @@ fn resolve_u16_entry(
}
fn resolve_u8_entry(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
signature_count: usize,
entry_index: usize,
offsets: &U8SignatureOffsets,
) -> kb_core::Result {
- let signature_payload_result = crate::solana_core_resolve_u8_instruction_payload(
+ let signature_payload_result = crate::decoder_solana_core_resolve_u8_instruction_payload(
input,
offsets.signature_instruction_index,
);
@@ -584,7 +593,7 @@ fn resolve_u8_entry(
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let address_payload_result = crate::solana_core_resolve_u8_instruction_payload(
+ let address_payload_result = crate::decoder_solana_core_resolve_u8_instruction_payload(
input,
offsets.ethereum_address_instruction_index,
);
@@ -592,16 +601,18 @@ fn resolve_u8_entry(
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let message_payload_result =
- crate::solana_core_resolve_u8_instruction_payload(input, offsets.message_instruction_index);
+ let message_payload_result = crate::decoder_solana_core_resolve_u8_instruction_payload(
+ input,
+ offsets.message_instruction_index,
+ );
let message_payload = match message_payload_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let signature_result = crate::solana_core_bounded_slice(
+ let signature_result = crate::decoder_solana_core_bounded_slice(
signature_payload.bytes.as_slice(),
usize::from(offsets.signature_offset),
- crate::SOLANA_CORE_SIGNATURE_BYTES,
+ crate::DC_SOLANA_CORE_SIGNATURE_BYTES,
"secp256k1 compact signature",
);
let signature = match signature_result {
@@ -609,7 +620,7 @@ fn resolve_u8_entry(
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
let recovery_offset = match usize::from(offsets.signature_offset)
- .checked_add(crate::SOLANA_CORE_SIGNATURE_BYTES)
+ .checked_add(crate::DC_SOLANA_CORE_SIGNATURE_BYTES)
{
std::option::Option::Some(value) => value,
std::option::Option::None => {
@@ -618,7 +629,7 @@ fn resolve_u8_entry(
));
},
};
- let recovery_result = crate::solana_core_bounded_slice(
+ let recovery_result = crate::decoder_solana_core_bounded_slice(
signature_payload.bytes.as_slice(),
recovery_offset,
1,
@@ -636,17 +647,17 @@ fn resolve_u8_entry(
));
},
};
- let address_result = crate::solana_core_bounded_slice(
+ let address_result = crate::decoder_solana_core_bounded_slice(
address_payload.bytes.as_slice(),
usize::from(offsets.ethereum_address_offset),
- crate::SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES,
+ crate::DC_SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES,
"secp256k1 Ethereum address",
);
let address = match address_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let message_result = crate::solana_core_bounded_slice(
+ let message_result = crate::decoder_solana_core_bounded_slice(
message_payload.bytes.as_slice(),
usize::from(offsets.message_data_offset),
usize::from(offsets.message_data_size),
@@ -699,17 +710,17 @@ fn resolve_u8_entry(
}
fn read_u16_offsets(bytes: &[u8], offset: usize) -> kb_core::Result {
- let table_result = crate::solana_core_bounded_slice(
+ let table_result = crate::decoder_solana_core_bounded_slice(
bytes,
offset,
- crate::SOLANA_CORE_U16_OFFSETS_BYTES,
+ crate::DC_SOLANA_CORE_U16_OFFSETS_BYTES,
"Ed25519 or secp256r1 offsets",
);
let table = match table_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let array_result = <[u8; crate::SOLANA_CORE_U16_OFFSETS_BYTES]>::try_from(table);
+ let array_result = <[u8; crate::DC_SOLANA_CORE_U16_OFFSETS_BYTES]>::try_from(table);
let array = match array_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
@@ -758,17 +769,17 @@ fn read_u16_offsets(bytes: &[u8], offset: usize) -> kb_core::Result kb_core::Result {
- let table_result = crate::solana_core_bounded_slice(
+ let table_result = crate::decoder_solana_core_bounded_slice(
bytes,
offset,
- crate::SOLANA_CORE_U8_OFFSETS_BYTES,
+ crate::DC_SOLANA_CORE_U8_OFFSETS_BYTES,
"secp256k1 offsets",
);
let table = match table_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let array_result = <[u8; crate::SOLANA_CORE_U8_OFFSETS_BYTES]>::try_from(table);
+ let array_result = <[u8; crate::DC_SOLANA_CORE_U8_OFFSETS_BYTES]>::try_from(table);
let array = match array_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
@@ -805,14 +816,14 @@ fn read_u8_offsets(bytes: &[u8], offset: usize) -> kb_core::Result,
-) -> crate::DecoderExecutionResult {
- let payload_hash = crate::solana_core_payload_hash(input);
- let instruction_data_sha256 = match crate::solana_core_decoded_payload_sha256(input) {
+) -> crate::DcApiDecoderExecutionResult {
+ let payload_hash = crate::decoder_solana_core_payload_hash(input);
+ let instruction_data_sha256 = match crate::decoder_solana_core_decoded_payload_sha256(input) {
std::option::Option::Some(value) => value,
std::option::Option::None => "instruction_data_sha256_unavailable".to_string(),
};
@@ -822,24 +833,24 @@ fn decoded_result(
std::option::Option::Some(value) => value.to_string(),
std::option::Option::None => "batch".to_string(),
};
- let event = crate::DecodedProtocolEvent {
- signature: crate::Signature(input.signature.clone()),
- slot: crate::Slot(input.slot),
- instruction_path: crate::InstructionPath(input.instruction_path.clone()),
- program_id: crate::ProgramId(input.program_id.clone()),
- protocol_code: crate::ProtocolCode(crate::SOLANA_CORE_PROTOCOL_CODE.to_string()),
- surface_code: crate::SurfaceCode(surface_code.to_string()),
- event_code: crate::EventCode(format!("{surface_code}.{ENTRY_CODE}")),
- event_name: crate::EventName(ENTRY_CODE.to_string()),
- event_family: crate::EventFamily::Audit,
- source_kind: crate::EventSourceKind::Instruction,
- confidence: crate::DecoderConfidence::ManualExact,
+ let event = crate::MdDecodedProtocolEvent {
+ signature: crate::MdSignature(input.signature.clone()),
+ slot: crate::MdSlot(input.slot),
+ instruction_path: crate::MdInstructionPath(input.instruction_path.clone()),
+ program_id: crate::MdProgramId(input.program_id.clone()),
+ protocol_code: crate::MdProtocolCode(crate::DC_SOLANA_CORE_PROTOCOL_CODE.to_string()),
+ surface_code: crate::MdSurfaceCode(surface_code.to_string()),
+ event_code: crate::MdEventCode(format!("{surface_code}.{ENTRY_CODE}")),
+ event_name: crate::MdEventName(ENTRY_CODE.to_string()),
+ event_family: crate::MdEventFamily::Audit,
+ source_kind: crate::MdEventSourceKind::Instruction,
+ confidence: crate::MdDecoderConfidence::ManualExact,
};
- observations.push(crate::DecodedObservation {
+ observations.push(crate::DcApiDecodedObservation {
event_key: format!("{ENTRY_CODE}:{entry_key}"),
event,
payload_json: serde_json::json!({
- "eventVersion": crate::SOLANA_CORE_NATIVE_EVENT_VERSION,
+ "eventVersion": crate::DC_SOLANA_CORE_NATIVE_EVENT_VERSION,
"programId": input.program_id,
"surfaceCode": surface_code,
"entryCode": ENTRY_CODE,
@@ -856,9 +867,9 @@ fn decoded_result(
transaction_failed: input.transaction_failed,
transaction_error: input.transaction_err_json.clone(),
observation_committed: !input.transaction_failed,
- proof: crate::DecoderProof {
- kind: crate::DecoderProofKind::ExactLayout,
- confidence: crate::DecoderConfidence::ManualExact,
+ proof: crate::DcApiDecoderProof {
+ kind: crate::DcApiDecoderProofKind::ExactLayout,
+ confidence: crate::MdDecoderConfidence::ManualExact,
evidence: vec![
source.to_string(),
"structural_decode_only:no_cryptographic_reverification".to_string(),
@@ -867,8 +878,8 @@ fn decoded_result(
},
});
}
- return crate::DecoderExecutionResult {
- status: crate::DecoderOutcomeStatus::Decoded,
+ return crate::DcApiDecoderExecutionResult {
+ status: crate::DcApiDecoderOutcomeStatus::Decoded,
recognized_entry_code: std::option::Option::Some(ENTRY_CODE.to_string()),
observations,
diagnostics: std::vec::Vec::new(),
@@ -876,7 +887,7 @@ fn decoded_result(
}
fn zero_signature_parameters(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
algorithm: &str,
padding: std::option::Option,
) -> serde_json::Value {
@@ -902,15 +913,15 @@ fn zero_signature_parameters(
fn component_summary(bytes: &[u8]) -> serde_json::Value {
return serde_json::json!({
"length": bytes.len(),
- "sha256": crate::solana_core_hash_bytes(bytes),
- "hexPrefix": crate::solana_core_bounded_hexadecimal_prefix(
+ "sha256": crate::decoder_solana_core_hash_bytes(bytes),
+ "hexPrefix": crate::decoder_solana_core_bounded_hexadecimal_prefix(
bytes,
- crate::SOLANA_CORE_PRECOMPILE_COMPONENT_PREFIX_BYTES,
+ crate::DC_SOLANA_CORE_PRECOMPILE_COMPONENT_PREFIX_BYTES,
),
});
}
-fn runtime_verification(input: &crate::CoreInstructionReplayInput) -> &'static str {
+fn runtime_verification(input: &crate::MdCoreInstructionReplayInput) -> &'static str {
return if input.transaction_failed {
"not_asserted_transaction_failed"
} else {
@@ -919,22 +930,26 @@ fn runtime_verification(input: &crate::CoreInstructionReplayInput) -> &'static s
}
fn failed(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
algorithm: &str,
code: &str,
entry_index: std::option::Option,
detail: impl std::convert::Into,
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
let detail_value = detail.into();
let bounded_detail = detail_value.chars().take(512).collect::();
- let decoded_result = crate::solana_core_decode_instruction_data(input);
+ let decoded_result = crate::decoder_solana_core_decode_instruction_data(input);
let (payload_length, signature_count, payload_sha256) = match decoded_result {
std::result::Result::Ok(bytes) => {
let count = match bytes.first() {
std::option::Option::Some(value) => value.to_string(),
std::option::Option::None => "absent".to_string(),
};
- (bytes.len().to_string(), count, crate::solana_core_hash_bytes(bytes.as_slice()))
+ (
+ bytes.len().to_string(),
+ count,
+ crate::decoder_solana_core_hash_bytes(bytes.as_slice()),
+ )
},
std::result::Result::Err(_error) => {
("unknown".to_string(), "unknown".to_string(), "unavailable".to_string())
@@ -944,21 +959,21 @@ fn failed(
std::option::Option::Some(value) => value.to_string(),
std::option::Option::None => "none".to_string(),
};
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(ENTRY_CODE),
code,
format!(
"algorithm={algorithm}; signatureCount={signature_count}; entryIndex={entry}; payloadLength={payload_length}; payloadSha256={payload_sha256}; payloadContextHash={}; detail={bounded_detail}",
- crate::solana_core_payload_hash(input)
+ crate::decoder_solana_core_payload_hash(input)
),
);
}
-fn coverage_entry(program_id: &str, surface_code: &str) -> crate::DecoderCoverageDeclaration {
- return crate::DecoderCoverageDeclaration {
+fn coverage_entry(program_id: &str, surface_code: &str) -> crate::DcApiDecoderCoverageDeclaration {
+ return crate::DcApiDecoderCoverageDeclaration {
program_id: program_id.to_string(),
surface_code: std::option::Option::Some(surface_code.to_string()),
- entry_kind: crate::DecoderCoverageEntryKind::Instruction,
+ entry_kind: crate::DcApiDecoderCoverageEntryKind::Instruction,
entry_code: ENTRY_CODE.to_string(),
discriminator_hex: std::option::Option::None,
historical: false,
@@ -967,13 +982,13 @@ fn coverage_entry(program_id: &str, surface_code: &str) -> crate::DecoderCoverag
fn surface_code(program_id: &str) -> std::option::Option<&'static str> {
if program_id == kb_program_ids::ED25519_PROGRAM_ID {
- return std::option::Option::Some(crate::SOLANA_CORE_ED25519_SURFACE_CODE);
+ return std::option::Option::Some(crate::DC_SOLANA_CORE_ED25519_SURFACE_CODE);
}
if program_id == kb_program_ids::SECP256K1_PROGRAM_ID {
- return std::option::Option::Some(crate::SOLANA_CORE_SECP256K1_SURFACE_CODE);
+ return std::option::Option::Some(crate::DC_SOLANA_CORE_SECP256K1_SURFACE_CODE);
}
if program_id == kb_program_ids::SECP256R1_PROGRAM_ID {
- return std::option::Option::Some(crate::SOLANA_CORE_SECP256R1_SURFACE_CODE);
+ return std::option::Option::Some(crate::DC_SOLANA_CORE_SECP256R1_SURFACE_CODE);
}
return std::option::Option::None;
}
@@ -985,7 +1000,7 @@ mod tests {
target_bytes: std::vec::Vec,
mut external: std::vec::Vec<(usize, std::vec::Vec)>,
transaction_failed: bool,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
external.push((1, target_bytes.clone()));
external.sort_by_key(|entry| return entry.0);
let outer = external
@@ -1001,11 +1016,11 @@ mod tests {
bytes,
)
},
- "payloadHash": crate::solana_core_hash_bytes(bytes),
+ "payloadHash": crate::decoder_solana_core_hash_bytes(bytes),
});
})
.collect::>();
- let result = crate::CoreInstructionReplayInput::new(
+ let result = crate::MdCoreInstructionReplayInput::new(
"signature:1",
"signature",
42,
@@ -1027,7 +1042,9 @@ mod tests {
target_bytes.as_slice(),
)
})),
- std::option::Option::Some(crate::solana_core_hash_bytes(target_bytes.as_slice())),
+ std::option::Option::Some(crate::decoder_solana_core_hash_bytes(
+ target_bytes.as_slice(),
+ )),
serde_json::Value::Array(outer),
serde_json::json!([]),
serde_json::json!([]),
@@ -1040,9 +1057,9 @@ mod tests {
}
fn u16_current_payload(key_size: usize, message: &[u8], padding: u8) -> std::vec::Vec {
- let table_end = 2 + crate::SOLANA_CORE_U16_OFFSETS_BYTES;
+ let table_end = 2 + crate::DC_SOLANA_CORE_U16_OFFSETS_BYTES;
let signature_offset = table_end;
- let key_offset = signature_offset + crate::SOLANA_CORE_SIGNATURE_BYTES;
+ let key_offset = signature_offset + crate::DC_SOLANA_CORE_SIGNATURE_BYTES;
let message_offset = key_offset + key_size;
let mut bytes = vec![1, padding];
push_u16(&mut bytes, u16_value(signature_offset));
@@ -1052,7 +1069,7 @@ mod tests {
push_u16(&mut bytes, u16_value(message_offset));
push_u16(&mut bytes, u16_value(message.len()));
push_u16(&mut bytes, u16::MAX);
- bytes.extend(std::iter::repeat_n(0x11, crate::SOLANA_CORE_SIGNATURE_BYTES));
+ bytes.extend(std::iter::repeat_n(0x11, crate::DC_SOLANA_CORE_SIGNATURE_BYTES));
bytes.extend(std::iter::repeat_n(0x22, key_size));
bytes.extend_from_slice(message);
return bytes;
@@ -1063,7 +1080,7 @@ mod tests {
message: &[u8],
) -> (std::vec::Vec, std::vec::Vec) {
let signature_offset = 0;
- let key_offset = crate::SOLANA_CORE_SIGNATURE_BYTES;
+ let key_offset = crate::DC_SOLANA_CORE_SIGNATURE_BYTES;
let message_offset = key_offset + key_size;
let mut target = vec![1, 0];
push_u16(&mut target, u16_value(signature_offset));
@@ -1073,7 +1090,7 @@ mod tests {
push_u16(&mut target, u16_value(message_offset));
push_u16(&mut target, u16_value(message.len()));
push_u16(&mut target, 0);
- let mut external = vec![0x31; crate::SOLANA_CORE_SIGNATURE_BYTES];
+ let mut external = vec![0x31; crate::DC_SOLANA_CORE_SIGNATURE_BYTES];
external.extend(std::iter::repeat_n(0x32, key_size));
external.extend_from_slice(message);
return (target, external);
@@ -1082,7 +1099,7 @@ mod tests {
fn u16_mixed_payload(
key_size: usize,
) -> (std::vec::Vec, std::vec::Vec<(usize, std::vec::Vec)>) {
- let signature_offset = 2 + crate::SOLANA_CORE_U16_OFFSETS_BYTES;
+ let signature_offset = 2 + crate::DC_SOLANA_CORE_U16_OFFSETS_BYTES;
let mut target = vec![1, 0];
push_u16(&mut target, u16_value(signature_offset));
push_u16(&mut target, u16::MAX);
@@ -1091,15 +1108,16 @@ mod tests {
push_u16(&mut target, 0);
push_u16(&mut target, 4);
push_u16(&mut target, 2);
- target.extend(std::iter::repeat_n(0x41, crate::SOLANA_CORE_SIGNATURE_BYTES));
+ target.extend(std::iter::repeat_n(0x41, crate::DC_SOLANA_CORE_SIGNATURE_BYTES));
return (target, vec![(0, vec![0x42; key_size]), (2, vec![0x43, 0x44, 0x45, 0x46])]);
}
fn secp256k1_current_payload(message: &[u8]) -> std::vec::Vec {
- let table_end = 1 + crate::SOLANA_CORE_U8_OFFSETS_BYTES;
+ let table_end = 1 + crate::DC_SOLANA_CORE_U8_OFFSETS_BYTES;
let signature_offset = table_end;
- let address_offset = signature_offset + crate::SOLANA_CORE_SIGNATURE_BYTES + 1;
- let message_offset = address_offset + crate::SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES;
+ let address_offset = signature_offset + crate::DC_SOLANA_CORE_SIGNATURE_BYTES + 1;
+ let message_offset =
+ address_offset + crate::DC_SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES;
let mut bytes = vec![1];
push_u16(&mut bytes, u16_value(signature_offset));
bytes.push(1);
@@ -1108,18 +1126,21 @@ mod tests {
push_u16(&mut bytes, u16_value(message_offset));
push_u16(&mut bytes, u16_value(message.len()));
bytes.push(1);
- bytes.extend(std::iter::repeat_n(0x51, crate::SOLANA_CORE_SIGNATURE_BYTES));
+ bytes.extend(std::iter::repeat_n(0x51, crate::DC_SOLANA_CORE_SIGNATURE_BYTES));
bytes.push(2);
- bytes
- .extend(std::iter::repeat_n(0x52, crate::SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES));
+ bytes.extend(std::iter::repeat_n(
+ 0x52,
+ crate::DC_SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES,
+ ));
bytes.extend_from_slice(message);
return bytes;
}
fn secp256k1_external_payload(message: &[u8]) -> (std::vec::Vec, std::vec::Vec) {
let signature_offset = 0;
- let address_offset = crate::SOLANA_CORE_SIGNATURE_BYTES + 1;
- let message_offset = address_offset + crate::SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES;
+ let address_offset = crate::DC_SOLANA_CORE_SIGNATURE_BYTES + 1;
+ let message_offset =
+ address_offset + crate::DC_SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES;
let mut target = vec![1];
push_u16(&mut target, u16_value(signature_offset));
target.push(0);
@@ -1128,16 +1149,18 @@ mod tests {
push_u16(&mut target, u16_value(message_offset));
push_u16(&mut target, u16_value(message.len()));
target.push(0);
- let mut external = vec![0x61; crate::SOLANA_CORE_SIGNATURE_BYTES];
+ let mut external = vec![0x61; crate::DC_SOLANA_CORE_SIGNATURE_BYTES];
external.push(3);
- external
- .extend(std::iter::repeat_n(0x62, crate::SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES));
+ external.extend(std::iter::repeat_n(
+ 0x62,
+ crate::DC_SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES,
+ ));
external.extend_from_slice(message);
return (target, external);
}
fn secp256k1_mixed_payload() -> (std::vec::Vec, std::vec::Vec<(usize, std::vec::Vec)>) {
- let signature_offset = 1 + crate::SOLANA_CORE_U8_OFFSETS_BYTES;
+ let signature_offset = 1 + crate::DC_SOLANA_CORE_U8_OFFSETS_BYTES;
let mut target = vec![1];
push_u16(&mut target, u16_value(signature_offset));
target.push(1);
@@ -1146,24 +1169,24 @@ mod tests {
push_u16(&mut target, 0);
push_u16(&mut target, 4);
target.push(2);
- target.extend(std::iter::repeat_n(0x71, crate::SOLANA_CORE_SIGNATURE_BYTES));
+ target.extend(std::iter::repeat_n(0x71, crate::DC_SOLANA_CORE_SIGNATURE_BYTES));
target.push(1);
return (
target,
vec![
- (0, vec![0x72; crate::SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES]),
+ (0, vec![0x72; crate::DC_SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES]),
(2, vec![0x73, 0x74, 0x75, 0x76]),
],
);
}
fn two_u16_entries(key_size: usize) -> std::vec::Vec {
- let table_end = 2 + 2 * crate::SOLANA_CORE_U16_OFFSETS_BYTES;
- let entry_size = crate::SOLANA_CORE_SIGNATURE_BYTES + key_size + 1;
+ let table_end = 2 + 2 * crate::DC_SOLANA_CORE_U16_OFFSETS_BYTES;
+ let entry_size = crate::DC_SOLANA_CORE_SIGNATURE_BYTES + key_size + 1;
let mut bytes = vec![2, 0];
for index in 0..2 {
let signature_offset = table_end + index * entry_size;
- let key_offset = signature_offset + crate::SOLANA_CORE_SIGNATURE_BYTES;
+ let key_offset = signature_offset + crate::DC_SOLANA_CORE_SIGNATURE_BYTES;
let message_offset = key_offset + key_size;
push_u16(&mut bytes, u16_value(signature_offset));
push_u16(&mut bytes, u16::MAX);
@@ -1176,7 +1199,7 @@ mod tests {
for index in 0..2 {
bytes.extend(std::iter::repeat_n(
0x80 + index as u8,
- crate::SOLANA_CORE_SIGNATURE_BYTES,
+ crate::DC_SOLANA_CORE_SIGNATURE_BYTES,
));
bytes.extend(std::iter::repeat_n(0x90 + index as u8, key_size));
bytes.push(index as u8);
@@ -1185,17 +1208,17 @@ mod tests {
}
fn two_secp256k1_entries() -> std::vec::Vec {
- let table_end = 1 + 2 * crate::SOLANA_CORE_U8_OFFSETS_BYTES;
- let entry_size = crate::SOLANA_CORE_SIGNATURE_BYTES
+ let table_end = 1 + 2 * crate::DC_SOLANA_CORE_U8_OFFSETS_BYTES;
+ let entry_size = crate::DC_SOLANA_CORE_SIGNATURE_BYTES
+ 1
- + crate::SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES
+ + crate::DC_SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES
+ 1;
let mut bytes = vec![2];
for index in 0..2 {
let signature_offset = table_end + index * entry_size;
- let address_offset = signature_offset + crate::SOLANA_CORE_SIGNATURE_BYTES + 1;
+ let address_offset = signature_offset + crate::DC_SOLANA_CORE_SIGNATURE_BYTES + 1;
let message_offset =
- address_offset + crate::SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES;
+ address_offset + crate::DC_SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES;
push_u16(&mut bytes, u16_value(signature_offset));
bytes.push(1);
push_u16(&mut bytes, u16_value(address_offset));
@@ -1207,12 +1230,12 @@ mod tests {
for index in 0..2 {
bytes.extend(std::iter::repeat_n(
0xA0 + index as u8,
- crate::SOLANA_CORE_SIGNATURE_BYTES,
+ crate::DC_SOLANA_CORE_SIGNATURE_BYTES,
));
bytes.push(index as u8);
bytes.extend(std::iter::repeat_n(
0xB0 + index as u8,
- crate::SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES,
+ crate::DC_SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES,
));
bytes.push(index as u8);
}
@@ -1254,7 +1277,7 @@ mod tests {
};
}
- fn parameters(result: &crate::DecoderExecutionResult) -> &serde_json::Value {
+ fn parameters(result: &crate::DcApiDecoderExecutionResult) -> &serde_json::Value {
return &result.observations[0].payload_json["parameters"];
}
@@ -1262,12 +1285,12 @@ mod tests {
fn ed25519_current_reference_decodes_exact_component_sizes_and_padding() {
let input = replay_input(
kb_program_ids::ED25519_PROGRAM_ID,
- u16_current_payload(crate::SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"message", 7),
+ u16_current_payload(crate::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"message", 7),
vec![],
false,
);
- let result = crate::solana_core_precompiles_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_precompiles_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(parameters(&result)["padding"], 7);
assert_eq!(parameters(&result)["signature"]["length"], 64);
assert_eq!(parameters(&result)["publicKey"]["length"], 32);
@@ -1278,12 +1301,12 @@ mod tests {
fn secp256r1_current_reference_decodes_compressed_public_key() {
let input = replay_input(
kb_program_ids::SECP256R1_PROGRAM_ID,
- u16_current_payload(crate::SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES, b"r1", 11),
+ u16_current_payload(crate::DC_SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES, b"r1", 11),
vec![],
false,
);
- let result = crate::solana_core_precompiles_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_precompiles_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(parameters(&result)["padding"], 11);
assert_eq!(parameters(&result)["publicKey"]["length"], 33);
assert_eq!(parameters(&result)["signature"]["length"], 64);
@@ -1297,8 +1320,8 @@ mod tests {
vec![],
false,
);
- let result = crate::solana_core_precompiles_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_precompiles_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(parameters(&result)["recoveryId"], 2);
assert_eq!(parameters(&result)["ethereumAddress"]["length"], 20);
assert_eq!(parameters(&result)["rawInstructionIndexes"]["signatureInstructionIndex"], 1);
@@ -1308,10 +1331,10 @@ mod tests {
#[test]
fn all_precompiles_resolve_external_outer_instruction_data() {
let (ed_target, ed_external) =
- u16_external_payload(crate::SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"external");
+ u16_external_payload(crate::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"external");
let (k1_target, k1_external) = secp256k1_external_payload(b"external");
let (r1_target, r1_external) =
- u16_external_payload(crate::SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES, b"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),
@@ -1319,8 +1342,8 @@ mod tests {
];
for (program_id, target, external) in cases {
let input = replay_input(program_id, target, vec![(0, external)], false);
- let result = crate::solana_core_precompiles_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_precompiles_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(parameters(&result)["provenance"]["message"], "outer_instruction");
assert_eq!(
parameters(&result)["resolvedInstructionIndexes"]["messageInstructionIndex"],
@@ -1332,10 +1355,10 @@ mod tests {
#[test]
fn all_precompiles_support_mixed_component_references() {
let (ed_target, ed_external) =
- u16_mixed_payload(crate::SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES);
+ u16_mixed_payload(crate::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES);
let (k1_target, k1_external) = secp256k1_mixed_payload();
let (r1_target, r1_external) =
- u16_mixed_payload(crate::SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES);
+ 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),
@@ -1343,8 +1366,8 @@ mod tests {
];
for (program_id, target, external) in cases {
let input = replay_input(program_id, target, external, false);
- let result = crate::solana_core_precompiles_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_precompiles_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(parameters(&result)["provenance"]["signature"], "current_instruction");
assert_eq!(parameters(&result)["provenance"]["message"], "outer_instruction");
}
@@ -1355,17 +1378,17 @@ mod tests {
let cases = [
(
kb_program_ids::ED25519_PROGRAM_ID,
- two_u16_entries(crate::SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES),
+ two_u16_entries(crate::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES),
),
(
kb_program_ids::SECP256R1_PROGRAM_ID,
- two_u16_entries(crate::SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES),
+ two_u16_entries(crate::DC_SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES),
),
];
for (program_id, bytes) in cases {
let input = replay_input(program_id, bytes, vec![], false);
- let result = crate::solana_core_precompiles_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_precompiles_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(result.observations.len(), 2);
assert_eq!(result.observations[1].event_key, "signature_verification:1");
}
@@ -1379,8 +1402,8 @@ mod tests {
vec![],
false,
);
- let result = crate::solana_core_precompiles_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_precompiles_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(result.observations.len(), 2);
assert_eq!(parameters(&result)["entryCount"], 2);
assert_eq!(result.observations[1].payload_json["parameters"]["recoveryId"], 1);
@@ -1390,11 +1413,11 @@ mod tests {
fn empty_and_large_messages_are_hashed_without_full_message_retention() {
let empty_input = replay_input(
kb_program_ids::ED25519_PROGRAM_ID,
- u16_current_payload(crate::SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"", 0),
+ u16_current_payload(crate::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"", 0),
vec![],
false,
);
- let empty_result = crate::solana_core_precompiles_decode(&empty_input);
+ let empty_result = crate::decoder_solana_core_precompiles_decode(&empty_input);
assert_eq!(parameters(&empty_result)["message"]["length"], 0);
let large_message = vec![0xA5; 1_024];
let large_input = replay_input(
@@ -1403,38 +1426,38 @@ mod tests {
vec![],
false,
);
- let large_result = crate::solana_core_precompiles_decode(&large_input);
+ let large_result = crate::decoder_solana_core_precompiles_decode(&large_input);
assert_eq!(parameters(&large_result)["message"]["length"], 1_024);
assert!(parameters(&large_result)["message"].get("bytes").is_none());
assert_eq!(
parameters(&large_result)["message"]["sha256"],
- crate::solana_core_hash_bytes(large_message.as_slice())
+ crate::decoder_solana_core_hash_bytes(large_message.as_slice())
);
}
#[test]
fn official_zero_signature_rules_are_preserved() {
- let ed_result = crate::solana_core_precompiles_decode(&replay_input(
+ let ed_result = crate::decoder_solana_core_precompiles_decode(&replay_input(
kb_program_ids::ED25519_PROGRAM_ID,
vec![0, 9],
vec![],
false,
));
- let k1_result = crate::solana_core_precompiles_decode(&replay_input(
+ let k1_result = crate::decoder_solana_core_precompiles_decode(&replay_input(
kb_program_ids::SECP256K1_PROGRAM_ID,
vec![0],
vec![],
false,
));
- let r1_result = crate::solana_core_precompiles_decode(&replay_input(
+ let r1_result = crate::decoder_solana_core_precompiles_decode(&replay_input(
kb_program_ids::SECP256R1_PROGRAM_ID,
vec![0, 0],
vec![],
false,
));
- assert_eq!(ed_result.status, crate::DecoderOutcomeStatus::Decoded);
- assert_eq!(k1_result.status, crate::DecoderOutcomeStatus::Decoded);
- assert_eq!(r1_result.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(ed_result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
+ assert_eq!(k1_result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
+ assert_eq!(r1_result.status, crate::DcApiDecoderOutcomeStatus::Failed);
assert_eq!(parameters(&ed_result)["entryCount"], 0);
assert!(parameters(&k1_result).get("padding").is_none());
}
@@ -1450,13 +1473,13 @@ mod tests {
(kb_program_ids::SECP256R1_PROGRAM_ID, vec![1, 0, 1]),
];
for (program_id, bytes) in cases {
- let result = crate::solana_core_precompiles_decode(&replay_input(
+ let result = crate::decoder_solana_core_precompiles_decode(&replay_input(
program_id,
bytes,
vec![],
false,
));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Failed);
assert_eq!(result.diagnostics.len(), 1);
}
}
@@ -1469,13 +1492,13 @@ mod tests {
(kb_program_ids::SECP256R1_PROGRAM_ID, vec![9, 0]),
];
for (program_id, bytes) in cases {
- let result = crate::solana_core_precompiles_decode(&replay_input(
+ let result = crate::decoder_solana_core_precompiles_decode(&replay_input(
program_id,
bytes,
vec![],
false,
));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
}
@@ -1487,13 +1510,13 @@ mod tests {
(kb_program_ids::SECP256R1_PROGRAM_ID, malformed_u16_index()),
];
for (program_id, bytes) in cases {
- let result = crate::solana_core_precompiles_decode(&replay_input(
+ let result = crate::decoder_solana_core_precompiles_decode(&replay_input(
program_id,
bytes,
vec![],
false,
));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Failed);
assert!(result.diagnostics[0].message.contains("signatureCount=1"));
assert!(result.diagnostics[0].message.contains("entryIndex=0"));
assert!(result.diagnostics[0].message.contains("payloadSha256="));
@@ -1502,13 +1525,13 @@ mod tests {
#[test]
fn out_of_bounds_offsets_fail_for_all_precompiles() {
- let mut ed = u16_current_payload(crate::SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"x", 0);
+ let mut ed = u16_current_payload(crate::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"x", 0);
ed[2] = 0xFF;
ed[3] = 0xFF;
let mut k1 = secp256k1_current_payload(b"x");
k1[1] = 0xFF;
k1[2] = 0xFF;
- let mut r1 = u16_current_payload(crate::SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES, b"x", 0);
+ let mut r1 = u16_current_payload(crate::DC_SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES, b"x", 0);
r1[10] = 0xFF;
r1[11] = 0xFF;
let cases = [
@@ -1517,25 +1540,25 @@ mod tests {
(kb_program_ids::SECP256R1_PROGRAM_ID, r1),
];
for (program_id, bytes) in cases {
- let result = crate::solana_core_precompiles_decode(&replay_input(
+ let result = crate::decoder_solana_core_precompiles_decode(&replay_input(
program_id,
bytes,
vec![],
false,
));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
}
#[test]
fn out_of_bounds_message_lengths_fail_for_all_precompiles() {
- let mut ed = u16_current_payload(crate::SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"x", 0);
+ let mut ed = u16_current_payload(crate::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"x", 0);
ed[12] = 0xFF;
ed[13] = 0xFF;
let mut k1 = secp256k1_current_payload(b"x");
k1[9] = 0xFF;
k1[10] = 0xFF;
- let mut r1 = u16_current_payload(crate::SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES, b"x", 0);
+ let mut r1 = u16_current_payload(crate::DC_SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES, b"x", 0);
r1[12] = 0xFF;
r1[13] = 0xFF;
let cases = [
@@ -1544,29 +1567,30 @@ mod tests {
(kb_program_ids::SECP256R1_PROGRAM_ID, r1),
];
for (program_id, bytes) in cases {
- let result = crate::solana_core_precompiles_decode(&replay_input(
+ let result = crate::decoder_solana_core_precompiles_decode(&replay_input(
program_id,
bytes,
vec![],
false,
));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
}
#[test]
fn checked_slice_rejects_offset_length_addition_overflow() {
- let result = crate::solana_core_bounded_slice(&[1, 2, 3], usize::MAX, 1, "overflow test");
+ let result =
+ crate::decoder_solana_core_bounded_slice(&[1, 2, 3], usize::MAX, 1, "overflow test");
assert!(result.is_err());
}
#[test]
fn missing_or_invalid_external_base64_fails_for_all_precompiles() {
let (ed_target, ed_external) =
- u16_external_payload(crate::SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"external");
+ u16_external_payload(crate::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"external");
let (k1_target, k1_external) = secp256k1_external_payload(b"external");
let (r1_target, r1_external) =
- u16_external_payload(crate::SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES, b"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),
@@ -1576,13 +1600,13 @@ mod tests {
let mut missing =
replay_input(program_id, target.clone(), vec![(0, external.clone())], false);
missing.outer_instructions_json[0]["payloadJson"] = serde_json::Value::Null;
- let missing_result = crate::solana_core_precompiles_decode(&missing);
- assert_eq!(missing_result.status, crate::DecoderOutcomeStatus::Failed);
+ let missing_result = crate::decoder_solana_core_precompiles_decode(&missing);
+ assert_eq!(missing_result.status, crate::DcApiDecoderOutcomeStatus::Failed);
let mut invalid = replay_input(program_id, target, vec![(0, external)], false);
invalid.outer_instructions_json[0]["payloadJson"] =
serde_json::json!({"dataBase64": "%%%"});
- let invalid_result = crate::solana_core_precompiles_decode(&invalid);
- assert_eq!(invalid_result.status, crate::DecoderOutcomeStatus::Failed);
+ let invalid_result = crate::decoder_solana_core_precompiles_decode(&invalid);
+ assert_eq!(invalid_result.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
}
@@ -1592,13 +1616,13 @@ mod tests {
bytes[3] = u8::MAX;
bytes[6] = u8::MAX;
bytes[11] = u8::MAX;
- let result = crate::solana_core_precompiles_decode(&replay_input(
+ let result = crate::decoder_solana_core_precompiles_decode(&replay_input(
kb_program_ids::SECP256K1_PROGRAM_ID,
bytes,
vec![],
false,
));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Failed);
assert!(result.diagnostics[0].message.contains("outer instruction index is absent: 255"));
}
@@ -1606,12 +1630,12 @@ mod tests {
fn failed_transaction_is_decoded_without_commit_or_runtime_validity_claim() {
let input = replay_input(
kb_program_ids::ED25519_PROGRAM_ID,
- u16_current_payload(crate::SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"failed", 0),
+ u16_current_payload(crate::DC_SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES, b"failed", 0),
vec![],
true,
);
- let result = crate::solana_core_precompiles_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_precompiles_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!result.observations[0].observation_committed);
assert_eq!(parameters(&result)["runtimeVerification"], "not_asserted_transaction_failed");
assert_eq!(parameters(&result)["cryptographicReverificationPerformed"], false);
@@ -1621,25 +1645,25 @@ mod tests {
fn event_kind_and_serialization_are_stable() {
let input = replay_input(
kb_program_ids::SECP256R1_PROGRAM_ID,
- u16_current_payload(crate::SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES, b"stable", 0),
+ u16_current_payload(crate::DC_SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES, b"stable", 0),
vec![],
false,
);
- let first = crate::solana_core_precompiles_decode(&input);
- let second = crate::solana_core_precompiles_decode(&input);
+ let first = crate::decoder_solana_core_precompiles_decode(&input);
+ let second = crate::decoder_solana_core_precompiles_decode(&input);
assert_eq!(first, second);
assert_eq!(
first.observations[0].event.event_code.0,
"solana_native_secp256r1.signature_verification"
);
assert_eq!(parameters(&first)["runtimeVerification"], "accepted_in_successful_transaction");
- let decoded_bytes = match crate::solana_core_decode_instruction_data(&input) {
+ let decoded_bytes = match crate::decoder_solana_core_decode_instruction_data(&input) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => panic!("unexpected payload error: {error}"),
};
assert_eq!(
first.observations[0].payload_json["instructionDataSha256"],
- crate::solana_core_hash_bytes(decoded_bytes.as_slice())
+ crate::decoder_solana_core_hash_bytes(decoded_bytes.as_slice())
);
let first_json_result = serde_json::to_string(&first);
let first_json = match first_json_result {
@@ -1656,7 +1680,7 @@ mod tests {
#[test]
fn coverage_declares_exactly_three_signature_precompile_surfaces() {
- let coverage = crate::solana_core_precompiles_coverage();
+ let coverage = crate::decoder_solana_core_precompiles_coverage();
assert_eq!(coverage.len(), 3);
assert!(coverage.iter().all(|entry| return entry.entry_code == "signature_verification"));
}
diff --git a/kb-lib/src/decoder/solana/core/slashing.rs b/kb-lib/src/decoder/solana/core/slashing.rs
index a5b5b4c..40754f5 100644
--- a/kb-lib/src/decoder/solana/core/slashing.rs
+++ b/kb-lib/src/decoder/solana/core/slashing.rs
@@ -9,36 +9,37 @@ const DUPLICATE_BLOCK_PROOF_INSTRUCTION_BYTES: usize = 305;
const SIGNATURE_BYTES: usize = 64;
const HASH_BYTES: usize = 32;
const PUBKEY_BYTES: usize = 32;
-const CLOSE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("violation_report", true, false),
- crate::SolanaCoreAccountRole::new("destination", true, false),
+const CLOSE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("violation_report", true, false),
+ crate::DcSolanaCoreAccountRole::new("destination", true, false),
];
-const DUPLICATE_BLOCK_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("proof_account", false, false),
- crate::SolanaCoreAccountRole::new("violation_report", true, false),
- crate::SolanaCoreAccountRole::new("instructions_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("system_program", false, false),
+const DUPLICATE_BLOCK_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("proof_account", false, false),
+ crate::DcSolanaCoreAccountRole::new("violation_report", true, false),
+ crate::DcSolanaCoreAccountRole::new("instructions_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("system_program", false, false),
];
/// Returns declared Slashing Program instruction coverage.
-pub(crate) fn slashing_coverage() -> std::vec::Vec {
+pub(crate) fn decoder_solana_core_slashing_coverage()
+-> std::vec::Vec {
return vec![
- crate::DecoderCoverageDeclaration {
+ crate::DcApiDecoderCoverageDeclaration {
program_id: kb_program_ids::SLASHING_PROGRAM_ID.to_string(),
surface_code: std::option::Option::Some(
- crate::SOLANA_CORE_SLASHING_SURFACE_CODE.to_string(),
+ crate::DC_SOLANA_CORE_SLASHING_SURFACE_CODE.to_string(),
),
- entry_kind: crate::DecoderCoverageEntryKind::Instruction,
+ entry_kind: crate::DcApiDecoderCoverageEntryKind::Instruction,
entry_code: "close_violation_report".to_string(),
discriminator_hex: std::option::Option::Some("00".to_string()),
historical: false,
},
- crate::DecoderCoverageDeclaration {
+ crate::DcApiDecoderCoverageDeclaration {
program_id: kb_program_ids::SLASHING_PROGRAM_ID.to_string(),
surface_code: std::option::Option::Some(
- crate::SOLANA_CORE_SLASHING_SURFACE_CODE.to_string(),
+ crate::DC_SOLANA_CORE_SLASHING_SURFACE_CODE.to_string(),
),
- entry_kind: crate::DecoderCoverageEntryKind::Instruction,
+ entry_kind: crate::DcApiDecoderCoverageEntryKind::Instruction,
entry_code: "duplicate_block_proof".to_string(),
discriminator_hex: std::option::Option::Some("01".to_string()),
historical: false,
@@ -47,18 +48,18 @@ pub(crate) fn slashing_coverage() -> std::vec::Vec crate::DecoderRecognition {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+) -> crate::DcApiDecoderRecognition {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
- std::option::Option::Some(crate::SOLANA_CORE_SLASHING_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_SLASHING_SURFACE_CODE.to_string()),
std::option::Option::Some("malformed_slashing_instruction".to_string()),
std::option::Option::None,
);
@@ -72,24 +73,24 @@ pub(crate) fn slashing_recognize(
std::option::Option::Some(_value) => ("unknown_slashing_instruction", false),
std::option::Option::None => ("malformed_slashing_instruction", false),
};
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
exact,
priority,
- std::option::Option::Some(crate::SOLANA_CORE_SLASHING_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_SLASHING_SURFACE_CODE.to_string()),
std::option::Option::Some(entry_code.to_string()),
- crate::solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(1)),
+ crate::decoder_solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(1)),
);
}
/// Decodes one Slashing Program instruction.
-pub(crate) fn slashing_decode(
- input: &crate::CoreInstructionReplayInput,
-) -> crate::DecoderExecutionResult {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+pub(crate) fn decoder_solana_core_slashing_decode(
+ input: &crate::MdCoreInstructionReplayInput,
+) -> crate::DcApiDecoderExecutionResult {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_slashing_instruction"),
"slashing_payload_invalid",
error.to_string(),
@@ -99,7 +100,7 @@ pub(crate) fn slashing_decode(
let tag = match bytes.first() {
std::option::Option::Some(value) => *value,
std::option::Option::None => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_slashing_instruction"),
"slashing_payload_empty",
"Slashing Program instruction payload is empty",
@@ -109,45 +110,49 @@ pub(crate) fn slashing_decode(
return match tag {
0 => decode_close_violation_report(input, bytes.as_slice()),
1 => decode_duplicate_block_proof(input, bytes.as_slice()),
- _ => crate::solana_core_unsupported_result(
+ _ => crate::decoder_solana_core_unsupported_result(
"unknown_slashing_instruction",
"slashing_tag_unknown",
format!(
"unknown Slashing Program instruction tag {tag}; payload_sha256={}",
- crate::solana_core_payload_hash(input)
+ crate::decoder_solana_core_payload_hash(input)
),
),
};
}
fn decode_close_violation_report(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
if bytes.len() != 1 {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("close_violation_report"),
"slashing_close_size_invalid",
format!("close_violation_report requires exactly 1 byte but received {}", bytes.len()),
);
}
- let accounts_result =
- crate::solana_core_resolve_accounts(input, CLOSE_ROLES, 2, std::option::Option::None);
+ let accounts_result = crate::decoder_solana_core_resolve_accounts(
+ input,
+ CLOSE_ROLES,
+ 2,
+ std::option::Option::None,
+ );
let accounts = match accounts_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("close_violation_report"),
"slashing_close_accounts_invalid",
error.to_string(),
);
},
};
- return crate::solana_core_decoded_result(
+ return crate::decoder_solana_core_decoded_result(
input,
- crate::SOLANA_CORE_SLASHING_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_SLASHING_SURFACE_CODE,
"close_violation_report",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
false,
accounts,
serde_json::json!({
@@ -164,11 +169,11 @@ fn decode_close_violation_report(
}
fn decode_duplicate_block_proof(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
if bytes.len() != DUPLICATE_BLOCK_PROOF_INSTRUCTION_BYTES {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("duplicate_block_proof"),
"slashing_duplicate_block_size_invalid",
format!(
@@ -178,7 +183,7 @@ fn decode_duplicate_block_proof(
),
);
}
- let accounts_result = crate::solana_core_resolve_accounts(
+ let accounts_result = crate::decoder_solana_core_resolve_accounts(
input,
DUPLICATE_BLOCK_ROLES,
4,
@@ -187,7 +192,7 @@ fn decode_duplicate_block_proof(
let accounts = match accounts_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("duplicate_block_proof"),
"slashing_duplicate_block_accounts_invalid",
error.to_string(),
@@ -196,7 +201,7 @@ fn decode_duplicate_block_proof(
};
let fixed_accounts_result = validate_duplicate_block_fixed_accounts(&accounts);
if let std::result::Result::Err(error) = fixed_accounts_result {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("duplicate_block_proof"),
"slashing_duplicate_block_fixed_account_invalid",
error.to_string(),
@@ -206,18 +211,18 @@ fn decode_duplicate_block_proof(
let parameters = match parsed_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("duplicate_block_proof"),
"slashing_duplicate_block_data_invalid",
error.to_string(),
);
},
};
- return crate::solana_core_decoded_result(
+ return crate::decoder_solana_core_decoded_result(
input,
- crate::SOLANA_CORE_SLASHING_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_SLASHING_SURFACE_CODE,
"duplicate_block_proof",
- crate::EventFamily::Audit,
+ crate::MdEventFamily::Audit,
false,
accounts,
parameters,
@@ -226,15 +231,15 @@ fn decode_duplicate_block_proof(
}
fn parse_duplicate_block_parameters(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
) -> kb_core::Result {
- let offset_result = crate::solana_core_read_u64_le(bytes, 1);
+ let offset_result = crate::decoder_solana_core_read_u64_le(bytes, 1);
let offset = match offset_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let slot_result = crate::solana_core_read_u64_le(bytes, 9);
+ let slot_result = crate::decoder_solana_core_read_u64_le(bytes, 9);
let slot = match slot_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
@@ -254,7 +259,7 @@ fn parse_duplicate_block_parameters(
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let shred_1_root_result = crate::solana_core_bounded_slice(
+ let shred_1_root_result = crate::decoder_solana_core_bounded_slice(
bytes,
113,
HASH_BYTES,
@@ -264,7 +269,7 @@ fn parse_duplicate_block_parameters(
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let shred_1_signature_result = crate::solana_core_bounded_slice(
+ let shred_1_signature_result = crate::decoder_solana_core_bounded_slice(
bytes,
145,
SIGNATURE_BYTES,
@@ -274,7 +279,7 @@ fn parse_duplicate_block_parameters(
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let shred_2_root_result = crate::solana_core_bounded_slice(
+ let shred_2_root_result = crate::decoder_solana_core_bounded_slice(
bytes,
209,
HASH_BYTES,
@@ -284,7 +289,7 @@ fn parse_duplicate_block_parameters(
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
- let shred_2_signature_result = crate::solana_core_bounded_slice(
+ let shred_2_signature_result = crate::decoder_solana_core_bounded_slice(
bytes,
241,
SIGNATURE_BYTES,
@@ -354,7 +359,7 @@ fn validate_duplicate_block_fixed_accounts(accounts: &serde_json::Value) -> kb_c
}
fn read_pubkey(bytes: &[u8], offset: usize, label: &str) -> kb_core::Result {
- let slice_result = crate::solana_core_bounded_slice(bytes, offset, PUBKEY_BYTES, label);
+ let slice_result = crate::decoder_solana_core_bounded_slice(bytes, offset, PUBKEY_BYTES, label);
return match slice_result {
std::result::Result::Ok(value) => {
std::result::Result::Ok(bs58::encode(value).into_string())
@@ -366,24 +371,24 @@ fn read_pubkey(bytes: &[u8], offset: usize, label: &str) -> kb_core::Result serde_json::Value {
return serde_json::json!({
"length": bytes.len(),
- "hex": crate::solana_core_bounded_hexadecimal_prefix(bytes, bytes.len()),
- "sha256": crate::solana_core_hash_bytes(bytes),
+ "hex": crate::decoder_solana_core_bounded_hexadecimal_prefix(bytes, bytes.len()),
+ "sha256": crate::decoder_solana_core_hash_bytes(bytes),
});
}
fn signature_summary(bytes: &[u8]) -> serde_json::Value {
return serde_json::json!({
"length": bytes.len(),
- "prefixHex": crate::solana_core_bounded_hexadecimal_prefix(
+ "prefixHex": crate::decoder_solana_core_bounded_hexadecimal_prefix(
bytes,
- crate::SOLANA_CORE_PRECOMPILE_COMPONENT_PREFIX_BYTES,
+ crate::DC_SOLANA_CORE_PRECOMPILE_COMPONENT_PREFIX_BYTES,
),
- "sha256": crate::solana_core_hash_bytes(bytes),
+ "sha256": crate::decoder_solana_core_hash_bytes(bytes),
});
}
-fn preceding_ed25519_instruction(input: &crate::CoreInstructionReplayInput) -> serde_json::Value {
- let target_index = match crate::solana_core_target_outer_instruction_index(input) {
+fn preceding_ed25519_instruction(input: &crate::MdCoreInstructionReplayInput) -> serde_json::Value {
+ let target_index = match crate::decoder_solana_core_target_outer_instruction_index(input) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
return serde_json::json!({
@@ -438,7 +443,7 @@ fn preceding_ed25519_instruction(input: &crate::CoreInstructionReplayInput) -> s
}
fn runtime_mutation(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
successful_value: &'static str,
) -> &'static str {
return if input.transaction_failed {
@@ -470,7 +475,7 @@ mod tests {
bytes: &[u8],
transaction_failed: bool,
instruction_path: &str,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
let keys = [
"Proof1111111111111111111111111111111111111",
"Report111111111111111111111111111111111111",
@@ -518,7 +523,7 @@ mod tests {
"payloadHash": "slashing-hash"
}
]);
- let result = crate::CoreInstructionReplayInput::new(
+ let result = crate::MdCoreInstructionReplayInput::new(
format!("signature:{instruction_path}"),
"signature",
42,
@@ -547,7 +552,7 @@ mod tests {
};
}
- fn close_replay_input(transaction_failed: bool) -> crate::CoreInstructionReplayInput {
+ fn close_replay_input(transaction_failed: bool) -> crate::MdCoreInstructionReplayInput {
let mut input = replay_input(&[0], transaction_failed, "0");
input.account_keys_json = serde_json::json!([
{
@@ -576,7 +581,7 @@ mod tests {
#[test]
fn coverage_declares_exactly_two_official_instructions() {
- let coverage = crate::solana_core_slashing_coverage();
+ let coverage = crate::decoder_solana_core_slashing_coverage();
assert_eq!(coverage.len(), 2);
assert_eq!(coverage[0].entry_code, "close_violation_report");
assert_eq!(coverage[1].entry_code, "duplicate_block_proof");
@@ -584,8 +589,8 @@ mod tests {
#[test]
fn close_violation_report_decodes_exact_runtime_contract() {
- let result = crate::solana_core_slashing_decode(&close_replay_input(false));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_slashing_decode(&close_replay_input(false));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some("close_violation_report")
@@ -602,9 +607,12 @@ mod tests {
fn duplicate_block_proof_decodes_exact_official_layout() {
let payload = duplicate_payload();
assert_eq!(payload.len(), super::DUPLICATE_BLOCK_PROOF_INSTRUCTION_BYTES);
- let result =
- crate::solana_core_slashing_decode(&replay_input(payload.as_slice(), false, "2"));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_slashing_decode(&replay_input(
+ payload.as_slice(),
+ false,
+ "2",
+ ));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
let parameters = &result.observations[0].payload_json["parameters"];
assert_eq!(parameters["proofAccountOffset"], 34);
assert_eq!(parameters["violationSlot"], 42);
@@ -620,7 +628,7 @@ mod tests {
#[test]
fn duplicate_block_proof_reports_preceding_ed25519_context() {
- let result = crate::solana_core_slashing_decode(&replay_input(
+ let result = crate::decoder_solana_core_slashing_decode(&replay_input(
duplicate_payload().as_slice(),
false,
"2",
@@ -636,12 +644,15 @@ mod tests {
#[test]
fn malformed_unknown_and_trailing_payloads_fail_safely() {
for bytes in [vec![], vec![0, 7], vec![1, 2, 3]] {
- let result =
- crate::solana_core_slashing_decode(&replay_input(bytes.as_slice(), false, "2"));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Failed);
+ let result = crate::decoder_solana_core_slashing_decode(&replay_input(
+ bytes.as_slice(),
+ false,
+ "2",
+ ));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
- let unknown = crate::solana_core_slashing_decode(&replay_input(&[9], false, "2"));
- assert_eq!(unknown.status, crate::DecoderOutcomeStatus::Unsupported);
+ let unknown = crate::decoder_solana_core_slashing_decode(&replay_input(&[9], false, "2"));
+ assert_eq!(unknown.status, crate::DcApiDecoderOutcomeStatus::Unsupported);
}
#[test]
@@ -649,18 +660,18 @@ mod tests {
let mut input = replay_input(duplicate_payload().as_slice(), false, "2");
input.instruction_accounts_json[2]["accountKey"] = serde_json::json!("wrong");
input.account_keys_json[2]["accountKey"] = serde_json::json!("wrong");
- let result = crate::solana_core_slashing_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Failed);
+ let result = crate::decoder_solana_core_slashing_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn failed_transaction_is_decoded_without_runtime_or_mutation_claim() {
- let result = crate::solana_core_slashing_decode(&replay_input(
+ let result = crate::decoder_solana_core_slashing_decode(&replay_input(
duplicate_payload().as_slice(),
true,
"2",
));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!result.observations[0].observation_committed);
let parameters = &result.observations[0].payload_json["parameters"];
assert_eq!(parameters["runtimeVerification"], "not_asserted_transaction_failed");
@@ -670,8 +681,8 @@ mod tests {
#[test]
fn serialization_is_deterministic() {
let input = replay_input(duplicate_payload().as_slice(), false, "2");
- let first = crate::solana_core_slashing_decode(&input);
- let second = crate::solana_core_slashing_decode(&input);
+ let first = crate::decoder_solana_core_slashing_decode(&input);
+ let second = crate::decoder_solana_core_slashing_decode(&input);
let first_json = match serde_json::to_string(&first) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => panic!("first serialization failed: {error}"),
diff --git a/kb-lib/src/decoder/solana/core/stake.rs b/kb-lib/src/decoder/solana/core/stake.rs
index e87964f..9200179 100644
--- a/kb-lib/src/decoder/solana/core/stake.rs
+++ b/kb-lib/src/decoder/solana/core/stake.rs
@@ -56,13 +56,14 @@ struct LockupCheckedArgsWire {
}
struct AccountContract {
- roles: std::vec::Vec,
+ roles: std::vec::Vec,
minimum_count: usize,
account_layout: &'static str,
}
/// Returns declared Stake Program instruction coverage.
-pub(crate) fn stake_coverage() -> std::vec::Vec {
+pub(crate) fn decoder_solana_core_stake_coverage()
+-> std::vec::Vec {
let entries = [
("initialize", 0_u32, false),
("authorize", 1_u32, false),
@@ -86,12 +87,12 @@ pub(crate) fn stake_coverage() -> std::vec::Vec std::vec::Vec crate::DecoderRecognition {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+) -> crate::DcApiDecoderRecognition {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
- std::option::Option::Some(crate::SOLANA_CORE_STAKE_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_STAKE_SURFACE_CODE.to_string()),
std::option::Option::Some("malformed_stake_instruction".to_string()),
std::option::Option::None,
);
},
};
- let tag_result = crate::solana_core_read_u32_le(bytes.as_slice(), 0);
+ let tag_result = crate::decoder_solana_core_read_u32_le(bytes.as_slice(), 0);
let tag = match tag_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
- std::option::Option::Some(crate::SOLANA_CORE_STAKE_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_STAKE_SURFACE_CODE.to_string()),
std::option::Option::Some("malformed_stake_instruction".to_string()),
- crate::solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(4)),
+ crate::decoder_solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(4)),
);
},
};
let entry_code = entry_code(tag);
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
entry_code.is_some(),
priority,
- std::option::Option::Some(crate::SOLANA_CORE_STAKE_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_STAKE_SURFACE_CODE.to_string()),
entry_code.map(str::to_string).or_else(|| {
return std::option::Option::Some("unknown_stake_instruction".to_string());
}),
@@ -144,25 +145,25 @@ pub(crate) fn stake_recognize(
}
/// Decodes one Stake Program instruction.
-pub(crate) fn stake_decode(
- input: &crate::CoreInstructionReplayInput,
-) -> crate::DecoderExecutionResult {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+pub(crate) fn decoder_solana_core_stake_decode(
+ input: &crate::MdCoreInstructionReplayInput,
+) -> crate::DcApiDecoderExecutionResult {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_stake_instruction"),
"stake_payload_invalid",
error.to_string(),
);
},
};
- let tag_result = crate::solana_core_read_u32_le(bytes.as_slice(), 0);
+ let tag_result = crate::decoder_solana_core_read_u32_le(bytes.as_slice(), 0);
let tag = match tag_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_stake_instruction"),
"stake_tag_truncated",
error.to_string(),
@@ -172,12 +173,12 @@ pub(crate) fn stake_decode(
let entry_code = match entry_code(tag) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::solana_core_unsupported_result(
+ return crate::decoder_solana_core_unsupported_result(
"unknown_stake_instruction",
"stake_tag_unknown",
format!(
"unknown Stake Program instruction tag {tag}; payload_sha256={}",
- crate::solana_core_payload_hash(input)
+ crate::decoder_solana_core_payload_hash(input)
),
);
},
@@ -186,7 +187,7 @@ pub(crate) fn stake_decode(
let instruction = match instruction_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"stake_wincode_invalid",
format!("cannot decode exact Stake Program {entry_code}: {error}"),
@@ -197,14 +198,14 @@ pub(crate) fn stake_decode(
}
fn decoded_instruction(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
instruction: StakeInstructionWire,
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
return match instruction {
StakeInstructionWire::Initialize(authorized, lockup) => build(
input,
"initialize",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
false,
contract(input, "initialize"),
serde_json::json!({
@@ -215,7 +216,7 @@ fn decoded_instruction(
StakeInstructionWire::Authorize(new_authority, authorization_type) => build(
input,
"authorize",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
false,
contract(input, "authorize"),
serde_json::json!({
@@ -226,7 +227,7 @@ fn decoded_instruction(
StakeInstructionWire::DelegateStake => build(
input,
"delegate_stake",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
false,
contract(input, "delegate_stake"),
serde_json::json!({}),
@@ -234,7 +235,7 @@ fn decoded_instruction(
StakeInstructionWire::Split(lamports) => build(
input,
"split",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
false,
contract(input, "split"),
serde_json::json!({"lamports": lamports}),
@@ -242,7 +243,7 @@ fn decoded_instruction(
StakeInstructionWire::Withdraw(lamports) => build(
input,
"withdraw",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
false,
contract(input, "withdraw"),
serde_json::json!({"lamports": lamports}),
@@ -250,7 +251,7 @@ fn decoded_instruction(
StakeInstructionWire::Deactivate => build(
input,
"deactivate",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
false,
contract(input, "deactivate"),
serde_json::json!({}),
@@ -258,7 +259,7 @@ fn decoded_instruction(
StakeInstructionWire::SetLockup(value) => build(
input,
"set_lockup",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
false,
contract(input, "set_lockup"),
lockup_args_json(value),
@@ -266,7 +267,7 @@ fn decoded_instruction(
StakeInstructionWire::Merge => build(
input,
"merge",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
false,
contract(input, "merge"),
serde_json::json!({}),
@@ -274,7 +275,7 @@ fn decoded_instruction(
StakeInstructionWire::AuthorizeWithSeed(value) => build(
input,
"authorize_with_seed",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
false,
contract(input, "authorize_with_seed"),
serde_json::json!({
@@ -287,7 +288,7 @@ fn decoded_instruction(
StakeInstructionWire::InitializeChecked => build(
input,
"initialize_checked",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
false,
contract(input, "initialize_checked"),
serde_json::json!({
@@ -298,7 +299,7 @@ fn decoded_instruction(
StakeInstructionWire::AuthorizeChecked(authorization_type) => build(
input,
"authorize_checked",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
false,
contract(input, "authorize_checked"),
serde_json::json!({
@@ -309,7 +310,7 @@ fn decoded_instruction(
StakeInstructionWire::AuthorizeCheckedWithSeed(value) => build(
input,
"authorize_checked_with_seed",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
false,
contract(input, "authorize_checked_with_seed"),
serde_json::json!({
@@ -322,7 +323,7 @@ fn decoded_instruction(
StakeInstructionWire::SetLockupChecked(value) => build(
input,
"set_lockup_checked",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
false,
contract(input, "set_lockup_checked"),
lockup_checked_args_json(value),
@@ -330,7 +331,7 @@ fn decoded_instruction(
StakeInstructionWire::GetMinimumDelegation => build(
input,
"get_minimum_delegation",
- crate::EventFamily::Audit,
+ crate::MdEventFamily::Audit,
false,
contract(input, "get_minimum_delegation"),
serde_json::json!({
@@ -341,7 +342,7 @@ fn decoded_instruction(
StakeInstructionWire::DeactivateDelinquent => build(
input,
"deactivate_delinquent",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
false,
contract(input, "deactivate_delinquent"),
serde_json::json!({}),
@@ -349,7 +350,7 @@ fn decoded_instruction(
StakeInstructionWire::Redelegate => build(
input,
"redelegate",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
true,
contract(input, "redelegate"),
serde_json::json!({
@@ -360,7 +361,7 @@ fn decoded_instruction(
StakeInstructionWire::MoveStake(lamports) => build(
input,
"move_stake",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
false,
contract(input, "move_stake"),
serde_json::json!({"lamports": lamports}),
@@ -368,7 +369,7 @@ fn decoded_instruction(
StakeInstructionWire::MoveLamports(lamports) => build(
input,
"move_lamports",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
false,
contract(input, "move_lamports"),
serde_json::json!({"lamports": lamports}),
@@ -377,14 +378,14 @@ fn decoded_instruction(
}
fn build(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
entry_code: &str,
- event_family: crate::EventFamily,
+ event_family: crate::MdEventFamily,
historical: bool,
contract: AccountContract,
mut parameters: serde_json::Value,
-) -> crate::DecoderExecutionResult {
- let accounts_result = crate::solana_core_resolve_accounts(
+) -> crate::DcApiDecoderExecutionResult {
+ let accounts_result = crate::decoder_solana_core_resolve_accounts(
input,
contract.roles.as_slice(),
contract.minimum_count,
@@ -393,7 +394,7 @@ fn build(
let accounts = match accounts_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"stake_accounts_invalid",
error.to_string(),
@@ -406,9 +407,9 @@ fn build(
serde_json::Value::String(contract.account_layout.to_string()),
);
}
- return crate::solana_core_decoded_result(
+ return crate::decoder_solana_core_decoded_result(
input,
- crate::SOLANA_CORE_STAKE_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_STAKE_SURFACE_CODE,
entry_code,
event_family,
historical,
@@ -418,7 +419,7 @@ fn build(
);
}
-fn contract(input: &crate::CoreInstructionReplayInput, entry_code: &str) -> AccountContract {
+fn contract(input: &crate::MdCoreInstructionReplayInput, entry_code: &str) -> AccountContract {
return match entry_code {
"initialize" => {
if account_key(input, 1)
@@ -426,15 +427,15 @@ fn contract(input: &crate::CoreInstructionReplayInput, entry_code: &str) -> Acco
{
AccountContract {
roles: vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("rent_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("rent_sysvar", false, false),
],
minimum_count: 1,
account_layout: "legacy_rent_compatibility",
}
} else {
AccountContract {
- roles: vec![crate::SolanaCoreAccountRole::new("stake_account", true, false)],
+ roles: vec![crate::DcSolanaCoreAccountRole::new("stake_account", true, false)],
minimum_count: 1,
account_layout: "runtime_minimal",
}
@@ -444,16 +445,16 @@ fn contract(input: &crate::CoreInstructionReplayInput, entry_code: &str) -> Acco
input,
1,
vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("clock_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("current_authority", false, true),
- crate::SolanaCoreAccountRole::new("lockup_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("clock_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("current_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("lockup_authority", false, true),
],
3,
vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("current_authority", false, true),
- crate::SolanaCoreAccountRole::new("lockup_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("current_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("lockup_authority", false, true),
],
2,
),
@@ -461,30 +462,30 @@ fn contract(input: &crate::CoreInstructionReplayInput, entry_code: &str) -> Acco
input,
2,
vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("vote_account", false, false),
- crate::SolanaCoreAccountRole::new("clock_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("stake_history_sysvar", false, false),
- crate::SolanaCoreAccountRole::new(
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("vote_account", false, false),
+ crate::DcSolanaCoreAccountRole::new("clock_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("stake_history_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new(
"unused_stake_config_compatibility_account",
false,
false,
),
- crate::SolanaCoreAccountRole::new("stake_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_authority", false, true),
],
5,
vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("vote_account", false, false),
- crate::SolanaCoreAccountRole::new("stake_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("vote_account", false, false),
+ crate::DcSolanaCoreAccountRole::new("stake_authority", false, true),
],
3,
),
"split" => AccountContract {
roles: vec![
- crate::SolanaCoreAccountRole::new("source_stake_account", true, false),
- crate::SolanaCoreAccountRole::new("destination_stake_account", true, false),
- crate::SolanaCoreAccountRole::new("stake_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("source_stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("destination_stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("stake_authority", false, true),
],
minimum_count: 2,
account_layout: "runtime_legacy_lax",
@@ -493,19 +494,19 @@ fn contract(input: &crate::CoreInstructionReplayInput, entry_code: &str) -> Acco
input,
2,
vec![
- crate::SolanaCoreAccountRole::new("source_stake_account", true, false),
- crate::SolanaCoreAccountRole::new("recipient_account", true, false),
- crate::SolanaCoreAccountRole::new("clock_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("stake_history_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("withdraw_authority", false, true),
- crate::SolanaCoreAccountRole::new("lockup_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("source_stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("recipient_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("clock_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("stake_history_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("withdraw_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("lockup_authority", false, true),
],
5,
vec![
- crate::SolanaCoreAccountRole::new("source_stake_account", true, false),
- crate::SolanaCoreAccountRole::new("recipient_account", true, false),
- crate::SolanaCoreAccountRole::new("withdraw_authority", false, true),
- crate::SolanaCoreAccountRole::new("lockup_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("source_stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("recipient_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("withdraw_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("lockup_authority", false, true),
],
3,
),
@@ -513,21 +514,21 @@ fn contract(input: &crate::CoreInstructionReplayInput, entry_code: &str) -> Acco
input,
1,
vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("clock_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("stake_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("clock_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("stake_authority", false, true),
],
2,
vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("stake_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("stake_authority", false, true),
],
2,
),
"set_lockup" => AccountContract {
roles: vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("lockup_or_withdraw_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("lockup_or_withdraw_authority", false, true),
],
minimum_count: 1,
account_layout: "runtime_legacy_lax",
@@ -536,17 +537,17 @@ fn contract(input: &crate::CoreInstructionReplayInput, entry_code: &str) -> Acco
input,
2,
vec![
- crate::SolanaCoreAccountRole::new("destination_stake_account", true, false),
- crate::SolanaCoreAccountRole::new("source_stake_account", true, false),
- crate::SolanaCoreAccountRole::new("clock_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("stake_history_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("stake_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("destination_stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("source_stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("clock_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("stake_history_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("stake_authority", false, true),
],
4,
vec![
- crate::SolanaCoreAccountRole::new("destination_stake_account", true, false),
- crate::SolanaCoreAccountRole::new("source_stake_account", true, false),
- crate::SolanaCoreAccountRole::new("stake_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("destination_stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("source_stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("stake_authority", false, true),
],
3,
),
@@ -554,16 +555,16 @@ fn contract(input: &crate::CoreInstructionReplayInput, entry_code: &str) -> Acco
input,
2,
vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("authority_base", false, true),
- crate::SolanaCoreAccountRole::new("clock_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("lockup_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("authority_base", false, true),
+ crate::DcSolanaCoreAccountRole::new("clock_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("lockup_authority", false, true),
],
3,
vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("authority_base", false, true),
- crate::SolanaCoreAccountRole::new("lockup_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("authority_base", false, true),
+ crate::DcSolanaCoreAccountRole::new("lockup_authority", false, true),
],
2,
),
@@ -573,10 +574,10 @@ fn contract(input: &crate::CoreInstructionReplayInput, entry_code: &str) -> Acco
{
AccountContract {
roles: vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("rent_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("stake_authority", false, false),
- crate::SolanaCoreAccountRole::new("withdraw_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("rent_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("stake_authority", false, false),
+ crate::DcSolanaCoreAccountRole::new("withdraw_authority", false, true),
],
minimum_count: 4,
account_layout: "legacy_sysvar",
@@ -584,9 +585,9 @@ fn contract(input: &crate::CoreInstructionReplayInput, entry_code: &str) -> Acco
} else {
AccountContract {
roles: vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("stake_authority", false, false),
- crate::SolanaCoreAccountRole::new("withdraw_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("stake_authority", false, false),
+ crate::DcSolanaCoreAccountRole::new("withdraw_authority", false, true),
],
minimum_count: 3,
account_layout: "runtime_strict",
@@ -597,18 +598,18 @@ fn contract(input: &crate::CoreInstructionReplayInput, entry_code: &str) -> Acco
input,
1,
vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("clock_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("current_authority", false, true),
- crate::SolanaCoreAccountRole::new("new_authority", false, true),
- crate::SolanaCoreAccountRole::new("lockup_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("clock_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("current_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("new_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("lockup_authority", false, true),
],
4,
vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("current_authority", false, true),
- crate::SolanaCoreAccountRole::new("new_authority", false, true),
- crate::SolanaCoreAccountRole::new("lockup_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("current_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("new_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("lockup_authority", false, true),
],
3,
),
@@ -616,26 +617,26 @@ fn contract(input: &crate::CoreInstructionReplayInput, entry_code: &str) -> Acco
input,
2,
vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("authority_base", false, true),
- crate::SolanaCoreAccountRole::new("clock_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("new_authority", false, true),
- crate::SolanaCoreAccountRole::new("lockup_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("authority_base", false, true),
+ crate::DcSolanaCoreAccountRole::new("clock_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("new_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("lockup_authority", false, true),
],
4,
vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("authority_base", false, true),
- crate::SolanaCoreAccountRole::new("new_authority", false, true),
- crate::SolanaCoreAccountRole::new("lockup_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("authority_base", false, true),
+ crate::DcSolanaCoreAccountRole::new("new_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("lockup_authority", false, true),
],
3,
),
"set_lockup_checked" => AccountContract {
roles: vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("lockup_or_withdraw_authority", false, true),
- crate::SolanaCoreAccountRole::new("new_lockup_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("lockup_or_withdraw_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("new_lockup_authority", false, true),
],
minimum_count: 1,
account_layout: "runtime_legacy_lax",
@@ -647,33 +648,33 @@ fn contract(input: &crate::CoreInstructionReplayInput, entry_code: &str) -> Acco
},
"deactivate_delinquent" => AccountContract {
roles: vec![
- crate::SolanaCoreAccountRole::new("stake_account", true, false),
- crate::SolanaCoreAccountRole::new("delinquent_vote_account", false, false),
- crate::SolanaCoreAccountRole::new("reference_vote_account", false, false),
+ crate::DcSolanaCoreAccountRole::new("stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("delinquent_vote_account", false, false),
+ crate::DcSolanaCoreAccountRole::new("reference_vote_account", false, false),
],
minimum_count: 3,
account_layout: "runtime_strict",
},
"redelegate" => AccountContract {
roles: vec![
- crate::SolanaCoreAccountRole::new("source_stake_account", true, false),
- crate::SolanaCoreAccountRole::new("destination_stake_account", true, false),
- crate::SolanaCoreAccountRole::new("vote_account", false, false),
- crate::SolanaCoreAccountRole::new(
+ crate::DcSolanaCoreAccountRole::new("source_stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("destination_stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("vote_account", false, false),
+ crate::DcSolanaCoreAccountRole::new(
"unused_stake_config_compatibility_account",
false,
false,
),
- crate::SolanaCoreAccountRole::new("stake_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("stake_authority", false, true),
],
minimum_count: 0,
account_layout: "disabled_before_account_processing",
},
"move_stake" | "move_lamports" => AccountContract {
roles: vec![
- crate::SolanaCoreAccountRole::new("source_stake_account", true, false),
- crate::SolanaCoreAccountRole::new("destination_stake_account", true, false),
- crate::SolanaCoreAccountRole::new("stake_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("source_stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("destination_stake_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("stake_authority", false, true),
],
minimum_count: 3,
account_layout: "runtime_strict",
@@ -687,11 +688,11 @@ fn contract(input: &crate::CoreInstructionReplayInput, entry_code: &str) -> Acco
}
fn clock_branch_contract(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
branch_position: usize,
- legacy_roles: std::vec::Vec,
+ legacy_roles: std::vec::Vec,
legacy_minimum_count: usize,
- current_roles: std::vec::Vec,
+ current_roles: std::vec::Vec,
current_minimum_count: usize,
) -> AccountContract {
if account_key(input, branch_position)
@@ -711,7 +712,7 @@ fn clock_branch_contract(
}
fn account_key(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
position: usize,
) -> std::option::Option<&str> {
return input
@@ -1010,7 +1011,7 @@ mod tests {
instruction: &super::StakeInstructionWire,
account_keys: &[std::string::String],
transaction_failed: bool,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
let bytes_result = wincode::serialize(instruction);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
@@ -1025,7 +1026,7 @@ mod tests {
bytes: &[u8],
account_keys: &[std::string::String],
transaction_failed: bool,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
let resolved_keys = account_keys
.iter()
.enumerate()
@@ -1050,7 +1051,7 @@ mod tests {
});
})
.collect::>();
- let result = crate::CoreInstructionReplayInput::new(
+ let result = crate::MdCoreInstructionReplayInput::new(
"signature:0",
"signature",
42,
@@ -1081,7 +1082,7 @@ mod tests {
#[test]
fn coverage_declares_every_official_stake_instruction() {
- let coverage = crate::solana_core_stake_coverage();
+ let coverage = crate::decoder_solana_core_stake_coverage();
assert_eq!(coverage.len(), 18);
for tag in 0_u32..18_u32 {
let expected = super::tag_hex(tag);
@@ -1152,8 +1153,8 @@ mod tests {
fixture.account_keys.as_slice(),
fixture.transaction_failed,
);
- let result = crate::solana_core_stake_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_stake_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some(fixture.entry_code)
@@ -1175,12 +1176,12 @@ mod tests {
"Authority5".to_string(),
];
let current_keys = ["Stake0".to_string(), "Vote1".to_string(), "Authority2".to_string()];
- let legacy = crate::solana_core_stake_decode(&replay_input(
+ let legacy = crate::decoder_solana_core_stake_decode(&replay_input(
&instruction,
legacy_keys.as_slice(),
false,
));
- let current = crate::solana_core_stake_decode(&replay_input(
+ let current = crate::decoder_solana_core_stake_decode(&replay_input(
&instruction,
current_keys.as_slice(),
false,
@@ -1258,12 +1259,12 @@ mod tests {
];
for (instruction, keys) in fixtures {
let account_keys = keys.into_iter().map(str::to_string).collect::>();
- let result = crate::solana_core_stake_decode(&replay_input(
+ let result = crate::decoder_solana_core_stake_decode(&replay_input(
&instruction,
account_keys.as_slice(),
false,
));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.observations[0].payload_json["parameters"]["accountLayout"],
if matches!(instruction, super::StakeInstructionWire::Initialize(_, _)) {
@@ -1279,8 +1280,8 @@ mod tests {
fn deprecated_redelegate_is_an_uncommitted_historical_intent() {
let instruction = super::StakeInstructionWire::Redelegate;
let input = replay_input(&instruction, &[], true);
- let result = crate::solana_core_stake_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_stake_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!result.observations[0].observation_committed);
assert_eq!(result.observations[0].payload_json["historical"], true);
assert_eq!(result.observations[0].payload_json["parameters"]["officiallyDisabled"], true);
@@ -1294,9 +1295,12 @@ mod tests {
fn failed_stake_instruction_is_decoded_as_uncommitted_intent() {
let instruction = super::StakeInstructionWire::MoveStake(42);
let keys = ["Stake0".to_string(), "Stake1".to_string(), "Authority2".to_string()];
- let result =
- crate::solana_core_stake_decode(&replay_input(&instruction, keys.as_slice(), true));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_stake_decode(&replay_input(
+ &instruction,
+ keys.as_slice(),
+ true,
+ ));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!result.observations[0].observation_committed);
assert_eq!(result.observations[0].payload_json["transactionSucceeded"], false);
}
@@ -1304,18 +1308,18 @@ mod tests {
#[test]
fn truncated_unknown_trailing_and_missing_accounts_fail_safely() {
let no_accounts = std::vec::Vec::new();
- let truncated = crate::solana_core_stake_decode(&replay_input_bytes(
+ let truncated = crate::decoder_solana_core_stake_decode(&replay_input_bytes(
&[0, 0, 0],
no_accounts.as_slice(),
false,
));
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
- let unknown = crate::solana_core_stake_decode(&replay_input_bytes(
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let unknown = crate::decoder_solana_core_stake_decode(&replay_input_bytes(
&99_u32.to_le_bytes(),
no_accounts.as_slice(),
false,
));
- assert_eq!(unknown.status, crate::DecoderOutcomeStatus::Unsupported);
+ assert_eq!(unknown.status, crate::DcApiDecoderOutcomeStatus::Unsupported);
let bytes_result = wincode::serialize(&super::StakeInstructionWire::MoveLamports(1));
let mut bytes = match bytes_result {
std::result::Result::Ok(value) => value,
@@ -1324,12 +1328,12 @@ mod tests {
},
};
bytes.push(1);
- let trailing = crate::solana_core_stake_decode(&replay_input_bytes(
+ let trailing = crate::decoder_solana_core_stake_decode(&replay_input_bytes(
bytes.as_slice(),
no_accounts.as_slice(),
false,
));
- assert_eq!(trailing.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(trailing.status, crate::DcApiDecoderOutcomeStatus::Failed);
let exact_result = wincode::serialize(&super::StakeInstructionWire::MoveLamports(1));
let exact = match exact_result {
std::result::Result::Ok(value) => value,
@@ -1337,11 +1341,11 @@ mod tests {
panic!("Stake fixture serialization failed: {error}")
},
};
- let missing_accounts = crate::solana_core_stake_decode(&replay_input_bytes(
+ let missing_accounts = crate::decoder_solana_core_stake_decode(&replay_input_bytes(
exact.as_slice(),
no_accounts.as_slice(),
false,
));
- assert_eq!(missing_accounts.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(missing_accounts.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
}
diff --git a/kb-lib/src/decoder/solana/core/system.rs b/kb-lib/src/decoder/solana/core/system.rs
index 79c5a5d..b80e951 100644
--- a/kb-lib/src/decoder/solana/core/system.rs
+++ b/kb-lib/src/decoder/solana/core/system.rs
@@ -5,62 +5,63 @@
const SOURCE: &str = "solana-system-interface@3.2.0 SystemInstruction wincode-compatible contract";
-const CREATE_ACCOUNT_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("funding_account", true, true),
- crate::SolanaCoreAccountRole::new("new_account", true, true),
+const CREATE_ACCOUNT_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("funding_account", true, true),
+ crate::DcSolanaCoreAccountRole::new("new_account", true, true),
];
-const ASSIGN_ROLES: &[crate::SolanaCoreAccountRole] =
- &[crate::SolanaCoreAccountRole::new("assigned_account", true, true)];
-const TRANSFER_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("funding_account", true, true),
- crate::SolanaCoreAccountRole::new("recipient_account", true, false),
+const ASSIGN_ROLES: &[crate::DcSolanaCoreAccountRole] =
+ &[crate::DcSolanaCoreAccountRole::new("assigned_account", true, true)];
+const TRANSFER_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("funding_account", true, true),
+ crate::DcSolanaCoreAccountRole::new("recipient_account", true, false),
];
-const CREATE_ACCOUNT_WITH_SEED_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("funding_account", true, true),
- crate::SolanaCoreAccountRole::new("new_account", true, false),
- crate::SolanaCoreAccountRole::new("base_account", false, true),
+const CREATE_ACCOUNT_WITH_SEED_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("funding_account", true, true),
+ crate::DcSolanaCoreAccountRole::new("new_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("base_account", false, true),
];
-const ADVANCE_NONCE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("nonce_account", true, false),
- crate::SolanaCoreAccountRole::new("recent_blockhashes_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("nonce_authority", false, true),
+const ADVANCE_NONCE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("nonce_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("recent_blockhashes_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("nonce_authority", false, true),
];
-const WITHDRAW_NONCE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("nonce_account", true, false),
- crate::SolanaCoreAccountRole::new("recipient_account", true, false),
- crate::SolanaCoreAccountRole::new("recent_blockhashes_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("rent_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("nonce_authority", false, true),
+const WITHDRAW_NONCE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("nonce_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("recipient_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("recent_blockhashes_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("rent_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("nonce_authority", false, true),
];
-const INITIALIZE_NONCE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("nonce_account", true, false),
- crate::SolanaCoreAccountRole::new("recent_blockhashes_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("rent_sysvar", false, false),
+const INITIALIZE_NONCE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("nonce_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("recent_blockhashes_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("rent_sysvar", false, false),
];
-const AUTHORIZE_NONCE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("nonce_account", true, false),
- crate::SolanaCoreAccountRole::new("nonce_authority", false, true),
+const AUTHORIZE_NONCE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("nonce_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("nonce_authority", false, true),
];
-const ALLOCATE_ROLES: &[crate::SolanaCoreAccountRole] =
- &[crate::SolanaCoreAccountRole::new("allocated_account", true, true)];
-const SEEDED_ACCOUNT_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("derived_account", true, false),
- crate::SolanaCoreAccountRole::new("base_account", false, true),
+const ALLOCATE_ROLES: &[crate::DcSolanaCoreAccountRole] =
+ &[crate::DcSolanaCoreAccountRole::new("allocated_account", true, true)];
+const SEEDED_ACCOUNT_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("derived_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("base_account", false, true),
];
-const TRANSFER_WITH_SEED_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("funding_account", true, false),
- crate::SolanaCoreAccountRole::new("base_account", false, true),
- crate::SolanaCoreAccountRole::new("recipient_account", true, false),
+const TRANSFER_WITH_SEED_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("funding_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("base_account", false, true),
+ crate::DcSolanaCoreAccountRole::new("recipient_account", true, false),
];
-const UPGRADE_NONCE_ROLES: &[crate::SolanaCoreAccountRole] =
- &[crate::SolanaCoreAccountRole::new("nonce_account", true, false)];
-const CREATE_ACCOUNT_ALLOW_PREFUND_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("new_account", true, true),
- crate::SolanaCoreAccountRole::new("funding_account", true, true),
+const UPGRADE_NONCE_ROLES: &[crate::DcSolanaCoreAccountRole] =
+ &[crate::DcSolanaCoreAccountRole::new("nonce_account", true, false)];
+const CREATE_ACCOUNT_ALLOW_PREFUND_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("new_account", true, true),
+ crate::DcSolanaCoreAccountRole::new("funding_account", true, true),
];
/// Returns declared System Program instruction coverage.
-pub(crate) fn system_coverage() -> std::vec::Vec {
+pub(crate) fn decoder_solana_core_system_coverage()
+-> std::vec::Vec {
let entries = [
("create_account", 0_u32),
("assign", 1_u32),
@@ -80,12 +81,12 @@ pub(crate) fn system_coverage() -> std::vec::Vec std::vec::Vec crate::DecoderRecognition {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+) -> crate::DcApiDecoderRecognition {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
- std::option::Option::Some(crate::SOLANA_CORE_SYSTEM_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_SYSTEM_SURFACE_CODE.to_string()),
std::option::Option::Some("malformed_system_instruction".to_string()),
std::option::Option::None,
);
},
};
- let tag_result = crate::solana_core_read_u32_le(bytes.as_slice(), 0);
+ let tag_result = crate::decoder_solana_core_read_u32_le(bytes.as_slice(), 0);
let tag = match tag_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
- std::option::Option::Some(crate::SOLANA_CORE_SYSTEM_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_SYSTEM_SURFACE_CODE.to_string()),
std::option::Option::Some("malformed_system_instruction".to_string()),
- crate::solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(4)),
+ crate::decoder_solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(4)),
);
},
};
let entry_code = entry_code(tag);
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
entry_code.is_some(),
priority,
- std::option::Option::Some(crate::SOLANA_CORE_SYSTEM_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_SYSTEM_SURFACE_CODE.to_string()),
entry_code.map(str::to_string).or_else(|| {
return std::option::Option::Some("unknown_system_instruction".to_string());
}),
@@ -138,25 +139,25 @@ pub(crate) fn system_recognize(
}
/// Decodes one System Program instruction.
-pub(crate) fn system_decode(
- input: &crate::CoreInstructionReplayInput,
-) -> crate::DecoderExecutionResult {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+pub(crate) fn decoder_solana_core_system_decode(
+ input: &crate::MdCoreInstructionReplayInput,
+) -> crate::DcApiDecoderExecutionResult {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_system_instruction"),
"system_payload_invalid",
error.to_string(),
);
},
};
- let tag_result = crate::solana_core_read_u32_le(bytes.as_slice(), 0);
+ let tag_result = crate::decoder_solana_core_read_u32_le(bytes.as_slice(), 0);
let tag = match tag_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_system_instruction"),
"system_tag_truncated",
error.to_string(),
@@ -166,12 +167,12 @@ pub(crate) fn system_decode(
let entry_code = match entry_code(tag) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::solana_core_unsupported_result(
+ return crate::decoder_solana_core_unsupported_result(
"unknown_system_instruction",
"system_tag_unknown",
format!(
"unknown System Program instruction tag {tag}; payload_sha256={}",
- crate::solana_core_payload_hash(input)
+ crate::decoder_solana_core_payload_hash(input)
),
);
},
@@ -182,7 +183,7 @@ pub(crate) fn system_decode(
let instruction = match instruction_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"system_wincode_invalid",
format!("cannot decode exact System Program {entry_code}: {error}"),
@@ -193,9 +194,9 @@ pub(crate) fn system_decode(
}
fn decoded_instruction(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
instruction: solana_system_interface::instruction::SystemInstruction,
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
return match instruction {
solana_system_interface::instruction::SystemInstruction::CreateAccount {
lamports,
@@ -204,7 +205,7 @@ fn decoded_instruction(
} => build(
input,
"create_account",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
CREATE_ACCOUNT_ROLES,
2,
serde_json::json!({"lamports": lamports, "space": space, "owner": owner.to_string()}),
@@ -212,7 +213,7 @@ fn decoded_instruction(
solana_system_interface::instruction::SystemInstruction::Assign { owner } => build(
input,
"assign",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
ASSIGN_ROLES,
1,
serde_json::json!({"owner": owner.to_string()}),
@@ -220,7 +221,7 @@ fn decoded_instruction(
solana_system_interface::instruction::SystemInstruction::Transfer { lamports } => build(
input,
"transfer",
- crate::EventFamily::Audit,
+ crate::MdEventFamily::Audit,
TRANSFER_ROLES,
2,
serde_json::json!({"lamports": lamports}),
@@ -234,7 +235,7 @@ fn decoded_instruction(
} => build(
input,
"create_account_with_seed",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
CREATE_ACCOUNT_WITH_SEED_ROLES,
2,
serde_json::json!({
@@ -248,7 +249,7 @@ fn decoded_instruction(
solana_system_interface::instruction::SystemInstruction::AdvanceNonceAccount => build(
input,
"advance_nonce_account",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
ADVANCE_NONCE_ROLES,
3,
serde_json::json!({}),
@@ -257,7 +258,7 @@ fn decoded_instruction(
build(
input,
"withdraw_nonce_account",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
WITHDRAW_NONCE_ROLES,
5,
serde_json::json!({"lamports": lamports}),
@@ -268,7 +269,7 @@ fn decoded_instruction(
) => build(
input,
"initialize_nonce_account",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
INITIALIZE_NONCE_ROLES,
3,
serde_json::json!({"authority": authority.to_string()}),
@@ -278,7 +279,7 @@ fn decoded_instruction(
) => build(
input,
"authorize_nonce_account",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
AUTHORIZE_NONCE_ROLES,
2,
serde_json::json!({"authority": authority.to_string()}),
@@ -286,7 +287,7 @@ fn decoded_instruction(
solana_system_interface::instruction::SystemInstruction::Allocate { space } => build(
input,
"allocate",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
ALLOCATE_ROLES,
1,
serde_json::json!({"space": space}),
@@ -299,7 +300,7 @@ fn decoded_instruction(
} => build(
input,
"allocate_with_seed",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
SEEDED_ACCOUNT_ROLES,
2,
serde_json::json!({
@@ -316,7 +317,7 @@ fn decoded_instruction(
} => build(
input,
"assign_with_seed",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
SEEDED_ACCOUNT_ROLES,
2,
serde_json::json!({
@@ -332,7 +333,7 @@ fn decoded_instruction(
} => build(
input,
"transfer_with_seed",
- crate::EventFamily::Audit,
+ crate::MdEventFamily::Audit,
TRANSFER_WITH_SEED_ROLES,
3,
serde_json::json!({
@@ -344,7 +345,7 @@ fn decoded_instruction(
solana_system_interface::instruction::SystemInstruction::UpgradeNonceAccount => build(
input,
"upgrade_nonce_account",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
UPGRADE_NONCE_ROLES,
1,
serde_json::json!({}),
@@ -356,7 +357,7 @@ fn decoded_instruction(
} => build(
input,
"create_account_allow_prefund",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
CREATE_ACCOUNT_ALLOW_PREFUND_ROLES,
if lamports == 0 { 1 } else { 2 },
serde_json::json!({"lamports": lamports, "space": space, "owner": owner.to_string()}),
@@ -365,28 +366,32 @@ fn decoded_instruction(
}
fn build(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
entry_code: &str,
- event_family: crate::EventFamily,
- roles: &[crate::SolanaCoreAccountRole],
+ event_family: crate::MdEventFamily,
+ roles: &[crate::DcSolanaCoreAccountRole],
minimum_count: usize,
parameters: serde_json::Value,
-) -> crate::DecoderExecutionResult {
- let accounts_result =
- crate::solana_core_resolve_accounts(input, roles, minimum_count, std::option::Option::None);
+) -> crate::DcApiDecoderExecutionResult {
+ let accounts_result = crate::decoder_solana_core_resolve_accounts(
+ input,
+ roles,
+ minimum_count,
+ std::option::Option::None,
+ );
let accounts = match accounts_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"system_accounts_invalid",
error.to_string(),
);
},
};
- return crate::solana_core_decoded_result(
+ return crate::decoder_solana_core_decoded_result(
input,
- crate::SOLANA_CORE_SYSTEM_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_SYSTEM_SURFACE_CODE,
entry_code,
event_family,
false,
@@ -429,7 +434,7 @@ mod tests {
instruction: &solana_system_interface::instruction::SystemInstruction,
account_count: usize,
transaction_failed: bool,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
let bytes_result = wincode::serialize(instruction);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
@@ -444,7 +449,7 @@ mod tests {
bytes: &[u8],
account_count: usize,
transaction_failed: bool,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
let encoded = base64::engine::general_purpose::STANDARD.encode(bytes);
let account_keys = (0..account_count)
.map(|index| {
@@ -466,7 +471,7 @@ mod tests {
});
})
.collect::>();
- let result = crate::CoreInstructionReplayInput::new(
+ let result = crate::MdCoreInstructionReplayInput::new(
"signature:0",
"signature",
42,
@@ -603,8 +608,8 @@ mod tests {
];
for (instruction, account_count, expected) in fixtures {
let input = replay_input(&instruction, account_count, false);
- let result = crate::solana_core_system_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_system_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some(expected)
@@ -617,8 +622,9 @@ mod tests {
fn additional_accounts_are_preserved_without_rejecting_valid_system_instructions() {
let instruction =
solana_system_interface::instruction::SystemInstruction::Transfer { lamports: 1 };
- let result = crate::solana_core_system_decode(&replay_input(&instruction, 3, false));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result =
+ crate::decoder_solana_core_system_decode(&replay_input(&instruction, 3, false));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
let accounts = match result.observations[0].payload_json["accounts"].as_array() {
std::option::Option::Some(value) => value,
std::option::Option::None => panic!("decoded System accounts are not an array"),
@@ -631,17 +637,22 @@ mod tests {
fn missing_accounts_and_truncated_payload_fail_without_panic() {
let instruction =
solana_system_interface::instruction::SystemInstruction::Transfer { lamports: 1 };
- let missing = crate::solana_core_system_decode(&replay_input(&instruction, 1, false));
- assert_eq!(missing.status, crate::DecoderOutcomeStatus::Failed);
- let truncated = crate::solana_core_system_decode(&replay_input_bytes(&[2, 0, 0], 2, false));
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
+ let missing =
+ crate::decoder_solana_core_system_decode(&replay_input(&instruction, 1, false));
+ assert_eq!(missing.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let truncated =
+ crate::decoder_solana_core_system_decode(&replay_input_bytes(&[2, 0, 0], 2, false));
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn unknown_tag_is_unsupported_and_hashable_for_replay() {
- let result =
- crate::solana_core_system_decode(&replay_input_bytes(&[255, 0, 0, 0], 0, false));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Unsupported);
+ let result = crate::decoder_solana_core_system_decode(&replay_input_bytes(
+ &[255, 0, 0, 0],
+ 0,
+ false,
+ ));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Unsupported);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some("unknown_system_instruction")
@@ -652,8 +663,8 @@ mod tests {
fn failed_transaction_is_decoded_as_uncommitted_intent() {
let instruction =
solana_system_interface::instruction::SystemInstruction::Transfer { lamports: 55 };
- let result = crate::solana_core_system_decode(&replay_input(&instruction, 2, true));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_system_decode(&replay_input(&instruction, 2, true));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!result.observations[0].observation_committed);
assert_eq!(result.observations[0].payload_json["transactionSucceeded"], false);
}
@@ -663,8 +674,8 @@ mod tests {
let instruction =
solana_system_interface::instruction::SystemInstruction::Transfer { lamports: 55 };
let input = replay_input(&instruction, 2, false);
- let first = crate::solana_core_system_decode(&input);
- let second = crate::solana_core_system_decode(&input);
+ let first = crate::decoder_solana_core_system_decode(&input);
+ let second = crate::decoder_solana_core_system_decode(&input);
let first_json = match serde_json::to_string(&first) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => panic!("first event serialization failed: {error}"),
@@ -678,7 +689,7 @@ mod tests {
#[test]
fn coverage_declares_all_current_system_variants() {
- let coverage = crate::solana_core_system_coverage();
+ let coverage = crate::decoder_solana_core_system_coverage();
assert_eq!(coverage.len(), 14);
assert!(coverage.iter().any(|entry| {
return entry.entry_code == "create_account_allow_prefund"
diff --git a/kb-lib/src/decoder/solana/core/vote.rs b/kb-lib/src/decoder/solana/core/vote.rs
index ad787ed..03e2906 100644
--- a/kb-lib/src/decoder/solana/core/vote.rs
+++ b/kb-lib/src/decoder/solana/core/vote.rs
@@ -5,76 +5,77 @@
const SOURCE: &str = "solana-vote-interface@6.x VoteInstruction wincode contract";
-const INITIALIZE_ACCOUNT_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("vote_account", true, false),
- crate::SolanaCoreAccountRole::new("rent_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("clock_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("validator_identity", false, true),
+const INITIALIZE_ACCOUNT_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("vote_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("rent_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("clock_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("validator_identity", false, true),
];
-const AUTHORIZE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("vote_account", true, false),
- crate::SolanaCoreAccountRole::new("clock_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("current_authority", false, true),
+const AUTHORIZE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("vote_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("clock_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("current_authority", false, true),
];
-const VOTE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("vote_account", true, false),
- crate::SolanaCoreAccountRole::new("slot_hashes_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("clock_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("vote_authority", false, true),
+const VOTE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("vote_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("slot_hashes_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("clock_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("vote_authority", false, true),
];
-const WITHDRAW_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("vote_account", true, false),
- crate::SolanaCoreAccountRole::new("recipient_account", true, false),
- crate::SolanaCoreAccountRole::new("withdraw_authority", false, true),
+const WITHDRAW_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("vote_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("recipient_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("withdraw_authority", false, true),
];
-const UPDATE_VALIDATOR_IDENTITY_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("vote_account", true, false),
- crate::SolanaCoreAccountRole::new("new_validator_identity", false, true),
- crate::SolanaCoreAccountRole::new("withdraw_authority", false, true),
+const UPDATE_VALIDATOR_IDENTITY_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("vote_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("new_validator_identity", false, true),
+ crate::DcSolanaCoreAccountRole::new("withdraw_authority", false, true),
];
-const UPDATE_COMMISSION_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("vote_account", true, false),
- crate::SolanaCoreAccountRole::new("withdraw_authority", false, true),
+const UPDATE_COMMISSION_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("vote_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("withdraw_authority", false, true),
];
-const AUTHORIZE_CHECKED_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("vote_account", true, false),
- crate::SolanaCoreAccountRole::new("clock_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("current_authority", false, true),
- crate::SolanaCoreAccountRole::new("new_authority", false, true),
+const AUTHORIZE_CHECKED_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("vote_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("clock_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("current_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("new_authority", false, true),
];
-const VOTE_STATE_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("vote_account", true, false),
- crate::SolanaCoreAccountRole::new("vote_authority", false, true),
+const VOTE_STATE_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("vote_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("vote_authority", false, true),
];
-const AUTHORIZE_WITH_SEED_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("vote_account", true, false),
- crate::SolanaCoreAccountRole::new("clock_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("current_authority_base", false, true),
+const AUTHORIZE_WITH_SEED_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("vote_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("clock_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("current_authority_base", false, true),
];
-const AUTHORIZE_CHECKED_WITH_SEED_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("vote_account", true, false),
- crate::SolanaCoreAccountRole::new("clock_sysvar", false, false),
- crate::SolanaCoreAccountRole::new("current_authority_base", false, true),
- crate::SolanaCoreAccountRole::new("new_authority", false, true),
+const AUTHORIZE_CHECKED_WITH_SEED_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("vote_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("clock_sysvar", false, false),
+ crate::DcSolanaCoreAccountRole::new("current_authority_base", false, true),
+ crate::DcSolanaCoreAccountRole::new("new_authority", false, true),
];
-const INITIALIZE_ACCOUNT_V2_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("vote_account", true, false),
- crate::SolanaCoreAccountRole::new("validator_identity", false, true),
- crate::SolanaCoreAccountRole::new("inflation_rewards_collector", true, false),
- crate::SolanaCoreAccountRole::new("block_revenue_collector", true, false),
+const INITIALIZE_ACCOUNT_V2_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("vote_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("validator_identity", false, true),
+ crate::DcSolanaCoreAccountRole::new("inflation_rewards_collector", true, false),
+ crate::DcSolanaCoreAccountRole::new("block_revenue_collector", true, false),
];
-const UPDATE_COMMISSION_COLLECTOR_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("vote_account", true, false),
- crate::SolanaCoreAccountRole::new("new_commission_collector", true, false),
- crate::SolanaCoreAccountRole::new("withdraw_authority", false, true),
+const UPDATE_COMMISSION_COLLECTOR_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("vote_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("new_commission_collector", true, false),
+ crate::DcSolanaCoreAccountRole::new("withdraw_authority", false, true),
];
-const DEPOSIT_DELEGATOR_REWARDS_ROLES: &[crate::SolanaCoreAccountRole] = &[
- crate::SolanaCoreAccountRole::new("vote_account", true, false),
- crate::SolanaCoreAccountRole::new("deposit_source", true, true),
+const DEPOSIT_DELEGATOR_REWARDS_ROLES: &[crate::DcSolanaCoreAccountRole] = &[
+ crate::DcSolanaCoreAccountRole::new("vote_account", true, false),
+ crate::DcSolanaCoreAccountRole::new("deposit_source", true, true),
];
/// Returns declared Vote Program instruction coverage.
-pub(crate) fn vote_coverage() -> std::vec::Vec {
+pub(crate) fn decoder_solana_core_vote_coverage()
+-> std::vec::Vec {
let entries = [
("initialize_account", 0_u32),
("authorize", 1_u32),
@@ -100,12 +101,12 @@ pub(crate) fn vote_coverage() -> std::vec::Vec std::vec::Vec crate::DecoderRecognition {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+) -> crate::DcApiDecoderRecognition {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
- std::option::Option::Some(crate::SOLANA_CORE_VOTE_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_VOTE_SURFACE_CODE.to_string()),
std::option::Option::Some("malformed_vote_instruction".to_string()),
std::option::Option::None,
);
},
};
- let tag_result = crate::solana_core_read_u32_le(bytes.as_slice(), 0);
+ let tag_result = crate::decoder_solana_core_read_u32_le(bytes.as_slice(), 0);
let tag = match tag_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
- std::option::Option::Some(crate::SOLANA_CORE_VOTE_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_VOTE_SURFACE_CODE.to_string()),
std::option::Option::Some("malformed_vote_instruction".to_string()),
- crate::solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(4)),
+ crate::decoder_solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(4)),
);
},
};
let entry_code = entry_code(tag);
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
entry_code.is_some(),
priority,
- std::option::Option::Some(crate::SOLANA_CORE_VOTE_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_VOTE_SURFACE_CODE.to_string()),
entry_code.map(str::to_string).or_else(|| {
return std::option::Option::Some("unknown_vote_instruction".to_string());
}),
@@ -158,25 +159,25 @@ pub(crate) fn vote_recognize(
}
/// Decodes one Vote Program instruction.
-pub(crate) fn vote_decode(
- input: &crate::CoreInstructionReplayInput,
-) -> crate::DecoderExecutionResult {
- let bytes_result = crate::solana_core_decode_instruction_data(input);
+pub(crate) fn decoder_solana_core_vote_decode(
+ input: &crate::MdCoreInstructionReplayInput,
+) -> crate::DcApiDecoderExecutionResult {
+ let bytes_result = crate::decoder_solana_core_decode_instruction_data(input);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_vote_instruction"),
"vote_payload_invalid",
error.to_string(),
);
},
};
- let tag_result = crate::solana_core_read_u32_le(bytes.as_slice(), 0);
+ let tag_result = crate::decoder_solana_core_read_u32_le(bytes.as_slice(), 0);
let tag = match tag_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_vote_instruction"),
"vote_tag_truncated",
error.to_string(),
@@ -186,12 +187,12 @@ pub(crate) fn vote_decode(
let entry_code = match entry_code(tag) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::solana_core_unsupported_result(
+ return crate::decoder_solana_core_unsupported_result(
"unknown_vote_instruction",
"vote_tag_unknown",
format!(
"unknown Vote Program instruction tag {tag}; payload_sha256={}",
- crate::solana_core_payload_hash(input)
+ crate::decoder_solana_core_payload_hash(input)
),
);
},
@@ -202,7 +203,7 @@ pub(crate) fn vote_decode(
let instruction = match instruction_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"vote_wincode_invalid",
format!("cannot decode exact Vote Program {entry_code}: {error}"),
@@ -213,14 +214,14 @@ pub(crate) fn vote_decode(
}
fn decoded_instruction(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
instruction: solana_vote_interface::instruction::VoteInstruction,
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
return match instruction {
solana_vote_interface::instruction::VoteInstruction::InitializeAccount(value) => build(
input,
"initialize_account",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
INITIALIZE_ACCOUNT_ROLES,
4,
&[
@@ -235,7 +236,7 @@ fn decoded_instruction(
) => build(
input,
"authorize",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
AUTHORIZE_ROLES,
3,
&[(1, kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID)],
@@ -247,7 +248,7 @@ fn decoded_instruction(
solana_vote_interface::instruction::VoteInstruction::Vote(value) => build(
input,
"vote",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
VOTE_ROLES,
4,
&[
@@ -259,7 +260,7 @@ fn decoded_instruction(
solana_vote_interface::instruction::VoteInstruction::Withdraw(lamports) => build(
input,
"withdraw",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
WITHDRAW_ROLES,
3,
&[],
@@ -268,7 +269,7 @@ fn decoded_instruction(
solana_vote_interface::instruction::VoteInstruction::UpdateValidatorIdentity => build(
input,
"update_validator_identity",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
UPDATE_VALIDATOR_IDENTITY_ROLES,
3,
&[],
@@ -277,7 +278,7 @@ fn decoded_instruction(
solana_vote_interface::instruction::VoteInstruction::UpdateCommission(commission) => build(
input,
"update_commission",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
UPDATE_COMMISSION_ROLES,
2,
&[],
@@ -293,7 +294,7 @@ fn decoded_instruction(
build(
input,
"vote_switch",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
VOTE_ROLES,
4,
&[
@@ -308,7 +309,7 @@ fn decoded_instruction(
) => build(
input,
"authorize_checked",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
AUTHORIZE_CHECKED_ROLES,
4,
&[(1, kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID)],
@@ -320,7 +321,7 @@ fn decoded_instruction(
solana_vote_interface::instruction::VoteInstruction::UpdateVoteState(value) => build(
input,
"update_vote_state",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
VOTE_STATE_ROLES,
2,
&[],
@@ -336,7 +337,7 @@ fn decoded_instruction(
build(
input,
"update_vote_state_switch",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
VOTE_STATE_ROLES,
2,
&[],
@@ -346,7 +347,7 @@ fn decoded_instruction(
solana_vote_interface::instruction::VoteInstruction::AuthorizeWithSeed(value) => build(
input,
"authorize_with_seed",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
AUTHORIZE_WITH_SEED_ROLES,
3,
&[(1, kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID)],
@@ -361,7 +362,7 @@ fn decoded_instruction(
build(
input,
"authorize_checked_with_seed",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
AUTHORIZE_CHECKED_WITH_SEED_ROLES,
4,
&[(1, kb_program_ids::SYSVAR_CLOCK_PROGRAM_ID)],
@@ -377,7 +378,7 @@ fn decoded_instruction(
build(
input,
"compact_update_vote_state",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
VOTE_STATE_ROLES,
2,
&[],
@@ -394,7 +395,7 @@ fn decoded_instruction(
build(
input,
"compact_update_vote_state_switch",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
VOTE_STATE_ROLES,
2,
&[],
@@ -404,7 +405,7 @@ fn decoded_instruction(
solana_vote_interface::instruction::VoteInstruction::TowerSync(value) => build(
input,
"tower_sync",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
VOTE_STATE_ROLES,
2,
&[],
@@ -420,7 +421,7 @@ fn decoded_instruction(
build(
input,
"tower_sync_switch",
- crate::EventFamily::Staking,
+ crate::MdEventFamily::Staking,
VOTE_STATE_ROLES,
2,
&[],
@@ -430,7 +431,7 @@ fn decoded_instruction(
solana_vote_interface::instruction::VoteInstruction::InitializeAccountV2(value) => build(
input,
"initialize_account_v2",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
INITIALIZE_ACCOUNT_V2_ROLES,
4,
&[],
@@ -440,7 +441,7 @@ fn decoded_instruction(
build(
input,
"update_commission_collector",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
UPDATE_COMMISSION_COLLECTOR_ROLES,
3,
&[],
@@ -453,7 +454,7 @@ fn decoded_instruction(
} => build(
input,
"update_commission_bps",
- crate::EventFamily::Admin,
+ crate::MdEventFamily::Admin,
UPDATE_COMMISSION_ROLES,
2,
&[],
@@ -467,7 +468,7 @@ fn decoded_instruction(
} => build(
input,
"deposit_delegator_rewards",
- crate::EventFamily::Reward,
+ crate::MdEventFamily::Reward,
DEPOSIT_DELEGATOR_REWARDS_ROLES,
2,
&[],
@@ -477,20 +478,24 @@ fn decoded_instruction(
}
fn build(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
entry_code: &str,
- event_family: crate::EventFamily,
- roles: &[crate::SolanaCoreAccountRole],
+ event_family: crate::MdEventFamily,
+ roles: &[crate::DcSolanaCoreAccountRole],
minimum_count: usize,
fixed_accounts: &[(usize, &str)],
parameters: serde_json::Value,
-) -> crate::DecoderExecutionResult {
- let accounts_result =
- crate::solana_core_resolve_accounts(input, roles, minimum_count, std::option::Option::None);
+) -> crate::DcApiDecoderExecutionResult {
+ let accounts_result = crate::decoder_solana_core_resolve_accounts(
+ input,
+ roles,
+ minimum_count,
+ std::option::Option::None,
+ );
let accounts = match accounts_result {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"vote_accounts_invalid",
error.to_string(),
@@ -499,15 +504,15 @@ fn build(
};
let fixed_result = validate_fixed_accounts(&accounts, fixed_accounts);
if let std::result::Result::Err(error) = fixed_result {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(entry_code),
"vote_fixed_account_invalid",
error.to_string(),
);
}
- return crate::solana_core_decoded_result(
+ return crate::decoder_solana_core_decoded_result(
input,
- crate::SOLANA_CORE_VOTE_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_VOTE_SURFACE_CODE,
entry_code,
event_family,
false,
@@ -854,7 +859,7 @@ mod tests {
account_count: usize,
entry_code: &str,
transaction_failed: bool,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
let bytes_result = wincode::serialize(instruction);
let bytes = match bytes_result {
std::result::Result::Ok(value) => value,
@@ -868,7 +873,7 @@ mod tests {
account_count: usize,
entry_code: &str,
transaction_failed: bool,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
let account_keys = (0..account_count)
.map(|index| {
let key = account_key(entry_code, index);
@@ -890,7 +895,7 @@ mod tests {
});
})
.collect::>();
- let result = crate::CoreInstructionReplayInput::new(
+ let result = crate::MdCoreInstructionReplayInput::new(
"signature:0",
"signature",
42,
@@ -943,7 +948,7 @@ mod tests {
#[test]
fn coverage_declares_every_official_vote_instruction() {
- let coverage = crate::solana_core_vote_coverage();
+ let coverage = crate::decoder_solana_core_vote_coverage();
assert_eq!(coverage.len(), 20);
for tag in 0_u32..20_u32 {
let expected = super::tag_hex(tag);
@@ -958,8 +963,8 @@ mod tests {
fn every_official_vote_variant_decodes() {
for (instruction, account_count, entry_code) in fixtures() {
let input = replay_input(&instruction, account_count, entry_code, false);
- let result = crate::solana_core_vote_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_vote_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some(entry_code)
@@ -978,8 +983,8 @@ mod tests {
),
);
let input = replay_input(&instruction, 3, "authorize", false);
- let result = crate::solana_core_vote_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_vote_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.observations[0].payload_json["parameters"]["authorizationType"]["kind"],
"voter_with_bls"
@@ -998,8 +1003,8 @@ mod tests {
solana_vote_interface::state::VoteInitV2::default(),
);
let input = replay_input(&instruction, 4, "initialize_account_v2", false);
- let result = crate::solana_core_vote_decode(&input);
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_vote_decode(&input);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
let payload = &result.observations[0].payload_json;
assert_eq!(payload["accounts"][2]["role"], "inflation_rewards_collector");
assert_eq!(payload["accounts"][3]["role"], "block_revenue_collector");
@@ -1009,20 +1014,20 @@ mod tests {
#[test]
fn truncated_unknown_and_trailing_payloads_are_distinguished() {
- let truncated = crate::solana_core_vote_decode(&replay_input_bytes(
+ let truncated = crate::decoder_solana_core_vote_decode(&replay_input_bytes(
&[0, 0, 0],
4,
"initialize_account",
false,
));
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
- let unknown = crate::solana_core_vote_decode(&replay_input_bytes(
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let unknown = crate::decoder_solana_core_vote_decode(&replay_input_bytes(
&[99, 0, 0, 0],
1,
"unknown_vote_instruction",
false,
));
- assert_eq!(unknown.status, crate::DecoderOutcomeStatus::Unsupported);
+ assert_eq!(unknown.status, crate::DcApiDecoderOutcomeStatus::Unsupported);
let fixture = solana_vote_interface::instruction::VoteInstruction::Withdraw(1);
let bytes_result = wincode::serialize(&fixture);
let mut bytes = match bytes_result {
@@ -1030,13 +1035,13 @@ mod tests {
std::result::Result::Err(error) => panic!("Vote fixture serialization failed: {error}"),
};
bytes.push(0);
- let trailing = crate::solana_core_vote_decode(&replay_input_bytes(
+ let trailing = crate::decoder_solana_core_vote_decode(&replay_input_bytes(
bytes.as_slice(),
3,
"withdraw",
false,
));
- assert_eq!(trailing.status, crate::DecoderOutcomeStatus::Failed);
+ assert_eq!(trailing.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
@@ -1044,24 +1049,25 @@ mod tests {
let instruction = solana_vote_interface::instruction::VoteInstruction::Vote(
solana_vote_interface::state::Vote::default(),
);
- let missing = crate::solana_core_vote_decode(&replay_input(&instruction, 3, "vote", false));
- assert_eq!(missing.status, crate::DecoderOutcomeStatus::Failed);
+ let missing =
+ crate::decoder_solana_core_vote_decode(&replay_input(&instruction, 3, "vote", false));
+ assert_eq!(missing.status, crate::DcApiDecoderOutcomeStatus::Failed);
let mut wrong = replay_input(&instruction, 4, "vote", false);
wrong.instruction_accounts_json[1]["accountKey"] =
serde_json::Value::String("WrongSysvar1111111111111111111111111111".to_string());
wrong.account_keys_json[1]["accountKey"] =
serde_json::Value::String("WrongSysvar1111111111111111111111111111".to_string());
- let wrong_result = crate::solana_core_vote_decode(&wrong);
- assert_eq!(wrong_result.status, crate::DecoderOutcomeStatus::Failed);
+ let wrong_result = crate::decoder_solana_core_vote_decode(&wrong);
+ assert_eq!(wrong_result.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn failed_vote_instruction_is_decoded_as_uncommitted_intent() {
let instruction = solana_vote_interface::instruction::VoteInstruction::Withdraw(1);
let input = replay_input(&instruction, 3, "withdraw", true);
- let first = crate::solana_core_vote_decode(&input);
- let second = crate::solana_core_vote_decode(&input);
- assert_eq!(first.status, crate::DecoderOutcomeStatus::Decoded);
+ let first = crate::decoder_solana_core_vote_decode(&input);
+ let second = crate::decoder_solana_core_vote_decode(&input);
+ assert_eq!(first.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!first.observations[0].observation_committed);
assert_eq!(first.observations[0].payload_json, second.observations[0].payload_json);
}
diff --git a/kb-lib/src/decoder/solana/core/zk_elgamal.rs b/kb-lib/src/decoder/solana/core/zk_elgamal.rs
index e012db7..5d9c473 100644
--- a/kb-lib/src/decoder/solana/core/zk_elgamal.rs
+++ b/kb-lib/src/decoder/solana/core/zk_elgamal.rs
@@ -15,16 +15,17 @@ struct ProofDescriptor {
}
/// Returns declared ZK ElGamal Proof instruction coverage.
-pub(crate) fn zk_elgamal_coverage() -> std::vec::Vec {
+pub(crate) fn decoder_solana_core_zk_elgamal_coverage()
+-> std::vec::Vec {
return instruction_entries()
.iter()
.map(|(tag, entry_code)| {
- return crate::DecoderCoverageDeclaration {
+ return crate::DcApiDecoderCoverageDeclaration {
program_id: kb_program_ids::ZK_ELGAMAL_PROOF_PROGRAM_ID.to_string(),
surface_code: std::option::Option::Some(
- crate::SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE.to_string(),
+ crate::DC_SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE.to_string(),
),
- entry_kind: crate::DecoderCoverageEntryKind::Instruction,
+ entry_kind: crate::DcApiDecoderCoverageEntryKind::Instruction,
entry_code: (*entry_code).to_string(),
discriminator_hex: std::option::Option::Some(format!("{tag:02x}")),
historical: false,
@@ -34,18 +35,18 @@ pub(crate) fn zk_elgamal_coverage() -> std::vec::Vec crate::DecoderRecognition {
- let bytes = match crate::solana_core_decode_instruction_data(input) {
+) -> crate::DcApiDecoderRecognition {
+ let bytes = match crate::decoder_solana_core_decode_instruction_data(input) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
std::option::Option::Some(
- crate::SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE.to_string(),
+ crate::DC_SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE.to_string(),
),
std::option::Option::Some("malformed_zk_elgamal_proof_instruction".to_string()),
std::option::Option::None,
@@ -63,14 +64,17 @@ pub(crate) fn zk_elgamal_recognize(
} else {
"unknown_zk_elgamal_proof_instruction"
};
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
std::option::Option::Some(
- crate::SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE.to_string(),
+ crate::DC_SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE.to_string(),
),
std::option::Option::Some(entry_code.to_string()),
- crate::solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(1)),
+ crate::decoder_solana_core_hexadecimal_prefix(
+ bytes.as_slice(),
+ bytes.len().min(1),
+ ),
);
},
};
@@ -83,16 +87,16 @@ pub(crate) fn zk_elgamal_recognize(
let descriptor = match descriptor {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
std::option::Option::Some(
- crate::SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE.to_string(),
+ crate::DC_SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE.to_string(),
),
std::option::Option::Some(
"unknown_zk_elgamal_proof_instruction".to_string(),
),
- crate::solana_core_hexadecimal_prefix(bytes.as_slice(), 1),
+ crate::decoder_solana_core_hexadecimal_prefix(bytes.as_slice(), 1),
);
},
};
@@ -103,23 +107,23 @@ pub(crate) fn zk_elgamal_recognize(
)
},
};
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
exact,
priority,
- std::option::Option::Some(crate::SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE.to_string()),
std::option::Option::Some(entry_code.to_string()),
- crate::solana_core_hexadecimal_prefix(bytes.as_slice(), 1),
+ crate::decoder_solana_core_hexadecimal_prefix(bytes.as_slice(), 1),
);
}
/// Decodes one native ZK ElGamal Proof instruction without recomputing the proof.
-pub(crate) fn zk_elgamal_decode(
- input: &crate::CoreInstructionReplayInput,
-) -> crate::DecoderExecutionResult {
- let bytes = match crate::solana_core_decode_instruction_data(input) {
+pub(crate) fn decoder_solana_core_zk_elgamal_decode(
+ input: &crate::MdCoreInstructionReplayInput,
+) -> crate::DcApiDecoderExecutionResult {
+ let bytes = match crate::decoder_solana_core_decode_instruction_data(input) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_zk_elgamal_proof_instruction"),
"zk_elgamal_payload_invalid",
error.to_string(),
@@ -133,7 +137,7 @@ pub(crate) fn zk_elgamal_decode(
std::option::Option::Some(value) => value,
std::option::Option::None => {
if bytes.is_empty() {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_zk_elgamal_proof_instruction"),
"zk_elgamal_payload_empty",
"ZK ElGamal Proof instruction payload is empty",
@@ -142,19 +146,19 @@ pub(crate) fn zk_elgamal_decode(
let tag = match bytes.first() {
std::option::Option::Some(value) => *value,
std::option::Option::None => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_zk_elgamal_proof_instruction"),
"zk_elgamal_payload_empty",
"ZK ElGamal Proof instruction payload is empty",
);
},
};
- return crate::solana_core_unsupported_result(
+ return crate::decoder_solana_core_unsupported_result(
"unknown_zk_elgamal_proof_instruction",
"zk_elgamal_tag_unknown",
format!(
"unknown ZK ElGamal Proof instruction tag {tag}; payload_sha256={}",
- crate::solana_core_payload_hash(input)
+ crate::decoder_solana_core_payload_hash(input)
),
);
},
@@ -167,7 +171,7 @@ pub(crate) fn zk_elgamal_decode(
let descriptor = match proof_descriptor(instruction) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::solana_core_unsupported_result(
+ return crate::decoder_solana_core_unsupported_result(
"unknown_zk_elgamal_proof_instruction",
"zk_elgamal_instruction_unmapped",
"official ZK ElGamal Proof instruction has no local descriptor",
@@ -178,15 +182,15 @@ pub(crate) fn zk_elgamal_decode(
}
fn decode_close_context_state(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
let roles = [
- crate::SolanaCoreAccountRole::new("proof_context_state", true, false),
- crate::SolanaCoreAccountRole::new("lamport_destination", true, false),
- crate::SolanaCoreAccountRole::new("context_state_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("proof_context_state", true, false),
+ crate::DcSolanaCoreAccountRole::new("lamport_destination", true, false),
+ crate::DcSolanaCoreAccountRole::new("context_state_authority", false, true),
];
- let accounts = match crate::solana_core_resolve_accounts(
+ let accounts = match crate::decoder_solana_core_resolve_accounts(
input,
roles.as_slice(),
3,
@@ -194,7 +198,7 @@ fn decode_close_context_state(
) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("close_context_state"),
"zk_elgamal_close_accounts_invalid",
error.to_string(),
@@ -204,7 +208,7 @@ fn decode_close_context_state(
let account_array = match accounts.as_array() {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("close_context_state"),
"zk_elgamal_close_accounts_not_array",
"resolved ZK ElGamal close accounts are not an array",
@@ -220,7 +224,7 @@ fn decode_close_context_state(
.and_then(|value| return value.get("accountKey"))
.and_then(serde_json::Value::as_str);
if context_key.is_some() && context_key == destination_key {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("close_context_state"),
"zk_elgamal_close_destination_matches_context",
"ZK ElGamal proof context account and lamport destination must differ",
@@ -229,26 +233,26 @@ fn decode_close_context_state(
let trailing = match bytes.get(1..) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("close_context_state"),
"zk_elgamal_close_payload_missing_tag",
"ZK ElGamal close-context instruction has no discriminator byte",
);
},
};
- return crate::solana_core_decoded_result(
+ return crate::decoder_solana_core_decoded_result(
input,
- crate::SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE,
"close_context_state",
- crate::EventFamily::Lifecycle,
+ crate::MdEventFamily::Lifecycle,
false,
accounts,
serde_json::json!({
"instructionMode": "close_context_state",
"runtimeAcceptsTrailingBytes": true,
"trailingByteLength": trailing.len(),
- "trailingSha256": crate::solana_core_hash_bytes(trailing),
- "trailingPrefixHex": crate::solana_core_bounded_hexadecimal_prefix(
+ "trailingSha256": crate::decoder_solana_core_hash_bytes(trailing),
+ "trailingPrefixHex": crate::decoder_solana_core_bounded_hexadecimal_prefix(
trailing,
PROOF_COMPONENT_PREFIX_BYTES,
),
@@ -261,14 +265,14 @@ fn decode_close_context_state(
}
fn decode_verify_proof(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
descriptor: ProofDescriptor,
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
let external_proof = bytes.len() == PROOF_ACCOUNT_INSTRUCTION_BYTES;
let expected_inline_size = descriptor.proof_data_size.saturating_add(1);
if !external_proof && bytes.len() != expected_inline_size {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(descriptor.entry_code),
"zk_elgamal_proof_data_size_invalid",
format!(
@@ -283,7 +287,7 @@ fn decode_verify_proof(
let account_count = match input.instruction_accounts_json.as_array() {
std::option::Option::Some(value) => value.len(),
std::option::Option::None => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(descriptor.entry_code),
"zk_elgamal_accounts_not_array",
"ZK ElGamal Proof instruction accounts are not an array",
@@ -294,14 +298,14 @@ fn decode_verify_proof(
if external_proof { account_count >= 3 } else { account_count >= 2 };
let mut roles = std::vec::Vec::new();
if external_proof {
- roles.push(crate::SolanaCoreAccountRole::new("proof_data_account", false, false));
+ roles.push(crate::DcSolanaCoreAccountRole::new("proof_data_account", false, false));
}
if context_state_requested {
- roles.push(crate::SolanaCoreAccountRole::new("proof_context_state", true, false));
- roles.push(crate::SolanaCoreAccountRole::new("context_state_authority", false, false));
+ roles.push(crate::DcSolanaCoreAccountRole::new("proof_context_state", true, false));
+ roles.push(crate::DcSolanaCoreAccountRole::new("context_state_authority", false, false));
}
let minimum_accounts = if external_proof { 1 } else { 0 };
- let accounts = match crate::solana_core_resolve_accounts(
+ let accounts = match crate::decoder_solana_core_resolve_accounts(
input,
roles.as_slice(),
minimum_accounts,
@@ -309,7 +313,7 @@ fn decode_verify_proof(
) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(descriptor.entry_code),
"zk_elgamal_accounts_invalid",
error.to_string(),
@@ -317,10 +321,10 @@ fn decode_verify_proof(
},
};
let proof_parameters = if external_proof {
- let offset = match crate::solana_core_read_u32_le(bytes, 1) {
+ let offset = match crate::decoder_solana_core_read_u32_le(bytes, 1) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(descriptor.entry_code),
"zk_elgamal_proof_account_offset_invalid",
error.to_string(),
@@ -342,7 +346,7 @@ fn decode_verify_proof(
let proof_data = match bytes.get(1..) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(descriptor.entry_code),
"zk_elgamal_inline_proof_missing",
"inline ZK ElGamal proof data is missing",
@@ -352,7 +356,7 @@ fn decode_verify_proof(
let context_data = match proof_data.get(..descriptor.context_data_size) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(descriptor.entry_code),
"zk_elgamal_inline_context_truncated",
"inline ZK ElGamal proof context data is truncated",
@@ -362,7 +366,7 @@ fn decode_verify_proof(
let proof_body = match proof_data.get(descriptor.context_data_size..) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(descriptor.entry_code),
"zk_elgamal_inline_proof_body_truncated",
"inline ZK ElGamal proof body is truncated",
@@ -376,28 +380,28 @@ fn decode_verify_proof(
"proofDataByteLength": proof_data.len(),
"contextDataByteLength": context_data.len(),
"proofBodyByteLength": proof_body.len(),
- "proofDataSha256": crate::solana_core_hash_bytes(proof_data),
- "proofDataPrefixHex": crate::solana_core_bounded_hexadecimal_prefix(
+ "proofDataSha256": crate::decoder_solana_core_hash_bytes(proof_data),
+ "proofDataPrefixHex": crate::decoder_solana_core_bounded_hexadecimal_prefix(
proof_data,
PROOF_COMPONENT_PREFIX_BYTES,
),
- "contextDataSha256": crate::solana_core_hash_bytes(context_data),
- "contextDataPrefixHex": crate::solana_core_bounded_hexadecimal_prefix(
+ "contextDataSha256": crate::decoder_solana_core_hash_bytes(context_data),
+ "contextDataPrefixHex": crate::decoder_solana_core_bounded_hexadecimal_prefix(
context_data,
PROOF_COMPONENT_PREFIX_BYTES,
),
- "proofBodySha256": crate::solana_core_hash_bytes(proof_body),
- "proofBodyPrefixHex": crate::solana_core_bounded_hexadecimal_prefix(
+ "proofBodySha256": crate::decoder_solana_core_hash_bytes(proof_body),
+ "proofBodyPrefixHex": crate::decoder_solana_core_bounded_hexadecimal_prefix(
proof_body,
PROOF_COMPONENT_PREFIX_BYTES,
),
})
};
- return crate::solana_core_decoded_result(
+ return crate::decoder_solana_core_decoded_result(
input,
- crate::SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE,
descriptor.entry_code,
- crate::EventFamily::Audit,
+ crate::MdEventFamily::Audit,
false,
accounts,
serde_json::json!({
@@ -491,7 +495,7 @@ fn proof_descriptor(
return std::option::Option::Some(descriptor);
}
-fn runtime_verification(input: &crate::CoreInstructionReplayInput) -> &'static str {
+fn runtime_verification(input: &crate::MdCoreInstructionReplayInput) -> &'static str {
if input.transaction_failed {
return "not_asserted_transaction_failed";
}
@@ -524,7 +528,7 @@ mod tests {
bytes: &[u8],
account_count: usize,
transaction_failed: bool,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
let account_keys = (0..account_count)
.map(|index| {
return serde_json::json!({
@@ -546,7 +550,7 @@ mod tests {
});
})
.collect::>();
- let result = crate::CoreInstructionReplayInput::new(
+ let result = crate::MdCoreInstructionReplayInput::new(
"signature:0",
"signature",
42,
@@ -590,7 +594,7 @@ mod tests {
#[test]
fn coverage_declares_all_thirteen_official_instructions() {
- let coverage = crate::solana_core_zk_elgamal_coverage();
+ let coverage = crate::decoder_solana_core_zk_elgamal_coverage();
assert_eq!(coverage.len(), 13);
for (tag, entry_code) in super::instruction_entries() {
let expected_discriminator = format!("{tag:02x}");
@@ -605,8 +609,10 @@ mod tests {
#[test]
fn official_discriminants_map_to_stable_entry_codes() {
for (tag, entry_code) in super::instruction_entries() {
- let recognition =
- crate::solana_core_zk_elgamal_recognize(&replay_input(&[*tag], 3, false), 100);
+ let recognition = crate::decoder_solana_core_zk_elgamal_recognize(
+ &replay_input(&[*tag], 3, false),
+ 100,
+ );
assert!(recognition.compatible);
assert_eq!(recognition.entry_code.as_deref(), std::option::Option::Some(*entry_code));
}
@@ -615,8 +621,8 @@ mod tests {
#[test]
fn proof_account_mode_decodes_offset_and_context_request() {
let bytes = [1_u8, 44, 0, 0, 0];
- let result = crate::solana_core_zk_elgamal_decode(&replay_input(&bytes, 3, false));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_zk_elgamal_decode(&replay_input(&bytes, 3, false));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
let parameters = &result.observations[0].payload_json["parameters"];
assert_eq!(parameters["proof"]["proofDataSource"], "account");
assert_eq!(parameters["proof"]["proofAccountOffset"], 44);
@@ -628,8 +634,8 @@ mod tests {
#[test]
fn proof_account_mode_requires_the_proof_account() {
let result =
- crate::solana_core_zk_elgamal_decode(&replay_input(&[1, 0, 0, 0, 0], 0, false));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Failed);
+ crate::decoder_solana_core_zk_elgamal_decode(&replay_input(&[1, 0, 0, 0, 0], 0, false));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
@@ -650,9 +656,12 @@ mod tests {
];
for (tag, instruction) in variants {
let bytes = inline_fixture(tag, instruction);
- let result =
- crate::solana_core_zk_elgamal_decode(&replay_input(bytes.as_slice(), 0, true));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_zk_elgamal_decode(&replay_input(
+ bytes.as_slice(),
+ 0,
+ true,
+ ));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(result.observations.len(), 1);
assert!(!result.observations[0].observation_committed);
assert_eq!(
@@ -664,18 +673,20 @@ mod tests {
#[test]
fn invalid_inline_sizes_unknown_tags_and_empty_payload_fail_safely() {
- let truncated = crate::solana_core_zk_elgamal_decode(&replay_input(&[1, 2, 3], 0, false));
- assert_eq!(truncated.status, crate::DecoderOutcomeStatus::Failed);
- let unknown = crate::solana_core_zk_elgamal_decode(&replay_input(&[99], 0, false));
- assert_eq!(unknown.status, crate::DecoderOutcomeStatus::Unsupported);
- let empty = crate::solana_core_zk_elgamal_decode(&replay_input(&[], 0, false));
- assert_eq!(empty.status, crate::DecoderOutcomeStatus::Failed);
+ let truncated =
+ crate::decoder_solana_core_zk_elgamal_decode(&replay_input(&[1, 2, 3], 0, false));
+ assert_eq!(truncated.status, crate::DcApiDecoderOutcomeStatus::Failed);
+ let unknown = crate::decoder_solana_core_zk_elgamal_decode(&replay_input(&[99], 0, false));
+ assert_eq!(unknown.status, crate::DcApiDecoderOutcomeStatus::Unsupported);
+ let empty = crate::decoder_solana_core_zk_elgamal_decode(&replay_input(&[], 0, false));
+ assert_eq!(empty.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn close_context_state_accepts_runtime_trailing_bytes_and_rejects_same_destination() {
- let decoded = crate::solana_core_zk_elgamal_decode(&replay_input(&[0, 7, 8], 3, false));
- assert_eq!(decoded.status, crate::DecoderOutcomeStatus::Decoded);
+ let decoded =
+ crate::decoder_solana_core_zk_elgamal_decode(&replay_input(&[0, 7, 8], 3, false));
+ assert_eq!(decoded.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(decoded.observations[0].payload_json["parameters"]["trailingByteLength"], 2);
let mut same = replay_input(&[0], 3, false);
let accounts = match same.instruction_accounts_json.as_array_mut() {
@@ -688,14 +699,15 @@ mod tests {
std::option::Option::None => panic!("account keys missing"),
};
keys[1]["accountKey"] = keys[0]["accountKey"].clone();
- let failed = crate::solana_core_zk_elgamal_decode(&same);
- assert_eq!(failed.status, crate::DecoderOutcomeStatus::Failed);
+ let failed = crate::decoder_solana_core_zk_elgamal_decode(&same);
+ assert_eq!(failed.status, crate::DcApiDecoderOutcomeStatus::Failed);
}
#[test]
fn failed_transaction_never_claims_runtime_verification_or_commit() {
- let result = crate::solana_core_zk_elgamal_decode(&replay_input(&[4, 0, 0, 0, 0], 1, true));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result =
+ crate::decoder_solana_core_zk_elgamal_decode(&replay_input(&[4, 0, 0, 0, 0], 1, true));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!result.observations[0].observation_committed);
assert_eq!(
result.observations[0].payload_json["parameters"]["runtimeVerification"],
@@ -706,8 +718,8 @@ mod tests {
#[test]
fn serialization_is_deterministic() {
let input = replay_input(&[1, 0, 0, 0, 0], 1, false);
- let first = crate::solana_core_zk_elgamal_decode(&input);
- let second = crate::solana_core_zk_elgamal_decode(&input);
+ let first = crate::decoder_solana_core_zk_elgamal_decode(&input);
+ let second = crate::decoder_solana_core_zk_elgamal_decode(&input);
let first_json = match serde_json::to_string(&first.observations[0].payload_json) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => panic!("first serialization failed: {error}"),
diff --git a/kb-lib/src/decoder/solana/core/zk_token_proof.rs b/kb-lib/src/decoder/solana/core/zk_token_proof.rs
index cdaef3f..7ef76e2 100644
--- a/kb-lib/src/decoder/solana/core/zk_token_proof.rs
+++ b/kb-lib/src/decoder/solana/core/zk_token_proof.rs
@@ -67,28 +67,29 @@ struct ProofDescriptor {
}
/// Returns declared historical and current ZK Token Proof coverage.
-pub(crate) fn zk_token_proof_coverage() -> std::vec::Vec {
+pub(crate) fn decoder_solana_core_zk_token_proof_coverage()
+-> std::vec::Vec {
let mut coverage = instruction_entries()
.iter()
.map(|(tag, entry_code)| {
- return crate::DecoderCoverageDeclaration {
+ return crate::DcApiDecoderCoverageDeclaration {
program_id: kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID.to_string(),
surface_code: std::option::Option::Some(
- crate::SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE.to_string(),
+ crate::DC_SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE.to_string(),
),
- entry_kind: crate::DecoderCoverageEntryKind::Instruction,
+ entry_kind: crate::DcApiDecoderCoverageEntryKind::Instruction,
entry_code: (*entry_code).to_string(),
discriminator_hex: std::option::Option::Some(format!("{tag:02x}")),
historical: true,
};
})
.collect::>();
- coverage.push(crate::DecoderCoverageDeclaration {
+ coverage.push(crate::DcApiDecoderCoverageDeclaration {
program_id: kb_program_ids::ZK_TOKEN_PROOF_PROGRAM_ID.to_string(),
surface_code: std::option::Option::Some(
- crate::SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE.to_string(),
+ crate::DC_SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE.to_string(),
),
- entry_kind: crate::DecoderCoverageEntryKind::Instruction,
+ entry_kind: crate::DcApiDecoderCoverageEntryKind::Instruction,
entry_code: "current_runtime_noop_invocation".to_string(),
discriminator_hex: std::option::Option::None,
historical: false,
@@ -97,18 +98,18 @@ pub(crate) fn zk_token_proof_coverage() -> std::vec::Vec crate::DecoderRecognition {
- let bytes = match crate::solana_core_decode_instruction_data(input) {
+) -> crate::DcApiDecoderRecognition {
+ let bytes = match crate::decoder_solana_core_decode_instruction_data(input) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(_error) => {
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
false,
priority,
std::option::Option::Some(
- crate::SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE.to_string(),
+ crate::DC_SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE.to_string(),
),
std::option::Option::Some("malformed_zk_token_proof_instruction".to_string()),
std::option::Option::None,
@@ -138,23 +139,23 @@ pub(crate) fn zk_token_proof_recognize(
},
std::option::Option::None => "current_runtime_noop_invocation",
};
- return crate::DecoderRecognition::compatible(
+ return crate::DcApiDecoderRecognition::compatible(
true,
priority,
- std::option::Option::Some(crate::SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE.to_string()),
std::option::Option::Some(entry_code.to_string()),
- crate::solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(1)),
+ crate::decoder_solana_core_hexadecimal_prefix(bytes.as_slice(), bytes.len().min(1)),
);
}
/// Decodes one historical ZK Token Proof layout without recomputing any proof.
-pub(crate) fn zk_token_proof_decode(
- input: &crate::CoreInstructionReplayInput,
-) -> crate::DecoderExecutionResult {
- let bytes = match crate::solana_core_decode_instruction_data(input) {
+pub(crate) fn decoder_solana_core_zk_token_proof_decode(
+ input: &crate::MdCoreInstructionReplayInput,
+) -> crate::DcApiDecoderExecutionResult {
+ let bytes = match crate::decoder_solana_core_decode_instruction_data(input) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("malformed_zk_token_proof_instruction"),
"zk_token_proof_payload_invalid",
error.to_string(),
@@ -184,7 +185,7 @@ pub(crate) fn zk_token_proof_decode(
let inline_size = match descriptor.proof_data_size.checked_add(1) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(descriptor.entry_code),
"zk_token_proof_inline_size_overflow",
"historical ZK Token Proof inline size overflowed usize",
@@ -198,26 +199,27 @@ pub(crate) fn zk_token_proof_decode(
}
fn decode_current_noop(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
historical_parse_status: &str,
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
let accounts =
- match crate::solana_core_resolve_accounts(input, &[], 0, std::option::Option::None) {
+ match crate::decoder_solana_core_resolve_accounts(input, &[], 0, std::option::Option::None)
+ {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("current_runtime_noop_invocation"),
"zk_token_proof_accounts_invalid",
error.to_string(),
);
},
};
- return crate::solana_core_decoded_result(
+ return crate::decoder_solana_core_decoded_result(
input,
- crate::SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE,
"current_runtime_noop_invocation",
- crate::EventFamily::Audit,
+ crate::MdEventFamily::Audit,
false,
accounts,
serde_json::json!({
@@ -225,8 +227,8 @@ fn decode_current_noop(
"historicalParseStatus": historical_parse_status,
"historicalDiscriminator": bytes.first().copied(),
"payloadByteLength": bytes.len(),
- "payloadSha256": crate::solana_core_hash_bytes(bytes),
- "payloadPrefixHex": crate::solana_core_bounded_hexadecimal_prefix(
+ "payloadSha256": crate::decoder_solana_core_hash_bytes(bytes),
+ "payloadPrefixHex": crate::decoder_solana_core_bounded_hexadecimal_prefix(
bytes,
PROOF_COMPONENT_PREFIX_BYTES,
),
@@ -244,15 +246,15 @@ fn decode_current_noop(
}
fn decode_close_context_state(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
let roles = [
- crate::SolanaCoreAccountRole::new("proof_context_state", true, false),
- crate::SolanaCoreAccountRole::new("lamport_destination", true, false),
- crate::SolanaCoreAccountRole::new("context_state_authority", false, true),
+ crate::DcSolanaCoreAccountRole::new("proof_context_state", true, false),
+ crate::DcSolanaCoreAccountRole::new("lamport_destination", true, false),
+ crate::DcSolanaCoreAccountRole::new("context_state_authority", false, true),
];
- let accounts = match crate::solana_core_resolve_accounts(
+ let accounts = match crate::decoder_solana_core_resolve_accounts(
input,
roles.as_slice(),
0,
@@ -260,7 +262,7 @@ fn decode_close_context_state(
) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("close_context_state"),
"zk_token_proof_close_accounts_invalid",
error.to_string(),
@@ -270,7 +272,7 @@ fn decode_close_context_state(
let account_array = match accounts.as_array() {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some("close_context_state"),
"zk_token_proof_close_accounts_not_array",
"resolved ZK Token Proof close accounts are not an array",
@@ -293,11 +295,11 @@ fn decode_close_context_state(
std::option::Option::Some(value) => value,
std::option::Option::None => &[],
};
- return crate::solana_core_decoded_result(
+ return crate::decoder_solana_core_decoded_result(
input,
- crate::SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE,
"close_context_state",
- crate::EventFamily::Audit,
+ crate::MdEventFamily::Audit,
true,
accounts,
serde_json::json!({
@@ -305,8 +307,8 @@ fn decode_close_context_state(
"historicalAccountLayoutValid": historical_account_layout_valid,
"historicalRuntimeAcceptsTrailingBytes": true,
"trailingByteLength": trailing.len(),
- "trailingSha256": crate::solana_core_hash_bytes(trailing),
- "trailingPrefixHex": crate::solana_core_bounded_hexadecimal_prefix(
+ "trailingSha256": crate::decoder_solana_core_hash_bytes(trailing),
+ "trailingPrefixHex": crate::decoder_solana_core_bounded_hexadecimal_prefix(
trailing,
PROOF_COMPONENT_PREFIX_BYTES,
),
@@ -326,15 +328,15 @@ fn decode_close_context_state(
}
fn decode_verify_proof(
- input: &crate::CoreInstructionReplayInput,
+ input: &crate::MdCoreInstructionReplayInput,
bytes: &[u8],
descriptor: ProofDescriptor,
-) -> crate::DecoderExecutionResult {
+) -> crate::DcApiDecoderExecutionResult {
let external_proof = bytes.len() == PROOF_ACCOUNT_INSTRUCTION_BYTES;
let account_count = match input.instruction_accounts_json.as_array() {
std::option::Option::Some(value) => value.len(),
std::option::Option::None => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(descriptor.entry_code),
"zk_token_proof_accounts_not_array",
"ZK Token Proof instruction accounts are not an array",
@@ -346,13 +348,13 @@ fn decode_verify_proof(
if external_proof { account_count >= 3 } else { account_count >= 2 };
let mut roles = std::vec::Vec::new();
if external_proof {
- roles.push(crate::SolanaCoreAccountRole::new("proof_data_account", false, false));
+ roles.push(crate::DcSolanaCoreAccountRole::new("proof_data_account", false, false));
}
if context_state_requested {
- roles.push(crate::SolanaCoreAccountRole::new("proof_context_state", true, false));
- roles.push(crate::SolanaCoreAccountRole::new("context_state_authority", false, false));
+ roles.push(crate::DcSolanaCoreAccountRole::new("proof_context_state", true, false));
+ roles.push(crate::DcSolanaCoreAccountRole::new("context_state_authority", false, false));
}
- let accounts = match crate::solana_core_resolve_accounts(
+ let accounts = match crate::decoder_solana_core_resolve_accounts(
input,
roles.as_slice(),
0,
@@ -360,7 +362,7 @@ fn decode_verify_proof(
) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(descriptor.entry_code),
"zk_token_proof_accounts_invalid",
error.to_string(),
@@ -371,7 +373,7 @@ fn decode_verify_proof(
{
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(descriptor.entry_code),
"zk_token_proof_official_size_inconsistent",
"historical ZK Token Proof context size exceeds proof data size",
@@ -379,10 +381,10 @@ fn decode_verify_proof(
},
};
let proof_parameters = if external_proof {
- let offset = match crate::solana_core_read_u32_le(bytes, 1) {
+ let offset = match crate::decoder_solana_core_read_u32_le(bytes, 1) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(descriptor.entry_code),
"zk_token_proof_account_offset_invalid",
error.to_string(),
@@ -408,7 +410,7 @@ fn decode_verify_proof(
let context_data = match proof_data.get(..descriptor.context_data_size) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(descriptor.entry_code),
"zk_token_proof_inline_context_truncated",
"inline historical ZK Token Proof context data is truncated",
@@ -418,7 +420,7 @@ fn decode_verify_proof(
let proof_body = match proof_data.get(descriptor.context_data_size..) {
std::option::Option::Some(value) => value,
std::option::Option::None => {
- return crate::solana_core_failed_result(
+ return crate::decoder_solana_core_failed_result(
std::option::Option::Some(descriptor.entry_code),
"zk_token_proof_inline_body_truncated",
"inline historical ZK Token Proof body is truncated",
@@ -432,18 +434,18 @@ fn decode_verify_proof(
"proofDataByteLength": proof_data.len(),
"contextDataByteLength": context_data.len(),
"proofBodyByteLength": proof_body.len(),
- "proofDataSha256": crate::solana_core_hash_bytes(proof_data),
- "proofDataPrefixHex": crate::solana_core_bounded_hexadecimal_prefix(
+ "proofDataSha256": crate::decoder_solana_core_hash_bytes(proof_data),
+ "proofDataPrefixHex": crate::decoder_solana_core_bounded_hexadecimal_prefix(
proof_data,
PROOF_COMPONENT_PREFIX_BYTES,
),
- "contextDataSha256": crate::solana_core_hash_bytes(context_data),
- "contextDataPrefixHex": crate::solana_core_bounded_hexadecimal_prefix(
+ "contextDataSha256": crate::decoder_solana_core_hash_bytes(context_data),
+ "contextDataPrefixHex": crate::decoder_solana_core_bounded_hexadecimal_prefix(
context_data,
PROOF_COMPONENT_PREFIX_BYTES,
),
- "proofBodySha256": crate::solana_core_hash_bytes(proof_body),
- "proofBodyPrefixHex": crate::solana_core_bounded_hexadecimal_prefix(
+ "proofBodySha256": crate::decoder_solana_core_hash_bytes(proof_body),
+ "proofBodyPrefixHex": crate::decoder_solana_core_bounded_hexadecimal_prefix(
proof_body,
PROOF_COMPONENT_PREFIX_BYTES,
),
@@ -454,11 +456,11 @@ fn decode_verify_proof(
} else {
descriptor.historical_inline_availability
};
- return crate::solana_core_decoded_result(
+ return crate::decoder_solana_core_decoded_result(
input,
- crate::SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE,
+ crate::DC_SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE,
descriptor.entry_code,
- crate::EventFamily::Audit,
+ crate::MdEventFamily::Audit,
true,
accounts,
serde_json::json!({
@@ -502,14 +504,14 @@ fn historical_account_layout(external_proof: bool, account_count: usize) -> &'st
};
}
-fn runtime_execution_outcome(input: &crate::CoreInstructionReplayInput) -> &'static str {
+fn runtime_execution_outcome(input: &crate::MdCoreInstructionReplayInput) -> &'static str {
if input.transaction_failed {
return "not_asserted_transaction_failed";
}
return "accepted_in_successful_transaction";
}
-fn verification_claim(input: &crate::CoreInstructionReplayInput) -> &'static str {
+fn verification_claim(input: &crate::MdCoreInstructionReplayInput) -> &'static str {
if input.transaction_failed {
return "not_asserted_transaction_failed";
}
@@ -658,7 +660,7 @@ mod tests {
account_count: usize,
transaction_failed: bool,
instruction_path: &str,
- ) -> crate::CoreInstructionReplayInput {
+ ) -> crate::MdCoreInstructionReplayInput {
let account_keys = (0..account_count)
.map(|index| {
return serde_json::json!({
@@ -680,7 +682,7 @@ mod tests {
});
})
.collect::>();
- let result = crate::CoreInstructionReplayInput::new(
+ let result = crate::MdCoreInstructionReplayInput::new(
format!("signature:{instruction_path}"),
"signature",
42,
@@ -728,7 +730,7 @@ mod tests {
#[test]
fn coverage_declares_seventeen_historical_entries_and_current_noop_fallback() {
- let coverage = crate::solana_core_zk_token_proof_coverage();
+ let coverage = crate::decoder_solana_core_zk_token_proof_coverage();
assert_eq!(coverage.len(), 18);
assert_eq!(coverage.iter().filter(|entry| return entry.historical).count(), 17);
assert!(coverage.iter().any(|entry| {
@@ -742,7 +744,7 @@ mod tests {
fn official_discriminants_map_to_stable_entry_codes() {
for (tag, entry_code) in super::instruction_entries() {
let bytes = if *tag == 0 { vec![*tag] } else { vec![*tag, 0, 0, 0, 0] };
- let recognition = crate::solana_core_zk_token_proof_recognize(
+ let recognition = crate::decoder_solana_core_zk_token_proof_recognize(
&replay_input(bytes.as_slice(), 3, false, "0"),
100,
);
@@ -795,13 +797,13 @@ mod tests {
assert_eq!(descriptor.proof_data_size, proof_data_size);
assert_eq!(descriptor.context_data_size, context_data_size);
let bytes = inline_fixture(instruction);
- let result = crate::solana_core_zk_token_proof_decode(&replay_input(
+ let result = crate::decoder_solana_core_zk_token_proof_decode(&replay_input(
bytes.as_slice(),
0,
true,
"0",
));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(result.observations.len(), 1);
assert!(!result.observations[0].observation_committed);
assert_eq!(
@@ -813,13 +815,13 @@ mod tests {
#[test]
fn proof_account_mode_is_structured_and_historical_feature_gate_is_explicit() {
- let result = crate::solana_core_zk_token_proof_decode(&replay_input(
+ let result = crate::decoder_solana_core_zk_token_proof_decode(&replay_input(
&[1, 44, 0, 0, 0],
3,
false,
"0",
));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
let parameters = &result.observations[0].payload_json["parameters"];
assert_eq!(parameters["proof"]["proofDataSource"], "account");
assert_eq!(parameters["proof"]["proofAccountOffset"], 44);
@@ -839,13 +841,13 @@ mod tests {
];
for instruction in variants {
let bytes = inline_fixture(instruction);
- let result = crate::solana_core_zk_token_proof_decode(&replay_input(
+ let result = crate::decoder_solana_core_zk_token_proof_decode(&replay_input(
bytes.as_slice(),
0,
false,
"0",
));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.observations[0].payload_json["parameters"]["historicalVariantAvailability"],
"gated_by_enable_zk_transfer_with_fee"
@@ -857,9 +859,10 @@ mod tests {
fn malformed_historical_shapes_decode_as_current_noop_instead_of_false_failure() {
let fixtures: &[&[u8]] = &[&[], &[99], &[1, 2, 3]];
for bytes in fixtures {
- let result =
- crate::solana_core_zk_token_proof_decode(&replay_input(bytes, 1, false, "0"));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_zk_token_proof_decode(&replay_input(
+ bytes, 1, false, "0",
+ ));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert_eq!(
result.recognized_entry_code.as_deref(),
std::option::Option::Some("current_runtime_noop_invocation")
@@ -878,23 +881,23 @@ mod tests {
#[test]
fn historical_account_arity_is_reported_without_overriding_current_noop_acceptance() {
let inline = inline_fixture(super::HistoricalProofInstruction::VerifyZeroBalance);
- let inline_result = crate::solana_core_zk_token_proof_decode(&replay_input(
+ let inline_result = crate::decoder_solana_core_zk_token_proof_decode(&replay_input(
inline.as_slice(),
1,
false,
"0",
));
- assert_eq!(inline_result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(inline_result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(inline_result.observations[0].payload_json["parameters"]["historicalAccountLayoutValid"]
.as_bool()
.is_some_and(|value| return !value));
- let account_result = crate::solana_core_zk_token_proof_decode(&replay_input(
+ let account_result = crate::decoder_solana_core_zk_token_proof_decode(&replay_input(
&[1, 0, 0, 0, 0],
2,
false,
"0",
));
- assert_eq!(account_result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(account_result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(account_result.observations[0].payload_json["parameters"]["historicalAccountLayoutValid"]
.as_bool()
.is_some_and(|value| return !value));
@@ -902,9 +905,13 @@ mod tests {
#[test]
fn close_context_state_preserves_historical_intent_without_claiming_mutation() {
- let result =
- crate::solana_core_zk_token_proof_decode(&replay_input(&[0, 7, 8], 3, false, "0"));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_zk_token_proof_decode(&replay_input(
+ &[0, 7, 8],
+ 3,
+ false,
+ "0",
+ ));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
let parameters = &result.observations[0].payload_json["parameters"];
assert!(
parameters["historicalAccountLayoutValid"]
@@ -924,13 +931,13 @@ mod tests {
#[test]
fn inner_invocation_never_claims_historical_verification() {
let bytes = inline_fixture(super::HistoricalProofInstruction::VerifyPubkeyValidity);
- let result = crate::solana_core_zk_token_proof_decode(&replay_input(
+ let result = crate::decoder_solana_core_zk_token_proof_decode(&replay_input(
bytes.as_slice(),
0,
false,
"0/1",
));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(
result.observations[0].payload_json["parameters"]["historicalInnerInstructionSupport"]
.as_bool()
@@ -945,9 +952,13 @@ mod tests {
#[test]
fn failed_transaction_is_non_committed_and_never_claims_verification() {
let bytes = inline_fixture(super::HistoricalProofInstruction::VerifyZeroBalance);
- let result =
- crate::solana_core_zk_token_proof_decode(&replay_input(bytes.as_slice(), 0, true, "0"));
- assert_eq!(result.status, crate::DecoderOutcomeStatus::Decoded);
+ let result = crate::decoder_solana_core_zk_token_proof_decode(&replay_input(
+ bytes.as_slice(),
+ 0,
+ true,
+ "0",
+ ));
+ assert_eq!(result.status, crate::DcApiDecoderOutcomeStatus::Decoded);
assert!(!result.observations[0].observation_committed);
assert_eq!(
result.observations[0].payload_json["parameters"]["cryptographicVerificationClaim"],
@@ -958,8 +969,8 @@ mod tests {
#[test]
fn serialization_is_deterministic() {
let input = replay_input(&[1, 0, 0, 0, 0], 1, false, "0");
- let first = crate::solana_core_zk_token_proof_decode(&input);
- let second = crate::solana_core_zk_token_proof_decode(&input);
+ let first = crate::decoder_solana_core_zk_token_proof_decode(&input);
+ let second = crate::decoder_solana_core_zk_token_proof_decode(&input);
let first_json = match serde_json::to_string(&first.observations[0].payload_json) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => panic!("first serialization failed: {error}"),
diff --git a/kb-lib/src/decoder/spl.rs b/kb-lib/src/decoder/spl.rs
index aed2830..b91d2a1 100644
--- a/kb-lib/src/decoder/spl.rs
+++ b/kb-lib/src/decoder/spl.rs
@@ -3,142 +3,142 @@
//! `spl` decoder family.
-pub mod account_compression;
-pub mod associated_token_account;
-pub mod elgamal_registry;
-pub mod memo;
-pub mod noop;
-pub mod single_pool;
-pub mod stake_pool;
+mod account_compression;
+mod associated_token_account;
+mod elgamal_registry;
+mod memo;
+mod noop;
+mod single_pool;
+mod stake_pool;
mod token;
-pub mod token_2022;
+mod token2022;
/// Current stable Associated Token Account decoded event contract version.
-pub(crate) use self::associated_token_account::SPL_ASSOCIATED_TOKEN_ACCOUNT_EVENT_VERSION;
+pub(crate) use self::associated_token_account::DC_SPL_ATA_EVENT_VERSION;
/// Exact Associated Token Account instructions published by the official interface.
-pub(crate) use self::associated_token_account::SPL_ASSOCIATED_TOKEN_ACCOUNT_INSTRUCTION_ENTRIES;
+pub(crate) use self::associated_token_account::DC_SPL_ATA_INSTRUCTION_ENTRIES;
/// Maximum retained account-key text length for the Associated Token Account decoder.
-pub(crate) use self::associated_token_account::SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_ACCOUNT_KEY_BYTES;
+pub(crate) use self::associated_token_account::DC_SPL_ATA_MAX_ACCOUNT_KEY_BYTES;
/// Maximum retained instruction account count for the Associated Token Account decoder.
-pub(crate) use self::associated_token_account::SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_ACCOUNTS;
+pub(crate) use self::associated_token_account::DC_SPL_ATA_MAX_ACCOUNTS;
/// Maximum retained semantic diagnostic count for the Associated Token Account decoder.
-pub(crate) use self::associated_token_account::SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_DIAGNOSTICS;
+pub(crate) use self::associated_token_account::DC_SPL_ATA_MAX_DIAGNOSTICS;
/// Maximum retained Associated Token Account instruction payload size.
-pub(crate) use self::associated_token_account::SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_INSTRUCTION_BYTES;
+pub(crate) use self::associated_token_account::DC_SPL_ATA_MAX_INSTRUCTION_BYTES;
/// Maximum retained transaction account-key count for the Associated Token Account decoder.
-pub(crate) use self::associated_token_account::SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_TRANSACTION_KEYS;
+pub(crate) use self::associated_token_account::DC_SPL_ATA_MAX_TRANSACTION_KEYS;
/// Stable protocol and surface code for the Associated Token Account program.
-pub(crate) use self::associated_token_account::SPL_ASSOCIATED_TOKEN_ACCOUNT_SURFACE_CODE;
+pub(crate) use self::associated_token_account::DC_SPL_ATA_SURFACE_CODE;
/// Canonical tracing target for the Associated Token Account decoder.
-pub(crate) use self::associated_token_account::SPL_ASSOCIATED_TOKEN_ACCOUNT_TRACING_TARGET;
+pub(crate) use self::associated_token_account::DC_SPL_ATA_TRACING_TARGET;
/// Decodes one bounded Associated Token Account instruction.
-pub(crate) use self::associated_token_account::spl_associated_token_account_decode;
+pub(crate) use self::associated_token_account::decoder_spl_associated_token_account_decode;
/// Returns the exact entry matching an Associated Token Account wire.
-pub(crate) use self::associated_token_account::spl_associated_token_account_entry;
+pub(crate) use self::associated_token_account::decoder_spl_associated_token_account_entry;
/// Reads one bounded Associated Token Account payload.
-pub(crate) use self::associated_token_account::spl_associated_token_account_payload;
-/// One parsed SPL ElGamal registry instruction.
-pub(crate) use self::elgamal_registry::ParsedRegistryInstruction;
+pub(crate) use self::associated_token_account::decoder_spl_associated_token_account_payload;
/// Current stable SPL ElGamal registry event contract version.
-pub(crate) use self::elgamal_registry::SPL_ELGAMAL_REGISTRY_EVENT_VERSION;
+pub(crate) use self::elgamal_registry::DC_SPL_ELGAMAL_REGISTRY_EVENT_VERSION;
/// Maximum retained SPL ElGamal registry instruction payload size.
-pub(crate) use self::elgamal_registry::SPL_ELGAMAL_REGISTRY_MAX_INSTRUCTION_BYTES;
+pub(crate) use self::elgamal_registry::DC_SPL_ELGAMAL_REGISTRY_MAX_INSTRUCTION_BYTES;
/// Stable SPL ElGamal registry surface code.
-pub(crate) use self::elgamal_registry::SPL_ELGAMAL_REGISTRY_SURFACE_CODE;
+pub(crate) use self::elgamal_registry::DC_SPL_ELGAMAL_REGISTRY_SURFACE_CODE;
/// Canonical tracing target for the SPL ElGamal registry decoder.
-pub(crate) use self::elgamal_registry::SPL_ELGAMAL_REGISTRY_TRACING_TARGET;
+pub(crate) use self::elgamal_registry::DC_SPL_ELGAMAL_REGISTRY_TRACING_TARGET;
+/// One parsed SPL ElGamal registry instruction.
+pub(crate) use self::elgamal_registry::DcSplElGamalRegistryParsedRegistryInstruction;
/// Decodes one bounded SPL ElGamal registry instruction.
-pub(crate) use self::elgamal_registry::spl_elgamal_registry_decode;
+pub(crate) use self::elgamal_registry::decoder_spl_elgamal_registry_decode;
/// Decodes one bounded SPL ElGamal registry instruction payload.
-pub(crate) use self::elgamal_registry::spl_elgamal_registry_decode_payload;
+pub(crate) use self::elgamal_registry::decoder_spl_elgamal_registry_decode_payload;
/// Parses one exact SPL ElGamal registry instruction.
-pub(crate) use self::elgamal_registry::spl_elgamal_registry_parse;
+pub(crate) use self::elgamal_registry::decoder_spl_elgamal_registry_parse;
/// Maximum payload prefix retained for bounded diagnostics.
-pub(crate) use self::memo::SPL_MEMO_DIAGNOSTIC_PREFIX_BYTES;
+pub(crate) use self::memo::DC_SPL_MEMO_DIAGNOSTIC_PREFIX_BYTES;
/// Current stable Memo decoded event contract version.
-pub(crate) use self::memo::SPL_MEMO_EVENT_VERSION;
+pub(crate) use self::memo::DC_SPL_MEMO_EVENT_VERSION;
/// Maximum decoded instruction data retained as a complete Memo payload.
-pub(crate) use self::memo::SPL_MEMO_MAX_PAYLOAD_BYTES;
+pub(crate) use self::memo::DC_SPL_MEMO_MAX_PAYLOAD_BYTES;
/// Stable protocol code shared by Memo generations.
-pub(crate) use self::memo::SPL_MEMO_PROTOCOL_CODE;
+pub(crate) use self::memo::DC_SPL_MEMO_PROTOCOL_CODE;
/// Canonical tracing target for the SPL Memo decoder.
-pub(crate) use self::memo::SPL_MEMO_TRACING_TARGET;
+pub(crate) use self::memo::DC_SPL_MEMO_TRACING_TARGET;
/// Stable Memo v1 surface code.
-pub(crate) use self::memo::SPL_MEMO_V1_SURFACE_CODE;
+pub(crate) use self::memo::DC_SPL_MEMO_V1_SURFACE_CODE;
/// Stable Memo v3 surface code.
-pub(crate) use self::memo::SPL_MEMO_V3_SURFACE_CODE;
+pub(crate) use self::memo::DC_SPL_MEMO_V3_SURFACE_CODE;
/// Stable Memo v4 surface code.
-pub(crate) use self::memo::SPL_MEMO_V4_SURFACE_CODE;
+pub(crate) use self::memo::DC_SPL_MEMO_V4_SURFACE_CODE;
/// Decodes one bounded SPL Memo instruction.
-pub(crate) use self::memo::spl_memo_decode;
+pub(crate) use self::memo::decoder_spl_memo_decode;
/// Maximum prefix retained in bounded classic SPL Token diagnostics.
-pub(crate) use self::token::SPL_TOKEN_DIAGNOSTIC_PREFIX_BYTES;
+pub(crate) use self::token::DC_SPL_TOKEN_DIAGNOSTIC_PREFIX_BYTES;
/// Current stable classic SPL Token decoded event contract version.
-pub(crate) use self::token::SPL_TOKEN_EVENT_VERSION;
+pub(crate) use self::token::DC_SPL_TOKEN_EVENT_VERSION;
/// One exact classic SPL Token instruction entry published by the official interface.
-pub(crate) use self::token::SPL_TOKEN_INSTRUCTION_ENTRIES;
+pub(crate) use self::token::DC_SPL_TOKEN_INSTRUCTION_ENTRIES;
/// Maximum total account metas consumed by one classic SPL Token batch.
-pub(crate) use self::token::SPL_TOKEN_MAX_BATCH_ACCOUNTS;
+pub(crate) use self::token::DC_SPL_TOKEN_MAX_BATCH_ACCOUNTS;
/// Maximum decoded sub-instructions in one classic SPL Token batch.
-pub(crate) use self::token::SPL_TOKEN_MAX_BATCH_INSTRUCTIONS;
+pub(crate) use self::token::DC_SPL_TOKEN_MAX_BATCH_INSTRUCTIONS;
/// Maximum retained classic SPL Token instruction payload size.
-pub(crate) use self::token::SPL_TOKEN_MAX_INSTRUCTION_BYTES;
+pub(crate) use self::token::DC_SPL_TOKEN_MAX_INSTRUCTION_BYTES;
/// Stable protocol and surface code for the classic SPL Token program.
-pub(crate) use self::token::SPL_TOKEN_SURFACE_CODE;
+pub(crate) use self::token::DC_SPL_TOKEN_SURFACE_CODE;
/// Canonical tracing target for the classic SPL Token decoder.
-pub(crate) use self::token::SPL_TOKEN_TRACING_TARGET;
+pub(crate) use self::token::DC_SPL_TOKEN_TRACING_TARGET;
/// Decodes one bounded classic SPL Token instruction.
-pub(crate) use self::token::spl_token_decode;
+pub(crate) use self::token::decoder_spl_token_decode;
/// Returns the published entry matching one classic SPL Token tag.
-pub(crate) use self::token::spl_token_entry_for_tag;
+pub(crate) use self::token::decoder_spl_token_entry_for_tag;
/// Returns the first byte of one retained classic SPL Token payload.
-pub(crate) use self::token::spl_token_payload_tag;
+pub(crate) use self::token::decoder_spl_token_payload_tag;
/// Maximum prefix retained in bounded Token-2022 diagnostics.
-pub(crate) use self::token_2022::SPL_TOKEN_2022_DIAGNOSTIC_PREFIX_BYTES;
+pub(crate) use self::token2022::DC_SPL_TOKEN2022_DIAGNOSTIC_PREFIX_BYTES;
/// Current stable Token-2022 decoded event contract version.
-pub(crate) use self::token_2022::SPL_TOKEN_2022_EVENT_VERSION;
+pub(crate) use self::token2022::DC_SPL_TOKEN2022_EVENT_VERSION;
/// Exact top-level instruction inventory published by the resolved Token-2022 interface.
-pub(crate) use self::token_2022::SPL_TOKEN_2022_INSTRUCTION_ENTRIES;
+pub(crate) use self::token2022::DC_SPL_TOKEN2022_INSTRUCTION_ENTRIES;
/// Maximum total account metas consumed by one Token-2022 batch.
-pub(crate) use self::token_2022::SPL_TOKEN_2022_MAX_BATCH_ACCOUNTS;
+pub(crate) use self::token2022::DC_SPL_TOKEN2022_MAX_BATCH_ACCOUNTS;
/// Maximum decoded sub-instructions in one Token-2022 batch.
-pub(crate) use self::token_2022::SPL_TOKEN_2022_MAX_BATCH_INSTRUCTIONS;
+pub(crate) use self::token2022::DC_SPL_TOKEN2022_MAX_BATCH_INSTRUCTIONS;
/// Maximum retained Token-2022 instruction payload size.
-pub(crate) use self::token_2022::SPL_TOKEN_2022_MAX_INSTRUCTION_BYTES;
+pub(crate) use self::token2022::DC_SPL_TOKEN2022_MAX_INSTRUCTION_BYTES;
/// Maximum retained UTF-8 string size for embedded Token Metadata instructions.
-pub(crate) use self::token_2022::SPL_TOKEN_2022_MAX_METADATA_STRING_BYTES;
+pub(crate) use self::token2022::DC_SPL_TOKEN2022_MAX_METADATA_STRING_BYTES;
/// Stable Token-2022 surface code.
-pub(crate) use self::token_2022::SPL_TOKEN_2022_SURFACE_CODE;
+pub(crate) use self::token2022::DC_SPL_TOKEN2022_SURFACE_CODE;
/// Canonical tracing target for the Token-2022 decoder.
-pub(crate) use self::token_2022::SPL_TOKEN_2022_TRACING_TARGET;
+pub(crate) use self::token2022::DC_SPL_TOKEN2022_TRACING_TARGET;
/// Decodes one bounded Token-2022 instruction.
-pub(crate) use self::token_2022::spl_token_2022_decode;
+pub(crate) use self::token2022::decoder_spl_token2022_decode;
/// Returns the exact entry matching one Token-2022 tag.
-pub(crate) use self::token_2022::spl_token_2022_entry_for_tag;
+pub(crate) use self::token2022::decoder_spl_token2022_entry_for_tag;
/// Returns the first byte of one retained Token-2022 payload.
-pub(crate) use self::token_2022::spl_token_2022_payload_tag;
+pub(crate) use self::token2022::decoder_spl_token2022_payload_tag;
/// Exact decoder for the SPL Associated Token Account program.
-pub use self::associated_token_account::SplAssociatedTokenAccountDecoder;
+pub use self::associated_token_account::DcSplAssociatedTokenAccountDecoder;
/// Exact byte length of one SPL ElGamal registry account.
-pub use self::elgamal_registry::ELGAMAL_REGISTRY_ACCOUNT_LEN;
+pub use self::elgamal_registry::DC_SPL_ELGAMAL_REGISTRY_ACCOUNT_LEN;
/// Parsed SPL ElGamal public-key registry account.
-pub use self::elgamal_registry::ElGamalRegistryState;
+pub use self::elgamal_registry::DcSplElGamalRegistryState;
/// Exact decoder for the SPL ElGamal registry program.
-pub use self::elgamal_registry::SplElgamalRegistryDecoder;
+pub use self::elgamal_registry::DcSplElgamalRegistryDecoder;
/// Parses one exact SPL ElGamal registry account.
-pub use self::elgamal_registry::parse_elgamal_registry_state;
+pub use self::elgamal_registry::decoder_spl_elgamal_registry_parse_elgamal_registry_state;
/// Exact decoder for the three registered SPL Memo generations.
-pub use self::memo::SplMemoDecoder;
+pub use self::memo::DcSplMemoDecoder;
/// Exact decoder for the classic SPL Token program.
-pub use self::token::SplTokenDecoder;
+pub use self::token::DcSplTokenDecoder;
/// Exact decoder for the Token-2022 program.
-pub use self::token_2022::SplToken2022Decoder;
+pub use self::token2022::DcSplToken2022Decoder;
/// Parsed Token-2022 Mint, Account, or Multisig state.
-pub use self::token_2022::Token2022State;
+pub use self::token2022::DcToken2022State;
/// Exact Token-2022 base account state kind.
-pub use self::token_2022::Token2022StateKind;
+pub use self::token2022::DcToken2022StateKind;
/// One exact Token-2022 TLV entry.
-pub use self::token_2022::Token2022TlvEntry;
+pub use self::token2022::DcToken2022TlvEntry;
/// Parses one Token-2022 Mint, Account, or Multisig state.
-pub use self::token_2022::parse_token_2022_state;
+pub use self::token2022::decoder_spl_token2022_parse_token2022_state;
diff --git a/kb-lib/src/decoder/spl/account_compression.rs b/kb-lib/src/decoder/spl/account_compression.rs
index 2e63da5..520407a 100644
--- a/kb-lib/src/decoder/spl/account_compression.rs
+++ b/kb-lib/src/decoder/spl/account_compression.rs
@@ -4,7 +4,7 @@
//! Migration boundary for legacy crate `kb_decoder_spl_account_compression`.
/// Legacy crate name retained for migration and compatibility tracking.
-pub const LEGACY_CRATE: &str = "kb_decoder_spl_account_compression";
+const LEGACY_CRATE: &str = "kb_decoder_spl_account_compression";
/// Current porting status.
-pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
+const MIGRATION_STATUS: &str = "source-preserved-pending-port";
diff --git a/kb-lib/src/decoder/spl/associated_token_account.rs b/kb-lib/src/decoder/spl/associated_token_account.rs
index b287479..9bab31f 100644
--- a/kb-lib/src/decoder/spl/associated_token_account.rs
+++ b/kb-lib/src/decoder/spl/associated_token_account.rs
@@ -8,29 +8,29 @@ mod decoder;
mod wire;
/// Current stable decoded event contract version.
-pub(crate) use self::constants::SPL_ASSOCIATED_TOKEN_ACCOUNT_EVENT_VERSION;
+pub(crate) use self::constants::DC_SPL_ATA_EVENT_VERSION;
/// Exact instructions published by the official interface.
-pub(crate) use self::constants::SPL_ASSOCIATED_TOKEN_ACCOUNT_INSTRUCTION_ENTRIES;
+pub(crate) use self::constants::DC_SPL_ATA_INSTRUCTION_ENTRIES;
/// Maximum retained account-key text length.
-pub(crate) use self::constants::SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_ACCOUNT_KEY_BYTES;
+pub(crate) use self::constants::DC_SPL_ATA_MAX_ACCOUNT_KEY_BYTES;
/// Maximum retained instruction account count.
-pub(crate) use self::constants::SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_ACCOUNTS;
+pub(crate) use self::constants::DC_SPL_ATA_MAX_ACCOUNTS;
/// Maximum retained semantic diagnostic count.
-pub(crate) use self::constants::SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_DIAGNOSTICS;
+pub(crate) use self::constants::DC_SPL_ATA_MAX_DIAGNOSTICS;
/// Maximum retained instruction payload size.
-pub(crate) use self::constants::SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_INSTRUCTION_BYTES;
+pub(crate) use self::constants::DC_SPL_ATA_MAX_INSTRUCTION_BYTES;
/// Maximum retained transaction account-key count.
-pub(crate) use self::constants::SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_TRANSACTION_KEYS;
+pub(crate) use self::constants::DC_SPL_ATA_MAX_TRANSACTION_KEYS;
/// Stable protocol and surface code for the Associated Token Account program.
-pub(crate) use self::constants::SPL_ASSOCIATED_TOKEN_ACCOUNT_SURFACE_CODE;
+pub(crate) use self::constants::DC_SPL_ATA_SURFACE_CODE;
/// Canonical tracing target for the Associated Token Account decoder.
-pub(crate) use self::constants::SPL_ASSOCIATED_TOKEN_ACCOUNT_TRACING_TARGET;
+pub(crate) use self::constants::DC_SPL_ATA_TRACING_TARGET;
/// Decodes one bounded Associated Token Account instruction.
-pub(crate) use self::wire::decode as spl_associated_token_account_decode;
+pub(crate) use self::wire::decoder_spl_associated_token_account_decode;
/// Returns the exact entry matching an Associated Token Account wire.
-pub(crate) use self::wire::entry as spl_associated_token_account_entry;
+pub(crate) use self::wire::decoder_spl_associated_token_account_entry;
/// Reads one bounded Associated Token Account payload.
-pub(crate) use self::wire::payload as spl_associated_token_account_payload;
+pub(crate) use self::wire::decoder_spl_associated_token_account_payload;
/// Exact decoder for the SPL Associated Token Account program.
-pub use self::decoder::SplAssociatedTokenAccountDecoder;
+pub use self::decoder::DcSplAssociatedTokenAccountDecoder;
diff --git a/kb-lib/src/decoder/spl/associated_token_account/constants.rs b/kb-lib/src/decoder/spl/associated_token_account/constants.rs
index 317abd0..527ca9f 100644
--- a/kb-lib/src/decoder/spl/associated_token_account/constants.rs
+++ b/kb-lib/src/decoder/spl/associated_token_account/constants.rs
@@ -4,25 +4,24 @@
//! Local constants for the `kb-lib` SPL Associated Token Account component.
/// Stable protocol and surface code for the Associated Token Account program.
-pub(crate) const SPL_ASSOCIATED_TOKEN_ACCOUNT_SURFACE_CODE: &str = "spl_associated_token_account";
+pub(crate) const DC_SPL_ATA_SURFACE_CODE: &str = "spl_associated_token_account";
/// Current stable decoded event contract version.
-pub(crate) const SPL_ASSOCIATED_TOKEN_ACCOUNT_EVENT_VERSION: u32 = 1;
+pub(crate) const DC_SPL_ATA_EVENT_VERSION: u32 = 1;
/// Maximum retained instruction payload size.
-pub(crate) const SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_INSTRUCTION_BYTES: usize = 64;
+pub(crate) const DC_SPL_ATA_MAX_INSTRUCTION_BYTES: usize = 64;
/// Maximum retained instruction account count.
-pub(crate) const SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_ACCOUNTS: usize = 64;
+pub(crate) const DC_SPL_ATA_MAX_ACCOUNTS: usize = 64;
/// Maximum retained transaction account-key count.
-pub(crate) const SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_TRANSACTION_KEYS: usize = 4_096;
+pub(crate) const DC_SPL_ATA_MAX_TRANSACTION_KEYS: usize = 4_096;
/// Maximum retained account-key text length.
-pub(crate) const SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_ACCOUNT_KEY_BYTES: usize = 128;
+pub(crate) const DC_SPL_ATA_MAX_ACCOUNT_KEY_BYTES: usize = 128;
/// Maximum retained semantic diagnostic count.
-pub(crate) const SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_DIAGNOSTICS: usize = 32;
+pub(crate) const DC_SPL_ATA_MAX_DIAGNOSTICS: usize = 32;
/// Exact instructions published by `spl-associated-token-account-interface` 2.0.0.
-pub(crate) const SPL_ASSOCIATED_TOKEN_ACCOUNT_INSTRUCTION_ENTRIES: &[(u8, &str, bool)] = &[
+pub(crate) const DC_SPL_ATA_INSTRUCTION_ENTRIES: &[(u8, &str, bool)] = &[
(0, "create", false),
(1, "create_idempotent", false),
(2, "recover_nested", false),
];
/// Canonical tracing target for the Associated Token Account decoder.
-pub(crate) const SPL_ASSOCIATED_TOKEN_ACCOUNT_TRACING_TARGET: &str =
- "kb-lib.decoder.spl.associated_token_account";
+pub(crate) const DC_SPL_ATA_TRACING_TARGET: &str = "kb-lib.decoder.spl.associated_token_account";
diff --git a/kb-lib/src/decoder/spl/associated_token_account/decoder.rs b/kb-lib/src/decoder/spl/associated_token_account/decoder.rs
index 5f110c2..2885db7 100644
--- a/kb-lib/src/decoder/spl/associated_token_account/decoder.rs
+++ b/kb-lib/src/decoder/spl/associated_token_account/decoder.rs
@@ -3,9 +3,9 @@
//! Exact SPL Associated Token Account dispatch for the common decode pipeline.
-const SURFACES: &[crate::DecoderSurface] = &[crate::DecoderSurface {
+const SURFACES: &[crate::DcApiDecoderSurface] = &[crate::DcApiDecoderSurface {
program_id: kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID,
- surface_code: crate::SPL_ASSOCIATED_TOKEN_ACCOUNT_SURFACE_CODE,
+ surface_code: crate::DC_SPL_ATA_SURFACE_CODE,
priority: 100,
}];
@@ -13,9 +13,9 @@ const PROGRAM_IDS: &[&str] = &[kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID];
/// Exact decoder for the SPL Associated Token Account program.
#[derive(Clone, Debug, Default)]
-pub struct SplAssociatedTokenAccountDecoder;
+pub struct DcSplAssociatedTokenAccountDecoder;
-impl crate::ProtocolDecoder for crate::SplAssociatedTokenAccountDecoder {
+impl crate::DcApiProtocolDecoder for crate::DcSplAssociatedTokenAccountDecoder {
fn decoder_name(&self) -> &'static str {
return "kb_decoder_spl_associated_token_account";
}
@@ -30,45 +30,45 @@ impl crate::ProtocolDecoder for crate::SplAssociatedTokenAccountDecoder {
fn supports_observation(
&self,
- observation: &crate::ProgramObservation,
- ) -> crate::DecoderSupport {
- return if crate::ProtocolDecoder::handles_program_id(self, &observation.program_id) {
- crate::DecoderSupport::Yes
+ observation: &crate::MdProgramObservation,
+ ) -> crate::DcApiDecoderSupport {
+ return if crate::DcApiProtocolDecoder::handles_program_id(self, &observation.program_id) {
+ crate::DcApiDecoderSupport::Yes
} else {
- crate::DecoderSupport::No
+ crate::DcApiDecoderSupport::No
};
}
fn decode_observation(
&self,
- _observation: &crate::ProgramObservation,
- ) -> kb_core::Result> {
+ _observation: &crate::MdProgramObservation,
+ ) -> kb_core::Result> {
return std::result::Result::Ok(std::vec::Vec::new());
}
}
-impl crate::InstructionDecoder for crate::SplAssociatedTokenAccountDecoder {
- fn identity(&self) -> crate::DecoderIdentity {
- return crate::DecoderIdentity {
- name: crate::SPL_ASSOCIATED_TOKEN_ACCOUNT_SURFACE_CODE.to_string(),
+impl crate::DcApiInstructionDecoder for crate::DcSplAssociatedTokenAccountDecoder {
+ fn identity(&self) -> crate::DcApiDecoderIdentity {
+ return crate::DcApiDecoderIdentity {
+ name: crate::DC_SPL_ATA_SURFACE_CODE.to_string(),
version: env!("CARGO_PKG_VERSION").to_string(),
};
}
- fn surfaces(&self) -> &'static [crate::DecoderSurface] {
+ fn surfaces(&self) -> &'static [crate::DcApiDecoderSurface] {
return SURFACES;
}
- fn coverage(&self) -> std::vec::Vec {
- return crate::SPL_ASSOCIATED_TOKEN_ACCOUNT_INSTRUCTION_ENTRIES
+ fn coverage(&self) -> std::vec::Vec {
+ return crate::DC_SPL_ATA_INSTRUCTION_ENTRIES
.iter()
.map(|(tag, code, historical)| {
- return crate::DecoderCoverageDeclaration {
+ return crate::DcApiDecoderCoverageDeclaration {
program_id: kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID.to_string(),
surface_code: std::option::Option::Some(
- crate::SPL_ASSOCIATED_TOKEN_ACCOUNT_SURFACE_CODE.to_string(),
+ crate::DC_SPL_ATA_SURFACE_CODE.to_string(),
),
- entry_kind: crate::DecoderCoverageEntryKind::Instruction,
+ entry_kind: crate::DcApiDecoderCoverageEntryKind::Instruction,
entry_code: (*code).to_string(),
discriminator_hex: std::option::Option::Some(format!("{tag:02x}")),
historical: *historical,
@@ -77,40 +77,47 @@ impl crate::InstructionDecoder for crate::SplAssociatedTokenAccountDecoder {
.collect();
}
- fn recognize(&self, input: &crate::CoreInstructionReplayInput) -> crate::DecoderRecognition {
+ fn recognize(
+ &self,
+ input: &crate::MdCoreInstructionReplayInput,
+ ) -> crate::DcApiDecoderRecognition {
if input.program_id != kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID {
- return crate::DecoderRecognition::incompatible();
+ return crate::DcApiDecoderRecognition::incompatible();
}
- let wire = crate::spl_associated_token_account_payload(input).ok();
+ let wire = crate::decoder_spl_associated_token_account_payload(input).ok();
let entry = wire
.as_ref()
- .and_then(|bytes| return crate::spl_associated_token_account_entry(bytes));
- return crate::DecoderRecognition::compatible(
+ .and_then(|bytes| return crate::decoder_spl_associated_token_account_entry(bytes));
+ return crate::DcApiDecoderRecognition::compatible(
entry.is_some(),
100,
- std::option::Option::Some(crate::SPL_ASSOCIATED_TOKEN_ACCOUNT_SURFACE_CODE.to_string()),
+ std::option::Option::Some(crate::DC_SPL_ATA_SURFACE_CODE.to_string()),
entry.map(|(_, code, _)| return code.to_string()),
wire.and_then(|bytes| return bytes.first().map(|tag| return format!("{tag:02x}"))),
);
}
- fn decode(&self, input: &crate::CoreInstructionReplayInput) -> crate::DecoderExecutionResult {
+ fn decode(
+ &self,
+ input: &crate::MdCoreInstructionReplayInput,
+ ) -> crate::DcApiDecoderExecutionResult {
if input.program_id != kb_program_ids::ASSOCIATED_TOKEN_PROGRAM_ID {
- return crate::DecoderExecutionResult::unsupported(std::option::Option::None);
+ return crate::DcApiDecoderExecutionResult::unsupported(std::option::Option::None);
}
- let result = crate::spl_associated_token_account_decode(input);
+ let result = crate::decoder_spl_associated_token_account_decode(input);
if matches!(
result.status,
- crate::DecoderOutcomeStatus::Failed | crate::DecoderOutcomeStatus::Unsupported
+ crate::DcApiDecoderOutcomeStatus::Failed
+ | crate::DcApiDecoderOutcomeStatus::Unsupported
) {
tracing::error!(
- target: crate::SPL_ASSOCIATED_TOKEN_ACCOUNT_TRACING_TARGET,
+ target: crate::DC_SPL_ATA_TRACING_TARGET,
action = "decode_failure",
signature = %input.signature,
slot = input.slot,
instruction_path = %input.instruction_path,
program_id = %input.program_id,
- processor_name = crate::SPL_ASSOCIATED_TOKEN_ACCOUNT_SURFACE_CODE,
+ processor_name = crate::DC_SPL_ATA_SURFACE_CODE,
processor_version = env!("CARGO_PKG_VERSION"),
input_key = %input.replay_input_key,
result_status = ?result.status,
@@ -119,7 +126,7 @@ impl crate::InstructionDecoder for crate::SplAssociatedTokenAccountDecoder {
);
}
tracing::debug!(
- target: crate::SPL_ASSOCIATED_TOKEN_ACCOUNT_TRACING_TARGET,
+ target: crate::DC_SPL_ATA_TRACING_TARGET,
action = "decode",
signature = %input.signature,
instruction_path = %input.instruction_path,
@@ -180,12 +187,12 @@ mod tests {
}
assert_eq!(matrix["surfaceEquality"]["matrixVariantCount"], 3);
assert_eq!(matrix["surfaceEquality"]["officialInterfaceVariantCount"], 3);
- let compiled = crate::SPL_ASSOCIATED_TOKEN_ACCOUNT_INSTRUCTION_ENTRIES
+ let compiled = crate::DC_SPL_ATA_INSTRUCTION_ENTRIES
.iter()
.map(|(tag, code, _)| return (std::option::Option::Some(*tag), (*code).to_string()))
.collect::