diff --git a/app/ante/check_reissuance_decorator.go b/app/ante/check_reissuance_decorator.go index 7b7bac1..abf9fe9 100644 --- a/app/ante/check_reissuance_decorator.go +++ b/app/ante/check_reissuance_decorator.go @@ -26,13 +26,13 @@ func (cmad CheckReissuanceDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simu if sdk.MsgTypeURL(msg) == "/planetmintgo.dao.MsgReissueRDDLProposal" { MsgProposal, ok := msg.(*daotypes.MsgReissueRDDLProposal) if ok { - util.GetAppLogger().Debug(ctx, anteHandlerTag+"received re-issuance proposal: "+MsgProposal.String()) + util.GetAppLogger().Debug(ctx, anteHandlerTag+"received reissuance proposal: "+MsgProposal.String()) isValid := cmad.dk.IsValidReissuanceProposal(ctx, MsgProposal) if !isValid { - util.GetAppLogger().Info(ctx, anteHandlerTag+"rejected re-issuance proposal") + util.GetAppLogger().Info(ctx, anteHandlerTag+"rejected reissuance proposal") return ctx, errorsmod.Wrapf(daotypes.ErrReissuanceProposal, "error during CheckTx or ReCheckTx") } - util.GetAppLogger().Debug(ctx, anteHandlerTag+"accepted re-issuance proposal: "+MsgProposal.String()) + util.GetAppLogger().Debug(ctx, anteHandlerTag+"accepted reissuance proposal: "+MsgProposal.String()) } } } diff --git a/app/ante/gaskv_cost_decorator.go b/app/ante/gaskv_cost_decorator.go index 4bb2869..ea3a1aa 100644 --- a/app/ante/gaskv_cost_decorator.go +++ b/app/ante/gaskv_cost_decorator.go @@ -13,26 +13,30 @@ func NewGasKVCostDecorator(sk StakingKeeper) GasKVCostDecorator { } func (gc GasKVCostDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (_ sdk.Context, err error) { - if !simulate && ctx.BlockHeight() != 0 { - msgs := tx.GetMsgs() - signers := msgs[0].GetSigners() - signer := signers[0] - - valAddr := sdk.ValAddress(signer) - _, found := gc.sk.GetValidator(ctx, valAddr) - - if found { - ctx = ctx.WithKVGasConfig(sdk.GasConfig{ - HasCost: 0, - DeleteCost: 0, - ReadCostFlat: 0, - ReadCostPerByte: 0, - WriteCostFlat: 0, - WriteCostPerByte: 0, - IterNextCostFlat: 0, - }) - } + if simulate || ctx.BlockHeight() == 0 { + return next(ctx, tx, simulate) } + msgs := tx.GetMsgs() + signers := msgs[0].GetSigners() + signer := signers[0] + + valAddr := sdk.ValAddress(signer) + _, found := gc.sk.GetValidator(ctx, valAddr) + + if !found { + return next(ctx, tx, simulate) + } + + ctx = ctx.WithKVGasConfig(sdk.GasConfig{ + HasCost: 0, + DeleteCost: 0, + ReadCostFlat: 0, + ReadCostPerByte: 0, + WriteCostFlat: 0, + WriteCostPerByte: 0, + IterNextCostFlat: 0, + }) + return next(ctx, tx, simulate) } diff --git a/config/config.go b/config/config.go index 41c38fa..62805c3 100644 --- a/config/config.go +++ b/config/config.go @@ -34,7 +34,7 @@ distribution-address-inv = "{{ .PlmntConfig.DistributionAddrInv }}" distribution-address-dao = "{{ .PlmntConfig.DistributionAddrDAO }}" distribution-address-pop = "{{ .PlmntConfig.DistributionAddrPop }}" distribution-offset = {{ .PlmntConfig.DistributionOffset }} -re-issuance-epochs = {{ .PlmntConfig.ReissuanceEpochs }} +reissuance-epochs = {{ .PlmntConfig.ReissuanceEpochs }} mqtt-domain = "{{ .PlmntConfig.MqttDomain }}" mqtt-port = {{ .PlmntConfig.MqttPort }} mqtt-user = "{{ .PlmntConfig.MqttUser }}" @@ -106,10 +106,10 @@ func DefaultConfig() *Config { // 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 + // 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 re-issuance can occur. In this case, `ReissuanceEpochs` is set - // to 17280, which means that re-issuance can occur after 1 day (12*60*24) of epochs. + // 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, MqttDomain: "testnet-mqtt.rddl.io", MqttPort: 1885, diff --git a/tests/e2e/dao/suite.go b/tests/e2e/dao/suite.go index 5f2c112..27b8ff9 100644 --- a/tests/e2e/dao/suite.go +++ b/tests/e2e/dao/suite.go @@ -239,9 +239,9 @@ func (s *E2ETestSuite) TestReissuance() { latestHeight, err = s.network.WaitForHeight(latestHeight + 1) s.Require().NoError(err) - // wait + for sending the re-issuance result, i.e.: - // 0: block 25: initializing RDDL re-issuance broadcast tx succeeded - // 1: block 26: sending the re-issuance result broadcast tx succeeded + // wait + for sending the reissuance result, i.e.: + // 0: block 25: initializing RDDL reissuance broadcast tx succeeded + // 1: block 26: sending the reissuance result broadcast tx succeeded // 2: block 27: confirmation wait = 2 if latestHeight%int64(conf.ReissuanceEpochs+wait) == 0 { @@ -249,7 +249,7 @@ func (s *E2ETestSuite) TestReissuance() { } } - // - because we waited on the re-issuance result, see above + // - because we waited on the reissuance result, see above intValue := strconv.FormatInt(latestHeight-int64(wait), 10) _, err = clitestutil.ExecTestCLICmd(val.ClientCtx, daocli.CmdGetReissuance(), []string{intValue}) s.Require().NoError(err) diff --git a/x/dao/abci.go b/x/dao/abci.go index d2ca124..7e0f574 100644 --- a/x/dao/abci.go +++ b/x/dao/abci.go @@ -39,7 +39,7 @@ func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper) util.SendInitReissuance(ctx, hexProposerAddress, reissuance.GetCommand(), currentBlockHeight, reissuance.GetFirstIncludedPop(), reissuance.GetLastIncludedPop()) } else { - util.GetAppLogger().Error(ctx, "error while computing the RDDL re-issuance ", err) + util.GetAppLogger().Error(ctx, "error while computing the RDDL reissuance ", err) } } diff --git a/x/dao/keeper/reissuance.go b/x/dao/keeper/reissuance.go index 0f4316f..9d3de90 100644 --- a/x/dao/keeper/reissuance.go +++ b/x/dao/keeper/reissuance.go @@ -142,17 +142,17 @@ func (k Keeper) ComputeReissuanceValue(ctx sdk.Context, startHeight int64, endHe popReissuanceString := GetReissuanceAsStringValue(obj.GetHeight()) amount, err := util.RDDLTokenStringToUint(popReissuanceString) if err != nil { - util.GetAppLogger().Error(ctx, "unable to compute PoP re-issuance value: "+popString) + util.GetAppLogger().Error(ctx, "unable to compute PoP reissuance value: "+popString) continue } - util.GetAppLogger().Info(ctx, "PoP is part of the reissuance: "+popString) + util.GetAppLogger().Debug(ctx, "PoP is part of the reissuance: "+popString) if firstIncludedPop == 0 { firstIncludedPop = obj.GetHeight() } lastIncludedPop = obj.GetHeight() overallAmount += amount } else { - util.GetAppLogger().Debug(ctx, "PoP is not part of the reissuance: "+popString) + util.GetAppLogger().Info(ctx, "PoP is not part of the reissuance: "+popString) if obj.GetHeight()+2*popEpochs > endHeight { break }