Skip to content

Commit 002990c

Browse files
author
snorochevskiy
committed
Adding more comments
1 parent a6e0820 commit 002990c

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

grpc/src/asseturls.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ impl DownloadError {
9090
/// Generated client implementations.
9191
pub mod asset_url_service_client {
9292
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
93-
use tonic::codegen::{http::Uri, *};
93+
use tonic::codegen::http::Uri;
94+
use tonic::codegen::*;
9495
#[derive(Debug, Clone)]
9596
pub struct AssetUrlServiceClient<T> {
9697
inner: tonic::client::Grpc<T>,

grpc/src/consistencyapi.rs

+2
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ pub mod bbgm_consistency_service_client {
305305
));
306306
self.inner.unary(req, path, codec).await
307307
}
308+
/// Request all the bubblegum grand epochs checksums for the given tree
308309
pub async fn get_bbgm_grand_epochs_for_tree(
309310
&mut self,
310311
request: impl tonic::IntoRequest<super::GetBbgmGrandEpochsForTreeReq>,
@@ -604,6 +605,7 @@ pub mod bbgm_consistency_service_server {
604605
&self,
605606
request: tonic::Request<()>,
606607
) -> std::result::Result<tonic::Response<super::BbgmEarlistGrandEpoch>, tonic::Status>;
608+
/// Request all the bubblegum grand epochs checksums for the given tree
607609
async fn get_bbgm_grand_epochs_for_tree(
608610
&self,
609611
request: tonic::Request<super::GetBbgmGrandEpochsForTreeReq>,

nft_ingester/src/bin/ingester/main.rs

+2
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ pub async fn main() -> Result<(), IngesterError> {
217217

218218
let rpc_client = Arc::new(RpcClient::new(config.rpc_host.clone()));
219219

220+
// Manages event related to epochs changes and notifications (new epoch started, late data - epoch invalidation).
221+
// Producers are processors (bubblegum and account), consumer - consistency calculator.
220222
let (nft_change_snd, nft_change_rcv) = mpsc::channel(NTF_CHANGES_NOTIFICATION_QUEUE_SIZE);
221223
let changes_tracker = Arc::new(NftChangesTracker::new(Some(nft_change_snd.clone())));
222224

nft_ingester/src/consistency_calculator.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rocks_db::{
1313
AccountNft, AccountNftBucket, AccountNftBucketKey, AccountNftChange, AccountNftChangeKey,
1414
AccountNftGrandBucket, AccountNftGrandBucketKey, AccountNftKey, BubblegumChange,
1515
BubblegumChangeKey, BubblegumEpoch, BubblegumEpochKey, BubblegumGrandEpoch,
16-
BubblegumGrandEpochKey, ACC_BUCKET_INVALIDATE, ACC_GRAND_BUCKET_INVALIDATE,
16+
BubblegumGrandEpochKey, ACC_BUCKET_INVALIDATE, ACC_GRAND_BUCKET_INVALIDATED,
1717
BUBBLEGUM_GRAND_EPOCH_INVALIDATED,
1818
},
1919
Storage,
@@ -103,7 +103,7 @@ impl NftChangesTracker {
103103
NftChangesTracker { sender }
104104
}
105105

106-
/// Persists given account NFT change into the sotrage, and, if the change is from the epoch
106+
/// Persists given account NFT change into the storage, and, if the change is from the epoch
107107
/// that is previous to the current epoch, then also notifies checksums calculator
108108
/// about late data.
109109
///
@@ -138,7 +138,7 @@ impl NftChangesTracker {
138138
let grand_bucket = grand_bucket_for_bucket(bucket);
139139
let _ = batch_storage.put_acc_grand_bucket(
140140
AccountNftGrandBucketKey::new(grand_bucket),
141-
ACC_GRAND_BUCKET_INVALIDATE,
141+
ACC_GRAND_BUCKET_INVALIDATED,
142142
);
143143
let _ = batch_storage
144144
.put_acc_bucket(AccountNftBucketKey::new(bucket), ACC_BUCKET_INVALIDATE);
@@ -752,7 +752,7 @@ async fn update_acc_if_needed(
752752
.acc_nft_grand_buckets
753753
.put_async(
754754
AccountNftGrandBucketKey::new(grand_bucket),
755-
ACC_GRAND_BUCKET_INVALIDATE,
755+
ACC_GRAND_BUCKET_INVALIDATED,
756756
)
757757
.await;
758758
invalidated_grand_buckets.insert(grand_bucket);

rocks-db/src/storage_consistency.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,23 @@ use crate::{column::TypedColumn, transaction::TreeUpdate, Storage};
2828

2929
use std::{collections::HashSet, sync::atomic::AtomicU64, u64};
3030

31+
/// Last slot seen by any of solana blocks processors.
3132
static LAST_SLOT: AtomicU64 = AtomicU64::new(0);
3233

34+
/// Returns current epoch based on the last seen solana slot
3335
pub fn current_estimated_epoch() -> u32 {
3436
epoch_of_slot(LAST_SLOT.load(std::sync::atomic::Ordering::Relaxed))
3537
}
3638

3739
pub fn last_tracked_slot() -> u64 {
40+
// Doesn't guarantee to be fully accurate, which is fine
3841
LAST_SLOT.load(std::sync::atomic::Ordering::Relaxed)
3942
}
4043

4144
pub fn track_slot_counter(slot: u64) -> u64 {
4245
let prev = LAST_SLOT.load(std::sync::atomic::Ordering::Relaxed);
4346
if slot > prev {
47+
// This code does not guaranteed to store the top slot processed, rather one of the top slots.
4448
LAST_SLOT.store(slot, std::sync::atomic::Ordering::Relaxed);
4549
}
4650
prev
@@ -123,7 +127,7 @@ pub const ACC_BUCKET_INVALIDATE: AccountNftBucket = AccountNftBucket {
123127
checksum: Checksum::Invalidated,
124128
};
125129

126-
pub const ACC_GRAND_BUCKET_INVALIDATE: AccountNftGrandBucket = AccountNftGrandBucket {
130+
pub const ACC_GRAND_BUCKET_INVALIDATED: AccountNftGrandBucket = AccountNftGrandBucket {
127131
checksum: Checksum::Invalidated,
128132
};
129133

0 commit comments

Comments
 (0)