Skip to content

Commit de1889d

Browse files
author
Nicolas Mahé
authored
Merge pull request #1735 from mesg-foundation/dev
Release v0.20.0
2 parents 7e25ea1 + 4092b91 commit de1889d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1839
-656
lines changed

.circleci/config.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,18 @@ jobs:
9595
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
9696
- run: make docker-publish version=$CIRCLE_TAG
9797

98+
"release_cli_dev":
99+
<<: *run_on_docker
100+
steps:
101+
- checkout
102+
- run: make publish-cmds version="dev build `echo $CIRCLE_SHA1 | cut -c1-7`" release-type=dev
103+
104+
"release_cli_prod":
105+
<<: *run_on_docker
106+
steps:
107+
- checkout
108+
- run: make publish-cmds version=$CIRCLE_TAG release-type=prod
109+
98110
workflows:
99111
version: 2
100112

@@ -142,6 +154,9 @@ workflows:
142154
- "publish_docker_dev":
143155
requires:
144156
- "test_e2e"
157+
- "release_cli_dev":
158+
requires:
159+
- "test_e2e"
145160

146161
test_prod:
147162
jobs:
@@ -193,3 +208,11 @@ workflows:
193208
ignore: /.*/
194209
requires:
195210
- "test_e2e"
211+
- "release_cli_prod":
212+
filters:
213+
tags:
214+
only: /^v.*/
215+
branches:
216+
ignore: /.*/
217+
requires:
218+
- "test_e2e"

CHANGELOG.md

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

