Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.21.0 #1784

Merged
merged 172 commits into from
Apr 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
172 commits
Select commit Hold shift + click to select a range
b49d654
add support for any type of data to filter
NicolasMahe Mar 17, 2020
35d58e0
Add filter predicate GT, GTE, LT and LTE that only works with Number …
NicolasMahe Mar 17, 2020
997cc7b
fix lint
NicolasMahe Mar 17, 2020
40bffc9
Add predicate CONTAINS that check if an element is inside a list
NicolasMahe Mar 17, 2020
05952ec
fix lint
NicolasMahe Mar 17, 2020
dd097c8
Merge pull request #1737 from mesg-foundation/feature/process-filter-…
antho1404 Mar 19, 2020
dd8be45
Merge branch 'dev' into feature/process-filter-predicates
Mar 20, 2020
9e57db3
make process filter predicate contains works with string
NicolasMahe Mar 23, 2020
da1336f
Merge pull request #1738 from mesg-foundation/feature/process-filter-…
antho1404 Mar 23, 2020
f678842
Add lcd query runner/hash that return a payload containing the runner…
NicolasMahe Mar 23, 2020
ec17976
simplify service hash query. remove it from keeper's querier and gRPC.
NicolasMahe Mar 23, 2020
58c313c
add process hash query to lcd
NicolasMahe Mar 24, 2020
ddd584b
improve e2e lcd test and random lcd small improvement
NicolasMahe Mar 24, 2020
c95f4f3
Merge pull request #1743 from mesg-foundation/feature/lcd-hash
antho1404 Mar 24, 2020
90beffa
add "dive" validation to all repeated message in the proto files
NicolasMahe Mar 20, 2020
6b61ac6
Merge pull request #1746 from mesg-foundation/feature/proto-dive
Mar 24, 2020
2816d91
Move process.node.map.reference to process.node.reference to use it i…
NicolasMahe Mar 17, 2020
230cd11
Add reference system in process filter
NicolasMahe Mar 20, 2020
ab8c6f4
improve comment and reverse condition order in function resolve input…
NicolasMahe Mar 20, 2020
8cc482a
Simplifies and improve xvalidator
NicolasMahe Mar 24, 2020
474b3ca
Simplifies cosmos message to create a service
NicolasMahe Mar 24, 2020
c16c222
Add more validation to service. Move service validation functions to …
NicolasMahe Mar 24, 2020
94a56f6
Simplifies cosmos message create and delete process
NicolasMahe Mar 24, 2020
c5aa8fb
Simplifies cosmos message create and delete runner
NicolasMahe Mar 24, 2020
55cd8bc
Simplifies cosmos message create and update execution
NicolasMahe Mar 24, 2020
ce3e8e8
Simplifies cosmos message withdraw coins of ownership module
NicolasMahe Mar 24, 2020
3fcfc19
register interface of execution's update result
NicolasMahe Mar 24, 2020
3d6949e
update build-proto script
NicolasMahe Mar 24, 2020
599592a
fix rebase
NicolasMahe Mar 24, 2020
cc5110e
revert rename service create event
NicolasMahe Mar 24, 2020
5dc7cbb
remove useless service msg_test file
NicolasMahe Mar 24, 2020
59c631c
make process filter match function to return error and put those erro…
NicolasMahe Mar 25, 2020
c359e02
rename Ownership WithdrawCoins to simply Withdraw
NicolasMahe Mar 25, 2020
632858f
Merge pull request #1742 from mesg-foundation/feature/proto-message
Mar 25, 2020
49ab377
Move setting the empty sid to service.New function
NicolasMahe Mar 25, 2020
0be8c7d
add resource validation in their new function
NicolasMahe Mar 25, 2020
417e0cc
add missing validation tags to protobuf types
NicolasMahe Mar 25, 2020
8b7060e
fix process validation test
NicolasMahe Mar 25, 2020
7c72a1b
improve validation on execution's price
NicolasMahe Mar 25, 2020
b962715
Merge branch 'dev' into feature/process-filter-reference
antho1404 Mar 25, 2020
3edb90b
Merge pull request #1739 from mesg-foundation/feature/process-filter-…
antho1404 Mar 25, 2020
e8c9873
update dependencies
antho1404 Mar 26, 2020
5661174
run go mod tidy
NicolasMahe Mar 26, 2020
b695f07
Merge pull request #1752 from mesg-foundation/fix/cosmos-tendermin-de…
Mar 26, 2020
d258e34
Merge branch 'dev' into feature/validation
NicolasMahe Mar 26, 2020
b1541fc
add required_without validation to parentHash and eventHash of execution
NicolasMahe Mar 26, 2020
87c95ad
add e2e test to withdraw from process
NicolasMahe Mar 25, 2020
b38e66b
remove e2e grpc service
NicolasMahe Mar 25, 2020
9f80f52
Set MaxSubscriptionClients to 100
NicolasMahe Mar 25, 2020
13a4e15
remove possible grpc from e2e execution
NicolasMahe Mar 25, 2020
7aeaf7c
remove now-useless e2e func newTestCreateServiceRequest
NicolasMahe Mar 25, 2020
ec1f48c
remove e2e grpc service complex
NicolasMahe Mar 25, 2020
0eb7fce
remove e2e grpc instance
NicolasMahe Mar 25, 2020
80f5b34
remove e2e grpc process
NicolasMahe Mar 25, 2020
1e959b0
remove e2e grpc orchestrator
NicolasMahe Mar 25, 2020
be8f4e8
fix execution price
NicolasMahe Mar 25, 2020
469edd9
remove execution stream from execution e2e test
NicolasMahe Mar 25, 2020
5ffe3c4
output sending event log in e2e service complex
NicolasMahe Mar 26, 2020
ae75752
broadcast tx using LCD in e2e tests
NicolasMahe Mar 26, 2020
949fff1
remove tendermint rpc client from e2e test
NicolasMahe Mar 26, 2020
c2a81dc
remove not used grpc client from e2e
NicolasMahe Mar 26, 2020
f165395
update service hash endpoint
antho1404 Mar 26, 2020
3a20cba
update e2e
antho1404 Mar 26, 2020
9883638
Merge pull request #1749 from mesg-foundation/feature/validation
antho1404 Mar 26, 2020
85d13c8
Merge branch 'dev' into fix/service-hash-request
antho1404 Mar 26, 2020
2c3d97e
Merge pull request #1754 from mesg-foundation/fix/service-hash-request
Mar 26, 2020
296d795
move execution stream creation to each test that required it
NicolasMahe Mar 26, 2020
4fd2336
create 10 executions in the same transaction
NicolasMahe Mar 26, 2020
153d445
remove execution stream from most orchestrator test
NicolasMahe Mar 27, 2020
83e883b
remove dependency to testing.T from lcd functions, panic on error
NicolasMahe Mar 27, 2020
e3ded31
remove execution stream from last complicated orchestrator test
NicolasMahe Mar 27, 2020
4dd5f39
update comments
NicolasMahe Mar 27, 2020
1e54742
Merge branch 'dev' into feature/e2e-lcd
NicolasMahe Mar 27, 2020
f16d425
remove now-wrong comment in e2e/orchestrator_test.go
NicolasMahe Mar 27, 2020
b6f604d
introduce dedicated request struct for process/hash
NicolasMahe Mar 27, 2020
bc48604
fix service e2e hash test to use the dedicated service/hash request s…
NicolasMahe Mar 27, 2020
8ed2290
Merge branch 'feature/process-hash-request' into feature/e2e-lcd
NicolasMahe Mar 27, 2020
daa7696
fix previous commit
NicolasMahe Mar 27, 2020
b4ca883
change gogoproto's customtype to casttype for use of hash.Hash
NicolasMahe Mar 27, 2020
d58b62c
remove now-useless proto marshal from hash.Hash
NicolasMahe Mar 27, 2020
d278fb4
Merge pull request #1755 from mesg-foundation/feature/process-hash-re…
antho1404 Mar 27, 2020
9055067
Merge branch 'dev' into feature/e2e-lcd
antho1404 Mar 27, 2020
ee4eb79
Merge pull request #1751 from mesg-foundation/feature/e2e-lcd
antho1404 Mar 27, 2020
d2b2fc4
add 2 more linters and remove useless exclusion
NicolasMahe Mar 27, 2020
40c7cf5
Merge pull request #1759 from mesg-foundation/feature/lint
antho1404 Mar 27, 2020
fae5636
Merge branch 'dev' into feature/gogoproto-casttype
antho1404 Mar 27, 2020
2963f35
Merge pull request #1756 from mesg-foundation/feature/gogoproto-casttype
antho1404 Mar 27, 2020
6674ab5
fix bug runner/builder/container when current UID and GID are not 0
NicolasMahe Mar 27, 2020
23e26a3
Make the e2e tests directly use the builder/container functions
NicolasMahe Mar 27, 2020
bf7abf1
introduce simple cosmos lcd client
NicolasMahe Mar 27, 2020
23f2709
update e2e tests to use lcd client
NicolasMahe Mar 27, 2020
b97f4e4
Merge pull request #1757 from mesg-foundation/feature/e2e-lcd-runner
antho1404 Mar 27, 2020
88905eb
Merge branch 'dev' into feature/lcd-client
antho1404 Mar 28, 2020
22735cf
rename cosmos client to rpc
NicolasMahe Mar 28, 2020
2e8eb9c
remove module suffix from lot of places
NicolasMahe Mar 28, 2020
2ec512a
pass gasLimit as parameter to LCD
NicolasMahe Mar 28, 2020
f78ceca
Merge pull request #1758 from mesg-foundation/feature/lcd-client
Mar 28, 2020
30cec3e
Only increase local account sequence when tx is ok
NicolasMahe Mar 28, 2020
dee39d4
do the same in rpc client
NicolasMahe Mar 28, 2020
a37a985
fix and simply e2e account sequence test
NicolasMahe Mar 29, 2020
6ca3bf0
Merge branch 'dev' into feature/remove-module-suffix
antho1404 Mar 29, 2020
f45410b
Merge pull request #1761 from mesg-foundation/feature/remove-module-s…
antho1404 Mar 29, 2020
26064c5
fix account sequence mutex
NicolasMahe Mar 30, 2020
9056f3d
Merge branch 'dev' into feature/account-seq-desync
Mar 30, 2020
e27e7c6
add lcd endpoints and commands exists to runner and process
NicolasMahe Apr 2, 2020
1206922
update go-playground/validator to v10
NicolasMahe Mar 31, 2020
839ce0f
Add new gRPC API to be used by the runners
NicolasMahe Apr 1, 2020
58c0249
add command to mesg-cli to sign and verify a signature
NicolasMahe Apr 1, 2020
242bf72
update e2e tests and e2e services to use the new runner API
NicolasMahe Apr 1, 2020
530e3ee
simplify the Runner Register API for the runner
NicolasMahe Apr 1, 2020
f0f30e5
update e2e tests and service with modif of previous commit
NicolasMahe Apr 1, 2020
047643d
fix runner register signature check
NicolasMahe Apr 1, 2020
3bb7d95
use runner exist endpoint in runner server instead of checking the error
NicolasMahe Apr 2, 2020
a81288a
rename gRPC metadata token to mesg_credential_token to improve namesp…
NicolasMahe Apr 2, 2020
ff1bb6a
remove token credential struct from server runner
NicolasMahe Apr 2, 2020
898ef80
update e2e services with previous commit
NicolasMahe Apr 2, 2020
2c5f66a
Merge pull request #1768 from mesg-foundation/feature/runner-process-…
antho1404 Apr 2, 2020
61dbefb
Merge branch 'dev' into feature/auth-runner-grpc
Apr 2, 2020
cf38696
Merge pull request #1767 from mesg-foundation/feature/auth-runner-grpc
antho1404 Apr 2, 2020
0291b18
Use the default cosmos event message as it should, it the module hand…
NicolasMahe Apr 2, 2020
8a27de1
Create dedicated events for each module. Call them in the keeper func…
NicolasMahe Apr 2, 2020
5698107
update the rest of the codebase. delete not really useful stream func…
NicolasMahe Apr 2, 2020
647f547
fix instance event type
NicolasMahe Apr 3, 2020
f97bf9e
Update emit execution. replace status by different action. emit it al…
NicolasMahe Apr 3, 2020
f009b77
deduplicate event in cosmos module client execution stream
NicolasMahe Apr 3, 2020
ef2bac3
gosimple
NicolasMahe Apr 3, 2020
f56fcb2
move execution proposed event when the emitter noted as proposed
NicolasMahe Apr 3, 2020
d419be3
Merge pull request #1769 from mesg-foundation/feature/cosmos-events
antho1404 Apr 3, 2020
7c95471
Move bech32MainPrefix and coinType as const in config package.
NicolasMahe Apr 6, 2020
67e6006
Add new gRPC API Orchestrator.
NicolasMahe Apr 6, 2020
58175b0
add command to sign message
NicolasMahe Apr 6, 2020
258ff4d
update e2e tests and services to use new Orchestrator API
NicolasMahe Apr 6, 2020
4cb4454
fix lint
NicolasMahe Apr 6, 2020
80a107b
put back set of FullFundraiserPath to cosmos config
NicolasMahe Apr 6, 2020
0e58bd3
remove unnecessary require in e2e test
NicolasMahe Apr 6, 2020
06c3e44
change orchestrator execution protobuf number
NicolasMahe Apr 6, 2020
ff8b363
update e2e services
NicolasMahe Apr 6, 2020
2d0ef86
switch to standard base64 encoding
NicolasMahe Apr 7, 2020
3281eae
add to e2e simple service a task that trigger a specific event
NicolasMahe Apr 7, 2020
fdecdda
Replace deprecated EventClient by the new one in e2e tests.
NicolasMahe Apr 7, 2020
9b1fa55
replace use of module client by rpc client
NicolasMahe Apr 7, 2020
f504c76
remove deprecated gRPC APIs and cosmos module client
NicolasMahe Apr 7, 2020
46a3994
fix lint
NicolasMahe Apr 7, 2020
ab55d45
Merge runner/builder package into container package by also simplifyi…
NicolasMahe Apr 7, 2020
53c3a55
remove unused docker-image folder
NicolasMahe Apr 7, 2020
d5f0eb8
remove mocks package
NicolasMahe Apr 7, 2020
84b11c6
sort json payload before signing it
NicolasMahe Apr 8, 2020
8a81e80
Merge pull request #1771 from mesg-foundation/feature/admin-grpc-api
antho1404 Apr 8, 2020
9c5fc9c
Merge branch 'dev' into e2e/switch-event-api
antho1404 Apr 8, 2020
2a2efe5
Merge pull request #1773 from mesg-foundation/e2e/switch-event-api
antho1404 Apr 8, 2020
9cb407b
Merge branch 'dev' into remove/deprecated-grpc-api
antho1404 Apr 8, 2020
6482f21
Merge branch 'dev' into feature/simplify-container
antho1404 Apr 8, 2020
08bfc2d
Merge pull request #1774 from mesg-foundation/remove/deprecated-grpc-api
antho1404 Apr 8, 2020
738a21f
Merge branch 'dev' into feature/simplify-container
NicolasMahe Apr 8, 2020
757de0b
remove docker socket bind from script dev
NicolasMahe Apr 8, 2020
99a8f5d
Merge pull request #1775 from mesg-foundation/feature/simplify-container
antho1404 Apr 8, 2020
969d4d2
Switch back to default staking token of cosmos
NicolasMahe Apr 10, 2020
2318fb2
Bump github.com/cosmos/cosmos-sdk from 0.38.2 to 0.38.3
dependabot-preview[bot] Apr 10, 2020
89a1ebd
add info to cosmos version on build
NicolasMahe Apr 10, 2020
e1945fc
go mod tidy
NicolasMahe Apr 10, 2020
6fa1f8e
Merge pull request #1778 from mesg-foundation/dependabot/go_modules/g…
Apr 10, 2020
b88e914
Merge branch 'dev' into feature/account-seq-desync
Apr 10, 2020
9150ca9
fix merge
NicolasMahe Apr 10, 2020
1e124f1
Merge branch 'dev' into feature/cosmos-cli
antho1404 Apr 10, 2020
cd23aac
Merge pull request #1780 from mesg-foundation/feature/cosmos-cli
antho1404 Apr 10, 2020
7b895a3
Merge branch 'dev' into feature/staking-token
antho1404 Apr 10, 2020
d60e919
Merge pull request #1781 from mesg-foundation/feature/staking-token
antho1404 Apr 10, 2020
429fdb1
Merge branch 'dev' into feature/account-seq-desync
antho1404 Apr 10, 2020
bbc506f
Merge pull request #1762 from mesg-foundation/feature/account-seq-desync
antho1404 Apr 10, 2020
58bfa5a
Calculate the instance env hash with only the customized env instead …
NicolasMahe Apr 14, 2020
209a08a
Merge pull request #1783 from mesg-foundation/feature/simplify-inst-e…
antho1404 Apr 14, 2020
81eeb6e
update changelog with v0.21.0
NicolasMahe Apr 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ schema1.svg
**/*.test
**/debug
**/node_modules
/docker-images
/test
/vendor
coverage.txt
Expand Down
12 changes: 2 additions & 10 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ linters-settings:
misspell:
locale: US

