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

Update new workflow after repo separation #321

Merged
merged 12 commits into from
Aug 26, 2020
57 changes: 33 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<div align="center">

<h1><code>Rainbow Bridge</code></h1>
<h1><code>Rainbow Bridge CLI</code></h1>

<p>
<strong>Ethereum to Near trustless, fully decentralized, bidirectional bridge</strong>
<strong>OPS tool to Rainbow Bridge, an Ethereum to Near trustless, fully decentralized, bidirectional bridge</strong>
</p>

<p>
<a href="https://buildkite.com/nearprotocol/rainbow-bridge"><img src="https://badge.buildkite.com/a3dcd9711ef855a7ea6dc80453828ad73d7a669b9a925889ad.svg?branch=master" alt="Buildkite Build" /></a>
<a href="https://npmjs.com/rainbow-bridge-cli"><img alt="npm" src="https://img.shields.io/npm/v/rainbow-bridge-cli.svg?style=flat-square"></a>
</p>
<h3>
<a href="https://github.com/near/rainbow-bridge#installation">Installation</a>
<a href="https://github.com/near/rainbow-bridge-cli#installation">Installation</a>
<span> | </span>
<a href="https://github.com/near/rainbow-bridge#usage">Usage</a>
<a href="https://github.com/near/rainbow-bridge-cli#usage">Usage</a>
<span> | </span>
<a href="https://github.com/near/rainbow-bridge/tree/master/docs#documentation">Documentation</a>
<a href="https://github.com/near/rainbow-bridge-cli/tree/master/docs#documentation">Documentation</a>
<span> | </span>
<a href="https://github.com/near/rainbow-bridge#examples">Examples</a>
<a href="https://github.com/near/rainbow-bridge-cli#examples">Examples</a>
</h3>
</div>

Expand All @@ -28,6 +28,11 @@ need CLI only for the token transfer you need to install all testing dependencie

