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

Function validateValidatorUpdates

state/execution.go:377–400  ·  view source on GitHub ↗
(abciUpdates []abci.ValidatorUpdate,
	params tmproto.ValidatorParams)

Source from the content-addressed store, hash-verified

375}
376
377func validateValidatorUpdates(abciUpdates []abci.ValidatorUpdate,
378 params tmproto.ValidatorParams) error {
379 for _, valUpdate := range abciUpdates {
380 if valUpdate.GetPower() < 0 {
381 return fmt.Errorf("voting power can't be negative %v", valUpdate)
382 } else if valUpdate.GetPower() == 0 {
383 // continue, since this is deleting the validator, and thus there is no
384 // pubkey to check
385 continue
386 }
387
388 // Check if validator's pubkey matches an ABCI type in the consensus params
389 pk, err := cryptoenc.PubKeyFromProto(valUpdate.PubKey)
390 if err != nil {
391 return err
392 }
393
394 if !types.IsValidPubkeyType(params, pk.Type()) {
395 return fmt.Errorf("validator %v is using pubkey %s, which is unsupported for consensus",
396 valUpdate, pk.Type())
397 }
398 }
399 return nil
400}
401
402// updateState returns a new State updated according to the header and responses.
403func updateState(

Callers 2

ApplyBlockMethod · 0.85
ValidateValidatorUpdatesFunction · 0.85

Calls 3

IsValidPubkeyTypeFunction · 0.92
TypeMethod · 0.65
GetPowerMethod · 0.45

Tested by 1

ValidateValidatorUpdatesFunction · 0.68