Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R4R: Update to Tendermint 0.24 (except NextValSet offsets) #2219

Merged
merged 29 commits into from
Oct 3, 2018
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
73292e0
Start of changes for TM 0.24
cwgoes Sep 3, 2018
14d5e68
More TM 0.24 updates
cwgoes Sep 3, 2018
532c9ee
Client updates for TM 0.24
cwgoes Sep 3, 2018
f45cfb2
Merge branch 'develop' into cwgoes/update-tendermint-upstream
cwgoes Sep 6, 2018
8f6c9e1
Pin to Tendermint 0.24.0-rc0
cwgoes Sep 6, 2018
06adc69
Update testcases for TM 0.24.0-rc0
cwgoes Sep 6, 2018
c667c56
More testcase fixes
cwgoes Sep 6, 2018
1f5fe29
Ignore Go src in linter
cwgoes Sep 6, 2018
dd75cd3
Minor cleanup
cwgoes Sep 6, 2018
e013b9f
Check errors
cwgoes Sep 6, 2018
2245b07
Merge branch 'develop' into cwgoes/update-tendermint-upstream
cwgoes Sep 7, 2018
897c381
Merge branch 'develop' into cwgoes/update-tendermint-upstream
cwgoes Sep 7, 2018
9dd4303
Pin final release
cwgoes Sep 7, 2018
b144dc7
Merge branch 'develop' into cwgoes/update-tendermint-upstream
cwgoes Sep 7, 2018
f95d26a
Merge branch 'develop' into cwgoes/update-tendermint-upstream
cwgoes Sep 8, 2018
08d4f45
Merge branch 'develop' into cwgoes/update-tendermint-upstream
cwgoes Sep 8, 2018
1d55673
Merge branch 'develop' into cwgoes/update-tendermint-upstream
cwgoes Sep 8, 2018
d85eb98
make format
cwgoes Sep 8, 2018
e7c2a96
Merge branch 'develop' into cwgoes/update-tendermint-upstream
cwgoes Sep 26, 2018
e931195
Remove unnecessary changes
cwgoes Sep 26, 2018
1013703
Update context.Verify
cwgoes Sep 26, 2018
da96e93
'make format'
cwgoes Sep 26, 2018
ecc06f4
Merge branch 'develop' into cwgoes/update-tendermint-upstream
cwgoes Sep 26, 2018
f11ee67
Merge branch 'develop' into cwgoes/update-tendermint-upstream
cwgoes Sep 27, 2018
fd36abf
Use own directory, fix tx size test, remove parseCmnError
cwgoes Sep 27, 2018
f2422cd
Keep code, codespace
cwgoes Sep 27, 2018
3ed2c22
Merge branch 'develop' into cwgoes/update-tendermint-upstream
cwgoes Oct 1, 2018
ec9cc2c
Trust the node for now
cwgoes Oct 3, 2018
1bb3bca
Merge branch 'develop' into cwgoes/update-tendermint-upstream
cwgoes Oct 3, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 37 additions & 27 deletions Gopkg.lock

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

4 changes: 2 additions & 2 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@

[[override]]
name = "github.com/tendermint/go-amino"
version = "=v0.12.0-rc0"
version = "=v0.12.0"

[[override]]
name = "github.com/tendermint/iavl"
version = "=v0.10.0"

[[override]]
name = "github.com/tendermint/tendermint"
version = "=v0.23.1-rc0"
version = "=0.24.0"

[[constraint]]
name = "github.com/bartekn/go-bip39"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ test_cover:

test_lint:
gometalinter.v2 --config=tools/gometalinter.json ./...
!(gometalinter.v2 --disable-all --enable='errcheck' --vendor ./... | grep -v "client/")
!(gometalinter.v2 --exclude /usr/lib/go/src/ --disable-all --enable='errcheck' --vendor ./... | grep -v "client/")
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s
dep status >> /dev/null
!(grep -n branch Gopkg.toml)
Expand Down
4 changes: 4 additions & 0 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ BREAKING CHANGES
* [x/gov] \#2195 Made governance use BFT Time instead of Block Heights for deposit and voting periods.

