Skip to content

Commit

Permalink
Filter out jailed validators (#489)
Browse files Browse the repository at this point in the history
2 new fields were added to ValidatorDetail to identified  2 new attributes (jailed and inactive)

Co-authored-by: Cosmic Vagabond <121588426+cosmic-vagabond@users.noreply.github.com>
  • Loading branch information
fenriz07 and cosmic-vagabond authored May 16, 2024
1 parent 3035098 commit 8f18bd7
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 76 deletions.
4 changes: 4 additions & 0 deletions proto/elys/commitment/types_cw.proto
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ message ValidatorDetail {
// Only available if there's some and if address.
// is sent in request object.
BalanceAvailable staked = 6 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
//Is jailed
string jailed = 7;
//The validator status
string inactive = 8;
}

message StakingValidator {
Expand Down
4 changes: 3 additions & 1 deletion x/commitment/client/wasm/query_all_validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package wasm
import (
"encoding/json"
"math"
"strconv"

errorsmod "cosmossdk.io/errors"
cosmos_sdk_math "cosmossdk.io/math"
Expand Down Expand Up @@ -54,7 +55,8 @@ func (oq *Querier) BuildAllValidatorsResponseCW(ctx sdk.Context, allValidators [
UsdAmount: sdk.ZeroDec(),
}
validatorCW.Commission = validator.GetCommission()

validatorCW.Jailed = strconv.FormatBool(validator.Jailed)
validatorCW.Inactive = strconv.FormatBool(!validator.IsBonded())
// if there is delegation,
if isDelegated {
valAddress, err := sdk.ValAddressFromBech32(validator.OperatorAddress)
Expand Down
256 changes: 181 additions & 75 deletions x/commitment/types/types_cw.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8f18bd7

Please sign in to comment.