issues:
exclude:
- "ineffective break statement. Did you mean to break out of the outer loop"

exclude-rules:
- path: ext/xvalidator/validator.go
linters:
- golint
text: "exported var Translator should have its own declaration"

linters:
disable-all: true
enable:
Expand All @@ -51,3 +41,5 @@ linters:
- unused
- varcheck
- whitespace
- depguard
- goconst
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,48 @@
# Changelog

## [v0.21.0](https://github.com/mesg-foundation/engine/releases/tag/v0.21.0)

#### Breaking Changes

- ([#1737](https://github.com/mesg-foundation/engine/pull/1737)) Add support for any type of data to filter.
- ([#1739](https://github.com/mesg-foundation/engine/pull/1739)) Add reference system to filter.
- ([#1774](https://github.com/mesg-foundation/engine/pull/1774)) Remove deprecated gRPC API.
- ([#1783](https://github.com/mesg-foundation/engine/pull/1783)) Calculate the instance env hash with only the customized env.

#### Added

- ([#1737](https://github.com/mesg-foundation/engine/pull/1737)) Add support for any type of data to filter.
- ([#1739](https://github.com/mesg-foundation/engine/pull/1739)) Add reference system to filter.
- ([#1749](https://github.com/mesg-foundation/engine/pull/1749)) Add more validation on resources.
- ([#1758](https://github.com/mesg-foundation/engine/pull/1758)) Introduce a simple LCD client.
- ([#1759](https://github.com/mesg-foundation/engine/pull/1759)) add 2 more linters and remove useless exclusion.
- ([#1767](https://github.com/mesg-foundation/engine/pull/1767)) New Runner gRPC API.
- ([#1768](https://github.com/mesg-foundation/engine/pull/1768)) Add lcd endpoints and commands exists to runner and process.
- ([#1771](https://github.com/mesg-foundation/engine/pull/1771)) Add Orchestrator gRPC API.
- ([#1780](https://github.com/mesg-foundation/engine/pull/1780)) Add info to cosmos version on build.

#### Changed

- ([#1751](https://github.com/mesg-foundation/engine/pull/1751)) Replace gRPC by LCD as much as possible from e2e tests.
- ([#1754](https://github.com/mesg-foundation/engine/pull/1754)) Update lcd service hash endpoint to use a dedicated request structure.
- ([#1755](https://github.com/mesg-foundation/engine/pull/1755)) Update lcd process hash endpoint to use a dedicated request structure.
- ([#1756](https://github.com/mesg-foundation/engine/pull/1756)) Change gogoproto's customtype to casttype.
- ([#1757](https://github.com/mesg-foundation/engine/pull/1757)) Replace runner gRPC by LCD in e2e tests.
- ([#1761](https://github.com/mesg-foundation/engine/pull/1761)) Remove module suffix from lot of places.
- ([#1769](https://github.com/mesg-foundation/engine/pull/1769)) Update cosmos events.
- ([#1773](https://github.com/mesg-foundation/engine/pull/1773)) Use new event API in e2e tests.
- ([#1775](https://github.com/mesg-foundation/engine/pull/1775)) Simplify container.
- ([#1781](https://github.com/mesg-foundation/engine/pull/1781)) Switch back to default staking coins of cosmos.

#### Fixed

- ([#1746](https://github.com/mesg-foundation/engine/pull/1746)) Add "dive" validation to all repeated message in the proto files.
- ([#1762](https://github.com/mesg-foundation/engine/pull/1762)) Fix account sequence desynchronisation when error.

#### Dependencies

- ([#1752](https://github.com/mesg-foundation/engine/pull/1752)) Update to cosmos-sdk v0.38.2 and tendermint v0.33.2.

## [v0.20.0](https://github.com/mesg-foundation/engine/releases/tag/v0.20.0)

#### Added
Expand Down
2 changes: 0 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/staking"
"github.com/cosmos/cosmos-sdk/x/supply"
"github.com/mesg-foundation/engine/protobuf/api"
"github.com/mesg-foundation/engine/protobuf/types"
"github.com/mesg-foundation/engine/x/execution"
"github.com/mesg-foundation/engine/x/instance"
Expand Down Expand Up @@ -85,7 +84,6 @@ func MakeCodec() *codec.Codec {
sdk.RegisterCodec(cdc)
codec.RegisterCrypto(cdc)
types.RegisterCodec(cdc)
api.RegisterCodec(cdc)

return cdc.Seal()
}
Expand Down
24 changes: 7 additions & 17 deletions cmd/mesg-cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/bank"
bankcmd "github.com/cosmos/cosmos-sdk/x/bank/client/cli"
"github.com/mesg-foundation/engine/app"
"github.com/mesg-foundation/engine/config"
"github.com/mesg-foundation/engine/cosmos"
"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand All @@ -32,22 +31,12 @@ func main() {
// Instantiate the codec for the command line application
cdc := app.MakeCodec()

// Read in the configuration file for the sdk
// TODO: change back when more refactor is done
// config := sdk.GetConfig()
// config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub)
// config.SetBech32PrefixForValidator(sdk.Bech32PrefixValAddr, sdk.Bech32PrefixValPub)
// config.SetBech32PrefixForConsensusNode(sdk.Bech32PrefixConsAddr, sdk.Bech32PrefixConsPub)
// config.Seal()
cfg, err := config.New()
if err != nil {
panic(err)
}
cosmos.CustomizeConfig(cfg)
// init the config of cosmos
cosmos.InitConfig()

rootCmd := &cobra.Command{
Use: "mesg-cli",
Short: "Command line interface for interacting with appd",
Use: version.ClientName,
Short: "Command line interface for interacting with " + version.Name,
}

// Add --chain-id to persistent flags and mark it required
Expand All @@ -66,6 +55,8 @@ func main() {
lcd.ServeCommand(cdc, registerRoutes),
flags.LineBreak,
keys.Commands(),
signCommand(),
verifySignCommand(),
flags.LineBreak,
version.Cmd,
flags.NewCompletionCmd(rootCmd, true),
Expand All @@ -74,8 +65,7 @@ func main() {
// Add flags and prefix all env exposed with MESG
executor := cli.PrepareMainCmd(rootCmd, "MESG", app.DefaultCLIHome)

err = executor.Execute()
if err != nil {
if err := executor.Execute(); err != nil {
fmt.Printf("Failed executing CLI command: %s, exiting...\n", err)
os.Exit(1)
}
Expand Down
76 changes: 76 additions & 0 deletions cmd/mesg-cli/sign.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package main

import (
"bufio"
"encoding/base64"
"fmt"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/crypto/keys"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)

func signCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "sign <name> <message>",
Short: "Sign the given message",
Args: cobra.MinimumNArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 2 {
return fmt.Errorf("must have exactly 2 args: name of the account to use and the message to sign")
}
buf := bufio.NewReader(cmd.InOrStdin())
kb, err := keys.NewKeyring(sdk.KeyringServiceName(), viper.GetString(flags.FlagKeyringBackend), viper.GetString(flags.FlagHome), buf)
if err != nil {
return err
}
signature, _, err := kb.Sign(args[0], "", []byte(args[1]))
if err != nil {
return err
}
fmt.Println(base64.StdEncoding.EncodeToString(signature))
return nil
},
}
cmd.PersistentFlags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)")
viper.BindPFlag(flags.FlagKeyringBackend, cmd.Flags().Lookup(flags.FlagKeyringBackend))
return cmd
}

func verifySignCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "verifySign <name> <message> <signature>",
Short: "Verify the signature of the given message",
Args: cobra.MinimumNArgs(3),
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 3 {
return fmt.Errorf("must have exactly 2 args: name of the account to use and the message used to sign, and the signature")
}
buf := bufio.NewReader(cmd.InOrStdin())
kb, err := keys.NewKeyring(sdk.KeyringServiceName(), viper.GetString(flags.FlagKeyringBackend), viper.GetString(flags.FlagHome), buf)
if err != nil {
return err
}
acc, err := kb.Get(args[0])
if err != nil {
return err
}
signature, err := base64.StdEncoding.DecodeString(args[2])
if err != nil {
return err
}
verify := acc.GetPubKey().VerifyBytes([]byte(args[1]), signature)
if verify {
fmt.Println("verification succeed")
} else {
fmt.Println("verification failed")
}
return nil
},
}
cmd.PersistentFlags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)")
viper.BindPFlag(flags.FlagKeyringBackend, cmd.Flags().Lookup(flags.FlagKeyringBackend))
return cmd
}
22 changes: 6 additions & 16 deletions cmd/mesg-daemon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth"
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
"github.com/cosmos/cosmos-sdk/x/staking"
"github.com/mesg-foundation/engine/app"
"github.com/mesg-foundation/engine/config"
"github.com/mesg-foundation/engine/cosmos"
"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand All @@ -32,23 +32,14 @@ var invCheckPeriod uint
func main() {
cdc := app.MakeCodec()

// TODO: put back when more refactor is done
// config := sdk.GetConfig()
// config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub)
// config.SetBech32PrefixForValidator(sdk.Bech32PrefixValAddr, sdk.Bech32PrefixValPub)
// config.SetBech32PrefixForConsensusNode(sdk.Bech32PrefixConsAddr, sdk.Bech32PrefixConsPub)
// config.Seal()
cfg, err := config.New()
if err != nil {
panic(err)
}
cosmos.CustomizeConfig(cfg)
// init the config of cosmos
cosmos.InitConfig()

ctx := server.NewDefaultContext()
cobra.EnableCommandSorting = false
rootCmd := &cobra.Command{
Use: "mesg-daemon",
Short: "app Daemon (server)",
Use: version.ServerName,
Short: "Engine Daemon (server)",
PersistentPreRunE: server.PersistentPreRunEFn(ctx),
}

Expand All @@ -72,8 +63,7 @@ func main() {
executor := cli.PrepareBaseCmd(rootCmd, "AU", app.DefaultNodeHome)
rootCmd.PersistentFlags().UintVar(&invCheckPeriod, flagInvCheckPeriod,
0, "Assert registered invariants every N blocks")
err = executor.Execute()
if err != nil {
if err := executor.Execute(); err != nil {
panic(err)
}
}
Expand Down
Loading