Skip to content

Commit

Permalink
prune slasher attestations (#7335)
Browse files Browse the repository at this point in the history
* prune slasher attestations

* remove unused code

* gaz

* remove unused methods from interface

* fix banchmark

* fix banchmark

* go.mod tidy

* preston feedback

* add test

* goimports

* fix test

* rm

* working version

* revert changes

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
  • Loading branch information
shayzluf and prylabs-bulldozer[bot] committed Oct 20, 2020
1 parent 81b553a commit 7c5ee0a
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 629 deletions.
9 changes: 0 additions & 9 deletions slasher/db/iface/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ type ReadOnlyDatabase interface {

// MinMaxSpan related methods.
EpochSpans(ctx context.Context, epoch uint64, fromCache bool) (*detectionTypes.EpochStore, error)
EpochSpansMap(ctx context.Context, epoch uint64) (map[uint64]detectionTypes.Span, bool, error)
EpochSpanByValidatorIndex(ctx context.Context, validatorIdx uint64, epoch uint64) (detectionTypes.Span, error)
EpochsSpanByValidatorsIndices(ctx context.Context, validatorIndices []uint64, maxEpoch uint64) (map[uint64]map[uint64]detectionTypes.Span, error)

// ProposerSlashing related methods.
ProposalSlashingsByStatus(ctx context.Context, status types.SlashingStatus) ([]*ethpb.ProposerSlashing, error)
Expand Down Expand Up @@ -70,12 +67,6 @@ type WriteAccessDatabase interface {

// MinMaxSpan related methods.
SaveEpochSpans(ctx context.Context, epoch uint64, spans *detectionTypes.EpochStore, toCache bool) error
SaveEpochSpansMap(ctx context.Context, epoch uint64, spanMap map[uint64]detectionTypes.Span) error
SaveValidatorEpochSpan(ctx context.Context, validatorIdx uint64, epoch uint64, spans detectionTypes.Span) error
SaveCachedSpansMaps(ctx context.Context) error
SaveEpochsSpanByValidatorsIndices(ctx context.Context, epochsSpans map[uint64]map[uint64]detectionTypes.Span) error
DeleteEpochSpans(ctx context.Context, validatorIdx uint64) error
DeleteValidatorSpanByEpoch(ctx context.Context, validatorIdx uint64, epoch uint64) error

// ProposerSlashing related methods.
DeleteProposerSlashing(ctx context.Context, slashing *ethpb.ProposerSlashing) error
Expand Down
2 changes: 0 additions & 2 deletions slasher/db/kv/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ go_library(
"kv.go",
"proposer_slashings.go",
"schema.go",
"spanner.go",
"spanner_new.go",
"validator_id_pubkey.go",
],
Expand Down Expand Up @@ -47,7 +46,6 @@ go_test(
"kv_test.go",
"proposer_slashings_test.go",
"spanner_new_test.go",
"spanner_test.go",
"validator_id_pubkey_test.go",
],
embed = [":go_default_library"],
Expand Down
6 changes: 0 additions & 6 deletions slasher/db/kv/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ var databaseFileName = "slasher.db"
type Store struct {
db *bolt.DB
databasePath string
spanCache *cache.EpochSpansCache
flatSpanCache *cache.EpochFlatSpansCache
spanCacheEnabled bool
}
Expand Down Expand Up @@ -97,11 +96,6 @@ func NewKVStore(dirPath string, cfg *Config) (*Store, error) {
}
kv := &Store{db: boltDB, databasePath: datafile}
kv.EnableSpanCache(true)
spanCache, err := cache.NewEpochSpansCache(cfg.SpanCacheSize, persistSpanMapsOnEviction(kv))
if err != nil {
return nil, errors.Wrap(err, "could not create new cache")
}
kv.spanCache = spanCache
flatSpanCache, err := cache.NewEpochFlatSpansCache(cfg.SpanCacheSize, persistFlatSpanMapsOnEviction(kv))
if err != nil {
return nil, errors.Wrap(err, "could not create new flat cache")
Expand Down

0 comments on commit 7c5ee0a

Please sign in to comment.