Skip to content

Conversation

@gichiba
Copy link
Contributor

@gichiba gichiba commented May 18, 2019

This PR improves upon the docs improvements/fixes that went into the latest glider release.

Specifically, it includes instructions for interacting with the Goerli deployment using remix or the truffle console.

JoinColony/solidity-steamroller#3 needs to be merged before the instructions will make sense, but that should happen relatively soon.

In order to compile the colonyNetwork smart contracts, you will need to have Docker installed and running. We recommend using Docker Community Version `2.0.0.0`. You can find instructions for installing Docker here: [Docker Installation](https://docs.docker.com/install/).

The colonyNetwork smart contracts require the `ethereum/solc:0.4.23` Docker image, so we will need to pull down this image before we can begin.
The colonyNetwork smart contracts require the `ethereum/solc:0.5.6` Docker image, so we will need to pull it down before we can begin.
Copy link
Contributor

Choose a reason for hiding this comment

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

We are upgrading to 0.5.8 in colonyNetwork#616

## `glider-rc.1` on the Görli testnet

To deploy all contracts and run all tests, run the following command.
The [Glider release candidate](/colonynetwork/docs-releases/) is in many ways a simpler and easier way to experiment than setting up a local development environment, and can be very useful if you're looking to just get a sense of how the colonyNetwork contracts work, or want to build extensions/integrations that remain inside the EVM.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the link supposed to be to the actual release details?

`ColonyNetwork`: `0x79073fc2117dD054FCEdaCad1E7018C9CbE3ec0B`

Alternatively, you can start a local test node and deploy the contracts yourself using the locally installed `truffle` package.
You will also require Görli test ETH, and a deployed ERC20 token to import.
Copy link
Contributor

Choose a reason for hiding this comment

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

If they plan on creating a Colony and interacting with it they will need a lot more than that 👆 . The following set of transactions are a useful reference as to how to setup and wire a new Colony.
#607

The ENS registration steps are optional (as they are a user friendly UI used by the dApp) and the Extension Contracts steps might also be skipped if Payments aren't a required functionality or Old style permissions aren't needed.

### Start Mining Client

You can start the reputation mining client using the following command.
Rather than import the entire set of contracts into remix, use the included `solidity-steamroller` to flatten the needed interface contracts to the `build/flattened/` directory:
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 build all interface contracts. Can solidity-steamroller accept wildcards for flattening, e.g. I*.sol 🤔


```
node packages/reputation-miner/bin/index.js --colonyNetworkAddress { COLONYNETWORK_ADDRESS } --minerAddress { MINER_ADDRESS }
$ yarn flatten:contracts
Copy link
Contributor

Choose a reason for hiding this comment

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

You are missing run from this command

Copy link
Contributor

Choose a reason for hiding this comment

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

As @area rightly pointed out to me earlier, this will work even without run. I didn't know that was the case but still I would probably want to be consistent and reference it still.

### Force Reputation Updates
Alternatively, you can put them into the directory of your choice, e.g. `~/Downloads/`:
```
$ yarn steamroller /contracts/IColonyNetwork.sol > ~/Downloads/flatIColonyNetwork.sol
Copy link
Contributor

Choose a reason for hiding this comment

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

Also missing run

```

The client is set to provide a reputation update once per hour. For testing, you'll likely want to "fast-forward" your network through a few submissions to see usable reputation.
Import the flattened contract into the remix IDE, and then call `createColony()`
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a little more than that, as they will need to create an instance of the flattened interface, then point to to an existing EtherRouter for the respective type, e.g. a ColonyNetwork representation. Only then if calling createColony you will be wired correctly. The above sounds to me like calling a function on an interface contract will do it.

Then, start up the truffle console and connect to testnet:
```
curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"evm_mine","params":[]}' localhost:8545
$ yarn truffle console --network goerli
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing run

```
In the truffle console, instantiate the IColonyNetwork interface for `glider-rc.1`:
```
truffle(goerli)> let IColonyNetwork = await IColonyNetwork.at("0x79073fc2117dD054FCEdaCad1E7018C9CbE3ec0B")
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 avoid naming local variables as truffle artefacts. let IColonyNetwork -> let colonyNetwork

