@@ -7,7 +7,7 @@ use std::{
77 pin:: Pin ,
88 task:: { Context , Poll } ,
99} ;
10- use tendermint:: abci:: { request, response, Request , Response } ;
10+ use tendermint:: v0_38 :: abci:: { request, response, Request , Response } ;
1111use tower:: Service ;
1212use tower_abci:: BoxError ;
1313
@@ -81,19 +81,33 @@ pub trait Application {
8181 Ok ( response:: ProcessProposal :: Accept )
8282 }
8383
84- /// Signals the beginning of a new block, prior to any `DeliverTx` calls.
85- async fn begin_block ( & self , request : request:: BeginBlock ) -> AbciResult < response:: BeginBlock > {
86- Ok ( Default :: default ( ) )
84+ /// Opportunity for the application to add arbitrary extension data to precommit votes.
85+ async fn extend_vote ( & self , _request : request:: ExtendVote ) -> AbciResult < response:: ExtendVote > {
86+ Ok ( response:: ExtendVote {
87+ vote_extension : bytes:: Bytes :: new ( ) ,
88+ } )
8789 }
8890
89- /// Apply a transaction to the application's state.
90- async fn deliver_tx ( & self , request : request:: DeliverTx ) -> AbciResult < response:: DeliverTx > {
91- Ok ( Default :: default ( ) )
91+ /// Verify vote extensions from peer validators.
92+ async fn verify_vote_extension (
93+ & self ,
94+ _request : request:: VerifyVoteExtension ,
95+ ) -> AbciResult < response:: VerifyVoteExtension > {
96+ Ok ( response:: VerifyVoteExtension :: Accept )
9297 }
9398
94- /// Signals the end of a block.
95- async fn end_block ( & self , request : request:: EndBlock ) -> AbciResult < response:: EndBlock > {
96- Ok ( Default :: default ( ) )
99+ /// Execute and finalize an entire block.
100+ async fn finalize_block (
101+ & self ,
102+ _request : request:: FinalizeBlock ,
103+ ) -> AbciResult < response:: FinalizeBlock > {
104+ Ok ( response:: FinalizeBlock {
105+ events : Vec :: new ( ) ,
106+ tx_results : Vec :: new ( ) ,
107+ validator_updates : Vec :: new ( ) ,
108+ consensus_param_updates : None ,
109+ app_hash : tendermint:: AppHash :: default ( ) ,
110+ } )
97111 }
98112
99113 /// Commit the current state at the current height.
@@ -174,11 +188,15 @@ where
174188 Request :: ProcessProposal ( r) => {
175189 Response :: ProcessProposal ( log_error ( app. process_proposal ( r) . await ) ?)
176190 }
177- Request :: BeginBlock ( r) => {
178- Response :: BeginBlock ( log_error ( app. begin_block ( r) . await ) ?)
191+ Request :: ExtendVote ( r) => {
192+ Response :: ExtendVote ( log_error ( app. extend_vote ( r) . await ) ?)
193+ }
194+ Request :: VerifyVoteExtension ( r) => {
195+ Response :: VerifyVoteExtension ( log_error ( app. verify_vote_extension ( r) . await ) ?)
196+ }
197+ Request :: FinalizeBlock ( r) => {
198+ Response :: FinalizeBlock ( log_error ( app. finalize_block ( r) . await ) ?)
179199 }
180- Request :: DeliverTx ( r) => Response :: DeliverTx ( log_error ( app. deliver_tx ( r) . await ) ?) ,
181- Request :: EndBlock ( r) => Response :: EndBlock ( log_error ( app. end_block ( r) . await ) ?) ,
182200 Request :: Commit => Response :: Commit ( log_error ( app. commit ( ) . await ) ?) ,
183201 Request :: ListSnapshots => {
184202 Response :: ListSnapshots ( log_error ( app. list_snapshots ( ) . await ) ?)
@@ -192,7 +210,8 @@ where
192210 Request :: ApplySnapshotChunk ( r) => {
193211 Response :: ApplySnapshotChunk ( log_error ( app. apply_snapshot_chunk ( r) . await ) ?)
194212 }
195- Request :: Flush => panic ! ( "Flush should be handled by the Server!" ) ,
213+ // Some clients still send explicit Flush requests; never panic on protocol input.
214+ Request :: Flush => Response :: Flush ,
196215 } ;
197216 Ok ( res)
198217 } ;
0 commit comments