prysm-pulse/slasher/detection/attestations/attestations_test.go

284 lines
9.3 KiB
Go
Raw Normal View History

package attestations
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
import (
"context"
"testing"
"github.com/gogo/protobuf/proto"
slashpb "github.com/prysmaticlabs/prysm/proto/slashing"
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
"github.com/prysmaticlabs/prysm/shared/params"
testDB "github.com/prysmaticlabs/prysm/slasher/db/testing"
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
)
type spanMapTestStruct struct {
validatorIdx uint64
sourceEpoch uint64
targetEpoch uint64
slashingTargetEpoch uint64
resultSpanMap *slashpb.EpochSpanMap
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
}
var spanTestsMax []spanMapTestStruct
var spanTestsMin []spanMapTestStruct
func init() {
// Test data following example of a max span by https://github.com/protolambda
// from here: https://github.com/protolambda/eth2-surround/blob/master/README.md#min-max-surround
spanTestsMax = []spanMapTestStruct{
{
validatorIdx: 0,
sourceEpoch: 3,
targetEpoch: 6,
slashingTargetEpoch: 0,
resultSpanMap: &slashpb.EpochSpanMap{
EpochSpanMap: map[uint64]*slashpb.MinMaxEpochSpan{
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
4: {MinEpochSpan: 0, MaxEpochSpan: 2},
5: {MinEpochSpan: 0, MaxEpochSpan: 1},
},
},
},
{
validatorIdx: 0,
sourceEpoch: 8,
targetEpoch: 18,
slashingTargetEpoch: 0,
resultSpanMap: &slashpb.EpochSpanMap{
EpochSpanMap: map[uint64]*slashpb.MinMaxEpochSpan{
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
4: {MinEpochSpan: 0, MaxEpochSpan: 2},
5: {MinEpochSpan: 0, MaxEpochSpan: 1},
9: {MinEpochSpan: 0, MaxEpochSpan: 9},
10: {MinEpochSpan: 0, MaxEpochSpan: 8},
11: {MinEpochSpan: 0, MaxEpochSpan: 7},
12: {MinEpochSpan: 0, MaxEpochSpan: 6},
13: {MinEpochSpan: 0, MaxEpochSpan: 5},
14: {MinEpochSpan: 0, MaxEpochSpan: 4},
15: {MinEpochSpan: 0, MaxEpochSpan: 3},
16: {MinEpochSpan: 0, MaxEpochSpan: 2},
17: {MinEpochSpan: 0, MaxEpochSpan: 1},
},
},
},
{
validatorIdx: 0,
sourceEpoch: 4,
targetEpoch: 12,
slashingTargetEpoch: 0,
resultSpanMap: &slashpb.EpochSpanMap{
EpochSpanMap: map[uint64]*slashpb.MinMaxEpochSpan{
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
4: {MinEpochSpan: 0, MaxEpochSpan: 2},
5: {MinEpochSpan: 0, MaxEpochSpan: 7},
6: {MinEpochSpan: 0, MaxEpochSpan: 6},
7: {MinEpochSpan: 0, MaxEpochSpan: 5},
8: {MinEpochSpan: 0, MaxEpochSpan: 4},
9: {MinEpochSpan: 0, MaxEpochSpan: 9},
10: {MinEpochSpan: 0, MaxEpochSpan: 8},
11: {MinEpochSpan: 0, MaxEpochSpan: 7},
12: {MinEpochSpan: 0, MaxEpochSpan: 6},
13: {MinEpochSpan: 0, MaxEpochSpan: 5},
14: {MinEpochSpan: 0, MaxEpochSpan: 4},
15: {MinEpochSpan: 0, MaxEpochSpan: 3},
16: {MinEpochSpan: 0, MaxEpochSpan: 2},
17: {MinEpochSpan: 0, MaxEpochSpan: 1},
},
},
},
{
validatorIdx: 0,
sourceEpoch: 10,
targetEpoch: 15,
slashingTargetEpoch: 18,
resultSpanMap: &slashpb.EpochSpanMap{
EpochSpanMap: map[uint64]*slashpb.MinMaxEpochSpan{
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
4: {MinEpochSpan: 0, MaxEpochSpan: 2},
5: {MinEpochSpan: 0, MaxEpochSpan: 7},
6: {MinEpochSpan: 0, MaxEpochSpan: 6},
7: {MinEpochSpan: 0, MaxEpochSpan: 5},
8: {MinEpochSpan: 0, MaxEpochSpan: 4},
9: {MinEpochSpan: 0, MaxEpochSpan: 9},
10: {MinEpochSpan: 0, MaxEpochSpan: 8},
11: {MinEpochSpan: 0, MaxEpochSpan: 7},
12: {MinEpochSpan: 0, MaxEpochSpan: 6},
13: {MinEpochSpan: 0, MaxEpochSpan: 5},
14: {MinEpochSpan: 0, MaxEpochSpan: 4},
15: {MinEpochSpan: 0, MaxEpochSpan: 3},
16: {MinEpochSpan: 0, MaxEpochSpan: 2},
17: {MinEpochSpan: 0, MaxEpochSpan: 1},
},
},
},
}
spanTestsMin = []spanMapTestStruct{
{
validatorIdx: 0,
sourceEpoch: 4,
targetEpoch: 6,
slashingTargetEpoch: 0,
resultSpanMap: &slashpb.EpochSpanMap{
EpochSpanMap: map[uint64]*slashpb.MinMaxEpochSpan{
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
1: {MinEpochSpan: 5, MaxEpochSpan: 0},
2: {MinEpochSpan: 4, MaxEpochSpan: 0},
3: {MinEpochSpan: 3, MaxEpochSpan: 0},
},
},
},
{
validatorIdx: 0,
sourceEpoch: 13,
targetEpoch: 18,
slashingTargetEpoch: 0,
resultSpanMap: &slashpb.EpochSpanMap{
EpochSpanMap: map[uint64]*slashpb.MinMaxEpochSpan{
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
1: {MinEpochSpan: 5, MaxEpochSpan: 0},
2: {MinEpochSpan: 4, MaxEpochSpan: 0},
3: {MinEpochSpan: 3, MaxEpochSpan: 0},
4: {MinEpochSpan: 14, MaxEpochSpan: 0},
5: {MinEpochSpan: 13, MaxEpochSpan: 0},
6: {MinEpochSpan: 12, MaxEpochSpan: 0},
7: {MinEpochSpan: 11, MaxEpochSpan: 0},
8: {MinEpochSpan: 10, MaxEpochSpan: 0},
9: {MinEpochSpan: 9, MaxEpochSpan: 0},
10: {MinEpochSpan: 8, MaxEpochSpan: 0},
11: {MinEpochSpan: 7, MaxEpochSpan: 0},
12: {MinEpochSpan: 6, MaxEpochSpan: 0},
},
},
},
{
validatorIdx: 0,
sourceEpoch: 11,
targetEpoch: 15,
slashingTargetEpoch: 0,
resultSpanMap: &slashpb.EpochSpanMap{
EpochSpanMap: map[uint64]*slashpb.MinMaxEpochSpan{
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
1: {MinEpochSpan: 5, MaxEpochSpan: 0},
2: {MinEpochSpan: 4, MaxEpochSpan: 0},
3: {MinEpochSpan: 3, MaxEpochSpan: 0},
4: {MinEpochSpan: 11, MaxEpochSpan: 0},
5: {MinEpochSpan: 10, MaxEpochSpan: 0},
6: {MinEpochSpan: 9, MaxEpochSpan: 0},
7: {MinEpochSpan: 8, MaxEpochSpan: 0},
8: {MinEpochSpan: 7, MaxEpochSpan: 0},
9: {MinEpochSpan: 6, MaxEpochSpan: 0},
10: {MinEpochSpan: 5, MaxEpochSpan: 0},
11: {MinEpochSpan: 7, MaxEpochSpan: 0},
12: {MinEpochSpan: 6, MaxEpochSpan: 0},
},
},
},
{
validatorIdx: 0,
sourceEpoch: 10,
targetEpoch: 20,
slashingTargetEpoch: 15,
resultSpanMap: &slashpb.EpochSpanMap{
EpochSpanMap: map[uint64]*slashpb.MinMaxEpochSpan{
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
1: {MinEpochSpan: 5, MaxEpochSpan: 0},
2: {MinEpochSpan: 4, MaxEpochSpan: 0},
3: {MinEpochSpan: 3, MaxEpochSpan: 0},
4: {MinEpochSpan: 11, MaxEpochSpan: 0},
5: {MinEpochSpan: 10, MaxEpochSpan: 0},
6: {MinEpochSpan: 9, MaxEpochSpan: 0},
7: {MinEpochSpan: 8, MaxEpochSpan: 0},
8: {MinEpochSpan: 7, MaxEpochSpan: 0},
9: {MinEpochSpan: 6, MaxEpochSpan: 0},
10: {MinEpochSpan: 5, MaxEpochSpan: 0},
11: {MinEpochSpan: 7, MaxEpochSpan: 0},
12: {MinEpochSpan: 6, MaxEpochSpan: 0},
},
},
},
}
}
func TestServer_UpdateMaxEpochSpan(t *testing.T) {
t.Skip("Tests are deprecated due to new span implementation")
db := testDB.SetupSlasherDB(t, true)
defer testDB.TeardownSlasherDB(t, db)
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
ctx := context.Background()
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
for _, tt := range spanTestsMax {
spanMap, err := db.ValidatorSpansMap(ctx, tt.validatorIdx)
if err != nil {
t.Fatal(err)
}
2020-02-20 14:56:37 +00:00
spanMap, st, err := detectAndUpdateMaxEpochSpan(ctx, spanMap, tt.sourceEpoch, tt.targetEpoch)
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
if err != nil {
t.Fatalf("Failed to update span: %v", err)
}
if err := db.SaveValidatorSpansMap(ctx, tt.validatorIdx, spanMap); err != nil {
t.Fatalf("Couldnt save span map for validator id: %d", tt.validatorIdx)
}
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
if st != tt.slashingTargetEpoch {
t.Fatalf("Expected slashing target: %d got: %d", tt.slashingTargetEpoch, st)
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
}
sm, err := db.ValidatorSpansMap(ctx, tt.validatorIdx)
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
if err != nil {
t.Fatalf("Failed to retrieve span: %v", err)
}
if sm == nil || !proto.Equal(sm, tt.resultSpanMap) {
t.Fatalf("Get should return validator span map: %v got: %v", tt.resultSpanMap, sm)
}
}
}
func TestServer_UpdateMinEpochSpan(t *testing.T) {
t.Skip("Tests are deprecated due to new span implementation")
db := testDB.SetupSlasherDB(t, true)
defer testDB.TeardownSlasherDB(t, db)
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
ctx := context.Background()
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
for _, tt := range spanTestsMin {
spanMap, err := db.ValidatorSpansMap(ctx, tt.validatorIdx)
if err != nil {
t.Fatal(err)
}
2020-02-20 14:56:37 +00:00
spanMap, st, err := detectAndUpdateMinEpochSpan(ctx, spanMap, tt.sourceEpoch, tt.targetEpoch)
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
if err != nil {
t.Fatalf("Failed to update span: %v", err)
}
if err := db.SaveValidatorSpansMap(ctx, tt.validatorIdx, spanMap); err != nil {
t.Fatalf("Couldnt save span map for validator id: %d", tt.validatorIdx)
}
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
if st != tt.slashingTargetEpoch {
t.Fatalf("Expected slashing target: %d got: %d", tt.slashingTargetEpoch, st)
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
}
sm, err := db.ValidatorSpansMap(ctx, tt.validatorIdx)
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
if err != nil {
t.Fatalf("Failed to retrieve span: %v", err)
}
if sm == nil || !proto.Equal(sm, tt.resultSpanMap) {
t.Fatalf("Get should return validator span map: %v got: %v", tt.resultSpanMap, sm)
}
}
}
func TestServer_FailToUpdate(t *testing.T) {
db := testDB.SetupSlasherDB(t, true)
defer testDB.TeardownSlasherDB(t, db)
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
ctx := context.Background()
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
spanTestsFail := spanMapTestStruct{
sourceEpoch: 0,
slashingTargetEpoch: 0,
targetEpoch: params.BeaconConfig().WeakSubjectivityPeriod + 1,
resultSpanMap: &slashpb.EpochSpanMap{
EpochSpanMap: map[uint64]*slashpb.MinMaxEpochSpan{
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
4: {MinEpochSpan: 0, MaxEpochSpan: 2},
5: {MinEpochSpan: 0, MaxEpochSpan: 1},
},
},
}
spanMap, err := db.ValidatorSpansMap(ctx, spanTestsFail.validatorIdx)
if err != nil {
t.Fatal(err)
}
2020-02-20 14:56:37 +00:00
if _, _, err := detectAndUpdateMinEpochSpan(ctx, spanMap, spanTestsFail.sourceEpoch, spanTestsFail.targetEpoch); err == nil {
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
t.Fatalf("Update should not support diff greater then weak subjectivity period: %v ", params.BeaconConfig().WeakSubjectivityPeriod)
}
2020-02-20 14:56:37 +00:00
if _, _, err := detectAndUpdateMaxEpochSpan(ctx, spanMap, spanTestsFail.sourceEpoch, spanTestsFail.targetEpoch); err == nil {
Surround detection (#3967) * min max span update logic * add comment to exported method * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * weak subjectivity error * add context * SlasherDb change to SlasherDB * gaz * raul feedback * fix old problem * gofmt goimports * gaz * import fix * change order * min max span detection * added benchmark * max diff without error * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/db/indexed_attestations.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span_bench_test.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * raul feedback, benchmark fix * raul feedback * gaz * fix merge * bench fix * another bench fix * comments * changed names of functions and proto * name change fix * name change fix * fix test * clarification comment * change to interface * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: Ivan Martinez <ivanthegreatdev@gmail.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: Raul Jordan <raul@prysmaticlabs.com> * change order to reduce confusion * Update proto/eth/v1alpha1/slasher.proto Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Apply suggestions from code review Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * Update slasher/rpc/detect_update_min_max_span.go * Fix some comments * terence feedback * preston feedback * fix test * fix comments
2019-11-18 19:49:39 +00:00
t.Fatalf("Update should not support diff greater then weak subjectivity period: %v ", params.BeaconConfig().WeakSubjectivityPeriod)
}
}