From a64c16b8c9cfe3955faf42bca56767c95133e3c6 Mon Sep 17 00:00:00 2001 From: Sergio Chouhy Date: Tue, 24 Feb 2026 10:31:18 -0300 Subject: [PATCH 1/9] compress proofs --- nssa/src/privacy_preserving_transaction/circuit.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nssa/src/privacy_preserving_transaction/circuit.rs b/nssa/src/privacy_preserving_transaction/circuit.rs index 9a28badd..98e0be24 100644 --- a/nssa/src/privacy_preserving_transaction/circuit.rs +++ b/nssa/src/privacy_preserving_transaction/circuit.rs @@ -7,7 +7,7 @@ use nssa_core::{ account::AccountWithMetadata, program::{ChainedCall, InstructionData, ProgramId, ProgramOutput}, }; -use risc0_zkvm::{ExecutorEnv, InnerReceipt, Receipt, default_prover}; +use risc0_zkvm::{ExecutorEnv, InnerReceipt, ProverOpts, Receipt, default_prover}; use crate::{ error::NssaError, @@ -126,8 +126,9 @@ pub fn execute_and_prove( env_builder.write(&circuit_input).unwrap(); let env = env_builder.build().unwrap(); let prover = default_prover(); + let opts = ProverOpts::succinct(); let prove_info = prover - .prove(env, PRIVACY_PRESERVING_CIRCUIT_ELF) + .prove_with_opts(env, PRIVACY_PRESERVING_CIRCUIT_ELF, &opts) .map_err(|e| NssaError::CircuitProvingError(e.to_string()))?; let proof = Proof(borsh::to_vec(&prove_info.receipt.inner)?); From 818eebb99f69a41920d4c9ddb637c1e7c76d76ad Mon Sep 17 00:00:00 2001 From: Pravdyvy Date: Wed, 25 Feb 2026 14:19:51 +0200 Subject: [PATCH 2/9] fix: recent blocks fix --- explorer_service/src/api.rs | 11 +++++++++++ explorer_service/src/pages/main_page.rs | 18 +++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/explorer_service/src/api.rs b/explorer_service/src/api.rs index d0785949..4dfd75cd 100644 --- a/explorer_service/src/api.rs +++ b/explorer_service/src/api.rs @@ -83,6 +83,17 @@ pub async fn get_block_by_id(block_id: BlockId) -> Result .map_err(|e| ServerFnError::ServerError(format!("RPC error: {}", e))) } +/// Get latest block ID +#[server] +pub async fn get_latest_block_id() -> Result { + use indexer_service_rpc::RpcClient as _; + let client = expect_context::(); + client + .get_last_finalized_block_id() + .await + .map_err(|e| ServerFnError::ServerError(format!("RPC error: {}", e))) +} + /// Get block by hash #[server] pub async fn get_block_by_hash(block_hash: HashType) -> Result { diff --git a/explorer_service/src/pages/main_page.rs b/explorer_service/src/pages/main_page.rs index ffd625c8..4a47536d 100644 --- a/explorer_service/src/pages/main_page.rs +++ b/explorer_service/src/pages/main_page.rs @@ -7,6 +7,8 @@ use crate::{ components::{AccountPreview, BlockPreview, TransactionPreview}, }; +const RECENT_BLOCKS_LIMIT: u64 = 10; + /// Main page component #[component] pub fn MainPage() -> impl IntoView { @@ -38,7 +40,21 @@ pub fn MainPage() -> impl IntoView { }); // Load recent blocks on mount - let recent_blocks_resource = Resource::new(|| (), |_| async { api::get_blocks(0, 10).await }); + let recent_blocks_resource = Resource::new( + || (), + |_| async { + match api::get_latest_block_id().await { + Ok(last_id) => { + api::get_blocks( + std::cmp::max(last_id.saturating_sub(RECENT_BLOCKS_LIMIT) as u32, 1), + RECENT_BLOCKS_LIMIT as u32, + ) + .await + } + Err(err) => Err(err), + } + }, + ); // Handle search - update URL parameter let on_search = move |ev: SubmitEvent| { From 24271b398e993dae459f3169b4f280c088f181af Mon Sep 17 00:00:00 2001 From: Pravdyvy Date: Wed, 25 Feb 2026 17:13:48 +0200 Subject: [PATCH 3/9] fix: possibly fixed tx accounts --- Cargo.lock | 2 + bedrock/docker-compose.yml | 2 +- explorer_service/Cargo.toml | 3 + .../src/components/transaction_preview.rs | 14 ++-- .../src/pages/transaction_page.rs | 44 +++++++++-- indexer/service/protocol/Cargo.toml | 1 + indexer/service/protocol/src/lib.rs | 78 ++++++++++++++++++- indexer/service/rpc/Cargo.toml | 2 +- 8 files changed, 129 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5543243a..7d240a64 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2721,6 +2721,7 @@ dependencies = [ "env_logger", "indexer_service_protocol", "indexer_service_rpc", + "itertools 0.14.0", "jsonrpsee", "leptos", "leptos_axum", @@ -3769,6 +3770,7 @@ dependencies = [ "schemars 1.2.1", "serde", "serde_with", + "sha2", ] [[package]] diff --git a/bedrock/docker-compose.yml b/bedrock/docker-compose.yml index cb93a624..93f5d485 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 - - "0:18080/tcp" + - "8080: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 219f2bc0..1dc989d0 100644 --- a/explorer_service/Cargo.toml +++ b/explorer_service/Cargo.toml @@ -50,6 +50,9 @@ clap = { workspace = true, features = ["derive"], optional = true } url = { workspace = true, optional = true } env_logger = { workspace = true, optional = true } +# Mandatory server side dependencies +itertools.workspace = true + [features] hydrate = ["leptos/hydrate"] ssr = [ diff --git a/explorer_service/src/components/transaction_preview.rs b/explorer_service/src/components/transaction_preview.rs index 68c1e86e..7fc98e77 100644 --- a/explorer_service/src/components/transaction_preview.rs +++ b/explorer_service/src/components/transaction_preview.rs @@ -19,14 +19,12 @@ pub fn TransactionPreview(transaction: Transaction) -> impl IntoView { let (type_name, type_class) = transaction_type_info(&transaction); // Get additional metadata based on transaction type + let affected_pub_account_ids = transaction + .affected_public_account_ids(); + let metadata = match &transaction { - Transaction::Public(tx) => { - let indexer_service_protocol::PublicTransaction { - hash: _, - message, - witness_set: _, - } = tx; - format!("{} accounts involved", message.account_ids.len()) + Transaction::Public(_) => { + format!("{} accounts involved", affected_pub_account_ids.len()) } Transaction::PrivacyPreserving(tx) => { let indexer_service_protocol::PrivacyPreservingTransaction { @@ -36,7 +34,7 @@ pub fn TransactionPreview(transaction: Transaction) -> impl IntoView { } = tx; format!( "{} public accounts, {} commitments", - message.public_account_ids.len(), + affected_pub_account_ids.len(), message.new_commitments.len() ) } diff --git a/explorer_service/src/pages/transaction_page.rs b/explorer_service/src/pages/transaction_page.rs index d0f1b4da..8ab33ff9 100644 --- a/explorer_service/src/pages/transaction_page.rs +++ b/explorer_service/src/pages/transaction_page.rs @@ -4,6 +4,7 @@ use indexer_service_protocol::{ HashType, PrivacyPreservingMessage, PrivacyPreservingTransaction, ProgramDeploymentMessage, ProgramDeploymentTransaction, PublicMessage, PublicTransaction, Transaction, WitnessSet, }; +use itertools::{EitherOrBoth, Itertools}; use leptos::prelude::*; use leptos_router::{components::A, hooks::use_params_map}; @@ -65,7 +66,9 @@ pub fn TransactionPage() -> impl IntoView { - {match tx { + { + let affected_pub_acc_ids = tx.affected_public_account_ids(); + match tx { Transaction::Public(ptx) => { let PublicTransaction { hash: _, @@ -74,7 +77,7 @@ pub fn TransactionPage() -> impl IntoView { } = ptx; let PublicMessage { program_id, - account_ids, + account_ids: _, nonces, instruction_data, } = message; @@ -113,11 +116,13 @@ pub fn TransactionPage() -> impl IntoView {

"Accounts"

- {account_ids + {affected_pub_acc_ids .into_iter() - .zip(nonces.into_iter()) - .map(|(account_id, nonce)| { - let account_id_str = account_id.to_string(); + .zip_longest(nonces.into_iter()) + .map(|maybe_pair| { + match maybe_pair { + EitherOrBoth::Both(account_id, nonce) => { + let account_id_str = account_id.to_string(); view! { } + } + EitherOrBoth::Left(account_id) => { + let account_id_str = account_id.to_string(); + view! { + + } + } + EitherOrBoth::Right(_) => { + view! { + + } + } + } }) .collect::>()}
diff --git a/indexer/service/protocol/Cargo.toml b/indexer/service/protocol/Cargo.toml index f9a3c2ad..2f787d2d 100644 --- a/indexer/service/protocol/Cargo.toml +++ b/indexer/service/protocol/Cargo.toml @@ -16,6 +16,7 @@ base64.workspace = true base58.workspace = true hex.workspace = true anyhow.workspace = true +sha2.workspace = true [features] # Enable conversion to/from NSSA core types diff --git a/indexer/service/protocol/src/lib.rs b/indexer/service/protocol/src/lib.rs index 8fdd3289..f13a51c5 100644 --- a/indexer/service/protocol/src/lib.rs +++ b/indexer/service/protocol/src/lib.rs @@ -3,13 +3,14 @@ //! Currently it mostly mimics types from `nssa_core`, but it's important to have a separate crate //! to define a stable interface for the indexer service RPCs which evolves in its own way. -use std::{fmt::Display, str::FromStr}; +use std::{collections::HashSet, fmt::Display, str::FromStr}; use anyhow::anyhow; use base58::{FromBase58 as _, ToBase58 as _}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_with::{DeserializeFromStr, SerializeDisplay}; +use sha2::{Digest, Sha256}; #[cfg(feature = "convert")] mod convert; @@ -53,6 +54,18 @@ pub struct AccountId { pub value: [u8; 32], } +impl From<&PublicKey> for AccountId { + fn from(key: &PublicKey) -> Self { + const PUBLIC_ACCOUNT_ID_PREFIX: &[u8; 32] = + b"/LEE/v0.3/AccountId/Public/\x00\x00\x00\x00\x00"; + + let mut hasher = Sha256::new(); + hasher.update(PUBLIC_ACCOUNT_ID_PREFIX); + hasher.update(key.0); + Self{ value: hasher.finalize().into()} + } +} + impl Display for AccountId { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.value.to_base58()) @@ -148,6 +161,15 @@ impl Transaction { Transaction::ProgramDeployment(tx) => &tx.hash, } } + + /// Get affected public account ids + pub fn affected_public_account_ids(&self) -> Vec { + match self { + Transaction::Public(tx) => tx.affected_public_account_ids(), + Transaction::PrivacyPreserving(tx) => tx.affected_public_account_ids(), + Transaction::ProgramDeployment(tx) => tx.affected_public_account_ids(), + } + } } #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] @@ -157,6 +179,28 @@ pub struct PublicTransaction { pub witness_set: WitnessSet, } +impl PublicTransaction { + + + pub(crate) fn signer_account_ids(&self) -> Vec { + self.witness_set + .signatures_and_public_keys() + .iter() + .map(|(_, public_key)| AccountId::from(public_key)) + .collect() + } + + pub fn affected_public_account_ids(&self) -> Vec { + let mut acc_set = self + .signer_account_ids() + .into_iter() + .collect::>(); + acc_set.extend(&self.message.account_ids); + + acc_set.into_iter().collect() + } +} + #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] pub struct PrivacyPreservingTransaction { pub hash: HashType, @@ -164,6 +208,26 @@ pub struct PrivacyPreservingTransaction { pub witness_set: WitnessSet, } +impl PrivacyPreservingTransaction { + pub(crate) fn signer_account_ids(&self) -> Vec { + self.witness_set + .signatures_and_public_keys() + .iter() + .map(|(_, public_key)| AccountId::from(public_key)) + .collect() + } + + pub fn affected_public_account_ids(&self) -> Vec { + let mut acc_set = self + .signer_account_ids() + .into_iter() + .collect::>(); + acc_set.extend(&self.message.public_account_ids); + + acc_set.into_iter().collect() + } +} + #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] pub struct PublicMessage { pub program_id: ProgramId, @@ -190,6 +254,12 @@ pub struct WitnessSet { pub proof: Proof, } +impl WitnessSet { + pub fn signatures_and_public_keys(&self) -> &[(Signature, PublicKey)] { + &self.signatures_and_public_keys + } +} + #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] pub struct Proof( #[serde(with = "base64")] @@ -210,6 +280,12 @@ pub struct ProgramDeploymentTransaction { pub message: ProgramDeploymentMessage, } +impl ProgramDeploymentTransaction { + pub fn affected_public_account_ids(&self) -> Vec { + vec![] + } +} + pub type ViewTag = u8; #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] diff --git a/indexer/service/rpc/Cargo.toml b/indexer/service/rpc/Cargo.toml index 2bed63ae..b2194882 100644 --- a/indexer/service/rpc/Cargo.toml +++ b/indexer/service/rpc/Cargo.toml @@ -5,7 +5,7 @@ edition = "2024" license = { workspace = true } [dependencies] -indexer_service_protocol = { workspace = true } +indexer_service_protocol = { workspace = true, features = ["convert"] } jsonrpsee = { workspace = true, features = ["macros"] } serde_json.workspace = true From fb2709f96c80c7213566b9cd86cb994c8214fd41 Mon Sep 17 00:00:00 2001 From: Pravdyvy Date: Wed, 25 Feb 2026 17:14:42 +0200 Subject: [PATCH 4/9] fix: docker fix --- bedrock/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From b2ae6317d2a2083144159369c61e3cbf97347c8f Mon Sep 17 00:00:00 2001 From: Pravdyvy Date: Thu, 26 Feb 2026 09:40:31 +0200 Subject: [PATCH 5/9] fix: naming changes --- explorer_service/src/lib.rs | 6 +++--- explorer_service/src/main.rs | 2 +- explorer_service/src/pages/main_page.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/explorer_service/src/lib.rs b/explorer_service/src/lib.rs index 489636fd..e2b2291e 100644 --- a/explorer_service/src/lib.rs +++ b/explorer_service/src/lib.rs @@ -28,7 +28,7 @@ pub fn App() -> impl IntoView { view! { - + <Title text="LEZ Block Explorer" /> <Meta name="description" content="Explore the blockchain - view blocks, transactions, and accounts" /> <Router> @@ -36,7 +36,7 @@ pub fn App() -> impl IntoView { <header class="app-header"> <nav class="app-nav"> <a href="/" class="nav-logo"> - "LEE Blockchain Explorer" + "LEZ Block Explorer" </a> </nav> </header> @@ -69,7 +69,7 @@ pub fn App() -> impl IntoView { </main> <footer class="app-footer"> - <p>"LEE Blockchain Explorer © 2026"</p> + <p>"LEZ Block Explorer © 2026"</p> </footer> </div> </Router> diff --git a/explorer_service/src/main.rs b/explorer_service/src/main.rs index 63d54d70..6cc4a9a4 100644 --- a/explorer_service/src/main.rs +++ b/explorer_service/src/main.rs @@ -10,7 +10,7 @@ async fn main() { env_logger::init(); - /// LEE Blockchain Explorer Server CLI arguments. + /// LEZ Block Explorer Server CLI arguments. #[derive(Parser, Debug)] #[command(version, about, long_about = None)] struct Args { diff --git a/explorer_service/src/pages/main_page.rs b/explorer_service/src/pages/main_page.rs index 4a47536d..3f6ec808 100644 --- a/explorer_service/src/pages/main_page.rs +++ b/explorer_service/src/pages/main_page.rs @@ -74,7 +74,7 @@ pub fn MainPage() -> impl IntoView { view! { <div class="main-page"> <div class="page-header"> - <h1>"LEE Blockchain Explorer"</h1> + <h1>"LEZ Block Explorer"</h1> </div> <div class="search-section"> From 6e61698ff835b7404e2ebaa496beca23850938ac Mon Sep 17 00:00:00 2001 From: Pravdyvy <awxrvtb@gmail.com> Date: Thu, 26 Feb 2026 13:46:38 +0200 Subject: [PATCH 6/9] fix: complete fixes --- .github/workflows/ci.yml | 2 +- Cargo.lock | 1 - .../src/components/transaction_preview.rs | 14 ++-- explorer_service/src/pages/main_page.rs | 2 +- .../src/pages/transaction_page.rs | 40 +++++++++-- indexer/core/src/block_store.rs | 12 +++- indexer/core/src/lib.rs | 1 - indexer/core/src/state.rs | 9 --- indexer/service/protocol/Cargo.toml | 1 - indexer/service/protocol/src/lib.rs | 72 +------------------ 10 files changed, 55 insertions(+), 99 deletions(-) delete mode 100644 indexer/core/src/state.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce9903b5..990ccdef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -158,7 +158,7 @@ jobs: valid-proof-test: runs-on: ubuntu-latest - timeout-minutes: 60 + timeout-minutes: 90 steps: - uses: actions/checkout@v5 with: diff --git a/Cargo.lock b/Cargo.lock index 7d240a64..1baf7d84 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3770,7 +3770,6 @@ dependencies = [ "schemars 1.2.1", "serde", "serde_with", - "sha2", ] [[package]] diff --git a/explorer_service/src/components/transaction_preview.rs b/explorer_service/src/components/transaction_preview.rs index 7fc98e77..68c1e86e 100644 --- a/explorer_service/src/components/transaction_preview.rs +++ b/explorer_service/src/components/transaction_preview.rs @@ -19,12 +19,14 @@ pub fn TransactionPreview(transaction: Transaction) -> impl IntoView { let (type_name, type_class) = transaction_type_info(&transaction); // Get additional metadata based on transaction type - let affected_pub_account_ids = transaction - .affected_public_account_ids(); - let metadata = match &transaction { - Transaction::Public(_) => { - format!("{} accounts involved", affected_pub_account_ids.len()) + Transaction::Public(tx) => { + let indexer_service_protocol::PublicTransaction { + hash: _, + message, + witness_set: _, + } = tx; + format!("{} accounts involved", message.account_ids.len()) } Transaction::PrivacyPreserving(tx) => { let indexer_service_protocol::PrivacyPreservingTransaction { @@ -34,7 +36,7 @@ pub fn TransactionPreview(transaction: Transaction) -> impl IntoView { } = tx; format!( "{} public accounts, {} commitments", - affected_pub_account_ids.len(), + message.public_account_ids.len(), message.new_commitments.len() ) } diff --git a/explorer_service/src/pages/main_page.rs b/explorer_service/src/pages/main_page.rs index 3f6ec808..3cfb832d 100644 --- a/explorer_service/src/pages/main_page.rs +++ b/explorer_service/src/pages/main_page.rs @@ -47,7 +47,7 @@ pub fn MainPage() -> impl IntoView { Ok(last_id) => { api::get_blocks( std::cmp::max(last_id.saturating_sub(RECENT_BLOCKS_LIMIT) as u32, 1), - RECENT_BLOCKS_LIMIT as u32, + (RECENT_BLOCKS_LIMIT + 1) as u32, ) .await } diff --git a/explorer_service/src/pages/transaction_page.rs b/explorer_service/src/pages/transaction_page.rs index 8ab33ff9..2859719f 100644 --- a/explorer_service/src/pages/transaction_page.rs +++ b/explorer_service/src/pages/transaction_page.rs @@ -67,7 +67,6 @@ pub fn TransactionPage() -> impl IntoView { </div> { - let affected_pub_acc_ids = tx.affected_public_account_ids(); match tx { Transaction::Public(ptx) => { let PublicTransaction { @@ -77,7 +76,7 @@ pub fn TransactionPage() -> impl IntoView { } = ptx; let PublicMessage { program_id, - account_ids: _, + account_ids, nonces, instruction_data, } = message; @@ -116,7 +115,7 @@ pub fn TransactionPage() -> impl IntoView { <h3>"Accounts"</h3> <div class="accounts-list"> - {affected_pub_acc_ids + {account_ids .into_iter() .zip_longest(nonces.into_iter()) .map(|maybe_pair| { @@ -221,9 +220,11 @@ pub fn TransactionPage() -> impl IntoView { <div class="accounts-list"> {public_account_ids .into_iter() - .zip(nonces.into_iter()) - .map(|(account_id, nonce)| { - let account_id_str = account_id.to_string(); + .zip_longest(nonces.into_iter()) + .map(|maybe_pair| { + match maybe_pair { + EitherOrBoth::Both(account_id, nonce) => { + let account_id_str = account_id.to_string(); view! { <div class="account-item"> <A href=format!("/account/{}", account_id_str)> @@ -234,6 +235,33 @@ pub fn TransactionPage() -> impl IntoView { </span> </div> } + } + EitherOrBoth::Left(account_id) => { + let account_id_str = account_id.to_string(); + view! { + <div class="account-item"> + <A href=format!("/account/{}", account_id_str)> + <span class="hash">{account_id_str}</span> + </A> + <span class="nonce"> + " (nonce: "{"Not affected by this transaction".to_string()}" )" + </span> + </div> + } + } + EitherOrBoth::Right(_) => { + view! { + <div class="account-item"> + <A href=format!("/account/{}", "Account not found")> + <span class="hash">{"Account not found"}</span> + </A> + <span class="nonce"> + " (nonce: "{"Account not found".to_string()}" )" + </span> + </div> + } + } + } }) .collect::<Vec<_>>()} </div> diff --git a/indexer/core/src/block_store.rs b/indexer/core/src/block_store.rs index 496d0bf3..2c1e960c 100644 --- a/indexer/core/src/block_store.rs +++ b/indexer/core/src/block_store.rs @@ -1,7 +1,10 @@ use std::{path::Path, sync::Arc}; use anyhow::Result; -use common::{block::Block, transaction::NSSATransaction}; +use common::{ + block::{BedrockStatus, Block}, + transaction::NSSATransaction, +}; use nssa::{Account, AccountId, V02State}; use storage::indexer::RocksDBIO; @@ -92,7 +95,7 @@ impl IndexerStore { Ok(self.final_state()?.get_account_by_id(*account_id)) } - pub fn put_block(&self, block: Block) -> Result<()> { + pub fn put_block(&self, mut block: Block) -> Result<()> { let mut final_state = self.dbio.final_state()?; for transaction in &block.body.transactions { @@ -102,6 +105,11 @@ impl IndexerStore { .execute_check_on_state(&mut final_state)?; } + // ToDo: Currently we are fetching only finalized blocks + // if it changes, the following lines need to be updated + // to represent correct block finality + block.bedrock_status = BedrockStatus::Finalized; + Ok(self.dbio.put_block(block)?) } } diff --git a/indexer/core/src/lib.rs b/indexer/core/src/lib.rs index 0497e68a..3111be6d 100644 --- a/indexer/core/src/lib.rs +++ b/indexer/core/src/lib.rs @@ -14,7 +14,6 @@ use crate::{block_store::IndexerStore, config::IndexerConfig}; pub mod block_store; pub mod config; -pub mod state; #[derive(Clone)] pub struct IndexerCore { diff --git a/indexer/core/src/state.rs b/indexer/core/src/state.rs deleted file mode 100644 index bd05971f..00000000 --- a/indexer/core/src/state.rs +++ /dev/null @@ -1,9 +0,0 @@ -use std::sync::Arc; - -use tokio::sync::RwLock; - -#[derive(Debug, Clone)] -pub struct IndexerState { - // Only one field for now, for testing. - pub latest_seen_block: Arc<RwLock<u64>>, -} diff --git a/indexer/service/protocol/Cargo.toml b/indexer/service/protocol/Cargo.toml index 2f787d2d..f9a3c2ad 100644 --- a/indexer/service/protocol/Cargo.toml +++ b/indexer/service/protocol/Cargo.toml @@ -16,7 +16,6 @@ base64.workspace = true base58.workspace = true hex.workspace = true anyhow.workspace = true -sha2.workspace = true [features] # Enable conversion to/from NSSA core types diff --git a/indexer/service/protocol/src/lib.rs b/indexer/service/protocol/src/lib.rs index f13a51c5..47dc20cc 100644 --- a/indexer/service/protocol/src/lib.rs +++ b/indexer/service/protocol/src/lib.rs @@ -3,14 +3,13 @@ //! Currently it mostly mimics types from `nssa_core`, but it's important to have a separate crate //! to define a stable interface for the indexer service RPCs which evolves in its own way. -use std::{collections::HashSet, fmt::Display, str::FromStr}; +use std::{fmt::Display, str::FromStr}; use anyhow::anyhow; use base58::{FromBase58 as _, ToBase58 as _}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_with::{DeserializeFromStr, SerializeDisplay}; -use sha2::{Digest, Sha256}; #[cfg(feature = "convert")] mod convert; @@ -54,18 +53,6 @@ pub struct AccountId { pub value: [u8; 32], } -impl From<&PublicKey> for AccountId { - fn from(key: &PublicKey) -> Self { - const PUBLIC_ACCOUNT_ID_PREFIX: &[u8; 32] = - b"/LEE/v0.3/AccountId/Public/\x00\x00\x00\x00\x00"; - - let mut hasher = Sha256::new(); - hasher.update(PUBLIC_ACCOUNT_ID_PREFIX); - hasher.update(key.0); - Self{ value: hasher.finalize().into()} - } -} - impl Display for AccountId { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.value.to_base58()) @@ -161,15 +148,6 @@ impl Transaction { Transaction::ProgramDeployment(tx) => &tx.hash, } } - - /// Get affected public account ids - pub fn affected_public_account_ids(&self) -> Vec<AccountId> { - match self { - Transaction::Public(tx) => tx.affected_public_account_ids(), - Transaction::PrivacyPreserving(tx) => tx.affected_public_account_ids(), - Transaction::ProgramDeployment(tx) => tx.affected_public_account_ids(), - } - } } #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] @@ -179,28 +157,6 @@ pub struct PublicTransaction { pub witness_set: WitnessSet, } -impl PublicTransaction { - - - pub(crate) fn signer_account_ids(&self) -> Vec<AccountId> { - self.witness_set - .signatures_and_public_keys() - .iter() - .map(|(_, public_key)| AccountId::from(public_key)) - .collect() - } - - pub fn affected_public_account_ids(&self) -> Vec<AccountId> { - let mut acc_set = self - .signer_account_ids() - .into_iter() - .collect::<HashSet<_>>(); - acc_set.extend(&self.message.account_ids); - - acc_set.into_iter().collect() - } -} - #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] pub struct PrivacyPreservingTransaction { pub hash: HashType, @@ -208,26 +164,6 @@ pub struct PrivacyPreservingTransaction { pub witness_set: WitnessSet, } -impl PrivacyPreservingTransaction { - pub(crate) fn signer_account_ids(&self) -> Vec<AccountId> { - self.witness_set - .signatures_and_public_keys() - .iter() - .map(|(_, public_key)| AccountId::from(public_key)) - .collect() - } - - pub fn affected_public_account_ids(&self) -> Vec<AccountId> { - let mut acc_set = self - .signer_account_ids() - .into_iter() - .collect::<HashSet<_>>(); - acc_set.extend(&self.message.public_account_ids); - - acc_set.into_iter().collect() - } -} - #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] pub struct PublicMessage { pub program_id: ProgramId, @@ -280,12 +216,6 @@ pub struct ProgramDeploymentTransaction { pub message: ProgramDeploymentMessage, } -impl ProgramDeploymentTransaction { - pub fn affected_public_account_ids(&self) -> Vec<AccountId> { - vec![] - } -} - pub type ViewTag = u8; #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] From 5eb4e0af1fc8079b4ca8169de3ad3836ce9267ee Mon Sep 17 00:00:00 2001 From: Pravdyvy <awxrvtb@gmail.com> Date: Thu, 26 Feb 2026 19:18:41 +0200 Subject: [PATCH 7/9] fix: downgrades of logs --- .github/workflows/ci.yml | 2 +- indexer/service/protocol/src/lib.rs | 6 ------ sequencer_core/src/block_settlement_client.rs | 4 ++-- sequencer_runner/src/lib.rs | 2 +- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5515da9c..eb4cc791 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -186,7 +186,7 @@ jobs: valid-proof-test: runs-on: ubuntu-latest - timeout-minutes: 90 + timeout-minutes: 60 steps: - uses: actions/checkout@v5 with: diff --git a/indexer/service/protocol/src/lib.rs b/indexer/service/protocol/src/lib.rs index 47dc20cc..8fdd3289 100644 --- a/indexer/service/protocol/src/lib.rs +++ b/indexer/service/protocol/src/lib.rs @@ -190,12 +190,6 @@ pub struct WitnessSet { pub proof: Proof, } -impl WitnessSet { - pub fn signatures_and_public_keys(&self) -> &[(Signature, PublicKey)] { - &self.signatures_and_public_keys - } -} - #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)] pub struct Proof( #[serde(with = "base64")] diff --git a/sequencer_core/src/block_settlement_client.rs b/sequencer_core/src/block_settlement_client.rs index 075ebd11..15612835 100644 --- a/sequencer_core/src/block_settlement_client.rs +++ b/sequencer_core/src/block_settlement_client.rs @@ -28,7 +28,7 @@ pub trait BlockSettlementClientTrait: Clone { /// Create and sign a transaction for inscribing data. fn create_inscribe_tx(&self, block: &Block) -> Result<(SignedMantleTx, MsgId)> { let inscription_data = borsh::to_vec(block)?; - log::info!( + log::debug!( "The size of the block {} is {} bytes", block.header.block_id, inscription_data.len() @@ -104,7 +104,7 @@ impl BlockSettlementClientTrait for BlockSettlementClient { .await .context("Failed to post transaction to Bedrock")?; - log::info!("Posted block to Bedrock with parent id {parent_id:?} and msg id: {msg_id:?}"); + log::debug!("Posted block to Bedrock with parent id {parent_id:?} and msg id: {msg_id:?}"); Ok(()) } diff --git a/sequencer_runner/src/lib.rs b/sequencer_runner/src/lib.rs index 7a02bfc3..8bef705e 100644 --- a/sequencer_runner/src/lib.rs +++ b/sequencer_runner/src/lib.rs @@ -183,7 +183,7 @@ async fn retry_pending_blocks(seq_core: &Arc<Mutex<SequencerCore>>) -> Result<() }; for block in pending_blocks.iter() { - info!( + debug!( "Resubmitting pending block with id {}", block.header.block_id ); From c622f3540aadc4742f8f42cb59c207da91e464f2 Mon Sep 17 00:00:00 2001 From: Pravdyvy <awxrvtb@gmail.com> Date: Thu, 26 Feb 2026 20:05:16 +0200 Subject: [PATCH 8/9] fix: logging, config --- indexer/core/src/lib.rs | 3 +++ indexer/service/configs/indexer_config.json | 2 +- sequencer_runner/src/lib.rs | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/indexer/core/src/lib.rs b/indexer/core/src/lib.rs index 8d34ede0..0959249b 100644 --- a/indexer/core/src/lib.rs +++ b/indexer/core/src/lib.rs @@ -139,6 +139,9 @@ impl IndexerCore { info!("Searching for initial header finished"); + info!("Moving one block into future in case if channel start was on first L1 block"); + prev_last_l1_lib_header = self.get_next_lib(prev_last_l1_lib_header).await?; + info!("Starting backfilling from {prev_last_l1_lib_header}"); loop { diff --git a/indexer/service/configs/indexer_config.json b/indexer/service/configs/indexer_config.json index 7d7a317c..247caa8e 100644 --- a/indexer/service/configs/indexer_config.json +++ b/indexer/service/configs/indexer_config.json @@ -1,6 +1,6 @@ { "home": "./indexer/service", - "consensus_info_polling_interval": "1s", + "consensus_info_polling_interval": "60s", "bedrock_client_config": { "addr": "http://localhost:8080", "backoff": { diff --git a/sequencer_runner/src/lib.rs b/sequencer_runner/src/lib.rs index 8bef705e..d74792c8 100644 --- a/sequencer_runner/src/lib.rs +++ b/sequencer_runner/src/lib.rs @@ -182,6 +182,14 @@ async fn retry_pending_blocks(seq_core: &Arc<Mutex<SequencerCore>>) -> Result<() (pending_blocks, client) }; + if !pending_blocks.is_empty() { + info!( + "Resubmitting blocks from {} to {}", + pending_blocks.first().unwrap().header.block_id, + pending_blocks.last().unwrap().header.block_id + ); + } + for block in pending_blocks.iter() { debug!( "Resubmitting pending block with id {}", From 1ea3aab3f12683ae7c5bab4155d4fc3d3dba6102 Mon Sep 17 00:00:00 2001 From: Pravdyvy <awxrvtb@gmail.com> Date: Thu, 26 Feb 2026 20:42:39 +0200 Subject: [PATCH 9/9] fix: limts fix --- indexer/core/src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/indexer/core/src/lib.rs b/indexer/core/src/lib.rs index 0959249b..6d56eb18 100644 --- a/indexer/core/src/lib.rs +++ b/indexer/core/src/lib.rs @@ -139,9 +139,6 @@ impl IndexerCore { info!("Searching for initial header finished"); - info!("Moving one block into future in case if channel start was on first L1 block"); - prev_last_l1_lib_header = self.get_next_lib(prev_last_l1_lib_header).await?; - info!("Starting backfilling from {prev_last_l1_lib_header}"); loop { @@ -270,7 +267,7 @@ impl IndexerCore { Ok(BackfillData { block_data: block_buffer, - curr_fin_l1_lib_header: backfill_limit, + curr_fin_l1_lib_header: curr_last_l1_lib_header, }) }