Skip to content

Commit 0ed64d3

Browse files
author
Nicolas Mahé
authored
Merge pull request #1833 from mesg-foundation/dev
Release v0.25.0
2 parents 7f2705c + 70eaa42 commit 0ed64d3

File tree

40 files changed

+395
-361
lines changed

40 files changed

+395
-361
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## [v0.25.0](https://github.com/mesg-foundation/engine/releases/tag/v0.25.0)
4+
5+
#### Breaking Changes
6+
7+
- ([#1830](https://github.com/mesg-foundation/engine/pull/1830)) Revert "Fix 2 issues with instance".
8+
9+
#### Added
10+
11+
- ([#1825](https://github.com/mesg-foundation/engine/pull/1825)) Add filter on execution list.
12+
13+
#### Changed
14+
15+
- ([#1827](https://github.com/mesg-foundation/engine/pull/1827)) Update dev script to use docker container instead of docker service.
16+
- ([#1828](https://github.com/mesg-foundation/engine/pull/1828)) Improve CLI commands.
17+
- ([#1831](https://github.com/mesg-foundation/engine/pull/1831)) Switch to json logger in orchestrator and daemon.
18+
319
## [v0.24.0](https://github.com/mesg-foundation/engine/releases/tag/v0.24.0)
420

521
#### Breaking Changes

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,6 @@ changelog:
8484

8585
clean:
8686
- rm -rf bin
87-
- docker image rm $(docker images | grep 'mesg')
87+
- docker volume rm engine
88+
- docker image rm $(shell docker images -q mesg/engine)
89+
- docker image rm $(shell docker images -q mesg/tools)

app/app.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,9 @@ func NewInitApp(
241241

242242
// Engine's module keepers
243243
app.ownershipKeeper = ownership.NewKeeper(app.cdc, keys[ownership.StoreKey], app.bankKeeper)
244-
app.serviceKeeper = service.NewKeeper(app.cdc, keys[service.StoreKey], app.ownershipKeeper)
245-
app.instanceKeeper = instance.NewKeeper(app.cdc, keys[instance.StoreKey], app.serviceKeeper)
244+
app.instanceKeeper = instance.NewKeeper(app.cdc, keys[instance.StoreKey])
246245
app.processKeeper = process.NewKeeper(app.cdc, keys[process.StoreKey], app.instanceKeeper, app.ownershipKeeper, app.bankKeeper)
246+
app.serviceKeeper = service.NewKeeper(app.cdc, keys[service.StoreKey], app.ownershipKeeper)
247247
app.runnerKeeper = runner.NewKeeper(app.cdc, keys[runner.StoreKey], app.instanceKeeper, app.ownershipKeeper)
248248
app.executionKeeper = execution.NewKeeper(
249249
app.cdc,

cmd/mesg-cli/main.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ import (
88
"github.com/cosmos/cosmos-sdk/client"
99
"github.com/cosmos/cosmos-sdk/client/flags"
1010
"github.com/cosmos/cosmos-sdk/client/keys"
11-
"github.com/cosmos/cosmos-sdk/client/lcd"
1211
"github.com/cosmos/cosmos-sdk/client/rpc"
1312
"github.com/cosmos/cosmos-sdk/version"
1413
"github.com/cosmos/cosmos-sdk/x/auth"
1514
authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli"
16-
authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
1715
"github.com/cosmos/cosmos-sdk/x/bank"
1816
bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli"
1917
"github.com/mesg-foundation/engine/app"
@@ -54,7 +52,7 @@ func main() {
5452
flags.LineBreak,
5553
orchestratorCmd(cdc),
5654
flags.LineBreak,
57-
lcd.ServeCommand(cdc, registerRoutes),
55+
ServeCommand(cdc),
5856
flags.LineBreak,
5957
keys.Commands(),
6058
signCommand(),
@@ -131,16 +129,6 @@ func txCmd(cdc *amino.Codec) *cobra.Command {
131129
return txCmd
132130
}
133131

134-
// registerRoutes registers the routes from the different modules for the LCD.
135-
// NOTE: details on the routes added for each module are in the module documentation
136-
// NOTE: If making updates here you also need to update the test helper in client/lcd/test_helper.go
137-
func registerRoutes(rs *lcd.RestServer) {
138-
client.RegisterRoutes(rs.CliCtx, rs.Mux)
139-
authrest.RegisterTxRoutes(rs.CliCtx, rs.Mux)
140-
app.ModuleBasics.RegisterRESTRoutes(rs.CliCtx, rs.Mux)
141-
cosmos.RegisterSimulateRoute(rs.CliCtx, rs.Mux)
142-
}
143-
144132
func initConfig(cmd *cobra.Command) error {
145133
home, err := cmd.PersistentFlags().GetString(cli.HomeFlag)
146134
if err != nil {

cmd/mesg-cli/orchestrator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func startOrchestratorCmd(cdc *codec.Codec) *cobra.Command {
4848
return fmt.Errorf("chain-id is required. use flag --chain-id or config file")
4949
}
5050

51-
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
51+
logger := log.NewTMJSONLogger(log.NewSyncWriter(os.Stdout))
5252
client, err := cliCtx.GetNode()
5353
if err != nil {
5454
return err

cmd/mesg-cli/serve.go

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"net"
6+
"os"
7+
"time"
8+
9+
"github.com/cosmos/cosmos-sdk/client"
10+
"github.com/cosmos/cosmos-sdk/client/context"
11+
"github.com/cosmos/cosmos-sdk/client/flags"
12+
"github.com/cosmos/cosmos-sdk/codec"
13+
"github.com/cosmos/cosmos-sdk/server"
14+
authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
15+
"github.com/gorilla/mux"
16+
"github.com/mesg-foundation/engine/app"
17+
"github.com/mesg-foundation/engine/cosmos"
18+
"github.com/spf13/cobra"
19+
"github.com/spf13/viper"
20+
"github.com/tendermint/tendermint/libs/log"
21+
rpcserver "github.com/tendermint/tendermint/rpc/lib/server"
22+
)
23+
24+
// ServeCommand creates and starts the LCD server
25+
// adapted version of function from https://github.com/cosmos/cosmos-sdk/blob/v0.38.3/client/lcd/root.go#L74-L100
26+
func ServeCommand(cdc *codec.Codec) *cobra.Command {
27+
cmd := &cobra.Command{
28+
Use: "rest-server",
29+
Short: "Start LCD (light-client daemon), a local REST server",
30+
RunE: func(cmd *cobra.Command, args []string) (err error) {
31+
// new rest server
32+
r := mux.NewRouter()
33+
cliCtx := context.NewCLIContext().WithCodec(cdc)
34+
logger := log.NewTMJSONLogger(log.NewSyncWriter(os.Stdout)).With("module", "rest-server")
35+
36+
// register routes
37+
client.RegisterRoutes(cliCtx, r)
38+
authrest.RegisterTxRoutes(cliCtx, r)
39+
app.ModuleBasics.RegisterRESTRoutes(cliCtx, r)
40+
cosmos.RegisterSimulateRoute(cliCtx, r)
41+
42+
// start
43+
var listener net.Listener
44+
server.TrapSignal(func() {
45+
err := listener.Close()
46+
logger.Error("error closing listener", "err", err)
47+
})
48+
49+
cfg := rpcserver.DefaultConfig()
50+
cfg.MaxOpenConnections = viper.GetInt(flags.FlagMaxOpenConnections)
51+
cfg.ReadTimeout = time.Duration(uint(viper.GetInt(flags.FlagRPCReadTimeout))) * time.Second
52+
cfg.WriteTimeout = time.Duration(uint(viper.GetInt(flags.FlagRPCWriteTimeout))) * time.Second
53+
54+
listener, err = rpcserver.Listen(viper.GetString(flags.FlagListenAddr), cfg)
55+
if err != nil {
56+
return
57+
}
58+
logger.Info(
59+
fmt.Sprintf(
60+
"Starting application REST service (chain-id: %q)...",
61+
viper.GetString(flags.FlagChainID),
62+
),
63+
)
64+
65+
return rpcserver.StartHTTPServer(listener, r, logger, cfg)
66+
},
67+
}
68+
69+
return flags.RegisterRestServerFlags(cmd)
70+
}

cmd/mesg-daemon/main.go

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"encoding/json"
55
"io"
6+
"os"
67

78
"github.com/cosmos/cosmos-sdk/baseapp"
89
"github.com/cosmos/cosmos-sdk/client/debug"
@@ -19,7 +20,9 @@ import (
1920
"github.com/spf13/cobra"
2021
"github.com/spf13/viper"
2122
abci "github.com/tendermint/tendermint/abci/types"
23+
cfg "github.com/tendermint/tendermint/config"
2224
"github.com/tendermint/tendermint/libs/cli"
25+
tmflags "github.com/tendermint/tendermint/libs/cli/flags"
2326
"github.com/tendermint/tendermint/libs/log"
2427
tmtypes "github.com/tendermint/tendermint/types"
2528
dbm "github.com/tendermint/tm-db"
@@ -35,12 +38,30 @@ func main() {
3538
// init the config of cosmos
3639
cosmos.InitConfig()
3740

38-
ctx := server.NewDefaultContext()
41+
ctx := server.NewContext(
42+
cfg.DefaultConfig(),
43+
log.NewTMJSONLogger(log.NewSyncWriter(os.Stdout)),
44+
)
3945
cobra.EnableCommandSorting = false
4046
rootCmd := &cobra.Command{
41-
Use: version.ServerName,
42-
Short: "Engine Daemon (server)",
43-
PersistentPreRunE: server.PersistentPreRunEFn(ctx),
47+
Use: version.ServerName,
48+
Short: "Engine Daemon (server)",
49+
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
50+
// adapted version of function from https://github.com/cosmos/cosmos-sdk/blob/v0.38.3/server/util.go#L49-L74
51+
if err := server.PersistentPreRunEFn(ctx)(cmd, args); err != nil {
52+
return err
53+
}
54+
logger, err := tmflags.ParseLogLevel(ctx.Config.LogLevel, log.NewTMJSONLogger(log.NewSyncWriter(os.Stdout)), cfg.DefaultLogLevel())
55+
if err != nil {
56+
return err
57+
}
58+
if viper.GetBool(cli.TraceFlag) {
59+
logger = log.NewTracingLogger(logger)
60+
}
61+
logger = logger.With("module", "main")
62+
ctx.Logger = logger
63+
return nil
64+
},
4465
}
4566

4667
rootCmd.AddCommand(genutilcli.InitCmd(ctx, cdc, app.ModuleBasics, app.DefaultNodeHome))

e2e/api_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,11 @@ func pollExecutionOfProcess(processHash hash.Hash, status execution.Status, node
145145
timeout := time.After(pollingTimeout)
146146
for {
147147
var execs []*execution.Execution
148-
if err := lcd.Get("execution/list", &execs); err != nil {
148+
if err := lcd.Get(fmt.Sprintf("execution/list?processHash=%s&status=%s&nodeKey=%s", processHash, status, nodeKey), &execs); err != nil {
149149
return nil, err
150150
}
151-
for _, exec := range execs {
152-
if exec.ProcessHash.Equal(processHash) && exec.Status == status && exec.NodeKey == nodeKey {
153-
return exec, nil
154-
}
151+
if len(execs) > 0 {
152+
return execs[0], nil
155153
}
156154
select {
157155
case <-time.After(pollingInterval):

instance/instance.pb.go

Lines changed: 7 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protobuf/types/instance.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ message Instance {
2121
];
2222

2323
bytes envHash = 3 [
24-
(gogoproto.moretags) = 'hash:"name:3" validate:"omitempty,hash"',
24+
(gogoproto.moretags) = 'hash:"name:3" validate:"required,hash"',
2525
(gogoproto.casttype) = "github.com/mesg-foundation/engine/hash.Hash"
2626
];
2727
}

0 commit comments

Comments
 (0)