Skip to content

Commit bb0c056

Browse files
authored
2.0.40beta release (#650)
* 2.0.40beta Release * Remove race * notes * lint * sd * fix test * fix more tests * rw lock * replace * import
1 parent 2c85026 commit bb0c056

14 files changed

+53
-31
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ Ref: https://keepachangelog.com/en/1.0.0/
2828

2929
# Changelog
3030

31+
## 2.0.40beta - 2023-03-10
32+
* [#646] (https://github.com/sei-protocol/sei-chain/pull/646) Optimizations for FinalizeBlock
33+
* [#644] (https://github.com/sei-protocol/sei-chain/pull/644) [Oak Audit] Add check for non-existent transaction
34+
* [#647] (https://github.com/sei-protocol/sei-chain/pull/647) Fixes to race conditions
35+
* [#638] (https://github.com/sei-protocol/sei-chain/pull/638) Emit Version Related Metrics
36+
* [#636] (https://github.com/sei-protocol/sei-chain/pull/636) Fix deadlock with upgrades
37+
* [#635] (https://github.com/sei-protocol/sei-chain/pull/635) Add event to dex messages
38+
3139
## 2.0.39beta - 2023-03-06
3240
* [#632](https://github.com/sei-protocol/sei-chain/pull/632) Bump Sei-tendermint to reduce log volume
3341
* [#631](https://github.com/sei-protocol/sei-chain/pull/631) Nondeterminism deadlock fixes

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ BUILD_FLAGS := -tags "$(build_tags)" -ldflags '$(ldflags)'
6666
all: lint install
6767

6868
install: go.sum
69-
go install -race $(BUILD_FLAGS) ./cmd/seid
69+
go install $(BUILD_FLAGS) ./cmd/seid
7070

7171
# In case when running seid fails with nitro issue or if you make changes to nitro, please use install-all
7272
install-all: build-nitro install

app/antedecorators/gasless_test.go

+14-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
"testing"
66

7+
"github.com/cosmos/cosmos-sdk/store"
78
sdk "github.com/cosmos/cosmos-sdk/types"
89
"github.com/cosmos/cosmos-sdk/types/accesscontrol"
910
"github.com/cosmos/cosmos-sdk/x/staking"
@@ -16,6 +17,9 @@ import (
1617
oracletypes "github.com/sei-protocol/sei-chain/x/oracle/types"
1718
"github.com/stretchr/testify/require"
1819
"github.com/tendermint/tendermint/crypto/secp256k1"
20+
"github.com/tendermint/tendermint/libs/log"
21+
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
22+
tmdb "github.com/tendermint/tm-db"
1923
)
2024

2125
var output = ""
@@ -118,7 +122,12 @@ func TestGaslessDecorator(t *testing.T) {
118122
FakeAnteDecoratorThree{},
119123
}
120124
chainedHandler, depGen := sdk.ChainAnteDecorators(anteDecorators...)
121-
_, err := chainedHandler(sdk.Context{}, FakeTx{}, false)
125+
126+
db := tmdb.NewMemDB()
127+
stateStore := store.NewCommitMultiStore(db)
128+
ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger())
129+
130+
_, err := chainedHandler(ctx, FakeTx{}, false)
122131
require.NoError(t, err)
123132
require.Equal(t, "onetwothree", output)
124133
_, err = depGen([]accesscontrol.AccessOperation{}, FakeTx{})
@@ -171,7 +180,7 @@ func TestDexPlaceOrderGasless(t *testing.T) {
171180
// this needs to be updated if its changed from constant true
172181
// reset gasless
173182
gasless = true
174-
err := CallGaslessDecoratorWithMsg(sdk.Context{}, &types.MsgPlaceOrders{}, oraclekeeper.Keeper{}, nitrokeeper.Keeper{})
183+
err := CallGaslessDecoratorWithMsg(sdk.NewContext(nil, tmproto.Header{}, false, nil), &types.MsgPlaceOrders{}, oraclekeeper.Keeper{}, nitrokeeper.Keeper{})
175184
require.NoError(t, err)
176185
require.True(t, gasless)
177186
}
@@ -193,14 +202,14 @@ func TestDexCancelOrderGasless(t *testing.T) {
193202
// not whitelisted
194203
// reset gasless
195204
gasless = true
196-
err := CallGaslessDecoratorWithMsg(sdk.Context{}, &cancelMsg1, oraclekeeper.Keeper{}, nitrokeeper.Keeper{})
205+
err := CallGaslessDecoratorWithMsg(sdk.NewContext(nil, tmproto.Header{}, false, nil), &cancelMsg1, oraclekeeper.Keeper{}, nitrokeeper.Keeper{})
197206
require.NoError(t, err)
198207
require.False(t, gasless)
199208

200209
// whitelisted
201210
// reset gasless
202211
gasless = true
203-
err = CallGaslessDecoratorWithMsg(sdk.Context{}, &cancelMsg2, oraclekeeper.Keeper{}, nitrokeeper.Keeper{})
212+
err = CallGaslessDecoratorWithMsg(sdk.NewContext(nil, tmproto.Header{}, false, nil), &cancelMsg2, oraclekeeper.Keeper{}, nitrokeeper.Keeper{})
204213
require.NoError(t, err)
205214
require.True(t, gasless)
206215
}
@@ -239,7 +248,7 @@ func TestNonGaslessMsg(t *testing.T) {
239248
// this needs to be updated if its changed from constant true
240249
// reset gasless
241250
gasless = true
242-
err := CallGaslessDecoratorWithMsg(sdk.Context{}, &types.MsgRegisterContract{}, oraclekeeper.Keeper{}, nitrokeeper.Keeper{})
251+
err := CallGaslessDecoratorWithMsg(sdk.NewContext(nil, tmproto.Header{}, false, nil), &types.MsgRegisterContract{}, oraclekeeper.Keeper{}, nitrokeeper.Keeper{})
243252
require.NoError(t, err)
244253
require.False(t, gasless)
245254
}

app/antedecorators/priority_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ import (
1010
"github.com/sei-protocol/sei-chain/x/dex/types"
1111
oracletypes "github.com/sei-protocol/sei-chain/x/oracle/types"
1212
"github.com/stretchr/testify/require"
13+
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
1314
)
1415

1516
func TestPriorityAnteDecorator(t *testing.T) {
1617
output = ""
1718
anteDecorators := []sdk.AnteFullDecorator{
1819
sdk.DefaultWrappedAnteDecorator(antedecorators.NewPriorityDecorator()),
1920
}
20-
ctx := sdk.Context{}
21+
ctx := sdk.NewContext(nil, tmproto.Header{}, false, nil)
2122
chainedHandler, _ := sdk.ChainAnteDecorators(anteDecorators...)
2223
// test with normal priority
2324
newCtx, err := chainedHandler(
@@ -34,7 +35,7 @@ func TestPriorityAnteDecoratorTooHighPriority(t *testing.T) {
3435
anteDecorators := []sdk.AnteFullDecorator{
3536
sdk.DefaultWrappedAnteDecorator(antedecorators.NewPriorityDecorator()),
3637
}
37-
ctx := sdk.Context{}
38+
ctx := sdk.NewContext(nil, tmproto.Header{}, false, nil)
3839
chainedHandler, _ := sdk.ChainAnteDecorators(anteDecorators...)
3940
// test with too high priority, should be auto capped
4041
newCtx, err := chainedHandler(
@@ -55,7 +56,7 @@ func TestPriorityAnteDecoratorOracleMsg(t *testing.T) {
5556
anteDecorators := []sdk.AnteFullDecorator{
5657
sdk.DefaultWrappedAnteDecorator(antedecorators.NewPriorityDecorator()),
5758
}
58-
ctx := sdk.Context{}
59+
ctx := sdk.NewContext(nil, tmproto.Header{}, false, nil)
5960
chainedHandler, _ := sdk.ChainAnteDecorators(anteDecorators...)
6061
// test with zero priority, should be bumped up to oracle priority
6162
newCtx, err := chainedHandler(

app/antedecorators/traced_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"github.com/sei-protocol/sei-chain/app/antedecorators"
88
"github.com/sei-protocol/sei-chain/utils"
99
"github.com/stretchr/testify/require"
10+
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
1011
)
1112

1213
func TestTracedDecorator(t *testing.T) {
@@ -20,6 +21,6 @@ func TestTracedDecorator(t *testing.T) {
2021
return sdk.DefaultWrappedAnteDecorator(antedecorators.NewTracedAnteDecorator(d, nil))
2122
})
2223
chainedHandler, _ := sdk.ChainAnteDecorators(tracedDecorators...)
23-
chainedHandler(sdk.Context{}, FakeTx{}, false)
24+
chainedHandler(sdk.NewContext(nil, tmproto.Header{}, false, nil), FakeTx{}, false)
2425
require.Equal(t, "onetwothree", output)
2526
}

app/upgrades.go

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ var upgradesList = []string{
5555
"2.0.37beta",
5656
"2.0.38beta",
5757
"2.0.39beta",
58+
"2.0.40beta",
5859
}
5960

6061
func (app App) RegisterUpgradeHandlers() {

cmd/seid/cmd/root.go

-5
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import (
66
"io"
77
"math"
88
"math/rand"
9-
"net/http"
10-
_ "net/http/pprof"
119
"os"
1210
"path/filepath"
1311
"time"
@@ -63,9 +61,6 @@ func (s *rootOptions) apply(options ...Option) { //nolint:unused // I figure thi
6361

6462
// NewRootCmd creates a new root command for a Cosmos SDK application
6563
func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
66-
go func() {
67-
http.ListenAndServe(":6060", nil)
68-
}()
6964
encodingConfig := app.MakeEncodingConfig()
7065
initClientCtx := client.Context{}.
7166
WithCodec(encodingConfig.Marshaler).

go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,10 @@ require (
269269
replace (
270270
github.com/CosmWasm/wasmd => github.com/sei-protocol/sei-wasmd v0.0.1
271271
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
272-
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.2.1-tony-2
273-
github.com/cosmos/iavl => github.com/sei-protocol/sei-iavl v0.1.2-tony-3
272+
github.com/cosmos/cosmos-sdk => github.com/sei-protocol/sei-cosmos v0.2.2
273+
github.com/cosmos/iavl => github.com/sei-protocol/sei-iavl v0.1.3
274274
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
275275
github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4
276-
github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.177
276+
github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.178
277277
google.golang.org/grpc => google.golang.org/grpc v1.33.2
278278
)

go.sum

+6-6
Original file line numberDiff line numberDiff line change
@@ -1066,12 +1066,12 @@ github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod
10661066
github.com/securego/gosec/v2 v2.11.0 h1:+PDkpzR41OI2jrw1q6AdXZCbsNGNGT7pQjal0H0cArI=
10671067
github.com/securego/gosec/v2 v2.11.0/go.mod h1:SX8bptShuG8reGC0XS09+a4H2BoWSJi+fscA+Pulbpo=
10681068
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
1069-
github.com/sei-protocol/sei-cosmos v0.2.1-tony-2 h1:RFs3RZ0VVV9IFTsK/0WX9E/p8axapU51+rtYinU08Lc=
1070-
github.com/sei-protocol/sei-cosmos v0.2.1-tony-2/go.mod h1:LUhhplOtRXliV1x17gbOptKPy90xSK0Sxv8zmgsMvTY=
1071-
github.com/sei-protocol/sei-iavl v0.1.2-tony-3 h1:udXCIcgpbJjX09c3udk8IlAyTRQyFWhZjw5SAgcuqaI=
1072-
github.com/sei-protocol/sei-iavl v0.1.2-tony-3/go.mod h1:7PfkEVT5dcoQE+s/9KWdoXJ8VVVP1QpYYPLdxlkSXFk=
1073-
github.com/sei-protocol/sei-tendermint v0.1.177 h1:gn6/z82eGBBdyRgEyd8wpbB0C3/l1BhjzcsiCFoSrvo=
1074-
github.com/sei-protocol/sei-tendermint v0.1.177/go.mod h1:+BtDvAwTkE64BlxzpH9ZP7S6vUYT9wRXiZa/WW8/o4g=
1069+
github.com/sei-protocol/sei-cosmos v0.2.2 h1:+VtjwsDcHJrxbNfXgZn5vkaQxtVRXC9tMzdyN/YMDDE=
1070+
github.com/sei-protocol/sei-cosmos v0.2.2/go.mod h1:LUhhplOtRXliV1x17gbOptKPy90xSK0Sxv8zmgsMvTY=
1071+
github.com/sei-protocol/sei-iavl v0.1.3 h1:0hvW1NtmBlZ7ZkerQcM/n+2tFKg0vUlYWK8q/OeuCgw=
1072+
github.com/sei-protocol/sei-iavl v0.1.3/go.mod h1:7PfkEVT5dcoQE+s/9KWdoXJ8VVVP1QpYYPLdxlkSXFk=
1073+
github.com/sei-protocol/sei-tendermint v0.1.178 h1:7ozXwpCvNrkU7UaaKcbHhtB/nRT0jQC3sC9VZJnK+Ak=
1074+
github.com/sei-protocol/sei-tendermint v0.1.178/go.mod h1:+BtDvAwTkE64BlxzpH9ZP7S6vUYT9wRXiZa/WW8/o4g=
10751075
github.com/sei-protocol/sei-tm-db v0.0.5 h1:3WONKdSXEqdZZeLuWYfK5hP37TJpfaUa13vAyAlvaQY=
10761076
github.com/sei-protocol/sei-tm-db v0.0.5/go.mod h1:Cpa6rGyczgthq7/0pI31jys2Fw0Nfrc+/jKdP1prVqY=
10771077
github.com/sei-protocol/sei-wasmd v0.0.1 h1:dRvdapc1sqWxhIB2+DKS5LfilFjOsaFwWkGkSWwQIow=

x/dex/exchange/limit_order_fuzz_test.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ import (
66

77
sdk "github.com/cosmos/cosmos-sdk/types"
88
"github.com/sei-protocol/sei-chain/testutil/fuzzing"
9+
keepertest "github.com/sei-protocol/sei-chain/testutil/keeper"
910
"github.com/sei-protocol/sei-chain/utils/datastructures"
1011
"github.com/sei-protocol/sei-chain/x/dex/exchange"
1112
"github.com/sei-protocol/sei-chain/x/dex/types"
1213
"github.com/stretchr/testify/require"
13-
14-
keepertest "github.com/sei-protocol/sei-chain/testutil/keeper"
14+
"github.com/tendermint/tendermint/libs/log"
15+
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
1516
)
1617

17-
var TestFuzzLimitCtx = sdk.Context{}
18+
var TestFuzzLimitCtx = sdk.NewContext(nil, tmproto.Header{}, false, log.NewNopLogger())
1819

1920
func FuzzMatchLimitOrders(f *testing.F) {
2021
TestFuzzLimitCtx = TestFuzzLimitCtx.WithBlockHeight(1).WithBlockTime(time.Now())

x/dex/exchange/market_order_fuzz_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ import (
1313
"github.com/sei-protocol/sei-chain/x/dex/types"
1414
dexutils "github.com/sei-protocol/sei-chain/x/dex/utils"
1515
"github.com/stretchr/testify/require"
16+
"github.com/tendermint/tendermint/libs/log"
17+
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
1618
)
1719

18-
var TestFuzzMarketCtx = sdk.Context{}
20+
var TestFuzzMarketCtx = sdk.NewContext(nil, tmproto.Header{}, false, log.NewNopLogger())
1921

2022
func FuzzMatchMarketOrders(f *testing.F) {
2123
f.Fuzz(fuzzTargetMatchMarketOrders)

x/dex/exchange/settlement_fuzz_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ import (
1111
"github.com/sei-protocol/sei-chain/x/dex/exchange"
1212
"github.com/sei-protocol/sei-chain/x/dex/types"
1313
"github.com/stretchr/testify/require"
14+
"github.com/tendermint/tendermint/libs/log"
15+
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
1416
)
1517

16-
var TestFuzzSettleCtx = sdk.Context{}
18+
var TestFuzzSettleCtx = sdk.NewContext(nil, tmproto.Header{}, false, log.NewNopLogger())
1719

1820
func FuzzSettleMarketOrder(f *testing.F) {
1921
TestFuzzSettleCtx = TestFuzzSettleCtx.WithBlockHeight(1).WithBlockTime(time.Now())

x/nitro/replay/replay_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
sdk "github.com/cosmos/cosmos-sdk/types"
1212
"github.com/sei-protocol/sei-chain/x/nitro/types"
1313
"github.com/stretchr/testify/require"
14+
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
1415
)
1516

1617
func testAccount() *types.Account {
@@ -59,7 +60,7 @@ func testTransaction() types.TransactionData {
5960
}
6061

6162
func TestReplay(t *testing.T) {
62-
ctx := sdk.Context{}.WithBlockHeight(1)
63+
ctx := sdk.NewContext(nil, tmproto.Header{}, false, nil).WithBlockHeight(1)
6364
tx := testTransaction()
6465
txbz, _ := tx.Marshal()
6566
_, err := Replay(ctx, [][]byte{txbz}, []*types.Account{}, []*types.Account{testAccount()}, []*types.Account{})

x/oracle/ante_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/sei-protocol/sei-chain/x/oracle"
1010
oracletypes "github.com/sei-protocol/sei-chain/x/oracle/types"
1111
"github.com/stretchr/testify/require"
12+
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
1213
)
1314

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

3334
for _, tc := range testCases {
3435
t.Run(tc.name, func(t *testing.T) {
35-
_, err := anteHandler(sdk.Context{}, tc.tx, false)
36+
_, err := anteHandler(sdk.NewContext(nil, tmproto.Header{}, false, nil), tc.tx, false)
3637
if tc.expErr {
3738
require.Error(t, err)
3839
} else {

0 commit comments

Comments
 (0)