-
Notifications
You must be signed in to change notification settings - Fork 46
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
Upgrade abci and tm versions #76
Conversation
Get chainID from initChain again Update tests Update pubKey indexing according to the new message format
Codecov Report
@@ Coverage Diff @@
## master #76 +/- ##
========================================
- Coverage 77.9% 77.4% -0.5%
========================================
Files 56 56
Lines 2399 2443 +44
========================================
+ Hits 1869 1893 +24
- Misses 425 445 +20
Partials 105 105
Continue to review full report at Codecov.
|
@ethanfrey So we've got the following changes: BREAKING CHANGES: [example/dummy] Remove. See example/kvstore [types] Add some fields - Anything here? |
What we care about:
Yup. we will want to store the set of initial validators later, or pass down to the apps to store it. Not needed now, but I will create an issue.
We don't need to store them at all, but we may want to place them in the Context, so an application could take action. This is only really useful when we have actions that run every block in BeginBlock, so I will create a future issue for this as well.
No one uses these fields now, they are all passed down the line. Good to go.
Validator in init genesis? I didn't think there was a validator in BeginBlock? But maybe I am wrong.
👍 this is a key change we need, so the validator diff works with the new version.
This one is interesting. What happens if we don't provide Validators??? It just uses the validators from the genesis file, right? Or do we have to explicitly return the same set as we get in from the input to InitChain? It would be good to investigate and add a comment on InitChain how this works. If we provide values, do they override the genesis value, or are the combined together (like the EndBlock Diff)?
We do not use these now, but maybe add a Many of the features are added for the complex staking model used in cosmos, and they are not necessary for us now, but it is good to know they are there, and when we add an interface to handle BeginBlock, we should make sure to include that it can return Tags. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. One suggestion for an enhancement
@@ -111,6 +111,11 @@ func (s *StoreApp) parseAppState(data []byte, init weave.Initializer) error { | |||
return errors.WithCode(err, errors.CodeTxParseError) | |||
} | |||
|
|||
err = s.storeChainID(chainID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -345,7 +342,7 @@ func (s *StoreApp) AddValChange(diffs []abci.Validator) { | |||
// return index of list with validator of same PubKey, or -1 if no match | |||
func pubKeyIndex(val abci.Validator, list []abci.Validator) int { | |||
for i, v := range list { | |||
if bytes.Equal(val.PubKey, v.PubKey) { | |||
if val.PubKey.Type == v.PubKey.Type && bytes.Equal(val.PubKey.Data, v.PubKey.Data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch
// Commit first block, make sure non-nil hash | ||
header := abci.Header{Height: h, ChainID: chainId} | ||
header := abci.Header{Height: h} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better this way.
Just wondering, maybe we verify chainID of every header on BeginBlock? And return an error if it is present and different from the one stored in InitCHain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I was not sure it's necessary, but we can indeed panic with an error if stuff does not match. Kind of provides "extra security", but on the other hand this should not be happening if the init was correct, otherwise we can't trust tendermint at all. Unless I'm missing something.
What do you think?
I guess what I'm trying to say is: double checking is good, but it leads to more code and more things that could potentially break/need to be supported while sometimes providing us with no benefit. I used to do that a lot on every level of an application, but then learned to limit myself to what's necessary.
I might be wrong about this one, so I leave this call up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes me look ridiculous, fighting for one line of code here 🗡
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please leave the tests as is.
I just got contacted from some people, where they ended up replaying blocks from the wrong chain in some dev setup. I thought a second check would not be bad.
But on reflection, the Info method on handshake will show a different AppHash than the chain, so tendermint should prohibit that anyway.
Ignore the above comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ethanfrey cool, not changing anything here then.
@ethanfrey I will investigate the evidence stuff and put TODO's about other stuff as well these coming days. |
@ethanfrey added some TODO's, ready for merge. Feel free to add tickets for whatever I might have missed. |
* Replace confio with iov packages * Fix utils imports * Fix test imports * More imports
Get chainID from initChain again
Update tests
Update pubKey indexing according to the new message format