diff --git a/config/config.go b/config/config.go index c96a104..41c38fa 100644 --- a/config/config.go +++ b/config/config.go @@ -33,7 +33,7 @@ validator-address = "{{ .PlmntConfig.ValidatorAddress }}" distribution-address-inv = "{{ .PlmntConfig.DistributionAddrInv }}" distribution-address-dao = "{{ .PlmntConfig.DistributionAddrDAO }}" distribution-address-pop = "{{ .PlmntConfig.DistributionAddrPop }}" -distribution-epochs = {{ .PlmntConfig.DistributionEpochs }} +distribution-offset = {{ .PlmntConfig.DistributionOffset }} re-issuance-epochs = {{ .PlmntConfig.ReissuanceEpochs }} mqtt-domain = "{{ .PlmntConfig.MqttDomain }}" mqtt-port = {{ .PlmntConfig.MqttPort }} @@ -64,7 +64,7 @@ type Config struct { DistributionAddrInv string `json:"distribution-addr-inv" mapstructure:"distribution-addr-inv"` DistributionAddrDAO string `json:"distribution-addr-dao" mapstructure:"distribution-addr-dao"` DistributionAddrPop string `json:"distribution-addr-pop" mapstructure:"distribution-addr-pop"` - DistributionEpochs int `json:"distribution-epochs" mapstructure:"distribution-epochs"` + DistributionOffset int `json:"distribution-offset" mapstructure:"distribution-offset"` ReissuanceEpochs int `json:"reissuance-epochs" mapstructure:"reissuance-epochs"` MqttDomain string `json:"mqtt-domain" mapstructure:"mqtt-domain"` MqttPort int `json:"mqtt-port" mapstructure:"mqtt-port"` @@ -102,7 +102,9 @@ func DefaultConfig() *Config { DistributionAddrInv: "vjTyRN2G42Yq3T5TJBecHj1dF1xdhKF89hKV4HJN3uXxUbaVGVR76hAfVRQqQCovWaEpar7G5qBBprFG", DistributionAddrDAO: "vjU8eMzU3JbUWZEpVANt2ePJuPWSPixgjiSj2jDMvkVVQQi2DDnZuBRVX4Ygt5YGBf5zvTWCr1ntdqYH", DistributionAddrPop: "vjTvXCFSReRsZ7grdsAreRR12KuKpDw8idueQJK9Yh1BYS7ggAqgvCxCgwh13KGK6M52y37HUmvr4GdD", - DistributionEpochs: 17640, // CometBFT epochs of 5s equate 1 day (12*60*24) + 30 min (12*30) to wait for confirmations on the re-issuance + // `DistributionOffset` relative to `ReissuanceEpochs`. CometBFT epochs of 5s equate 30 min (12*30) + // to wait for confirmations on the reissuance + DistributionOffset: 360, // `ReissuanceEpochs` is a configuration parameter that determines the number of CometBFT epochs // required for re-issuance. In the context of Planetmint, re-issuance refers to the process of // issuing new tokens. This configuration parameter specifies the number of epochs (each epoch is 5 diff --git a/tests/e2e/dao/suite.go b/tests/e2e/dao/suite.go index 23bc63f..5f2c112 100644 --- a/tests/e2e/dao/suite.go +++ b/tests/e2e/dao/suite.go @@ -52,6 +52,7 @@ func (s *E2ETestSuite) SetupSuite() { conf := config.GetConfig() conf.FeeDenom = "node0token" // set epochs: make sure to start after initial height of 7 + conf.DistributionOffset = 5 conf.ReissuanceEpochs = 25 conf.SetPlanetmintConfig(conf) diff --git a/x/dao/abci.go b/x/dao/abci.go index fd7b077..d2ca124 100644 --- a/x/dao/abci.go +++ b/x/dao/abci.go @@ -60,12 +60,18 @@ func isPopHeight(height int64) bool { func isReissuanceHeight(height int64) bool { conf := config.GetConfig() + // e.g. 483840 % 17280 = 0 return height%int64(conf.ReissuanceEpochs) == 0 } func isDistributionHeight(height int64) bool { conf := config.GetConfig() - return height%int64(conf.DistributionEpochs) == 0 + // e.g. 360 % 17280 = 360 + if height <= int64(conf.ReissuanceEpochs) { + return false + } + // e.g. 484200 % 17280 = 360 + return height%int64(conf.ReissuanceEpochs) == int64(conf.DistributionOffset) } func EndBlocker(ctx sdk.Context, _ abci.RequestEndBlock, k keeper.Keeper) {