Skip to content
Draft
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (app *App) DeliverTx(ctx sdk.Context, req abci.RequestDeliverTxV2, tx sdk.T
telemetry.SetGauge(float32(gInfo.GasUsed), "tx", "gas", "used")
telemetry.SetGauge(float32(gInfo.GasWanted), "tx", "gas", "wanted")
}()
gInfo, result, anteEvents, resCtx, err := legacyabci.DeliverTx(ctx.WithTxBytes(req.Tx).WithTxSum(checksum).WithVoteInfos(app.UnsafeGetVoteInfos()), tx, app.GetTxConfig(), &app.DeliverTxKeepers, checksum, func(ctx sdk.Context) (sdk.Context, sdk.CacheMultiStore) {
gInfo, result, anteEvents, resCtx, err := legacyabci.DeliverTx(ctx.WithTxBytes(req.Tx).WithTxSum(checksum), tx, app.GetTxConfig(), &app.DeliverTxKeepers, checksum, func(ctx sdk.Context) (sdk.Context, sdk.CacheMultiStore) {
return app.CacheTxContext(ctx, checksum)
}, app.RunMsgs, app.TracingInfo, app.AddCosmosEventsToEVMReceiptIfApplicable)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion app/antedecorators/authz_nested_message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestAuthzNestedEvmMessage(t *testing.T) {
anteDecorators := []sdk.AnteDecorator{
antedecorators.NewAuthzNestedMessageDecorator(),
}
ctx := sdk.NewContext(nil, tmproto.Header{}, false, nil)
ctx := sdk.NewContext(nil, sdk.Header{}, false, nil)
chainedHandler := sdk.ChainAnteDecorators(anteDecorators...)

nestedEvmMessage := authz.NewMsgExec(addr1, []sdk.Msg{&evmtypes.MsgEVMTransaction{}})
Expand Down
2 changes: 1 addition & 1 deletion app/antedecorators/gasless_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func TestNonGaslessMsg(t *testing.T) {
// this needs to be updated if its changed from constant true
// reset gasless
gasless = true
err := CallGaslessDecoratorWithMsg(sdk.NewContext(nil, tmproto.Header{}, false, nil).WithIsCheckTx(true), &oracletypes.MsgDelegateFeedConsent{}, oraclekeeper.Keeper{}, nil)
err := CallGaslessDecoratorWithMsg(sdk.NewContext(nil, sdk.Header{}, false, nil).WithIsCheckTx(true), &oracletypes.MsgDelegateFeedConsent{}, oraclekeeper.Keeper{}, nil)
require.NoError(t, err)
require.False(t, gasless)
}
10 changes: 5 additions & 5 deletions app/antedecorators/priority_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestPriorityAnteDecorator(t *testing.T) {
anteDecorators := []sdk.AnteDecorator{
antedecorators.NewPriorityDecorator(),
}
ctx := sdk.NewContext(nil, tmproto.Header{}, false, nil)
ctx := sdk.NewContext(nil, sdk.Header{}, false, nil)
chainedHandler := sdk.ChainAnteDecorators(anteDecorators...)
// test with normal priority
newCtx, err := chainedHandler(
Expand All @@ -41,7 +41,7 @@ func TestPriorityAnteDecoratorTooHighPriority(t *testing.T) {
anteDecorators := []sdk.AnteDecorator{
antedecorators.NewPriorityDecorator(),
}
ctx := sdk.NewContext(nil, tmproto.Header{}, false, nil)
ctx := sdk.NewContext(nil, sdk.Header{}, false, nil)
chainedHandler := sdk.ChainAnteDecorators(anteDecorators...)
// test with too high priority, should be auto capped
newCtx, err := chainedHandler(
Expand All @@ -62,7 +62,7 @@ func TestPriorityAnteDecoratorOracleMsg(t *testing.T) {
anteDecorators := []sdk.AnteDecorator{
antedecorators.NewPriorityDecorator(),
}
ctx := sdk.NewContext(nil, tmproto.Header{}, false, nil)
ctx := sdk.NewContext(nil, sdk.Header{}, false, nil)
chainedHandler := sdk.ChainAnteDecorators(anteDecorators...)
// test with zero priority, should be bumped up to oracle priority
newCtx, err := chainedHandler(
Expand Down Expand Up @@ -90,7 +90,7 @@ func (d PriorityCaptureDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulat

func TestPriorityWithExactAnteChain_BankSend(t *testing.T) {
testApp := app.Setup(t, false, false, false)
ctx := testApp.NewContext(false, tmproto.Header{ChainID: "sei-test"}).WithBlockHeight(2).WithIsCheckTx(true)
ctx := testApp.NewContext(false, sdk.Header{ChainID: "sei-test"}).WithBlockHeight(2).WithIsCheckTx(true)
testApp.ParamsKeeper.SetCosmosGasParams(ctx, *paramtypes.DefaultCosmosGasParams())
testApp.ParamsKeeper.SetFeesParams(ctx, paramtypes.DefaultGenesis().GetFeesParams())

Expand Down Expand Up @@ -157,7 +157,7 @@ func (d PrioritySetterDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate

func TestPrioritySetterWithAnteHandlers(t *testing.T) {
testApp := app.Setup(t, false, false, false)
ctx := testApp.NewContext(false, tmproto.Header{}).WithBlockHeight(2).WithIsCheckTx(true)
ctx := testApp.NewContext(false, sdk.Header{}).WithBlockHeight(2).WithIsCheckTx(true)
testApp.ParamsKeeper.SetCosmosGasParams(ctx, *paramtypes.DefaultCosmosGasParams())
testApp.ParamsKeeper.SetFeesParams(ctx, paramtypes.DefaultGenesis().GetFeesParams())

Expand Down
2 changes: 1 addition & 1 deletion app/antedecorators/traced_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ func TestTracedDecorator(t *testing.T) {
return antedecorators.NewTracedAnteDecorator(d, nil)
})
chainedHandler := sdk.ChainAnteDecorators(tracedDecorators...)
chainedHandler(sdk.NewContext(nil, tmproto.Header{}, false, nil), FakeTx{}, false)
chainedHandler(sdk.NewContext(nil, sdk.Header{}, false, nil), FakeTx{}, false)
require.Equal(t, "onetwothree", output)
}
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ func New(
tmos.Exit(err.Error())
}

ctx := app.NewUncachedContext(true, tmproto.Header{})
ctx := app.NewUncachedContext(true, sdk.Header{})
if err := app.WasmKeeper.InitializePinnedCodes(ctx); err != nil {
tmos.Exit(fmt.Sprintf("failed initialize pinned codes %s", err))
}
Expand Down
7 changes: 3 additions & 4 deletions app/apptesting/test_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
abci "github.com/sei-protocol/sei-chain/sei-tendermint/abci/types"
"github.com/sei-protocol/sei-chain/sei-tendermint/crypto/ed25519"
"github.com/sei-protocol/sei-chain/sei-tendermint/libs/log"
tmtypes "github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types"
minttypes "github.com/sei-protocol/sei-chain/x/mint/types"
"github.com/stretchr/testify/suite"
dbm "github.com/tendermint/tm-db"
Expand All @@ -39,7 +38,7 @@
// Setup sets up basic environment for suite (App, Ctx, and test accounts)
func (s *KeeperTestHelper) Setup() {
s.App = app.Setup(s.T(), false, false, false)
s.Ctx = s.App.NewContext(false, tmtypes.Header{Height: 1, ChainID: "sei-test", Time: time.Now().UTC()})
s.Ctx = s.App.NewContext(false, sdk.Header{Height: 1, ChainID: "sei-test", Time: time.Now().UTC()})

Check warning

Code scanning / CodeQL

Calling the system time Warning test

Calling the system time may be a possible source of non-determinism
s.QueryHelper = &baseapp.QueryServiceTestHelper{
GRPCQueryRouter: s.App.GRPCQueryRouter(),
Ctx: s.Ctx,
Expand All @@ -55,7 +54,7 @@

ms := rootmulti.NewStore(db, log.NewNopLogger())

return sdk.NewContext(ms, tmtypes.Header{}, false, logger)
return sdk.NewContext(ms, sdk.Header{}, false, logger)
}

// CreateTestContext creates a test context.
Expand All @@ -66,7 +65,7 @@
if err != nil {
panic(err)
}
newHeader := tmtypes.Header{Height: oldHeight + 1, ChainID: oldHeader.ChainID, Time: time.Now().UTC()}
newHeader := sdk.Header{Height: oldHeight + 1, ChainID: oldHeader.ChainID, Time: time.Now().UTC()}

Check warning

Code scanning / CodeQL

Calling the system time Warning test

Calling the system time may be a possible source of non-determinism
legacyabci.BeginBlock(s.Ctx, newHeader.Height, []abci.VoteInfo{}, []abci.Misbehavior{}, s.App.BeginBlockKeepers)
s.Ctx = s.App.GetBaseApp().NewContext(false, newHeader)
}
Expand Down
6 changes: 2 additions & 4 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (

"github.com/cosmos/cosmos-sdk/types/kv"

tmproto "github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types"

servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
Expand All @@ -23,7 +21,7 @@ func (app *App) ExportAppStateAndValidators(
forZeroHeight bool, jailAllowedAddrs []string,
) (servertypes.ExportedApp, error) {
// as if they could withdraw from the start of the next block
ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})
ctx := app.NewContext(true, sdk.Header{Height: app.LastBlockHeight()})

// We export at last height + 1, because that's the height at which
// Tendermint will start InitChain.
Expand Down Expand Up @@ -55,7 +53,7 @@ func (app *App) ExportAppToFileStateAndValidators(
forZeroHeight bool, jailAllowedAddrs []string, file *os.File,
) (servertypes.ExportedApp, error) {
// as if they could withdraw from the start of the next block
ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})
ctx := app.NewContext(true, sdk.Header{Height: app.LastBlockHeight()})

// We export at last height + 1, because that's the height at which
// Tendermint will start InitChain.
Expand Down
2 changes: 1 addition & 1 deletion app/optimistic_processing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
sdk "github.com/cosmos/cosmos-sdk/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
abci "github.com/sei-protocol/sei-chain/sei-tendermint/abci/types"
tmproto "github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types"

Check failure on line 11 in app/optimistic_processing_test.go

View workflow job for this annotation

GitHub Actions / Test sei-chain

"github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types" imported as tmproto and not used

Check failure on line 11 in app/optimistic_processing_test.go

View workflow job for this annotation

GitHub Actions / Go / Lint

"github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types" imported as tmproto and not used

Check failure on line 11 in app/optimistic_processing_test.go

View workflow job for this annotation

GitHub Actions / Test sei-chain

"github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types" imported as tmproto and not used
"github.com/stretchr/testify/suite"
)

Expand All @@ -20,7 +20,7 @@

func (suite *OptimisticProcessingTestSuite) SetupTest() {
suite.app = Setup(suite.T(), false, false, false)
suite.ctx = suite.app.BaseApp.NewContext(false, tmproto.Header{Height: 1})
suite.ctx = suite.app.BaseApp.NewContext(false, sdk.Header{Height: 1})
}

func TestOptimisticProcessingTestSuite(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func newTestWrapper(tb testing.TB, tm time.Time, valPub cryptotypes.PubKey, enab
} else {
appPtr = Setup(tb, false, enableEVMCustomPrecompiles, false, baseAppOptions...)
}
ctx := appPtr.NewContext(false, tmproto.Header{Height: 1, ChainID: "sei-test", Time: tm})
ctx := appPtr.NewContext(false, sdk.Header{Height: 1, ChainID: "sei-test", Time: tm})
wrapper := &TestWrapper{
App: appPtr,
Ctx: ctx,
Expand Down Expand Up @@ -292,7 +292,7 @@ func (s *TestWrapper) BeginBlock() {

newBlockTime := s.Ctx.BlockTime().Add(2 * time.Second)

header := tmproto.Header{Height: s.Ctx.BlockHeight() + 1, Time: newBlockTime}
header := sdk.Header{Height: s.Ctx.BlockHeight() + 1, Time: newBlockTime}
newCtx := s.Ctx.WithBlockTime(newBlockTime).WithBlockHeight(s.Ctx.BlockHeight() + 1)
s.Ctx = newCtx
lastCommitInfo := abci.LastCommitInfo{
Expand Down Expand Up @@ -914,7 +914,7 @@ func GenTx(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, ch
}

func SignCheckDeliver(
t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header tmproto.Header, msgs []sdk.Msg,
t *testing.T, txCfg client.TxConfig, app *bam.BaseApp, header sdk.Header, msgs []sdk.Msg,
chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey,
) (sdk.GasInfo, *sdk.Result, error) {

Expand Down Expand Up @@ -992,7 +992,7 @@ func incrementAllSequenceNumbers(initSeqNums []uint64) {

// CheckBalance checks the balance of an account.
func CheckBalance(t *testing.T, app *App, addr sdk.AccAddress, balances sdk.Coins) {
ctxCheck := app.NewContext(true, tmproto.Header{})
ctxCheck := app.NewContext(true, sdk.Header{})
require.True(t, balances.IsEqual(app.BankKeeper.GetAllBalances(ctxCheck, addr)))
}

Expand Down
4 changes: 2 additions & 2 deletions app/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestSkipOptimisticProcessingOnUpgrade(t *testing.T) {
testWrapper := app.NewTestWrapper(t, tm, valPub, false)

// No optimistic processing with upgrade scheduled
testCtx := testWrapper.App.BaseApp.NewContext(false, tmproto.Header{Height: 3, ChainID: "sei-test", Time: tm})
testCtx := testWrapper.App.BaseApp.NewContext(false, sdk.Header{Height: 3, ChainID: "sei-test", Time: tm})

testWrapper.App.UpgradeKeeper.ScheduleUpgrade(testWrapper.Ctx, types.Plan{
Name: "test-plan",
Expand All @@ -60,7 +60,7 @@ func TestSkipOptimisticProcessingOnUpgrade(t *testing.T) {
tm := time.Now().UTC()
valPub := secp256k1.GenPrivKey().PubKey()
testWrapper := app.NewTestWrapper(t, tm, valPub, false)
testCtx := testWrapper.App.BaseApp.NewContext(false, tmproto.Header{Height: 3, ChainID: "sei-test", Time: tm})
testCtx := testWrapper.App.BaseApp.NewContext(false, sdk.Header{Height: 3, ChainID: "sei-test", Time: tm})

testWrapper.App.UpgradeKeeper.ScheduleUpgrade(testWrapper.Ctx, types.Plan{
Name: "test-plan",
Expand Down
2 changes: 1 addition & 1 deletion giga/deps/testutil/keeper/epoch.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func EpochKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
paramsSubspace,
)

ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger())
ctx := sdk.NewContext(stateStore, sdk.Header{}, false, log.NewNopLogger())

// Initialize params
k.SetParams(ctx, types.DefaultParams())
Expand Down
8 changes: 4 additions & 4 deletions giga/deps/xbank/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (suite *IntegrationTestSuite) SetupTest() {
})
a := wrapper.App
ctx := wrapper.Ctx
ctx = ctx.WithBlockHeader(tmproto.Header{
ctx = ctx.WithBlockHeader(sdk.Header{
Height: ctx.BlockHeader().Height,
ChainID: ctx.BlockHeader().ChainID,
Time: blockTime,
Expand Down Expand Up @@ -403,7 +403,7 @@ func (suite *IntegrationTestSuite) TestHasBalance() {
func (suite *IntegrationTestSuite) TestSpendableCoins() {
app, ctx := suite.app, suite.ctx
now := tmtime.Now()
ctx = ctx.WithBlockHeader(tmproto.Header{Time: now})
ctx = ctx.WithBlockHeader(sdk.Header{Time: now})
endTime := now.Add(24 * time.Hour)

origCoins := sdk.NewCoins(sdk.NewInt64Coin("usei", 100))
Expand Down Expand Up @@ -434,7 +434,7 @@ func (suite *IntegrationTestSuite) TestSpendableCoins() {
func (suite *IntegrationTestSuite) TestVestingAccountSend() {
app, ctx := suite.app, suite.ctx
now := tmtime.Now()
ctx = ctx.WithBlockHeader(tmproto.Header{Time: now})
ctx = ctx.WithBlockHeader(sdk.Header{Time: now})
endTime := now.Add(24 * time.Hour)

origCoins := sdk.NewCoins(sdk.NewInt64Coin("usei", 100))
Expand Down Expand Up @@ -462,7 +462,7 @@ func (suite *IntegrationTestSuite) TestVestingAccountSend() {
func (suite *IntegrationTestSuite) TestPeriodicVestingAccountSend() {
app, ctx := suite.app, suite.ctx
now := tmtime.Now()
ctx = ctx.WithBlockHeader(tmproto.Header{Time: now})
ctx = ctx.WithBlockHeader(sdk.Header{Time: now})
origCoins := sdk.NewCoins(sdk.NewInt64Coin("usei", 100))
sendCoins := sdk.NewCoins(sdk.NewInt64Coin("usei", 50))

Expand Down
2 changes: 1 addition & 1 deletion giga/tests/giga_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func NewGigaTestContext(t testing.TB, testAccts []utils.TestAcct, blockTime time
}
testApp := wrapper.App
ctx := wrapper.Ctx
ctx = ctx.WithBlockHeader(tmproto.Header{
ctx = ctx.WithBlockHeader(sdk.Header{
Height: ctx.BlockHeader().Height,
ChainID: ctx.BlockHeader().ChainID,
Time: blockTime,
Expand Down
2 changes: 1 addition & 1 deletion giga/tests/state_harness_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func NewStateTestContext(t testing.TB, blockTime time.Time, workers int, mode Ex
}
testApp := wrapper.App
ctx := wrapper.Ctx
ctx = ctx.WithBlockHeader(tmproto.Header{
ctx = ctx.WithBlockHeader(sdk.Header{
Height: ctx.BlockHeader().Height,
ChainID: ctx.BlockHeader().ChainID,
Time: blockTime,
Expand Down
2 changes: 1 addition & 1 deletion occ_tests/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/sei-protocol/sei-chain/sei-tendermint/abci/types"
tmproto "github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types"

Check failure on line 28 in occ_tests/utils/utils.go

View workflow job for this annotation

GitHub Actions / Test sei-chain

"github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types" imported as tmproto and not used

Check failure on line 28 in occ_tests/utils/utils.go

View workflow job for this annotation

GitHub Actions / Test sei-chain

"github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types" imported as tmproto and not used

Check failure on line 28 in occ_tests/utils/utils.go

View workflow job for this annotation

GitHub Actions / Go / Lint

"github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types" imported as tmproto and not used

Check failure on line 28 in occ_tests/utils/utils.go

View workflow job for this annotation

GitHub Actions / Go / Lint

"github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types" imported as tmproto and not used

Check failure on line 28 in occ_tests/utils/utils.go

View workflow job for this annotation

GitHub Actions / Test sei-chain

"github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types" imported as tmproto and not used

Check failure on line 28 in occ_tests/utils/utils.go

View workflow job for this annotation

GitHub Actions / Test sei-chain

"github.com/sei-protocol/sei-chain/sei-tendermint/proto/tendermint/types" imported as tmproto and not used
wasmkeeper "github.com/sei-protocol/sei-chain/sei-wasmd/x/wasm/keeper"
wasmxtypes "github.com/sei-protocol/sei-chain/sei-wasmd/x/wasm/types"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -165,7 +165,7 @@
})
testApp := wrapper.App
ctx := wrapper.Ctx
ctx = ctx.WithBlockHeader(tmproto.Header{Height: ctx.BlockHeader().Height, ChainID: ctx.BlockHeader().ChainID, Time: blockTime})
ctx = ctx.WithBlockHeader(sdk.Header{Height: ctx.BlockHeader().Height, ChainID: ctx.BlockHeader().ChainID, Time: blockTime})
amounts := sdk.NewCoins(sdk.NewCoin("usei", sdk.NewInt(1000000000000000)), sdk.NewCoin("uusdc", sdk.NewInt(1000000000000000)))
bankkeeper := testApp.BankKeeper
wasmKeeper := testApp.WasmKeeper
Expand Down
Loading
Loading