@@ -928,9 +928,9 @@ impl Worker {
928
928
929
929
let height = proposal. number ( ) as Height ;
930
930
let seal_view = TendermintSealView :: new ( proposal. seal ( ) ) ;
931
- let prev_block_view = seal_view. previous_block_view ( ) . expect ( "The proposal is verified" ) ;
931
+ let parent_block_finalized_view = seal_view. parent_block_finalized_view ( ) . expect ( "The proposal is verified" ) ;
932
932
let on = VoteOn {
933
- step : VoteStep :: new ( height - 1 , prev_block_view , Step :: Precommit ) ,
933
+ step : VoteStep :: new ( height - 1 , parent_block_finalized_view , Step :: Precommit ) ,
934
934
block_hash : Some ( * proposal. parent_hash ( ) ) ,
935
935
} ;
936
936
for ( index, signature) in seal_view. signatures ( ) . expect ( "The proposal is verified" ) {
@@ -990,7 +990,7 @@ impl Worker {
990
990
} ;
991
991
} else if current_height < height {
992
992
let finalized_view_of_previous_height =
993
- TendermintSealView :: new ( proposal. seal ( ) ) . previous_block_view ( ) . unwrap ( ) ;
993
+ TendermintSealView :: new ( proposal. seal ( ) ) . parent_block_finalized_view ( ) . unwrap ( ) ;
994
994
995
995
self . jump_to_height ( height, finalized_view_of_previous_height) ;
996
996
@@ -1095,16 +1095,15 @@ impl Worker {
1095
1095
fn proposal_generated ( & mut self , sealed_block : & SealedBlock ) {
1096
1096
let proposal_height = sealed_block. header ( ) . number ( ) ;
1097
1097
let proposal_seal = sealed_block. header ( ) . seal ( ) ;
1098
- let proposal_view = TendermintSealView :: new ( proposal_seal)
1099
- . consensus_view ( )
1100
- . expect ( "Generated proposal should have a valid seal" ) ;
1098
+ let proposal_author_view =
1099
+ TendermintSealView :: new ( proposal_seal) . author_view ( ) . expect ( "Generated proposal should have a valid seal" ) ;
1101
1100
assert ! ( proposal_height <= self . height, "A proposal cannot be generated on the future height" ) ;
1102
- if proposal_height < self . height || ( proposal_height == self . height && proposal_view != self . view ) {
1101
+ if proposal_height < self . height || ( proposal_height == self . height && proposal_author_view != self . view ) {
1103
1102
ctrace ! (
1104
1103
ENGINE ,
1105
1104
"Proposal is generated on the height {} and view {}. Current height is {} and view is {}" ,
1106
1105
proposal_height,
1107
- proposal_view ,
1106
+ proposal_author_view ,
1108
1107
self . height,
1109
1108
self . view,
1110
1109
) ;
@@ -1131,7 +1130,7 @@ impl Worker {
1131
1130
) ;
1132
1131
return
1133
1132
}
1134
- debug_assert_eq ! ( Ok ( self . view) , TendermintSealView :: new( header. seal( ) ) . consensus_view ( ) ) ;
1133
+ debug_assert_eq ! ( Ok ( self . view) , TendermintSealView :: new( header. seal( ) ) . author_view ( ) ) ;
1135
1134
1136
1135
self . vote_on_header_for_proposal ( & header) . expect ( "I'm a proposer" ) ;
1137
1136
@@ -1152,8 +1151,8 @@ impl Worker {
1152
1151
}
1153
1152
1154
1153
let height = header. number ( ) ;
1155
- let view = TendermintSealView :: new ( header. seal ( ) ) . consensus_view ( ) . unwrap ( ) ;
1156
- let score = calculate_score ( height, view ) ;
1154
+ let author_view = TendermintSealView :: new ( header. seal ( ) ) . author_view ( ) . unwrap ( ) ;
1155
+ let score = calculate_score ( height, author_view ) ;
1157
1156
1158
1157
if * header. score ( ) != score {
1159
1158
return Err ( BlockError :: InvalidScore ( Mismatch {
@@ -1168,13 +1167,13 @@ impl Worker {
1168
1167
1169
1168
fn verify_block_external ( & self , header : & Header ) -> Result < ( ) , Error > {
1170
1169
let height = header. number ( ) as usize ;
1171
- let view = TendermintSealView :: new ( header. seal ( ) ) . consensus_view ( ) ?;
1172
- ctrace ! ( ENGINE , "Verify external at {}-{}, {:?}" , height, view , header) ;
1170
+ let author_view = TendermintSealView :: new ( header. seal ( ) ) . author_view ( ) ?;
1171
+ ctrace ! ( ENGINE , "Verify external at {}-{}, {:?}" , height, author_view , header) ;
1173
1172
let proposer = header. author ( ) ;
1174
1173
if !self . is_authority ( header. parent_hash ( ) , proposer) {
1175
1174
return Err ( EngineError :: BlockNotAuthorized ( * proposer) . into ( ) )
1176
1175
}
1177
- self . check_view_proposer ( header. parent_hash ( ) , header. number ( ) , view , & proposer) ?;
1176
+ self . check_view_proposer ( header. parent_hash ( ) , header. number ( ) , author_view , & proposer) ?;
1178
1177
let seal_view = TendermintSealView :: new ( header. seal ( ) ) ;
1179
1178
let bitset_count = seal_view. bitset ( ) ?. count ( ) ;
1180
1179
let precommits_count = seal_view. precommits ( ) . item_count ( ) ?;
@@ -1197,9 +1196,9 @@ impl Worker {
1197
1196
return Err ( BlockError :: InvalidSeal . into ( ) )
1198
1197
}
1199
1198
1200
- let previous_block_view = TendermintSealView :: new ( header. seal ( ) ) . previous_block_view ( ) ?;
1199
+ let parent_block_finalized_view = TendermintSealView :: new ( header. seal ( ) ) . parent_block_finalized_view ( ) ?;
1201
1200
let precommit_vote_on = VoteOn {
1202
- step : VoteStep :: new ( header. number ( ) - 1 , previous_block_view , Step :: Precommit ) ,
1201
+ step : VoteStep :: new ( header. number ( ) - 1 , parent_block_finalized_view , Step :: Precommit ) ,
1203
1202
block_hash : Some ( * header. parent_hash ( ) ) ,
1204
1203
} ;
1205
1204
@@ -1642,7 +1641,7 @@ impl Worker {
1642
1641
if self . height < header. number ( ) {
1643
1642
cinfo ! ( ENGINE , "Received a commit: {:?}." , header. number( ) ) ;
1644
1643
let finalized_view_of_previous_height = TendermintSealView :: new ( full_header. seal ( ) )
1645
- . previous_block_view ( )
1644
+ . parent_block_finalized_view ( )
1646
1645
. expect ( "Imported block already checked" ) ;
1647
1646
self . jump_to_height ( header. number ( ) , finalized_view_of_previous_height) ;
1648
1647
}
@@ -1791,15 +1790,14 @@ impl Worker {
1791
1790
// The proposer re-proposed its locked proposal.
1792
1791
// If we already imported the proposal, we should set `proposal` here.
1793
1792
if c. block ( & BlockId :: Hash ( header_view. hash ( ) ) ) . is_some ( ) {
1794
- let generated_view = TendermintSealView :: new ( header_view. seal ( ) )
1795
- . consensus_view ( )
1796
- . expect ( "Imported block is verified" ) ;
1793
+ let author_view =
1794
+ TendermintSealView :: new ( header_view. seal ( ) ) . author_view ( ) . expect ( "Imported block is verified" ) ;
1797
1795
cdebug ! (
1798
1796
ENGINE ,
1799
1797
"Received a proposal({}) by a locked proposer. current view: {}, original proposal's view: {}" ,
1800
1798
header_view. hash( ) ,
1801
1799
proposed_view,
1802
- generated_view
1800
+ author_view
1803
1801
) ;
1804
1802
self . proposal = Proposal :: new_imported ( header_view. hash ( ) ) ;
1805
1803
} else {
@@ -1975,13 +1973,14 @@ impl Worker {
1975
1973
let block = self . client ( ) . block ( & height. into ( ) ) . expect ( "Parent block should exist" ) ;
1976
1974
let block_hash = block. hash ( ) ;
1977
1975
let seal = block. seal ( ) ;
1978
- let view = TendermintSealView :: new ( & seal) . consensus_view ( ) . expect ( "Block is already verified and imported" ) ;
1976
+ let author_view =
1977
+ TendermintSealView :: new ( & seal) . author_view ( ) . expect ( "Block is already verified and imported" ) ;
1979
1978
1980
1979
let votes = self
1981
1980
. votes
1982
1981
. get_all_votes_in_round ( & VoteStep {
1983
1982
height,
1984
- view,
1983
+ view : author_view ,
1985
1984
step : Step :: Precommit ,
1986
1985
} )
1987
1986
. into_iter ( )
@@ -1994,9 +1993,10 @@ impl Worker {
1994
1993
let child_block = self . client ( ) . block ( & ( height + 1 ) . into ( ) ) . expect ( "Parent block should exist" ) ;
1995
1994
let child_block_header_seal = child_block. header ( ) . seal ( ) ;
1996
1995
let child_block_seal_view = TendermintSealView :: new ( & child_block_header_seal) ;
1997
- let view = child_block_seal_view. previous_block_view ( ) . expect ( "Verified block" ) ;
1996
+ let parent_block_finalized_view =
1997
+ child_block_seal_view. parent_block_finalized_view ( ) . expect ( "Verified block" ) ;
1998
1998
let on = VoteOn {
1999
- step : VoteStep :: new ( height, view , Step :: Precommit ) ,
1999
+ step : VoteStep :: new ( height, parent_block_finalized_view , Step :: Precommit ) ,
2000
2000
block_hash : Some ( block. hash ( ) ) ,
2001
2001
} ;
2002
2002
let mut votes = Vec :: new ( ) ;
0 commit comments