-
Notifications
You must be signed in to change notification settings - Fork 79
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
core/dutydb: implement in-memory dutyDB #178
Conversation
Codecov Report
@@ Coverage Diff @@
## main #178 +/- ##
=======================================
Coverage ? 56.73%
=======================================
Files ? 39
Lines ? 2346
Branches ? 0
=======================================
Hits ? 1331
Misses ? 882
Partials ? 133 Continue to review full report at Codecov.
|
@@ -66,6 +66,7 @@ issues: | |||
- bodyclose | |||
- noctx | |||
- revive | |||
- gosec |
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.
exclude gosec from tests
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.
Looks good!
Few comments
} | ||
|
||
// Store key and value for PubKeyByAttestation | ||
pKey := pkKey{ |
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 data can be same for two DVs, if 2 validators are part of same committee for the same slot
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.
well, not the pkkey, since that is has aggbits which is unique per validator. It is the other key, attkey
which can be match mutliple Dvs, but we ensure that data is consistent
core/encode.go
Outdated
@@ -56,7 +55,7 @@ func DecodeAttesterUnsingedData(unsignedData UnsignedData) (*eth2p0.AttestationD | |||
} | |||
|
|||
// EncodeAttesterUnsingedData returns the attestation data as an encoded UnsignedData. | |||
func EncodeAttesterUnsingedData(attData *eth2p0.AttestationData) (UnsignedData, error) { | |||
func EncodeAttesterUnsingedData(attData *AttestationData) (UnsignedData, error) { |
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.
**EncodeAttesterUnsignedData
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.
fixed
@@ -85,33 +85,37 @@ func (f *Fetcher) Fetch(ctx context.Context, duty core.Duty, argSet core.FetchAr | |||
// fetchAttesterData returns the fetched attestation data set for committees and validators in the arg set. | |||
func (f *Fetcher) fetchAttesterData(ctx context.Context, slot int64, argSet core.FetchArgSet, | |||
) (core.UnsignedDataSet, error) { | |||
valsByComm := make(map[eth2p0.CommitteeIndex][]core.PubKey) | |||
// We may have multiple validators in the same committee, use the same attestation data in that case. |
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.
Exactly!
for _, pubkey := range pubkeys { | ||
resp[pubkey] = dutyData | ||
} | ||
resp[pubkey] = dutyData |
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 suppose this data is to be sent to our validators for partial signing after this with their key share
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.
yup
Co-authored-by: Dhruv Bodani <dhruvbodani2510@gmail.com>
Implements a placeholder in-memory dutyDB.
Refactor the dutyDB interface types to explicit eth2 types since they are duty type specific.
Adds AttestestionDuty with AttestationData so DutyDB can map responses to pubkey via aggbits
category: feature
ticket: #165