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.
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
Allow DA recorded blocks to come out-of-order #2415
base: master
Are you sure you want to change the base?
Allow DA recorded blocks to come out-of-order #2415
Changes from 12 commits
448d8c2
c5866a3
c54f098
fcf4477
159d5b4
ba080ff
d2b3c28
128a9ba
5f19932
922f3e0
d7e9bdd
12c517e
f8dca06
2bb86fe
60771e9
03da963
ea14e6f
b615b33
cfd1a71
d983891
4c2b844
48fe978
b578a8e
7ca55c7
6ac41de
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Do we really need an error here? We could log error here and use
0
=)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.
It's up to us. If this errors we have a serious problem with our code.
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.
If the committer has problems and submits several bundles per same height(they can in theory because they do re-bundle), it will break the node.
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.
That can't happen if it's finalized before they report to us.
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.
I've been thinking about the (very unlikely) case that our gas price metadata is "ahead" of the chain on restart. This could in theory result in a bunch of the blocks being missing from the
unrecorded_blocks
. At that point we might have the da_committer reporting those blocks again.Since the precision of the algorithm isn't that important, I think the simplest solution would be to just ignore re-reported blocks.
In that case we don't want it throwing an error here. So I'm going to change this.
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.
Hmmmmmmmm.... Well it's kinda weird.
We don't get the values for each committed block, we just get a value for the entire bundle.
This means, for example if the
unrecorded_blocks
are just[(8, 100)]
(height, bytes) and the committed blocks come back and they are for heights[1,2,3,4,5,6,7,8]
with cost10_000
, then we will remove the 8 and subtract100
from the total and then add10_000
to the total! Even though it's likely that the costs for 1-7 are already accounted for.We can take 1/8 of the
10_000
, which would be better than nothing, but definitely inaccurate.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.
In terms of the algorithm, I think the best approach here is to ignore the batch. The problem is if it ever occurs, we will carry those
unrecorded_blocks
forever. It's fine from the algorithm's perspective because the error will become negligible pretty quickly.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.
Nevermind. We can both remove the blocks and ignore. I think that's the best.
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.
Do we really need to iterate each time here? Just curios why not to use structure that does accounting internally and updates values once per add/remove events.
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 gets called semi-infrequently (only when we get a batch back from the committer). It could become more frequent I guess.
Yes. An alternative would be having the "total unrecorded bytes" tracked and when we remove blocks we subtract their bytes from that total. Then this would just be a multiplication of that. I can add that if you prefer.
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.
Done.