http://127.0.0.1:3000/{reputationState}/{colonyAddress}/{skillId}/{userAddress}
From here, you can create a new colony (with an ERC20 token already deployed):
```
truffle(goerli)> IColonyNetwork.createColony("your-erc20-token-address")
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to await all commands as they return promises

```
The oracle should be able to provide responses to any valid reputation score in all historical states, as well as the current state.
truffle(goerli)> IColonyNetwork.getColonyCount()
Copy link
Contributor

Choose a reason for hiding this comment

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

await

http://127.0.0.1:3000/0x7ad8c25e960b823336fea83f761f5199d690c7b230e846eb29a359187943eb33/0x1133560dB4AebBebC712d4273C8e3137f58c3A65/2/0x3a965407ced5e62c5ad71de491ce7b23da5331a4
yarn run start:blockchain:client
./node_modules/.bin/truffle migrate --reset --compile-all
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets be consistent and use yarn run truffle instead of ./node_modules/.bin/truffle

```

The oracle should return something similar to the following.
To deploy all contracts and run all tests, run the following command.
Copy link
Contributor

Choose a reason for hiding this comment

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

In #613 we have split the reputation mining tests away from the main test suite. After this is merged in addition to test:contracts we'll have test:reputation which will run reputation contract and miner client tests and checks their coverage.

order: 6
---

The reputation mining client is usable for testing but it has limited functionality. Still, it is possible to run a single miner instance for usable reputation scores on a local test network.
Copy link
Contributor

Choose a reason for hiding this comment

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

This sounds like our miner is a a bit lame :) What's the "limited functionality" you are referring to here?

curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"evm_increaseTime","params":[86400],"id": 1}' localhost:8545
```

Once you have moved the network forward by an hour, you can then mine a new block with the following command.
Copy link
Contributor

Choose a reason for hiding this comment

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

We need 24 hours to mine a reputation cycle


Note that because reputation is awarded for the *previous* submission window, you will need to use the "fast-forward" command above to speed through at least 3 reputation updates before noticing a change in the miner's reputation.

### Get Reputation from the Reputation Oracle
Copy link
Contributor

Choose a reason for hiding this comment

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

It'll be useful to add another section on the Visualiser which can be very useful to understand the current reputation mining state. This work will be merged in #582

* the current testnet release (tagged on the `master` branch) and deployed to Görli
* against the `develop` branch where we merge ongoing work
* the current testnet release (tagged on the `develop` branch) and deployed to Görli
* against the `master` branch where we merge ongoing work
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh no, we don't merge ongoing work in master, that's where we release to mainnet from.

package.json Outdated
"provision:token:contracts": "truffle compile && truffle compile --contracts_directory 'lib/dappsys/[!proxy][!exec]*.sol' && bash ./scripts/provision-token-contracts.sh",
"start:blockchain:client": "bash ./scripts/start-blockchain-client.sh",
"stop:blockchain:client": "bash ./scripts/stop-blockchain-client.sh",
"flatten:contracts": "mkdir -p ./build/flattened/ && steamroller contracts/IColonyNetwork.sol > build/flattened/flatIColonyNetwork.sol && steamroller contracts/IColony.sol > build/flattened/flatIColony.sol",
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 build all interface contracts really.

Copy link
Contributor

@elenadimitrova elenadimitrova left a comment

Choose a reason for hiding this comment

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

I want to improve this further, in quite a few places it didn't ring quite true to me as a developer. The network is complex to wire and work with, even we are finding it mind boggling sometimes so I'd like to make the docs as clear and concise as possible for them to be useful.

@gichiba
Copy link
Contributor Author

gichiba commented May 21, 2019

Ok, I'll fix what you've commented on tomorrow if I have time, Wednesday if I don't

@gichiba gichiba force-pushed the docs/glider-fixes branch from e1a9c1e to ee0f94d Compare May 23, 2019 16:24
@elenadimitrova elenadimitrova merged commit 3580cb0 into develop May 23, 2019
@elenadimitrova elenadimitrova deleted the docs/glider-fixes branch May 23, 2019 17:02
@gichiba gichiba mentioned this pull request May 24, 2019
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants