Revert unnecessary config patch (#323)

* Revert "feat: bring back config parameters"

This reverts commit 4ab279033cae5e351cd13c348a21e4717705f341.

Unnecessary because cosmos sdk handles chain upgrades properly: it holds
the chain and waits for a new binary version.

* refactor: use testnet parameters as default in x/dao
---------

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
This commit is contained in:
Julian Strobl 2024-02-26 12:25:12 +01:00 committed by GitHub
parent ec697840de
commit b1c4d11ccf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 28 additions and 133 deletions

View File

@ -12,69 +12,34 @@ const DefaultConfigTemplate = `
############################################################################### ###############################################################################
[planetmint] [planetmint]
asset-registry-domain = "{{ .PlmntConfig.AssetRegistryDomain }}"
asset-registry-path = "{{ .PlmntConfig.AssetRegistryPath }}"
asset-registry-scheme = "{{ .PlmntConfig.AssetRegistryScheme}}"
claim-address = "{{ .PlmntConfig.ClaimAddress }}"
claim-denom = "{{ .PlmntConfig.ClaimDenom }}"
distribution-address-dao = "{{ .PlmntConfig.DistributionAddrDAO }}"
distribution-address-early-inv = "{{ .PlmntConfig.DistributionAddrEarlyInv }}"
distribution-address-investor = "{{ .PlmntConfig.DistributionAddrInvestor }}"
distribution-address-pop = "{{ .PlmntConfig.DistributionAddrPop }}"
distribution-address-strategic = "{{ .PlmntConfig.DistributionAddrStrategic }}"
distribution-offset = {{ .PlmntConfig.DistributionOffset }}
mqtt-response-timeout = {{ .PlmntConfig.MqttResponseTimeout }}
pop-epochs = {{ .PlmntConfig.PopEpochs }}
reissuance-asset = "{{ .PlmntConfig.ReissuanceAsset }}"
reissuance-epochs = {{ .PlmntConfig.ReissuanceEpochs }}
rpc-host = "{{ .PlmntConfig.RPCHost }}" rpc-host = "{{ .PlmntConfig.RPCHost }}"
rpc-port = {{ .PlmntConfig.RPCPort }} rpc-port = {{ .PlmntConfig.RPCPort }}
rpc-user = "{{ .PlmntConfig.RPCUser }}" rpc-user = "{{ .PlmntConfig.RPCUser }}"
rpc-password = "{{ .PlmntConfig.RPCPassword }}" rpc-password = "{{ .PlmntConfig.RPCPassword }}"
rpc-scheme = "{{ .PlmntConfig.RPCScheme }}" rpc-scheme = "{{ .PlmntConfig.RPCScheme }}"
rpc-wallet = "{{ .PlmntConfig.RPCWallet }}" rpc-wallet = "{{ .PlmntConfig.RPCWallet }}"
staged-denom = "{{ .PlmntConfig.StagedDenom }}"
token-denom = "{{ .PlmntConfig.TokenDenom }}"
tx-gas-limit = {{ .PlmntConfig.TxGasLimit }}
validator-address = "{{ .PlmntConfig.ValidatorAddress }}" validator-address = "{{ .PlmntConfig.ValidatorAddress }}"
mqtt-domain = "{{ .PlmntConfig.MqttDomain }}" mqtt-domain = "{{ .PlmntConfig.MqttDomain }}"
mqtt-port = {{ .PlmntConfig.MqttPort }} mqtt-port = {{ .PlmntConfig.MqttPort }}
mqtt-user = "{{ .PlmntConfig.MqttUser }}" mqtt-user = "{{ .PlmntConfig.MqttUser }}"
mqtt-password = "{{ .PlmntConfig.MqttPassword }}" mqtt-password = "{{ .PlmntConfig.MqttPassword }}"
` `
// Config defines Planetmint's top level configuration // Config defines Planetmint's top level configuration
type Config struct { type Config struct {
AssetRegistryDomain string `json:"asset-registry-domain" mapstructure:"asset-registry-domain"` ConfigRootDir string `json:"config-root-dir" mapstructure:"config-root-dir"`
AssetRegistryPath string `json:"asset-registry-path" mapstructure:"asset-registry-path"` RPCHost string `json:"rpc-host" mapstructure:"rpc-host"`
AssetRegistryScheme string `json:"asset-registry-scheme" mapstructure:"asset-registry-scheme"` RPCPort int `json:"rpc-port" mapstructure:"rpc-port"`
ClaimAddress string `json:"claim-address" mapstructure:"claim-address"` RPCUser string `json:"rpc-user" mapstructure:"rpc-user"`
ClaimDenom string `json:"claim-denom" mapstructure:"claim-denom"` RPCPassword string `json:"rpc-password" mapstructure:"rpc-password"`
ConfigRootDir string `json:"config-root-dir" mapstructure:"config-root-dir"` RPCScheme string `json:"rpc-scheme" mapstructure:"rpc-scheme"`
DistributionAddrDAO string `json:"distribution-addr-dao" mapstructure:"distribution-addr-dao"` RPCWallet string `json:"rpc-wallet" mapstructure:"rpc-wallet"`
DistributionAddrEarlyInv string `json:"distribution-addr-early-inv" mapstructure:"distribution-addr-early-inv"` ValidatorAddress string `json:"validator-address" mapstructure:"validator-address"`
DistributionAddrInvestor string `json:"distribution-addr-investor" mapstructure:"distribution-addr-investor"` MqttDomain string `json:"mqtt-domain" mapstructure:"mqtt-domain"`
DistributionAddrPop string `json:"distribution-addr-pop" mapstructure:"distribution-addr-pop"` MqttPort int `json:"mqtt-port" mapstructure:"mqtt-port"`
DistributionAddrStrategic string `json:"distribution-addr-strategic" mapstructure:"distribution-addr-strategic"` MqttUser string `json:"mqtt-user" mapstructure:"mqtt-user"`
DistributionOffset int `json:"distribution-offset" mapstructure:"distribution-offset"` MqttPassword string `json:"mqtt-password" mapstructure:"mqtt-password"`
MqttDomain string `json:"mqtt-domain" mapstructure:"mqtt-domain"`
MqttPassword string `json:"mqtt-password" mapstructure:"mqtt-password"`
MqttPort int `json:"mqtt-port" mapstructure:"mqtt-port"`
MqttResponseTimeout int `json:"mqtt-response-timeout" mapstructure:"mqtt-response-timeout"`
MqttUser string `json:"mqtt-user" mapstructure:"mqtt-user"`
PopEpochs int `json:"pop-epochs" mapstructure:"pop-epochs"`
RPCHost string `json:"rpc-host" mapstructure:"rpc-host"`
RPCPassword string `json:"rpc-password" mapstructure:"rpc-password"`
RPCPort int `json:"rpc-port" mapstructure:"rpc-port"`
RPCScheme string `json:"rpc-scheme" mapstructure:"rpc-scheme"`
RPCUser string `json:"rpc-user" mapstructure:"rpc-user"`
RPCWallet string `json:"rpc-wallet" mapstructure:"rpc-wallet"`
ReissuanceAsset string `json:"reissuance-asset" mapstructure:"reissuance-asset"`
ReissuanceEpochs int `json:"reissuance-epochs" mapstructure:"reissuance-epochs"`
StagedDenom string `json:"staged-denom" mapstructure:"staged-denom"`
TokenDenom string `json:"token-denom" mapstructure:"token-denom"`
TxGasLimit int `json:"tx-gas-limit" mapstructure:"tx-gas-limit"`
ValidatorAddress string `json:"validator-address" mapstructure:"validator-address"`
} }
// cosmos-sdk wide global singleton // cosmos-sdk wide global singleton
@ -86,43 +51,18 @@ var (
// DefaultConfig returns planetmint's default configuration. // DefaultConfig returns planetmint's default configuration.
func DefaultConfig() *Config { func DefaultConfig() *Config {
return &Config{ return &Config{
AssetRegistryDomain: "testnet-assets.rddl.io", ConfigRootDir: "",
AssetRegistryPath: "register_asset", RPCHost: "localhost",
AssetRegistryScheme: "https", RPCPort: 18884,
ClaimAddress: "plmnt1w5dww335zhh98pzv783hqre355ck3u4w4hjxcx", RPCUser: "user",
ClaimDenom: "crddl", RPCPassword: "password",
ConfigRootDir: "", RPCScheme: "http",
DistributionAddrDAO: "vjU8eMzU3JbUWZEpVANt2ePJuPWSPixgjiSj2jDMvkVVQQi2DDnZuBRVX4Ygt5YGBf5zvTWCr1ntdqYH", RPCWallet: "rpcwallet",
DistributionAddrEarlyInv: "vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG",
DistributionAddrInvestor: "vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG",
DistributionAddrPop: "vjTvXCFSReRsZ7grdsAreRR12KuKpDw8idueQJK9Yh1BYS7ggAqgvCxCgwh13KGK6M52y37HUmvr4GdD",
DistributionAddrStrategic: "vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG",
// `DistributionOffset` relative to `ReissuanceEpochs`. CometBFT epochs of 5s equate 30 min (12*30)
// to wait for confirmations on the reissuance
DistributionOffset: 360,
MqttDomain: "testnet-mqtt.rddl.io",
MqttPassword: "password",
MqttPort: 1885,
MqttResponseTimeout: 2000, // the value is defined in milliseconds
MqttUser: "user",
PopEpochs: 24, // 24 CometBFT epochs of 5s equate 120s
RPCHost: "localhost",
RPCPassword: "password",
RPCPort: 18884,
RPCScheme: "http",
RPCUser: "user",
RPCWallet: "rpcwallet",
ReissuanceAsset: "7add40beb27df701e02ee85089c5bc0021bc813823fedb5f1dcb5debda7f3da9",
// `ReissuanceEpochs` is a configuration parameter that determines the number of CometBFT epochs
// required for reissuance. In the context of Planetmint, reissuance refers to the process of
// issuing new tokens. This configuration parameter specifies the number of epochs (each epoch is 5
// seconds) that need to pass before reissuance can occur. In this case, `ReissuanceEpochs` is set
// to 17280, which means that reissuance can occur after 1 day (12*60*24) of epochs.
ReissuanceEpochs: 17280,
StagedDenom: "stagedcrddl",
TokenDenom: "plmnt",
TxGasLimit: 200000,
ValidatorAddress: "plmnt1w5dww335zhh98pzv783hqre355ck3u4w4hjxcx", ValidatorAddress: "plmnt1w5dww335zhh98pzv783hqre355ck3u4w4hjxcx",
MqttDomain: "testnet-mqtt.rddl.io",
MqttPort: 1885,
MqttUser: "user",
MqttPassword: "password",
} }
} }

View File

@ -4,7 +4,6 @@ import (
"math" "math"
"strconv" "strconv"
"github.com/planetmint/planetmint-go/config"
clitestutil "github.com/planetmint/planetmint-go/testutil/cli" clitestutil "github.com/planetmint/planetmint-go/testutil/cli"
"github.com/planetmint/planetmint-go/testutil/network" "github.com/planetmint/planetmint-go/testutil/network"
daocli "github.com/planetmint/planetmint-go/x/dao/client/cli" daocli "github.com/planetmint/planetmint-go/x/dao/client/cli"
@ -38,10 +37,6 @@ func (s *AssetDistributionE2ETestSuite) SetupSuite() {
daoGenState.Params.ReissuanceEpochs = s.reissaunceEpochs daoGenState.Params.ReissuanceEpochs = s.reissaunceEpochs
s.cfg.GenesisState[daotypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&daoGenState) s.cfg.GenesisState[daotypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&daoGenState)
conf := config.GetConfig()
conf.DistributionOffset = int(s.distributionOffset)
conf.ReissuanceEpochs = int(s.reissaunceEpochs)
s.network = network.Load(s.T(), s.cfg) s.network = network.Load(s.T(), s.cfg)
} }

View File

@ -11,7 +11,6 @@ import (
"github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
bank "github.com/cosmos/cosmos-sdk/x/bank/client/cli" bank "github.com/cosmos/cosmos-sdk/x/bank/client/cli"
"github.com/planetmint/planetmint-go/config"
"github.com/planetmint/planetmint-go/lib" "github.com/planetmint/planetmint-go/lib"
"github.com/planetmint/planetmint-go/testutil" "github.com/planetmint/planetmint-go/testutil"
clitestutil "github.com/planetmint/planetmint-go/testutil/cli" clitestutil "github.com/planetmint/planetmint-go/testutil/cli"
@ -79,13 +78,6 @@ func (s *PopSelectionE2ETestSuite) SetupSuite() {
daoGenState.Params.ClaimAddress = valAddr.String() daoGenState.Params.ClaimAddress = valAddr.String()
s.cfg.GenesisState[daotypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&daoGenState) s.cfg.GenesisState[daotypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&daoGenState)
conf := config.GetConfig()
conf.PopEpochs = int(s.popEpochs)
conf.ReissuanceEpochs = int(s.reissuanceEpochs)
conf.DistributionOffset = int(s.distributionOffset)
conf.MqttResponseTimeout = 200
conf.ClaimAddress = valAddr.String()
s.network = network.Load(s.T(), s.cfg) s.network = network.Load(s.T(), s.cfg)
} }

View File

@ -9,7 +9,6 @@ import (
"cosmossdk.io/math" "cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/crypto/keyring"
bank "github.com/cosmos/cosmos-sdk/x/bank/client/cli" bank "github.com/cosmos/cosmos-sdk/x/bank/client/cli"
"github.com/planetmint/planetmint-go/config"
"github.com/planetmint/planetmint-go/lib" "github.com/planetmint/planetmint-go/lib"
clitestutil "github.com/planetmint/planetmint-go/testutil/cli" clitestutil "github.com/planetmint/planetmint-go/testutil/cli"
e2etestutil "github.com/planetmint/planetmint-go/testutil/e2e" e2etestutil "github.com/planetmint/planetmint-go/testutil/e2e"
@ -80,11 +79,6 @@ func (s *E2ETestSuite) SetupSuite() {
daoGenState.Params.ClaimAddress = valAddr.String() daoGenState.Params.ClaimAddress = valAddr.String()
s.cfg.GenesisState[daotypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&daoGenState) s.cfg.GenesisState[daotypes.ModuleName] = s.cfg.Codec.MustMarshalJSON(&daoGenState)
conf := config.GetConfig()
conf.DistributionOffset = int(s.distributionOffset)
conf.ReissuanceEpochs = int(s.reissuanceEpochs)
conf.ClaimAddress = valAddr.String()
bbalances := sdk.NewCoins( bbalances := sdk.NewCoins(
sdk.NewCoin(daoGenState.Params.TokenDenom, math.NewInt(10000)), sdk.NewCoin(daoGenState.Params.TokenDenom, math.NewInt(10000)),
) )

View File

@ -2,7 +2,6 @@ package keeper
import ( import (
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/config"
"github.com/planetmint/planetmint-go/x/dao/types" "github.com/planetmint/planetmint-go/x/dao/types"
) )
@ -14,25 +13,6 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
return params return params
} }
k.cdc.MustUnmarshal(bz, &params) k.cdc.MustUnmarshal(bz, &params)
mintAddress := params.MintAddress
params = types.Params{
ClaimAddress: config.GetConfig().ClaimAddress,
ClaimDenom: config.GetConfig().ClaimDenom,
DistributionAddressDao: config.GetConfig().DistributionAddrDAO,
DistributionAddressEarlyInv: config.GetConfig().DistributionAddrEarlyInv,
DistributionAddressInvestor: config.GetConfig().DistributionAddrInvestor,
DistributionAddressPop: config.GetConfig().DistributionAddrPop,
DistributionAddressStrategic: config.GetConfig().DistributionAddrStrategic,
DistributionOffset: int64(config.GetConfig().DistributionOffset),
MintAddress: mintAddress,
MqttResponseTimeout: int64(config.GetConfig().MqttResponseTimeout),
PopEpochs: int64(config.GetConfig().PopEpochs),
ReissuanceAsset: config.GetConfig().ReissuanceAsset,
ReissuanceEpochs: int64(config.GetConfig().ReissuanceEpochs),
StagedDenom: config.GetConfig().StagedDenom,
TokenDenom: config.GetConfig().TokenDenom,
TxGasLimit: uint64(config.GetConfig().TxGasLimit),
}
return params return params
} }

View File

@ -53,16 +53,16 @@ func DefaultParams() Params {
"stagedcrddl", "stagedcrddl",
"crddl", "crddl",
"7add40beb27df701e02ee85089c5bc0021bc813823fedb5f1dcb5debda7f3da9", "7add40beb27df701e02ee85089c5bc0021bc813823fedb5f1dcb5debda7f3da9",
17280, 3600,
24, 5,
360, 75,
"vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG", "vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG",
"vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG", "vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG",
"vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG", "vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG",
"vjU8eMzU3JbUWZEpVANt2ePJuPWSPixgjiSj2jDMvkVVQQi2DDnZuBRVX4Ygt5YGBf5zvTWCr1ntdqYH", "vjU8eMzU3JbUWZEpVANt2ePJuPWSPixgjiSj2jDMvkVVQQi2DDnZuBRVX4Ygt5YGBf5zvTWCr1ntdqYH",
"vjTvXCFSReRsZ7grdsAreRR12KuKpDw8idueQJK9Yh1BYS7ggAqgvCxCgwh13KGK6M52y37HUmvr4GdD", "vjTvXCFSReRsZ7grdsAreRR12KuKpDw8idueQJK9Yh1BYS7ggAqgvCxCgwh13KGK6M52y37HUmvr4GdD",
2000, 2000,
"plmnt1w5dww335zhh98pzv783hqre355ck3u4w4hjxcx", "plmnt1m5apfematgm7uueazhk482026ert95x2l2dx78",
200000) 200000)
} }

View File

@ -2,7 +2,6 @@ package keeper
import ( import (
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/planetmint/planetmint-go/config"
"github.com/planetmint/planetmint-go/x/machine/types" "github.com/planetmint/planetmint-go/x/machine/types"
) )
@ -14,11 +13,6 @@ func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
return params return params
} }
k.cdc.MustUnmarshal(bz, &params) k.cdc.MustUnmarshal(bz, &params)
params = types.Params{
AssetRegistryDomain: config.GetConfig().AssetRegistryDomain,
AssetRegistryPath: config.GetConfig().AssetRegistryPath,
AssetRegistryScheme: config.GetConfig().AssetRegistryScheme,
}
return params return params
} }