light_sdk/state.rs
1use anchor_lang::{AnchorDeserialize, AnchorSerialize};
2use solana_program::pubkey::Pubkey;
3
4#[derive(AnchorDeserialize, AnchorSerialize, Debug, PartialEq, Default)]
5pub struct MerkleTreeMetadata {
6 pub access_metadata: AccessMetadata,
7 pub rollover_metadata: RolloverMetadata,
8 // Queue associated with this Merkle tree.
9 pub associated_queue: Pubkey,
10 // Next Merkle tree to be used after rollover.
11 pub next_merkle_tree: Pubkey,
12}
13
14#[derive(AnchorDeserialize, AnchorSerialize, Debug, PartialEq, Default)]
15pub struct AccessMetadata {
16 /// Owner of the Merkle tree.
17 pub owner: Pubkey,
18 /// Program owner of the Merkle tree. This will be used for program owned Merkle trees.
19 pub program_owner: Pubkey,
20 /// Optional privileged forester pubkey, can be set for custom Merkle trees
21 /// without a network fee. Merkle trees without network fees are not
22 /// forested by light foresters. The variable is not used in the account
23 /// compression program but the registry program. The registry program
24 /// implements access control to prevent contention during forester. The
25 /// forester pubkey specified in this struct can bypass contention checks.
26 pub forester: Pubkey,
27}
28
29#[derive(AnchorDeserialize, AnchorSerialize, Debug, PartialEq, Default)]
30pub struct RolloverMetadata {
31 /// Unique index.
32 pub index: u64,
33 /// This fee is used for rent for the next account.
34 /// It accumulates in the account so that once the corresponding Merkle tree account is full it can be rolled over
35 pub rollover_fee: u64,
36 /// The threshold in percentage points when the account should be rolled over (95 corresponds to 95% filled).
37 pub rollover_threshold: u64,
38 /// Tip for maintaining the account.
39 pub network_fee: u64,
40 /// The slot when the account was rolled over, a rolled over account should not be written to.
41 pub rolledover_slot: u64,
42 /// If current slot is greater than rolledover_slot + close_threshold and
43 /// the account is empty it can be closed. No 'close' functionality has been
44 /// implemented yet.
45 pub close_threshold: u64,
46 /// Placeholder for bytes of additional accounts which are tied to the
47 /// Merkle trees operation and need to be rolled over as well.
48 pub additional_bytes: u64,
49}