-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[execution-pool] BlockRetrievalRequest struct -> enum #15812
Conversation
⏱️ 5h 6m total CI duration on this PR
|
d98225a
to
be5e4c3
Compare
be5e4c3
to
2c36388
Compare
pub struct BlockRetrievalRequestV2 { | ||
block_id: HashValue, | ||
num_blocks: u64, | ||
// TODO: remove the Option, if it's not too painful |
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.
Ah, two things I now remember thinking to clean up:
- Now that we're separating out the logic, can we remove the Option? It doesn't make sense to have a V2 request without the target
- Is epoch needed here?
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.
- Sounds good. For posterity in case we come back to this, the option and
(epoch, round)
was included from the original PR - Will remove epoch and Option
2c36388
to
902382e
Compare
consensus/src/epoch_manager.rs
Outdated
BlockRetrievalRequest::V1(v1) => v1, | ||
// TODO @bchocho @hariria implement after all nodes upgrade to release with enum BlockRetrievalRequest (not struct) | ||
BlockRetrievalRequest::V2(_) => { | ||
unimplemented!("Should not have received a BlockRetrievalRequestV2...") |
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 better to log error with sender.
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.
Changed to
bail!("Should not have received a BlockRetrievalRequestV2 {} from peer with id {}", v2, peer_id);
consensus/src/network.rs
Outdated
BlockRetrieval(IncomingBlockRetrievalRequest), | ||
/// NOTE: This is being phased out in two releases to accommodate `IncomingBlockRetrievalRequestV2` | ||
/// TODO @bchocho @hariria can remove after all nodes upgrade to release with enum BlockRetrievalRequest (not struct) | ||
DeprecatedBlockRetrieval(IncomingBlockRetrievalRequest), |
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 am wondering if we should append V0 to IncomingBlockRetrievalRequest
and make it IncomingBlockRetrievalRequestV0
. That way we can keep the new variant as BlockRetrieval
instead?
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.
Changed to
#[derive(Debug)]
pub enum IncomingRpcRequest {
/// NOTE: This is being phased out in two releases to accommodate `IncomingBlockRetrievalRequestV2`
/// TODO @bchocho @hariria can remove after all nodes upgrade to release with enum BlockRetrievalRequest (not struct)
DeprecatedBlockRetrieval(DeprecatedIncomingBlockRetrievalRequest),
BatchRetrieval(IncomingBatchRetrievalRequest),
DAGRequest(IncomingDAGRequest),
CommitRequest(IncomingCommitRequest),
RandGenRequest(IncomingRandGenRequest),
BlockRetrieval(IncomingBlockRetrievalRequest),
}
consensus/src/network_interface.rs
Outdated
@@ -83,14 +86,17 @@ pub enum ConsensusMsg { | |||
OrderVoteMsg(Box<OrderVoteMsg>), | |||
/// RoundTimeoutMsg is broadcasted by a validator once it decides to timeout the current round. | |||
RoundTimeoutMsg(Box<RoundTimeoutMsg>), | |||
/// RPC to get a chain of block of the given length starting from the given block id, using epoch and round. | |||
BlockRetrievalRequestV2(Box<BlockRetrievalRequest>), |
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.
Same as for RPC request. V0 for the original variant and drop the V2 for the new variant?
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.
Changed to
/// Network type for consensus
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum ConsensusMsg {
/// DEPRECATED: Please use [`ConsensusMsg::BlockRetrievalRequest`](ConsensusMsg::BlockRetrievalRequest) going forward
/// This variant was renamed from `BlockRetrievalRequest` to `DeprecatedBlockRetrievalRequest`
/// RPC to get a chain of block of the given length starting from the given block id.
/// Note: Naming here is `BlockRetrievalRequest` and not `DeprecatedBlockRetrievalRequest`
/// to be consistent with the naming implementation in [`ConsensusMsg::name`](ConsensusMsg::name)
DeprecatedBlockRetrievalRequest(Box<BlockRetrievalRequestV1>),
...
/// RPC to get a chain of block of the given length starting from the given block id, using epoch and round.
BlockRetrievalRequest(Box<BlockRetrievalRequest>),
}
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
d3516c9
to
ca4499f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
As discussed offline, let's implement process_block_retrieval_v2 in the next PR.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
consensus/src/epoch_manager.rs
Outdated
continue; | ||
} | ||
if let Err(e) = monitor!( | ||
"process_block_retrieval", |
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.
Change to process_block_retrieval_v2
so we can see the change in metrics while rolling out
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.
Done!
8389258
to
6bd46ac
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
Description
Deprecates the
BlockRetrievalRequest
struct in favor of aBlockRetrievalRequest
enum. This is needed as execution pool plans to makeBlockRetrievalRequest
s that include epoch and round information instead oftarget_block_id
.The plan is to phase this in three releases. The first release will introduce the new
BlockRetrievalRequest
enum and all corresponding structs / logic that use it. The second release will deprecate theBlockRetrievalRequestV1
struct and all related structs / logic.Important
Some TODOs around deprecation are already marked in the code. Additional TODO in future PRs:
process_block_retrieval_v2
to be implemented in a future PR cc @bchocho @haririaBlockRetrievalRequest
enum is in the mainnet release,request_block
should sendConsensusMsg::BlockRetrievalRequest
instead ofConsensusMsg::DeprecatedBlockRetrievalRequest
Additional Questions
consensus.yaml
requireTUPLEARRAY
instead ofTUPLE
?How Has This Been Tested?