pub trait TreeSyncApi {
type Error: Debug;
// Required methods
fn get_block_commitments(
&self,
from_height: u32,
to_height: u32,
) -> Result<BlockCommitmentsPage, Self::Error>;
fn get_root_at_height(&self, height: u32) -> Result<Option<Fp>, Self::Error>;
fn get_tree_state(&self) -> Result<TreeState, Self::Error>;
}Expand description
The contract between server and client.
In the POC: in-process (server implements this directly). In production: maps to Cosmos SDK gRPC/REST endpoints:
get_block_commitments→ custom compact-block endpoint or Tendermint block queriesget_root_at_height→GET /zally/v1/commitment-tree/{height}get_tree_state→GET /zally/v1/commitment-tree/latest
Required Associated Types§
Required Methods§
Sourcefn get_block_commitments(
&self,
from_height: u32,
to_height: u32,
) -> Result<BlockCommitmentsPage, Self::Error>
fn get_block_commitments( &self, from_height: u32, to_height: u32, ) -> Result<BlockCommitmentsPage, Self::Error>
Fetch commitments per block in a height range (primary sync method).
Returns blocks in ascending height order. Empty blocks (no appends) may be omitted from the result.
Sourcefn get_root_at_height(&self, height: u32) -> Result<Option<Fp>, Self::Error>
fn get_root_at_height(&self, height: u32) -> Result<Option<Fp>, Self::Error>
Fetch tree root at a checkpoint height (anchor verification).
Maps to: GET /zally/v1/commitment-tree/{height}
Sourcefn get_tree_state(&self) -> Result<TreeState, Self::Error>
fn get_tree_state(&self) -> Result<TreeState, Self::Error>
Fetch current tree state (next_index, root, latest height).
Maps to: GET /zally/v1/commitment-tree/latest