Remove debugging print statements

This commit is contained in:
Christopher Goes 2018-10-23 15:50:35 +02:00
parent 5790d013fe
commit be66a4950e
7 changed files with 6 additions and 91 deletions

View File

@ -411,11 +411,6 @@ 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()
@ -678,12 +673,6 @@ 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
}

View File

@ -14,9 +14,9 @@ func (k Keeper) onValidatorCreated(ctx sdk.Context, addr sdk.ValAddress) {
vdi := types.ValidatorDistInfo{
OperatorAddr: addr,
FeePoolWithdrawalHeight: height,
Pool: types.DecCoins{},
PoolCommission: types.DecCoins{},
DelAccum: types.NewTotalAccum(height),
Pool: types.DecCoins{},
PoolCommission: types.DecCoins{},
DelAccum: types.NewTotalAccum(height),
}
k.SetValidatorDistInfo(ctx, vdi)
}
@ -54,8 +54,6 @@ func (k Keeper) onDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress,
func (k Keeper) onDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress,
valAddr sdk.ValAddress) {
fmt.Printf("DELEGATION SHARES MODIFIED %v\n", valAddr)
if err := k.WithdrawDelegationReward(ctx, delAddr, valAddr); err != nil {
panic(err)
}

View File

@ -1,10 +1,7 @@
package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
cmn "github.com/tendermint/tendermint/libs/common"
)
// total accumulation tracker
@ -39,18 +36,6 @@ func (ta TotalAccum) UpdateForNewHeight_DEBUG(height int64, accumCreatedPerBlock
if blocks < 0 {
panic("reverse updated for new height")
}
if !accumCreatedPerBlock.IsZero() && blocks != 0 {
fmt.Println(
cmn.Blue(
fmt.Sprintf("FP Add %v * %v = %v, + %v (old) => %v (new)",
accumCreatedPerBlock.String(), sdk.NewInt(blocks),
accumCreatedPerBlock.MulInt(sdk.NewInt(blocks)).String(),
ta.Accum.String(),
ta.Accum.Add(accumCreatedPerBlock.MulInt(sdk.NewInt(blocks))).String(),
),
),
)
}
ta.Accum = ta.Accum.Add(accumCreatedPerBlock.MulInt(sdk.NewInt(blocks)))
ta.UpdateHeight = height
return ta

View File

@ -1,10 +1,7 @@
package types
import (
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
cmn "github.com/tendermint/tendermint/libs/common"
)
// distribution info for a particular validator
@ -22,9 +19,9 @@ func NewValidatorDistInfo(operatorAddr sdk.ValAddress, currentHeight int64) Vali
return ValidatorDistInfo{
OperatorAddr: operatorAddr,
FeePoolWithdrawalHeight: currentHeight,
Pool: DecCoins{},
PoolCommission: DecCoins{},
DelAccum: NewTotalAccum(currentHeight),
Pool: DecCoins{},
PoolCommission: DecCoins{},
DelAccum: NewTotalAccum(currentHeight),
}
}
@ -46,15 +43,6 @@ 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() {
@ -66,19 +54,6 @@ func (vi ValidatorDistInfo) TakeFeePoolRewards(fp FeePool, height int64, totalBo
vi.FeePoolWithdrawalHeight = height
accum := vdTokens.MulInt(sdk.NewInt(blocks))
if !accum.IsZero() {
fmt.Println(
cmn.Red(
fmt.Sprintf("FP Sub %v * %v = %v, %v - _ => %v",
vdTokens.String(), sdk.NewInt(blocks),
accum.String(),
fp.TotalValAccum.Accum.String(),
fp.TotalValAccum.Accum.Sub(accum).String(),
),
),
)
}
if accum.GT(fp.TotalValAccum.Accum) {
panic("individual accum should never be greater than the total")
}

View File

@ -41,13 +41,11 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState) (res [
// Manually set indices for the first time
keeper.SetValidatorByConsAddr(ctx, validator)
keeper.SetValidatorByPowerIndex(ctx, validator, data.Pool)
fmt.Println("stake.INITGENESIS", ctx.BlockHeight())
keeper.OnValidatorCreated(ctx, validator.OperatorAddr)
}
for _, delegation := range data.Bonds {
keeper.SetDelegation(ctx, delegation)
fmt.Println("stake.INITGENESISd", ctx.BlockHeight())
keeper.OnDelegationCreated(ctx, delegation.DelegatorAddr, delegation.ValidatorAddr)
}

View File

@ -360,7 +360,6 @@ func (k Keeper) Delegate(ctx sdk.Context, delAddr sdk.AccAddress, bondAmt sdk.Co
}
// call the appropriate hook if present
//fmt.Printf("DELEGATION SHARES MODIFIED (2) FOUND OR NOT %v found: %v\n", validator.OperatorAddr, found)
if found {
k.OnDelegationSharesModified(ctx, delAddr, validator.OperatorAddr)
} else {

View File

@ -9,7 +9,6 @@ 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,
@ -30,8 +29,6 @@ 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).
@ -83,24 +80,11 @@ 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
delete(last, operatorBytes)
fmt.Println(
cmn.Cyan(
fmt.Sprintf("TOTAL ADD %v pow: %v",
operator, newPower),
),
)
// keep count
count++
totalPower += newPower
@ -116,9 +100,7 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab
validator := k.mustGetValidator(ctx, sdk.ValAddress(operator))
// bonded to unbonding
fmt.Println("!!!!")
k.bondedToUnbonding(ctx, validator)
fmt.Println("!!!!2")
// remove validator if it has no more tokens
if validator.Tokens.IsZero() {
@ -127,12 +109,6 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab
// delete from the bonded validator index
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())
@ -142,11 +118,6 @@ 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
}