You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// AttCaches defines the caches used to satisfy attestation pool interface.
// These caches are KV store for various attestations
// such are unaggregated, aggregated or attestations within a block.
type AttCaches struct {
aggregatedAttLock sync.RWMutex aggregatedAtt map[[32]byte][]*ethpb.Attestation
unAggregateAttLock sync.RWMutex
}
why use a slice type as the aggregatedAtt map's value? which sence the value may be slice?
the aggregatedAtt is the cache for store the aggregated attestation, key is the attestation's hash root,value is the aggregated result. i consider that the aggregated of multi attestations with the same hashRoot should one attestation, not a slice .
some related code is here:
beacon-chain/operations/attestations/kv/aggregated.go
// SaveAggregatedAttestation saves an aggregated attestation in cache.
func (c *AttCaches) SaveAggregatedAttestation(att *ethpb.Attestation) error
atts, ok := c.aggregatedAtt[r]
if !ok {
atts := []*ethpb.Attestation{copiedAtt}
c.aggregatedAtt[r] = atts
return nil
}
atts, err = attaggregation.Aggregate(append(atts, copiedAtt)) ------> atts is a slice
if err != nil {
return err
}
c.aggregatedAtt[r] = atts
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
// AttCaches defines the caches used to satisfy attestation pool interface.
// These caches are KV store for various attestations
// such are unaggregated, aggregated or attestations within a block.
type AttCaches struct {
aggregatedAttLock sync.RWMutex
aggregatedAtt map[[32]byte][]*ethpb.Attestation
unAggregateAttLock sync.RWMutex
}
why use a slice type as the aggregatedAtt map's value? which sence the value may be slice?
the aggregatedAtt is the cache for store the aggregated attestation, key is the attestation's hash root,value is the aggregated result. i consider that the aggregated of multi attestations with the same hashRoot should one attestation, not a slice .
some related code is here:
beacon-chain/operations/attestations/kv/aggregated.go
// SaveAggregatedAttestation saves an aggregated attestation in cache.
func (c *AttCaches) SaveAggregatedAttestation(att *ethpb.Attestation) error
atts, ok := c.aggregatedAtt[r]
if !ok {
atts := []*ethpb.Attestation{copiedAtt}
c.aggregatedAtt[r] = atts
return nil
}
func Aggregate(atts []*ethpb.Attestation) ([]*ethpb.Attestation, error) { ----> return value isslice
return MaxCoverAttestationAggregation(atts)
}
Can anyone answer my doubts? tks
Beta Was this translation helpful? Give feedback.
All reactions