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

tendermint: Update to master #6471

Closed
wants to merge 69 commits into from
Closed

tendermint: Update to master #6471

wants to merge 69 commits into from

Conversation

tac0turtle
Copy link
Member

@tac0turtle tac0turtle commented Jun 19, 2020

Description

Updating sdk to latest tendermint (master) in order to start testing things on our side with the sdk.

This PR removes:

  • verfier from context (no longer present)
  • --trust-node:

closes: #XXXX

@tac0turtle tac0turtle added the WIP label Jun 19, 2020
@tac0turtle tac0turtle self-assigned this Jun 19, 2020
@fedekunze
Copy link
Collaborator

@marbar3778 you also need to update the makefile to point to the commit in order to update the proto deps

@tac0turtle
Copy link
Member Author

@marbar3778 you also need to update the makefile to point to the commit in order to update the proto deps

yup yup i know. There isnt a need for that right now.

@tac0turtle
Copy link
Member Author

this is currently blocked on ics23-tendermint. I think it will have to be moved to the SDK or some functions that were removed from Tendermint that have been added to Tendermint will need to be moved elsewhere to avoid SDK importing ics23 and ics23 importing SDK

store/rootmulti/map.go Outdated Show resolved Hide resolved
@tac0turtle tac0turtle changed the title DNM: Tm update for testing DNM: Tm update Jun 29, 2020
@tac0turtle
Copy link
Member Author

this may be blocked on a possible bug in tendermint. The bug has been present in all previous versions but only now is known due to the strictness of proto

@@ -552,3 +554,19 @@ func splitPath(requestPath string) (path []string) {

return path
}

func (app *BaseApp) ListSnapshots(abci.RequestListSnapshots) abci.ResponseListSnapshots {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we plan on supporting state sync for stargate?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, there is a separate PR that integrates it but it's blocked on this PR. anyways these are added as no-ops for now

@@ -151,7 +152,7 @@ func encryptPrivKey(privKey crypto.PrivKey, passphrase string) (saltBytes []byte
}

key = crypto.Sha256(key) // get 32 bytes
privKeyBytes := privKey.Bytes()
privKeyBytes := legacy.Cdc.Amino.MustMarshalBinaryBare(privKey)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use the legacy amino codec here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bytes before was the amino encoding. I wasn't sure if I should work on the migration of keys in this PR as its already large.

@zmanian
Copy link
Member

zmanian commented Jul 27, 2020

Linking to tendermint/tendermint#5138 but my understanding is that it's blocking.

var bzArr [32]byte
copy(bzArr[:], bz)
return secp256k1.PrivKeySecp256k1(bzArr)
var bzArr = make([]byte, secp256k1.PrivKeySize)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var bzArr = make([]byte, secp256k1.PrivKeySize)
bzArr := make([]byte, secp256k1.PrivKeySize)

@@ -154,3 +154,5 @@ func (pk PubKeyMultisigThreshold) Equals(other crypto.PubKey) bool {
}
return true
}

func (pk PubKeyMultisigThreshold) Type() string { return " PubKeyMultisigThreshold" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func (pk PubKeyMultisigThreshold) Type() string { return " PubKeyMultisigThreshold" }
func (pk PubKeyMultisigThreshold) Type() string { return "PubKeyMultisigThreshold" }

google.golang.org/grpc v1.30.0
gopkg.in/yaml.v2 v2.3.0
)

replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.2-alpha.regen.4

replace github.com/tendermint/tendermint => ../tendermint
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

MaxAgeNumBlocks: cp.Evidence.MaxAgeNumBlocks,
MaxAgeDuration: cp.Evidence.MaxAgeDuration,
// TODO: expand to house other params
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address

