diff --git a/Cargo.toml b/Cargo.toml index e113919..d7d68e4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,12 @@ # file: Cargo.toml -# version: 527 +# version: 528 [workspace] resolver = "3" members = ["crates/ksp-app-backfill-desk", "crates/ksp-app-config-desk", "crates/ksp-app-solprices-desk", "crates/ksp-app-store-desk", "crates/ksp-app-wallet-desk", "crates/ksp-config-lib", "crates/ksp-core-lib", "crates/ksp-interface-lib", "crates/ksp-job-api", "crates/ksp-job-backfill-lib", "crates/ksp-logging-lib", "crates/ksp-offchain-transport-lib", "crates/ksp-onchain-transport-lib", "crates/ksp-program-api", "crates/ksp-raw-transaction-lib", "crates/ksp-store-api", "crates/ksp-store-lib", "crates/ksp-store-postgres-lib", "crates/ksp-wallet-lib", "crates/ksp-worker-api", "crates/ksp-worker-raw-transaction-ingest-lib"] [workspace.package] -version = "0.3.12-pre.6" +version = "0.3.12-pre.6.fix.1" edition = "2024" license = "MIT" repository = "https://git.sasedev.com/Sasedev/khadhroony-solana-project" diff --git a/crates/ksp-worker-raw-transaction-ingest-lib/src/runtime_resources.rs b/crates/ksp-worker-raw-transaction-ingest-lib/src/runtime_resources.rs index d345c51..654828c 100644 --- a/crates/ksp-worker-raw-transaction-ingest-lib/src/runtime_resources.rs +++ b/crates/ksp-worker-raw-transaction-ingest-lib/src/runtime_resources.rs @@ -1,5 +1,5 @@ // file: crates/ksp-worker-raw-transaction-ingest-lib/src/runtime_resources.rs -// version: 8 +// version: 9 use sha2::Digest; // rust-rules: trait-import @@ -731,7 +731,7 @@ fn route_yellowstone_update( ksp_onchain_transport_lib::YellowstoneSubscribeUpdate::Account(_) | ksp_onchain_transport_lib::YellowstoneSubscribeUpdate::Ping(_) | ksp_onchain_transport_lib::YellowstoneSubscribeUpdate::Pong(_) - | ksp_onchain_transport_lib::YellowstoneSubscribeUpdate::Entry(_) => std::result::Result::Ok(()), + | ksp_onchain_transport_lib::YellowstoneSubscribeUpdate::Entry(_) => return std::result::Result::Ok(()), } } @@ -840,10 +840,12 @@ impl RawTransactionIngestHydrationCoordinator { fn start_hydrations(&mut self, source: &crate::RawTransactionIngestYellowstoneSource) -> ksp_core_lib::Result<()> { while self.tasks.len() < self.max_in_flight { - let key = self - .pending - .iter() - .find_map(|(key, pending)| if pending.in_flight { std::option::Option::None } else { std::option::Option::Some(key.clone()) }); + let key = self.pending.iter().find_map(|(key, pending)| { + if pending.in_flight { + return std::option::Option::None; + } + return std::option::Option::Some(key.clone()); + }); let key = match key { std::option::Option::Some(value) => value, std::option::Option::None => break, @@ -946,6 +948,9 @@ fn hydration_key( source: &crate::RawTransactionIngestYellowstoneSource, signal: &RawTransactionIngestSourceSignal, ) -> ksp_core_lib::Result { + if signal.network != source.network { + return std::result::Result::Err(crate::runtime_error("hydration.network_mismatch")); + } let commitment = match hydration_commitment(source) { std::result::Result::Ok(value) => value, std::result::Result::Err(error) => return std::result::Result::Err(error), diff --git a/deltas/0.3.12/pre.006-fix.001.md b/deltas/0.3.12/pre.006-fix.001.md new file mode 100644 index 0000000..ddaa796 --- /dev/null +++ b/deltas/0.3.12/pre.006-fix.001.md @@ -0,0 +1,96 @@ + + + +# Delta `0.3.12-pre.006-fix.001` — retours explicites et guard réseau pré-hydration + +## Base requise + +```text +0.3.12-pre.006 +workspace.package.version = 0.3.12-pre.6 +``` + +Le gate opérateur communiqué confirme que les audits et `cargo check --workspace` passent. Les 58 unit tests s'exécutent, avec 57 PASS et un unique échec sur le contexte du guard réseau. Le gate Clippy strict échoue sur trois `clippy::implicit-return`. + +## Objectif + +Corriger exclusivement ces diagnostics de `pre.006`, sans neutraliser de lint et sans avancer les responsabilités `pre.007`/`pre.008`. + +## Version + +```text +workspace.package.version = 0.3.12-pre.6.fix.1 +``` + +## Corrections + +La branche neutre `Account/Ping/Pong/Entry` du routage Yellowstone retourne maintenant explicitement `Ok(())`. + +La closure de sélection de la prochaine hydration pending utilise des `return` explicites dans ses deux branches, conformément au lint workspace `clippy::implicit-return`. + +`hydration_key` rejette désormais avant coalescence et avant HTTP : + +```text +signal.network != source.network -> hydration.network_mismatch +``` + +Ce guard restaure le contrat de qualification `pre.004`. Le contrôle équivalent de `finalize_yellowstone_hydration` reste volontairement présent comme défense secondaire. Aucun test n'est affaibli pour accepter `hydration.network_key_mismatch`. + +## Fichiers ajoutés + +```text +deltas/0.3.12/pre.006-fix.001.md +``` + +## Fichiers modifiés + +```text +Cargo.toml +crates/ksp-worker-raw-transaction-ingest-lib/src/runtime_resources.rs +docs/validation/029-V0_3_12_YELLOWSTONE_HYDRATION_CONTINUITY.md +``` + +## Fichiers supprimés + +Aucun. + +## Non-changements + +```text +aucune API publique +aucune dépendance +aucun changement de clé de coalescence +aucun changement de provenance +aucune modification des bornes pending/in-flight +aucune modification de la supervision JoinSet +aucun processing frontier +aucun from_slot / ReplayInfo / reconnect policy +aucun repair/backfill implicite +aucun lint neutralisé +``` + +## Validations exécutées dans l'environnement d'assemblage + +```text +python3 scripts/audit_rust_workspace_rules.py +python3 scripts/audit_markdown_tables.py README.md RULES.md ROADMAP.md CHANGELOG.md docs prompts crates deltas +``` + +Contrôles statiques complémentaires : absence des trois retours implicites signalés par le gate, guard `hydration.network_mismatch` présent dans `hydration_key`, version workspace exacte et reproduction du delta sur la base `pre.006`. + +## Validations non exécutées dans l'environnement d'assemblage + +`cargo`, `rustc` et `rustfmt` ne sont pas disponibles dans l'environnement d'assemblage. Aucun gate Cargo local n'est revendiqué. + +## Gate opérateur requis + +```bash +cargo fmt --all +python3 scripts/audit_rust_workspace_rules.py +python3 scripts/audit_markdown_tables.py README.md RULES.md ROADMAP.md CHANGELOG.md docs prompts crates deltas +cargo check --workspace +cargo clippy --workspace --all-targets --all-features -- -D warnings +cargo test -p ksp-worker-raw-transaction-ingest-lib +``` + +Après gate vert, la suite reste `pre.007`. diff --git a/docs/validation/029-V0_3_12_YELLOWSTONE_HYDRATION_CONTINUITY.md b/docs/validation/029-V0_3_12_YELLOWSTONE_HYDRATION_CONTINUITY.md index ecd7e27..52f684a 100644 --- a/docs/validation/029-V0_3_12_YELLOWSTONE_HYDRATION_CONTINUITY.md +++ b/docs/validation/029-V0_3_12_YELLOWSTONE_HYDRATION_CONTINUITY.md @@ -1,5 +1,5 @@ - + # Validation v0.3.12 — Yellowstone + hydration HTTP + continuité de run du Worker RawTransaction @@ -1306,3 +1306,36 @@ cargo tree --duplicates ``` Dans l'environnement d'assemblage, `cargo`, `rustc` et `rustfmt` ne sont pas installés ; aucun gate Cargo local n'est donc revendiqué. + +## 55. Gate opérateur `pre.006` et `pre.006-fix.001` + +Le gate opérateur de `pre.006` confirme : + +```text +General Rust rule audit : clean +Rust export completeness audit : 0 candidate(s) +KSP workspace Rust rule audit : clean +Markdown table audit : clean (340 tables, 810 fichiers) +cargo check --workspace : PASS +cargo test -p ksp-worker-raw-transaction-ingest-lib : 57 PASS / 1 FAIL +``` + +Le gate Clippy strict échoue uniquement sur trois `clippy::implicit-return` dans le nouveau chemin productif : la branche neutre du routage Yellowstone et les deux branches de la closure `find_map` qui sélectionne la prochaine hydration non lancée. + +Le test rouge est `pre_004_source_hydration_rejects_slot_index_signature_and_network_mismatch_before_admission`. La cause n'est pas le test : depuis `pre.006`, le helper de qualification construit la clé et lance le fetch avant d'atteindre le guard réseau de `finalize_yellowstone_hydration`, ce qui transforme le contexte attendu `hydration.network_mismatch` en `hydration.network_key_mismatch`. + +`pre.006-fix.001` restaure l'invariant plus fort : `hydration_key` rejette immédiatement tout `signal.network != source.network` avec `hydration.network_mismatch`, donc avant coalescence et avant tout HTTP. Le guard de finalisation reste en place comme défense secondaire. + +Les trois retours implicites sont rendus explicites sans lint neutralisé. La logique de coalescence, les bornes, le fan-out, les provenances et le contrat de stop ne changent pas. + +## 56. Gate requis après `pre.006-fix.001` + +```bash +cargo fmt --all +python3 scripts/audit_rust_workspace_rules.py +python3 scripts/audit_markdown_tables.py README.md RULES.md ROADMAP.md CHANGELOG.md docs prompts crates deltas +cargo check --workspace +cargo clippy --workspace --all-targets --all-features -- -D warnings +cargo test -p ksp-worker-raw-transaction-ingest-lib +``` +