- Install golang, [see](https://golang.org/dl/).
- Make sure you are using Node with version <=13. We recommend using [nvm](https://github.com/nvm-sh/nvm) for installing node and npm, if you already don't have one. This constraint will be removed soon;
- yarn
- docker, for deterministic compile rust contracts

### If you want to test with a local near node:

- You would also need to install resources needed to compile nearcore (in the future this will only be required for the testing CLI):

```bash
Expand All @@ -38,34 +43,27 @@ rustup target add wasm32-unknown-unknown
```

- Then install dependencies needed for the compilation of nearcore, [see](https://docs.near.org/docs/local-setup/running-testnet#compiling-and-running-official-node-without-docker).

## Prerequisite

- linux or mac
- nodejs 12 or 13
- npm
- yarn
- golang 1.13 or above (For ethashproof util)
- docker (For deterministic compile rust contracts)

If you want to test with a local near node:

- rust, and necessary library to build nearcore (For compile and run a local near node)
- python 3.6 or above (For nearup)
- python3, for nearup

## Usage

You can install `rainbow-bridge-cli` from npm

```
npm i -g rainbow-bridge-cli
```

To learn the commands that you can use with the rainbow bridge run

rainbow-bridge --help
```
rainbow --help
```

Alternatively, clone this repo, `cd environment && yarn install && cd ..`, then you can see what commands you can use with:
Alternatively, clone this repo, `yarn install`, then you can see what commands you can use with:

```
./index.js --help
```

Parameters of each command can be specified through environment variables, command line arguments, entries in the `~/.rainbow/config.json` config file, or the default value will be used -- in that priority.
If argument is not provided and there is no default value the program will not execute.
Expand Down Expand Up @@ -120,8 +118,7 @@ Let's set them up:
Prepare CLI:

```bash
git clone https://github.com/near/rainbow-bridge/
cd rainbow-bridge/environment
git clone https://github.com/near/rainbow-bridge-cli/
yarn
node index.js clean
node index.js prepare
Expand Down Expand Up @@ -305,6 +302,18 @@ node index.js transfer-eth-erc20-from-near --amount 1 --near-sender-account rain

You should observe the change of the ERC20 balance as reported by the CLI.

## Contract Development Workflow

Above steps are ways to run a local bridge and development workflows you need if make any changes to rainbow-bridge-cli. If you want to update any of solidity or rust contracts, they're not in this repo now and workflow is as following.

- Install dependencies, doing `index.js clean`, `prepare`, `start near-node` `start ganache`
ailisp marked this conversation as resolved.
Show resolved Hide resolved
- If you want to modify solidity contracts, cd to `node_modules/rainbow-bridge-sol`, doing changes there and run `../build_all.sh` to recompile solidity contracts.
ailisp marked this conversation as resolved.
Show resolved Hide resolved
- If you want to modify rust contracts, cd to `node_modules/ranbow-bridge-rs`, doing changes there and run `./build_all.sh` to recompile rust contracts.
ailisp marked this conversation as resolved.
Show resolved Hide resolved
- If you want to modify rainbow bridge lib,, cd to `node_modules/rainbow-bridge-lib`, doing changes there and CLI will depends on the updated `rainbow-bridge-lib`
ailisp marked this conversation as resolved.
Show resolved Hide resolved
- Follow instructions above to init eth contracts and near contracts, start services and start testing with bridge
- After you're done with solidity contract updates, doing the same update and create a pull request in https://github.com/near/rainbow-bridge-sol. After you're done with rust contract updates, create PR in https://github.com/near/rainbow-bridge-rs. After you're done with rainbow bridge lib updates, create PR in https://github.com/near/rainbow-bridge-lib.
ailisp marked this conversation as resolved.
Show resolved Hide resolved
- After PR merged in contract repos and rainbow-bridge-lib repo, we will periodically publish them as new version of npm packages. And rainbow-bridge-cli will adopt new version of them.

# Docker:

## Currently we have the following docker options:
Expand Down
11 changes: 10 additions & 1 deletion ci/patch_contract_version.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,25 @@ async function main() {
'rainbow-bridge-rs'
] = `near/rainbow-bridge-rs#${process.env.PATCH_RAINBOW_BRIDGE_RS}`
}
if (process.env.PATCH_RAINBOW_BRIDGE_LIB) {
packageJson.dependencies[
'rainbow-bridge-lib'
] = `near/rainbow-bridge-lib#${process.env.PATCH_RAINBOW_BRIDGE_LIB}`
}
console.log('Contract versions:')
console.log(
`rainbow-bridge-sol: ${packageJson.dependencies['rainbow-bridge-sol']}`
)
console.log(
`rainbow-bridge-rs: ${packageJson.dependencies['rainbow-bridge-rs']}`
)
console.log(
`rainbow-bridge-lib: ${packageJson.dependencies['rainbow-bridge-lib']}`
)
if (
!process.env.PATCH_RAINBOW_BRIDGE_SOL &&
!process.env.PATCH_RAINBOW_BRIDGE_RS
!process.env.PATCH_RAINBOW_BRIDGE_RS &&
!process.env.PATCH_RAINBOW_BRIDGE_LIB
) {
process.exit()
}
Expand Down
13 changes: 0 additions & 13 deletions ci/test_verify_eth_headers.sh

This file was deleted.

14 changes: 0 additions & 14 deletions ci/test_verify_eth_proofs.sh

This file was deleted.

17 changes: 0 additions & 17 deletions ci/test_verify_near_headers.sh

This file was deleted.

17 changes: 0 additions & 17 deletions ci/test_verify_near_proofs.sh

This file was deleted.

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const {
InitEthProver,
} = require('rainbow-bridge-lib/init')

// source dir of environment dir or where rainbow is installed (when install with npm)
// source dir or where rainbow cli is installed (when install with npm)
const BRIDGE_SRC_DIR = __dirname
const LIBS_SOL_SRC_DIR = path.join(
BRIDGE_SRC_DIR,
Expand Down
2 changes: 1 addition & 1 deletion scripts/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ cd $BRIDGE_SRC
git submodule update --init --recursive

yarn
echo "Installed environment dependencies"
echo "Installed CLI dependencies"

cd $BRIDGE_SRC/vendor/ganache
yarn
Expand Down