From eaf6fae94c8377832c4caaace55b4aa8dc15bed5 Mon Sep 17 00:00:00 2001 From: SinuS Von SifriduS Date: Sun, 6 Sep 2026 18:02:01 +0200 Subject: [PATCH] v0.3.10-pre.004-fix.001 --- Cargo.toml | 4 +- .../tests/http_block_material.rs | 49 ++++-- deltas/0.3.10/pre.004-fix.001.md | 165 ++++++++++++++++++ ...031-V0_3_10_RAW_TRANSACTION_INGEST_PLAN.md | 4 +- .../027-V0_3_10_RAW_TRANSACTION_INGEST.md | 33 +++- 5 files changed, 235 insertions(+), 20 deletions(-) create mode 100644 deltas/0.3.10/pre.004-fix.001.md diff --git a/Cargo.toml b/Cargo.toml index 840154f..58a64a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,12 @@ # file: Cargo.toml -# version: 494 +# version: 495 [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"] [workspace.package] -version = "0.3.10-pre.4" +version = "0.3.10-pre.4.fix.1" edition = "2024" license = "MIT" repository = "https://git.sasedev.com/Sasedev/khadhroony-solana-project" diff --git a/crates/ksp-job-backfill-lib/tests/http_block_material.rs b/crates/ksp-job-backfill-lib/tests/http_block_material.rs index cbe2ca8..dafa51d 100644 --- a/crates/ksp-job-backfill-lib/tests/http_block_material.rs +++ b/crates/ksp-job-backfill-lib/tests/http_block_material.rs @@ -1,9 +1,13 @@ // file: crates/ksp-job-backfill-lib/tests/http_block_material.rs -// version: 1 +// version: 2 //! Cross-layer canary for the future Worker-owned HTTP block adapter without changing production ownership. -fn pool_for_url(url: &str) -> ksp_onchain_transport_lib::HttpTransportPool { +fn pool_for_url(url: &str) -> ksp_core_lib::Result { + let endpoint_url = match ksp_onchain_transport_lib::HttpEndpointUrl::parse(url) { + Ok(endpoint_url) => endpoint_url, + Err(error) => return Err(error), + }; let role = ksp_onchain_transport_lib::HttpEndpointRoleSettings::new( ksp_onchain_transport_lib::HttpRoleName::new("default"), true, @@ -21,7 +25,7 @@ fn pool_for_url(url: &str) -> ksp_onchain_transport_lib::HttpTransportPool { true, ksp_onchain_transport_lib::HttpProviderName::new("fixture-provider"), ksp_onchain_transport_lib::HttpClusterName::new("devnet"), - ksp_onchain_transport_lib::HttpEndpointUrl::parse(url).expect("fixture URL must parse"), + endpoint_url, std::time::Duration::from_secs(1), std::time::Duration::from_secs(1), std::option::Option::Some(1), @@ -30,19 +34,30 @@ fn pool_for_url(url: &str) -> ksp_onchain_transport_lib::HttpTransportPool { return ksp_onchain_transport_lib::HttpTransportPool::new(ksp_onchain_transport_lib::HttpTransportSettings::new( std::vec![endpoint], ksp_onchain_transport_lib::HttpRetrySettings::new(0, std::time::Duration::from_millis(1), std::time::Duration::from_millis(1)), - )) - .expect("fixture pool must build"); + )); } -fn serve_once(body: &'static str) -> (std::string::String, std::thread::JoinHandle<()>) { - let listener = std::net::TcpListener::bind("127.0.0.1:0").expect("fixture listener must bind"); - let address = listener.local_addr().expect("fixture listener address must resolve"); +fn serve_once(body: &'static str) -> std::io::Result<(std::string::String, std::thread::JoinHandle>)> { + let listener = match std::net::TcpListener::bind("127.0.0.1:0") { + Ok(listener) => listener, + Err(error) => return Err(error), + }; + let address = match listener.local_addr() { + Ok(address) => address, + Err(error) => return Err(error), + }; let handle = std::thread::spawn(move || { - let (mut stream, _) = listener.accept().expect("fixture server must accept one request"); + let (mut stream, _) = match listener.accept() { + Ok(accepted) => accepted, + Err(error) => return Err(error), + }; let mut bytes = std::vec::Vec::new(); let mut buffer = [0_u8; 1024]; loop { - let count = std::io::Read::read(&mut stream, &mut buffer).expect("fixture request must read"); + let count = match std::io::Read::read(&mut stream, &mut buffer) { + Ok(count) => count, + Err(error) => return Err(error), + }; if count == 0 { break; } @@ -52,10 +67,12 @@ fn serve_once(body: &'static str) -> (std::string::String, std::thread::JoinHand } } let response = format!("HTTP/1.1 200 OK\r\nContent-Type: application/json\r\nContent-Length: {}\r\nConnection: close\r\n\r\n{}", body.len(), body); - std::io::Write::write_all(&mut stream, response.as_bytes()).expect("fixture response must write"); - return; + if let Err(error) = std::io::Write::write_all(&mut stream, response.as_bytes()) { + return Err(error); + } + return Ok(()); }); - return (format!("http://{address}"), handle); + return Ok((format!("http://{address}"), handle)); } fn map_meta(field: &ksp_onchain_transport_lib::SolanaWireField) -> ksp_raw_transaction_lib::RawTransactionWireField { @@ -91,8 +108,8 @@ async fn pre_004_http_observed_block_projects_each_base64_transaction_to_common_ "{\"transaction\":[\"AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEA\",", "\"base64\"],\"meta\":{\"err\":null,\"fee\":6000},\"version\":0}]},\"id\":1}", ); - let (url, handle) = serve_once(BODY); - let pool = pool_for_url(url.as_str()); + let (url, handle) = serve_once(BODY).expect("fixture server must start"); + let pool = pool_for_url(url.as_str()).expect("fixture pool must build"); let config = ksp_onchain_transport_lib::SolanaGetBlockConfig::new( std::option::Option::Some(ksp_onchain_transport_lib::SolanaCommitment::Confirmed), std::option::Option::Some(ksp_onchain_transport_lib::SolanaTransactionEncoding::Base64), @@ -136,6 +153,6 @@ async fn pre_004_http_observed_block_projects_each_base64_transaction_to_common_ assert_eq!(raw.block_time().map(|value| return value.unix_millis()), std::option::Option::Some(1_787_072_400_000)); assert!(raw.payload().bytes().ends_with(format!("\"transactionIndex\":{transaction_index}}}").as_bytes())); } - handle.join().expect("fixture server must join"); + handle.join().expect("fixture server must join").expect("fixture server must complete successfully"); return; } diff --git a/deltas/0.3.10/pre.004-fix.001.md b/deltas/0.3.10/pre.004-fix.001.md new file mode 100644 index 0000000..7ff1870 --- /dev/null +++ b/deltas/0.3.10/pre.004-fix.001.md @@ -0,0 +1,165 @@ + + + +# Delta `0.3.10-pre.004-fix.001` — correction du canari HTTP block et du gate Clippy + +## Base requise + +```text +livraison : 0.3.10-pre.004 +workspace.package.version = 0.3.10-pre.4 +``` + +Le delta historique `deltas/0.3.10/pre.004.md` reste inchangé. Le présent fix trace séparément le défaut révélé par la validation opérateur du 2026-09-06. + +## Résultat opérateur de la base + +La validation communiquée confirme : + +```text +cargo fmt --all : exécuté +General Rust rule audit: clean +Rust export completeness audit: 0 candidate(s) +KSP workspace Rust rule audit: clean +Markdown table audit: clean (339 table(s), 757 file(s)) +cargo check --workspace : PASS +cargo clippy --workspace --all-targets --all-features -- -D warnings : FAIL +cargo test -p ksp-raw-transaction-lib : PASS +cargo test -p ksp-onchain-transport-lib : PASS +cargo test -p ksp-job-backfill-lib --test http_block_material : PASS +``` + +Les tests fonctionnels communiqués confirment notamment : + +```text +ksp-raw-transaction-lib : 12 unit + 9 intégration, 0 échec +ksp-onchain-transport-lib : 387 unit + 51 public API + 43 release completeness + 4 doctests, 0 échec +http_block_material : 1 test, PASS +smokes live Transport : ignorés comme prévu +``` + +Les arbres normaux communiqués conservent les frontières prévues : la common RAW dépend de `base64`, `ksp-core-lib`, `ksp-store-api`, `serde_json`, `sha2`, et `ksp-onchain-transport-lib` ne dépend pas de `ksp-raw-transaction-lib`. + +## Motif du fix + +Le gate strict : + +```bash +cargo clippy --workspace --all-targets --all-features -- -D warnings +``` + +échoue exclusivement sur sept `clippy::expect_used` dans les deux helpers privés du nouveau test d’intégration : + +```text +pool_for_url(...) +serve_once(...) +``` + +Les usages concernés sont : + +```text +parsing HttpEndpointUrl +construction HttpTransportPool +bind du listener local +lecture de local_addr +accept de la connexion fixture +read de la requête fixture +write de la réponse fixture +``` + +La configuration commune autorise `expect` dans les fonctions de test, mais ces helpers ne portent pas eux-mêmes l’attribut `#[test]`/`#[tokio::test]` et sont donc correctement rejetés par Clippy. + +## Correction + +Aucun lint n’est désactivé. + +`pool_for_url(...)` retourne désormais explicitement : + +```text +ksp_core_lib::Result +``` + +et propage les deux erreurs possibles par `match` explicite. + +`serve_once(...)` retourne désormais : + +```text +std::io::Result<(String, JoinHandle>)> +``` + +Le bind, `local_addr`, `accept`, `read` et `write_all` retournent leurs erreurs par contrôle de flux explicite. Les assertions/`expect()` de fixture restent uniquement dans le corps `#[tokio::test]`, conformément à `allow-expect-in-tests = true`. + +## Version Cargo + +Ce fix modifie du Rust de test. Le signal technique Cargo est donc synchronisé : + +```text +0.3.10-pre.4 -> 0.3.10-pre.4.fix.1 +``` + +Le header du `Cargo.toml` racine passe de `494` à `495`. + +## Invariants volontairement inchangés + +```text +get_block_observed : inchangé +winner provider/endpoint : inchangé +RAW_TRANSACTION_FORMAT_ID = ksp.solana.raw_transaction +RAW_TRANSACTION_FORMAT_VERSION = 1 +extraction Base64/short_vec : inchangée +projection 2 transactions / index 0-1 : inchangée +TR-C2 : adapter productif toujours Worker-owned +aucun changement de code production +aucune dépendance ou feature ajoutée +aucun nouveau Worker +``` + +## Fichiers modifiés + +```text +Cargo.toml +crates/ksp-job-backfill-lib/tests/http_block_material.rs +docs/plans/031-V0_3_10_RAW_TRANSACTION_INGEST_PLAN.md +docs/validation/027-V0_3_10_RAW_TRANSACTION_INGEST.md +``` + +## Fichier ajouté + +```text +deltas/0.3.10/pre.004-fix.001.md +``` + +## Fichiers supprimés + +Aucun. + +## Validations exécutées dans l’environnement d’assemblage + +```text +python3 scripts/audit_rust_workspace_rules.py +General Rust rule audit: clean +Rust export completeness audit: 0 candidate(s) +KSP workspace Rust rule audit: clean + +python3 scripts/audit_markdown_tables.py README.md RULES.md ROADMAP.md CHANGELOG.md docs prompts crates deltas +Markdown table audit: clean (339 table(s), 758 file(s)) +``` + +L’environnement d’assemblage ne fournit ni `cargo`, ni `rustc`, ni `rustfmt`; aucun gate Cargo du fix n’est donc déclaré PASS localement. + +## Validation à rejouer + +```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-raw-transaction-lib +cargo test -p ksp-onchain-transport-lib +cargo test -p ksp-job-backfill-lib --test http_block_material +cargo tree -p ksp-raw-transaction-lib --edges normal +cargo tree -p ksp-onchain-transport-lib --edges normal +``` + +`pre.005` reste bloquée tant que ce gate n’est pas intégralement vert. diff --git a/docs/plans/031-V0_3_10_RAW_TRANSACTION_INGEST_PLAN.md b/docs/plans/031-V0_3_10_RAW_TRANSACTION_INGEST_PLAN.md index 5261a84..11a71a0 100644 --- a/docs/plans/031-V0_3_10_RAW_TRANSACTION_INGEST_PLAN.md +++ b/docs/plans/031-V0_3_10_RAW_TRANSACTION_INGEST_PLAN.md @@ -1,5 +1,5 @@ - + # Plan v0.3.10 — RAW Transaction commune + Worker d’ingestion multi-source @@ -1060,6 +1060,8 @@ Le rejeu opérateur du 2026-09-06 ferme `pre.003` : audits statiques propres, `c Conformément à `TR-C2`, aucun adapter productif Transport DTO -> `RawTransactionMaterial` n’est placé dans Transport : une preuve cross-layer test-only démontre `get_block_observed -> N SolanaBlockTransaction -> RawTransactionMaterial -> RAW v1` sur deux transactions distinctes avec index 0/1, tandis que l’adapter productif reste réservé au futur Worker. Aucun Worker live complet n’est ouvert. +Le premier rejeu opérateur de `pre.004` a validé les audits, `cargo check`, les tests common, les 387 tests Transport et le canari cross-layer, mais Clippy strict a rejeté sept `expect()` placés dans deux helpers de fixture hors du corps `#[tokio::test]`. `pre.004-fix.001` corrige uniquement ces helpers en retournant explicitement des `Result`; aucun code de production, contrat RAW, surface Transport, golden ou dépendance n’est modifié. + ### `pre.005` — parité WS/Helius full Fermer projection `blockSubscribe` + Helius `transactionSubscribe` vers matériau common, golden parity ou fallback hydration explicitement qualifié. diff --git a/docs/validation/027-V0_3_10_RAW_TRANSACTION_INGEST.md b/docs/validation/027-V0_3_10_RAW_TRANSACTION_INGEST.md index b35ab66..6a8b174 100644 --- a/docs/validation/027-V0_3_10_RAW_TRANSACTION_INGEST.md +++ b/docs/validation/027-V0_3_10_RAW_TRANSACTION_INGEST.md @@ -1,5 +1,5 @@ - + # Validation v0.3.10 — RAW Transaction commune + Worker d’ingestion @@ -767,3 +767,34 @@ cargo tree -p ksp-raw-transaction-lib --edges normal cargo tree -p ksp-onchain-transport-lib --edges normal ``` +### 13.6 Résultat opérateur de `pre.004` et `pre.004-fix.001` + +Le rejeu communiqué le 2026-09-06 confirme : + +```text +cargo fmt --all : exécuté +General Rust rule audit: clean +Rust export completeness audit: 0 candidate(s) +KSP workspace Rust rule audit: clean +Markdown table audit: clean (339 table(s), 757 file(s)) +cargo check --workspace : PASS +cargo clippy --workspace --all-targets --all-features -- -D warnings : FAIL +cargo test -p ksp-raw-transaction-lib : PASS, 12 unit + 9 intégration, 0 échec +cargo test -p ksp-onchain-transport-lib : PASS, 387 unit + 51 public API + 43 release completeness + 4 doctests, 0 échec ; smokes live ignorés comme prévu +cargo test -p ksp-job-backfill-lib --test http_block_material : PASS, 1 test +cargo tree -p ksp-raw-transaction-lib --edges normal : graphe attendu avec base64/core/store-api/serde_json/sha2 +cargo tree -p ksp-onchain-transport-lib --edges normal : aucun edge vers ksp-raw-transaction-lib +``` + +L’échec Clippy est strictement limité à sept `clippy::expect_used` dans les helpers privés de fixture de `crates/ksp-job-backfill-lib/tests/http_block_material.rs` : construction de l’URL/pool, bind/adresse/accept/read/write du serveur local. Les `expect()` situés directement dans la fonction `#[tokio::test]` restent conformes à `allow-expect-in-tests = true`. + +`pre.004-fix.001` remplace uniquement ces sept usages hors-test par des retours `Result` et un contrôle de flux explicite. Aucun `#[allow(...)]` n’est ajouté et aucun code de production n’est modifié. + +Version technique du fix : + +```text +workspace.package.version = 0.3.10-pre.4.fix.1 +``` + +Le gate complet de `pre.004` doit être rejoué après application du fix avant ouverture de `pre.005`. +