Skip to content

Commit

Permalink
refactor: rename to CometBFT (#14914)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Feb 6, 2023
1 parent 88909d6 commit 80dd55f
Show file tree
Hide file tree
Showing 274 changed files with 1,506 additions and 1,514 deletions.
26 changes: 0 additions & 26 deletions Makefile
Expand Up @@ -368,32 +368,6 @@ format:
$(golangci_lint_cmd) run --fix
.PHONY: format

###############################################################################
### Devdoc ###
###############################################################################

DEVDOC_SAVE = docker commit `docker ps -a -n 1 -q` devdoc:local

devdoc-init:
$(DOCKER) run -it -v "$(CURDIR):/go/src/github.com/cosmos/cosmos-sdk" -w "/go/src/github.com/cosmos/cosmos-sdk" tendermint/devdoc echo
# TODO make this safer
$(call DEVDOC_SAVE)

devdoc:
$(DOCKER) run -it -v "$(CURDIR):/go/src/github.com/cosmos/cosmos-sdk" -w "/go/src/github.com/cosmos/cosmos-sdk" devdoc:local bash

devdoc-save:
# TODO make this safer
$(call DEVDOC_SAVE)

devdoc-clean:
docker rmi -f $$(docker images -f "dangling=true" -q)

devdoc-update:
docker pull tendermint/devdoc

.PHONY: devdoc devdoc-clean devdoc-init devdoc-save devdoc-update

###############################################################################
### Protobuf ###
###############################################################################
Expand Down
9 changes: 9 additions & 0 deletions UPGRADING.md
Expand Up @@ -4,6 +4,15 @@ This guide provides instructions for upgrading to specific versions of Cosmos SD

## [Unreleased]

### Consensus Engine

The Cosmos SDK has migrated to CometBFT as its default consensus engine.
This is a breaking changes that needs chains to re-generate their protos.
Some functions has been renamed to reflect the naming change, following an exhaustive list:

* `client.TendermintRPC` -> `client.CometRPC`
* `clitestutil.MockTendermintRPC` -> `clitestutil.MockCometRPC`

### Configuration

A new tool have been created for migrating configuration of the SDK. Use the following command to migrate your configuration:
Expand Down
20 changes: 10 additions & 10 deletions baseapp/abci.go
Expand Up @@ -11,7 +11,7 @@ import (
"time"

abci "github.com/cometbft/cometbft/abci/types"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"github.com/cosmos/gogoproto/proto"
"google.golang.org/grpc/codes"
grpcstatus "google.golang.org/grpc/status"
Expand All @@ -38,15 +38,15 @@ const (
func (app *BaseApp) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain) {
// On a new chain, we consider the init chain block height as 0, even though
// req.InitialHeight is 1 by default.
initHeader := tmproto.Header{ChainID: req.ChainId, Time: req.Time}
initHeader := cmtproto.Header{ChainID: req.ChainId, Time: req.Time}

app.logger.Info("InitChain", "initialHeight", req.InitialHeight, "chainID", req.ChainId)

// If req.InitialHeight is > 1, then we set the initial version in the
// stores.
if req.InitialHeight > 1 {
app.initialHeight = req.InitialHeight
initHeader = tmproto.Header{ChainID: req.ChainId, Height: req.InitialHeight, Time: req.Time}
initHeader = cmtproto.Header{ChainID: req.ChainId, Height: req.InitialHeight, Time: req.Time}
err := app.cms.SetInitialVersion(req.InitialHeight)
if err != nil {
panic(err)
Expand Down Expand Up @@ -265,7 +265,7 @@ func (app *BaseApp) PrepareProposal(req abci.RequestPrepareProposal) (resp abci.
panic("PrepareProposal method not set")
}

// Tendermint must never call PrepareProposal with a height of 0.
// CometBFT must never call PrepareProposal with a height of 0.
// Ref: https://github.com/cometbft/cometbft/blob/059798a4f5b0c9f52aa8655fa619054a0154088c/spec/core/state.md?plain=1#L37-L38
if req.Height < 1 {
panic("PrepareProposal called with invalid height")
Expand Down Expand Up @@ -301,7 +301,7 @@ func (app *BaseApp) PrepareProposal(req abci.RequestPrepareProposal) (resp abci.
// block. Note, the application defines the exact implementation details of
// ProcessProposal. In general, the application must at the very least ensure
// that all transactions are valid. If all transactions are valid, then we inform
// Tendermint that the Status is ACCEPT. However, the application is also able
// CometBFT that the Status is ACCEPT. However, the application is also able
// to implement optimizations such as executing the entire proposed block
// immediately.
//
Expand Down Expand Up @@ -449,7 +449,7 @@ func (app *BaseApp) Commit() abci.ResponseCommit {

// Reset the Check state to the latest committed.
//
// NOTE: This is safe because Tendermint holds a lock on the mempool for
// NOTE: This is safe because CometBFT holds a lock on the mempool for
// Commit. Use the header from this latest block.
app.setState(runTxModeCheck, header)
app.setState(runTxPrepareProposal, header)
Expand All @@ -469,7 +469,7 @@ func (app *BaseApp) Commit() abci.ResponseCommit {
}

if halt {
// Halt the binary and allow Tendermint to receive the ResponseCommit
// Halt the binary and allow CometBFT to receive the ResponseCommit
// response with the commit ID hash. This will allow the node to successfully
// restart and process blocks assuming the halt configuration has been
// reset or moved to a more distant value.
Expand Down Expand Up @@ -637,7 +637,7 @@ func (app *BaseApp) OfferSnapshot(req abci.RequestOfferSnapshot) abci.ResponseOf
)

// We currently don't support resetting the IAVL stores and retrying a different snapshot,
// so we ask Tendermint to abort all snapshot restoration.
// so we ask CometBFT to abort all snapshot restoration.
return abci.ResponseOfferSnapshot{Result: abci.ResponseOfferSnapshot_ABORT}
}
}
Expand Down Expand Up @@ -777,7 +777,7 @@ func (app *BaseApp) CreateQueryContext(height int64, prove bool) (sdk.Context, e
}

// GetBlockRetentionHeight returns the height for which all blocks below this height
// are pruned from Tendermint. Given a commitment height and a non-zero local
// are pruned from CometBFT. Given a commitment height and a non-zero local
// minRetainBlocks configuration, the retentionHeight is the smallest height that
// satisfies:
//
Expand Down Expand Up @@ -818,7 +818,7 @@ func (app *BaseApp) GetBlockRetentionHeight(commitHeight int64) int64 {

// Define retentionHeight as the minimum value that satisfies all non-zero
// constraints. All blocks below (commitHeight-retentionHeight) are pruned
// from Tendermint.
// from CometBFT.
var retentionHeight int64

// Define the number of blocks needed to protect against misbehaving validators
Expand Down

0 comments on commit 80dd55f

Please sign in to comment.