refactor(core,x/**): simplify core service api and embed environment in keepers (#20071)

This commit is contained in:
Julien Robert
2024-04-17 18:18:16 +00:00
committed by GitHub
parent a4ff821981
commit 5e7aae0db1
115 changed files with 546 additions and 651 deletions
+1 -6
View File
@@ -12,8 +12,6 @@ import (
"github.com/golang/mock/gomock"
"cosmossdk.io/core/header"
"cosmossdk.io/log"
storetypes "cosmossdk.io/store/types"
banktypes "cosmossdk.io/x/bank/types"
"cosmossdk.io/x/group"
"cosmossdk.io/x/group/internal/math"
@@ -21,7 +19,6 @@ import (
minttypes "cosmossdk.io/x/mint/types"
"github.com/cosmos/cosmos-sdk/codec/address"
"github.com/cosmos/cosmos-sdk/runtime"
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
@@ -1995,12 +1992,10 @@ func (s *TestSuite) TestWithdrawProposal() {
postRun: func(sdkCtx sdk.Context) {
resp, err := s.groupKeeper.Proposal(s.ctx, &group.QueryProposalRequest{ProposalId: proposalID})
s.Require().NoError(err)
key := storetypes.NewKVStoreKey(group.StoreKey)
env := runtime.NewEnvironment(runtime.NewKVStoreService(key), log.NewNopLogger())
vpe := resp.Proposal.VotingPeriodEnd
timeDiff := vpe.Sub(s.sdkCtx.HeaderInfo().Time)
ctxVPE := sdkCtx.WithHeaderInfo(header.Info{Time: s.sdkCtx.HeaderInfo().Time.Add(timeDiff).Add(time.Second * 1)})
s.Require().NoError(s.groupKeeper.TallyProposalsAtVPEnd(ctxVPE, env))
s.Require().NoError(s.groupKeeper.TallyProposalsAtVPEnd(ctxVPE))
events := ctxVPE.EventManager().ABCIEvents()
s.Require().True(eventTypeFound(events, EventProposalPruned))