v0.1.0-pre.030

This commit is contained in:
2026-07-25 10:35:16 +02:00
parent 685b5dd283
commit 7e97530f50
10 changed files with 2298 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
// file: kb-lib/src/decoder.rs
// version: 9
// version: 10
//! Consolidated decoder modules.
@@ -126,7 +126,7 @@ 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;
pub use self::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.

View File

@@ -1,5 +1,5 @@
// file: kb-lib/src/decoder/api.rs
// version: 4
// version: 5
//! Decoder contracts consolidated from `kb_decoder_api`.
@@ -33,7 +33,7 @@ pub use self::contracts::DcApiDecoderSurface;
/// Contextual instruction decoder contract.
pub use self::contracts::DcApiInstructionDecoder;
/// Computes the deterministic contextual input hash.
pub use self::contracts::decoder_api_decoder_api_contextual_input_hash;
pub use self::contracts::decoder_api_contextual_input_hash;
/// Returns true when a decoder declares the exact program id.
pub use self::contracts::decoder_api_decoder_handles_program_id;
/// Computes a deterministic lowercase SHA-256 hash for one JSON value.

View File

@@ -1,5 +1,5 @@
// file: kb-lib/src/decoder/api/contracts.rs
// version: 7
// version: 8
//! Backend-neutral contextual instruction decoder contracts.
@@ -383,7 +383,7 @@ pub fn decoder_api_decoder_handles_program_id(
}
/// Computes a deterministic lowercase SHA-256 hash for one contextual input.
pub fn decoder_api_decoder_api_contextual_input_hash(
pub fn decoder_api_contextual_input_hash(
input: &crate::MdCoreInstructionReplayInput,
) -> kb_core::Result<std::string::String> {
let serialization_result = serde_json::to_value(input);
@@ -501,8 +501,8 @@ mod tests {
#[test]
fn contextual_input_hash_is_stable() {
let first = crate::decoder_api_decoder_api_contextual_input_hash(&replay_input());
let second = crate::decoder_api_decoder_api_contextual_input_hash(&replay_input());
let first = crate::decoder_api_contextual_input_hash(&replay_input());
let second = crate::decoder_api_contextual_input_hash(&replay_input());
assert!(first.is_ok());
assert_eq!(first, second);
}
@@ -518,8 +518,8 @@ mod tests {
"payloadJson": {"dataBase64": "CAcGBQQDAgE="},
"payloadHash": "different-payload-hash"
}]);
let first_hash = crate::decoder_api_decoder_api_contextual_input_hash(&first);
let second_hash = crate::decoder_api_decoder_api_contextual_input_hash(&second);
let first_hash = crate::decoder_api_contextual_input_hash(&first);
let second_hash = crate::decoder_api_contextual_input_hash(&second);
assert!(first_hash.is_ok());
assert!(second_hash.is_ok());
assert_ne!(first_hash, second_hash);

View File

@@ -1,5 +1,5 @@
// file: kb-lib/src/lib.rs
// version: 23
// version: 24
//! Consolidated decoder, executor, materializer and shared model library.
#![warn(missing_docs)]
@@ -312,7 +312,7 @@ pub use self::decoder::DcWalletJupiterApeproSmartWalletDecoder;
/// Reserved `kb_decoder_weighted_swap_stabble` decoder.
pub use self::decoder::DcWeightedSwapStabbleDecoder;
/// Computes the deterministic contextual input hash.
pub use self::decoder::decoder_api_decoder_api_contextual_input_hash;
pub use self::decoder::decoder_api_contextual_input_hash;
/// Returns true when a decoder declares the exact program id.
pub use self::decoder::decoder_api_decoder_handles_program_id;
/// Computes a deterministic lowercase SHA-256 hash for one JSON value.