refactor(evidence): migrate to env var (#19482)

This commit is contained in:
Marko
2024-02-20 09:48:32 +00:00
committed by GitHub
parent f5a3bfb058
commit 8acade49db
8 changed files with 37 additions and 36 deletions
@@ -131,7 +131,7 @@ func initFixture(tb testing.TB) *fixture {
stakingKeeper.SetHooks(stakingtypes.NewMultiStakingHooks(slashingKeeper.Hooks()))
evidenceKeeper := keeper.NewKeeper(cdc, runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), stakingKeeper, slashingKeeper, addresscodec.NewBech32Codec(sdk.Bech32PrefixAccAddr))
evidenceKeeper := keeper.NewKeeper(cdc, runtime.NewEnvironment(runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), log.NewNopLogger()), stakingKeeper, slashingKeeper, addresscodec.NewBech32Codec(sdk.Bech32PrefixAccAddr))
router := evidencetypes.NewRouter()
router = router.AddRoute(evidencetypes.RouteEquivocation, testEquivocationHandler(evidenceKeeper))
evidenceKeeper.SetRouter(router)
@@ -271,7 +271,7 @@ func TestHandleDoubleSign_TooOld(t *testing.T) {
t.Parallel()
f := initFixture(t)
ctx := f.sdkCtx.WithIsCheckTx(false).WithBlockHeight(1).WithHeaderInfo(header.Info{Time: time.Now()})
ctx := f.sdkCtx.WithIsCheckTx(false).WithHeaderInfo(header.Info{Height: 1, Time: time.Now()})
populateValidators(t, f)
power := int64(100)
@@ -306,8 +306,7 @@ func TestHandleDoubleSign_TooOld(t *testing.T) {
ctx = ctx.WithCometInfo(nci)
ctx = ctx.WithConsensusParams(cp)
ctx = ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.Add(cp.Evidence.MaxAgeDuration + 1)})
ctx = ctx.WithBlockHeight(ctx.BlockHeight() + cp.Evidence.MaxAgeNumBlocks + 1)
ctx = ctx.WithHeaderInfo(header.Info{Height: ctx.BlockHeight() + cp.Evidence.MaxAgeNumBlocks + 1, Time: ctx.HeaderInfo().Time.Add(cp.Evidence.MaxAgeDuration + 1)})
assert.NilError(t, f.evidenceKeeper.BeginBlocker(ctx))