-
Notifications
You must be signed in to change notification settings - Fork 4
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
consensus: fast-sync mode: Skip dead reckoning #457
Conversation
57e64bd
to
810ce3c
Compare
810ce3c
to
2ce36a6
Compare
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.
Thanks for nicely organizing the commits! Really made the changes easy to follow.
// A new node is registered. | ||
if nodeEvent.IsRegistration && nodeEvent.Expiration >= currentEpoch { | ||
// A new node is registered; the expiration check above is needed because oasis-node sometimes returns | ||
// obsolete registration events, i.e. registrations that are already expired when they are produced. |
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.
Hm, weird do you know why/when does this happen?
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.
No :(
Tadej was vaguely aware that there's some sloppiness around registry data, for efficiency sake; but he was unsure of details.
I'll bring it up during demo.
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.
Forgot to :/
0532bd0
to
f585caa
Compare
…e latter references the former
f585caa
to
f99705d
Compare
f99705d
to
5ae1199
Compare
Thank you @ptrus ! |
This PR makes parallel analyzers (which have been possible to instantiate since #456) actually work. To achieve this, it implements "fast-sync" mode for block analyzers:
Getting this to work involved finding and plugging multiple holes. I only spun off two PRs; most other fixes are relatively small in terms of lines of code, so I recommend just reviewing this commit by commit. Explanations for individual commits follow, in order:
analyzer/consensus: fast-sync: reduce dead-reckoning, data fetching
analyzer/runtime: fast-sync: reduce dead-reckoning
analyzer/block: unlock blocks when terminating; do not work on expired blocks
genesis: Use DELETE b/c TRUNCATE does not respect txs
TRUNCATE
. We useTRUNCATE
in genesis processing. I don't think we ever run multiple of these in parallel, so this is a "just in case". Our tables are small enough thatDELETE
is not appreciably slower.runtimes
table beforeruntime_nodes
, because the latter references the former`debug: Optionally dump genesis JSON
genesis: StateToGenesis(height): Fetch nodes separately
StateToGenesis()
is designed primarily with dump-and-restore in mind. So when it dumps nodes, it ignores everything but validator nodes because others "will reregister immediately [after the dump-restore upgrade] anyway", per Jernej. Our use case is a little different; we need the full state of nodes at height H after having run fast-sync up to H. This commit makes it so we fetch the full set of nodes with a separate RPC, in addition to StateToGenesis().bugfix: analyzer/consensus: Reset nodes voting power
consensus/consensus,genesis: ignore expired-on-arrival node registrations
Post-review edit: Here are more changes I made after the review.
I believe they are non-controversial, so I'll (ab)use the LGTM and merge this PR pretty soon. Happy to address review comments in follow-up PRs though; there will be more work.
Additional changes/commits; trivial commits and commits addressing review feedback are skipped:
(bugfix) api: do not count accts with 0 balance among token holders
analyzer/batch: If batch deadline expires, do not attempt further blocks
analyzer/runtime: fast-sync: do not dead-reckon runtime_accounts.num_txs
analyzer/runtime: fast-sync: do not dead-reckon runtime_accounts.gas_for_calling
Remove chain.runtime_{withdraws,deposits} tables
bugfix: genesis: correctly insert proposal cancellations
Testing:
e2e from #525 , with and without parallelism.
A future test will be deploying this in staging. That's also when I plan to measure real-world speedups, and see how bad the DB contention is.Deployed in staging; indexed entire testnet (and found the "correctly insert proposal cancellations" bug), indexing of mainnet in progress (and prompted the reductions in runtime dead-reckoning).