This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Chain Selection Subsystem Logic #3277
Chain Selection Subsystem Logic #3277
Changes from 82 commits
66bf4b2
dfb09e5
5a474eb
9c2340b
3c49a32
06e92a6
a2b0250
8790e52
d0f0f45
60196bf
a023348
537e59b
22705aa
c71d5b2
422afc4
70e5d8a
a792b1c
3487cf3
4a1f610
ae74536
b678828
645327a
2a40721
f76d410
2602e50
efc0963
5ec0064
750b8d7
bb1de40
8f3c533
ec48118
82c1817
6f2edf3
a1d9169
a969a2b
6ed7ac4
0577ed6
c10d52c
5407dae
53e4539
f975bf2
2518a17
32d73a1
ca45cc3
d08f418
8a97b71
05dc72a
f95d23e
5c2d2d9
fc13846
fabc28d
46d2416
14e8518
c4457ae
6308490
45a07c8
f439ed7
d163da5
c838388
b8c12ee
a05cb2b
1711f11
0586dbc
d73d621
1185b75
2dd5358
f42230c
99b4392
5afd66a
bf15a67
1aabcb3
8dff999
16c26e8
2b075b1
5a7abf9
a512985
cb2d136
4e01714
9a16ffc
31f47de
eeb4c89
085b612
4132129
16ceda8
0465903
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
This could be part of the
Backend
.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.
Yes, I can see that, but I believe it's simpler right now to expose a minimal
Backend
API and build on top of that. We're going to be disk-bound by this anyway.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.
This function is \Omega(block_height) in the worst case, so if someone were to pass in the genesis hash we would basically read the entire chain, right?
I wonder whether it makes sense to put a limit on the depth of this loop...
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.
@Lldenaurois It's actually O(block_height - finalized_height) because we only store unfinalized subtrees here. Pretty much all the algorithms here have the same complexity but as long as we don't have thousands of unfinalized blocks they'll work fine.
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.
Right now it's more inefficient than it needs to be but we could easily keep a
HashSet<Hash>
of block-entries we've visited already and bail early when we encounter a parent hash we've already seen. Most chains will have some common ancestor before the last finalized block.