Skip to content

Commit

Permalink
2.0.40beta release (#650)
Browse files Browse the repository at this point in the history
* 2.0.40beta Release

* Remove race

* notes

* lint

* sd

* fix test

* fix more tests

* rw lock

* replace

* import
  • Loading branch information
BrandonWeng committed Mar 10, 2023
1 parent 2c85026 commit bb0c056
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 31 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ Ref: https://keepachangelog.com/en/1.0.0/

# Changelog

## 2.0.40beta - 2023-03-10
* [#646] (https://github.com/sei-protocol/sei-chain/pull/646) Optimizations for FinalizeBlock
* [#644] (https://github.com/sei-protocol/sei-chain/pull/644) [Oak Audit] Add check for non-existent transaction
* [#647] (https://github.com/sei-protocol/sei-chain/pull/647) Fixes to race conditions
* [#638] (https://github.com/sei-protocol/sei-chain/pull/638) Emit Version Related Metrics
* [#636] (https://github.com/sei-protocol/sei-chain/pull/636) Fix deadlock with upgrades
* [#635] (https://github.com/sei-protocol/sei-chain/pull/635) Add event to dex messages

## 2.0.39beta - 2023-03-06
* [#632](https://github.com/sei-protocol/sei-chain/pull/632) Bump Sei-tendermint to reduce log volume
* [#631](https://github.com/sei-protocol/sei-chain/pull/631) Nondeterminism deadlock fixes
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
all: lint install

install: go.sum
go install -race $(BUILD_FLAGS) ./cmd/seid
go install $(BUILD_FLAGS) ./cmd/seid

# In case when running seid fails with nitro issue or if you make changes to nitro, please use install-all
install-all: build-nitro install
Expand Down
19 changes: 14 additions & 5 deletions app/antedecorators/gasless_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"testing"

"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/accesscontrol"
"github.com/cosmos/cosmos-sdk/x/staking"
Expand All @@ -16,6 +17,9 @@ import (
oracletypes "github.com/sei-protocol/sei-chain/x/oracle/types"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto/secp256k1"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmdb "github.com/tendermint/tm-db"
)

var output = ""
Expand Down Expand Up @@ -118,7 +122,12 @@ func TestGaslessDecorator(t *testing.T) {
FakeAnteDecoratorThree{},
}
chainedHandler, depGen := sdk.ChainAnteDecorators(anteDecorators...)
_, err := chainedHandler(sdk.Context{}, FakeTx{}, false)

db := tmdb.NewMemDB()
stateStore := store.NewCommitMultiStore(db)
ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger())

_, err := chainedHandler(ctx, FakeTx{}, false)
require.NoError(t, err)
require.Equal(t, "onetwothree", output)
_, err = depGen([]accesscontrol.AccessOperation{}, FakeTx{})
Expand Down Expand Up @@ -171,7 +180,7 @@ func TestDexPlaceOrderGasless(t *testing.T) {
// this needs to be updated if its changed from constant true
// reset gasless
gasless = true
err := CallGaslessDecoratorWithMsg(sdk.Context{}, &types.MsgPlaceOrders{}, oraclekeeper.Keeper{}, nitrokeeper.Keeper{})
err := CallGaslessDecoratorWithMsg(sdk.NewContext(nil, tmproto.Header{}, false, nil), &types.MsgPlaceOrders{}, oraclekeeper.Keeper{}, nitrokeeper.Keeper{})
require.NoError(t, err)
require.True(t, gasless)
}
Expand All @@ -193,14 +202,14 @@ func TestDexCancelOrderGasless(t *testing.T) {
// not whitelisted
// reset gasless
gasless = true
err := CallGaslessDecoratorWithMsg(sdk.Context{}, &cancelMsg1, oraclekeeper.Keeper{}, nitrokeeper.Keeper{})
err := CallGaslessDecoratorWithMsg(sdk.NewContext(nil, tmproto.Header{}, false, nil), &cancelMsg1, oraclekeeper.Keeper{}, nitrokeeper.Keeper{})
require.NoError(t, err)
require.False(t, gasless)

// whitelisted
// reset gasless
gasless = true
err = CallGaslessDecoratorWithMsg(sdk.Context{}, &cancelMsg2, oraclekeeper.Keeper{}, nitrokeeper.Keeper{})
err = CallGaslessDecoratorWithMsg(sdk.NewContext(nil, tmproto.Header{}, false, nil), &cancelMsg2, oraclekeeper.Keeper{}, nitrokeeper.Keeper{})
require.NoError(t, err)
require.True(t, gasless)
}
Expand Down Expand Up @@ -239,7 +248,7 @@ func TestNonGaslessMsg(t *testing.T) {
// this needs to be updated if its changed from constant true
// reset gasless
gasless = true
err := CallGaslessDecoratorWithMsg(sdk.Context{}, &types.MsgRegisterContract{}, oraclekeeper.Keeper{}, nitrokeeper.Keeper{})
err := CallGaslessDecoratorWithMsg(sdk.NewContext(nil, tmproto.Header{}, false, nil), &types.MsgRegisterContract{}, oraclekeeper.Keeper{}, nitrokeeper.Keeper{})
require.NoError(t, err)
require.False(t, gasless)
}
7 changes: 4 additions & 3 deletions app/antedecorators/priority_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ import (
"github.com/sei-protocol/sei-chain/x/dex/types"
oracletypes "github.com/sei-protocol/sei-chain/x/oracle/types"
"github.com/stretchr/testify/require"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)

func TestPriorityAnteDecorator(t *testing.T) {
output = ""
anteDecorators := []sdk.AnteFullDecorator{
sdk.DefaultWrappedAnteDecorator(antedecorators.NewPriorityDecorator()),
}
ctx := sdk.Context{}
ctx := sdk.NewContext(nil, tmproto.Header{}, false, nil)
chainedHandler, _ := sdk.ChainAnteDecorators(anteDecorators...)
// test with normal priority
newCtx, err := chainedHandler(
Expand All @@ -34,7 +35,7 @@ func TestPriorityAnteDecoratorTooHighPriority(t *testing.T) {
anteDecorators := []sdk.AnteFullDecorator{
sdk.DefaultWrappedAnteDecorator(antedecorators.NewPriorityDecorator()),
}
ctx := sdk.Context{}
ctx := sdk.NewContext(nil, tmproto.Header{}, false, nil)
chainedHandler, _ := sdk.ChainAnteDecorators(anteDecorators...)
// test with too high priority, should be auto capped
newCtx, err := chainedHandler(
Expand All @@ -55,7 +56,7 @@ func TestPriorityAnteDecoratorOracleMsg(t *testing.T) {
anteDecorators := []sdk.AnteFullDecorator{
sdk.DefaultWrappedAnteDecorator(antedecorators.NewPriorityDecorator()),
}
ctx := sdk.Context{}
ctx := sdk.NewContext(nil, tmproto.Header{}, false, nil)
chainedHandler, _ := sdk.ChainAnteDecorators(anteDecorators...)
// test with zero priority, should be bumped up to oracle priority
newCtx, err := chainedHandler(
Expand Down
3 changes: 2 additions & 1 deletion app/antedecorators/traced_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/sei-protocol/sei-chain/app/antedecorators"
"github.com/sei-protocol/sei-chain/utils"
"github.com/stretchr/testify/require"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)

func TestTracedDecorator(t *testing.T) {
Expand All @@ -20,6 +21,6 @@ func TestTracedDecorator(t *testing.T) {
return sdk.DefaultWrappedAnteDecorator(antedecorators.NewTracedAnteDecorator(d, nil))
})
chainedHandler, _ := sdk.ChainAnteDecorators(tracedDecorators...)
chainedHandler(sdk.Context{}, FakeTx{}, false)
chainedHandler(sdk.NewContext(nil, tmproto.Header{}, false, nil), FakeTx{}, false)
require.Equal(t, "onetwothree", output)
}
1 change: 1 addition & 0 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ var upgradesList = []string{
"2.0.37beta",
"2.0.38beta",
"2.0.39beta",
"2.0.40beta",
}

func (app App) RegisterUpgradeHandlers() {
Expand Down
5 changes: 0 additions & 5 deletions cmd/seid/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"io"
"math"
"math/rand"
"net/http"
_ "net/http/pprof"
"os"
"path/filepath"
"time"
Expand Down Expand Up @@ -63,9 +61,6 @@ func (s *rootOptions) apply(options ...Option) { //nolint:unused // I figure thi

// NewRootCmd creates a new root command for a Cosmos SDK application
func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
go func() {
http.ListenAndServe(":6060", nil)
}()
encodingConfig := app.MakeEncodingConfig()
initClientCtx := client.Context{}.
WithCodec(encodingConfig.Marshaler).
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@ require (
replace (
github.com/CosmWasm/wasmd => github.com/sei-protocol/sei-wasmd v0.0.1
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.2.1-tony-2
github.com/cosmos/iavl => github.com/sei-protocol/sei-iavl v0.1.2-tony-3
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.2.2
github.com/cosmos/iavl => github.com/sei-protocol/sei-iavl v0.1.3
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4
github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.177
github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.178
google.golang.org/grpc => google.golang.org/grpc v1.33.2
)
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1066,12 +1066,12 @@ github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod
github.com/securego/gosec/v2 v2.11.0 h1:+PDkpzR41OI2jrw1q6AdXZCbsNGNGT7pQjal0H0cArI=
github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo=
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
github.com/sei-protocol/sei-cosmos v0.2.1-tony-2 h1:RFs3RZ0VVV9IFTsK/0WX9E/p8axapU51+rtYinU08Lc=
github.com/sei-protocol/sei-cosmos v0.2.1-tony-2/go.mod h1:LUhhplOtRXliV1x17gbOptKPy90xSK0Sxv8zmgsMvTY=
github.com/sei-protocol/sei-iavl v0.1.2-tony-3 h1:udXCIcgpbJjX09c3udk8IlAyTRQyFWhZjw5SAgcuqaI=
github.com/sei-protocol/sei-iavl v0.1.2-tony-3/go.mod h1:7PfkEVT5dcoQE+s/9KWdoXJ8VVVP1QpYYPLdxlkSXFk=
github.com/sei-protocol/sei-tendermint v0.1.177 h1:gn6/z82eGBBdyRgEyd8wpbB0C3/l1BhjzcsiCFoSrvo=
github.com/sei-protocol/sei-tendermint v0.1.177/go.mod h1:+BtDvAwTkE64BlxzpH9ZP7S6vUYT9wRXiZa/WW8/o4g=
github.com/sei-protocol/sei-cosmos v0.2.2 h1:+VtjwsDcHJrxbNfXgZn5vkaQxtVRXC9tMzdyN/YMDDE=
github.com/sei-protocol/sei-cosmos v0.2.2/go.mod h1:LUhhplOtRXliV1x17gbOptKPy90xSK0Sxv8zmgsMvTY=
github.com/sei-protocol/sei-iavl v0.1.3 h1:0hvW1NtmBlZ7ZkerQcM/n+2tFKg0vUlYWK8q/OeuCgw=
github.com/sei-protocol/sei-iavl v0.1.3/go.mod h1:7PfkEVT5dcoQE+s/9KWdoXJ8VVVP1QpYYPLdxlkSXFk=
github.com/sei-protocol/sei-tendermint v0.1.178 h1:7ozXwpCvNrkU7UaaKcbHhtB/nRT0jQC3sC9VZJnK+Ak=
github.com/sei-protocol/sei-tendermint v0.1.178/go.mod h1:+BtDvAwTkE64BlxzpH9ZP7S6vUYT9wRXiZa/WW8/o4g=
github.com/sei-protocol/sei-tm-db v0.0.5 h1:3WONKdSXEqdZZeLuWYfK5hP37TJpfaUa13vAyAlvaQY=
github.com/sei-protocol/sei-tm-db v0.0.5/go.mod h1:Cpa6rGyczgthq7/0pI31jys2Fw0Nfrc+/jKdP1prVqY=
github.com/sei-protocol/sei-wasmd v0.0.1 h1:dRvdapc1sqWxhIB2+DKS5LfilFjOsaFwWkGkSWwQIow=
Expand Down
7 changes: 4 additions & 3 deletions x/dex/exchange/limit_order_fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import (

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/sei-protocol/sei-chain/testutil/fuzzing"
keepertest "github.com/sei-protocol/sei-chain/testutil/keeper"
"github.com/sei-protocol/sei-chain/utils/datastructures"
"github.com/sei-protocol/sei-chain/x/dex/exchange"
"github.com/sei-protocol/sei-chain/x/dex/types"
"github.com/stretchr/testify/require"

keepertest "github.com/sei-protocol/sei-chain/testutil/keeper"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)

var TestFuzzLimitCtx = sdk.Context{}
var TestFuzzLimitCtx = sdk.NewContext(nil, tmproto.Header{}, false, log.NewNopLogger())

func FuzzMatchLimitOrders(f *testing.F) {
TestFuzzLimitCtx = TestFuzzLimitCtx.WithBlockHeight(1).WithBlockTime(time.Now())
Expand Down
4 changes: 3 additions & 1 deletion x/dex/exchange/market_order_fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ import (
"github.com/sei-protocol/sei-chain/x/dex/types"
dexutils "github.com/sei-protocol/sei-chain/x/dex/utils"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)

var TestFuzzMarketCtx = sdk.Context{}
var TestFuzzMarketCtx = sdk.NewContext(nil, tmproto.Header{}, false, log.NewNopLogger())

func FuzzMatchMarketOrders(f *testing.F) {
f.Fuzz(fuzzTargetMatchMarketOrders)
Expand Down
4 changes: 3 additions & 1 deletion x/dex/exchange/settlement_fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import (
"github.com/sei-protocol/sei-chain/x/dex/exchange"
"github.com/sei-protocol/sei-chain/x/dex/types"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)

var TestFuzzSettleCtx = sdk.Context{}
var TestFuzzSettleCtx = sdk.NewContext(nil, tmproto.Header{}, false, log.NewNopLogger())

func FuzzSettleMarketOrder(f *testing.F) {
TestFuzzSettleCtx = TestFuzzSettleCtx.WithBlockHeight(1).WithBlockTime(time.Now())
Expand Down
3 changes: 2 additions & 1 deletion x/nitro/replay/replay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/sei-protocol/sei-chain/x/nitro/types"
"github.com/stretchr/testify/require"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)

func testAccount() *types.Account {
Expand Down Expand Up @@ -59,7 +60,7 @@ func testTransaction() types.TransactionData {
}

func TestReplay(t *testing.T) {
ctx := sdk.Context{}.WithBlockHeight(1)
ctx := sdk.NewContext(nil, tmproto.Header{}, false, nil).WithBlockHeight(1)
tx := testTransaction()
txbz, _ := tx.Marshal()
_, err := Replay(ctx, [][]byte{txbz}, []*types.Account{}, []*types.Account{testAccount()}, []*types.Account{})
Expand Down
3 changes: 2 additions & 1 deletion x/oracle/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/sei-protocol/sei-chain/x/oracle"
oracletypes "github.com/sei-protocol/sei-chain/x/oracle/types"
"github.com/stretchr/testify/require"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)

func TestOracleVoteAloneAnteHandler(t *testing.T) {
Expand All @@ -32,7 +33,7 @@ func TestOracleVoteAloneAnteHandler(t *testing.T) {

for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
_, err := anteHandler(sdk.Context{}, tc.tx, false)
_, err := anteHandler(sdk.NewContext(nil, tmproto.Header{}, false, nil), tc.tx, false)
if tc.expErr {
require.Error(t, err)
} else {
Expand Down

0 comments on commit bb0c056

Please sign in to comment.