diff --git a/app/app.go b/app/app.go index 7f582883d8..7c236c9bc2 100644 --- a/app/app.go +++ b/app/app.go @@ -1,13 +1,14 @@ package app import ( - tokenregistrykeeper "github.com/Sifchain/sifnode/x/tokenregistry/keeper" - tmos "github.com/tendermint/tendermint/libs/os" "io" "math/big" "net/http" "os" + tokenregistrykeeper "github.com/Sifchain/sifnode/x/tokenregistry/keeper" + tmos "github.com/tendermint/tendermint/libs/os" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" @@ -55,6 +56,9 @@ import ( ibchost "github.com/cosmos/cosmos-sdk/x/ibc/core/24-host" ibckeeper "github.com/cosmos/cosmos-sdk/x/ibc/core/keeper" ibcmock "github.com/cosmos/cosmos-sdk/x/ibc/testing/mock" + "github.com/cosmos/cosmos-sdk/x/mint" + mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/cosmos/cosmos-sdk/x/params" paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" @@ -107,6 +111,7 @@ var ( bank.AppModuleBasic{}, capability.AppModuleBasic{}, staking.AppModuleBasic{}, + mint.AppModuleBasic{}, distr.AppModuleBasic{}, gov.NewAppModuleBasic( paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, @@ -128,6 +133,7 @@ var ( maccPerms = map[string][]string{ authtypes.FeeCollectorName: nil, distrtypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter}, stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner, authtypes.Staking}, @@ -173,6 +179,7 @@ type SifchainApp struct { GovKeeper govkeeper.Keeper StakingKeeper stakingkeeper.Keeper SlashingKeeper slashingkeeper.Keeper + MintKeeper mintkeeper.Keeper DistrKeeper distrkeeper.Keeper EvidenceKeeper evidencekeeper.Keeper IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly @@ -215,6 +222,7 @@ func NewSifApp( paramstypes.StoreKey, upgradetypes.StoreKey, govtypes.StoreKey, + minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, evidencetypes.StoreKey, @@ -271,6 +279,11 @@ func NewSifApp( appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName), ) + app.MintKeeper = mintkeeper.NewKeeper( + appCodec, keys[minttypes.StoreKey], app.GetSubspace(minttypes.ModuleName), &stakingKeeper, + app.AccountKeeper, app.BankKeeper, authtypes.FeeCollectorName, + ) + app.DistrKeeper = distrkeeper.NewKeeper( appCodec, keys[distrtypes.StoreKey], app.GetSubspace(distrtypes.ModuleName), app.AccountKeeper, app.BankKeeper, &stakingKeeper, authtypes.FeeCollectorName, app.ModuleAccountAddrs(), @@ -375,6 +388,7 @@ func NewSifApp( bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper), capability.NewAppModule(appCodec, *app.CapabilityKeeper), gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), + mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), @@ -395,9 +409,10 @@ func NewSifApp( // CanWithdrawInvariant invariant. app.mm.SetOrderBeginBlockers( capabilitytypes.ModuleName, + upgradetypes.ModuleName, + minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName, - upgradetypes.ModuleName, evidencetypes.ModuleName, stakingtypes.ModuleName, ibchost.ModuleName, @@ -419,6 +434,7 @@ func NewSifApp( slashingtypes.ModuleName, genutiltypes.ModuleName, govtypes.ModuleName, + minttypes.ModuleName, evidencetypes.ModuleName, ibchost.ModuleName, ibctransfertypes.ModuleName, @@ -607,6 +623,7 @@ func initParamsKeeper(appCodec codec.BinaryMarshaler, legacyAmino *codec.LegacyA paramsKeeper.Subspace(authtypes.ModuleName) paramsKeeper.Subspace(banktypes.ModuleName) paramsKeeper.Subspace(stakingtypes.ModuleName) + paramsKeeper.Subspace(minttypes.ModuleName) paramsKeeper.Subspace(distrtypes.ModuleName) paramsKeeper.Subspace(slashingtypes.ModuleName) paramsKeeper.Subspace(clptypes.ModuleName) diff --git a/app/setup_handlers.go b/app/setup_handlers.go index de6b2d5865..54d83b0294 100644 --- a/app/setup_handlers.go +++ b/app/setup_handlers.go @@ -1,24 +1,28 @@ package app import ( - tokenregistrymigrations "github.com/Sifchain/sifnode/x/tokenregistry/migrations" - tokenregistrytypes "github.com/Sifchain/sifnode/x/tokenregistry/types" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/mint" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) -const upgradeNameV095 = "0.9.5" +const upgradeName = "0.9.7" func SetupHandlers(app *SifchainApp) { - SetupHandlersForV095(app) + SetupHandlersForMint(app) } -func SetupHandlersForV095(app *SifchainApp) { - app.UpgradeKeeper.SetUpgradeHandler("0.9.5", func(ctx sdk.Context, plan types.Plan) { - app.Logger().Info("Running upgrade handler for " + upgradeNameV095 + " with new store " + tokenregistrytypes.StoreKey) - // Install initial token registry entries for non-ibc tokens. - tokenregistrymigrations.Init(ctx, app.TokenRegistryKeeper) +func SetupHandlersForMint(app *SifchainApp) { + app.UpgradeKeeper.SetUpgradeHandler(upgradeName, func(ctx sdk.Context, plan types.Plan) { + app.Logger().Info("Running upgrade handler for " + upgradeName + " with new store " + minttypes.StoreKey) + // Install initial params and minter for mint module. + mintGenesis := minttypes.DefaultGenesisState() + // Replace default MintDenom with staking bond denom. + mintGenesis.Params.MintDenom = app.StakingKeeper.GetParams(ctx).BondDenom + mint.InitGenesis(ctx, app.MintKeeper, app.AccountKeeper, mintGenesis) + }) upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() @@ -26,9 +30,9 @@ func SetupHandlersForV095(app *SifchainApp) { panic(err) } - if upgradeInfo.Name == upgradeNameV095 && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + if upgradeInfo.Name == upgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { storeUpgrades := storetypes.StoreUpgrades{ - Added: []string{tokenregistrytypes.StoreKey}, + Added: []string{minttypes.StoreKey}, } // Use upgrade store loader for the initial loading of all stores when app starts, diff --git a/cmd/sifnoded/cmd/migrate_test.go b/cmd/sifnoded/cmd/migrate_test.go index e53c575fbf..4a2e9ba3c3 100644 --- a/cmd/sifnoded/cmd/migrate_test.go +++ b/cmd/sifnoded/cmd/migrate_test.go @@ -16,7 +16,7 @@ func TestMigrateGenesisDataCmd(t *testing.T) { cmd, _ := NewRootCmd() migrateOutputBuf := new(bytes.Buffer) cmd.SetOut(migrateOutputBuf) - // This test file has been run through sifnoded migrate, and IBC state added. + // This test file has been run through sifnoded migrate, and IBC and Mint state added. cmd.SetArgs([]string{"migrate-data", "v0.9", "testdata/v039_exported_migrated_state.json"}) app.SetConfig(false) diff --git a/cmd/sifnoded/cmd/testdata/v039_exported_migrated_state.json b/cmd/sifnoded/cmd/testdata/v039_exported_migrated_state.json index 053f57d7e2..201f2efa32 100644 --- a/cmd/sifnoded/cmd/testdata/v039_exported_migrated_state.json +++ b/cmd/sifnoded/cmd/testdata/v039_exported_migrated_state.json @@ -1 +1,531 @@ -{"app_hash":"","app_state":{"ibc":{"client_genesis":{"clients":[],"clients_consensus":[],"create_localhost":false},"connection_genesis":{"connections":[],"client_connection_paths":[]},"channel_genesis":{"channels":[],"acknowledgements":[],"commitments":[],"receipts":[],"send_sequences":[],"recv_sequences":[],"ack_sequences":[]}},"transfer":{"port_id":"transfer","denom_traces":[],"params":{"send_enabled":false,"receive_enabled":false}},"capability":{"index":"1","owners":[]},"auth":{"accounts":[{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"1","address":"sif1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3sxxeku","pub_key":null,"sequence":"0"},"name":"bonded_tokens_pool","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"2","address":"sif1tygms3xhhs3yv487phx3dw4a95jn7t7lyx6gqg","pub_key":null,"sequence":"0"},"name":"not_bonded_tokens_pool","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"7","address":"sif10d07y265gmmuvt4z0w9aw880jnsr700jllunec","pub_key":null,"sequence":"0"},"name":"gov","permissions":["burner","staking"]},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"3","address":"sif1syavy2npfyt9tcncdtsdzf7kny9lh777yqc2nd","pub_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"AvUEsFHbsr40nTSmWh7CWYRZHGwf4cpRLtJlaRO4VAoq"},"sequence":"1"},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"0","address":"sif1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8zzt2x5","pub_key":null,"sequence":"0"},"name":"distribution","permissions":[]},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"5","address":"sif1kkdqp4dtqmc7wh59vchqr0zdzk8w2ydukjugkz","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.ModuleAccount","base_account":{"account_number":"8","address":"sif17xpfvakm2amg962yls6f84z3kell8c5l4yvkyk","pub_key":null,"sequence":"0"},"name":"fee_collector","permissions":[]},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"6","address":"sif17s95c5jpc6x2l3edwh4dm8yhac68yru7a7kr3x","pub_key":null,"sequence":"0"},{"@type":"/cosmos.auth.v1beta1.BaseAccount","account_number":"4","address":"sif1l7hypmqk2yc334vc6vmdwzp5sdefygj2ad93p5","pub_key":null,"sequence":"0"}],"params":{"max_memo_characters":"256","sig_verify_cost_ed25519":"590","sig_verify_cost_secp256k1":"1000","tx_sig_limit":"7","tx_size_cost_per_byte":"10"}},"bank":{"balances":[{"address":"sif1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3sxxeku","coins":[{"amount":"1000000000000000000000000","denom":"stake"}]},{"address":"sif1tygms3xhhs3yv487phx3dw4a95jn7t7lyx6gqg","coins":[]},{"address":"sif10d07y265gmmuvt4z0w9aw880jnsr700jllunec","coins":[]},{"address":"sif1syavy2npfyt9tcncdtsdzf7kny9lh777yqc2nd","coins":[{"amount":"500000000000000000000000","denom":"catk"},{"amount":"500000000000000000000000","denom":"cbtk"},{"amount":"500000000000000000000000","denom":"cdash"},{"amount":"500000000000000000000000","denom":"ceth"},{"amount":"500000000000000000000000","denom":"clink"},{"amount":"5000000000000000000000000000000","denom":"rowan"},{"amount":"989000000000000000000000000","denom":"stake"}]},{"address":"sif1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8zzt2x5","coins":[]},{"address":"sif1kkdqp4dtqmc7wh59vchqr0zdzk8w2ydukjugkz","coins":[{"amount":"5000000000000000000000000000000","denom":"rowan"}]},{"address":"sif17xpfvakm2amg962yls6f84z3kell8c5l4yvkyk","coins":[]},{"address":"sif17s95c5jpc6x2l3edwh4dm8yhac68yru7a7kr3x","coins":[{"amount":"100000000000000000000000","denom":"rowan"}]},{"address":"sif1l7hypmqk2yc334vc6vmdwzp5sdefygj2ad93p5","coins":[{"amount":"500000000000000000000000","denom":"catk"},{"amount":"500000000000000000000000","denom":"cbtk"},{"amount":"500000000000000000000000","denom":"cdash"},{"amount":"500000000000000000000000","denom":"ceth"},{"amount":"500000000000000000000000","denom":"clink"},{"amount":"5000000000000000000000000000000","denom":"rowan"},{"amount":"990000000000000000000000000","denom":"stake"}]}],"denom_metadata":[],"params":{"default_send_enabled":true,"send_enabled":[]},"supply":[{"amount":"1000000000000000000000000","denom":"catk"},{"amount":"1000000000000000000000000","denom":"cbtk"},{"amount":"1000000000000000000000000","denom":"cdash"},{"amount":"1000000000000000000000000","denom":"ceth"},{"amount":"1000000000000000000000000","denom":"clink"},{"amount":"15000000100000000000000000000000","denom":"rowan"},{"amount":"1980000000000000000000000000","denom":"stake"}]},"clp":{"address_whitelist":["sif1ny48eeuk4dm9f63dy0lwfgjhnvud9yvtzkhtjq","sif1syavy2npfyt9tcncdtsdzf7kny9lh777yqc2nd","sif1l7hypmqk2yc334vc6vmdwzp5sdefygj2ad93p5"],"liquidity_provider_list":null,"params":{"min_create_pool_threshold":"100"},"pool_list":null},"dispensation":{},"distribution":{"delegator_starting_infos":[{"delegator_address":"sif1syavy2npfyt9tcncdtsdzf7kny9lh777yqc2nd","starting_info":{"height":"0","previous_period":"1","stake":"1000000000000000000000000.000000000000000000"},"validator_address":"sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna"}],"delegator_withdraw_infos":[],"fee_pool":{"community_pool":[]},"outstanding_rewards":[{"outstanding_rewards":[],"validator_address":"sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna"}],"params":{"base_proposer_reward":"0.010000000000000000","bonus_proposer_reward":"0.040000000000000000","community_tax":"0.020000000000000000","withdraw_addr_enabled":true},"previous_proposer":"sifvalcons19nf44j47mssrgd76frpgc75jpk50ru4shyut55","validator_accumulated_commissions":[{"accumulated":{"commission":[]},"validator_address":"sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna"}],"validator_current_rewards":[{"rewards":{"period":"2","rewards":[]},"validator_address":"sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna"}],"validator_historical_rewards":[{"period":"1","rewards":{"cumulative_reward_ratio":[],"reference_count":2},"validator_address":"sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna"}],"validator_slash_events":[]},"ethbridge":{"ceth_receiver_account":"","peggy_tokens":[]},"faucet":{},"genutil":{"gen_txs":[]},"gov":{"deposit_params":{"max_deposit_period":"172800s","min_deposit":[{"amount":"10000000","denom":"stake"}]},"deposits":[],"proposals":[],"starting_proposal_id":"1","tally_params":{"quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000"},"votes":[],"voting_params":{"voting_period":"172800s"}},"oracle":{"address_whitelist":["sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna"],"admin_address":""},"slashing":{"missed_blocks":[{"address":"sifvalcons19nf44j47mssrgd76frpgc75jpk50ru4shyut55","missed_blocks":[]}],"params":{"downtime_jail_duration":"600s","min_signed_per_window":"0.500000000000000000","signed_blocks_window":"100","slash_fraction_double_sign":"0.050000000000000000","slash_fraction_downtime":"0.010000000000000000"},"signing_infos":[{"address":"sifvalcons19nf44j47mssrgd76frpgc75jpk50ru4shyut55","validator_signing_info":{"address":"sifvalcons19nf44j47mssrgd76frpgc75jpk50ru4shyut55","index_offset":"5","jailed_until":"1970-01-01T00:00:00Z","missed_blocks_counter":"0","start_height":"0","tombstoned":false}}]},"staking":{"delegations":[{"delegator_address":"sif1syavy2npfyt9tcncdtsdzf7kny9lh777yqc2nd","shares":"1000000000000000000000000.000000000000000000","validator_address":"sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna"}],"exported":true,"last_total_power":"1000000","last_validator_powers":[{"address":"sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna","power":"1000000"}],"params":{"bond_denom":"stake","historical_entries":0,"max_entries":7,"max_validators":100,"unbonding_time":"1814400s"},"redelegations":[],"unbonding_delegations":[],"validators":[{"commission":{"commission_rates":{"max_change_rate":"0.010000000000000000","max_rate":"0.200000000000000000","rate":"0.100000000000000000"},"update_time":"2021-05-25T14:55:08.824942Z"},"consensus_pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"zM9+uFjL8GUzB757iOQre7ydPNoVRDBlYqFcOSlmqZM="},"delegator_shares":"1000000000000000000000000.000000000000000000","description":{"details":"","identity":"","moniker":"test","security_contact":"","website":""},"jailed":false,"min_self_delegation":"1","operator_address":"sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna","status":"BOND_STATUS_BONDED","tokens":"1000000000000000000000000","unbonding_height":"0","unbonding_time":"1970-01-01T00:00:00Z"}]},"upgrade":{}},"chain_id":"localnet","consensus_params":{"block":{"max_bytes":"22020096","max_gas":"-1","time_iota_ms":"1000"},"evidence":{"max_age_duration":"172800000000000","max_age_num_blocks":"100000"},"validator":{"pub_key_types":["ed25519"]},"version":{}},"genesis_time":"2021-05-25T14:55:08.824942Z","initial_height":"1","validators":[{"address":"2CD35ACABEDC203437DA48C28C7A920DA8F1F2B0","name":"test","power":"1000000","pub_key":{"type":"tendermint/PubKeyEd25519","value":"zM9+uFjL8GUzB757iOQre7ydPNoVRDBlYqFcOSlmqZM="}}]} +{ + "app_hash": "", + "app_state": { + "mint": { + "minter": { + "annual_provisions": "0.000000000000000000", + "inflation": "0.130000000000000000" + }, + "params": { + "blocks_per_year": "6311520", + "goal_bonded": "0.670000000000000000", + "inflation_max": "0.200000000000000000", + "inflation_min": "0.070000000000000000", + "inflation_rate_change": "0.130000000000000000", + "mint_denom": "stake" + } + }, + "ibc": { + "client_genesis": { + "clients": [], + "clients_consensus": [], + "create_localhost": false + }, + "connection_genesis": { + "connections": [], + "client_connection_paths": [] + }, + "channel_genesis": { + "channels": [], + "acknowledgements": [], + "commitments": [], + "receipts": [], + "send_sequences": [], + "recv_sequences": [], + "ack_sequences": [] + } + }, + "transfer": { + "port_id": "transfer", + "denom_traces": [], + "params": { + "send_enabled": false, + "receive_enabled": false + } + }, + "capability": { + "index": "1", + "owners": [] + }, + "auth": { + "accounts": [ + { + "@type": "/cosmos.auth.v1beta1.ModuleAccount", + "base_account": { + "account_number": "1", + "address": "sif1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3sxxeku", + "pub_key": null, + "sequence": "0" + }, + "name": "bonded_tokens_pool", + "permissions": [ + "burner", + "staking" + ] + }, + { + "@type": "/cosmos.auth.v1beta1.ModuleAccount", + "base_account": { + "account_number": "2", + "address": "sif1tygms3xhhs3yv487phx3dw4a95jn7t7lyx6gqg", + "pub_key": null, + "sequence": "0" + }, + "name": "not_bonded_tokens_pool", + "permissions": [ + "burner", + "staking" + ] + }, + { + "@type": "/cosmos.auth.v1beta1.ModuleAccount", + "base_account": { + "account_number": "7", + "address": "sif10d07y265gmmuvt4z0w9aw880jnsr700jllunec", + "pub_key": null, + "sequence": "0" + }, + "name": "gov", + "permissions": [ + "burner", + "staking" + ] + }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "3", + "address": "sif1syavy2npfyt9tcncdtsdzf7kny9lh777yqc2nd", + "pub_key": { + "@type": "/cosmos.crypto.secp256k1.PubKey", + "key": "AvUEsFHbsr40nTSmWh7CWYRZHGwf4cpRLtJlaRO4VAoq" + }, + "sequence": "1" + }, + { + "@type": "/cosmos.auth.v1beta1.ModuleAccount", + "base_account": { + "account_number": "0", + "address": "sif1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8zzt2x5", + "pub_key": null, + "sequence": "0" + }, + "name": "distribution", + "permissions": [] + }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "5", + "address": "sif1kkdqp4dtqmc7wh59vchqr0zdzk8w2ydukjugkz", + "pub_key": null, + "sequence": "0" + }, + { + "@type": "/cosmos.auth.v1beta1.ModuleAccount", + "base_account": { + "account_number": "8", + "address": "sif17xpfvakm2amg962yls6f84z3kell8c5l4yvkyk", + "pub_key": null, + "sequence": "0" + }, + "name": "fee_collector", + "permissions": [] + }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "6", + "address": "sif17s95c5jpc6x2l3edwh4dm8yhac68yru7a7kr3x", + "pub_key": null, + "sequence": "0" + }, + { + "@type": "/cosmos.auth.v1beta1.BaseAccount", + "account_number": "4", + "address": "sif1l7hypmqk2yc334vc6vmdwzp5sdefygj2ad93p5", + "pub_key": null, + "sequence": "0" + } + ], + "params": { + "max_memo_characters": "256", + "sig_verify_cost_ed25519": "590", + "sig_verify_cost_secp256k1": "1000", + "tx_sig_limit": "7", + "tx_size_cost_per_byte": "10" + } + }, + "bank": { + "balances": [ + { + "address": "sif1fl48vsnmsdzcv85q5d2q4z5ajdha8yu3sxxeku", + "coins": [ + { + "amount": "1000000000000000000000000", + "denom": "stake" + } + ] + }, + { + "address": "sif1tygms3xhhs3yv487phx3dw4a95jn7t7lyx6gqg", + "coins": [] + }, + { + "address": "sif10d07y265gmmuvt4z0w9aw880jnsr700jllunec", + "coins": [] + }, + { + "address": "sif1syavy2npfyt9tcncdtsdzf7kny9lh777yqc2nd", + "coins": [ + { + "amount": "500000000000000000000000", + "denom": "catk" + }, + { + "amount": "500000000000000000000000", + "denom": "cbtk" + }, + { + "amount": "500000000000000000000000", + "denom": "cdash" + }, + { + "amount": "500000000000000000000000", + "denom": "ceth" + }, + { + "amount": "500000000000000000000000", + "denom": "clink" + }, + { + "amount": "5000000000000000000000000000000", + "denom": "rowan" + }, + { + "amount": "989000000000000000000000000", + "denom": "stake" + } + ] + }, + { + "address": "sif1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8zzt2x5", + "coins": [] + }, + { + "address": "sif1kkdqp4dtqmc7wh59vchqr0zdzk8w2ydukjugkz", + "coins": [ + { + "amount": "5000000000000000000000000000000", + "denom": "rowan" + } + ] + }, + { + "address": "sif17xpfvakm2amg962yls6f84z3kell8c5l4yvkyk", + "coins": [] + }, + { + "address": "sif17s95c5jpc6x2l3edwh4dm8yhac68yru7a7kr3x", + "coins": [ + { + "amount": "100000000000000000000000", + "denom": "rowan" + } + ] + }, + { + "address": "sif1l7hypmqk2yc334vc6vmdwzp5sdefygj2ad93p5", + "coins": [ + { + "amount": "500000000000000000000000", + "denom": "catk" + }, + { + "amount": "500000000000000000000000", + "denom": "cbtk" + }, + { + "amount": "500000000000000000000000", + "denom": "cdash" + }, + { + "amount": "500000000000000000000000", + "denom": "ceth" + }, + { + "amount": "500000000000000000000000", + "denom": "clink" + }, + { + "amount": "5000000000000000000000000000000", + "denom": "rowan" + }, + { + "amount": "990000000000000000000000000", + "denom": "stake" + } + ] + } + ], + "denom_metadata": [], + "params": { + "default_send_enabled": true, + "send_enabled": [] + }, + "supply": [ + { + "amount": "1000000000000000000000000", + "denom": "catk" + }, + { + "amount": "1000000000000000000000000", + "denom": "cbtk" + }, + { + "amount": "1000000000000000000000000", + "denom": "cdash" + }, + { + "amount": "1000000000000000000000000", + "denom": "ceth" + }, + { + "amount": "1000000000000000000000000", + "denom": "clink" + }, + { + "amount": "15000000100000000000000000000000", + "denom": "rowan" + }, + { + "amount": "1980000000000000000000000000", + "denom": "stake" + } + ] + }, + "clp": { + "address_whitelist": [ + "sif1ny48eeuk4dm9f63dy0lwfgjhnvud9yvtzkhtjq", + "sif1syavy2npfyt9tcncdtsdzf7kny9lh777yqc2nd", + "sif1l7hypmqk2yc334vc6vmdwzp5sdefygj2ad93p5" + ], + "liquidity_provider_list": null, + "params": { + "min_create_pool_threshold": "100" + }, + "pool_list": null + }, + "dispensation": {}, + "distribution": { + "delegator_starting_infos": [ + { + "delegator_address": "sif1syavy2npfyt9tcncdtsdzf7kny9lh777yqc2nd", + "starting_info": { + "height": "0", + "previous_period": "1", + "stake": "1000000000000000000000000.000000000000000000" + }, + "validator_address": "sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna" + } + ], + "delegator_withdraw_infos": [], + "fee_pool": { + "community_pool": [] + }, + "outstanding_rewards": [ + { + "outstanding_rewards": [], + "validator_address": "sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna" + } + ], + "params": { + "base_proposer_reward": "0.010000000000000000", + "bonus_proposer_reward": "0.040000000000000000", + "community_tax": "0.020000000000000000", + "withdraw_addr_enabled": true + }, + "previous_proposer": "sifvalcons19nf44j47mssrgd76frpgc75jpk50ru4shyut55", + "validator_accumulated_commissions": [ + { + "accumulated": { + "commission": [] + }, + "validator_address": "sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna" + } + ], + "validator_current_rewards": [ + { + "rewards": { + "period": "2", + "rewards": [] + }, + "validator_address": "sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna" + } + ], + "validator_historical_rewards": [ + { + "period": "1", + "rewards": { + "cumulative_reward_ratio": [], + "reference_count": 2 + }, + "validator_address": "sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna" + } + ], + "validator_slash_events": [] + }, + "ethbridge": { + "ceth_receiver_account": "", + "peggy_tokens": [] + }, + "faucet": {}, + "genutil": { + "gen_txs": [] + }, + "gov": { + "deposit_params": { + "max_deposit_period": "172800s", + "min_deposit": [ + { + "amount": "10000000", + "denom": "stake" + } + ] + }, + "deposits": [], + "proposals": [], + "starting_proposal_id": "1", + "tally_params": { + "quorum": "0.334000000000000000", + "threshold": "0.500000000000000000", + "veto_threshold": "0.334000000000000000" + }, + "votes": [], + "voting_params": { + "voting_period": "172800s" + } + }, + "oracle": { + "address_whitelist": [ + "sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna" + ], + "admin_address": "" + }, + "slashing": { + "missed_blocks": [ + { + "address": "sifvalcons19nf44j47mssrgd76frpgc75jpk50ru4shyut55", + "missed_blocks": [] + } + ], + "params": { + "downtime_jail_duration": "600s", + "min_signed_per_window": "0.500000000000000000", + "signed_blocks_window": "100", + "slash_fraction_double_sign": "0.050000000000000000", + "slash_fraction_downtime": "0.010000000000000000" + }, + "signing_infos": [ + { + "address": "sifvalcons19nf44j47mssrgd76frpgc75jpk50ru4shyut55", + "validator_signing_info": { + "address": "sifvalcons19nf44j47mssrgd76frpgc75jpk50ru4shyut55", + "index_offset": "5", + "jailed_until": "1970-01-01T00:00:00Z", + "missed_blocks_counter": "0", + "start_height": "0", + "tombstoned": false + } + } + ] + }, + "staking": { + "delegations": [ + { + "delegator_address": "sif1syavy2npfyt9tcncdtsdzf7kny9lh777yqc2nd", + "shares": "1000000000000000000000000.000000000000000000", + "validator_address": "sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna" + } + ], + "exported": true, + "last_total_power": "1000000", + "last_validator_powers": [ + { + "address": "sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna", + "power": "1000000" + } + ], + "params": { + "bond_denom": "stake", + "historical_entries": 0, + "max_entries": 7, + "max_validators": 100, + "unbonding_time": "1814400s" + }, + "redelegations": [], + "unbonding_delegations": [], + "validators": [ + { + "commission": { + "commission_rates": { + "max_change_rate": "0.010000000000000000", + "max_rate": "0.200000000000000000", + "rate": "0.100000000000000000" + }, + "update_time": "2021-05-25T14:55:08.824942Z" + }, + "consensus_pubkey": { + "@type": "/cosmos.crypto.ed25519.PubKey", + "key": "zM9+uFjL8GUzB757iOQre7ydPNoVRDBlYqFcOSlmqZM=" + }, + "delegator_shares": "1000000000000000000000000.000000000000000000", + "description": { + "details": "", + "identity": "", + "moniker": "test", + "security_contact": "", + "website": "" + }, + "jailed": false, + "min_self_delegation": "1", + "operator_address": "sifvaloper1syavy2npfyt9tcncdtsdzf7kny9lh777dzsqna", + "status": "BOND_STATUS_BONDED", + "tokens": "1000000000000000000000000", + "unbonding_height": "0", + "unbonding_time": "1970-01-01T00:00:00Z" + } + ] + }, + "upgrade": {} + }, + "chain_id": "localnet", + "consensus_params": { + "block": { + "max_bytes": "22020096", + "max_gas": "-1", + "time_iota_ms": "1000" + }, + "evidence": { + "max_age_duration": "172800000000000", + "max_age_num_blocks": "100000" + }, + "validator": { + "pub_key_types": [ + "ed25519" + ] + }, + "version": {} + }, + "genesis_time": "2021-05-25T14:55:08.824942Z", + "initial_height": "1", + "validators": [ + { + "address": "2CD35ACABEDC203437DA48C28C7A920DA8F1F2B0", + "name": "test", + "power": "1000000", + "pub_key": { + "type": "tendermint/PubKeyEd25519", + "value": "zM9+uFjL8GUzB757iOQre7ydPNoVRDBlYqFcOSlmqZM=" + } + } + ] +} + diff --git a/tools/sifgen/common/types/genesis.go b/tools/sifgen/common/types/genesis.go index f6fd4c6023..b4fcdc5709 100644 --- a/tools/sifgen/common/types/genesis.go +++ b/tools/sifgen/common/types/genesis.go @@ -245,6 +245,25 @@ type Gov struct { TallyParams GovTallyParams `json:"tally_params"` } +type Minter struct { + Inflation string `json:"inflation"` + AnnualProvisions string `json:"annual_provisions"` +} + +type MintParams struct { + MintDenom string `json:"mint_denom"` + InflationRateChange string `json:"inflation_rate_change"` + InflationMax string `json:"inflation_max"` + InflationMin string `json:"inflation_min"` + GoalBonded string `json:"goal_bonded"` + BlocksPerYear string `json:"blocks_per_year"` +} + +type Mint struct { + Minter Minter `json:"minter"` + Params MintParams `json:"params"` +} + type ClientGenesisParams struct { AllowedClients []string `json:"allowed_clients"` } @@ -338,6 +357,7 @@ type AppState struct { Distribution Distribution `json:"distribution"` Staking Staking `json:"staking"` Gov Gov `json:"gov"` + Mint Mint `json:"mint"` Slashing Slashing `json:"slashing"` Auth Auth `json:"auth"` Bank Bank `json:"bank"` diff --git a/tools/sifgen/genesis/genesis.go b/tools/sifgen/genesis/genesis.go index 7f6e620fcd..951c61c9aa 100644 --- a/tools/sifgen/genesis/genesis.go +++ b/tools/sifgen/genesis/genesis.go @@ -19,7 +19,25 @@ func ReplaceStakingBondDenom(nodeHomeDir string) error { } genesis.AppState.Staking.Params.BondDenom = common.StakeTokenDenom + content, err := tmjson.Marshal(genesis) + if err != nil { + return err + } + + if err := writeGenesis(nodeHomeDir, content); err != nil { + return err + } + + return nil +} + +func ReplaceMintBondDenom(nodeHomeDir string) error { + genesis, err := readGenesis(nodeHomeDir) + if err != nil { + return err + } + genesis.AppState.Mint.Params.MintDenom = common.StakeTokenDenom content, err := tmjson.Marshal(genesis) if err != nil { return err diff --git a/tools/sifgen/network/network.go b/tools/sifgen/network/network.go index 47fe533ede..2aee79c5a9 100644 --- a/tools/sifgen/network/network.go +++ b/tools/sifgen/network/network.go @@ -104,6 +104,10 @@ func (n *Network) Build(count int, outputDir, seedIPv4Addr string) (*string, err return nil, err } + if err := genesis.ReplaceMintBondDenom(validator.NodeHomeDir); err != nil { + return nil, err + } + if err := n.setValidatorID(validator); err != nil { return nil, err } diff --git a/version b/version index 03834411d1..c81aa44afb 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.9.5 \ No newline at end of file +0.9.7