Skip to content

Commit

Permalink
reverted validator check
Browse files Browse the repository at this point in the history
  • Loading branch information
abi87 committed Sep 30, 2024
1 parent f943e95 commit b679d11
Showing 1 changed file with 23 additions and 26 deletions.
49 changes: 23 additions & 26 deletions mod/consensus/pkg/cometbft/service/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,34 +112,31 @@ func (s *Service[LoggerT]) InitChain(
}

// check validators
if len(resValidators) == 0 {
return nil, errors.New(
"application init chain handler returned no validators",
)
}
if len(req.Validators) != len(resValidators) {
return nil, fmt.Errorf(
"len(RequestInitChain.Validators) != len(GenesisValidators) (%d != %d)",
len(req.Validators),
len(resValidators),
)
}

sort.Sort(cmtabci.ValidatorUpdates(req.Validators))

for i := range resValidators {
if req.Validators[i].Power != resValidators[i].Power {
return nil, errors.New("mismatched power")
}
if !bytes.Equal(
req.Validators[i].PubKeyBytes, resValidators[i].
PubKeyBytes) {
return nil, errors.New("mismatched pubkey bytes")
if len(req.Validators) > 0 {
if len(req.Validators) != len(resValidators) {
return nil, fmt.Errorf(
"len(RequestInitChain.Validators) != len(GenesisValidators) (%d != %d)",
len(req.Validators),
len(resValidators),
)
}

if req.Validators[i].PubKeyType !=
resValidators[i].PubKeyType {
return nil, errors.New("mismatched pubkey types")
sort.Sort(cmtabci.ValidatorUpdates(req.Validators))

for i := range resValidators {
if req.Validators[i].Power != resValidators[i].Power {
return nil, errors.New("mismatched power")
}
if !bytes.Equal(
req.Validators[i].PubKeyBytes, resValidators[i].
PubKeyBytes) {
return nil, errors.New("mismatched pubkey bytes")
}

if req.Validators[i].PubKeyType !=
resValidators[i].PubKeyType {
return nil, errors.New("mismatched pubkey types")
}
}
}

Expand Down

0 comments on commit b679d11

Please sign in to comment.