Fix deep source complains (#8714)

This commit is contained in:
terence tsao
2021-04-05 16:04:26 -07:00
committed by GitHub
parent 99bd988375
commit 7998348bcb
4 changed files with 2 additions and 13 deletions

View File

@@ -152,7 +152,7 @@ func verifyExitConditions(validator iface.ReadOnlyValidator, currentSlot types.S
// Verify the validator has been active long enough.
if currentEpoch < validator.ActivationEpoch()+params.BeaconConfig().ShardCommitteePeriod {
return fmt.Errorf(
"%s: %d of %d epochs. Validator will be eligible for exit at epoch %d.",
"%s: %d of %d epochs. Validator will be eligible for exit at epoch %d",
ValidatorCannotExitYetMsg,
currentEpoch-validator.ActivationEpoch(),
params.BeaconConfig().ShardCommitteePeriod,

View File

@@ -368,7 +368,7 @@ func aggregatorsPerSlot(activeValidators uint64) uint64 {
}
// provides the relevant score by the provided weight and threshold.
func scoreByWeight(weight float64, threshold float64) float64 {
func scoreByWeight(weight, threshold float64) float64 {
return maxScore() / (weight * threshold * threshold)
}

View File

@@ -533,16 +533,6 @@ func (b *BeaconState) ValidatorIndexByPubkey(key [48]byte) (types.ValidatorIndex
return idx, ok
}
func (b *BeaconState) validatorIndexMap() map[[48]byte]types.ValidatorIndex {
if b == nil || b.valMapHandler == nil || b.valMapHandler.IsNil() {
return map[[48]byte]types.ValidatorIndex{}
}
b.lock.RLock()
defer b.lock.RUnlock()
return b.valMapHandler.Copy().ValidatorIndexMap()
}
// PubkeyAtIndex returns the pubkey at the given
// validator index.
func (b *BeaconState) PubkeyAtIndex(idx types.ValidatorIndex) [48]byte {

View File

@@ -57,7 +57,6 @@ func TestNilState_NoPanic(t *testing.T) {
_, err = st.ValidatorAtIndexReadOnly(0)
_ = err
_, _ = st.ValidatorIndexByPubkey([48]byte{})
_ = st.validatorIndexMap()
_ = st.PubkeyAtIndex(0)
_ = st.NumValidators()
_ = st.Balances()