Skip to content

Commit

Permalink
feat: bump up lbm-sdk v0.46.0-rc10 (#119)
Browse files Browse the repository at this point in the history
* feat: bump up lbm-sdk v0.46.0-rc10

Signed-off-by: zemyblue <zemyblue@gmail.com>

* chore: apply changes of go.sum

Signed-off-by: zemyblue <zemyblue@gmail.com>

* fix: integration test - TestLBMQueryTxPagination

* fix: revert all removed tests

* test: change BroadcastMode from block to sync

* test: fix lint

* test: add explicit broadcast mode sync

* test: revert changing broadcast mode

Signed-off-by: zemyblue <zemyblue@gmail.com>
Co-authored-by: dudong2 <leesj9476lsj@gmail.com>
  • Loading branch information
zemyblue and dudong2 authored Nov 25, 2022
1 parent 5b35593 commit e8efc09
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 11 deletions.
15 changes: 15 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/line/lbm-sdk/baseapp"
"github.com/line/lbm-sdk/client"
nodeservice "github.com/line/lbm-sdk/client/grpc/node"
"github.com/line/lbm-sdk/client/grpc/tmservice"
"github.com/line/lbm-sdk/client/rpc"
"github.com/line/lbm-sdk/codec"
Expand All @@ -29,6 +30,7 @@ import (
"github.com/line/lbm-sdk/server/config"
servertypes "github.com/line/lbm-sdk/server/types"
"github.com/line/lbm-sdk/simapp"
"github.com/line/lbm-sdk/store/streaming"
sdk "github.com/line/lbm-sdk/types"
"github.com/line/lbm-sdk/types/module"
"github.com/line/lbm-sdk/version"
Expand Down Expand Up @@ -253,6 +255,12 @@ func NewLinkApp(
// not include this key.
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)

// configure state listening capabilities using AppOptions
// we are doing nothing with the returned streamingServices and waitGroup in this case
if _, _, err := streaming.LoadStreamingServices(bApp, appOpts, appCodec, keys); err != nil {
ostos.Exit(err.Error())
}

app := &LinkApp{
BaseApp: bApp,
legacyAmino: legacyAmino,
Expand Down Expand Up @@ -672,6 +680,9 @@ func (app *LinkApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APICo
// Register new tendermint queries routes from grpc-gateway.
tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)

// Register node gRPC service for grpc-gateway.
nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)

// Register legacy and grpc-gateway routes for all modules.
ModuleBasics.RegisterRESTRoutes(clientCtx, apiSvr.Router)
ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
Expand All @@ -692,6 +703,10 @@ func (app *LinkApp) RegisterTendermintService(clientCtx client.Context) {
tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry)
}

func (app *LinkApp) RegisterNodeService(clientCtx client.Context) {
nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter())
}

// RegisterSwaggerAPI registers swagger route with API Server
func RegisterSwaggerAPI(rtr *mux.Router) {
statikFS, err := fs.New()
Expand Down
7 changes: 6 additions & 1 deletion cli_test/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,15 @@ func TestLBMFeesDeduction(t *testing.T) {
keyFoo, barAddr, sdk.NewCoin(fooDenom, largeCoins),
fmt.Sprintf("--fees=%s", sdk.NewInt64Coin(feeDenom, 2)), "-y")
require.NoError(t, err)
require.Contains(t, out.String(), "insufficient funds")

// Wait for a block
err = n.WaitForNextBlock()
require.NoError(t, err)

resp := UnmarshalTxResponse(t, out.Bytes())
out2 := f.QueryTx(resp.TxHash)
require.Contains(t, out2.String(), "insufficient funds")

// ensure state didn't change
fooBal = f.QueryBalances(fooAddr)
require.Equal(t, fooAmt.Int64(), fooBal.GetBalances().AmountOf(fooDenom).Int64())
Expand Down Expand Up @@ -743,6 +746,8 @@ func TestLBMQueryTxPagination(t *testing.T) {
require.NoError(t, err)
seq++
}
err := n.WaitForNextBlock()
require.NoError(t, err)

// perPage = 15, 2 pages
txsPage1 := f.QueryTxs(1, 2, fmt.Sprintf("--events='message.sender=%s'", fooAddr))
Expand Down
2 changes: 1 addition & 1 deletion cli_test/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ func newValidator(f *Fixtures, cfg testnet.Config, appCfg *srvconfig.Config, ctx

ctx.Logger = logger

require.NoError(f.T, os.MkdirAll(filepath.Join(f.Home, "config"), 0755))
require.NoError(f.T, os.MkdirAll(filepath.Join(f.Home, "config"), 0o755))

tmCfg.SetRoot(f.Home)
tmCfg.Moniker = f.Moniker
Expand Down
7 changes: 5 additions & 2 deletions cmd/lbm/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/line/lbm-sdk/client/debug"
"github.com/line/lbm-sdk/client/flags"
"github.com/line/lbm-sdk/client/keys"
"github.com/line/lbm-sdk/client/pruning"
"github.com/line/lbm-sdk/client/rpc"
"github.com/line/lbm-sdk/codec"
"github.com/line/lbm-sdk/server"
Expand Down Expand Up @@ -163,6 +164,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {
testnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}),
debug.Cmd(),
config.Cmd(),
pruning.PruningCmd(newApp),
)

