Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MTG-750 Calculating bubblegum and account checksums #291

Closed
wants to merge 4 commits into from

Conversation

snorochevskiy
Copy link
Contributor

@snorochevskiy snorochevskiy commented Oct 22, 2024

See: #316

@snorochevskiy snorochevskiy force-pushed the MTG-688_consistency_checksum branch from 0c84d5c to ba9fa93 Compare October 22, 2024 13:23
Copy link
Contributor

@n00m4d n00m4d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Only one small question at the moment

hasher = Hasher::default();
}
hasher.hash(&k);
hasher.hash(&v);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we save value as well? Why not only key or value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@n00m4d
I assume that theoretically (not sure how high the probability is) we might have a situation, when on different peers there are bubblegum changes with same pubkey+slot+seq, but different signatures.
It you believe that this is impossible, then I can remove the signature from the bubblegum change entity (and from the hashing).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, not sure either. Ok let's leave it for now 😅

Copy link
Contributor

@n00m4d n00m4d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh and also while was looking at fork cleaner got a thought that maybe we should sync with sequence consistency checker before calculating epoch hash, not to calculate epoch hash if we have gaps in tree sequences.

@snorochevskiy snorochevskiy force-pushed the MTG-688_consistency_checksum branch 2 times, most recently from f3636c6 to b504cad Compare November 1, 2024 00:50
@snorochevskiy snorochevskiy changed the title MTG-750 Adding bubblegum checksums storage MTG-750 Calculating bubblegum and account checksums Nov 1, 2024
@snorochevskiy snorochevskiy force-pushed the MTG-688_consistency_checksum branch from b504cad to 23cb90a Compare November 1, 2024 00:56
@snorochevskiy snorochevskiy force-pushed the MTG-688_consistency_checksum branch from 7cd234a to 8595abb Compare November 1, 2024 16:29
Copy link
Collaborator

@StanChe StanChe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still have some reading to do, but sharing the feedback as some comments are pending for quite a while

@@ -185,6 +188,14 @@ pub async fn main() -> Result<(), IngesterError> {
}

let rpc_client = Arc::new(RpcClient::new(config.rpc_host.clone()));
let (nft_change_snd, nft_change_rcv) = mpsc::channel(NTF_CHANGES_NOTIFICATION_QUEUE_SIZE);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment: Manages event related to epochs changes and notifications (new epoch started, late data - epoch invalidation). Producers are processors (bubblegum and account), consumer - consistency calculator.

pub fn track_slot_counter(slot: u64) -> u64 {
let prev = LAST_SLOT.load(std::sync::atomic::Ordering::Relaxed);
if slot > prev {
LAST_SLOT.store(slot, std::sync::atomic::Ordering::Relaxed);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code does not guaranteed to store the top slot processed, rather one of the top slots. Please add a comment

checksum: Checksum::Calculating,
};

pub const ACC_BUCKET_INVALIDATE: AccountNftBucket = AccountNftBucket {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub const ACC_BUCKET_INVALIDATE: AccountNftBucket = AccountNftBucket {
pub const ACC_BUCKET_INVALIDATED: AccountNftBucket = AccountNftBucket {

checksum: Checksum::Invalidated,
};

pub const ACC_GRAND_BUCKET_INVALIDATE: AccountNftGrandBucket = AccountNftGrandBucket {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub const ACC_GRAND_BUCKET_INVALIDATE: AccountNftGrandBucket = AccountNftGrandBucket {
pub const ACC_GRAND_BUCKET_INVALIDATED: AccountNftGrandBucket = AccountNftGrandBucket {

});
if await_operation {
let _ = task
.await
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the tasked be always called if we don't await it?

NftChangesTracker { sender }
}

/// Persists given account NFT change into the sotrage, and, if the change is from the epoch
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Persists given account NFT change into the sotrage, and, if the change is from the epoch
/// Persists given account NFT change into the storage, and, if the change is from the epoch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants