-
Notifications
You must be signed in to change notification settings - Fork 0
Backpressure for private mempool & some refactorings #222
Conversation
.zed/settings.json
Outdated
// 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 |
There was a problem hiding this comment.
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,
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
src/builder_state.rs
Outdated
state_id.parent_commitment, | ||
builder_hash.clone(), | ||
requested_view_number, | ||
state_id.view, |
There was a problem hiding this comment.
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>>, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Display
implementation