v0.1.0-pre.008

This commit is contained in:
2026-07-23 20:40:38 +02:00
parent f5bd8fab7f
commit 12b42a31b8
26 changed files with 6686 additions and 280 deletions

View File

@@ -1,5 +1,5 @@
// file: kb-lib/src/lib.rs
// version: 9
// version: 10
//! Consolidated decoder, executor, materializer and shared model library.
#![warn(missing_docs)]
@@ -11,6 +11,8 @@ pub mod executor;
pub mod materializer;
pub mod model;
/// One parsed SPL ElGamal registry instruction.
pub(crate) use crate::decoder::ParsedRegistryInstruction;
/// Current stable Associated Token Account decoded event contract version.
pub(crate) use crate::decoder::SPL_ASSOCIATED_TOKEN_ACCOUNT_EVENT_VERSION;
/// Exact Associated Token Account instructions published by the official interface.
@@ -29,6 +31,14 @@ pub(crate) use crate::decoder::SPL_ASSOCIATED_TOKEN_ACCOUNT_MAX_TRANSACTION_KEYS
pub(crate) use crate::decoder::SPL_ASSOCIATED_TOKEN_ACCOUNT_SURFACE_CODE;
/// Canonical tracing target for the Associated Token Account decoder.
pub(crate) use crate::decoder::SPL_ASSOCIATED_TOKEN_ACCOUNT_TRACING_TARGET;
/// Current stable SPL ElGamal registry event contract version.
pub(crate) use crate::decoder::SPL_ELGAMAL_REGISTRY_EVENT_VERSION;
/// Maximum retained SPL ElGamal registry instruction payload size.
pub(crate) use crate::decoder::SPL_ELGAMAL_REGISTRY_MAX_INSTRUCTION_BYTES;
/// Stable SPL ElGamal registry surface code.
pub(crate) use crate::decoder::SPL_ELGAMAL_REGISTRY_SURFACE_CODE;
/// Canonical tracing target for the SPL ElGamal registry decoder.
pub(crate) use crate::decoder::SPL_ELGAMAL_REGISTRY_TRACING_TARGET;
/// Maximum payload prefix retained for bounded Memo diagnostics.
pub(crate) use crate::decoder::SPL_MEMO_DIAGNOSTIC_PREFIX_BYTES;
/// Current stable Memo decoded event contract version.
@@ -45,6 +55,24 @@ pub(crate) use crate::decoder::SPL_MEMO_V1_SURFACE_CODE;
pub(crate) use crate::decoder::SPL_MEMO_V3_SURFACE_CODE;
/// Stable Memo v4 surface code.
pub(crate) use crate::decoder::SPL_MEMO_V4_SURFACE_CODE;
/// Maximum prefix retained in bounded Token-2022 diagnostics.
pub(crate) use crate::decoder::SPL_TOKEN_2022_DIAGNOSTIC_PREFIX_BYTES;
/// Current stable Token-2022 decoded event contract version.
pub(crate) use crate::decoder::SPL_TOKEN_2022_EVENT_VERSION;
/// Exact top-level instruction inventory published by the resolved Token-2022 interface.
pub(crate) use crate::decoder::SPL_TOKEN_2022_INSTRUCTION_ENTRIES;
/// Maximum total account metas consumed by one Token-2022 batch.
pub(crate) use crate::decoder::SPL_TOKEN_2022_MAX_BATCH_ACCOUNTS;
/// Maximum decoded sub-instructions in one Token-2022 batch.
pub(crate) use crate::decoder::SPL_TOKEN_2022_MAX_BATCH_INSTRUCTIONS;
/// Maximum retained Token-2022 instruction payload size.
pub(crate) use crate::decoder::SPL_TOKEN_2022_MAX_INSTRUCTION_BYTES;
/// Maximum retained UTF-8 string size for embedded Token Metadata instructions.
pub(crate) use crate::decoder::SPL_TOKEN_2022_MAX_METADATA_STRING_BYTES;
/// Stable Token-2022 surface code.
pub(crate) use crate::decoder::SPL_TOKEN_2022_SURFACE_CODE;
/// Canonical tracing target for the Token-2022 decoder.
pub(crate) use crate::decoder::SPL_TOKEN_2022_TRACING_TARGET;
/// Maximum prefix retained in bounded classic SPL Token diagnostics.
pub(crate) use crate::decoder::SPL_TOKEN_DIAGNOSTIC_PREFIX_BYTES;
/// Current stable classic SPL Token decoded event contract version.
@@ -89,43 +117,6 @@ pub(crate) use crate::decoder::solana::SOLANA_CORE_NATIVE_EVENT_VERSION;
pub(crate) use crate::decoder::solana::SOLANA_CORE_NATIVE_LOADER_SURFACE_CODE;
/// Maximum number of component bytes retained as a hexadecimal event prefix.
pub(crate) use crate::decoder::solana::SOLANA_CORE_PRECOMPILE_COMPONENT_PREFIX_BYTES;
/// Expected role and privileges for one positional instruction account.
pub(crate) use crate::decoder::solana::SolanaCoreAccountRole;
/// Returns declared Address Lookup Table instruction coverage.
pub(crate) use crate::decoder::solana::solana_core_address_lookup_table_coverage;
/// Decodes one Address Lookup Table instruction.
pub(crate) use crate::decoder::solana::solana_core_address_lookup_table_decode;
/// Recognizes one Address Lookup Table instruction without producing an event.
pub(crate) use crate::decoder::solana::solana_core_address_lookup_table_recognize;
/// Returns declared Compute Budget instruction coverage.
pub(crate) use crate::decoder::solana::solana_core_compute_budget_coverage;
/// Decodes one Compute Budget instruction.
pub(crate) use crate::decoder::solana::solana_core_compute_budget_decode;
/// Recognizes one Compute Budget instruction without producing an event.
pub(crate) use crate::decoder::solana::solana_core_compute_budget_recognize;
/// Returns declared Config Program instruction coverage.
pub(crate) use crate::decoder::solana::solana_core_config_coverage;
/// Decodes one generic Config Program store instruction.
pub(crate) use crate::decoder::solana::solana_core_config_decode;
/// Recognizes one generic Config Program store instruction.
pub(crate) use crate::decoder::solana::solana_core_config_recognize;
/// Resolves positional instruction accounts and validates their core indexes.
pub(crate) use crate::decoder::solana::solana_core_resolve_accounts;
/// Decodes one bounded Associated Token Account instruction.
pub(crate) use crate::decoder::spl_associated_token_account_decode;
/// Returns the exact entry matching an Associated Token Account wire.
pub(crate) use crate::decoder::spl_associated_token_account_entry;
/// Reads one bounded Associated Token Account payload.
pub(crate) use crate::decoder::spl_associated_token_account_payload;
/// Decodes one bounded SPL Memo instruction.
pub(crate) use crate::decoder::spl_memo_decode;
/// Decodes one bounded classic SPL Token instruction.
pub(crate) use crate::decoder::spl_token_decode;
/// Returns the published entry matching one classic SPL Token tag.
pub(crate) use crate::decoder::spl_token_entry_for_tag;
/// Returns the first byte of one retained classic SPL Token payload.
pub(crate) use crate::decoder::spl_token_payload_tag;
/// Stable protocol code shared by native Solana events.
pub(crate) use crate::decoder::solana::SOLANA_CORE_PROTOCOL_CODE;
/// Byte length of a secp256k1 Ethereum address.
@@ -158,12 +149,32 @@ pub(crate) use crate::decoder::solana::SOLANA_CORE_VOTE_SURFACE_CODE;
pub(crate) use crate::decoder::solana::SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE;
/// Stable historical ZK Token Proof surface code.
pub(crate) use crate::decoder::solana::SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE;
/// Expected role and privileges for one positional instruction account.
pub(crate) use crate::decoder::solana::SolanaCoreAccountRole;
/// One resolved outer instruction payload and its provenance relative to the target instruction.
pub(crate) use crate::decoder::solana::SolanaCoreResolvedInstructionPayload;
/// Returns declared Address Lookup Table instruction coverage.
pub(crate) use crate::decoder::solana::solana_core_address_lookup_table_coverage;
/// Decodes one Address Lookup Table instruction.
pub(crate) use crate::decoder::solana::solana_core_address_lookup_table_decode;
/// Recognizes one Address Lookup Table instruction without producing an event.
pub(crate) use crate::decoder::solana::solana_core_address_lookup_table_recognize;
/// Returns a hexadecimal prefix no longer than the available byte slice.
pub(crate) use crate::decoder::solana::solana_core_bounded_hexadecimal_prefix;
/// Extracts one exact bounded byte slice with checked arithmetic.
pub(crate) use crate::decoder::solana::solana_core_bounded_slice;
/// Returns declared Compute Budget instruction coverage.
pub(crate) use crate::decoder::solana::solana_core_compute_budget_coverage;
/// Decodes one Compute Budget instruction.
pub(crate) use crate::decoder::solana::solana_core_compute_budget_decode;
/// Recognizes one Compute Budget instruction without producing an event.
pub(crate) use crate::decoder::solana::solana_core_compute_budget_recognize;
/// Returns declared Config Program instruction coverage.
pub(crate) use crate::decoder::solana::solana_core_config_coverage;
/// Decodes one generic Config Program store instruction.
pub(crate) use crate::decoder::solana::solana_core_config_decode;
/// Recognizes one generic Config Program store instruction.
pub(crate) use crate::decoder::solana::solana_core_config_recognize;
/// Decodes one retained base64 instruction payload with an explicit byte limit.
pub(crate) use crate::decoder::solana::solana_core_decode_instruction_data;
/// Returns the decoded target payload length when retained and valid.
@@ -202,6 +213,8 @@ pub(crate) use crate::decoder::solana::solana_core_precompiles_recognize;
pub(crate) use crate::decoder::solana::solana_core_read_u32_le;
/// Reads one little-endian `u64` from an exact byte range.
pub(crate) use crate::decoder::solana::solana_core_read_u64_le;
/// Resolves positional instruction accounts and validates their core indexes.
pub(crate) use crate::decoder::solana::solana_core_resolve_accounts;
/// 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 crate::decoder::solana::solana_core_resolve_u8_instruction_payload;
@@ -247,13 +260,53 @@ pub(crate) use crate::decoder::solana::solana_core_zk_token_proof_coverage;
pub(crate) use crate::decoder::solana::solana_core_zk_token_proof_decode;
/// Recognizes one historical ZK Token Proof layout or the current no-op runtime fallback.
pub(crate) use crate::decoder::solana::solana_core_zk_token_proof_recognize;
/// Decodes one bounded Associated Token Account instruction.
pub(crate) use crate::decoder::spl_associated_token_account_decode;
/// Returns the exact entry matching an Associated Token Account wire.
pub(crate) use crate::decoder::spl_associated_token_account_entry;
/// Reads one bounded Associated Token Account payload.
pub(crate) use crate::decoder::spl_associated_token_account_payload;
/// Decodes one bounded SPL ElGamal registry instruction.
pub(crate) use crate::decoder::spl_elgamal_registry_decode;
/// Decodes one bounded SPL ElGamal registry instruction payload.
pub(crate) use crate::decoder::spl_elgamal_registry_decode_payload;
/// Parses one exact SPL ElGamal registry instruction.
pub(crate) use crate::decoder::spl_elgamal_registry_parse;
/// Decodes one bounded SPL Memo instruction.
pub(crate) use crate::decoder::spl_memo_decode;
/// Decodes one bounded Token-2022 instruction.
pub(crate) use crate::decoder::spl_token_2022_decode;
/// Returns the exact entry matching one Token-2022 tag.
pub(crate) use crate::decoder::spl_token_2022_entry_for_tag;
/// Returns the first byte of one retained Token-2022 payload.
pub(crate) use crate::decoder::spl_token_2022_payload_tag;
/// Decodes one bounded classic SPL Token instruction.
pub(crate) use crate::decoder::spl_token_decode;
/// Returns the published entry matching one classic SPL Token tag.
pub(crate) use crate::decoder::spl_token_entry_for_tag;
/// Returns the first byte of one retained classic SPL Token payload.
pub(crate) use crate::decoder::spl_token_payload_tag;
/// Exact byte length of one SPL ElGamal registry account.
pub use crate::decoder::ELGAMAL_REGISTRY_ACCOUNT_LEN;
/// Parsed SPL ElGamal public-key registry account.
pub use crate::decoder::ElGamalRegistryState;
/// Exact decoder for the SPL Associated Token Account program.
pub use crate::decoder::SplAssociatedTokenAccountDecoder;
/// Exact decoder for the SPL ElGamal registry program.
pub use crate::decoder::SplElgamalRegistryDecoder;
/// Exact decoder for the three registered SPL Memo generations.
pub use crate::decoder::SplMemoDecoder;
/// Exact decoder for the Token-2022 program.
pub use crate::decoder::SplToken2022Decoder;
/// Exact decoder for the classic SPL Token program.
pub use crate::decoder::SplTokenDecoder;
/// Parsed Token-2022 Mint, Account, or Multisig state.
pub use crate::decoder::Token2022State;
/// Exact Token-2022 base account state kind.
pub use crate::decoder::Token2022StateKind;
/// One exact Token-2022 TLV entry.
pub use crate::decoder::Token2022TlvEntry;
/// Current contextual core instruction input contract version.
pub use crate::decoder::api::contracts::CORE_INSTRUCTION_INPUT_CONTRACT_VERSION;
/// Stable contextual decoded observation.
@@ -294,6 +347,10 @@ pub use crate::decoder::api::decoder::DecoderSupport;
pub use crate::decoder::api::decoder::InitialDecoder;
/// Exposes the common protocol decoder trait.
pub use crate::decoder::api::decoder::ProtocolDecoder;
/// Parses one exact SPL ElGamal registry account.
pub use crate::decoder::parse_elgamal_registry_state;
/// Parses one Token-2022 Mint, Account, or Multisig state.
pub use crate::decoder::parse_token_2022_state;
/// Runtime-native Solana decoder with maximal native instruction coverage.
pub use crate::decoder::solana::SolanaCoreDecoder;
/// Exposes the blockhash policy kind.