Add more useful logging
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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)},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user