Remove debugging print statements
This commit is contained in:
parent
5790d013fe
commit
be66a4950e
|
@ -411,11 +411,6 @@ func handleQueryCustom(app *BaseApp, path []string, req abci.RequestQuery) (res
|
||||||
|
|
||||||
// BeginBlock implements the ABCI application interface.
|
// BeginBlock implements the ABCI application interface.
|
||||||
func (app *BaseApp) BeginBlock(req abci.RequestBeginBlock) (res abci.ResponseBeginBlock) {
|
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() {
|
if app.cms.TracingEnabled() {
|
||||||
app.cms.ResetTraceContext()
|
app.cms.ResetTraceContext()
|
||||||
|
@ -678,12 +673,6 @@ func (app *BaseApp) EndBlock(req abci.RequestEndBlock) (res abci.ResponseEndBloc
|
||||||
res = app.endBlocker(app.deliverState.ctx, req)
|
res = app.endBlocker(app.deliverState.ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(
|
|
||||||
cmn.Cyan(
|
|
||||||
fmt.Sprintf("END BLOCK"),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ func (k Keeper) onValidatorCreated(ctx sdk.Context, addr sdk.ValAddress) {
|
||||||
vdi := types.ValidatorDistInfo{
|
vdi := types.ValidatorDistInfo{
|
||||||
OperatorAddr: addr,
|
OperatorAddr: addr,
|
||||||
FeePoolWithdrawalHeight: height,
|
FeePoolWithdrawalHeight: height,
|
||||||
Pool: types.DecCoins{},
|
Pool: types.DecCoins{},
|
||||||
PoolCommission: types.DecCoins{},
|
PoolCommission: types.DecCoins{},
|
||||||
DelAccum: types.NewTotalAccum(height),
|
DelAccum: types.NewTotalAccum(height),
|
||||||
}
|
}
|
||||||
k.SetValidatorDistInfo(ctx, vdi)
|
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,
|
func (k Keeper) onDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress,
|
||||||
valAddr sdk.ValAddress) {
|
valAddr sdk.ValAddress) {
|
||||||
|
|
||||||
fmt.Printf("DELEGATION SHARES MODIFIED %v\n", valAddr)
|
|
||||||
|
|
||||||
if err := k.WithdrawDelegationReward(ctx, delAddr, valAddr); err != nil {
|
if err := k.WithdrawDelegationReward(ctx, delAddr, valAddr); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
package types
|
package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
cmn "github.com/tendermint/tendermint/libs/common"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// total accumulation tracker
|
// total accumulation tracker
|
||||||
|
@ -39,18 +36,6 @@ func (ta TotalAccum) UpdateForNewHeight_DEBUG(height int64, accumCreatedPerBlock
|
||||||
if blocks < 0 {
|
if blocks < 0 {
|
||||||
panic("reverse updated for new height")
|
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.Accum = ta.Accum.Add(accumCreatedPerBlock.MulInt(sdk.NewInt(blocks)))
|
||||||
ta.UpdateHeight = height
|
ta.UpdateHeight = height
|
||||||
return ta
|
return ta
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
package types
|
package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
cmn "github.com/tendermint/tendermint/libs/common"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// distribution info for a particular validator
|
// distribution info for a particular validator
|
||||||
|
@ -22,9 +19,9 @@ func NewValidatorDistInfo(operatorAddr sdk.ValAddress, currentHeight int64) Vali
|
||||||
return ValidatorDistInfo{
|
return ValidatorDistInfo{
|
||||||
OperatorAddr: operatorAddr,
|
OperatorAddr: operatorAddr,
|
||||||
FeePoolWithdrawalHeight: currentHeight,
|
FeePoolWithdrawalHeight: currentHeight,
|
||||||
Pool: DecCoins{},
|
Pool: DecCoins{},
|
||||||
PoolCommission: DecCoins{},
|
PoolCommission: DecCoins{},
|
||||||
DelAccum: NewTotalAccum(currentHeight),
|
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,
|
func (vi ValidatorDistInfo) TakeFeePoolRewards(fp FeePool, height int64, totalBonded, vdTokens,
|
||||||
commissionRate sdk.Dec) (ValidatorDistInfo, FeePool) {
|
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)
|
fp = fp.UpdateTotalValAccum(height, totalBonded)
|
||||||
|
|
||||||
if fp.TotalValAccum.Accum.IsZero() {
|
if fp.TotalValAccum.Accum.IsZero() {
|
||||||
|
@ -66,19 +54,6 @@ func (vi ValidatorDistInfo) TakeFeePoolRewards(fp FeePool, height int64, totalBo
|
||||||
vi.FeePoolWithdrawalHeight = height
|
vi.FeePoolWithdrawalHeight = height
|
||||||
accum := vdTokens.MulInt(sdk.NewInt(blocks))
|
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) {
|
if accum.GT(fp.TotalValAccum.Accum) {
|
||||||
panic("individual accum should never be greater than the total")
|
panic("individual accum should never be greater than the total")
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,13 +41,11 @@ func InitGenesis(ctx sdk.Context, keeper Keeper, data types.GenesisState) (res [
|
||||||
// Manually set indices for the first time
|
// Manually set indices for the first time
|
||||||
keeper.SetValidatorByConsAddr(ctx, validator)
|
keeper.SetValidatorByConsAddr(ctx, validator)
|
||||||
keeper.SetValidatorByPowerIndex(ctx, validator, data.Pool)
|
keeper.SetValidatorByPowerIndex(ctx, validator, data.Pool)
|
||||||
fmt.Println("stake.INITGENESIS", ctx.BlockHeight())
|
|
||||||
keeper.OnValidatorCreated(ctx, validator.OperatorAddr)
|
keeper.OnValidatorCreated(ctx, validator.OperatorAddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, delegation := range data.Bonds {
|
for _, delegation := range data.Bonds {
|
||||||
keeper.SetDelegation(ctx, delegation)
|
keeper.SetDelegation(ctx, delegation)
|
||||||
fmt.Println("stake.INITGENESISd", ctx.BlockHeight())
|
|
||||||
keeper.OnDelegationCreated(ctx, delegation.DelegatorAddr, delegation.ValidatorAddr)
|
keeper.OnDelegationCreated(ctx, delegation.DelegatorAddr, delegation.ValidatorAddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -360,7 +360,6 @@ func (k Keeper) Delegate(ctx sdk.Context, delAddr sdk.AccAddress, bondAmt sdk.Co
|
||||||
}
|
}
|
||||||
|
|
||||||
// call the appropriate hook if present
|
// call the appropriate hook if present
|
||||||
//fmt.Printf("DELEGATION SHARES MODIFIED (2) FOUND OR NOT %v found: %v\n", validator.OperatorAddr, found)
|
|
||||||
if found {
|
if found {
|
||||||
k.OnDelegationSharesModified(ctx, delAddr, validator.OperatorAddr)
|
k.OnDelegationSharesModified(ctx, delAddr, validator.OperatorAddr)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/stake/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,
|
// 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
|
maxValidators := k.GetParams(ctx).MaxValidators
|
||||||
totalPower := int64(0)
|
totalPower := int64(0)
|
||||||
|
|
||||||
fmt.Println(cmn.Cyan(fmt.Sprintf("BLOCK #%v ApplyAndReturnValidatorSetUpdates", ctx.BlockHeight())))
|
|
||||||
|
|
||||||
// Retrieve the last validator set.
|
// Retrieve the last validator set.
|
||||||
// The persistent set is updated later in this function.
|
// The persistent set is updated later in this function.
|
||||||
// (see LastValidatorPowerKey).
|
// (see LastValidatorPowerKey).
|
||||||
|
@ -83,24 +80,11 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab
|
||||||
|
|
||||||
// set validator power on lookup index.
|
// set validator power on lookup index.
|
||||||
k.SetLastValidatorPower(ctx, operator, sdk.NewDec(newPower))
|
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
|
// validator still in the validator set, so delete from the copy
|
||||||
delete(last, operatorBytes)
|
delete(last, operatorBytes)
|
||||||
|
|
||||||
fmt.Println(
|
|
||||||
cmn.Cyan(
|
|
||||||
fmt.Sprintf("TOTAL ADD %v pow: %v",
|
|
||||||
operator, newPower),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
// keep count
|
// keep count
|
||||||
count++
|
count++
|
||||||
totalPower += newPower
|
totalPower += newPower
|
||||||
|
@ -116,9 +100,7 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab
|
||||||
validator := k.mustGetValidator(ctx, sdk.ValAddress(operator))
|
validator := k.mustGetValidator(ctx, sdk.ValAddress(operator))
|
||||||
|
|
||||||
// bonded to unbonding
|
// bonded to unbonding
|
||||||
fmt.Println("!!!!")
|
|
||||||
k.bondedToUnbonding(ctx, validator)
|
k.bondedToUnbonding(ctx, validator)
|
||||||
fmt.Println("!!!!2")
|
|
||||||
|
|
||||||
// remove validator if it has no more tokens
|
// remove validator if it has no more tokens
|
||||||
if validator.Tokens.IsZero() {
|
if validator.Tokens.IsZero() {
|
||||||
|
@ -127,12 +109,6 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab
|
||||||
|
|
||||||
// delete from the bonded validator index
|
// delete from the bonded validator index
|
||||||
k.DeleteLastValidatorPower(ctx, sdk.ValAddress(operator))
|
k.DeleteLastValidatorPower(ctx, sdk.ValAddress(operator))
|
||||||
fmt.Println(
|
|
||||||
cmn.Cyan(
|
|
||||||
fmt.Sprintf("SetLastValidatorPower %v pow: 0",
|
|
||||||
sdk.ValAddress(operator)),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
// update the validator set
|
// update the validator set
|
||||||
updates = append(updates, validator.ABCIValidatorUpdateZero())
|
updates = append(updates, validator.ABCIValidatorUpdateZero())
|
||||||
|
@ -142,11 +118,6 @@ func (k Keeper) ApplyAndReturnValidatorSetUpdates(ctx sdk.Context) (updates []ab
|
||||||
if len(updates) > 0 {
|
if len(updates) > 0 {
|
||||||
k.SetLastTotalPower(ctx, sdk.NewDec(totalPower))
|
k.SetLastTotalPower(ctx, sdk.NewDec(totalPower))
|
||||||
}
|
}
|
||||||
fmt.Println(
|
|
||||||
cmn.Cyan(
|
|
||||||
fmt.Sprintf("SetLastTotalPower pow: %v", totalPower),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
return updates
|
return updates
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue