Skip to content

Commit 73a6b0c

Browse files
author
Nicolas Mahé
authored
Merge pull request #1857 from mesg-foundation/dev
Release v0.25.1
2 parents 0ed64d3 + 7662c15 commit 73a6b0c

File tree

33 files changed

+313
-101
lines changed

33 files changed

+313
-101
lines changed

Diff for: .circleci/config.yml

-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ jobs:
4646
steps:
4747
- checkout
4848
- setup_remote_docker
49-
- run: docker swarm init
5049
- <<: *restore_go_cache
5150
- <<: *restore_go_path
5251
- run: make test
@@ -67,7 +66,6 @@ jobs:
6766
sudo rm -rf /usr/local/go
6867
curl -sSL "https://dl.google.com/go/go1.13.10.linux-amd64.tar.gz" | sudo tar -xz -C /usr/local/
6968
echo "export PATH=$PATH:/usr/local/go/bin" >> $BASH_ENV
70-
- run: docker swarm init
7169
- <<: *restore_go_cache
7270
- <<: *restore_go_path
7371
- run: make e2e

Diff for: CHANGELOG.md

+20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Changelog
22

3+
## [v0.25.1](https://github.com/mesg-foundation/engine/releases/tag/v0.25.1)
4+
5+
#### Changed
6+
7+
- ([#1845](https://github.com/mesg-foundation/engine/pull/1845)) Set default flag gasPrice of the orchestrator to null.
8+
- ([#1851](https://github.com/mesg-foundation/engine/pull/1851)) Remove swarm init from ci.
9+
10+
#### Fixed
11+
12+
- ([#1838](https://github.com/mesg-foundation/engine/pull/1838)) Remove min gas price from dev chain and e2e.
13+
- ([#1841](https://github.com/mesg-foundation/engine/pull/1841)) Fix dev-starter when user stop script during the first sleep of 5 sec.
14+
- ([#1843](https://github.com/mesg-foundation/engine/pull/1843)) Display body in lcd client on error.
15+
- ([#1844](https://github.com/mesg-foundation/engine/pull/1844)) Add a check in LCD client if the account exists or not.
16+
- ([#1846](https://github.com/mesg-foundation/engine/pull/1846)) Fix command execution list because of not set filter.
17+
- ([#1848](https://github.com/mesg-foundation/engine/pull/1848)) Implement import and export functions in modules.
18+
19+
#### Dependencies
20+
21+
- ([#1835](https://github.com/mesg-foundation/engine/pull/1835)) Bump github.com/cosmos/cosmos-sdk from 0.38.3 to 0.38.4.
22+
323
## [v0.25.0](https://github.com/mesg-foundation/engine/releases/tag/v0.25.0)
424

525
#### Breaking Changes

Diff for: app/app.go

+4-19
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"github.com/cosmos/cosmos-sdk/types/module"
1717
"github.com/cosmos/cosmos-sdk/version"
1818
"github.com/cosmos/cosmos-sdk/x/auth"
19-
"github.com/cosmos/cosmos-sdk/x/auth/ante"
2019
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
2120
"github.com/cosmos/cosmos-sdk/x/bank"
2221
distr "github.com/cosmos/cosmos-sdk/x/distribution"
@@ -315,25 +314,11 @@ func NewInitApp(
315314

316315
// The AnteHandler handles signature verification and transaction pre-processing
317316
app.SetAnteHandler(
318-
sdk.ChainAnteDecorators(
319-
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
320-
ante.NewMempoolFeeDecorator(),
321-
ante.NewValidateBasicDecorator(),
322-
ante.NewValidateMemoDecorator(app.accountKeeper),
323-
ante.NewConsumeGasForTxSizeDecorator(app.accountKeeper),
324-
ante.NewSetPubKeyDecorator(app.accountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
325-
ante.NewValidateSigCountDecorator(app.accountKeeper),
326-
ante.NewDeductFeeDecorator(app.accountKeeper, app.supplyKeeper),
327-
ante.NewSigGasConsumeDecorator(app.accountKeeper, auth.DefaultSigVerificationGasConsumer),
328-
ante.NewSigVerificationDecorator(app.accountKeeper),
329-
newForceCheckTxProxyDecorator(ante.NewIncrementSequenceDecorator(app.accountKeeper)), // innermost AnteDecorator
317+
auth.NewAnteHandler(
318+
app.accountKeeper,
319+
app.supplyKeeper,
320+
auth.DefaultSigVerificationGasConsumer,
330321
),
331-
// Previous implementation:
332-
// auth.NewAnteHandler(
333-
// app.accountKeeper,
334-
// app.supplyKeeper,
335-
// auth.DefaultSigVerificationGasConsumer,
336-
// ),
337322
)
338323

339324
// initialize stores

Diff for: app/decorator.go

-29
This file was deleted.

Diff for: cmd/mesg-cli/orchestrator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func startOrchestratorCmd(cdc *codec.Codec) *cobra.Command {
117117
cmd.Flags().String(flagGrpcAddr, ":50052", "The address for the gRPC server to expose")
118118
cmd.Flags().String(flagAuthorizedPubKeys, "", "The authorized pubkeys to communicate with the gRPC server")
119119
cmd.Flags().String(flagMnemonic, "", "The account's mnemonic that will be used to sign transactions")
120-
cmd.Flags().String(flagGasPrices, "1.0atto", "The gas price to sign tx")
120+
cmd.Flags().String(flagGasPrices, "", "The gas price to sign tx")
121121
cmd.Flags().String(flagExecPrice, "10000atto", "The execution price to create execution")
122122
cmd.Flags().String(flagAccNumber, "0", "The account number of the hd path to use to derive the mnemonic")
123123
cmd.Flags().String(flagAccIndex, "0", "The account index of the hd path to use to derive the mnemonic")

Diff for: cosmos/lcd.go

+14-10
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ func (lcd *LCD) Get(path string, ptr interface{}) error {
6262
return err
6363
}
6464
defer resp.Body.Close()
65-
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
66-
return fmt.Errorf("request status code is not 2XX, got %d", resp.StatusCode)
67-
}
6865
body, err := ioutil.ReadAll(resp.Body)
6966
if err != nil {
7067
return err
7168
}
69+
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
70+
return fmt.Errorf("request status code is not 2XX, got %d with body: %s", resp.StatusCode, body)
71+
}
7272
cosResp := rest.ResponseWithHeight{}
7373
if err := lcd.cdc.UnmarshalJSON(body, &cosResp); err != nil {
7474
return err
@@ -108,13 +108,13 @@ func (lcd *LCD) PostBare(path string, req interface{}, ptr interface{}) error {
108108
return err
109109
}
110110
defer resp.Body.Close()
111-
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
112-
return fmt.Errorf("request status code is not 2XX, got %d", resp.StatusCode)
113-
}
114111
body, err := ioutil.ReadAll(resp.Body)
115112
if err != nil {
116113
return err
117114
}
115+
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
116+
return fmt.Errorf("request status code is not 2XX, got %d with body: %s", resp.StatusCode, body)
117+
}
118118
if err := lcd.cdc.UnmarshalJSON(body, ptr); err != nil {
119119
return err
120120
}
@@ -180,14 +180,18 @@ func (lcd *LCD) getAccount() (*auth.BaseAccount, error) {
180180
}
181181
lcd.acc = auth.NewBaseAccount(accKb.GetAddress(), nil, accKb.GetPubKey(), 0, 0)
182182
}
183-
localSeq := lcd.acc.GetSequence()
184-
if err := lcd.Get("auth/accounts/"+lcd.acc.GetAddress().String(), &lcd.acc); err != nil {
183+
var accR *auth.BaseAccount
184+
if err := lcd.Get("auth/accounts/"+lcd.acc.GetAddress().String(), &accR); err != nil {
185185
return nil, err
186186
}
187+
if accR.Address.Empty() {
188+
return nil, fmt.Errorf("account %q doesn't exist", lcd.acc.GetAddress().String())
189+
}
187190
// replace seq if sup
188-
if localSeq > lcd.acc.GetSequence() {
189-
lcd.acc.SetSequence(localSeq)
191+
if lcd.acc.GetSequence() > accR.GetSequence() {
192+
accR.SetSequence(lcd.acc.GetSequence())
190193
}
194+
lcd.acc = accR
191195
return lcd.acc, nil
192196
}
193197

Diff for: cosmos/rpc.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,11 @@ func (c *RPC) GetAccount() (authExported.Account, error) {
181181
if err != nil {
182182
return nil, err
183183
}
184-
localSeq := c.acc.GetSequence()
185-
c.acc = accR
186184
// replace seq if sup
187-
if localSeq > c.acc.GetSequence() {
188-
c.acc.SetSequence(localSeq)
185+
if c.acc.GetSequence() > accR.GetSequence() {
186+
accR.SetSequence(c.acc.GetSequence())
189187
}
188+
c.acc = accR
190189
return c.acc, nil
191190
}
192191

Diff for: dev-chain/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ See file `dev-genesis.json`
1111
### Validator
1212

1313
Address: `mesg10cjcxje0jjdxzdq5hpqa4dc4znhuxsax2zh7mp`
14+
Validator address: `mesgvaloper10cjcxje0jjdxzdq5hpqa4dc4znhuxsaxkrzt5d`
1415
Pubkey: `mesgpub1addwnpepq0gwhzul5qcycxxs6r7jdzdn5q29mj2a8gmngfrcfa6l8qs2dar4s2jqycv`
1516
Mnemonic: `fruit lock run bike eyebrow unique embrace cost parade welcome more frown oxygen crane club donate grid harsh marriage host skirt sign warfare cup`
1617
Coins: 100000000stake (but used in gentx)

Diff for: dev-chain/cli/config/config.toml

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ chain-id = "mesg-dev-chain"
44
# orchestrtor
55
authorized-pubkeys = "mesgpub1addwnpepqvdrcdvg3x4tf0y5aapn47njxapdu4l0jgsjzcm2klp9a7eztva66eqnadt"
66
mnemonic = "neutral false together tattoo matrix stamp poem mouse chair chair grain pledge mandate layer shiver embark struggle vicious antenna total faith genre valley mandate"
7+
gas-prices = ""

Diff for: dev-chain/validator/config/app.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# The minimum gas prices a validator is willing to accept for processing a
22
# transaction. A transaction's fees must meet the minimum of any denomination
33
# specified in this config (e.g. 0.25token1;0.0001token2).
4-
minimum-gas-prices = "1.0atto"
4+
minimum-gas-prices = ""

Diff for: e2e/api_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type apiclient struct {
2727

2828
const (
2929
chainID = "mesg-dev-chain"
30-
gasPrices = "1.0atto"
30+
gasPrices = ""
3131
pollingInterval = 500 * time.Millisecond // half a block
3232
pollingTimeout = 10 * time.Second // 10 blocks
3333

Diff for: go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99
github.com/btcsuite/btcd v0.0.0-20190807005414-4063feeff79a // indirect
1010
github.com/containerd/containerd v1.3.0 // indirect
1111
github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc // indirect
12-
github.com/cosmos/cosmos-sdk v0.38.3
12+
github.com/cosmos/cosmos-sdk v0.38.4
1313
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d
1414
github.com/cskr/pubsub v1.0.2
1515
github.com/docker/cli v0.0.0-20191011045415-5d85cdacd257

Diff for: go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7
9595
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
9696
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
9797
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
98-
github.com/cosmos/cosmos-sdk v0.38.3 h1:qIBTiw+2T9POaSUJ5rvbBbXeq8C8btBlJxnSegPBd3Y=
99-
github.com/cosmos/cosmos-sdk v0.38.3/go.mod h1:rzWOofbKfRt3wxiylmYWEFHnxxGj0coyqgWl2I9obAw=
98+
github.com/cosmos/cosmos-sdk v0.38.4 h1:jPZOvhMQkm7wwwzcLxuluhVpKfuIgddNGt999pAiz/Y=
99+
github.com/cosmos/cosmos-sdk v0.38.4/go.mod h1:rzWOofbKfRt3wxiylmYWEFHnxxGj0coyqgWl2I9obAw=
100100
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU=
101101
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
102102
github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4=

Diff for: scripts/dev-starter.sh

+14
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,29 @@ set -m
77
mesg-daemon start &
88
daemon=$!
99

10+
# function that stop child processes
11+
function stop {
12+
echo "stopping daemon"
13+
kill $daemon
14+
wait $daemon
15+
exit 0
16+
}
17+
18+
# trap both sigint (ctrl+c) and sigterm (OS ask process to be stopped)
19+
trap stop SIGINT
20+
trap stop SIGTERM
21+
1022
# wait 5 sec for the daemon to start rpc server
1123
sleep 5 &
1224
wait $!
1325

1426
# start lcd
27+
echo "starting lcd"
1528
mesg-cli rest-server --laddr tcp://0.0.0.0:1317 &
1629
lcd=$!
1730

1831
# start orchestrator
32+
echo "starting orchestrator"
1933
mesg-cli orchestrator start &
2034
orchestrator=$!
2135

Diff for: x/execution/client/cli/query.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ func GetCmdList(queryRoute string, cdc *codec.Codec) *cobra.Command {
6363
Args: cobra.NoArgs,
6464
RunE: func(cmd *cobra.Command, args []string) error {
6565
cliCtx := context.NewCLIContext().WithCodec(cdc)
66-
res, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryList), nil)
66+
data, err := cliCtx.Codec.MarshalJSON(types.ListFilter{})
67+
if err != nil {
68+
return err
69+
}
70+
res, _, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", queryRoute, types.QueryList), data)
6771
if err != nil {
6872
fmt.Printf("could not list executions\n%s\n", err.Error())
6973
return nil

Diff for: x/execution/genesis.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import (
1010
// and the keeper's address to pubkey map
1111
func InitGenesis(ctx sdk.Context, k Keeper, data types.GenesisState) []abci.ValidatorUpdate {
1212
k.SetParams(ctx, data.Params)
13+
if err := k.Import(ctx, data.Executions); err != nil {
14+
panic(err)
15+
}
1316
return []abci.ValidatorUpdate{}
1417
}
1518

@@ -18,5 +21,9 @@ func InitGenesis(ctx sdk.Context, k Keeper, data types.GenesisState) []abci.Vali
1821
// with InitGenesis
1922
func ExportGenesis(ctx sdk.Context, k Keeper) (data types.GenesisState) {
2023
params := k.GetParams(ctx)
21-
return types.NewGenesisState(params)
24+
execs, err := k.List(ctx, types.ListFilter{})
25+
if err != nil {
26+
panic(err)
27+
}
28+
return types.NewGenesisState(params, execs)
2229
}

Diff for: x/execution/internal/keeper/keeper.go

+13
Original file line numberDiff line numberDiff line change
@@ -469,3 +469,16 @@ func (k *Keeper) fetchEmitters(ctx sdk.Context, proc *process.Process, nodeKey s
469469
}
470470
return matchedRuns, nil
471471
}
472+
473+
// Import imports a list of executions into the store.
474+
func (k *Keeper) Import(ctx sdk.Context, execs []*executionpb.Execution) error {
475+
store := ctx.KVStore(k.storeKey)
476+
for _, exec := range execs {
477+
value, err := k.cdc.MarshalBinaryLengthPrefixed(exec)
478+
if err != nil {
479+
return sdkerrors.Wrapf(sdkerrors.ErrJSONMarshal, err.Error())
480+
}
481+
store.Set(exec.Hash, value)
482+
}
483+
return nil
484+
}

Diff for: x/execution/internal/types/genesis.go

+19-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,38 @@
11
package types
22

3+
import (
4+
fmt "fmt"
5+
6+
executionpb "github.com/mesg-foundation/engine/execution"
7+
"github.com/mesg-foundation/engine/ext/xvalidator"
8+
)
9+
310
// GenesisState - all instance state that must be provided at genesis
411
type GenesisState struct {
5-
Params Params `json:"params" yaml:"params"`
12+
Params Params `json:"params" yaml:"params" validate:"dive"`
13+
Executions []*executionpb.Execution `json:"executions" yaml:"executions" validate:"dive"`
614
}
715

816
// NewGenesisState creates a new GenesisState object
9-
func NewGenesisState(params Params) GenesisState {
10-
return GenesisState{Params: params}
17+
func NewGenesisState(params Params, execs []*executionpb.Execution) GenesisState {
18+
return GenesisState{
19+
Params: params,
20+
Executions: execs,
21+
}
1122
}
1223

1324
// DefaultGenesisState - default GenesisState used by Cosmos Hub
1425
func DefaultGenesisState() GenesisState {
1526
return GenesisState{
16-
Params: DefaultParams(),
27+
Params: DefaultParams(),
28+
Executions: []*executionpb.Execution{},
1729
}
1830
}
1931

2032
// ValidateGenesis validates the instance genesis parameters
2133
func ValidateGenesis(data GenesisState) error {
34+
if err := xvalidator.Struct(data); err != nil {
35+
return fmt.Errorf("failed to validate %s genesis state: %w", ModuleName, err)
36+
}
2237
return nil
2338
}

Diff for: x/instance/genesis.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ import (
88

99
// InitGenesis initialize default parameters and the keeper's address to pubkey map.
1010
func InitGenesis(ctx sdk.Context, k Keeper, data types.GenesisState) []abci.ValidatorUpdate {
11+
if err := k.Import(ctx, data.Instances); err != nil {
12+
panic(err)
13+
}
1114
return []abci.ValidatorUpdate{}
1215
}
1316

1417
// ExportGenesis writes the current store values // to a genesis file,
1518
// which can be imported again with InitGenesis.
1619
func ExportGenesis(ctx sdk.Context, k Keeper) types.GenesisState {
17-
return types.NewGenesisState()
20+
instances, err := k.List(ctx)
21+
if err != nil {
22+
panic(err)
23+
}
24+
return types.NewGenesisState(instances)
1825
}

0 commit comments

Comments
 (0)