chore: use comet api pkg instead of comet alias (#20614)

This commit is contained in:
Marko
2024-06-11 08:46:04 +00:00
committed by GitHub
parent 9e1d28e2a6
commit 28fa3b8dfc
86 changed files with 130 additions and 130 deletions
+16 -15
View File
@@ -7,6 +7,7 @@ import (
"sync/atomic"
abci "github.com/cometbft/cometbft/abci/types"
abciproto "github.com/cometbft/cometbft/api/cometbft/abci/v1"
coreappmgr "cosmossdk.io/core/app"
"cosmossdk.io/core/comet"
@@ -125,7 +126,7 @@ type BlockData struct {
// CheckTx implements types.Application.
// It is called by cometbft to verify transaction validity
func (c *Consensus[T]) CheckTx(ctx context.Context, req *abci.CheckTxRequest) (*abci.CheckTxResponse, error) {
func (c *Consensus[T]) CheckTx(ctx context.Context, req *abciproto.CheckTxRequest) (*abciproto.CheckTxResponse, error) {
decodedTx, err := c.txCodec.Decode(req.Tx)
if err != nil {
return nil, err
@@ -154,7 +155,7 @@ func (c *Consensus[T]) CheckTx(ctx context.Context, req *abci.CheckTxRequest) (*
}
// Info implements types.Application.
func (c *Consensus[T]) Info(ctx context.Context, _ *abci.InfoRequest) (*abci.InfoResponse, error) {
func (c *Consensus[T]) Info(ctx context.Context, _ *abciproto.InfoRequest) (*abciproto.InfoResponse, error) {
version, _, err := c.store.StateLatest()
if err != nil {
return nil, err
@@ -182,7 +183,7 @@ func (c *Consensus[T]) Info(ctx context.Context, _ *abci.InfoRequest) (*abci.Inf
// Query implements types.Application.
// It is called by cometbft to query application state.
func (c *Consensus[T]) Query(ctx context.Context, req *abci.QueryRequest) (*abci.QueryResponse, error) {
func (c *Consensus[T]) Query(ctx context.Context, req *abciproto.QueryRequest) (*abciproto.QueryResponse, error) {
// follow the query path from here
decodedMsg, err := c.txCodec.Decode(req.Data)
protoMsg, ok := any(decodedMsg).(transaction.Msg)
@@ -208,7 +209,7 @@ func (c *Consensus[T]) Query(ctx context.Context, req *abci.QueryRequest) (*abci
return QueryResult(errorsmod.Wrap(cometerrors.ErrUnknownRequest, "no query path provided"), c.cfg.Trace), nil
}
var resp *abci.QueryResponse
var resp *abciproto.QueryResponse
switch path[0] {
case QueryPathApp:
@@ -232,7 +233,7 @@ func (c *Consensus[T]) Query(ctx context.Context, req *abci.QueryRequest) (*abci
}
// InitChain implements types.Application.
func (c *Consensus[T]) InitChain(ctx context.Context, req *abci.InitChainRequest) (*abci.InitChainResponse, error) {
func (c *Consensus[T]) InitChain(ctx context.Context, req *abciproto.InitChainRequest) (*abciproto.InitChainResponse, error) {
c.logger.Info("InitChain", "initialHeight", req.InitialHeight, "chainID", req.ChainId)
// store chainID to be used later on in execution
@@ -304,8 +305,8 @@ func (c *Consensus[T]) InitChain(ctx context.Context, req *abci.InitChainRequest
// It is called by cometbft to prepare a proposal block.
func (c *Consensus[T]) PrepareProposal(
ctx context.Context,
req *abci.PrepareProposalRequest,
) (resp *abci.PrepareProposalResponse, err error) {
req *abciproto.PrepareProposalRequest,
) (resp *abciproto.PrepareProposalResponse, err error) {
if req.Height < 1 {
return nil, errors.New("PrepareProposal called with invalid height")
}
@@ -347,8 +348,8 @@ func (c *Consensus[T]) PrepareProposal(
// It is called by cometbft to process/verify a proposal block.
func (c *Consensus[T]) ProcessProposal(
ctx context.Context,
req *abci.ProcessProposalRequest,
) (*abci.ProcessProposalResponse, error) {
req *abciproto.ProcessProposalRequest,
) (*abciproto.ProcessProposalResponse, error) {
decodedTxs := make([]T, len(req.Txs))
for _, tx := range req.Txs {
decTx, err := c.txCodec.Decode(tx)
@@ -384,8 +385,8 @@ func (c *Consensus[T]) ProcessProposal(
// It is called by cometbft to finalize a block.
func (c *Consensus[T]) FinalizeBlock(
ctx context.Context,
req *abci.FinalizeBlockRequest,
) (*abci.FinalizeBlockResponse, error) {
req *abciproto.FinalizeBlockRequest,
) (*abciproto.FinalizeBlockResponse, error) {
if err := c.validateFinalizeBlockHeight(req); err != nil {
return nil, err
}
@@ -494,7 +495,7 @@ func (c *Consensus[T]) FinalizeBlock(
// Commit implements types.Application.
// It is called by cometbft to notify the application that a block was committed.
func (c *Consensus[T]) Commit(ctx context.Context, _ *abci.CommitRequest) (*abci.CommitResponse, error) {
func (c *Consensus[T]) Commit(ctx context.Context, _ *abciproto.CommitRequest) (*abciproto.CommitResponse, error) {
lastCommittedBlock := c.lastCommittedBlock.Load()
c.snapshotManager.SnapshotIfApplicable(lastCommittedBlock.Height)
@@ -513,8 +514,8 @@ func (c *Consensus[T]) Commit(ctx context.Context, _ *abci.CommitRequest) (*abci
// VerifyVoteExtension implements types.Application.
func (c *Consensus[T]) VerifyVoteExtension(
ctx context.Context,
req *abci.VerifyVoteExtensionRequest,
) (*abci.VerifyVoteExtensionResponse, error) {
req *abciproto.VerifyVoteExtensionRequest,
) (*abciproto.VerifyVoteExtensionResponse, error) {
// If vote extensions are not enabled, as a safety precaution, we return an
// error.
cp, err := c.GetConsensusParams(ctx)
@@ -548,7 +549,7 @@ func (c *Consensus[T]) VerifyVoteExtension(
}
// ExtendVote implements types.Application.
func (c *Consensus[T]) ExtendVote(ctx context.Context, req *abci.ExtendVoteRequest) (*abci.ExtendVoteResponse, error) {
func (c *Consensus[T]) ExtendVote(ctx context.Context, req *abciproto.ExtendVoteRequest) (*abciproto.ExtendVoteResponse, error) {
// If vote extensions are not enabled, as a safety precaution, we return an
// error.
cp, err := c.GetConsensusParams(ctx)
@@ -5,7 +5,7 @@ import (
"fmt"
"strings"
abci "github.com/cometbft/cometbft/abci/types"
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
coretypes "github.com/cometbft/cometbft/rpc/core/types"
gogogrpc "github.com/cosmos/gogoproto/grpc"
"github.com/grpc-ecosystem/grpc-gateway/runtime"
@@ -1,7 +1,7 @@
package cmtservice
import (
abci "github.com/cometbft/cometbft/abci/types"
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
)
// ToABCIRequestQuery converts a gRPC ABCIQueryRequest type to an ABCI
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"errors"
"fmt"
abci "github.com/cometbft/cometbft/abci/types"
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
"github.com/cosmos/gogoproto/proto"
consensusv1 "cosmossdk.io/api/cosmos/consensus/v1"
+1 -1
View File
@@ -3,7 +3,7 @@ package handlers
import (
"context"
abci "github.com/cometbft/cometbft/abci/types"
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
"github.com/cosmos/gogoproto/proto"
"cosmossdk.io/core/store"
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"context"
"strings"
abci "github.com/cometbft/cometbft/abci/types"
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
crypto "github.com/cometbft/cometbft/api/cometbft/crypto/v1"
errorsmod "cosmossdk.io/errors"
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"os"
"path/filepath"
abci "github.com/cometbft/cometbft/abci/types"
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
"github.com/cosmos/gogoproto/proto"
"cosmossdk.io/store/v2/snapshots"
+1 -1
View File
@@ -1,6 +1,6 @@
package types
import abci "github.com/cometbft/cometbft/abci/types"
import abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
// PeerFilter responds to p2p filtering queries from Tendermint
type PeerFilter func(info string) (*abci.QueryResponse, error)
+1 -1
View File
@@ -3,7 +3,7 @@ package types
import (
"context"
abci "github.com/cometbft/cometbft/abci/types"
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
)
// VoteExtensionsHandler defines how to implement vote extension handlers
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"time"
abciv1 "buf.build/gen/go/cometbft/cometbft/protocolbuffers/go/cometbft/abci/v1"
abci "github.com/cometbft/cometbft/abci/types"
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
gogoproto "github.com/cosmos/gogoproto/proto"
gogoany "github.com/cosmos/gogoproto/types/any"