1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
use borsh::{BorshDeserialize, BorshSerialize};
#[derive(BorshDeserialize, BorshSerialize, Debug)]
pub struct Changelogs {
pub changelogs: Vec<ChangelogEvent>,
}
/// Event containing the Merkle path of the given
/// [`StateMerkleTree`](light_merkle_tree_program::state::StateMerkleTree)
/// change. Indexers can use this type of events to re-build a non-sparse
/// version of state Merkle tree.
#[derive(BorshDeserialize, BorshSerialize, Debug)]
#[repr(C)]
pub enum ChangelogEvent {
V1(ChangelogEventV1),
}
/// Node of the Merkle path with an index representing the position in a
/// non-sparse Merkle tree.
#[derive(BorshDeserialize, BorshSerialize, Debug, Eq, PartialEq)]
pub struct PathNode {
pub node: [u8; 32],
pub index: u32,
}
/// Version 1 of the [`ChangelogEvent`](light_merkle_tree_program::state::ChangelogEvent).
#[derive(BorshDeserialize, BorshSerialize, Debug)]
pub struct ChangelogEventV1 {
/// Public key of the tree.
pub id: [u8; 32],
// Merkle paths.
pub paths: Vec<Vec<PathNode>>,
/// Number of successful operations on the on-chain tree.
pub seq: u64,
/// Changelog event index.
pub index: u32,
}