-
Notifications
You must be signed in to change notification settings - Fork 12
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
Block building core #401
Block building core #401
Conversation
danielSanchezQ
commented
Sep 13, 2023
- Added transactions selections trait
- Added blob selection trait
- Implemented basic size filling tx selector
- Implemented basic size filling blob selector
- Implemented block builder with composing tx+blob selectors
Codecov ReportPatch has no changes to coverable lines. 📢 Thoughts on this report? Let us know!. |
nomos-core/src/block/builder.rs
Outdated
use serde::de::DeserializeOwned; | ||
use serde::Serialize; |
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: not std
use consensus_engine::overlay::RandomBeaconState; | ||
use consensus_engine::{NodeId, Qc, View}; | ||
|
||
pub struct BlockBuilder<Tx, Blob, TxSelector, BlobSelector> { |
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.
how would this be used? I think an example might help me understand
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.
I'm not really sure I understand exactly. But it is just a wrapper over the Block::new
that throws into the mix the transaction and blob selectors (Which should be some static heuristic).
Core is the build method:
Block::new(
view,
parent_qc,
tx_selector.select_tx_from(txs),
blob_selector.select_blob_from(blobs),
proposer,
beacon,
)
The idea is to just use it when the leader propose the block.
I had in mind that we could even have a service that handles the next block building depending on different events in the node:
- View change
- New tx arrived
- New blob arrived
- ...
So it always have something ready when needed.
But for now I think this is enough.
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.
how would this be used? I think an example might help me understand
I added an example to the builder, but I do not think that is what you reffered to, hence my answer above.
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.
👍
Co-authored-by: Youngjoon Lee <taxihighway@gmail.com>