More comments, update sim for NextValSet
This commit is contained in:
parent
8f4d3a6cd7
commit
48672c4c0b
|
@ -28,10 +28,9 @@ BREAKING CHANGES
|
||||||
* [x/stake, x/slashing] [#1305](https://github.com/cosmos/cosmos-sdk/issues/1305) - Rename "revoked" to "jailed"
|
* [x/stake, x/slashing] [#1305](https://github.com/cosmos/cosmos-sdk/issues/1305) - Rename "revoked" to "jailed"
|
||||||
* [x/stake] [#1676] Revoked and jailed validators put into the unbonding state
|
* [x/stake] [#1676] Revoked and jailed validators put into the unbonding state
|
||||||
* [x/stake] [#1877] Redelegations/unbonding-delegation from unbonding validator have reduced time
|
* [x/stake] [#1877] Redelegations/unbonding-delegation from unbonding validator have reduced time
|
||||||
* [x/stake] \#2040 Validator operator type has now changed to `sdk.ValAddress`
|
|
||||||
* A new bech32 prefix has been introduced for Tendermint signing keys and
|
|
||||||
addresses, `cosmosconspub` and `cosmoscons` respectively.
|
|
||||||
* [x/slashing] \#1789 Slashing changes for Tendermint validator set offset (NextValSet)
|
* [x/slashing] \#1789 Slashing changes for Tendermint validator set offset (NextValSet)
|
||||||
|
* [x/stake] [\#2040](https://github.com/cosmos/cosmos-sdk/issues/2040) Validator
|
||||||
|
operator type has now changed to `sdk.ValAddress`
|
||||||
* [x/stake] [\#2221](https://github.com/cosmos/cosmos-sdk/issues/2221) New
|
* [x/stake] [\#2221](https://github.com/cosmos/cosmos-sdk/issues/2221) New
|
||||||
Bech32 prefixes have been introduced for a validator's consensus address and
|
Bech32 prefixes have been introduced for a validator's consensus address and
|
||||||
public key: `cosmosvalcons` and `cosmosvalconspub` respectively. Also, existing Bech32 prefixes have been
|
public key: `cosmosvalcons` and `cosmosvalconspub` respectively. Also, existing Bech32 prefixes have been
|
||||||
|
|
|
@ -77,6 +77,9 @@ func SimulateFromSeed(tb testing.TB, app *baseapp.BaseApp,
|
||||||
}
|
}
|
||||||
|
|
||||||
validators := initChain(r, accs, setups, app, appStateFn)
|
validators := initChain(r, accs, setups, app, appStateFn)
|
||||||
|
// Second variable to keep pending validator set (delayed one block since TM 0.24)
|
||||||
|
// Initially this is the same as the initial validator set
|
||||||
|
nextValidators := validators
|
||||||
|
|
||||||
header := abci.Header{Height: 0, Time: timestamp}
|
header := abci.Header{Height: 0, Time: timestamp}
|
||||||
opCount := 0
|
opCount := 0
|
||||||
|
@ -160,8 +163,9 @@ func SimulateFromSeed(tb testing.TB, app *baseapp.BaseApp,
|
||||||
// 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)
|
||||||
|
|
||||||
// Update the validator set
|
// Update the validator set, which will be reflected in the application on the next block
|
||||||
validators = updateValidators(tb, r, validators, res.ValidatorUpdates, event)
|
validators = nextValidators
|
||||||
|
nextValidators = updateValidators(tb, r, validators, res.ValidatorUpdates, event)
|
||||||
}
|
}
|
||||||
if stopEarly {
|
if stopEarly {
|
||||||
DisplayEvents(events)
|
DisplayEvents(events)
|
||||||
|
|
|
@ -63,6 +63,9 @@ func (k Keeper) handleDoubleSign(ctx sdk.Context, addr crypto.Address, infractio
|
||||||
logger.Info(fmt.Sprintf("Fraction slashed capped by slashing period from %v to %v", fraction, revisedFraction))
|
logger.Info(fmt.Sprintf("Fraction slashed capped by slashing period from %v to %v", fraction, revisedFraction))
|
||||||
|
|
||||||
// We need to retrieve the stake distribution which signed the block, so we subtract ValidatorUpdateDelay from the evidence height.
|
// We need to retrieve the stake distribution which signed the block, so we subtract ValidatorUpdateDelay from the evidence height.
|
||||||
|
// Note that this *can* result in a "distributionHeight" of -1,
|
||||||
|
// i.e. at the end of the pre-genesis block (none) = at the beginning of the genesis block.
|
||||||
|
// That's fine since this is just used to filter unbonding delegations & redelegations.
|
||||||
distributionHeight := infractionHeight - ValidatorUpdateDelay
|
distributionHeight := infractionHeight - ValidatorUpdateDelay
|
||||||
|
|
||||||
// Slash validator
|
// Slash validator
|
||||||
|
@ -128,6 +131,9 @@ func (k Keeper) handleValidatorSignature(ctx sdk.Context, addr crypto.Address, p
|
||||||
pubkey.Address(), minHeight, k.MinSignedPerWindow(ctx)))
|
pubkey.Address(), minHeight, k.MinSignedPerWindow(ctx)))
|
||||||
// We need to retrieve the stake distribution which signed the block, so we subtract ValidatorUpdateDelay from the evidence height,
|
// We need to retrieve the stake distribution which signed the block, so we subtract ValidatorUpdateDelay from the evidence height,
|
||||||
// and subtract an additional 1 since this is the LastCommit.
|
// and subtract an additional 1 since this is the LastCommit.
|
||||||
|
// Note that this *can* result in a "distributionHeight" of -1 or -2,
|
||||||
|
// i.e. at the end of the pre-genesis block (none) = at the beginning of the genesis block.
|
||||||
|
// That's fine since this is just used to filter unbonding delegations & redelegations.
|
||||||
distributionHeight := height - ValidatorUpdateDelay - 1
|
distributionHeight := height - ValidatorUpdateDelay - 1
|
||||||
k.validatorSet.Slash(ctx, consAddr, distributionHeight, power, k.SlashFractionDowntime(ctx))
|
k.validatorSet.Slash(ctx, consAddr, distributionHeight, power, k.SlashFractionDowntime(ctx))
|
||||||
k.validatorSet.Jail(ctx, consAddr)
|
k.validatorSet.Jail(ctx, consAddr)
|
||||||
|
|
Loading…
Reference in New Issue