refactor!: deprecate blocktime on context (#17738)

This commit is contained in:
Marko
2023-09-18 13:55:21 +00:00
committed by GitHub
parent 8df065b611
commit 6615ff4f76
89 changed files with 379 additions and 369 deletions
+7 -8
View File
@@ -5,11 +5,10 @@ import (
"testing"
"time"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
cmttime "github.com/cometbft/cometbft/types/time"
"github.com/stretchr/testify/suite"
"cosmossdk.io/core/address"
"cosmossdk.io/core/header"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
"cosmossdk.io/math"
@@ -62,7 +61,7 @@ func (s *IntegrationTestSuite) SetupTest() {
ctx := app.BaseApp.NewContext(false)
ctx = ctx.WithBlockHeader(cmtproto.Header{Time: cmttime.Now()})
ctx = ctx.WithHeaderInfo(header.Info{Time: time.Now()})
s.ctx = ctx
@@ -265,7 +264,7 @@ func (s *IntegrationTestSuite) TestEndBlockerPruning() {
s.Require().NoError(err)
return pID
},
newCtx: ctx.WithBlockTime(ctx.BlockTime().Add(votingPeriod).Add(time.Hour)),
newCtx: ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.Add(votingPeriod).Add(time.Hour)}),
expErrMsg: "load proposal: not found",
expStatus: group.PROPOSAL_STATUS_WITHDRAWN,
},
@@ -302,7 +301,7 @@ func (s *IntegrationTestSuite) TestEndBlockerPruning() {
return pID
},
newCtx: ctx.WithBlockTime(ctx.BlockTime().Add(votingPeriod).Add(time.Hour)),
newCtx: ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.Add(votingPeriod).Add(time.Hour)}),
expErrMsg: "load proposal: not found",
expStatus: group.PROPOSAL_STATUS_ABORTED,
expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_NOT_RUN,
@@ -432,7 +431,7 @@ func (s *IntegrationTestSuite) TestEndBlockerTallying() {
return pID
},
admin: proposers[0],
newCtx: ctx.WithBlockTime(ctx.BlockTime().Add(votingPeriod).Add(time.Hour)),
newCtx: ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.Add(votingPeriod).Add(time.Hour)}),
tallyRes: group.DefaultTallyResult(),
expStatus: group.PROPOSAL_STATUS_REJECTED,
},
@@ -469,7 +468,7 @@ func (s *IntegrationTestSuite) TestEndBlockerTallying() {
return pID
},
admin: proposers[0],
newCtx: ctx.WithBlockTime(ctx.BlockTime().Add(votingPeriod).Add(time.Hour)),
newCtx: ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.Add(votingPeriod).Add(time.Hour)}),
tallyRes: group.TallyResult{
YesCount: "1",
NoCount: "0",
@@ -486,7 +485,7 @@ func (s *IntegrationTestSuite) TestEndBlockerTallying() {
return pID
},
admin: proposers[0],
newCtx: ctx.WithBlockTime(ctx.BlockTime().Add(votingPeriod).Add(time.Hour)),
newCtx: ctx.WithHeaderInfo(header.Info{Time: ctx.HeaderInfo().Time.Add(votingPeriod).Add(time.Hour)}),
tallyRes: group.TallyResult{
YesCount: "2",
NoCount: "0",