Persist evidence in equivocation handler (#8502)
* Persist evidence in handler * update docs * update docs Co-authored-by: Alessio Treglia <alessio@tendermint.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
parent
c54b3c4344
commit
c5c049a045
|
@ -48,6 +48,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
|
||||||
|
|
||||||
* (x/{bank,distrib,gov,slashing,staking}) [\#8363](https://github.com/cosmos/cosmos-sdk/issues/8363) Store keys have been modified to allow for variable-length addresses.
|
* (x/{bank,distrib,gov,slashing,staking}) [\#8363](https://github.com/cosmos/cosmos-sdk/issues/8363) Store keys have been modified to allow for variable-length addresses.
|
||||||
* (x/ibc) [\#8266](https://github.com/cosmos/cosmos-sdk/issues/8266) Add amino JSON for IBC messages in order to support Ledger text signing.
|
* (x/ibc) [\#8266](https://github.com/cosmos/cosmos-sdk/issues/8266) Add amino JSON for IBC messages in order to support Ledger text signing.
|
||||||
|
* (x/evidence) [\#8502](https://github.com/cosmos/cosmos-sdk/pull/8502) `HandleEquivocationEvidence` persists the evidence to state.
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|
||||||
|
|
|
@ -119,4 +119,5 @@ func (k Keeper) HandleEquivocationEvidence(ctx sdk.Context, evidence *types.Equi
|
||||||
|
|
||||||
k.slashingKeeper.JailUntil(ctx, consAddr, types.DoubleSignJailEndTime)
|
k.slashingKeeper.JailUntil(ctx, consAddr, types.DoubleSignJailEndTime)
|
||||||
k.slashingKeeper.Tombstone(ctx, consAddr)
|
k.slashingKeeper.Tombstone(ctx, consAddr)
|
||||||
|
k.SetEvidence(ctx, evidence)
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,10 @@ func (suite *KeeperTestSuite) TestHandleDoubleSign() {
|
||||||
tstaking.Ctx = ctx
|
tstaking.Ctx = ctx
|
||||||
tstaking.Denom = stakingParams.BondDenom
|
tstaking.Denom = stakingParams.BondDenom
|
||||||
tstaking.Undelegate(sdk.AccAddress(operatorAddr), operatorAddr, totalBond, true)
|
tstaking.Undelegate(sdk.AccAddress(operatorAddr), operatorAddr, totalBond, true)
|
||||||
|
|
||||||
|
// query evidence from store
|
||||||
|
evidences := suite.app.EvidenceKeeper.GetAllEvidence(ctx)
|
||||||
|
suite.Len(evidences, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *KeeperTestSuite) TestHandleDoubleSign_TooOld() {
|
func (suite *KeeperTestSuite) TestHandleDoubleSign_TooOld() {
|
||||||
|
|
|
@ -66,7 +66,8 @@ The `Handler` (defined below) is responsible for executing the entirety of the
|
||||||
business logic for handling `Evidence`. This typically includes validating the
|
business logic for handling `Evidence`. This typically includes validating the
|
||||||
evidence, both stateless checks via `ValidateBasic` and stateful checks via any
|
evidence, both stateless checks via `ValidateBasic` and stateful checks via any
|
||||||
keepers provided to the `Handler`. In addition, the `Handler` may also perform
|
keepers provided to the `Handler`. In addition, the `Handler` may also perform
|
||||||
capabilities such as slashing and jailing a validator.
|
capabilities such as slashing and jailing a validator. All `Evidence` handled
|
||||||
|
by the `Handler` should be persisted.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// Handler defines an agnostic Evidence handler. The handler is responsible
|
// Handler defines an agnostic Evidence handler. The handler is responsible
|
||||||
|
|
Loading…
Reference in New Issue