Skip to content
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

Found by Cem Özer: Ignore older latest messages in attesting balance #1306

Merged
merged 1 commit into from
Jul 25, 2019

Conversation

protolambda
Copy link
Contributor

Found by Cem Özer (@cemozerr): Ignore older latest messages in attesting balance sum, instead of assertion error.

I think there might be an error in get_latest_attesting_balance. Lets say that the children root (in the last line of get_head) that gets passed into get_latest_attesting_balance is the root of the actual head block. in the last line of get_latest_attesting_balance, lets say that the root we get by indexing latest_messages by the validator index i corresponds to the parent block of this head block. since head block will have slot number n , and its parent will have slot number n - 1, the assert statement at get_ancestor will throw.

Previously we asserted that the retrieved block was newer than the slot. But it may actually be older, if a latest message is older than the justified block (or later).

It is not breaking anything if there are no latest messages older than the justified epoch (not always the case). And I do not think that any clients are directly affected, as they are expected to not copy the inefficient spec implementation. It should be considered as a bug however.

Another option would be to check the lastest message slot, but we only track the epoch. Hence the decision to just return an empty hash in the query instead, which will always be different to the root being compared.

@djrtwo djrtwo changed the base branch from master to v08x July 23, 2019 13:33
@djrtwo
Copy link
Contributor

djrtwo commented Jul 23, 2019

changed base to v08x rather than master

@protolambda
Copy link
Contributor Author

@djrtwo Wasn't sure, so just picked master to avoid conflicts, and to redirect base later. Is v08x ready yet, are we merging those cosmetic dev branch things into it?

@djrtwo
Copy link
Contributor

djrtwo commented Jul 23, 2019

v08x was a fork off of dev right after the last release + backport

@djrtwo djrtwo merged commit f9f722c into v08x Jul 25, 2019
@djrtwo djrtwo deleted the old_latest_message branch July 25, 2019 02:03
hwwhww added a commit to hwwhww/trinity that referenced this pull request Aug 26, 2019
ralexstokes pushed a commit to ralexstokes/trinity that referenced this pull request Aug 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants