diff --git a/Cargo.lock b/Cargo.lock index afe4e7b3..1e5519d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2469,7 +2469,6 @@ dependencies = [ "console_error_panic_hook", "console_log", "env_logger", - "hex", "indexer_service_protocol", "indexer_service_rpc", "jsonrpsee", @@ -3403,12 +3402,16 @@ dependencies = [ name = "indexer_service_protocol" version = "0.1.0" dependencies = [ + "anyhow", + "base58", "base64 0.22.1", "common", + "hex", "nssa", "nssa_core", "schemars 1.2.1", "serde", + "serde_with", ] [[package]] @@ -3833,9 +3836,9 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +checksum = "cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653" dependencies = [ "cpufeatures", ] @@ -8190,7 +8193,6 @@ dependencies = [ "amm_core", "anyhow", "async-stream", - "base58", "base64 0.22.1", "borsh", "bytemuck", diff --git a/artifacts/test_program_methods/burner.bin b/artifacts/test_program_methods/burner.bin index 5b92cfc4..bbff49aa 100644 Binary files a/artifacts/test_program_methods/burner.bin and b/artifacts/test_program_methods/burner.bin differ diff --git a/artifacts/test_program_methods/chain_caller.bin b/artifacts/test_program_methods/chain_caller.bin index adb03a26..3495435a 100644 Binary files a/artifacts/test_program_methods/chain_caller.bin and b/artifacts/test_program_methods/chain_caller.bin differ diff --git a/artifacts/test_program_methods/changer_claimer.bin b/artifacts/test_program_methods/changer_claimer.bin index 5d5b157a..7c1cfb5b 100644 Binary files a/artifacts/test_program_methods/changer_claimer.bin and b/artifacts/test_program_methods/changer_claimer.bin differ diff --git a/artifacts/test_program_methods/claimer.bin b/artifacts/test_program_methods/claimer.bin index b816a527..dc622f89 100644 Binary files a/artifacts/test_program_methods/claimer.bin and b/artifacts/test_program_methods/claimer.bin differ diff --git a/artifacts/test_program_methods/data_changer.bin b/artifacts/test_program_methods/data_changer.bin index 3dcd0663..38ec9d78 100644 Binary files a/artifacts/test_program_methods/data_changer.bin and b/artifacts/test_program_methods/data_changer.bin differ diff --git a/artifacts/test_program_methods/extra_output.bin b/artifacts/test_program_methods/extra_output.bin index 37bd04e3..3f36d446 100644 Binary files a/artifacts/test_program_methods/extra_output.bin and b/artifacts/test_program_methods/extra_output.bin differ diff --git a/artifacts/test_program_methods/malicious_authorization_changer.bin b/artifacts/test_program_methods/malicious_authorization_changer.bin index 6d25674b..4ccb216c 100644 Binary files a/artifacts/test_program_methods/malicious_authorization_changer.bin and b/artifacts/test_program_methods/malicious_authorization_changer.bin differ diff --git a/artifacts/test_program_methods/minter.bin b/artifacts/test_program_methods/minter.bin index 73607e85..040a9dbf 100644 Binary files a/artifacts/test_program_methods/minter.bin and b/artifacts/test_program_methods/minter.bin differ diff --git a/artifacts/test_program_methods/missing_output.bin b/artifacts/test_program_methods/missing_output.bin index 7b2aa8a3..e04ab41d 100644 Binary files a/artifacts/test_program_methods/missing_output.bin and b/artifacts/test_program_methods/missing_output.bin differ diff --git a/artifacts/test_program_methods/modified_transfer.bin b/artifacts/test_program_methods/modified_transfer.bin index ccb40a3a..7871d07c 100644 Binary files a/artifacts/test_program_methods/modified_transfer.bin and b/artifacts/test_program_methods/modified_transfer.bin differ diff --git a/artifacts/test_program_methods/nonce_changer.bin b/artifacts/test_program_methods/nonce_changer.bin index 7e26bf73..bf10cc24 100644 Binary files a/artifacts/test_program_methods/nonce_changer.bin and b/artifacts/test_program_methods/nonce_changer.bin differ diff --git a/artifacts/test_program_methods/noop.bin b/artifacts/test_program_methods/noop.bin index 69608bbf..71080ca3 100644 Binary files a/artifacts/test_program_methods/noop.bin and b/artifacts/test_program_methods/noop.bin differ diff --git a/artifacts/test_program_methods/program_owner_changer.bin b/artifacts/test_program_methods/program_owner_changer.bin index f4c91bae..3d3f528a 100644 Binary files a/artifacts/test_program_methods/program_owner_changer.bin and b/artifacts/test_program_methods/program_owner_changer.bin differ diff --git a/artifacts/test_program_methods/simple_balance_transfer.bin b/artifacts/test_program_methods/simple_balance_transfer.bin index b3381b5f..74f82078 100644 Binary files a/artifacts/test_program_methods/simple_balance_transfer.bin and b/artifacts/test_program_methods/simple_balance_transfer.bin differ diff --git a/bedrock/docker-compose.yml b/bedrock/docker-compose.yml index 93f5d485..cb93a624 100644 --- a/bedrock/docker-compose.yml +++ b/bedrock/docker-compose.yml @@ -11,7 +11,7 @@ services: image: ghcr.io/logos-blockchain/logos-blockchain@sha256:000982e751dfd346ca5346b8025c685fc3abc585079c59cde3bde7fd63100657 ports: # Map 0 port so that multiple instances can run on the same host - - "8080:18080/tcp" + - "0:18080/tcp" volumes: - ./scripts:/etc/logos-blockchain/scripts - ./kzgrs_test_params:/kzgrs_test_params:z diff --git a/explorer_service/Cargo.toml b/explorer_service/Cargo.toml index 49d1ddce..219f2bc0 100644 --- a/explorer_service/Cargo.toml +++ b/explorer_service/Cargo.toml @@ -26,9 +26,6 @@ console_log = "1.0" # Date/Time chrono.workspace = true -# Hex encoding/decoding -hex.workspace = true - # URL encoding urlencoding = "2.1" diff --git a/explorer_service/src/api.rs b/explorer_service/src/api.rs index c3360c01..7974d5c0 100644 --- a/explorer_service/src/api.rs +++ b/explorer_service/src/api.rs @@ -25,13 +25,6 @@ pub async fn get_account(account_id: AccountId) -> Result Option> { - let s = s.trim().trim_start_matches("0x"); - hex::decode(s).ok() -} - /// Search for a block, transaction, or account by query string #[server] pub async fn search(query: String) -> Result { @@ -42,12 +35,8 @@ pub async fn search(query: String) -> Result { let mut transactions = Vec::new(); let mut accounts = Vec::new(); - // Try to parse as hash (32 bytes) - if let Some(bytes) = parse_hex(&query) - && let Ok(hash_array) = <[u8; 32]>::try_from(bytes) - { - let hash = HashType(hash_array); - + // Try as hash + if let Ok(hash) = HashType::from_str(&query) { // Try as block hash if let Ok(block) = client.get_block_by_hash(hash).await { blocks.push(block); @@ -57,12 +46,13 @@ pub async fn search(query: String) -> Result { if let Ok(tx) = client.get_transaction(hash).await { transactions.push(tx); } + } - // Try as account ID - let account_id = AccountId { value: hash_array }; - if let Ok(account) = client.get_account(account_id).await { - accounts.push((account_id, account)); - } + // Try as account ID + if let Ok(account_id) = AccountId::from_str(&query) + && let Ok(account) = client.get_account(account_id).await + { + accounts.push((account_id, account)); } // Try as block ID diff --git a/explorer_service/src/components/account_preview.rs b/explorer_service/src/components/account_preview.rs index 3a99eeb8..bbe59c0f 100644 --- a/explorer_service/src/components/account_preview.rs +++ b/explorer_service/src/components/account_preview.rs @@ -2,12 +2,10 @@ use indexer_service_protocol::{Account, AccountId}; use leptos::prelude::*; use leptos_router::components::A; -use crate::format_utils; - /// Account preview component #[component] pub fn AccountPreview(account_id: AccountId, account: Account) -> impl IntoView { - let account_id_str = format_utils::format_account_id(&account_id); + let account_id_str = account_id.to_string(); view! { {move || { let Account { program_owner, balance, data, nonce } = &account; - let program_id = format_utils::format_program_id(program_owner); + let program_id = program_owner.to_string(); view! {