Skip to content

Commit

Permalink
Nomarket runner (#12)
Browse files Browse the repository at this point in the history
* use no-market for the orchestrator runner
* new scripts to deploy contract and run the runner from eth remove node
  • Loading branch information
dzmitryhil authored Sep 27, 2021
1 parent eeccb77 commit 36ab867
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 10 deletions.
12 changes: 10 additions & 2 deletions deploy/single-node-runner-rinkeby/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,18 @@ ENV PATH=$PATH:$GOPATH/bin
WORKDIR $ONOMY_DIR
RUN make install


# ------------------ contract-deployer ------------------

ADD https://github.com/onomyprotocol/cosmos-gravity-bridge/releases/download/v0.0.0-20210915184851-orch-nomarket/Gravity.json /root/home/solidity/Gravity.json
ADD https://github.com/onomyprotocol/cosmos-gravity-bridge/releases/download/v0.0.0-20210915184851-orch-nomarket/TestERC20A.json /root/home/solidity/TestERC20A.json
ADD https://github.com/onomyprotocol/cosmos-gravity-bridge/releases/download/v0.0.0-20210915184851-orch-nomarket/contract-deployer /usr/bin/contract-deployer
RUN chmod +x /usr/bin/contract-deployer

# ------------------ orchestrator ------------------

ADD https://github.com/onomyprotocol/cosmos-gravity-bridge/releases/download/v0.0.0-20210915184851/gbt /usr/bin/gbt
RUN chmod 777 /usr/bin/gbt
ADD https://github.com/onomyprotocol/cosmos-gravity-bridge/releases/download/v0.0.0-20210915184851-orch-nomarket/gbt /usr/bin/gbt
RUN chmod +x /usr/bin/gbt

# ------------------ ethereum go (geth) ------------------
RUN add-apt-repository -y ppa:ethereum/ethereum
Expand Down
Binary file modified deploy/single-node-runner-rinkeby/client/linux/gbt
100644 → 100755
Binary file not shown.
14 changes: 7 additions & 7 deletions deploy/single-node-runner-rinkeby/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ and one bridge orchestrator. This is a minimum that makes the bridge works.
### Build locally

```
docker build -t onomy/onomy-single-node-runner-rinkeby:local -f Dockerfile ../../
docker build -t onomy/onomy-single-node-runner-rinkeby:local -f Dockerfile ../../ --no-cache
```

### Steps to rebuild image from scratch
Expand All @@ -46,7 +46,7 @@ This home contains testnet chain settings and genesys file of the chain.
***The contract used for the runner***.

```
Gravity deployed at Address - 0x8778174A44b74CD75daEeCbC9830D675Cc5C892C
Gravity deployed at Address - 0x8A0814b7251138Dea19054425D0dfF0C497305d3
```

## Run
Expand Down Expand Up @@ -139,8 +139,8 @@ The ETC20 coins used in that part are FAU. You can substitute "erc20-address" to
```
gbt -a onomy client eth-to-cosmos \
--ethereum-key="e0b21b1d80e53f38734a3ed395796956b50c637916ddbb6cedb096b848053d2d" \
--ethereum-rpc="http://0.0.0.0:8545" \
--gravity-contract-address=0x8778174A44b74CD75daEeCbC9830D675Cc5C892C \
--ethereum-rpc="http://$ETH_HOST:8545" \
--gravity-contract-address=0x8A0814b7251138Dea19054425D0dfF0C497305d3 \
--token-contract-address=0xFab46E002BbF0b4509813474841E0716E6730136 \
--amount=10 \
--destination=onomy1e6xtwjw9mgmljyrqw6mlw3nrpuz3p79gct73nw
Expand All @@ -153,8 +153,8 @@ The ETC20 coins used in that part are FAU. You can substitute "erc20-address" to
```
gbt -a onomy client cosmos-to-eth --cosmos-phrase="ten stereo fortune girl mean stadium boost maze immune margin rural dragon stage gadget comfort creek cupboard expect satoshi maple machine hunt abstract entry" \
--cosmos-grpc="http://0.0.0.0:9090" \
--fees=1nom \
--amount=1000gravity0xFab46E002BbF0b4509813474841E0716E6730136 \
--fees=1gravity0xFab46E002BbF0b4509813474841E0716E6730136 \
--amount=555555gravity0xFab46E002BbF0b4509813474841E0716E6730136 \
--eth-destination=0x2d9480eBA3A001033a0B8c3Df26039FD3433D55d
- Now check users balances on both sides one more time
Expand Down Expand Up @@ -190,7 +190,7 @@ The ETC20 coins used in that part are FAU. You can substitute "erc20-address" to
./gbt -a onomy client eth-to-cosmos \
--ethereum-key="e0b21b1d80e53f38734a3ed395796956b50c637916ddbb6cedb096b848053d2d" \
--ethereum-rpc="http://$ETH_HOST:8545" \
--gravity-contract-address=0x8778174A44b74CD75daEeCbC9830D675Cc5C892C \
--gravity-contract-address=0x8A0814b7251138Dea19054425D0dfF0C497305d3 \
--token-contract-address=0xFab46E002BbF0b4509813474841E0716E6730136 \
--amount=10 \
--destination=onomy1e6xtwjw9mgmljyrqw6mlw3nrpuz3p79gct73nw
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash
set -eu

echo "running onomy with bridge"

# Initial dir
CURRENT_WORKING_DIR=$(pwd)
# Name of the network to bootstrap
CHAINID="onomy"
# Name of the onomy artifact
ONOMY=onomyd
# The name of the onomy node
ONOMY_NODE_NAME="onomy"
# The prefix for cosmos addresses
ONOMY_ADDRESS_PREFIX="onomy"
# The address to run onomy node
ONOMY_HOST="0.0.0.0"
# The port of the onomy gRPC
ONOMY_GRPC_PORT="9090"
# Home folder for onomy config
ONOMY_HOME="$CURRENT_WORKING_DIR/$CHAINID/$ONOMY_NODE_NAME"
# Home flag for home folder
ONOMY_HOME_FLAG="--home $ONOMY_HOME"
# Onomy mnemonic used for fauset from (validator_key.json file)
ONOMY_VALIDATOR_MNEMONIC=$(jq -r .mnemonic $ONOMY_HOME/validator_key.json)

# The ETH key used for orchestrator signing of the transactions
ETH_ORCHESTRATOR_PRIVATE_KEY=c40f62e75a11789dbaf6ba82233ce8a52c20efb434281ae6977bb0b3a69bf709

# ------------------ Run onomy ------------------

echo "Starting $ONOMY_NODE_NAME"
$ONOMY $ONOMY_HOME_FLAG start --pruning=nothing &

echo "Waiting $ONOMY_NODE_NAME to launch gRPC $ONOMY_GRPC_PORT..."

while ! timeout 1 bash -c "</dev/tcp/$ONOMY_HOST/$ONOMY_GRPC_PORT"; do
sleep 1
done

echo "$ONOMY_NODE_NAME launched"

#-------------------- Deploy the contract --------------------

echo "Deploying Gravity contract"
cd /root/home/solidity

contract-deployer \
--cosmos-node="http://$ONOMY_HOST:26657" \
--eth-node="$ETH_ADDRESS" \
--eth-privkey="$ETH_ORCHESTRATOR_PRIVATE_KEY" \
--contract=Gravity.json \
--test-mode=false | grep "Gravity deployed at Address" | grep -Eow '0x[0-9a-fA-F]{40}' >> $GRAVITY_HOME/eth_contract_address

CONTRACT_ADDRESS=$(cat $GRAVITY_HOME/eth_contract_address)

echo "Contract address: $CONTRACT_ADDRESS"


65 changes: 65 additions & 0 deletions deploy/single-node-runner-rinkeby/scripts/run-with-remote-eth.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash
set -eu

echo "running onomy with bridge"

# Initial dir
CURRENT_WORKING_DIR=$(pwd)
# Name of the network to bootstrap
CHAINID="onomy"
# Name of the onomy artifact
ONOMY=onomyd
# The name of the onomy node
ONOMY_NODE_NAME="onomy"
# The prefix for cosmos addresses
ONOMY_ADDRESS_PREFIX="onomy"
# The address to run onomy node
ONOMY_HOST="0.0.0.0"
# The port of the onomy gRPC
ONOMY_GRPC_PORT="9090"
# Home folder for onomy config
ONOMY_HOME="$CURRENT_WORKING_DIR/$CHAINID/$ONOMY_NODE_NAME"
# Home flag for home folder
ONOMY_HOME_FLAG="--home $ONOMY_HOME"
# Onomy mnemonic used for orchestrator signing of the transactions (orchestrator_key.json file)
ONOMY_ORCHESTRATOR_MNEMONIC=$(jq -r .mnemonic $ONOMY_HOME/orchestrator_key.json)
# Onomy mnemonic used for fauset from (validator_key.json file)
ONOMY_VALIDATOR_MNEMONIC=$(jq -r .mnemonic $ONOMY_HOME/validator_key.json)

# Onomy chain demons
STAKE_DENOM="nom"

# The ETH key used for orchestrator signing of the transactions
ETH_ORCHESTRATOR_PRIVATE_KEY=c40f62e75a11789dbaf6ba82233ce8a52c20efb434281ae6977bb0b3a69bf709

ETH_CONTRACT_ADDRESS=0x8A0814b7251138Dea19054425D0dfF0C497305d3

# ------------------ Run onomy ------------------

echo "Starting $ONOMY_NODE_NAME"
$ONOMY $ONOMY_HOME_FLAG start --pruning=nothing &

echo "Waiting $ONOMY_NODE_NAME to launch gRPC $ONOMY_GRPC_PORT..."

while ! timeout 1 bash -c "</dev/tcp/$ONOMY_HOST/$ONOMY_GRPC_PORT"; do
sleep 1
done

echo "$ONOMY_NODE_NAME launched"

# ------------------ Run fauset ------------------

echo "Starting fauset based on validator account"
faucet -cli-name=$ONOMY -mnemonic="$ONOMY_VALIDATOR_MNEMONIC" &

#-------------------- Run orchestrator --------------------

echo "Starting orchestrator"

gbt --address-prefix="$ONOMY_ADDRESS_PREFIX" orchestrator \
--cosmos-phrase="$ONOMY_ORCHESTRATOR_MNEMONIC" \
--ethereum-key="$ETH_ORCHESTRATOR_PRIVATE_KEY" \
--cosmos-grpc="http://$ONOMY_HOST:$ONOMY_GRPC_PORT/" \
--ethereum-rpc="$ETH_ADDRESS" \
--fees="1$STAKE_DENOM" \
--gravity-contract-address="$ETH_CONTRACT_ADDRESS"
2 changes: 1 addition & 1 deletion deploy/single-node-runner-rinkeby/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ETH_HOST="0.0.0.0"
# Eth node rpc port
ETH_RPC_PORT="8545"

ETH_CONTRACT_ADDRESS=0x8778174A44b74CD75daEeCbC9830D675Cc5C892C
ETH_CONTRACT_ADDRESS=0x8A0814b7251138Dea19054425D0dfF0C497305d3

# ------------------ Run onomy ------------------

Expand Down

0 comments on commit 36ab867

Please sign in to comment.