Skip to content

Commit 055683a

Browse files
authored
[Consensus] Remove non-decoupled execution and refactor for cleaner interfaces (aptos-labs#12104)
1 parent 3bef23f commit 055683a

39 files changed

+821
-777
lines changed

consensus/consensus-types/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ pub mod block_retrieval;
1010
pub mod common;
1111
pub mod delayed_qc_msg;
1212
pub mod epoch_retrieval;
13-
pub mod executed_block;
1413
pub mod pipeline;
14+
pub mod pipelined_block;
1515
pub mod proof_of_store;
1616
pub mod proposal_ext;
1717
pub mod proposal_msg;

consensus/consensus-types/src/executed_block.rs renamed to consensus/consensus-types/src/pipelined_block.rs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ use std::{
2020
time::{Duration, Instant},
2121
};
2222

23-
/// ExecutedBlocks are managed in a speculative tree, the committed blocks form a chain. Besides
24-
/// block data, each executed block also has other derived meta data which could be regenerated from
25-
/// blocks.
23+
/// A representation of a block that has been added to the execution pipeline. It might either be in ordered
24+
/// or in executed state. In the ordered state, the block is waiting to be executed. In the executed state,
25+
/// the block has been executed and the output is available.
2626
#[derive(Clone, Eq, PartialEq)]
27-
pub struct ExecutedBlock {
27+
pub struct PipelinedBlock {
2828
/// Block data that cannot be regenerated.
2929
block: Block,
3030
/// Input transactions in the order of execution
@@ -37,8 +37,8 @@ pub struct ExecutedBlock {
3737
pipeline_insertion_time: OnceCell<Instant>,
3838
}
3939

40-
impl ExecutedBlock {
41-
pub fn replace_result(
40+
impl PipelinedBlock {
41+
pub fn set_execution_result(
4242
mut self,
4343
input_transactions: Vec<SignedTransaction>,
4444
result: StateComputeResult,
@@ -57,19 +57,19 @@ impl ExecutedBlock {
5757
}
5858
}
5959

60-
impl Debug for ExecutedBlock {
60+
impl Debug for PipelinedBlock {
6161
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
6262
write!(f, "{}", self)
6363
}
6464
}
6565

66-
impl Display for ExecutedBlock {
66+
impl Display for PipelinedBlock {
6767
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
6868
write!(f, "{}", self.block())
6969
}
7070
}
7171

72-
impl ExecutedBlock {
72+
impl PipelinedBlock {
7373
pub fn new(
7474
block: Block,
7575
input_transactions: Vec<SignedTransaction>,
@@ -84,6 +84,16 @@ impl ExecutedBlock {
8484
}
8585
}
8686

87+
pub fn new_ordered(block: Block) -> Self {
88+
Self {
89+
block,
90+
input_transactions: vec![],
91+
state_compute_result: StateComputeResult::new_dummy(),
92+
randomness: OnceCell::new(),
93+
pipeline_insertion_time: OnceCell::new(),
94+
}
95+
}
96+
8797
pub fn block(&self) -> &Block {
8898
&self.block
8999
}
@@ -144,12 +154,12 @@ impl ExecutedBlock {
144154
)
145155
}
146156

147-
pub fn vote_proposal(&self, decoupled_execution: bool) -> VoteProposal {
157+
pub fn vote_proposal(&self) -> VoteProposal {
148158
VoteProposal::new(
149159
self.compute_result().extension_proof(),
150160
self.block.clone(),
151161
self.compute_result().epoch_state().clone(),
152-
decoupled_execution,
162+
true,
153163
)
154164
}
155165

0 commit comments

Comments
 (0)