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
+1 -1
View File
@@ -294,7 +294,7 @@ func simulateMsgSubmitProposal(
fops := make([]simtypes.FutureOperation, numVotes+1)
for i := 0; i < numVotes; i++ {
whenVote := ctx.BlockHeader().Time.Add(time.Duration(r.Int63n(int64(votingPeriod.Seconds()))) * time.Second)
whenVote := ctx.HeaderInfo().Time.Add(time.Duration(r.Int63n(int64(votingPeriod.Seconds()))) * time.Second)
fops[i] = simtypes.FutureOperation{
BlockTime: whenVote,
Op: operationSimulateMsgVote(txGen, ak, bk, k, accs[whoVotes[i]], int64(proposalID)),
+9 -8
View File
@@ -10,6 +10,7 @@ import (
"github.com/cosmos/gogoproto/proto"
"github.com/stretchr/testify/require"
"cosmossdk.io/core/header"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
@@ -213,7 +214,7 @@ func TestSimulateMsgCancelProposal(t *testing.T) {
suite, ctx := createTestSuite(t, false)
app := suite.App
blockTime := time.Now().UTC()
ctx = ctx.WithBlockTime(blockTime)
ctx = ctx.WithHeaderInfo(header.Info{Time: blockTime})
// setup 3 accounts
s := rand.NewSource(1)
@@ -225,7 +226,7 @@ func TestSimulateMsgCancelProposal(t *testing.T) {
contentMsg, err := v1.NewLegacyContent(content, suite.GovKeeper.GetGovernanceAccount(ctx).GetAddress().String())
require.NoError(t, err)
submitTime := ctx.BlockHeader().Time
submitTime := ctx.HeaderInfo().Time
params, _ := suite.GovKeeper.Params.Get(ctx)
depositPeriod := params.MaxDepositPeriod
@@ -262,7 +263,7 @@ func TestSimulateMsgDeposit(t *testing.T) {
suite, ctx := createTestSuite(t, false)
app := suite.App
blockTime := time.Now().UTC()
ctx = ctx.WithBlockTime(blockTime)
ctx = ctx.WithHeaderInfo(header.Info{Time: blockTime})
// setup 3 accounts
s := rand.NewSource(1)
@@ -274,7 +275,7 @@ func TestSimulateMsgDeposit(t *testing.T) {
contentMsg, err := v1.NewLegacyContent(content, suite.GovKeeper.GetGovernanceAccount(ctx).GetAddress().String())
require.NoError(t, err)
submitTime := ctx.BlockHeader().Time
submitTime := ctx.HeaderInfo().Time
params, _ := suite.GovKeeper.Params.Get(ctx)
depositPeriod := params.MaxDepositPeriod
@@ -312,7 +313,7 @@ func TestSimulateMsgVote(t *testing.T) {
suite, ctx := createTestSuite(t, false)
app := suite.App
blockTime := time.Now().UTC()
ctx = ctx.WithBlockTime(blockTime)
ctx = ctx.WithHeaderInfo(header.Info{Time: blockTime})
// setup 3 accounts
s := rand.NewSource(1)
@@ -324,7 +325,7 @@ func TestSimulateMsgVote(t *testing.T) {
contentMsg, err := v1.NewLegacyContent(v1beta1.NewTextProposal("Test", "description"), govAcc)
require.NoError(t, err)
submitTime := ctx.BlockHeader().Time
submitTime := ctx.HeaderInfo().Time
params, _ := suite.GovKeeper.Params.Get(ctx)
depositPeriod := params.MaxDepositPeriod
@@ -361,7 +362,7 @@ func TestSimulateMsgVoteWeighted(t *testing.T) {
suite, ctx := createTestSuite(t, false)
app := suite.App
blockTime := time.Now().UTC()
ctx = ctx.WithBlockTime(blockTime)
ctx = ctx.WithHeaderInfo(header.Info{Time: blockTime})
// setup 3 accounts
s := rand.NewSource(1)
@@ -372,7 +373,7 @@ func TestSimulateMsgVoteWeighted(t *testing.T) {
govAcc := suite.GovKeeper.GetGovernanceAccount(ctx).GetAddress().String()
contentMsg, err := v1.NewLegacyContent(v1beta1.NewTextProposal("Test", "description"), govAcc)
require.NoError(t, err)
submitTime := ctx.BlockHeader().Time
submitTime := ctx.HeaderInfo().Time
params, _ := suite.GovKeeper.Params.Get(ctx)
depositPeriod := params.MaxDepositPeriod