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

Set ChainID on InitChain #1367

Merged
merged 16 commits into from
Jun 27, 2018
Merged

Set ChainID on InitChain #1367

merged 16 commits into from
Jun 27, 2018

Conversation

AdityaSripal
Copy link
Member

@AdityaSripal AdityaSripal commented Jun 25, 2018

  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGELOG.md
  • Updated Gaia/Examples
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

Closes #1295

@AdityaSripal AdityaSripal changed the title Aditya/init chainid Set ChainID on InitChain Jun 25, 2018
@AdityaSripal
Copy link
Member Author

Fixes Issue #1295

@ValarDragon
Copy link
Contributor

Can you update the changelog? Other than that LGTM

@codecov
Copy link

codecov bot commented Jun 25, 2018

Codecov Report

Merging #1367 into develop will increase coverage by 0.06%.
The diff coverage is 100%.

@@             Coverage Diff             @@
##           develop    #1367      +/-   ##
===========================================
+ Coverage    63.72%   63.78%   +0.06%     
===========================================
  Files          109      109              
  Lines         6026     6028       +2     
===========================================
+ Hits          3840     3845       +5     
+ Misses        1967     1964       -3     
  Partials       219      219

cwgoes
cwgoes previously requested changes Jun 25, 2018
Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

@AdityaSripal AdityaSripal dismissed cwgoes’s stale review June 25, 2018 22:07

Addressed comment

@AdityaSripal
Copy link
Member Author

Yup, got rid of it.

Could have done so a long time ago tho:

https://github.com/cosmos/cosmos-sdk/blob/develop/x/auth/ante.go#L88

@AdityaSripal
Copy link
Member Author

setCheckState was initially called in InitFromStore with an empty blockheader and reset on Commit with the current blockheader. This meant that chainID was missing from the first block's checkState, which would cause CheckTx to fail on the first block with the standard ante-handler (since signBytes included chainID)

@cwgoes
Copy link
Contributor

cwgoes commented Jun 27, 2018

Do we know why the unit tests are failing?

@AdityaSripal
Copy link
Member Author

The latest merge broke initChainer because genesisState.StakeData is not set.

Looking into fixing this now.

@AdityaSripal
Copy link
Member Author

@cwgoes bug fixed. ready for review

@@ -383,6 +381,8 @@ func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeg
// if this is a test and InitChain was never called.
if app.deliverState == nil {
app.setDeliverState(req.Header)
} else {
app.deliverState.ctx = app.deliverState.ctx.WithBlockHeader(req.Header)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this now necessary? app.DeliverState is set to nil when Commit() is called. Also, I think the comment on line 381 is wrong for this reason.

Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

utACK

@cwgoes cwgoes merged commit 9b4838d into develop Jun 27, 2018
@cwgoes cwgoes deleted the aditya/init-chainid branch June 27, 2018 22:45
adrianbrink pushed a commit that referenced this pull request Jul 2, 2018
* Added chain-id to context in InitChain
* Fix bug in test
* fmt
* Appease linter
* updated changelog
* Remove chainID hack
* setCheckState in InitChain
* Fix bug
* Fix initialization errors in example tests
* Initialize app tests with default stake genesis
* fix comments
chillyvee pushed a commit to chillyvee/cosmos-sdk that referenced this pull request Mar 1, 2024
* Update cosmos-hub-roadmap-2.0.md

* Update cosmos-hub-roadmap-2.0.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants