MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / RandValidator

Function RandValidator

types/validator.go:181–193  ·  view source on GitHub ↗

---------------------------------------- RandValidator RandValidator returns a randomized validator, useful for testing. UNSTABLE

(randPower bool, minPower int64)

Source from the content-addressed store, hash-verified

179// RandValidator returns a randomized validator, useful for testing.
180// UNSTABLE
181func RandValidator(randPower bool, minPower int64) (*Validator, PrivValidator) {
182 privVal := NewMockPV()
183 votePower := minPower
184 if randPower {
185 votePower += int64(tmrand.Uint32())
186 }
187 pubKey, err := privVal.GetPubKey()
188 if err != nil {
189 panic(fmt.Errorf("could not retrieve pubkey %w", err))
190 }
191 val := NewValidator(pubKey, votePower)
192 return val, privVal
193}

Callers 9

TestStoreLoadValidatorsFunction · 0.92
randGenesisDocFunction · 0.92
randGenesisDocFunction · 0.92
randGenesisDocFunction · 0.92
randGenesisDocFunction · 0.92
RandValidatorSetFunction · 0.85
TestValidatorProtoBufFunction · 0.85

Calls 4

GetPubKeyMethod · 0.95
NewMockPVFunction · 0.85
NewValidatorFunction · 0.85
Uint32Method · 0.65

Tested by 8

TestStoreLoadValidatorsFunction · 0.74
randGenesisDocFunction · 0.74
randGenesisDocFunction · 0.74
randGenesisDocFunction · 0.74
randGenesisDocFunction · 0.74
TestValidatorProtoBufFunction · 0.68