Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

Backpressure for private mempool & some refactorings #222

Merged
merged 8 commits into from
Jul 31, 2024
Merged

Conversation

QuentinI
Copy link
Contributor

@QuentinI QuentinI commented Jul 26, 2024

  • Return errors on HTTP API when we can't handle transactions
  • Don't store unbounded amount of built blocks
  • Move from (VidCommitment, View) and (BuilderCommitment, View) tuples to dedicated structs with clear name and Display implementation

Comment on lines 1 to 4
// Folder-specific settings
//
// For a full list of overridable settings, and general information on folder-specific settings,
// see the documentation: https://zed.dev/docs/configuring-zed#folder-specific-settings
Copy link
Member

Choose a reason for hiding this comment

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

Probably due to commenting in JSON, these lines are displayed with a red background for me,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, this wasn't even supposed to end up here, I forgot to add it to excludes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

Comment on lines 507 to 509
state_id.parent_commitment,
builder_hash.clone(),
requested_view_number,
state_id.view,
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Since we now have the BuilderStateId type that contains the parent commitment and view number, can we update builder_commitments to also just use BuilderStateId rather than the two fields separately?

@@ -108,18 +116,14 @@ pub struct ReceivedTransaction<Types: NodeType> {
#[derive(Debug)]
pub struct GlobalState<Types: NodeType> {
// data store for the blocks
pub block_hash_to_block: HashMap<(BuilderCommitment, Types::Time), BlockInfo<Types>>,
pub blocks: lru::LruCache<BlockId<Types>, BlockInfo<Types>>,
Copy link
Member

Choose a reason for hiding this comment

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

Am I correctly understanding that we replace HashMap with LruCache here to retrieve blocks ordered by visit frequencies? E.g., we call promote in update_global_state which wasn't supported before.

However, I don't quite understand why we need LruCache for this purpose. If we want to prevent returning duplicate blocks, can't we just call remove on a HashMap? Maybe I'm missing some more complicated use cases.

Copy link
Contributor Author

@QuentinI QuentinI Jul 29, 2024

Choose a reason for hiding this comment

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

It's not really used as a cache here. The reason I've replaced it is that there wasn't any sort of GC process for built blocks, so I'm just using it to forget old blocks, as it has a fixed capacity and pops least used blocks when full.
We can't just forget blocks when they are claimed, because there's no guarantee a block will be claimed at all.

@QuentinI QuentinI merged commit 5643cd6 into main Jul 31, 2024
5 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants