RewardMerkleTreeDataSource

Trait RewardMerkleTreeDataSource 

Source
pub(crate) trait RewardMerkleTreeDataSource:
    Send
    + Sync
    + Clone
    + 'static {
Show 13 methods // Required methods fn load_v1_reward_account_proof( &self, _height: u64, _account: RewardAccountV1, ) -> impl Send + Future<Output = Result<RewardAccountQueryDataV1>>; fn persist_reward_proofs( &self, node_state: &NodeState, height: u64, version: Version, ) -> impl Send + Future<Output = Result<()>>; fn persist_tree( &self, height: u64, merkle_tree: Vec<u8>, ) -> impl Send + Future<Output = Result<()>>; fn load_tree( &self, height: u64, ) -> impl Send + Future<Output = Result<Vec<u8>>>; fn persist_proofs( &self, height: u64, proofs: impl Iterator<Item = (Vec<u8>, Vec<u8>)> + Send, ) -> impl Send + Future<Output = Result<()>>; fn load_proof( &self, height: u64, account: Vec<u8>, epoch_height: u64, ) -> impl Send + Future<Output = Result<Vec<u8>>>; fn load_latest_proof( &self, account: Vec<u8>, ) -> impl Send + Future<Output = Result<Vec<u8>>>; fn proof_exists(&self, height: u64) -> impl Send + Future<Output = bool>; fn garbage_collect( &self, height: u64, ) -> impl Send + Future<Output = Result<()>>; // Provided methods fn save_and_gc_reward_tree_v2( &self, node_state: &NodeState, height: u64, version: Version, merkle_tree: &RewardMerkleTreeV2, ) -> impl Send + Future<Output = Result<()>> { ... } fn load_reward_merkle_tree_v2( &self, height: u64, ) -> impl Send + Future<Output = Result<PermittedRewardMerkleTreeV2>> { ... } fn load_reward_account_proof_v2( &self, _height: u64, _account: RewardAccountV2, ) -> impl Send + Future<Output = Result<RewardAccountQueryDataV2>> { ... } fn load_latest_reward_account_proof_v2( &self, account: RewardAccountV2, ) -> impl Send + Future<Output = Result<RewardAccountQueryDataV2>> { ... }
}

Required Methods§

Source

fn load_v1_reward_account_proof( &self, _height: u64, _account: RewardAccountV1, ) -> impl Send + Future<Output = Result<RewardAccountQueryDataV1>>

Source

fn persist_reward_proofs( &self, node_state: &NodeState, height: u64, version: Version, ) -> impl Send + Future<Output = Result<()>>

Source

fn persist_tree( &self, height: u64, merkle_tree: Vec<u8>, ) -> impl Send + Future<Output = Result<()>>

Source

fn load_tree(&self, height: u64) -> impl Send + Future<Output = Result<Vec<u8>>>

Source

fn persist_proofs( &self, height: u64, proofs: impl Iterator<Item = (Vec<u8>, Vec<u8>)> + Send, ) -> impl Send + Future<Output = Result<()>>

Source

fn load_proof( &self, height: u64, account: Vec<u8>, epoch_height: u64, ) -> impl Send + Future<Output = Result<Vec<u8>>>

Source

fn load_latest_proof( &self, account: Vec<u8>, ) -> impl Send + Future<Output = Result<Vec<u8>>>

Source

fn proof_exists(&self, height: u64) -> impl Send + Future<Output = bool>

Source

fn garbage_collect( &self, height: u64, ) -> impl Send + Future<Output = Result<()>>

garbage collects merkle tree data for blocks strictly older than height

Provided Methods§

Source

fn save_and_gc_reward_tree_v2( &self, node_state: &NodeState, height: u64, version: Version, merkle_tree: &RewardMerkleTreeV2, ) -> impl Send + Future<Output = Result<()>>

Source

fn load_reward_merkle_tree_v2( &self, height: u64, ) -> impl Send + Future<Output = Result<PermittedRewardMerkleTreeV2>>

Source

fn load_reward_account_proof_v2( &self, _height: u64, _account: RewardAccountV2, ) -> impl Send + Future<Output = Result<RewardAccountQueryDataV2>>

Source

fn load_latest_reward_account_proof_v2( &self, account: RewardAccountV2, ) -> impl Send + Future<Output = Result<RewardAccountQueryDataV2>>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl RewardMerkleTreeDataSource for MetricsDataSource

Source§

fn load_v1_reward_account_proof( &self, _height: u64, _account: RewardAccountV1, ) -> impl Send + Future<Output = Result<RewardAccountQueryDataV1>>

Source§

fn persist_reward_proofs( &self, _node_state: &NodeState, _height: u64, _version: Version, ) -> impl Send + Future<Output = Result<()>>

Source§

fn persist_tree( &self, _height: u64, _merkle_tree: Vec<u8>, ) -> impl Send + Future<Output = Result<()>>

Source§

fn load_tree( &self, _height: u64, ) -> impl Send + Future<Output = Result<Vec<u8>>>

Source§

fn garbage_collect( &self, _height: u64, ) -> impl Send + Future<Output = Result<()>>

Source§

fn persist_proofs( &self, _height: u64, _proofs: impl Iterator<Item = (Vec<u8>, Vec<u8>)> + Send, ) -> impl Send + Future<Output = Result<()>>

Source§

fn load_proof( &self, _height: u64, _account: Vec<u8>, _epoch_height: u64, ) -> impl Send + Future<Output = Result<Vec<u8>>>

Source§

fn load_latest_proof( &self, _account: Vec<u8>, ) -> impl Send + Future<Output = Result<Vec<u8>>>

Source§

fn proof_exists(&self, _height: u64) -> impl Send + Future<Output = bool>

Source§

impl RewardMerkleTreeDataSource for SqlStorage

Source§

fn load_proof( &self, height: u64, account: Vec<u8>, epoch_height: u64, ) -> impl Send + Future<Output = Result<Vec<u8>>>

Load a reward proof for a given height and account.

For V5+ (epoch rewards), if the requested height is not an epoch boundary, resolves to the previous epoch’s last block. Verifies the boundary block is V5+ to handle V4→V5 upgrades. For V4 (per-block rewards), proofs are stored at every block height.

Source§

fn persist_reward_proofs( &self, node_state: &NodeState, height: u64, version: Version, ) -> impl Send + Future<Output = Result<()>>

Generate and persist reward proofs for the current L1-finalized height.

For V5+ (epoch rewards), the reward tree is only stored at epoch boundaries. We resolve to the nearest epoch boundary to load the tree, verify it’s V5+ (for V4→V5 upgrades), and store the generated proofs at finalized_hotshot_height. For V4 (per-block rewards), the tree exists at every block height.

Source§

async fn load_v1_reward_account_proof( &self, height: u64, account: RewardAccountV1, ) -> Result<RewardAccountQueryDataV1>

Source§

fn persist_tree( &self, height: u64, merkle_tree: Vec<u8>, ) -> impl Send + Future<Output = Result<()>>

Source§

fn load_tree(&self, height: u64) -> impl Send + Future<Output = Result<Vec<u8>>>

Source§

fn persist_proofs( &self, height: u64, proofs: impl Iterator<Item = (Vec<u8>, Vec<u8>)> + Send, ) -> impl Send + Future<Output = Result<()>>

Source§

fn load_latest_proof( &self, account: Vec<u8>, ) -> impl Send + Future<Output = Result<Vec<u8>>>

Source§

fn garbage_collect( &self, height: u64, ) -> impl Send + Future<Output = Result<()>>

Source§

fn proof_exists(&self, height: u64) -> impl Send + Future<Output = bool>

Source§

impl<T, S> RewardMerkleTreeDataSource for ExtensibleDataSource<T, S>

Source§

async fn load_v1_reward_account_proof( &self, height: u64, account: RewardAccountV1, ) -> Result<RewardAccountQueryDataV1>

Source§

async fn load_reward_account_proof_v2( &self, height: u64, account: RewardAccountV2, ) -> Result<RewardAccountQueryDataV2>

Source§

fn persist_tree( &self, height: u64, merkle_tree: Vec<u8>, ) -> impl Send + Future<Output = Result<()>>

Source§

fn load_tree(&self, height: u64) -> impl Send + Future<Output = Result<Vec<u8>>>

Source§

fn garbage_collect( &self, height: u64, ) -> impl Send + Future<Output = Result<()>>

Source§

fn persist_proofs( &self, height: u64, proofs: impl Iterator<Item = (Vec<u8>, Vec<u8>)> + Send, ) -> impl Send + Future<Output = Result<()>>

Source§

fn load_proof( &self, height: u64, account: Vec<u8>, epoch_height: u64, ) -> impl Send + Future<Output = Result<Vec<u8>>>

Source§

fn load_latest_proof( &self, account: Vec<u8>, ) -> impl Send + Future<Output = Result<Vec<u8>>>

Source§

fn proof_exists(&self, height: u64) -> impl Send + Future<Output = bool>

Source§

fn persist_reward_proofs( &self, node_state: &NodeState, height: u64, version: Version, ) -> impl Send + Future<Output = Result<()>>

Implementors§