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

Feature/kovan parity #57

Closed
wants to merge 17 commits into from
Closed

Feature/kovan parity #57

wants to merge 17 commits into from

Conversation

jcortejoso
Copy link
Contributor

@jcortejoso jcortejoso commented Nov 23, 2018

Description

Added support to spin up a parity client which connects to kovan network and Ocean testnet POA.

Is this PR related with an open issue?

Related to Issue #51

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Follows the code style of this project.
  • Tests Cover Changes
  • Documentation

Funny gif

Put a link of a funny gif inside the parenthesis-->

@jcortejoso jcortejoso requested review from ttmc, aaitor and H34D November 23, 2018 14:32
Copy link
Contributor

@ttmc ttmc left a comment

Choose a reason for hiding this comment

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

It would be nice to have some documentation about how to use this option as well.

start_ocean.sh Outdated Show resolved Hide resolved
Copy link
Contributor

@aaitor aaitor left a comment

Choose a reason for hiding this comment

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

looks good to me. Because adding this change, to deploy in kovan/test net require to unlock the address, can you add some info about how the users should unlock their accounts?

start_ocean.sh Outdated Show resolved Hide resolved
start_ocean.sh Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated
then `docker-compose-only-parity.yml` Docker Compose file will be used. It will start only one container (`oceanprotocol/parity-ethereum:master`) that will connect to the Kovan testnet network. The parity client is configure to allow connections with the RPC interface. With this option, you must place in `./parity/kovan/account.json` your account json and in `./parity/kovan/password` a file with the account passsword (default locations). Also you must export the variable `UNLOCK_ADDRESS` with the account address of this account. For example:

