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

Cosmos integration #1211

Merged
merged 9 commits into from
Aug 13, 2019
Merged

Cosmos integration #1211

merged 9 commits into from
Aug 13, 2019

Conversation

NicolasMahe
Copy link
Member

@NicolasMahe NicolasMahe commented Aug 9, 2019

This PR integrate Cosmos and mainly tendermint in the Engine 🍾 🎊

There is 2 ways to run cosmos, as validator (will create the blocks) and as client (will receive blocks from a validator).
A working blockchain should have at least one validator.

To run a validator, execute:

./dev --validator

To run a client, execute:

./dev

If you want to run multiple Engine on the same computer, you'll need to set a different name, path and port:

MESG_NAME=engine2 MESG_SERVER_PORT=50053 MESG_PATH=~/.mesg2 ./dev

To override default, you can specificy the validator with the following envs:

MESG_TENDERMINT_VALIDATORPUBKEY=9731AA3C8A4D381397B17726308E441A4FD5028451C99CD7CD5A84BDE9E5D
288 
MESG_TENDERMINT_P2P_SEEDS=c291a80fbad7c95ac7c86251beeabf0e53d7a836@0.tcp.ngrok.io:26656

The logs from Cosmos are too much and will be configurable in another PR.


Closes #1195

@NicolasMahe NicolasMahe added the enhancement New feature or request label Aug 9, 2019
@NicolasMahe NicolasMahe added this to the next milestone Aug 9, 2019
@NicolasMahe NicolasMahe self-assigned this Aug 9, 2019
logger.Init(cfg.Log.Format, cfg.Log.Level, cfg.Log.ForceColors)

// init app
db := db.NewMemDB()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't matter for this PR but just a reminder that this is in memory

core/main.go Outdated Show resolved Hide resolved
dev
MESG_TENDERMINT_VALIDATORPUBKEY=${MESG_TENDERMINT_VALIDATORPUBKEY:-$VALIDATOR_PUBKEY}

# Setup the validator private keys
if [[ $* == *--validator* ]]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krhubert if you know a better way to read flag but definitely not blocking

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, there is getopts tool (one of many examples https://sookocheff.com/post/bash/parsing-bash-script-arguments-with-shopts/)

genesis := &types.GenesisDoc{
GenesisTime: time.Date(2019, 8, 8, 0, 0, 0, 0, time.UTC),
ChainID: "xxx",
ConsensusParams: types.DefaultConsensusParams(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the default consensus here but a config with 10 sec. Don't we have any issue with that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConsensusParams != config.Consensus

config.Consensus is stored in config/config.toml:

##### consensus configuration options #####
[consensus]

wal_file = "data/cs.wal/wal"

timeout_propose = "3s"
timeout_propose_delta = "500ms"
timeout_prevote = "1s"
timeout_prevote_delta = "500ms"
timeout_precommit = "1s"
timeout_precommit_delta = "500ms"
timeout_commit = "5s"
# ....

ConsensusParams is stored in config/genesis.json:

  "consensus_params": {
    "block": {
      "max_bytes": "22020096",
      "max_gas": "-1",
      "time_iota_ms": "1000"
    },
    "evidence": {
      "max_age": "100000"
    },
    "validator": {
      "pub_key_types": [
        "ed25519"
      ]
    }
  },

tendermint/node.go Outdated Show resolved Hide resolved
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
golang.org/x/tools v0.0.0-20190712213246-8b927904ee0d // indirect
google.golang.org/genproto v0.0.0-20190708153700-3bdd9d9f5532 // indirect
google.golang.org/grpc v1.22.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

many dependencies changed what's the reason? Is this really necessary for this PR and if it is we need to make sure it didn't break anything and test all that

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dependency with cosmos-sdk is the reason.

core/main.go Outdated Show resolved Hide resolved
@antho1404
Copy link
Member

there are also issues on codacy because of missing comments to fix

Copy link
Member

@antho1404 antho1404 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok for me, it looks great, just resolving the conflicts and then it's ready to merge for me :)

I got some issues with the dev script but apparently, it is fixed on another PR

…cosmos-integration

# Conflicts:
#	config/config.go
#	core/main.go
#	go.mod
#	go.sum
@NicolasMahe NicolasMahe merged commit 4ce52f8 into dev Aug 13, 2019
@NicolasMahe NicolasMahe deleted the feature/cosmos-integration branch August 13, 2019 02:50
@NicolasMahe NicolasMahe modified the milestones: next, v0.13.0 Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integration of a Tendermint in the Engine
3 participants