simapp/test_helpers.go Show resolved Hide resolved
t.Cleanup(iterator.Close)
t.Cleanup(func() {
if err := iterator.Close; err != nil {
t.Logf("error cleaning up iterator: %v", err())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is err a function?

t.Cleanup(reverseIterator.Close)
t.Cleanup(func() {
if err := reverseIterator.Close; err != nil {
t.Logf("error cleaning up iterator: %v", err())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

expectedValue: nil,
expectedOut: "{\"operation\":\"read\",\"key\":\"\",\"value\":\"\",\"metadata\":{\"blockHeight\":64}}\n",
},
// TODO: key types can not me empty
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address?

@@ -45,10 +46,12 @@ func startInProcess(cfg Config, val *Validator) error {
logger.With("module", val.Moniker),
)
if err != nil {
fmt.Println(err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Println(err)

expectedValue: nil,
expectedOut: "{\"operation\":\"read\",\"key\":\"\",\"value\":\"\",\"metadata\":{\"blockHeight\":64}}\n",
},
// TODO: key types can not me empty
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address

@alexanderbez
Copy link
Contributor

alexanderbez commented Jul 29, 2020

I would like to know how many files diff just based on package renaming compared to logic changes. It might really simplify the review process if we could have 1 PR that is just for pkg renaming changes and separate PRs for logic changes -- no matter how small.

The base PR (pkg renaming) should be the first PR and approved immediately, but not merged. Then subsequent PRs are based against the base PR and are merged after thorough review. This way, we can tackle all logic changes piecemeal.

I know you already put a bunch of work into this @marbar3778, but reviewing a 200+ file diff is just not feasible.

Copy link
Contributor

@colin-axner colin-axner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did a first pass mostly over IBC stuff, mostly looks good to me 👍 just left comments on things that stood out

@@ -13,7 +13,7 @@ this [blog post](https://blog.cosmos.network/bug-bounty-program-for-tendermint-c

The following is a list of examples of the kinds of bugs we're most interested
in for the Cosmos SDK. See [here](https://github.com/tendermint/tendermint/blob/master/SECURITY.md) for vulnerabilities we are interested
in for Tendermint and other lower-level libraries (eg. [IAVL](https://github.com/tendermint/iavl)).
in for Tendermint and other lower-level libraries (eg. [IAVL](https://github.com/cosmos/iavl)).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be removed? I imagine IAVL bugs will now be reported to cosmos and not tendermint

return err
}

if err := tmNode.Start(); err != nil {
fmt.Println(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Println(err)

@@ -1,6 +1,7 @@
package network

import (
"fmt"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"fmt"

@@ -366,7 +366,7 @@ func convertProofs(mproof MerkleProof) ([]*ics23.CommitmentProof, error) {

// Empty returns true if the root is empty
func (proof MerkleProof) Empty() bool {
return proof.Proof.Equal(nil) || proof.Equal(MerkleProof{}) || proof.Proof.Equal(nil) || proof.Proof.Equal(merkle.Proof{})
return proto.Equal(proof.Proof, nil) || proto.Equal(&proof, &MerkleProof{}) || proto.Equal(proof.Proof, nil) || proto.Equal(proof.Proof, &tmmerkle.ProofOps{})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is outside the scope of this pr, but there is a duplicate check here with proto.Equal(proof.Proof, nil)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a bug, I think the first check should be proto.Equal(proof, nil)

@@ -109,7 +109,12 @@ func QueryTendermintHeader(clientCtx client.Context) (ibctmtypes.Header, int64,
return ibctmtypes.Header{}, 0, err
}

validators, err := node.Validators(&height, 0, 10000)
page := new(int)
*page = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there no way to condense these lines?

@@ -91,7 +91,12 @@ func NewLevelDB(name, dir string) (db dbm.DB, err error) {
err = fmt.Errorf("couldn't create db: %v", r)
}
}()
return dbm.NewDB(name, backend, dir), err

if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this necessary? won't the error be returned because the err error definition in the return

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a direct return of the error in the defer func makes the most sense

@@ -79,8 +78,8 @@ func (a Attribute) String() string {
}

// ToKVPair converts an Attribute object into a Tendermint key/value pair.
func (a Attribute) ToKVPair() tmkv.Pair {
return tmkv.Pair{Key: toBytes(a.Key), Value: toBytes(a.Value)}
func (a Attribute) ToKVPair() abci.EventAttribute {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be using the cosmos kv instead of returning an abci.EventAttribute? the func name and comment differs with behavior with this update

@colin-axner
Copy link
Contributor

I agree with @alexanderbez suggestion, I think it'll lead to a faster review process and not require multiple people to scan 200 files worth of import name changes.

@marbar3778 I can lend a hand with doing import name changes on a base PR tomorrow, we could divide up the work like I could do ibc and some other modules so we can work at the same time

@tac0turtle
Copy link
Member Author

breaking this pr into multiple ones

@tac0turtle tac0turtle changed the base branch from master to tm_update_1 July 30, 2020 10:06
@tac0turtle tac0turtle changed the base branch from tm_update_1 to master July 30, 2020 10:07
@colin-axner colin-axner mentioned this pull request Jul 30, 2020
9 tasks
@tac0turtle
Copy link
Member Author

closing this in favor of #6892

@tac0turtle tac0turtle closed this Jul 30, 2020
@tac0turtle tac0turtle deleted the marko/tm_update branch October 21, 2020 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants