diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index b390e38417..34844974f1 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -411,6 +411,12 @@ func handleQueryCustom(app *BaseApp, path []string, req abci.RequestQuery) (res // BeginBlock implements the ABCI application interface. func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeginBlock) { + fmt.Println( + cmn.Cyan( + fmt.Sprintf("BEGIN BLOCK #%v", req.Header.Height), + ), + ) + if app.cms.TracingEnabled() { app.cms.ResetTraceContext() app.cms.WithTracingContext(sdk.TraceContext( @@ -672,6 +678,12 @@ func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBloc res = app.endBlocker(app.deliverState.ctx, req) } + fmt.Println( + cmn.Cyan( + fmt.Sprintf("END BLOCK"), + ), + ) + return } diff --git a/cmd/gaia/app/sim_test.go b/cmd/gaia/app/sim_test.go index 630165cd01..925880b19e 100644 --- a/cmd/gaia/app/sim_test.go +++ b/cmd/gaia/app/sim_test.go @@ -14,7 +14,7 @@ import ( "github.com/tendermint/tendermint/libs/log" sdk "github.com/cosmos/cosmos-sdk/types" - authsim "github.com/cosmos/cosmos-sdk/x/auth/simulation" + // authsim "github.com/cosmos/cosmos-sdk/x/auth/simulation" banksim "github.com/cosmos/cosmos-sdk/x/bank/simulation" distr "github.com/cosmos/cosmos-sdk/x/distribution" distributionsim "github.com/cosmos/cosmos-sdk/x/distribution/simulation" @@ -104,19 +104,19 @@ func appStateFn(r *rand.Rand, accs []simulation.Account) json.RawMessage { func testAndRunTxs(app *GaiaApp) []simulation.WeightedOperation { return []simulation.WeightedOperation{ - {5, authsim.SimulateDeductFee(app.accountMapper, app.feeCollectionKeeper)}, + //{5, authsim.SimulateDeductFee(app.accountMapper, app.feeCollectionKeeper)}, {100, banksim.SingleInputSendMsg(app.accountMapper, app.bankKeeper)}, - {50, distributionsim.SimulateMsgSetWithdrawAddress(app.accountMapper, app.distrKeeper)}, + // {50, distributionsim.SimulateMsgSetWithdrawAddress(app.accountMapper, app.distrKeeper)}, {50, distributionsim.SimulateMsgWithdrawDelegatorRewardsAll(app.accountMapper, app.distrKeeper)}, {50, distributionsim.SimulateMsgWithdrawDelegatorReward(app.accountMapper, app.distrKeeper)}, - {50, distributionsim.SimulateMsgWithdrawValidatorRewardsAll(app.accountMapper, app.distrKeeper)}, - {5, govsim.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, app.stakeKeeper)}, - {100, govsim.SimulateMsgDeposit(app.govKeeper, app.stakeKeeper)}, + // {50, distributionsim.SimulateMsgWithdrawValidatorRewardsAll(app.accountMapper, app.distrKeeper)}, + //{5, govsim.SimulateSubmittingVotingAndSlashingForProposal(app.govKeeper, app.stakeKeeper)}, + //{100, govsim.SimulateMsgDeposit(app.govKeeper, app.stakeKeeper)}, {100, stakesim.SimulateMsgCreateValidator(app.accountMapper, app.stakeKeeper)}, - {5, stakesim.SimulateMsgEditValidator(app.stakeKeeper)}, + //{5, stakesim.SimulateMsgEditValidator(app.stakeKeeper)}, {100, stakesim.SimulateMsgDelegate(app.accountMapper, app.stakeKeeper)}, - {100, stakesim.SimulateMsgBeginUnbonding(app.accountMapper, app.stakeKeeper)}, - {100, stakesim.SimulateMsgBeginRedelegate(app.accountMapper, app.stakeKeeper)}, + //{100, stakesim.SimulateMsgBeginUnbonding(app.accountMapper, app.stakeKeeper)}, + //{100, stakesim.SimulateMsgBeginRedelegate(app.accountMapper, app.stakeKeeper)}, {100, slashingsim.SimulateMsgUnjail(app.slashingKeeper)}, } } diff --git a/x/distribution/types/validator_info.go b/x/distribution/types/validator_info.go index df1062e5c4..9e122cb0cc 100644 --- a/x/distribution/types/validator_info.go +++ b/x/distribution/types/validator_info.go @@ -46,6 +46,15 @@ func (vi ValidatorDistInfo) UpdateTotalDelAccum(height int64, totalDelShares sdk func (vi ValidatorDistInfo) TakeFeePoolRewards(fp FeePool, height int64, totalBonded, vdTokens, commissionRate sdk.Dec) (ValidatorDistInfo, FeePool) { + if vi.FeePoolWithdrawalHeight != height && !vdTokens.IsZero() { + fmt.Println( + cmn.Yellow( + fmt.Sprintf("TakeFeePoolRewards %v last: %v curr: %v pow: %v", + vi.OperatorAddr, vi.FeePoolWithdrawalHeight, height, vdTokens.String()), + ), + ) + } + fp = fp.UpdateTotalValAccum(height, totalBonded) if fp.TotalValAccum.Accum.IsZero() { diff --git a/x/stake/keeper/val_state_change.go b/x/stake/keeper/val_state_change.go index cfa381973d..559357bd1d 100644 --- a/x/stake/keeper/val_state_change.go +++ b/x/stake/keeper/val_state_change.go @@ -9,6 +9,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/stake/types" + cmn "github.com/tendermint/tendermint/libs/common" ) // Apply and return accumulated updates to the bonded validator set. Also, @@ -29,6 +30,8 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab maxValidators := k.GetParams(ctx).MaxValidators totalPower := int64(0) + fmt.Println(cmn.Cyan(fmt.Sprintf("BLOCK #%v ApplyAndReturnValidatorSetUpdates", ctx.BlockHeight()))) + // Retrieve the last validator set. // The persistent set is updated later in this function. // (see LastValidatorPowerKey). @@ -80,6 +83,12 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab // set validator power on lookup index. k.SetLastValidatorPower(ctx, operator, sdk.NewDec(newPower)) + fmt.Println( + cmn.Cyan( + fmt.Sprintf("SetLastValidatorPower %v pow: %v", + operator, newPower), + ), + ) } // validator still in the validator set, so delete from the copy @@ -108,7 +117,13 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab } // delete from the bonded validator index - k.DeleteLastValidatorPower(ctx, operator) + k.DeleteLastValidatorPower(ctx, sdk.ValAddress(operator)) + fmt.Println( + cmn.Cyan( + fmt.Sprintf("SetLastValidatorPower %v pow: 0", + sdk.ValAddress(operator)), + ), + ) // update the validator set updates = append(updates, validator.ABCIValidatorUpdateZero()) @@ -118,6 +133,11 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab if len(updates) > 0 { k.SetLastTotalPower(ctx, sdk.NewDec(totalPower)) } + fmt.Println( + cmn.Cyan( + fmt.Sprintf("SetLastTotalPower pow: %v", totalPower), + ), + ) return updates }