From f91d83d499d24e6a7e43577c1ce2e9296fcd9d75 Mon Sep 17 00:00:00 2001 From: Sergey Timoshin Date: Mon, 16 Jun 2025 15:19:39 +0100 Subject: [PATCH] refactor: return Pubkey::default() for root in get_validity_proof/v2 --- src/api/method/get_validity_proof/v2.rs | 3 ++- tests/integration_tests/batched_state_tree_tests.rs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/api/method/get_validity_proof/v2.rs b/src/api/method/get_validity_proof/v2.rs index 376cb75a..57d50951 100644 --- a/src/api/method/get_validity_proof/v2.rs +++ b/src/api/method/get_validity_proof/v2.rs @@ -17,6 +17,7 @@ use jsonrpsee_core::Serialize; use sea_orm::{ColumnTrait, ConnectionTrait, EntityTrait, QueryFilter}; use sea_orm::{DatabaseBackend, DatabaseConnection, Statement, TransactionTrait}; use serde::Deserialize; +use solana_pubkey::Pubkey; use utoipa::ToSchema; #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, ToSchema)] @@ -195,7 +196,7 @@ pub async fn get_validity_proof_v2( if acc_model.in_output_queue { accounts_for_prove_by_index_inputs[original_idx] = Some(AccountProofInputs { hash: Hash::new(acc_model.hash.as_slice())?.to_string(), - root: "".to_string(), + root: Pubkey::default().to_string(), root_index: None.into(), // prove_by_index = true leaf_index: acc_model.leaf_index as u64, merkle_context: MerkleContextV2 { diff --git a/tests/integration_tests/batched_state_tree_tests.rs b/tests/integration_tests/batched_state_tree_tests.rs index 620c71f8..794ffd6f 100644 --- a/tests/integration_tests/batched_state_tree_tests.rs +++ b/tests/integration_tests/batched_state_tree_tests.rs @@ -240,7 +240,7 @@ async fn test_batched_tree_transactions( .value .accounts .iter() - .all(|x| x.root.is_empty())); + .all(|x| x.root == Pubkey::default().to_string())); } // Merkle tree which is created along side indexing the event transactions. @@ -418,7 +418,7 @@ async fn test_batched_tree_transactions( assert!(!account_proof.root_index.prove_by_index); } else { assert!(account_proof.root_index.prove_by_index); - assert_eq!(account_proof.root, ""); + assert_eq!(account_proof.root, Pubkey::default().to_string()); } base_index += 2; }