Skip to content

ABCI chain migration conclusion#2488

Merged
kansi merged 7 commits intobigchaindb:masterfrom
ldmberman:abci-chain-migration-conclusion
Sep 3, 2018
Merged

ABCI chain migration conclusion#2488
kansi merged 7 commits intobigchaindb:masterfrom
ldmberman:abci-chain-migration-conclusion

Conversation

@ldmberman
Copy link
Copy Markdown
Contributor

Addresses the main point from #2468.

@ldmberman ldmberman requested a review from kansi August 29, 2018 10:52
@codecov-io
Copy link
Copy Markdown

codecov-io commented Aug 29, 2018

Codecov Report

Merging #2488 into master will increase coverage by 0.24%.
The diff coverage is 97.46%.

@@            Coverage Diff             @@
##           master    #2488      +/-   ##
==========================================
+ Coverage   91.48%   91.73%   +0.24%     
==========================================
  Files          41       41              
  Lines        2396     2467      +71     
==========================================
+ Hits         2192     2263      +71     
  Misses        204      204

'ABCI request - you need to migrate the ABCI client ' + \
'and set new chain ID: {chain_id}.'
logger.error(msg)
return ResponseInitChain()
Copy link
Copy Markdown
Contributor

@kansi kansi Aug 29, 2018

Choose a reason for hiding this comment

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

Why is init_chain returning a successful response even when the system is receiving invalid parameters?
The above query applies to all other places where an error log is generated but the return value is a success response.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No error codes are documented for InitChain.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since we cannot send error codes back we need to panic, just like Tendermint does when it sees a height greater than what it has witnessed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Which goal do we achieve by causing panic?

If there is a process manager, the process will be restarted and it will start all over.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The reason I am suggesting to panic is because the system is starting with invalid information. There is not point sending success response when we can't do any further processing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Tendermint state is changed somehow if we return a response, what is not the case if we panic, so you have point.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am in the process of updating other ABCI handlers - it probably makes sense to abort everywhere until the latest chain is in sync, right?

@ldmberman ldmberman force-pushed the abci-chain-migration-conclusion branch from a6d73c6 to b92139f Compare August 30, 2018 15:36
"""

chain = self.bigchaindb.get_latest_abci_chain()
self.abort_if_abci_chain_is_not_synced(chain)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As discussed in our office conversation it would be better to load the genesis for the fork during __init__() and then use it inside info, init_chain and check_tx

connection.conn[dbname].utxos.delete_many({})
connection.conn[dbname].validators.delete_many({})
for t in TABLES:
getattr(connection.conn[dbname], t).delete_many({})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

}


def test_create_secondary_indexes():
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The indexes on abci_chains collection should also be asserted

@ldmberman ldmberman force-pushed the abci-chain-migration-conclusion branch from 40fa6fa to 5b7e9fe Compare September 3, 2018 10:26
@ldmberman
Copy link
Copy Markdown
Contributor Author

Regarding the failed tests, see #2507.

Solution: Make get_validator_set/get_validators return None/[] when there are no validators yet.
Solution: Record known chains and sync through InitChain. Triggering the migration and adjusting other ABCI endpoints will follow.
It generates and records a chain ID.
And abort if the current chain is not synced.
@ldmberman ldmberman force-pushed the abci-chain-migration-conclusion branch from 5b7e9fe to 314c7ea Compare September 3, 2018 13:12
@kansi kansi merged commit 230a5b2 into bigchaindb:master Sep 3, 2018
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