forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
x/{distribution, staking, bank, mint, crisis} genesis protobuf migrat…
…ion (cosmos#6835) * distribution genesis types migrated to proto * removed types from types/genesis.go * fix lint * added new line proto * staking genesis migrated to proto * fix lint * x/bank: genesis types migrated to proto * fix lint * x/mint: genesis types changed to proto * x/crisis: genesis types changed to proto * Migrate genesis state of x/crisis * add new lines * whitespace * Fix bad merge * added missing field * fixed error Co-authored-by: sahith-narahari <[email protected]> Co-authored-by: Aaron Craelius <[email protected]> Co-authored-by: Aaron Craelius <[email protected]>
- Loading branch information
1 parent
2651427
commit b33b1e9
Showing
16 changed files
with
5,713 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
syntax = "proto3"; | ||
package cosmos.bank; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/cosmos.proto"; | ||
import "cosmos/bank/bank.proto"; | ||
|
||
option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types"; | ||
|
||
// GenesisState defines the bank module's genesis state. | ||
message GenesisState { | ||
Params params = 1 [ | ||
(gogoproto.casttype) = "Params", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
repeated Balance balances = 2 [ | ||
(gogoproto.casttype) = "Balance", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
repeated cosmos.Coin supply = 3 [ | ||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
repeated Metadata denom_metadata = 4 [ | ||
(gogoproto.casttype) = "Metadata", | ||
(gogoproto.moretags) = "yaml:\"denom_metadata\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
// Balance defines an account address and balance pair used in the bank module's | ||
// genesis state. | ||
message Balance { | ||
option (gogoproto.goproto_getters) = false; | ||
|
||
bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress"]; | ||
|
||
repeated cosmos.Coin coins = 2 [ | ||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", | ||
(gogoproto.nullable) = false | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
syntax = "proto3"; | ||
package cosmos.crisis; | ||
|
||
option go_package = "github.com/cosmos/cosmos-sdk/x/crisis/types"; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/cosmos.proto"; | ||
|
||
// GenesisState - genesis state of x/crisis | ||
message GenesisState { | ||
cosmos.Coin constant_fee = 3 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Coin", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"constant_fee\"" | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
syntax = "proto3"; | ||
package cosmos.distribution; | ||
|
||
option go_package = "github.com/cosmos/cosmos-sdk/x/distribution/types"; | ||
option (gogoproto.equal_all) = true; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/cosmos.proto"; | ||
import "cosmos/distribution/distribution.proto"; | ||
|
||
// genesis types | ||
|
||
// DelegatorWithdrawInfo | ||
// the address for where distributions rewards are withdrawn to by default | ||
// this struct is only used at genesis to feed in default withdraw addresses | ||
message DelegatorWithdrawInfo { | ||
bytes delegator_address = 1 [ | ||
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", | ||
(gogoproto.moretags) = "yaml:\"delegator_address\"" | ||
]; | ||
|
||
bytes withdraw_address = 2 [ | ||
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", | ||
(gogoproto.moretags) = "yaml:\"withdraw_address\"" | ||
]; | ||
} | ||
|
||
// ValidatorOutstandingRewardsRecord | ||
// used for import/export via genesis json | ||
message ValidatorOutstandingRewardsRecord { | ||
bytes validator_address = 1 [ | ||
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", | ||
(gogoproto.moretags) = "yaml:\"validator_address\"" | ||
]; | ||
|
||
repeated cosmos.DecCoin outstanding_rewards = 2 [ | ||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"outstanding_rewards\"" | ||
]; | ||
} | ||
|
||
// ValidatorAccumulatedCommissionRecord | ||
// used for import / export via genesis json | ||
message ValidatorAccumulatedCommissionRecord { | ||
bytes validator_address = 1 [ | ||
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", | ||
(gogoproto.moretags) = "yaml:\"validator_address\"" | ||
]; | ||
|
||
ValidatorAccumulatedCommission accumulated = 2 [ | ||
(gogoproto.casttype) = "ValidatorAccumulatedCommission", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"accumulated\"" | ||
]; | ||
} | ||
|
||
// ValidatorHistoricalRewardsRecord | ||
// used for import / export via genesis json | ||
message ValidatorHistoricalRewardsRecord { | ||
bytes validator_address = 1 [ | ||
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", | ||
(gogoproto.moretags) = "yaml:\"validator_address\"" | ||
]; | ||
|
||
uint64 period = 2; | ||
|
||
ValidatorHistoricalRewards rewards = 3[ | ||
(gogoproto.casttype) = "ValidatorHistoricalRewards", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"rewards\"" | ||
]; | ||
} | ||
|
||
// ValidatorCurrentRewardsRecord | ||
// used for import / export via genesis json | ||
message ValidatorCurrentRewardsRecord { | ||
bytes validator_address = 1 [ | ||
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", | ||
(gogoproto.moretags) = "yaml:\"validator_address\"" | ||
]; | ||
|
||
ValidatorCurrentRewards rewards = 2[ | ||
(gogoproto.casttype) = "ValidatorCurrentRewards", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"rewards\"" | ||
]; | ||
} | ||
|
||
// DelegatorStartingInfoRecord | ||
// used for import / export via genesis json | ||
message DelegatorStartingInfoRecord { | ||
bytes delegator_address = 1 [ | ||
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress", | ||
(gogoproto.moretags) = "yaml:\"delegator_address\"" | ||
]; | ||
|
||
bytes validator_address = 2 [ | ||
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", | ||
(gogoproto.moretags) = "yaml:\"validator_address\"" | ||
]; | ||
|
||
DelegatorStartingInfo starting_info = 3 [ | ||
(gogoproto.casttype) = "DelegatorStartingInfo", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"starting_info\"" | ||
]; | ||
} | ||
|
||
// ValidatorSlashEventRecord | ||
// used for import / export via genesis json | ||
message ValidatorSlashEventRecord { | ||
bytes validator_address = 1 [ | ||
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress", | ||
(gogoproto.moretags) = "yaml:\"validator_address\"" | ||
]; | ||
uint64 height = 2; | ||
uint64 period = 3; | ||
ValidatorSlashEvent event = 4 [ | ||
(gogoproto.casttype) = "ValidatorSlashEvent", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"event\"" | ||
]; | ||
} | ||
|
||
// GenesisState - all distribution state that must be provided at genesis | ||
message GenesisState { | ||
Params params = 1 [ | ||
(gogoproto.casttype) = "Params", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"params\"" | ||
]; | ||
|
||
FeePool fee_pool = 2 [ | ||
(gogoproto.casttype) = "FeePool", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"fee_pool\"" | ||
]; | ||
|
||
repeated DelegatorWithdrawInfo delegator_withdraw_infos = 3 [ | ||
(gogoproto.casttype) = "DelegatorWithdrawInfo", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"delegator_withdraw_infos\"" | ||
]; | ||
|
||
bytes previous_proposer = 4 [ | ||
(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ConsAddress", | ||
(gogoproto.moretags) = "yaml:\"previous_proposer\"" | ||
]; | ||
|
||
repeated ValidatorOutstandingRewardsRecord outstanding_rewards = 5 [ | ||
(gogoproto.casttype) = "ValidatorOutstandingRewardsRecord", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"outstanding_rewards\"" | ||
]; | ||
|
||
repeated ValidatorAccumulatedCommissionRecord validator_accumulated_commissions = 6 [ | ||
(gogoproto.casttype) = "ValidatorAccumulatedCommissionRecord", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"validator_accumulated_commissions\"" | ||
]; | ||
|
||
repeated ValidatorHistoricalRewardsRecord validator_historical_rewards = 7 [ | ||
(gogoproto.casttype) = "ValidatorHistoricalRewardsRecord", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"validator_historical_rewards\"" | ||
]; | ||
|
||
repeated ValidatorCurrentRewardsRecord validator_current_rewards = 8 [ | ||
(gogoproto.casttype) = "ValidatorCurrentRewardsRecord", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"validator_current_rewards\"" | ||
]; | ||
|
||
repeated DelegatorStartingInfoRecord delegator_starting_infos = 9 [ | ||
(gogoproto.casttype) = "DelegatorStartingInfoRecord", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"delegator_starting_infos\"" | ||
]; | ||
|
||
repeated ValidatorSlashEventRecord validator_slash_events = 10 [ | ||
(gogoproto.casttype) = "ValidatorSlashEventRecord", | ||
(gogoproto.nullable) = false, | ||
(gogoproto.moretags) = "yaml:\"validator_slash_events\"" | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
syntax = "proto3"; | ||
package cosmos.mint; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/mint/mint.proto"; | ||
|
||
option go_package = "github.com/cosmos/cosmos-sdk/x/mint/types"; | ||
|
||
// GenesisState - minter state | ||
message GenesisState { | ||
Minter minter = 1 [ | ||
(gogoproto.casttype) = "Minter", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
Params params = 2 [ | ||
(gogoproto.casttype) = "Params", | ||
(gogoproto.nullable) = false | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
syntax = "proto3"; | ||
package cosmos.staking; | ||
|
||
option go_package = "github.com/cosmos/cosmos-sdk/x/staking/types"; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/staking/staking.proto"; | ||
|
||
// GenesisState - all staking state that must be provided at genesis | ||
message GenesisState { | ||
Params params = 1 [(gogoproto.casttype) = "Params", (gogoproto.nullable) = false]; | ||
bytes last_total_power = 2 [ | ||
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", | ||
(gogoproto.moretags) = "yaml:\"last_total_power\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
repeated LastValidatorPower last_validator_powers = 3 [ | ||
(gogoproto.casttype) = "LastValidatorPower", | ||
(gogoproto.moretags) = "yaml:\"last_validator_powers\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
repeated Validator validators = 4 [ | ||
(gogoproto.casttype) = "Validator", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
repeated Delegation delegations = 5 [ | ||
(gogoproto.casttype) = "Delegation", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
repeated UnbondingDelegation unbonding_delegations = 6 [ | ||
(gogoproto.casttype) = "UnbondingDelegation", | ||
(gogoproto.moretags) = "yaml:\"unbonding_delegations\"", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
repeated Redelegation redelegations = 7 [ | ||
(gogoproto.casttype) = "Redelegation", | ||
(gogoproto.nullable) = false | ||
]; | ||
|
||
bool exported = 8; | ||
} | ||
|
||
// LastValidatorPower required for validator set update logic | ||
message LastValidatorPower { | ||
bytes address = 1 [(gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.ValAddress"]; | ||
int64 power = 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.