0.1.0-pre.004
This commit is contained in:
@@ -1,10 +1,197 @@
|
||||
// file: kb-lib/src/decoder/solana/core.rs
|
||||
// version: 1
|
||||
// version: 17
|
||||
|
||||
//! Migration boundary for legacy crate `kb_decoder_solana_core`.
|
||||
//! Solana Core decoder component.
|
||||
|
||||
/// Legacy crate name retained for migration and compatibility tracking.
|
||||
pub const LEGACY_CRATE: &str = "kb_decoder_solana_core";
|
||||
mod accounts;
|
||||
mod address_lookup_table;
|
||||
mod compute_budget;
|
||||
mod config;
|
||||
mod constants;
|
||||
mod decoder;
|
||||
mod event;
|
||||
mod feature;
|
||||
mod loaders;
|
||||
mod payload;
|
||||
mod precompiles;
|
||||
mod slashing;
|
||||
mod stake;
|
||||
mod system;
|
||||
mod vote;
|
||||
mod zk_elgamal;
|
||||
mod zk_token_proof;
|
||||
|
||||
/// Current porting status.
|
||||
pub const MIGRATION_STATUS: &str = "source-preserved-pending-port";
|
||||
/// Expected role and privileges for one positional instruction account.
|
||||
pub(crate) use self::accounts::AccountRole as SolanaCoreAccountRole;
|
||||
/// Resolves positional instruction accounts and validates their core indexes.
|
||||
pub(crate) use self::accounts::resolve_accounts as solana_core_resolve_accounts;
|
||||
/// Returns declared Address Lookup Table instruction coverage.
|
||||
pub(crate) use self::address_lookup_table::address_lookup_table_coverage as solana_core_address_lookup_table_coverage;
|
||||
/// Decodes one Address Lookup Table instruction.
|
||||
pub(crate) use self::address_lookup_table::address_lookup_table_decode as solana_core_address_lookup_table_decode;
|
||||
/// Recognizes one Address Lookup Table instruction without producing an event.
|
||||
pub(crate) use self::address_lookup_table::address_lookup_table_recognize as solana_core_address_lookup_table_recognize;
|
||||
/// Returns declared Compute Budget instruction coverage.
|
||||
pub(crate) use self::compute_budget::compute_budget_coverage as solana_core_compute_budget_coverage;
|
||||
/// Decodes one Compute Budget instruction.
|
||||
pub(crate) use self::compute_budget::compute_budget_decode as solana_core_compute_budget_decode;
|
||||
/// Recognizes one Compute Budget instruction without producing an event.
|
||||
pub(crate) use self::compute_budget::compute_budget_recognize as solana_core_compute_budget_recognize;
|
||||
/// Returns declared Config Program instruction coverage.
|
||||
pub(crate) use self::config::config_coverage as solana_core_config_coverage;
|
||||
/// Decodes one generic Config Program store instruction.
|
||||
pub(crate) use self::config::config_decode as solana_core_config_decode;
|
||||
/// Recognizes one generic Config Program store instruction.
|
||||
pub(crate) use self::config::config_recognize as solana_core_config_recognize;
|
||||
/// Stable Address Lookup Table surface code.
|
||||
pub(crate) use self::constants::ADDRESS_LOOKUP_TABLE_SURFACE_CODE as SOLANA_CORE_ADDRESS_LOOKUP_TABLE_SURFACE_CODE;
|
||||
/// Stable deprecated immutable BPF Loader surface code.
|
||||
pub(crate) use self::constants::BPF_LOADER_DEPRECATED_SURFACE_CODE as SOLANA_CORE_BPF_LOADER_DEPRECATED_SURFACE_CODE;
|
||||
/// Stable immutable BPF Loader v2 surface code.
|
||||
pub(crate) use self::constants::BPF_LOADER_SURFACE_CODE as SOLANA_CORE_BPF_LOADER_SURFACE_CODE;
|
||||
/// Stable upgradeable BPF Loader surface code.
|
||||
pub(crate) use self::constants::BPF_LOADER_UPGRADEABLE_SURFACE_CODE as SOLANA_CORE_BPF_LOADER_UPGRADEABLE_SURFACE_CODE;
|
||||
/// Stable Compute Budget surface code.
|
||||
pub(crate) use self::constants::COMPUTE_BUDGET_SURFACE_CODE as SOLANA_CORE_COMPUTE_BUDGET_SURFACE_CODE;
|
||||
/// Stable Config Program surface code.
|
||||
pub(crate) use self::constants::CONFIG_SURFACE_CODE as SOLANA_CORE_CONFIG_SURFACE_CODE;
|
||||
/// Byte length of an Ed25519 public key.
|
||||
pub(crate) use self::constants::ED25519_PUBLIC_KEY_BYTES as SOLANA_CORE_ED25519_PUBLIC_KEY_BYTES;
|
||||
/// Stable Ed25519 signature precompile surface code.
|
||||
pub(crate) use self::constants::ED25519_SURFACE_CODE as SOLANA_CORE_ED25519_SURFACE_CODE;
|
||||
/// Stable Feature Gate surface code.
|
||||
pub(crate) use self::constants::FEATURE_SURFACE_CODE as SOLANA_CORE_FEATURE_SURFACE_CODE;
|
||||
/// Stable Loader v4 surface code.
|
||||
pub(crate) use self::constants::LOADER_V4_SURFACE_CODE as SOLANA_CORE_LOADER_V4_SURFACE_CODE;
|
||||
/// Maximum retained native instruction payload accepted by the first decoder phase.
|
||||
pub(crate) use self::constants::MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES as SOLANA_CORE_MAX_NATIVE_INSTRUCTION_PAYLOAD_BYTES;
|
||||
/// Current native event payload contract version.
|
||||
pub(crate) use self::constants::NATIVE_EVENT_VERSION as SOLANA_CORE_NATIVE_EVENT_VERSION;
|
||||
/// Stable Native Loader surface code.
|
||||
pub(crate) use self::constants::NATIVE_LOADER_SURFACE_CODE as SOLANA_CORE_NATIVE_LOADER_SURFACE_CODE;
|
||||
/// Maximum number of component bytes retained as a hexadecimal event prefix.
|
||||
pub(crate) use self::constants::PRECOMPILE_COMPONENT_PREFIX_BYTES as SOLANA_CORE_PRECOMPILE_COMPONENT_PREFIX_BYTES;
|
||||
/// Stable protocol code shared by native Solana events.
|
||||
pub(crate) use self::constants::PROTOCOL_CODE as SOLANA_CORE_PROTOCOL_CODE;
|
||||
/// Byte length of a secp256k1 Ethereum address.
|
||||
pub(crate) use self::constants::SECP256K1_ETHEREUM_ADDRESS_BYTES as SOLANA_CORE_SECP256K1_ETHEREUM_ADDRESS_BYTES;
|
||||
/// Stable secp256k1 signature precompile surface code.
|
||||
pub(crate) use self::constants::SECP256K1_SURFACE_CODE as SOLANA_CORE_SECP256K1_SURFACE_CODE;
|
||||
/// Runtime maximum number of secp256r1 signatures in one precompile instruction.
|
||||
pub(crate) use self::constants::SECP256R1_MAX_SIGNATURES as SOLANA_CORE_SECP256R1_MAX_SIGNATURES;
|
||||
/// Byte length of a compressed secp256r1 public key.
|
||||
pub(crate) use self::constants::SECP256R1_PUBLIC_KEY_BYTES as SOLANA_CORE_SECP256R1_PUBLIC_KEY_BYTES;
|
||||
/// Stable secp256r1 signature precompile surface code.
|
||||
pub(crate) use self::constants::SECP256R1_SURFACE_CODE as SOLANA_CORE_SECP256R1_SURFACE_CODE;
|
||||
/// Byte length shared by compact Ed25519, secp256k1 and secp256r1 signatures.
|
||||
pub(crate) use self::constants::SIGNATURE_BYTES as SOLANA_CORE_SIGNATURE_BYTES;
|
||||
/// Stable Slashing Program decoder surface code.
|
||||
pub(crate) use self::constants::SLASHING_SURFACE_CODE as SOLANA_CORE_SLASHING_SURFACE_CODE;
|
||||
/// Stable Stake Program surface code.
|
||||
pub(crate) use self::constants::STAKE_SURFACE_CODE as SOLANA_CORE_STAKE_SURFACE_CODE;
|
||||
/// Stable System Program surface code.
|
||||
pub(crate) use self::constants::SYSTEM_SURFACE_CODE as SOLANA_CORE_SYSTEM_SURFACE_CODE;
|
||||
/// Canonical tracing target for the Solana Core decoder component.
|
||||
pub(crate) use self::constants::TRACING_TARGET as SOLANA_CORE_TRACING_TARGET;
|
||||
/// Byte length of one secp256k1 offsets entry.
|
||||
pub(crate) use self::constants::U8_OFFSETS_BYTES as SOLANA_CORE_U8_OFFSETS_BYTES;
|
||||
/// Byte length of one Ed25519 or secp256r1 offsets entry.
|
||||
pub(crate) use self::constants::U16_OFFSETS_BYTES as SOLANA_CORE_U16_OFFSETS_BYTES;
|
||||
/// Stable Vote Program surface code.
|
||||
pub(crate) use self::constants::VOTE_SURFACE_CODE as SOLANA_CORE_VOTE_SURFACE_CODE;
|
||||
/// Stable native ZK ElGamal Proof surface code.
|
||||
pub(crate) use self::constants::ZK_ELGAMAL_PROOF_SURFACE_CODE as SOLANA_CORE_ZK_ELGAMAL_PROOF_SURFACE_CODE;
|
||||
/// Stable historical ZK Token Proof surface code.
|
||||
pub(crate) use self::constants::ZK_TOKEN_PROOF_SURFACE_CODE as SOLANA_CORE_ZK_TOKEN_PROOF_SURFACE_CODE;
|
||||
/// Builds one exact decoded native observation.
|
||||
pub(crate) use self::event::decoded_result as solana_core_decoded_result;
|
||||
/// Builds one failed native decode result.
|
||||
pub(crate) use self::event::failed_result as solana_core_failed_result;
|
||||
/// Builds one unsupported native decode result with a bounded diagnostic.
|
||||
pub(crate) use self::event::unsupported_result as solana_core_unsupported_result;
|
||||
/// Returns declared Feature Gate instruction coverage.
|
||||
pub(crate) use self::feature::feature_coverage as solana_core_feature_coverage;
|
||||
/// Decodes one Feature Gate instruction.
|
||||
pub(crate) use self::feature::feature_decode as solana_core_feature_decode;
|
||||
/// Recognizes one Feature Gate instruction without producing an event.
|
||||
pub(crate) use self::feature::feature_recognize as solana_core_feature_recognize;
|
||||
/// Returns declared loader instruction coverage.
|
||||
pub(crate) use self::loaders::loaders_coverage as solana_core_loaders_coverage;
|
||||
/// Decodes one loader instruction.
|
||||
pub(crate) use self::loaders::loaders_decode as solana_core_loaders_decode;
|
||||
/// Recognizes one loader instruction without producing an event.
|
||||
pub(crate) use self::loaders::loaders_recognize as solana_core_loaders_recognize;
|
||||
/// One resolved outer instruction payload and its provenance relative to the target instruction.
|
||||
pub(crate) use self::payload::ResolvedInstructionPayload as SolanaCoreResolvedInstructionPayload;
|
||||
/// Returns a hexadecimal prefix no longer than the available byte slice.
|
||||
pub(crate) use self::payload::bounded_hexadecimal_prefix as solana_core_bounded_hexadecimal_prefix;
|
||||
/// Extracts one exact bounded byte slice with checked arithmetic.
|
||||
pub(crate) use self::payload::bounded_slice as solana_core_bounded_slice;
|
||||
/// Decodes one retained base64 instruction payload with an explicit byte limit.
|
||||
pub(crate) use self::payload::decode_instruction_data as solana_core_decode_instruction_data;
|
||||
/// Returns the decoded target payload length when retained and valid.
|
||||
pub(crate) use self::payload::decoded_payload_length as solana_core_decoded_payload_length;
|
||||
/// Returns the SHA-256 of the decoded target instruction data when available.
|
||||
pub(crate) use self::payload::decoded_payload_sha256 as solana_core_decoded_payload_sha256;
|
||||
/// Returns the lowercase SHA-256 of one bounded byte slice.
|
||||
pub(crate) use self::payload::hash_bytes as solana_core_hash_bytes;
|
||||
/// Returns a normalized lowercase hexadecimal prefix.
|
||||
pub(crate) use self::payload::hexadecimal_prefix as solana_core_hexadecimal_prefix;
|
||||
/// Returns a stable payload hash from core or computes it from retained JSON.
|
||||
pub(crate) use self::payload::payload_hash as solana_core_payload_hash;
|
||||
/// Reads one little-endian `u32` from an exact byte range.
|
||||
pub(crate) use self::payload::read_u32_le as solana_core_read_u32_le;
|
||||
/// Reads one little-endian `u64` from an exact byte range.
|
||||
pub(crate) use self::payload::read_u64_le as solana_core_read_u64_le;
|
||||
/// 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 self::payload::resolve_u8_instruction_payload as solana_core_resolve_u8_instruction_payload;
|
||||
/// Resolves an Ed25519 or secp256r1 instruction reference using the official `u16::MAX` sentinel.
|
||||
pub(crate) use self::payload::resolve_u16_instruction_payload as solana_core_resolve_u16_instruction_payload;
|
||||
/// Returns the numeric outer index of the target instruction.
|
||||
pub(crate) use self::payload::target_outer_instruction_index as solana_core_target_outer_instruction_index;
|
||||
/// Returns declared signature precompile coverage.
|
||||
pub(crate) use self::precompiles::precompiles_coverage as solana_core_precompiles_coverage;
|
||||
/// Decodes one signature precompile instruction structurally without cryptographic recomputation.
|
||||
pub(crate) use self::precompiles::precompiles_decode as solana_core_precompiles_decode;
|
||||
/// Recognizes one signature precompile instruction without resolving referenced data.
|
||||
pub(crate) use self::precompiles::precompiles_recognize as solana_core_precompiles_recognize;
|
||||
/// Returns declared Slashing Program instruction coverage.
|
||||
pub(crate) use self::slashing::slashing_coverage as solana_core_slashing_coverage;
|
||||
/// Decodes one Slashing Program instruction.
|
||||
pub(crate) use self::slashing::slashing_decode as solana_core_slashing_decode;
|
||||
/// Recognizes one Slashing Program instruction without producing an event.
|
||||
pub(crate) use self::slashing::slashing_recognize as solana_core_slashing_recognize;
|
||||
/// Returns declared Stake Program instruction coverage.
|
||||
pub(crate) use self::stake::stake_coverage as solana_core_stake_coverage;
|
||||
/// Decodes one Stake Program instruction.
|
||||
pub(crate) use self::stake::stake_decode as solana_core_stake_decode;
|
||||
/// Recognizes one Stake Program instruction without producing an event.
|
||||
pub(crate) use self::stake::stake_recognize as solana_core_stake_recognize;
|
||||
/// Returns declared System Program instruction coverage.
|
||||
pub(crate) use self::system::system_coverage as solana_core_system_coverage;
|
||||
/// Decodes one System Program instruction.
|
||||
pub(crate) use self::system::system_decode as solana_core_system_decode;
|
||||
/// Recognizes one System Program instruction without producing an event.
|
||||
pub(crate) use self::system::system_recognize as solana_core_system_recognize;
|
||||
/// Returns declared Vote Program instruction coverage.
|
||||
pub(crate) use self::vote::vote_coverage as solana_core_vote_coverage;
|
||||
/// Decodes one Vote Program instruction.
|
||||
pub(crate) use self::vote::vote_decode as solana_core_vote_decode;
|
||||
/// Recognizes one Vote Program instruction without producing an event.
|
||||
pub(crate) use self::vote::vote_recognize as solana_core_vote_recognize;
|
||||
/// Returns declared ZK ElGamal Proof instruction coverage.
|
||||
pub(crate) use self::zk_elgamal::zk_elgamal_coverage as solana_core_zk_elgamal_coverage;
|
||||
/// Decodes one native ZK ElGamal Proof instruction without recomputing the proof.
|
||||
pub(crate) use self::zk_elgamal::zk_elgamal_decode as solana_core_zk_elgamal_decode;
|
||||
/// Recognizes one native ZK ElGamal Proof instruction.
|
||||
pub(crate) use self::zk_elgamal::zk_elgamal_recognize as solana_core_zk_elgamal_recognize;
|
||||
/// Returns declared historical and current ZK Token Proof coverage.
|
||||
pub(crate) use self::zk_token_proof::zk_token_proof_coverage as solana_core_zk_token_proof_coverage;
|
||||
/// Decodes one historical ZK Token Proof layout without recomputing any proof.
|
||||
pub(crate) use self::zk_token_proof::zk_token_proof_decode as solana_core_zk_token_proof_decode;
|
||||
/// Recognizes one historical ZK Token Proof layout or the current no-op runtime fallback.
|
||||
pub(crate) use self::zk_token_proof::zk_token_proof_recognize as solana_core_zk_token_proof_recognize;
|
||||
|
||||
/// Runtime-native Solana decoder with phased maximal native coverage.
|
||||
pub use self::decoder::SolanaCoreDecoder;
|
||||
|
||||
Reference in New Issue
Block a user