77 "sync"
88 "time"
99
10- ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3"
1110 "github.com/theckman/yacspin"
1211
1312 tmtypes "github.com/tendermint/tendermint/types"
@@ -31,6 +30,7 @@ import (
3130 dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3"
3231 etypes "github.com/akash-network/akash-api/go/node/escrow/v1beta3"
3332 mtypes "github.com/akash-network/akash-api/go/node/market/v1beta4"
33+ ptypes "github.com/akash-network/akash-api/go/node/provider/v1beta3"
3434
3535 "github.com/akash-network/node/x/audit"
3636 "github.com/akash-network/node/x/cert"
@@ -300,10 +300,6 @@ func (ga *GenesisState) validateBalances() error {
300300 return fmt .Errorf ("bonded pool balance is different from bonded coins: %s <-> %s" , notBondedBalance , notBondedCoins ) // nolint: goerr113
301301 }
302302
303- // if !notBondedBalance.IsEqual(notBondedCoins) {
304- // return fmt.Errorf("not bonded pool balance is different from not bonded coins: %s <-> %s", notBondedBalance, notBondedCoins) // nolint: goerr113
305- // }
306-
307303 return nil
308304}
309305
@@ -451,16 +447,10 @@ func (ga *AuthState) pack(cdc codec.Codec) error {
451447}
452448
453449func (ga * BankState ) unpack (cdc codec.Codec ) error {
454- var err error
455-
456450 ga .once .Do (func () {
457451 ga .state = banktypes .GetGenesisStateFromAppState (cdc , ga .gstate )
458452 })
459453
460- if err != nil {
461- return err
462- }
463-
464454 return nil
465455}
466456
@@ -482,16 +472,10 @@ func (ga *BankState) pack(cdc codec.Codec) error {
482472}
483473
484474func (ga * GovState ) unpack (cdc codec.Codec ) error {
485- var err error
486-
487475 ga .once .Do (func () {
488476 ga .state = GetGovGenesisStateFromAppState (cdc , ga .gstate )
489477 })
490478
491- if err != nil {
492- return err
493- }
494-
495479 return nil
496480}
497481
@@ -511,16 +495,10 @@ func (ga *GovState) pack(cdc codec.Codec) error {
511495}
512496
513497func (ga * IBCState ) unpack (cdc codec.Codec ) error {
514- var err error
515-
516498 ga .once .Do (func () {
517499 ga .state = GetIBCGenesisStateFromAppState (cdc , ga .gstate )
518500 })
519501
520- if err != nil {
521- return err
522- }
523-
524502 return nil
525503}
526504
@@ -540,16 +518,10 @@ func (ga *IBCState) pack(cdc codec.Codec) error {
540518}
541519
542520func (ga * StakingState ) unpack (cdc codec.Codec ) error {
543- var err error
544-
545521 ga .once .Do (func () {
546522 ga .state = stakingtypes .GetGenesisStateFromAppState (cdc , ga .gstate )
547523 })
548524
549- if err != nil {
550- return err
551- }
552-
553525 return nil
554526}
555527
@@ -569,16 +541,10 @@ func (ga *StakingState) pack(cdc codec.Codec) error {
569541}
570542
571543func (ga * SlashingState ) unpack (cdc codec.Codec ) error {
572- var err error
573-
574544 ga .once .Do (func () {
575545 ga .state = GetSlashingGenesisStateFromAppState (cdc , ga .gstate )
576546 })
577547
578- if err != nil {
579- return err
580- }
581-
582548 return nil
583549}
584550
@@ -598,16 +564,10 @@ func (ga *SlashingState) pack(cdc codec.Codec) error {
598564}
599565
600566func (ga * DistributionState ) unpack (cdc codec.Codec ) error {
601- var err error
602-
603567 ga .once .Do (func () {
604568 ga .state = GetDistributionGenesisStateFromAppState (cdc , ga .gstate )
605569 })
606570
607- if err != nil {
608- return err
609- }
610-
611571 return nil
612572}
613573
@@ -1063,7 +1023,10 @@ func (ga *GenesisState) ensureActiveSet(cdc codec.Codec) error {
10631023 }
10641024 }
10651025
1066- pubkey , _ := val .ConsPubKey ()
1026+ pubkey , err := val .ConsPubKey ()
1027+ if err != nil {
1028+ return err
1029+ }
10671030
10681031 tmPk , err := cryptocodec .ToTmPubKeyInterface (pubkey )
10691032 if err != nil {
@@ -1074,7 +1037,7 @@ func (ga *GenesisState) ensureActiveSet(cdc codec.Codec) error {
10741037 totalPower += power
10751038
10761039 vals = append (vals , tmtypes.GenesisValidator {
1077- Address : tmPk .Address (),
1040+ Address : sdk . ConsAddress ( tmPk .Address ()). Bytes (),
10781041 PubKey : tmPk ,
10791042 Power : power ,
10801043 Name : val .Description .Moniker ,
@@ -1096,7 +1059,6 @@ func (ga *GenesisState) ensureActiveSet(cdc codec.Codec) error {
10961059
10971060 ga .app .StakingState .state .LastTotalPower = sdk .NewInt (totalPower )
10981061 ga .app .StakingState .state .LastValidatorPowers = sPowers
1099-
11001062 sort .Sort (sort .Reverse (GenesisValidators (vals )))
11011063
11021064 ga .doc .Validators = vals
@@ -1176,6 +1138,8 @@ func (ga *GenesisState) AddNewValidator(
11761138 return err
11771139 }
11781140
1141+ consAddr := sdk .ConsAddress (pk .Address ())
1142+
11791143 pkAny , err := codectypes .NewAnyWithValue (pk )
11801144 if err != nil {
11811145 return err
@@ -1219,9 +1183,9 @@ func (ga *GenesisState) AddNewValidator(
12191183
12201184 ga .app .SlashingState .state .SigningInfos = append (ga .app .SlashingState .state .SigningInfos ,
12211185 slashingtypes.SigningInfo {
1222- Address : sdk . ConsAddress ( addr ) .String (),
1186+ Address : consAddr .String (),
12231187 ValidatorSigningInfo : slashingtypes.ValidatorSigningInfo {
1224- Address : sdk . ConsAddress ( addr ) .String (),
1188+ Address : consAddr .String (),
12251189 StartHeight : ga .doc .InitialHeight - 3 ,
12261190 IndexOffset : 0 ,
12271191 JailedUntil : time.Time {},
0 commit comments