simulation stop early with no proposers
This commit is contained in:
parent
fa3730a5d2
commit
5a559f75c5
|
@ -13,6 +13,7 @@ func (k Keeper) AllocateTokens(ctx sdk.Context, percentVotes sdk.Dec, proposer s
|
||||||
|
|
||||||
// get the proposer of this block
|
// get the proposer of this block
|
||||||
proposerValidator := k.stakeKeeper.ValidatorByConsAddr(ctx, proposer)
|
proposerValidator := k.stakeKeeper.ValidatorByConsAddr(ctx, proposer)
|
||||||
|
|
||||||
proposerDist := k.GetValidatorDistInfo(ctx, proposerValidator.GetOperator())
|
proposerDist := k.GetValidatorDistInfo(ctx, proposerValidator.GetOperator())
|
||||||
|
|
||||||
// get the fees which have been getting collected through all the
|
// get the fees which have been getting collected through all the
|
||||||
|
|
|
@ -104,7 +104,6 @@ func (h Hooks) OnDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valA
|
||||||
func (h Hooks) OnValidatorBeginUnbonding(ctx sdk.Context, _ sdk.ConsAddress, addr sdk.ValAddress) {
|
func (h Hooks) OnValidatorBeginUnbonding(ctx sdk.Context, _ sdk.ConsAddress, addr sdk.ValAddress) {
|
||||||
h.k.onValidatorModified(ctx, addr)
|
h.k.onValidatorModified(ctx, addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h Hooks) OnValidatorBonded(ctx sdk.Context, _ sdk.ConsAddress, addr sdk.ValAddress) {
|
func (h Hooks) OnValidatorBonded(ctx sdk.Context, _ sdk.ConsAddress, addr sdk.ValAddress) {
|
||||||
h.k.onValidatorModified(ctx, addr)
|
h.k.onValidatorModified(ctx, addr)
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,6 +176,12 @@ func SimulateFromSeed(tb testing.TB, app *baseapp.BaseApp,
|
||||||
app.Commit()
|
app.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if header.ProposerAddress == nil {
|
||||||
|
fmt.Printf("\nSimulation stopped early as all validators have been unbonded, there is nobody left propose a block!\n")
|
||||||
|
stopEarly = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
// Generate a random RequestBeginBlock with the current validator set for the next block
|
// Generate a random RequestBeginBlock with the current validator set for the next block
|
||||||
request = RandomRequestBeginBlock(r, validators, livenessTransitionMatrix, evidenceFraction, pastTimes, pastVoteInfos, event, header)
|
request = RandomRequestBeginBlock(r, validators, livenessTransitionMatrix, evidenceFraction, pastTimes, pastVoteInfos, event, header)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue