Skip to content

Instantly share code, notes, and snippets.

@jaekwon
Last active April 14, 2017 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaekwon/184acfdf785863899cddeb45e50e1019 to your computer and use it in GitHub Desktop.
Save jaekwon/184acfdf785863899cddeb45e50e1019 to your computer and use it in GitHub Desktop.
consensus fixes
* state/execution.go
- // ApplyBlock executes the block, then commits and updates the mempool atomically
becomes...
// ApplyBlock executes the block, updates state w/ ABCI responses, then commits and updates the mempool atomically, then saves state
- execBlockOnProxyApp should return relevant ABCI responses
- Between s.ExecBlock and s.CommitStateUpdateMempool, add a function to save ABI responses, 's.SaveABCIResponses'. Make the ABCI responses a simple field of state.State. Make it a pointer, and have State.Copy() just copy the pointer -- ABCI responses are not mutable.
- Move call to 's.SetBlockAndValidators' to between s.SaveABCIResponses and s.CommitStateUpdateMempool. Also move calls to 'updateValidators' and 'IncrementAccum' into s.SetBlockAndValidators. Change s.SetBlockAndValidators to include ABCI responses as arguments.
- After s.CommitStateUpdateMempool, save the state.
* In state/state.go
- Change 'updated at end of ExecBlock' to 'updated at end of SetBlockAndValidators'
* In consensus/state.go
- Before ApplyBlock, write #ENDHEIGHT to wal. And remove #HEIGHT auto-writer from consensus/wal.go
- Remove stateCopy.Save()
- BTW, we should also remove 'TODO: Handle app failure. See #177' and close #177. In the future, MultiAppConn should take care of it transparenty.
* In blockchain/reactor.go
- Remove bcR.state.Save()
* In consensus/replay.go
- Remove 'h.replayLastBlock' from `if appBlockHeight == stateBlockHeight`
- Revert timeout logic in 'replayLastBlock'
- Replace 'h.replayLastBlock' from `if appBlockHeight == storeBlockHeight`
Replace it with `state.ApplyBlock()` but using the mockApp.
- Make newMockProxyApp() take the stored ABCI responses in addition to the app hash
- Search for #ENDHEIGHT rather than #HEIGHT in both places (and decrement the argument by 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment