From dcd23abb92adab2ae69baefb3623e29bdaee19dd Mon Sep 17 00:00:00 2001 From: SinuS Von SifriduS Date: Wed, 19 Aug 2026 13:15:09 +0200 Subject: [PATCH] v0.2.5-pre.005-fix.001 --- Cargo.toml | 4 +- crates/ksp-wallet-lib/src/wallet.rs | 6 +- crates/ksp-wallet-lib/src/wire.rs | 4 +- deltas/0.2.5/pre.005-fix.001.md | 119 ++++++++++++++++++++++++++++ 4 files changed, 126 insertions(+), 7 deletions(-) create mode 100644 deltas/0.2.5/pre.005-fix.001.md diff --git a/Cargo.toml b/Cargo.toml index 94d20cb..13928f1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,12 @@ # file: Cargo.toml -# version: 151 +# version: 152 [workspace] resolver = "3" members = ["crates/ksp-app-config-desk", "crates/ksp-config-lib", "crates/ksp-core-lib", "crates/ksp-logging-lib", "crates/ksp-onchain-transport-lib", "crates/ksp-wallet-lib"] [workspace.package] -version = "0.2.5-pre.5" +version = "0.2.5-pre.5.fix.1" edition = "2024" license = "MIT" repository = "https://git.sasedev.com/Sasedev/khadhroony-solana-project" diff --git a/crates/ksp-wallet-lib/src/wallet.rs b/crates/ksp-wallet-lib/src/wallet.rs index 8ffdc0e..0b61163 100644 --- a/crates/ksp-wallet-lib/src/wallet.rs +++ b/crates/ksp-wallet-lib/src/wallet.rs @@ -1,5 +1,5 @@ // file: crates/ksp-wallet-lib/src/wallet.rs -// version: 2 +// version: 3 //! In-memory native Wallet V1 create/open orchestration. @@ -263,7 +263,7 @@ pub async fn create_wallet_v1( let owner_slot = crate::WalletKeySlotV1::new(owner_slot_id, crate::WalletKeySlotRoleV1::Owner, owner_kdf, crate::WalletKeyWrapV1::new(owner_wrap_nonce, owner_wrapped)); let view_descriptor = match view_slot.as_ref() { - std::option::Option::Some(slot) => crate::WalletViewDescriptorV1::enabled(*slot.slot_id()), + std::option::Option::Some(slot) => crate::WalletViewDescriptorV1::enabled_for_slot(*slot.slot_id()), std::option::Option::None => crate::WalletViewDescriptorV1::disabled(), }; let owner_control = crate::WalletEncryptedCompartmentV1::new(crate::WalletCompartmentKindV1::OwnerControl, owner_control_nonce, owner_control_ciphertext); @@ -584,7 +584,7 @@ fn provisional_envelope( ); let (view_descriptor, view_slot) = match view_material { std::option::Option::Some(material) => ( - crate::WalletViewDescriptorV1::enabled(material.slot_id), + crate::WalletViewDescriptorV1::enabled_for_slot(material.slot_id), std::option::Option::Some(crate::WalletKeySlotV1::new( material.slot_id, crate::WalletKeySlotRoleV1::View, diff --git a/crates/ksp-wallet-lib/src/wire.rs b/crates/ksp-wallet-lib/src/wire.rs index f95bd57..b6b4a9a 100644 --- a/crates/ksp-wallet-lib/src/wire.rs +++ b/crates/ksp-wallet-lib/src/wire.rs @@ -1,5 +1,5 @@ // file: crates/ksp-wallet-lib/src/wire.rs -// version: 4 +// version: 5 //! Strict native `.kspwallet` V1 wire envelope. @@ -273,7 +273,7 @@ impl WalletViewDescriptorV1 { return Self { enabled: false, slot_id: std::option::Option::None }; } - pub(crate) const fn enabled(slot_id: [u8; crate::KSPWALLET_V1_SLOT_ID_BYTES]) -> Self { + pub(crate) const fn enabled_for_slot(slot_id: [u8; crate::KSPWALLET_V1_SLOT_ID_BYTES]) -> Self { return Self { enabled: true, slot_id: std::option::Option::Some(slot_id) }; } diff --git a/deltas/0.2.5/pre.005-fix.001.md b/deltas/0.2.5/pre.005-fix.001.md new file mode 100644 index 0000000..b1f3740 --- /dev/null +++ b/deltas/0.2.5/pre.005-fix.001.md @@ -0,0 +1,119 @@ + + + +# Delta `0.2.5-pre.005-fix.001` — collision constructeur/getter `WalletViewDescriptorV1::enabled` + +## Base requise + +```text +livraison : 0.2.5-pre.005 +workspace.package.version = "0.2.5-pre.5" +``` + +## Motif + +Les validations opérateur de `pre.005` échouent dès `cargo check --workspace` sur `ksp-wallet-lib` avec : + +```text +error[E0592]: duplicate definitions with name `enabled` +``` + +`WalletViewDescriptorV1` déclarait simultanément : + +```rust +pub(crate) const fn enabled(slot_id: [u8; KSPWALLET_V1_SLOT_ID_BYTES]) -> Self +pub const fn enabled(&self) -> bool +``` + +Rust n'autorise pas deux éléments inhérents de même nom sur un type, même lorsqu'un élément est un constructeur associé et l'autre une méthode prenant `&self`. + +Les erreurs `E0599` observées sur les appels `.enabled()` sont des conséquences de cette collision de définition et non une absence conceptuelle du getter. + +## Correction + +Le getter public est conservé inchangé : + +```rust +pub const fn enabled(&self) -> bool +``` + +Le constructeur crate-private est renommé : + +```rust +pub(crate) const fn enabled_for_slot(slot_id: [u8; KSPWALLET_V1_SLOT_ID_BYTES]) -> Self +``` + +Les deux callsites internes de création du descripteur VIEW sont mis à jour dans `wallet.rs`. + +Ce choix conserve : + +- la surface publique déjà attendue `descriptor.enabled()` ; +- la sémantique wire et transcript de `pre.003+` ; +- les invariants VIEW/OWNER ; +- les vecteurs cryptographiques et le format `.kspwallet` V1 ; +- aucune modification de dépendances. + +## Décision sur `solana-keypair` + +Aucun déplacement de `solana-keypair` vers `ksp-core-lib` n'est effectué dans ce fix. + +Les règles KSP autorisent `solana-keypair` comme primitive fondamentale, mais Core ne doit pas devenir un agrégateur automatique de toutes les primitives Solana autorisées. Dans l'architecture actuelle : + +- `Pubkey` est un value type transversal et non secret, donc son contrat via `ksp-core-lib` est justifié ; +- `Keypair` possède le secret Solana et constitue une capacité de signature ; +- `ksp-wallet-lib` est actuellement le composant propriétaire concret du secret, de l'ouverture et de la signature ; +- les futures couches d'exécution doivent préférer une capacité de signature Wallet plutôt que recevoir une keypair brute. + +La propriété de `solana-keypair` sera réauditée uniquement si une autre crate KSP de bas niveau démontre un besoin concret de manipuler une keypair brute indépendamment de Wallet. + +## Version Cargo + +Le correctif modifie du Rust de production : + +```text +0.2.5-pre.5 -> 0.2.5-pre.5.fix.1 +``` + +## Fichiers modifiés + +```text +Cargo.toml +crates/ksp-wallet-lib/src/wire.rs +crates/ksp-wallet-lib/src/wallet.rs +``` + +## Fichiers ajoutés + +```text +deltas/0.2.5/pre.005-fix.001.md +``` + +## Fichiers supprimés + +Aucun. + +## Validation attendue après application + +```bash +cargo fmt --all +cargo check --workspace +cargo clippy --workspace --all-targets +cargo test -p ksp-wallet-lib +cargo test --workspace +``` + +Le `cargo tree` de `pre.005` reste pertinent après compilation : + +```bash +cargo tree -p ksp-wallet-lib +cargo tree -p ksp-wallet-lib -d +cargo tree -i ed25519-dalek@2.2.0 +cargo tree -i solana-keypair@3.1.2 +cargo tree -i solana-address@2.7.0 +``` + +## Commit attendu + +```text +v0.2.5-pre.005-fix.001 +```