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

Always Update Attesting History If Not Slashable #7935

Merged
merged 3 commits into from
Nov 24, 2020

Conversation

rauljordan
Copy link
Contributor

Follow up to #7934, this PR ensures we update the attesting history if an attestation is not found to be slashable. Additionally, we save the protection data to DB before we attest rather than afterwards

@rauljordan rauljordan requested a review from a team as a code owner November 24, 2020 01:55
@rauljordan rauljordan self-assigned this Nov 24, 2020
@rauljordan rauljordan added Priority: Critical Highest, immediate priority item release-target Ready For Review A pull request ready for code review labels Nov 24, 2020
prestonvanloon
prestonvanloon previously approved these changes Nov 24, 2020
terencechain
terencechain previously approved these changes Nov 24, 2020
terencechain
terencechain previously approved these changes Nov 24, 2020
Comment on lines 101 to 113
newHistory, err := kv.MarkAllAsAttestedSinceLatestWrittenEpoch(
ctx,
history,
indexedAtt.Data.Target.Epoch,
&kv.HistoryData{
Source: indexedAtt.Data.Source.Epoch,
SigningRoot: signingRoot[:],
},
)
if err != nil {
return errors.Wrapf(err, "could not mark epoch %d as attested", indexedAtt.Data.Target.Epoch)
}
v.attesterHistoryByPubKey[pubKey] = newHistory
Copy link
Member

Choose a reason for hiding this comment

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

This is duplicated on lines 85-97. Recommend: move to after the if/else block to deduplicate the code

@prylabs-bulldozer prylabs-bulldozer bot merged commit 3cc2ebc into master Nov 24, 2020
@delete-merged-branch delete-merged-branch bot deleted the always-update-history branch November 24, 2020 02:48
shayzluf added a commit that referenced this pull request Nov 24, 2020
rauljordan added a commit that referenced this pull request Nov 24, 2020
…ng a pub key data (#7937)

* minimal change to handle nil attesterHistoryByPubKey

* Revert "Always Update Attesting History If Not Slashable (#7935)"

This reverts commit 3cc2ebc.

* remove unused functions

* move save before propose

* wait before go func

* move wait into the go routine

* handling map mutation

* remove map handling in this case

* log in case it is still not found

* fix log

* fix locks

* Update validator/client/attest_protect.go

* remove code duplication

* remove method extraction

* move metrics to their appropriate place

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Critical Highest, immediate priority item Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants