feat: Update Cosmos SDK to CometBFT v2 (#24837)
Co-authored-by: aljo242 <alex@interchainlabs.io>
This commit is contained in:
co-authored by
aljo242
parent
b78a6c660e
commit
fd170b5140
@@ -3,12 +3,12 @@ package cli
|
||||
import (
|
||||
"context"
|
||||
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
cmtbytes "github.com/cometbft/cometbft/libs/bytes"
|
||||
rpcclient "github.com/cometbft/cometbft/rpc/client"
|
||||
rpcclientmock "github.com/cometbft/cometbft/rpc/client/mock"
|
||||
coretypes "github.com/cometbft/cometbft/rpc/core/types"
|
||||
cmttypes "github.com/cometbft/cometbft/types"
|
||||
abci "github.com/cometbft/cometbft/v2/abci/types"
|
||||
cmtbytes "github.com/cometbft/cometbft/v2/libs/bytes"
|
||||
rpcclient "github.com/cometbft/cometbft/v2/rpc/client"
|
||||
rpcclientmock "github.com/cometbft/cometbft/v2/rpc/client/mock"
|
||||
coretypes "github.com/cometbft/cometbft/v2/rpc/core/types"
|
||||
cmttypes "github.com/cometbft/cometbft/v2/types"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
)
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
|
||||
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v2"
|
||||
dbm "github.com/cosmos/cosmos-db"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
|
||||
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v2"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
"cosmossdk.io/core/appmodule"
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
cmtabcitypes "github.com/cometbft/cometbft/abci/types"
|
||||
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
|
||||
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v2"
|
||||
cmtabcitypes "github.com/cometbft/cometbft/v2/abci/types"
|
||||
dbm "github.com/cosmos/cosmos-db"
|
||||
|
||||
"cosmossdk.io/core/appmodule"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package mock
|
||||
|
||||
import (
|
||||
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
|
||||
"github.com/cometbft/cometbft/crypto"
|
||||
cmttypes "github.com/cometbft/cometbft/types"
|
||||
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v2"
|
||||
"github.com/cometbft/cometbft/v2/crypto"
|
||||
cmttypes "github.com/cometbft/cometbft/v2/types"
|
||||
|
||||
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
|
||||
@@ -36,7 +36,7 @@ func (pv PV) SignVote(chainID string, vote *cmtproto.Vote, signExtension bool) e
|
||||
}
|
||||
vote.Signature = sig
|
||||
if signExtension {
|
||||
extSignBytes := cmttypes.VoteExtensionSignBytes(chainID, vote)
|
||||
extSignBytes, _ := cmttypes.VoteExtensionSignBytes(chainID, vote)
|
||||
extSig, err := pv.PrivKey.Sign(extSignBytes)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -3,7 +3,7 @@ package mock
|
||||
import (
|
||||
"testing"
|
||||
|
||||
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
|
||||
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v2"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
reflect "reflect"
|
||||
|
||||
appmodule "cosmossdk.io/core/appmodule"
|
||||
types "github.com/cometbft/cometbft/abci/types"
|
||||
types "github.com/cometbft/cometbft/v2/abci/types"
|
||||
client "github.com/cosmos/cosmos-sdk/client"
|
||||
codec "github.com/cosmos/cosmos-sdk/codec"
|
||||
types0 "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
json "encoding/json"
|
||||
reflect "reflect"
|
||||
|
||||
types "github.com/cometbft/cometbft/abci/types"
|
||||
types "github.com/cometbft/cometbft/v2/abci/types"
|
||||
client "github.com/cosmos/cosmos-sdk/client"
|
||||
codec "github.com/cosmos/cosmos-sdk/codec"
|
||||
types0 "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
|
||||
@@ -17,8 +17,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cometbft/cometbft/node"
|
||||
cmtclient "github.com/cometbft/cometbft/rpc/client"
|
||||
"github.com/cometbft/cometbft/v2/node"
|
||||
cmtclient "github.com/cometbft/cometbft/v2/rpc/client"
|
||||
dbm "github.com/cosmos/cosmos-db"
|
||||
"github.com/spf13/cobra"
|
||||
"golang.org/x/sync/errgroup"
|
||||
@@ -381,7 +381,6 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) {
|
||||
|
||||
ctx := server.NewDefaultContext()
|
||||
cmtCfg := ctx.Config
|
||||
cmtCfg.Consensus.TimeoutCommit = cfg.TimeoutCommit
|
||||
|
||||
// Only allow the first validator to expose an RPC, API and gRPC
|
||||
// server/client due to CometBFT in-process constraints.
|
||||
|
||||
@@ -2,19 +2,20 @@ package network
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/sha256"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
cmtcfg "github.com/cometbft/cometbft/config"
|
||||
"github.com/cometbft/cometbft/node"
|
||||
"github.com/cometbft/cometbft/p2p"
|
||||
pvm "github.com/cometbft/cometbft/privval"
|
||||
"github.com/cometbft/cometbft/proxy"
|
||||
"github.com/cometbft/cometbft/rpc/client/local"
|
||||
cmttime "github.com/cometbft/cometbft/types/time"
|
||||
cmtcfg "github.com/cometbft/cometbft/v2/config"
|
||||
"github.com/cometbft/cometbft/v2/node"
|
||||
"github.com/cometbft/cometbft/v2/p2p"
|
||||
pvm "github.com/cometbft/cometbft/v2/privval"
|
||||
"github.com/cometbft/cometbft/v2/proxy"
|
||||
"github.com/cometbft/cometbft/v2/rpc/client/local"
|
||||
cmttime "github.com/cometbft/cometbft/v2/types/time"
|
||||
"golang.org/x/sync/errgroup"
|
||||
|
||||
"cosmossdk.io/log"
|
||||
@@ -59,7 +60,23 @@ func startInProcess(cfg Config, val *Validator) error {
|
||||
Sha256Checksum: []byte{},
|
||||
}, err
|
||||
}
|
||||
return node.ChecksummedGenesisDoc{GenesisDoc: gen, Sha256Checksum: make([]byte, 0)}, nil
|
||||
|
||||
genbz, err := gen.AppState.MarshalJSON()
|
||||
if err != nil {
|
||||
return node.ChecksummedGenesisDoc{
|
||||
Sha256Checksum: []byte{},
|
||||
}, err
|
||||
}
|
||||
|
||||
bz, err := json.Marshal(genbz)
|
||||
if err != nil {
|
||||
return node.ChecksummedGenesisDoc{
|
||||
Sha256Checksum: []byte{},
|
||||
}, err
|
||||
}
|
||||
sum := sha256.Sum256(bz)
|
||||
|
||||
return node.ChecksummedGenesisDoc{GenesisDoc: gen, Sha256Checksum: sum[:]}, nil
|
||||
}
|
||||
|
||||
cmtApp := server.NewCometABCIWrapper(app)
|
||||
|
||||
@@ -5,10 +5,10 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
abci "github.com/cometbft/cometbft/abci/types"
|
||||
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
|
||||
cmtjson "github.com/cometbft/cometbft/libs/json"
|
||||
cmttypes "github.com/cometbft/cometbft/types"
|
||||
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v2"
|
||||
abci "github.com/cometbft/cometbft/v2/abci/types"
|
||||
cmtjson "github.com/cometbft/cometbft/v2/libs/json"
|
||||
cmttypes "github.com/cometbft/cometbft/v2/types"
|
||||
dbm "github.com/cosmos/cosmos-db"
|
||||
|
||||
coreheader "cosmossdk.io/core/header"
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
types2 "github.com/cometbft/cometbft/abci/types"
|
||||
types "github.com/cometbft/cometbft/api/cometbft/types/v1"
|
||||
types "github.com/cometbft/cometbft/api/cometbft/types/v2"
|
||||
types2 "github.com/cometbft/cometbft/v2/abci/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"cosmossdk.io/errors"
|
||||
|
||||
Reference in New Issue
Block a user