refactor: bring cometbft back to v0.38.x family (#25285)

This commit is contained in:
Alex | Interchain Labs
2025-08-29 15:58:04 -04:00
committed by GitHub
parent a37940077e
commit 727faf0484
446 changed files with 15286 additions and 103152 deletions
@@ -7,8 +7,8 @@ import (
"strings"
"testing"
abci "github.com/cometbft/cometbft/v2/abci/types"
rpcclientmock "github.com/cometbft/cometbft/v2/rpc/client/mock"
abci "github.com/cometbft/cometbft/abci/types"
rpcclientmock "github.com/cometbft/cometbft/rpc/client/mock"
"github.com/stretchr/testify/suite"
"cosmossdk.io/core/address"
@@ -69,7 +69,7 @@ func (s *CLITestSuite) SetupSuite() {
ctxGen := func() client.Context {
bz, _ := s.encCfg.Codec.Marshal(&sdk.TxResponse{})
c := clitestutil.NewMockCometRPC(abci.QueryResponse{
c := clitestutil.NewMockCometRPC(abci.ResponseQuery{
Value: bz,
})
return s.baseCtx.WithClient(c)
@@ -3,7 +3,7 @@ package keeper_test
import (
"testing"
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v2"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/stretchr/testify/require"
"gotest.tools/v3/assert"
"pgregory.net/rapid"
@@ -5,8 +5,8 @@ import (
"fmt"
"testing"
types "github.com/cometbft/cometbft/api/cometbft/types/v2"
cmtabcitypes "github.com/cometbft/cometbft/v2/abci/types"
cmtabcitypes "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/stretchr/testify/require"
"gotest.tools/v3/assert"
@@ -7,8 +7,8 @@ import (
"testing"
"time"
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v2"
abci "github.com/cometbft/cometbft/v2/abci/types"
abci "github.com/cometbft/cometbft/abci/types"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"gotest.tools/v3/assert"
"cosmossdk.io/core/appmodule"
@@ -204,10 +204,10 @@ func TestHandleDoubleSign(t *testing.T) {
assert.NilError(t, err)
oldTokens := val.GetTokens()
nci := NewCometInfo(abci.FinalizeBlockRequest{
nci := NewCometInfo(abci.RequestFinalizeBlock{
Misbehavior: []abci.Misbehavior{{
Validator: abci.Validator{Address: valpubkey.Address(), Power: power},
Type: abci.MISBEHAVIOR_TYPE_DUPLICATE_VOTE,
Type: abci.MisbehaviorType_DUPLICATE_VOTE,
Time: time.Now().UTC(),
Height: 1,
}},
@@ -284,10 +284,10 @@ func TestHandleDoubleSign_TooOld(t *testing.T) {
assert.NilError(t, err)
assert.DeepEqual(t, amt, val.GetBondedTokens())
nci := NewCometInfo(abci.FinalizeBlockRequest{
nci := NewCometInfo(abci.RequestFinalizeBlock{
Misbehavior: []abci.Misbehavior{{
Validator: abci.Validator{Address: valpubkey.Address(), Power: power},
Type: abci.MISBEHAVIOR_TYPE_DUPLICATE_VOTE,
Type: abci.MisbehaviorType_DUPLICATE_VOTE,
Time: ctx.BlockTime(),
Height: 0,
}},
@@ -353,7 +353,7 @@ type CometService struct {
Evidence []abci.Misbehavior
}
func NewCometInfo(bg abci.FinalizeBlockRequest) comet.BlockInfo {
func NewCometInfo(bg abci.RequestFinalizeBlock) comet.BlockInfo {
return CometService{
Evidence: bg.Misbehavior,
}
+5 -5
View File
@@ -4,7 +4,7 @@ import (
"encoding/json"
"testing"
abci "github.com/cometbft/cometbft/v2/abci/types"
abci "github.com/cometbft/cometbft/abci/types"
dbm "github.com/cosmos/cosmos-db"
"gotest.tools/v3/assert"
@@ -75,7 +75,7 @@ func TestImportExportQueues(t *testing.T) {
ctx := s1.app.NewContext(false)
addrs := simtestutil.AddTestAddrs(s1.BankKeeper, s1.StakingKeeper, ctx, 1, valTokens)
_, err = s1.app.FinalizeBlock(&abci.FinalizeBlockRequest{
_, err = s1.app.FinalizeBlock(&abci.RequestFinalizeBlock{
Height: s1.app.LastBlockHeight() + 1,
})
assert.NilError(t, err)
@@ -140,7 +140,7 @@ func TestImportExportQueues(t *testing.T) {
assert.NilError(t, err)
_, err = s2.app.InitChain(
&abci.InitChainRequest{
&abci.RequestInitChain{
Validators: []abci.ValidatorUpdate{},
ConsensusParams: simtestutil.DefaultConsensusParams,
AppStateBytes: stateBytes,
@@ -148,12 +148,12 @@ func TestImportExportQueues(t *testing.T) {
)
assert.NilError(t, err)
_, err = s2.app.FinalizeBlock(&abci.FinalizeBlockRequest{
_, err = s2.app.FinalizeBlock(&abci.RequestFinalizeBlock{
Height: s2.app.LastBlockHeight() + 1,
})
assert.NilError(t, err)
_, err = s2.app.FinalizeBlock(&abci.FinalizeBlockRequest{
_, err = s2.app.FinalizeBlock(&abci.RequestFinalizeBlock{
Height: s2.app.LastBlockHeight() + 1,
})
assert.NilError(t, err)
+1 -1
View File
@@ -3,7 +3,7 @@ package keeper_test
import (
"testing"
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v2"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"gotest.tools/v3/assert"
"cosmossdk.io/core/appmodule"
@@ -4,7 +4,7 @@ import (
"testing"
"time"
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v2"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/stretchr/testify/require"
"gotest.tools/v3/assert"
@@ -4,7 +4,7 @@ import (
"math/big"
"testing"
cmtprototypes "github.com/cometbft/cometbft/api/cometbft/types/v2"
cmtprototypes "github.com/cometbft/cometbft/proto/tendermint/types"
"gotest.tools/v3/assert"
"cosmossdk.io/core/appmodule"
@@ -4,7 +4,7 @@ import (
"testing"
"time"
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v2"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"gotest.tools/v3/assert"
"pgregory.net/rapid"
@@ -4,7 +4,7 @@ import (
"fmt"
"testing"
abci "github.com/cometbft/cometbft/v2/abci/types"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/stretchr/testify/require"
"gotest.tools/v3/assert"
@@ -5,7 +5,7 @@ import (
"fmt"
"testing"
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v2"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"gotest.tools/v3/assert"
"cosmossdk.io/math"
@@ -4,7 +4,7 @@ import (
"testing"
"time"
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v2"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/stretchr/testify/require"
"gotest.tools/v3/assert"
@@ -4,7 +4,7 @@ import (
"fmt"
"testing"
abci "github.com/cometbft/cometbft/v2/abci/types"
abci "github.com/cometbft/cometbft/abci/types"
"gotest.tools/v3/assert"
"cosmossdk.io/math"
@@ -5,11 +5,10 @@ import (
"sort"
"testing"
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v2"
abci "github.com/cometbft/cometbft/v2/abci/types"
abci "github.com/cometbft/cometbft/abci/types"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
protoio "github.com/cosmos/gogoproto/io"
"github.com/cosmos/gogoproto/proto"
gogotypes "github.com/cosmos/gogoproto/types"
"gotest.tools/v3/assert"
"cosmossdk.io/core/comet"
@@ -36,7 +35,7 @@ func TestValidateVoteExtensions(t *testing.T) {
// enable vote extensions
cp := simtestutil.DefaultConsensusParams
cp.Feature = &cmtproto.FeatureParams{VoteExtensionsEnableHeight: &gogotypes.Int64Value{Value: 1}}
cp.Abci = &cmtproto.ABCIParams{VoteExtensionsEnableHeight: 1}
f.sdkCtx = f.sdkCtx.WithConsensusParams(*cp).WithHeaderInfo(header.Info{Height: 2, ChainID: chainID})
// setup the validators
@@ -4,8 +4,8 @@ import (
"fmt"
"testing"
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v2"
abci "github.com/cometbft/cometbft/v2/abci/types"
abci "github.com/cometbft/cometbft/abci/types"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
dbm "github.com/cosmos/cosmos-db"
"github.com/stretchr/testify/require"
"gotest.tools/v3/assert"
@@ -32,14 +32,14 @@ func TestRollback(t *testing.T) {
AppHash: app.LastCommitID().Hash,
}
_, err := app.FinalizeBlock(&abci.FinalizeBlockRequest{
_, err := app.FinalizeBlock(&abci.RequestFinalizeBlock{
Height: header.Height,
})
require.NoError(t, err)
ctx := app.NewContextLegacy(false, header)
store := ctx.KVStore(app.GetKey("bank"))
store.Set([]byte("key"), []byte(fmt.Sprintf("value%d", i)))
_, err = app.FinalizeBlock(&abci.FinalizeBlockRequest{
_, err = app.FinalizeBlock(&abci.RequestFinalizeBlock{
Height: header.Height,
})
require.NoError(t, err)
@@ -67,12 +67,12 @@ func TestRollback(t *testing.T) {
Height: ver0 + i,
AppHash: app.LastCommitID().Hash,
}
_, err := app.FinalizeBlock(&abci.FinalizeBlockRequest{Height: header.Height})
_, err := app.FinalizeBlock(&abci.RequestFinalizeBlock{Height: header.Height})
require.NoError(t, err)
ctx := app.NewContextLegacy(false, header)
store := ctx.KVStore(app.GetKey("bank"))
store.Set([]byte("key"), []byte(fmt.Sprintf("VALUE%d", i)))
_, err = app.FinalizeBlock(&abci.FinalizeBlockRequest{
_, err = app.FinalizeBlock(&abci.RequestFinalizeBlock{
Height: header.Height,
})
require.NoError(t, err)