Skip to content

Commit 905bc49

Browse files
Upgrade for v1.0.17 (#353)
* fix for LCD calls * Local chain upgrade path, fix
1 parent 8fcf934 commit 905bc49

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

app/app.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import (
77
context "context"
88
"fmt"
99
"io"
10+
"net/http"
1011
"os"
12+
"strings"
1113

1214
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
1315
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
@@ -544,6 +546,18 @@ func NewArkeoApp(
544546
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
545547
})
546548

549+
// general v1.0.17.1 upgrade handler
550+
app.Keepers.UpgradeKeeper.SetUpgradeHandler("general-v1.0.17.1", func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
551+
app.Logger().Info("running general-v1.0.17.1 upgrade")
552+
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
553+
})
554+
555+
// providers v1.0.17.1 upgrade handler
556+
app.Keepers.UpgradeKeeper.SetUpgradeHandler("providers-v1.0.17.1", func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
557+
app.Logger().Info("running providers-v1.0.17.1 upgrade")
558+
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
559+
})
560+
547561
groupConfig := group.DefaultConfig()
548562
/*
549563
Example of setting group params:
@@ -1044,6 +1058,23 @@ func (app *ArkeoApp) GetSubspace(moduleName string) paramstypes.Subspace {
10441058
// RegisterAPIRoutes registers all application module routes with the provided
10451059
// API server.
10461060
func (app *ArkeoApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
1061+
// Legacy LCD compat: map ?events=... to ?query=...
1062+
apiSvr.Router.Use(func(next http.Handler) http.Handler {
1063+
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
1064+
if r.URL.Path == "/cosmos/tx/v1beta1/txs" {
1065+
q := r.URL.Query()
1066+
if q.Get("query") == "" {
1067+
if evs, ok := q["events"]; ok && len(evs) > 0 {
1068+
q.Set("query", strings.Join(evs, " AND "))
1069+
q.Del("events")
1070+
r.URL.RawQuery = q.Encode()
1071+
}
1072+
}
1073+
}
1074+
next.ServeHTTP(w, r)
1075+
})
1076+
})
1077+
10471078
clientCtx := apiSvr.ClientCtx
10481079
// Register new tx routes from grpc-gateway.
10491080
authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)

app/app_regtest.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"io"
99
"net/http"
10+
"strings"
1011

1112
clienthelpers "cosmossdk.io/client/v2/helpers"
1213
runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services"
@@ -918,6 +919,23 @@ func (app *ArkeoApp) GetSubspace(moduleName string) paramstypes.Subspace {
918919
// RegisterAPIRoutes registers all application module routes with the provided
919920
// API server.
920921
func (app *ArkeoApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
922+
// Legacy LCD compat: map ?events=... to ?query=...
923+
apiSvr.Router.Use(func(next http.Handler) http.Handler {
924+
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
925+
if r.URL.Path == "/cosmos/tx/v1beta1/txs" {
926+
q := r.URL.Query()
927+
if q.Get("query") == "" {
928+
if evs, ok := q["events"]; ok && len(evs) > 0 {
929+
q.Set("query", strings.Join(evs, " AND "))
930+
q.Del("events")
931+
r.URL.RawQuery = q.Encode()
932+
}
933+
}
934+
}
935+
next.ServeHTTP(w, r)
936+
})
937+
})
938+
921939
clientCtx := apiSvr.ClientCtx
922940
// Register new tx routes from grpc-gateway.
923941
authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)

0 commit comments

Comments
 (0)