feat!: Comet v0.38 Integration (#15519)
Co-authored-by: marbar3778 <marbar3778@yahoo.com> Co-authored-by: cool-developer <51834436+cool-develope@users.noreply.github.com> Co-authored-by: Aaron Craelius <aaron@regen.network> Co-authored-by: Matt Kocubinski <mkocubinski@gmail.com> Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
co-authored by
marbar3778
cool-developer
Aaron Craelius
Matt Kocubinski
Julien Robert
parent
166be3766b
commit
6cee22df52
@@ -24,7 +24,7 @@ var (
|
||||
)
|
||||
|
||||
type (
|
||||
abciQueryFn = func(abci.RequestQuery) abci.ResponseQuery
|
||||
abciQueryFn = func(context.Context, *abci.RequestQuery) (*abci.ResponseQuery, error)
|
||||
|
||||
queryServer struct {
|
||||
clientCtx client.Context
|
||||
@@ -218,7 +218,7 @@ func (s queryServer) GetNodeInfo(ctx context.Context, _ *GetNodeInfoRequest) (*G
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
func (s queryServer) ABCIQuery(_ context.Context, req *ABCIQueryRequest) (*ABCIQueryResponse, error) {
|
||||
func (s queryServer) ABCIQuery(ctx context.Context, req *ABCIQueryRequest) (*ABCIQueryResponse, error) {
|
||||
if s.queryFn == nil {
|
||||
return nil, status.Error(codes.Internal, "ABCI Query handler undefined")
|
||||
}
|
||||
@@ -241,7 +241,10 @@ func (s queryServer) ABCIQuery(_ context.Context, req *ABCIQueryRequest) (*ABCIQ
|
||||
}
|
||||
}
|
||||
|
||||
res := s.queryFn(req.ToABCIRequestQuery())
|
||||
res, err := s.queryFn(ctx, req.ToABCIRequestQuery())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return FromABCIResponseQuery(res), nil
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
|
||||
// ToABCIRequestQuery converts a gRPC ABCIQueryRequest type to an ABCI
|
||||
// RequestQuery type.
|
||||
func (req *ABCIQueryRequest) ToABCIRequestQuery() abci.RequestQuery {
|
||||
return abci.RequestQuery{
|
||||
func (req *ABCIQueryRequest) ToABCIRequestQuery() *abci.RequestQuery {
|
||||
return &abci.RequestQuery{
|
||||
Data: req.Data,
|
||||
Path: req.Path,
|
||||
Height: req.Height,
|
||||
@@ -17,7 +17,7 @@ func (req *ABCIQueryRequest) ToABCIRequestQuery() abci.RequestQuery {
|
||||
|
||||
// FromABCIResponseQuery converts an ABCI ResponseQuery type to a gRPC
|
||||
// ABCIQueryResponse type.
|
||||
func FromABCIResponseQuery(res abci.ResponseQuery) *ABCIQueryResponse {
|
||||
func FromABCIResponseQuery(res *abci.ResponseQuery) *ABCIQueryResponse {
|
||||
var proofOps *ProofOps
|
||||
|
||||
if res.ProofOps != nil {
|
||||
|
||||
@@ -83,21 +83,18 @@ func (s *IntegrationTestSuite) SetupSuite() {
|
||||
s.NoError(err)
|
||||
|
||||
// init chain will set the validator set and initialize the genesis accounts
|
||||
app.InitChain(
|
||||
abci.RequestInitChain{
|
||||
Validators: []abci.ValidatorUpdate{},
|
||||
ConsensusParams: sims.DefaultConsensusParams,
|
||||
AppStateBytes: stateBytes,
|
||||
},
|
||||
app.InitChain(&abci.RequestInitChain{
|
||||
Validators: []abci.ValidatorUpdate{},
|
||||
ConsensusParams: sims.DefaultConsensusParams,
|
||||
AppStateBytes: stateBytes,
|
||||
},
|
||||
)
|
||||
|
||||
app.Commit()
|
||||
app.BeginBlock(abci.RequestBeginBlock{Header: cmtproto.Header{
|
||||
app.FinalizeBlock(&abci.RequestFinalizeBlock{
|
||||
Height: app.LastBlockHeight() + 1,
|
||||
AppHash: app.LastCommitID().Hash,
|
||||
ValidatorsHash: valSet.Hash(),
|
||||
Hash: app.LastCommitID().Hash,
|
||||
NextValidatorsHash: valSet.Hash(),
|
||||
}})
|
||||
})
|
||||
|
||||
// end of app init
|
||||
|
||||
|
||||
Reference in New Issue
Block a user