|
|
|
@ -117,22 +117,25 @@ func eposStakedCommittee( |
|
|
|
|
// TODO Nervous about this because overtime the list will become quite large
|
|
|
|
|
candidates := stakerReader.ValidatorCandidates() |
|
|
|
|
essentials := map[common.Address]effective.SlotOrder{} |
|
|
|
|
|
|
|
|
|
utils.Logger().Info().Int("staked-candidates", len(candidates)).Msg("preparing epos staked committee") |
|
|
|
|
|
|
|
|
|
l := utils.Logger().Info().Int("staked-candidates", len(candidates)) |
|
|
|
|
l.Msg("preparing epos staked committee") |
|
|
|
|
blsKeys := make(map[shard.BlsPublicKey]struct{}) |
|
|
|
|
|
|
|
|
|
// TODO benchmark difference if went with data structure that sorts on insert
|
|
|
|
|
for i := range candidates { |
|
|
|
|
validator, err := stakerReader.ReadValidatorInformation(candidates[i]) |
|
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
return nil, err |
|
|
|
|
} |
|
|
|
|
if err := validator.SanityCheck(); err != nil { |
|
|
|
|
utils.Logger().Error(). |
|
|
|
|
Str("failure", validator.String()). |
|
|
|
|
Msg("Sanity check of validator failed") |
|
|
|
|
l.Err(err). |
|
|
|
|
RawJSON("candidate", []byte(validator.String())). |
|
|
|
|
Msg("validator sanity check failed") |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
if !effective.IsEligibleForEPOSAuction(validator) { |
|
|
|
|
l.RawJSON("candidate", []byte(validator.String())). |
|
|
|
|
Msg("validator not eligible for epos") |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
validatorStake := big.NewInt(0) |
|
|
|
@ -151,7 +154,8 @@ func eposStakedCommittee( |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if found { |
|
|
|
|
utils.Logger().Info().Msgf("[eposStakedCommittee] Duplicate bls key found %x, in validator %+v. Ignoring", dupKey, validator) |
|
|
|
|
const m = "Duplicate bls key found %x, in validator %+v. Ignoring" |
|
|
|
|
l.Msgf(m, dupKey, validator) |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -184,7 +188,7 @@ func eposStakedCommittee( |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if stakedSlotsCount == 0 { |
|
|
|
|
utils.Logger().Info().Int("slots-for-epos", stakedSlotsCount). |
|
|
|
|
l.Int("slots-for-epos", stakedSlotsCount). |
|
|
|
|
Msg("committe composed only of harmony node") |
|
|
|
|
return shardState, nil |
|
|
|
|
} |
|
|
|
@ -211,10 +215,10 @@ func eposStakedCommittee( |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if c := len(candidates); c != 0 { |
|
|
|
|
utils.Logger().Info().Int("staked-candidates", c). |
|
|
|
|
l.Int("staked-candidates", c). |
|
|
|
|
Str("total-staked-by-validators", totalStake.String()). |
|
|
|
|
RawJSON("staked-super-committee", []byte(shardState.String())). |
|
|
|
|
Msg("EPoS based super-committe") |
|
|
|
|
Msg("epos based super-committe") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return shardState, nil |
|
|
|
|