* SDK
* [core] \#2219 Update to Tendermint 0.24.0
* Validator set updates delayed by one block
* BFT timestamp that can safely be used by applications
* Fixed maximum block size enforcement
* [core] [\#1807](https://github.com/cosmos/cosmos-sdk/issues/1807) Switch from use of rational to decimal
* [types] [\#1901](https://github.com/cosmos/cosmos-sdk/issues/1901) Validator interface's GetOwner() renamed to GetOperator()
* [x/slashing] [#2122](https://github.com/cosmos/cosmos-sdk/pull/2122) - Implement slashing period
Expand Down
12 changes: 6 additions & 6 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ type BaseApp struct {
// checkState is set on initialization and reset on Commit.
// deliverState is set in InitChain and BeginBlock and cleared on Commit.
// See methods setCheckState and setDeliverState.
checkState *state // for CheckTx
deliverState *state // for DeliverTx
signedValidators []abci.SigningValidator // absent validators from begin block
checkState *state // for CheckTx
deliverState *state // for DeliverTx
voteInfos []abci.VoteInfo // absent validators from begin block

// flag for sealing
sealed bool
Expand Down Expand Up @@ -421,7 +421,7 @@ func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeg

// set the signed validators for addition to context in deliverTx
// TODO: communicate this result to the address to pubkey map in slashing
app.signedValidators = req.LastCommitInfo.GetValidators()
app.voteInfos = req.LastCommitInfo.GetVotes()
return
}

Expand Down Expand Up @@ -495,12 +495,12 @@ func validateBasicTxMsgs(msgs []sdk.Msg) sdk.Error {
}

// retrieve the context for the ante handler and store the tx bytes; store
// the signing validators if the tx runs within the deliverTx() state.
// the vote infos if the tx runs within the deliverTx() state.
func (app *BaseApp) getContextForAnte(mode runTxMode, txBytes []byte) (ctx sdk.Context) {
// Get the context
ctx = getState(app, mode).ctx.WithTxBytes(txBytes)
if mode == runTxModeDeliver {
ctx = ctx.WithSigningValidators(app.signedValidators)
ctx = ctx.WithVoteInfos(app.voteInfos)
}
return
}
Expand Down
19 changes: 11 additions & 8 deletions client/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/spf13/viper"

"github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/log"
tmlite "github.com/tendermint/tendermint/lite"
tmliteProxy "github.com/tendermint/tendermint/lite/proxy"
rpcclient "github.com/tendermint/tendermint/rpc/client"
Expand All @@ -37,7 +38,7 @@ type CLIContext struct {
Async bool
JSON bool
PrintResponse bool
Certifier tmlite.Certifier
Verifier tmlite.Verifier
DryRun bool
GenerateOnly bool
}
Expand Down Expand Up @@ -65,13 +66,13 @@ func NewCLIContext() CLIContext {
Async: viper.GetBool(client.FlagAsync),
JSON: viper.GetBool(client.FlagJson),
PrintResponse: viper.GetBool(client.FlagPrintResponse),
Certifier: createCertifier(),
Verifier: createVerifier(),
DryRun: viper.GetBool(client.FlagDryRun),
GenerateOnly: viper.GetBool(client.FlagGenerateOnly),
}
}

func createCertifier() tmlite.Certifier {
func createVerifier() tmlite.Verifier {
trustNode := viper.GetBool(client.FlagTrustNode)
if trustNode {
return nil
Expand All @@ -94,11 +95,13 @@ func createCertifier() tmlite.Certifier {
if errMsg.Len() != 0 {
panic(fmt.Errorf("can't create certifier for distrust mode, empty values from these options: %s", errMsg.String()))
}
certifier, err := tmliteProxy.GetCertifier(chainID, home, nodeURI)
node := rpcclient.NewHTTP(nodeURI, "/websocket")
// TODO Utilize ctx.Logger correctly
verifier, err := tmliteProxy.NewVerifier(chainID, home, node, log.NewNopLogger())
if err != nil {
panic(err)
}
return certifier
return verifier
}

// WithCodec returns a copy of the context with an updated codec.
Expand Down Expand Up @@ -159,9 +162,9 @@ func (ctx CLIContext) WithUseLedger(useLedger bool) CLIContext {
return ctx
}

// WithCertifier - return a copy of the context with an updated Certifier
func (ctx CLIContext) WithCertifier(certifier tmlite.Certifier) CLIContext {
ctx.Certifier = certifier
// WithVerifier - return a copy of the context with an updated Verifier
func (ctx CLIContext) WithVerifier(verifier tmlite.Verifier) CLIContext {
ctx.Verifier = verifier
return ctx
}

Expand Down
6 changes: 3 additions & 3 deletions client/context/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ func (ctx CLIContext) query(path string, key cmn.HexBytes) (res []byte, err erro
// nolint: unparam
func (ctx CLIContext) verifyProof(path string, resp abci.ResponseQuery) error {

if ctx.Certifier == nil {
return fmt.Errorf("missing valid certifier to verify data from untrusted node")
if ctx.Verifier == nil {
return fmt.Errorf("missing valid verifier to verify data from untrusted node")
}

node, err := ctx.GetNode()
Expand All @@ -337,7 +337,7 @@ func (ctx CLIContext) verifyProof(path string, resp abci.ResponseQuery) error {
}

// AppHash for height H is in header H+1
commit, err := tmliteProxy.GetCertifiedCommit(resp.Height+1, node, ctx.Certifier)
commit, err := tmliteProxy.GetCertifiedCommit(resp.Height+1, node, ctx.Verifier)
if err != nil {
return err
}
Expand Down
6 changes: 6 additions & 0 deletions client/lcd/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
nm "github.com/tendermint/tendermint/node"
"github.com/tendermint/tendermint/p2p"
pvm "github.com/tendermint/tendermint/privval"
"github.com/tendermint/tendermint/proxy"
tmrpc "github.com/tendermint/tendermint/rpc/lib/server"
Expand Down Expand Up @@ -218,9 +219,14 @@ func startTM(
) (*nm.Node, error) {
genDocProvider := func() (*tmtypes.GenesisDoc, error) { return genDoc, nil }
dbProvider := func(*nm.DBContext) (dbm.DB, error) { return dbm.NewMemDB(), nil }
nodeKey, err := p2p.LoadOrGenNodeKey(tmcfg.NodeKeyFile())
if err != nil {
return nil, err
}
node, err := nm.NewNode(
tmcfg,
privVal,
nodeKey,
proxy.NewLocalClientCreator(app),
genDocProvider,
dbProvider,
Expand Down
2 changes: 1 addition & 1 deletion cmd/gaia/app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func setGenesis(gapp *GaiaApp, accs ...*auth.BaseAccount) error {
}

// Initialize the chain
vals := []abci.Validator{}
vals := []abci.ValidatorUpdate{}
gapp.InitChain(abci.RequestInitChain{Validators: vals, AppStateBytes: stateBytes})
gapp.Commit()

Expand Down
Loading