Skip to content

Commit

Permalink
Merge pull request #9829 from vegaprotocol/comet0.38
Browse files Browse the repository at this point in the history
feat: upgrade to cometbft 0.38
  • Loading branch information
jeremyletang authored Nov 6, 2023
2 parents c4639dd + 51f5b8b commit bc7c4fa
Show file tree
Hide file tree
Showing 88 changed files with 1,647 additions and 2,564 deletions.
1 change: 1 addition & 0 deletions .spelling
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ cleanup
Cleanup
clef
codegen
cometbft
config
cyclomatic
dApp
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

### 🛠 Improvements

- [8051](https://github.com/vegaprotocol/vega/issues/8051) - Upgrade to comet `0.38.0`
- [9484](https://github.com/vegaprotocol/vega/issues/9484) - Remove network parameters that only provide defaults for market liquidity settings.
- [8718](https://github.com/vegaprotocol/vega/issues/8718) - Emit market data event after setting mark price prior to final settlement.
- [8590](https://github.com/vegaprotocol/vega/issues/8590) - Improved Ethereum oracle support.
Expand Down
6 changes: 3 additions & 3 deletions blockexplorer/entities/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
pb "code.vegaprotocol.io/vega/protos/blockexplorer/api/v1"
commandspb "code.vegaprotocol.io/vega/protos/vega/commands/v1"

tmTypes "github.com/tendermint/tendermint/abci/types"
tmTypes "github.com/cometbft/cometbft/abci/types"
"google.golang.org/protobuf/proto"
)

Expand Down Expand Up @@ -92,8 +92,8 @@ func extractAttribute(r *tmTypes.TxResult, eType, key string) string {
for _, e := range r.Result.Events {
if e.Type == eType {
for _, a := range e.Attributes {
if string(a.Key) == key {
return string(a.Value)
if a.Key == key {
return a.Value
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion blockexplorer/store/transactions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ import (
pb "code.vegaprotocol.io/vega/protos/blockexplorer/api/v1"

"github.com/cenkalti/backoff"
tmTypes "github.com/cometbft/cometbft/abci/types"
"github.com/jackc/pgx/v4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
tmTypes "github.com/tendermint/tendermint/abci/types"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion cmd/vega/commands/genesis/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import (
"code.vegaprotocol.io/vega/logging"
"code.vegaprotocol.io/vega/paths"

tmtypes "github.com/cometbft/cometbft/types"
"github.com/jessevdk/go-flags"
tmtypes "github.com/tendermint/tendermint/types"
)

type generateCmd struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/vega/commands/genesis/load_checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import (
vgfs "code.vegaprotocol.io/vega/libs/fs"
"code.vegaprotocol.io/vega/logging"

tmjson "github.com/cometbft/cometbft/libs/json"
tmtypes "github.com/cometbft/cometbft/types"
"github.com/jessevdk/go-flags"
tmjson "github.com/tendermint/tendermint/libs/json"
tmtypes "github.com/tendermint/tendermint/types"
)

type loadCheckpointCmd struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/vega/commands/genesis/new_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (
"code.vegaprotocol.io/vega/logging"
"code.vegaprotocol.io/vega/paths"

tmjson "github.com/cometbft/cometbft/libs/json"
tmtypes "github.com/cometbft/cometbft/types"
"github.com/jessevdk/go-flags"
tmjson "github.com/tendermint/tendermint/libs/json"
tmtypes "github.com/tendermint/tendermint/types"
)

var ErrAppendAndReplaceAreMutuallyExclusive = errors.New("--append and --replace and mutually exclusive")
Expand Down
12 changes: 6 additions & 6 deletions cmd/vega/commands/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ import (
"code.vegaprotocol.io/vega/logging"
"code.vegaprotocol.io/vega/paths"

tmcfg "github.com/cometbft/cometbft/config"
tmos "github.com/cometbft/cometbft/libs/os"
tmrand "github.com/cometbft/cometbft/libs/rand"
"github.com/cometbft/cometbft/p2p"
"github.com/cometbft/cometbft/privval"
"github.com/cometbft/cometbft/types"
"github.com/jessevdk/go-flags"
tmcfg "github.com/tendermint/tendermint/config"
tmos "github.com/tendermint/tendermint/libs/os"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/privval"
"github.com/tendermint/tendermint/types"
)

type InitCmd struct {
Expand Down
78 changes: 38 additions & 40 deletions cmd/vega/commands/node/app_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@

package node

import "github.com/tendermint/tendermint/abci/types"
import (
"context"

"github.com/cometbft/cometbft/abci/types"
)

type appW struct {
// this is the application currently in use
Expand All @@ -32,71 +36,65 @@ func newAppW(app types.Application) *appW {
}
}

func (app *appW) Info(req types.RequestInfo) types.ResponseInfo {
return app.impl.Info(req)
}

func (app *appW) DeliverTx(req types.RequestDeliverTx) types.ResponseDeliverTx {
return app.impl.DeliverTx(req)
func (app *appW) Info(ctx context.Context, req *types.RequestInfo) (*types.ResponseInfo, error) {
return app.impl.Info(ctx, req)
}

func (app *appW) CheckTx(req types.RequestCheckTx) types.ResponseCheckTx {
return app.impl.CheckTx(req)
func (app *appW) CheckTx(ctx context.Context, req *types.RequestCheckTx) (*types.ResponseCheckTx, error) {
return app.impl.CheckTx(ctx, req)
}

func (app *appW) Commit() types.ResponseCommit {
resp := app.impl.Commit()
func (app *appW) Commit(ctx context.Context, req *types.RequestCommit) (*types.ResponseCommit, error) {
resp, err := app.impl.Commit(ctx, req)
// if we are scheduled for an upgrade of the protocol
// let's do it now.
if app.update != nil {
app.impl = app.update
app.update = nil
}
return resp
return resp, err
}

func (app *appW) Query(ctx context.Context, req *types.RequestQuery) (*types.ResponseQuery, error) {
return app.impl.Query(ctx, req)
}

func (app *appW) InitChain(ctx context.Context, req *types.RequestInitChain) (*types.ResponseInitChain, error) {
return app.impl.InitChain(ctx, req)
}

func (app *appW) Query(req types.RequestQuery) types.ResponseQuery {
return app.impl.Query(req)
func (app *appW) ListSnapshots(ctx context.Context, req *types.RequestListSnapshots) (*types.ResponseListSnapshots, error) {
return app.impl.ListSnapshots(ctx, req)
}

func (app *appW) InitChain(req types.RequestInitChain) types.ResponseInitChain {
return app.impl.InitChain(req)
func (app *appW) OfferSnapshot(ctx context.Context, req *types.RequestOfferSnapshot) (*types.ResponseOfferSnapshot, error) {
return app.impl.OfferSnapshot(ctx, req)
}

func (app *appW) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock {
return app.impl.BeginBlock(req)
func (app *appW) LoadSnapshotChunk(ctx context.Context, req *types.RequestLoadSnapshotChunk) (*types.ResponseLoadSnapshotChunk, error) {
return app.impl.LoadSnapshotChunk(ctx, req)
}

func (app *appW) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock {
return app.impl.EndBlock(req)
func (app *appW) ApplySnapshotChunk(ctx context.Context, req *types.RequestApplySnapshotChunk) (*types.ResponseApplySnapshotChunk, error) {
return app.impl.ApplySnapshotChunk(ctx, req)
}

func (app *appW) ListSnapshots(
req types.RequestListSnapshots,
) types.ResponseListSnapshots {
return app.impl.ListSnapshots(req)
func (app *appW) PrepareProposal(ctx context.Context, proposal *types.RequestPrepareProposal) (*types.ResponsePrepareProposal, error) {
return app.impl.PrepareProposal(ctx, proposal)
}

func (app *appW) OfferSnapshot(
req types.RequestOfferSnapshot,
) types.ResponseOfferSnapshot {
return app.impl.OfferSnapshot(req)
func (app *appW) ProcessProposal(ctx context.Context, proposal *types.RequestProcessProposal) (*types.ResponseProcessProposal, error) {
return app.impl.ProcessProposal(ctx, proposal)
}

func (app *appW) LoadSnapshotChunk(
req types.RequestLoadSnapshotChunk,
) types.ResponseLoadSnapshotChunk {
return app.impl.LoadSnapshotChunk(req)
func (app *appW) FinalizeBlock(ctx context.Context, req *types.RequestFinalizeBlock) (*types.ResponseFinalizeBlock, error) {
return app.impl.FinalizeBlock(ctx, req)
}

func (app *appW) ApplySnapshotChunk(
req types.RequestApplySnapshotChunk,
) types.ResponseApplySnapshotChunk {
return app.impl.ApplySnapshotChunk(req)
func (app *appW) ExtendVote(ctx context.Context, req *types.RequestExtendVote) (*types.ResponseExtendVote, error) {
return app.impl.ExtendVote(ctx, req)
}

func (app *appW) SetOption(
req types.RequestSetOption,
) types.ResponseSetOption {
return app.impl.SetOption(req)
func (app *appW) VerifyVoteExtension(ctx context.Context, req *types.RequestVerifyVoteExtension) (*types.ResponseVerifyVoteExtension, error) {
return app.impl.VerifyVoteExtension(ctx, req)
}
2 changes: 1 addition & 1 deletion cmd/vega/commands/node/fetch_genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"code.vegaprotocol.io/vega/core/genesis"

tmtypes "github.com/tendermint/tendermint/types"
tmtypes "github.com/cometbft/cometbft/types"
)

func genesisDocHTTPFromURL(genesisFilePath string) (*tmtypes.GenesisDoc, error) {
Expand Down
9 changes: 4 additions & 5 deletions cmd/vega/commands/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ import (
apipb "code.vegaprotocol.io/vega/protos/vega/api/v1"
"code.vegaprotocol.io/vega/version"

"github.com/tendermint/tendermint/abci/types"
tmtypes "github.com/tendermint/tendermint/types"
"github.com/cometbft/cometbft/abci/types"
tmtypes "github.com/cometbft/cometbft/types"
"google.golang.org/grpc"
)

Expand Down Expand Up @@ -323,8 +323,7 @@ func (n *Command) startBlockchain(log *logging.Logger, tmHome, network, networkU
if err != nil {
return err
}
// n.blockchainClient = blockchain.NewClient(client)
n.blockchainClient.Set(client)
n.blockchainClient.Set(client, n.tmNode.MempoolSize)
case blockchain.ProviderNullChain:
// nullchain acts as both the client and the server because its does everything
n.nullBlockchain = nullchain.NewClient(
Expand All @@ -335,7 +334,7 @@ func (n *Command) startBlockchain(log *logging.Logger, tmHome, network, networkU
n.nullBlockchain.SetABCIApp(n.abciApp)
n.blockchainServer = blockchain.NewServer(n.Log, n.nullBlockchain)
// n.blockchainClient = blockchain.NewClient(n.nullBlockchain)
n.blockchainClient.Set(n.nullBlockchain)
n.blockchainClient.Set(n.nullBlockchain, 100*1024*1024)

default:
return ErrUnknownChainProvider
Expand Down
2 changes: 1 addition & 1 deletion cmd/vega/commands/nodewallet/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import (
"code.vegaprotocol.io/vega/logging"
"code.vegaprotocol.io/vega/paths"

tmconfig "github.com/cometbft/cometbft/config"
"github.com/jessevdk/go-flags"
tmconfig "github.com/tendermint/tendermint/config"
)

var (
Expand Down
9 changes: 4 additions & 5 deletions cmd/vega/commands/tm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import (
"os"
"path/filepath"

tmcmd "github.com/cometbft/cometbft/cmd/cometbft/commands"
tmdebug "github.com/cometbft/cometbft/cmd/cometbft/commands/debug"
tmcfg "github.com/cometbft/cometbft/config"
tmcli "github.com/cometbft/cometbft/libs/cli"
"github.com/jessevdk/go-flags"
tmcmd "github.com/tendermint/tendermint/cmd/cometbft/commands"
tmdebug "github.com/tendermint/tendermint/cmd/cometbft/commands/debug"
tmcfg "github.com/tendermint/tendermint/config"
tmcli "github.com/tendermint/tendermint/libs/cli"
)

func Tm(_ context.Context, parser *flags.Parser) error {
Expand Down Expand Up @@ -57,7 +57,6 @@ func (opts *tmCmd) Execute(_ []string) error {
rootCmd.AddCommand(
tmcmd.GenValidatorCmd,
tmcmd.InitFilesCmd,
tmcmd.ProbeUpnpCmd,
tmcmd.LightCmd,
tmcmd.ReplayCmd,
tmcmd.ReplayConsoleCmd,
Expand Down
2 changes: 1 addition & 1 deletion cmd/vega/commands/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (

"code.vegaprotocol.io/vega/core/blockchain/abci"

tmctypes "github.com/cometbft/cometbft/rpc/core/types"
"github.com/jessevdk/go-flags"
tmctypes "github.com/tendermint/tendermint/rpc/core/types"
)

type watch struct {
Expand Down
7 changes: 3 additions & 4 deletions cmd/vegatools/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ import (
"code.vegaprotocol.io/vega/paths"
"code.vegaprotocol.io/vega/vegatools/snapshotdb"

tmconfig "github.com/cometbft/cometbft/config"
"github.com/cometbft/cometbft/store"
"github.com/spf13/viper"
tmconfig "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/node"
"github.com/tendermint/tendermint/store"
)

type snapshotCmd struct {
Expand All @@ -46,7 +45,7 @@ func getLastProcessedBlock(homeDir string) (int64, error) {
conf.SetRoot(homeDir)

// lets get the last processed block from tendermint
blockStoreDB, err := node.DefaultDBProvider(&node.DBContext{ID: "blockstore", Config: conf})
blockStoreDB, err := tmconfig.DefaultDBProvider(&tmconfig.DBContext{ID: "blockstore", Config: conf})
if err != nil {
return 0, err
}
Expand Down
12 changes: 6 additions & 6 deletions core/api/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ import (
eventspb "code.vegaprotocol.io/vega/protos/vega/events/v1"
"code.vegaprotocol.io/vega/wallet/crypto"

"github.com/cometbft/cometbft/libs/bytes"
tmctypes "github.com/cometbft/cometbft/rpc/core/types"
"github.com/pkg/errors"
"github.com/tendermint/tendermint/libs/bytes"
tmctypes "github.com/tendermint/tendermint/rpc/core/types"
"google.golang.org/grpc/codes"
)

Expand Down Expand Up @@ -659,14 +659,14 @@ func (s *coreService) SubmitRawTransaction(ctx context.Context, req *protoapi.Su
if txResult != nil {
return &protoapi.SubmitRawTransactionResponse{
Success: false,
Code: txResult.DeliverTx.Code,
Data: string(txResult.DeliverTx.Data),
Log: txResult.DeliverTx.Log,
Code: txResult.TxResult.Code,
Data: string(txResult.TxResult.Data),
Log: txResult.TxResult.Log,
}, s.handleSubmitRawTxTMError(err)
}
return nil, s.handleSubmitRawTxTMError(err)
}
setResponseBasisContent(successResponse, txResult.DeliverTx.Code, txResult.DeliverTx.Log, txResult.DeliverTx.Data, txResult.Hash)
setResponseBasisContent(successResponse, txResult.TxResult.Code, txResult.TxResult.Log, txResult.TxResult.Data, txResult.Hash)
successResponse.Height = txResult.Height

default:
Expand Down
2 changes: 1 addition & 1 deletion core/api/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
commandspb "code.vegaprotocol.io/vega/protos/vega/commands/v1"
eventspb "code.vegaprotocol.io/vega/protos/vega/events/v1"

tmctypes "github.com/tendermint/tendermint/rpc/core/types"
tmctypes "github.com/cometbft/cometbft/rpc/core/types"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/peer"
Expand Down
2 changes: 1 addition & 1 deletion core/api/mocks/blockchain_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bc7c4fa

Please sign in to comment.