```bash
export UNLOCK_ADDRESS="0x00bd138abd70e2f00903268f3db08f2d25677c9e"
Copy link
Contributor

Choose a reason for hiding this comment

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

we should use an nmemoric for this instead of private key / address / password combination

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, any recommendation?

@H34D
Copy link
Contributor

H34D commented Nov 26, 2018

./start_ocean.sh --no-pleuston --latest --kovan-parity-node gives me Option --no-pleuston is not compatible with option --local-secret-store

Co-Authored-By: jcortejoso <[email protected]>
@jcortejoso
Copy link
Contributor Author

jcortejoso commented Nov 26, 2018

@H34D not sure if we should include logic about compatibility of option, but in that case --kovan-parity-node and --no-pleuston are kind of incompatible. I mean, it would have different results running ./start_ocean.sh --no-pleuston --kovan-parity-node and ./start_ocean.sh --kovan-parity-node --no-pleuston, which is not a good deal. I would say it is better to error when the script is run with two option that force to use different compose files. Additionally, --latest when running --kovan-parity-node or --testnet-parity-node has no effect.

But the message is not correct. Thanks!

@H34D
Copy link
Contributor

H34D commented Nov 26, 2018

We should never run nodes (to persistent blockchains) with unlocked account. I also don't see the need to have unlocked accounts anyway.

There are a few stages:

  • Development / Local: Usually a docker or ganache-cli or parity --dev instance. It's ok to have unlocked accounts because you use them for development of smart contracts or unit tests aka development of (L1 and L2).
  • Integration: in our case this will be our POA AWS network, we must make sure that there is never a node with unlocked accounts. Thats an antipattern. Deployments to this network could be done from keeper-contracts like they are done now to kovan (with a nmemoric phrase that is private). Why should this docker deploy anything anyway? There is a release process of contracts already.
  • Test: Kovan, there is a deployment process in place. No need for unlocked accounts at all.
  • Live: Mainnet, never unlock accounts here.

Prosal:

  • remove unlocked accounts
  • remove migration process from docker
  • add flags for using different networks underneath, local poa, aws poa, kovan, mainnet

@H34D
Copy link
Contributor

H34D commented Nov 26, 2018

@H34D not sure if we should include logic about compatibility of option, but in that case --kovan-parity-node and --no-pleuston are kind of incompatible. I mean, it would have different results running ./start_ocean.sh --no-pleuston --kovan-parity-node and ./start_ocean.sh --kovan-parity-node --no-pleuston, which is not a good deal. I would say it is better to error when the script is run with two option that force to use different compose files.

@jcortejoso but why? there is no need for this dependency other than they are in two different compose files.

I can start the whole infrastructure without pleuston and use kovan for the rest, Spin up my own pleuston and connect to kovan with ease.

@jcortejoso
Copy link
Contributor Author

@H34D the idea about having unlock (locally) an account was to avoid the way we were deploying currently the contracts. Using keeper-contracts locally to connect directly to the container so we do not need to connect to a remote node with an account unlocked. But if there is a better approach to this we can change it.

@H34D
Copy link
Contributor

H34D commented Nov 26, 2018

@H34D the idea about having unlock (locally) an account was to avoid the way we were deploying currently the contracts. Using keeper-contracts locally to connect directly to the container so we do not need to connect to a remote node with an account unlocked. But if there is a better approach to this we can change it.

yes but this is only needed for local deployments (ganache-cli or parity --dev) and is a huge risk in the other cases.

@jcortejoso
Copy link
Contributor Author

@H34D about he compatibility of the compose files, the result of running start-ocean.sh is running only one compose files. To run simultaneously multiple compose files, you need to run multiple times start-ocean.sh. So any option which implies different compose-files are not very intuitive.

@H34D
Copy link
Contributor

H34D commented Nov 26, 2018

we should declare poa network or kovan to the default and remove the migration part completely from docker. Development stage is an edge case, not the default.

@jcortejoso
Copy link
Contributor Author

@H34D good, I change the unlock part.

@jcortejoso jcortejoso added the Status: InProgress Work in progress, don't merge label Nov 26, 2018
@H34D
Copy link
Contributor

H34D commented Nov 26, 2018

can we do something like a plugin system where we keep a base and plug the nodes to it like docker-compose -f docker-compose.yml -f docker-compose.kovan.yml up -d

What i can define so far is:

  • base components: mongo-db, brizo, aquarius
  • plugin secret store: secret-store, local parity node to sign, cors proxy
  • plugin node: ganache-cli OR local poa OR poa test OR kovan (represented by different configured parity nodes or ganache)
  • plugin frontend: pleuston OR nothing

@H34D
Copy link
Contributor

H34D commented Nov 26, 2018

can we do something like a plugin system where we keep a base and plug the nodes to it like docker-compose -f docker-compose.yml -f docker-compose.kovan.yml up -d

What i can define so far is:

  • base components: mongo-db, brizo, aquarius
  • plugin secret store: secret-store, local parity node to sign, cors proxy
  • plugin node: ganache-cli OR local poa OR poa test OR kovan (represented by different configured parity nodes or ganache)
  • plugin frontend: pleuston OR nothing

i tried that out and it works, giving me the following diagram. All of the stacks can be started individually:

untitled diagram

this will give the flexibility to start in whatever combination we want combined to full flexibility of node setup, blockchain node could be ganache or mainnet, doesn't matter as long it is exposing port 8545

@H34D
Copy link
Contributor

H34D commented Nov 26, 2018

maybe lets describe all components i am starting with all permutations of the blockchain nodes that i can imagine:

  • Local Ganache node (ganache-cli forming a local private network)
  • Local Parity node (parity --chain dev forming a local private network)
  • Local POA Parity node (parity forming a local private network that behaves like POA AWS (but with different Network ID))
  • AWS POA Parity node (parity node connected to POA network in AWS)
  • Kovan node (parity node connected to kovan network)
  • Mainnet node (parity node connected to mainnet network)
| Docker          | Location | Type     | Net  | node.yml |
|=================|==========|==========|======|==========|
| docker-compose- | aws-poa- | parity-  |      | node.yml |
| docker-compose- | kovan-   | parity-  |      | node.yml |
| docker-compose- | local-   | ganache- |      | node.yml |
| docker-compose- | local-   | parity-  | dev- | node.yml |
| docker-compose- | local-   | parity-  | poa- | node.yml |

@jcortejoso
Copy link
Contributor Author

maybe lets describe all components i am starting with all permutations of the blockchain nodes that i can imagine:

* Local Ganache node (`ganache-cli` forming a local private network)

* Local Parity node (`parity --chain dev` forming a local private network)

* Local POA Parity node (`parity` forming a local private network that behaves like POA AWS (but with different Network ID))

* AWS POA Parity node (`parity` node connected to POA network in AWS)

* Kovan node (`parity` node connected to `kovan` network)

* Mainnet node (`parity` node connected to `mainnet` network)
| Docker          | Location | Type     | Net  | node.yml |
|=================|==========|==========|======|==========|
| docker-compose- | aws-poa- | parity-  |      | node.yml |
| docker-compose- | kovan-   | parity-  |      | node.yml |
| docker-compose- | local-   | ganache- |      | node.yml |
| docker-compose- | local-   | parity-  | dev- | node.yml |
| docker-compose- | local-   | parity-  | poa- | node.yml |

👍 Sounds very good. I will open a new PR for facing that refactor.

I have updated this PR removing the possibility to unlock accounts. @H34D does this make sense?

@ttmc
Copy link
Contributor

ttmc commented Nov 26, 2018

I didn't know that Docker Compose could take multiple docker-compose files in one command-line command, but it can. See:

https://docs.docker.com/compose/reference/overview/#specifying-multiple-compose-files

If we kill off ganache completely, then that would simplify things: the only node "Type" would be parity, so it wouldn't have to be specified at all.

@H34D
Copy link
Contributor

H34D commented Nov 26, 2018

I didn't know that Docker Compose could take multiple docker-compose files in one command-line command, but it can. See:

it can an we can build fancy mix and match layer system on top

@H34D
Copy link
Contributor

H34D commented Nov 26, 2018

If we kill off ganache completely, then that would simplify things: the only node "Type" would be parity, so it wouldn't have to be specified at all.

but why limiting? i renamed the container to blockchain holding what ever your plugin specifies as blockchain, could be ganache, parity or geth. Or even somthing complelty different, as long it exposes the ethereum protocol on port 8545.

@ttmc
Copy link
Contributor

ttmc commented Nov 26, 2018

but why limiting? i renamed the container to blockchain holding what ever your plugin specifies as blockchain, could be ganache, parity or geth. Or even somthing complelty different, as long it exposes the ethereum protocol on port 8545.

I'm okay with keeping ganache as an option. I was just looking for opportunities to simplify.

Copy link
Contributor

@H34D H34D left a comment

Choose a reason for hiding this comment

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

lgtm

parity/ocean-network/account.json
parity/ocean-network/password
parity/kovan/account.json
Copy link
Contributor

Choose a reason for hiding this comment

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

can be removed

@H34D
Copy link
Contributor

H34D commented Nov 27, 2018

./start_ocean.sh --local-secret-store will no give me Option --no-pleuston is not compatible with option --local-secret-store all the time

@H34D
Copy link
Contributor

H34D commented Nov 27, 2018

relates to #64

@@ -64,8 +64,10 @@ Option | Description
--- | ---
`--latest` | Get the `latest` versions of all components, referring to their `develop` branches.
`--no-pleuston` | Start up Ocean without an instance of `pleuston`. Helpful for development on `pleuston`.
`--local-parity-node` | Runs a local parity POA node and Secret Store instead of ganache-cli.
`--local-secret-store` | Runs a local parity POA node and Secret Store instead of ganache-cli.
`--reuse-database` | Start up Ocean and reuse the Database from ganache. Helpful for development.
Copy link
Contributor

Choose a reason for hiding this comment

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

should be something like --reuse-ganache-database because it triggers a reuse of the blockchain db not the mongodb. This is also a super special case.

`--reuse-database` | Start up Ocean and reuse the Database from ganache. Helpful for development.
`--testnet-parity-node` | Start up a parity client connected to Ocean testnet.
Copy link
Contributor

Choose a reason for hiding this comment

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

does this really connect to the testnet in aws? or is ist setting up an own testnet?

`--reuse-database` | Start up Ocean and reuse the Database from ganache. Helpful for development.
`--testnet-parity-node` | Start up a parity client connected to Ocean testnet.
`--kovan-parity-node` | Start up a parity client connected to Kovan testnet.
Copy link
Contributor

Choose a reason for hiding this comment

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

parity can be removed for a user it does not matter if it spins up a parity or geth node to connect to kovan

environment:
LOCAL_CONTRACTS: "true"
DEPLOY_CONTRACTS: ${DEPLOY_CONTRACTS}
DATABASE_PATH: "/ganache-db"
Copy link
Contributor

Choose a reason for hiding this comment

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

GANACHE_DATABASE_PATH: "/ganache-db"

LOCAL_CONTRACTS: "true"
DEPLOY_CONTRACTS: ${DEPLOY_CONTRACTS}
DATABASE_PATH: "/ganache-db"
REUSE_DATABASE: ${REUSE_DATABASE}
Copy link
Contributor

Choose a reason for hiding this comment

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

GANCHE_REUSE_DATABASE

DATABASE_PATH: "/ganache-db"
REUSE_DATABASE: ${REUSE_DATABASE}
NETWORK_NAME: ${KEEPER_NETWORK_NAME}
POA_HOST: "parity-node"
Copy link
Contributor

Choose a reason for hiding this comment

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

BLOCKCHAIN_NODE_HOST: "parity-node"

@jcortejoso
Copy link
Contributor Author

I think we can close in favor of #71 . Will open a new PR when that is merged to work on Ocean testnet compatibility.

@jcortejoso jcortejoso closed this Dec 5, 2018
@jcortejoso jcortejoso removed the Status: InProgress Work in progress, don't merge label Dec 5, 2018
@H34D H34D deleted the feature/kovan_parity branch December 10, 2018 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants