chore: use comet api pkg instead of comet alias (#20614)
This commit is contained in:
+15
-14
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
abciproto "github.com/cometbft/cometbft/api/cometbft/abci/v1"
|
||||
|
||||
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
||||
)
|
||||
@@ -16,58 +17,58 @@ func NewCometABCIWrapper(app servertypes.ABCI) abci.Application {
|
||||
return cometABCIWrapper{app: app}
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) Info(_ context.Context, req *abci.InfoRequest) (*abci.InfoResponse, error) {
|
||||
func (w cometABCIWrapper) Info(_ context.Context, req *abciproto.InfoRequest) (*abciproto.InfoResponse, error) {
|
||||
return w.app.Info(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) Query(ctx context.Context, req *abci.QueryRequest) (*abci.QueryResponse, error) {
|
||||
func (w cometABCIWrapper) Query(ctx context.Context, req *abciproto.QueryRequest) (*abciproto.QueryResponse, error) {
|
||||
return w.app.Query(ctx, req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) CheckTx(_ context.Context, req *abci.CheckTxRequest) (*abci.CheckTxResponse, error) {
|
||||
func (w cometABCIWrapper) CheckTx(_ context.Context, req *abciproto.CheckTxRequest) (*abciproto.CheckTxResponse, error) {
|
||||
return w.app.CheckTx(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) InitChain(_ context.Context, req *abci.InitChainRequest) (*abci.InitChainResponse, error) {
|
||||
func (w cometABCIWrapper) InitChain(_ context.Context, req *abciproto.InitChainRequest) (*abciproto.InitChainResponse, error) {
|
||||
return w.app.InitChain(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) PrepareProposal(_ context.Context, req *abci.PrepareProposalRequest) (*abci.PrepareProposalResponse, error) {
|
||||
func (w cometABCIWrapper) PrepareProposal(_ context.Context, req *abciproto.PrepareProposalRequest) (*abciproto.PrepareProposalResponse, error) {
|
||||
return w.app.PrepareProposal(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) ProcessProposal(_ context.Context, req *abci.ProcessProposalRequest) (*abci.ProcessProposalResponse, error) {
|
||||
func (w cometABCIWrapper) ProcessProposal(_ context.Context, req *abciproto.ProcessProposalRequest) (*abciproto.ProcessProposalResponse, error) {
|
||||
return w.app.ProcessProposal(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) FinalizeBlock(_ context.Context, req *abci.FinalizeBlockRequest) (*abci.FinalizeBlockResponse, error) {
|
||||
func (w cometABCIWrapper) FinalizeBlock(_ context.Context, req *abciproto.FinalizeBlockRequest) (*abciproto.FinalizeBlockResponse, error) {
|
||||
return w.app.FinalizeBlock(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) ExtendVote(ctx context.Context, req *abci.ExtendVoteRequest) (*abci.ExtendVoteResponse, error) {
|
||||
func (w cometABCIWrapper) ExtendVote(ctx context.Context, req *abciproto.ExtendVoteRequest) (*abciproto.ExtendVoteResponse, error) {
|
||||
return w.app.ExtendVote(ctx, req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) VerifyVoteExtension(_ context.Context, req *abci.VerifyVoteExtensionRequest) (*abci.VerifyVoteExtensionResponse, error) {
|
||||
func (w cometABCIWrapper) VerifyVoteExtension(_ context.Context, req *abciproto.VerifyVoteExtensionRequest) (*abciproto.VerifyVoteExtensionResponse, error) {
|
||||
return w.app.VerifyVoteExtension(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) Commit(_ context.Context, _ *abci.CommitRequest) (*abci.CommitResponse, error) {
|
||||
func (w cometABCIWrapper) Commit(_ context.Context, _ *abciproto.CommitRequest) (*abciproto.CommitResponse, error) {
|
||||
return w.app.Commit()
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) ListSnapshots(_ context.Context, req *abci.ListSnapshotsRequest) (*abci.ListSnapshotsResponse, error) {
|
||||
func (w cometABCIWrapper) ListSnapshots(_ context.Context, req *abciproto.ListSnapshotsRequest) (*abciproto.ListSnapshotsResponse, error) {
|
||||
return w.app.ListSnapshots(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) OfferSnapshot(_ context.Context, req *abci.OfferSnapshotRequest) (*abci.OfferSnapshotResponse, error) {
|
||||
func (w cometABCIWrapper) OfferSnapshot(_ context.Context, req *abciproto.OfferSnapshotRequest) (*abciproto.OfferSnapshotResponse, error) {
|
||||
return w.app.OfferSnapshot(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) LoadSnapshotChunk(_ context.Context, req *abci.LoadSnapshotChunkRequest) (*abci.LoadSnapshotChunkResponse, error) {
|
||||
func (w cometABCIWrapper) LoadSnapshotChunk(_ context.Context, req *abciproto.LoadSnapshotChunkRequest) (*abciproto.LoadSnapshotChunkResponse, error) {
|
||||
return w.app.LoadSnapshotChunk(req)
|
||||
}
|
||||
|
||||
func (w cometABCIWrapper) ApplySnapshotChunk(_ context.Context, req *abci.ApplySnapshotChunkRequest) (*abci.ApplySnapshotChunkResponse, error) {
|
||||
func (w cometABCIWrapper) ApplySnapshotChunk(_ context.Context, req *abciproto.ApplySnapshotChunkRequest) (*abciproto.ApplySnapshotChunkResponse, error) {
|
||||
return w.app.ApplySnapshotChunk(req)
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
|
||||
db "github.com/cosmos/cosmos-db"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"cosmossdk.io/log"
|
||||
|
||||
@@ -3,7 +3,7 @@ package types
|
||||
import (
|
||||
"context"
|
||||
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
|
||||
)
|
||||
|
||||
// ABCI is an interface that enables any finite, deterministic state machine
|
||||
|
||||
+16
-15
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user