server.AddCommands(rootCmd, app.DefaultNodeHome, newApp, createSimappAndExport, addModuleInitFlags)
Expand Down Expand Up @@ -256,7 +258,7 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts serverty
}

snapshotDir := filepath.Join(cast.ToString(appOpts.Get(flags.FlagHome)), "data", "snapshots")
if err := os.MkdirAll(snapshotDir, 0755); err != nil {
if err := os.MkdirAll(snapshotDir, 0o755); err != nil {
panic(err)
}
snapshotDB, err := sdk.NewLevelDB("metadata", snapshotDir)
Expand Down Expand Up @@ -286,10 +288,11 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts serverty
baseapp.SetMinRetainBlocks(cast.ToUint64(appOpts.Get(server.FlagMinRetainBlocks))),
baseapp.SetInterBlockCache(cache),
baseapp.SetIndexEvents(cast.ToStringSlice(appOpts.Get(server.FlagIndexEvents))),
baseapp.SetIAVLCacheSize(cast.ToInt(appOpts.Get(server.FlagIAVLCacheSize))),
baseapp.SetSnapshotStore(snapshotStore),
baseapp.SetSnapshotInterval(cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval))),
baseapp.SetSnapshotKeepRecent(cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent))),
baseapp.SetIAVLCacheSize(cast.ToInt(appOpts.Get(server.FlagIAVLCacheSize))),
baseapp.SetIAVLDisableFastNode(cast.ToBool(appOpts.Get(server.FlagIAVLFastNode))),
baseapp.SetChanCheckTxSize(cast.ToUint(appOpts.Get(server.FlagChanCheckTxSize))),
)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/lbm/cmd/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Example:
return cmd
}

const nodeDirPerm = 0755
const nodeDirPerm = 0o755

// Initialize the testnet
func InitTestnet(
Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.18
require (
github.com/golang/mock v1.6.0
github.com/gorilla/mux v1.8.0
github.com/line/lbm-sdk v0.46.0-rc9
github.com/line/lbm-sdk v0.46.0-rc10
github.com/line/ostracon v1.0.7-0.20220906074149-e6ecd80874f8
github.com/prometheus/client_golang v1.13.0
github.com/rakyll/statik v0.1.7
Expand Down Expand Up @@ -105,7 +105,7 @@ require (
github.com/regen-network/cosmos-proto v0.3.1 // indirect
github.com/rs/cors v1.8.2 // indirect
github.com/rs/zerolog v1.28.0 // indirect
github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand All @@ -118,6 +118,7 @@ require (
github.com/zondax/hid v0.9.0 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/net v0.0.0-20220617184016-355a448f1bc9 // indirect
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -734,8 +734,8 @@ github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QT
github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
github.com/line/gorocksdb v0.0.0-20210406043732-d4bea34b6d55/go.mod h1:DHRJroSL7NaRkpvocRx3OtRsleXVsYSxBI9SfHFlTQ0=
github.com/line/lbm-sdk v0.46.0-rc9 h1:DntTpRixOHhAHDLcaPBtPXJm1nS2Jg+LEGDtfwFYeic=
github.com/line/lbm-sdk v0.46.0-rc9/go.mod h1:WRGlX57Np2OUqp+F2LRVDBENGdZWIthNGiKufwkdFbQ=
github.com/line/lbm-sdk v0.46.0-rc10 h1:MzSIWJQbWFaheoRaq2egHTiT24mH8PxmfJUWMBP+98Q=
github.com/line/lbm-sdk v0.46.0-rc10/go.mod h1:EcflA9fjgm8tjuRtr/m5IRagu2p9MynZ3yDKAGCcL/4=
github.com/line/ostracon v1.0.7-0.20220906074149-e6ecd80874f8 h1:f4qs+qoF28n+bezpZIPAtbdl36l6hwm7EbrZeOGQZhI=
github.com/line/ostracon v1.0.7-0.20220906074149-e6ecd80874f8/go.mod h1:fZk18b2be10fRB4qGM2IyvMIGKuPtBVa8xnPxDg9LRI=
github.com/line/tm-db/v2 v2.0.0-init.1.0.20220121012851-61d2bc1d9486 h1:uvXQdcWaUyNsgkXBz375FpQ285WEJaLXhQ5HtoNK/GU=
Expand Down Expand Up @@ -1047,8 +1047,9 @@ github.com/sagikazarmark/crypt v0.5.0/go.mod h1:l+nzl7KWh51rpzp2h7t4MZWyiEWdhNpO
github.com/sagikazarmark/crypt v0.6.0/go.mod h1:U8+INwJo3nBv1m6A/8OBXAq7Jnpspk5AxSgDyEQcea8=
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/sanposhiho/wastedassign/v2 v2.0.6/go.mod h1:KyZ0MWTwxxBmfwn33zh3k1dmsbF2ud9pAAGfoLfjhtI=
github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4=
github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM=
github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0=
github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
Expand Down Expand Up @@ -1308,8 +1309,9 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5 h1:FR+oGxGfbQu1d+jglI3rCkjAjUnhRSZcUxr+DqlDLNo=
golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw=
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA=
golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
Expand Down

0 comments on commit e8efc09

Please sign in to comment.