3+
## [v0.20.0](https://github.com/mesg-foundation/engine/releases/tag/v0.20.0)
4+
5+
#### Added
6+
7+
- ([#1688](https://github.com/mesg-foundation/engine/pull/1688)) Handle withdraw from resources.
8+
- ([#1694](https://github.com/mesg-foundation/engine/pull/1694)) Add build multi-platform cmds script to CI.
9+
- ([#1699](https://github.com/mesg-foundation/engine/pull/1699)) Processes pay for executions.
10+
- ([#1705](https://github.com/mesg-foundation/engine/pull/1705)) Add emitters to execution with consensus system.
11+
- ([#1719](https://github.com/mesg-foundation/engine/pull/1719)) Add transaction's log to returned error.
12+
- ([#1723](https://github.com/mesg-foundation/engine/pull/1723)) Add address to process.
13+
- ([#1728](https://github.com/mesg-foundation/engine/pull/1728)) Add address to service, runner, execution, and execution.
14+
- ([#1729](https://github.com/mesg-foundation/engine/pull/1729)) Wrap errors of modules' keeper, querier and msg to sent them to clients.
15+
16+
#### Dependencies
17+
18+
- ([#1668](https://github.com/mesg-foundation/engine/pull/1668)) Bump github.com/go-kit/kit from 0.9.0 to 0.10.0.
19+
- ([#1674](https://github.com/mesg-foundation/engine/pull/1674)) Bump github.com/stretchr/testify from 1.4.0 to 1.5.1.
20+
- ([#1677](https://github.com/mesg-foundation/engine/pull/1677)) Bump github.com/spf13/cobra from 0.0.5 to 0.0.6.
21+
- ([#1686](https://github.com/mesg-foundation/engine/pull/1686)) Bump github.com/golang/protobuf from 1.3.3 to 1.3.4.
22+
- ([#1697](https://github.com/mesg-foundation/engine/pull/1697)) Bump github.com/pseudomuto/protoc-gen-doc from 1.3.0 to 1.3.1.
23+
- ([#1702](https://github.com/mesg-foundation/engine/pull/1702)) Bump github.com/prometheus/client_golang from 1.4.1 to 1.5.0.
24+
325
## [v0.19.0](https://github.com/mesg-foundation/engine/releases/tag/v0.19.0)
426

527
#### Added

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
.PHONY: all build build-cmd-cosmos changelog check-version clean clean-build clean-docker dep dev dev-mon dev-start dev-stop docker-build docker-dev docker-publish docker-publish-dev docker-tools genesis lint protobuf test
1+
.PHONY: all build build-cmd-cosmos changelog check-version clean clean-build clean-docker dep dev dev-mon dev-start dev-stop docker-build docker-dev docker-publish docker-publish-dev docker-tools genesis lint protobuf test publish-cmds
22

3-
MAJOR_VERSION := $(shell echo $(version) | cut -d . -f 1)
3+
MAJOR_VERSION := $(shell echo $(version) | cut -d . -f 1)
44
MINOR_VERSION := $(shell echo $(version) | cut -d . -f 1-2)
55
PATCH_VERSION := $(version)
66

@@ -54,6 +54,9 @@ dep:
5454
build: check-version dep
5555
go build -mod=readonly -o ./bin/engine -ldflags="-X 'github.com/mesg-foundation/engine/version.Version=$(version)'" core/main.go
5656

57+
publish-cmds: check-version dep
58+
./scripts/publish-cmds.sh "$(version)" "$(release-type)"
59+
5760
build-cmd: dep
5861
go build -mod=readonly -o ./bin/mesg-cli ./cmd/mesg-cli/
5962
go build -mod=readonly -o ./bin/mesg-daemon ./cmd/mesg-daemon/
@@ -80,6 +83,7 @@ clean-docker:
8083
- docker image rm \
8184
mesg/engine:$(version) \
8285
mesg/engine:latest \
86+
mesg/engine:local \
8387
mesg/engine:dev 2>/dev/null
8488

8589
clean: clean-build clean-docker

app/app.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,11 @@ func NewInitApp(
242242
)
243243

244244
// Engine's module keepers
245-
app.ownershipKeeper = ownership.NewKeeper(app.cdc, keys[ownership.StoreKey])
245+
app.ownershipKeeper = ownership.NewKeeper(app.cdc, keys[ownership.StoreKey], app.bankKeeper)
246246
app.instanceKeeper = instance.NewKeeper(app.cdc, keys[instance.StoreKey])
247-
app.processKeeper = process.NewKeeper(app.cdc, keys[process.StoreKey], app.instanceKeeper, app.ownershipKeeper)
247+
app.processKeeper = process.NewKeeper(app.cdc, keys[process.StoreKey], app.instanceKeeper, app.ownershipKeeper, app.bankKeeper)
248248
app.serviceKeeper = service.NewKeeper(app.cdc, keys[service.StoreKey], app.ownershipKeeper)
249-
app.runnerKeeper = runner.NewKeeper(app.cdc, keys[runner.StoreKey], app.instanceKeeper)
249+
app.runnerKeeper = runner.NewKeeper(app.cdc, keys[runner.StoreKey], app.instanceKeeper, app.ownershipKeeper)
250250
app.executionKeeper = execution.NewKeeper(
251251
app.cdc,
252252
keys[execution.StoreKey],

config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func defaultConfig() (*Config, error) {
9797

9898
c.IpfsEndpoint = "http://ipfs.app.mesg.com:8080/ipfs/"
9999

100-
c.DefaultExecutionPrice = "10000atto" // /x/execution/internal/type/params.go#DefaultMinPrice
100+
c.DefaultExecutionPrice = "10000atto" // /x/execution/internal/types/params.go#DefaultMinPrice
101101

102102
c.Server.Address = ":50052"
103103
c.Log.Format = "text"

core/main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ import (
3030
"github.com/mesg-foundation/engine/server/grpc"
3131
"github.com/mesg-foundation/engine/version"
3232
"github.com/sirupsen/logrus"
33+
rpcclient "github.com/tendermint/tendermint/rpc/client"
3334
rpcserver "github.com/tendermint/tendermint/rpc/lib/server"
3435
tmtypes "github.com/tendermint/tendermint/types"
3536
db "github.com/tendermint/tm-db"
3637
)
3738

38-
func stopRunningServices(mc *cosmos.ModuleClient, b *builder.Builder, address string) error {
39-
runners, err := mc.ListRunner(&cosmos.FilterRunner{Address: address})
39+
func stopRunningServices(mc *cosmos.ModuleClient, b *builder.Builder, owner string) error {
40+
runners, err := mc.ListRunner(&cosmos.FilterRunner{Owner: owner})
4041
if err != nil {
4142
return err
4243
}
@@ -186,7 +187,7 @@ func main() {
186187
}()
187188

188189
// create cosmos client
189-
client, err := cosmos.NewClient(node, cdc, kb, genesis.ChainID, cfg.Account.Name, cfg.Account.Password, cfg.Cosmos.MinGasPrices)
190+
client, err := cosmos.NewClient(rpcclient.NewLocal(node), cdc, kb, genesis.ChainID, cfg.Account.Name, cfg.Account.Password, cfg.Cosmos.MinGasPrices)
190191
if err != nil {
191192
logrus.WithField("module", "main").Fatalln(err)
192193
}

cosmos/client.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@ import (
1919
"github.com/mesg-foundation/engine/ext/xstrings"
2020
"github.com/mesg-foundation/engine/hash"
2121
abci "github.com/tendermint/tendermint/abci/types"
22-
"github.com/tendermint/tendermint/node"
2322
rpcclient "github.com/tendermint/tendermint/rpc/client"
2423
tenderminttypes "github.com/tendermint/tendermint/types"
2524
)
2625

2726
// Client is a tendermint client with helper functions.
2827
type Client struct {
29-
*rpcclient.Local
28+
rpcclient.Client
3029
cdc *codec.Codec
3130
kb keys.Keybase
3231
chainID string
@@ -41,13 +40,13 @@ type Client struct {
4140
}
4241

4342
// NewClient returns a rpc tendermint client.
44-
func NewClient(node *node.Node, cdc *codec.Codec, kb keys.Keybase, chainID, accName, accPassword, minGasPrices string) (*Client, error) {
43+
func NewClient(client rpcclient.Client, cdc *codec.Codec, kb keys.Keybase, chainID, accName, accPassword, minGasPrices string) (*Client, error) {
4544
minGasPricesDecoded, err := sdktypes.ParseDecCoins(minGasPrices)
4645
if err != nil {
4746
return nil, err
4847
}
4948
return &Client{
50-
Local: rpcclient.NewLocal(node),
49+
Client: client,
5150
cdc: cdc,
5251
kb: kb,
5352
chainID: chainID,
@@ -93,7 +92,7 @@ func (c *Client) QueryWithData(path string, data []byte) ([]byte, int64, error)
9392
// BuildAndBroadcastMsg builds and signs message and broadcast it to node.
9493
func (c *Client) BuildAndBroadcastMsg(msg sdktypes.Msg) (*abci.ResponseDeliverTx, error) {
9594
c.broadcastMutex.Lock() // Lock the whole signature + broadcast of the transaction
96-
signedTx, err := c.createAndSignTx([]sdktypes.Msg{msg})
95+
signedTx, err := c.CreateAndSignTx([]sdktypes.Msg{msg})
9796
if err != nil {
9897
c.broadcastMutex.Unlock()
9998
return nil, err
@@ -106,7 +105,7 @@ func (c *Client) BuildAndBroadcastMsg(msg sdktypes.Msg) (*abci.ResponseDeliverTx
106105
}
107106

108107
if txres.Code != abci.CodeTypeOK {
109-
return nil, fmt.Errorf("transaction returned with invalid code %d", txres.Code)
108+
return nil, fmt.Errorf("transaction returned with invalid code %d: %s", txres.Code, txres.Log)
110109
}
111110

112111
// TODO: 20*time.Second should not be hardcoded here
@@ -132,7 +131,7 @@ func (c *Client) BuildAndBroadcastMsg(msg sdktypes.Msg) (*abci.ResponseDeliverTx
132131
}
133132
return &data.TxResult.Result, nil
134133
case <-ctx.Done():
135-
return nil, errors.New("i/o timeout")
134+
return nil, errors.New("reach timeout for listening for transaction result")
136135
}
137136
}
138137

@@ -204,7 +203,8 @@ func (c *Client) GetAccount() (authExported.Account, error) {
204203
return c.acc, nil
205204
}
206205

207-
func (c *Client) createAndSignTx(msgs []sdktypes.Msg) (tenderminttypes.Tx, error) {
206+
// CreateAndSignTx build and sign a msg with client account.
207+
func (c *Client) CreateAndSignTx(msgs []sdktypes.Msg) (tenderminttypes.Tx, error) {
208208
// retrieve account
209209
accR, err := c.GetAccount()
210210
if err != nil {

cosmos/errors/errors.go

Lines changed: 0 additions & 28 deletions
This file was deleted.

cosmos/module_client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ func (mc *ModuleClient) GetRunner(hash hash.Hash) (*runnerpb.Runner, error) {
257257

258258
// FilterRunner to apply while listing runners.
259259
type FilterRunner struct {
260-
Address string
260+
Owner string
261261
InstanceHash hash.Hash
262262
}
263263

@@ -277,7 +277,7 @@ func (mc *ModuleClient) ListRunner(f *FilterRunner) ([]*runnerpb.Runner, error)
277277
// filter results
278278
out := make([]*runnerpb.Runner, 0)
279279
for _, r := range rs {
280-
if (f.Address == "" || r.Address == f.Address) &&
280+
if (f.Owner == "" || r.Owner == f.Owner) &&
281281
(f.InstanceHash.IsZero() || r.InstanceHash.Equal(f.InstanceHash)) {
282282
out = append(out, r)
283283
}

e2e/api_test.go

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,19 @@ import (
55
"context"
66
"io/ioutil"
77
"net/http"
8+
"os"
9+
"path/filepath"
810
"testing"
911

12+
"github.com/cosmos/cosmos-sdk/crypto/keys"
13+
sdk "github.com/cosmos/cosmos-sdk/types"
1014
"github.com/cosmos/cosmos-sdk/types/rest"
1115
"github.com/mesg-foundation/engine/app"
1216
"github.com/mesg-foundation/engine/config"
1317
"github.com/mesg-foundation/engine/cosmos"
1418
pb "github.com/mesg-foundation/engine/protobuf/api"
1519
"github.com/stretchr/testify/require"
20+
rpcclient "github.com/tendermint/tendermint/rpc/client"
1621
"google.golang.org/grpc"
1722
)
1823

@@ -27,8 +32,11 @@ type apiclient struct {
2732
}
2833

2934
var (
30-
client apiclient
31-
cdc = app.MakeCodec()
35+
minExecutionPrice sdk.Coins
36+
client apiclient
37+
cclient *cosmos.Client
38+
cdc = app.MakeCodec()
39+
processInitialBalance = sdk.NewCoins(sdk.NewInt64Coin("atto", 10000000))
3240
)
3341

3442
const (
@@ -70,14 +78,35 @@ func TestAPI(t *testing.T) {
7078
}
7179

7280
cfg, err := config.New()
73-
if err != nil {
74-
panic(err)
75-
}
81+
require.NoError(t, err)
82+
83+
minExecutionPrice, err = sdk.ParseCoins(cfg.DefaultExecutionPrice)
84+
require.NoError(t, err)
85+
7686
cosmos.CustomizeConfig(cfg)
7787

7888
conn, err := grpc.DialContext(context.Background(), "localhost:50052", grpc.WithInsecure())
7989
require.NoError(t, err)
8090

91+
// change and recreate cosmos relative path because CI dir permissions
92+
cfg.Cosmos.RelativePath = "e2e.cosmos"
93+
err = os.MkdirAll(filepath.Join(cfg.Path, cfg.Cosmos.RelativePath), os.FileMode(0755))
94+
require.NoError(t, err)
95+
96+
kb, err := cosmos.NewKeybase(filepath.Join(cfg.Path, cfg.Cosmos.RelativePath))
97+
require.NoError(t, err)
98+
if cfg.Account.Mnemonic != "" {
99+
_, err = kb.CreateAccount(cfg.Account.Name, cfg.Account.Mnemonic, "", cfg.Account.Password, keys.CreateHDPath(cfg.Account.Number, cfg.Account.Index).String(), cosmos.DefaultAlgo)
100+
require.NoError(t, err)
101+
}
102+
103+
httpclient, err := rpcclient.NewHTTP("http://localhost:26657", "/websocket")
104+
require.NoError(t, err)
105+
require.NoError(t, httpclient.Start())
106+
defer httpclient.Stop()
107+
cclient, err = cosmos.NewClient(httpclient, cdc, kb, cfg.DevGenesis.ChainID, cfg.Account.Name, cfg.Account.Password, cfg.Cosmos.MinGasPrices)
108+
require.NoError(t, err)
109+
81110
client = apiclient{
82111
pb.NewServiceClient(conn),
83112
pb.NewEventClient(conn),

0 commit comments

Comments
 (0)