Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Commit

Permalink
Add community Replicators and Verifiers with instructions (#175)
Browse files Browse the repository at this point in the history
* Add community Replicators and Verifiers with instructions

* clean utils.ts
  • Loading branch information
CAPtheorem committed Jul 9, 2021
1 parent bb69180 commit 8fd511e
Show file tree
Hide file tree
Showing 7 changed files with 199 additions and 34 deletions.
51 changes: 51 additions & 0 deletions omgx_documention/Community_Replica.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
- [Community Replica Service](#community-replica-service)
* [Prerequisites](#prerequisites)
* [Start Replica service](#start-replica-service)
+ [Configuration](#configuration)
+ [Start the docker](#start-the-docker)
+ [Common Errors](#common-errors)

# Community Replica Service

The `ops/docker-compose-replica-service.yml` docker-compose project runs a local replica of the OMGC Rinkeby l2geth. This service allows you run a local copy of the L2, which is useful for generating analyics for blockexplorers.

## Prerequisites

\- docker
\- docker-compose

## Start Replica service

### Configuration

Replace `INFURA_KEY` with your own key in [docker-compose-replica-service.yml](.ops/docker-compose-replica-service.yml). You can get a free Infura key from https://infura.io.

### Start the docker

Start the replica service via:

```bash
cd ops
docker-compose -f docker-compose-replica-service.yml up
```

This will pull two images from docker hub:

* [`data-tranport-layer`](https://hub.docker.com/layers/156092207/omgx/data-transport-layer/production-v1/images/sha256-07d4415aab46863b8c7996c1c40f6221f3ac3f697485ccc262a3a6f0478aa4fb?context=explore): service that indexes transaction data from the L1 chain and L2 chain

* [`replica`](https://hub.docker.com/layers/157390249/omgx/replica/production-v1/images/sha256-fc85c0db75352a911f49ba44372e087e54bd7123963f83a11084939f75581b37?context=explore): L2 geth node running in sync mode

### Common Errors

If you get this:

```bash
(node:1) UnhandledPromiseRejectionWarning: Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.1.0)
```

then you forgot to replace `INFURA_KEY` in this line: `DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT: https://rinkeby.infura.io/v3/INFURA_KEY` with your Infura key. Your Infura key will be a string like `c655138ed943455123456789123456789c`, so the final line will look something like this:

```bash
DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT: https://rinkeby.infura.io/v3/c655138ed943455123456789123456789c
```

50 changes: 50 additions & 0 deletions omgx_documention/Community_Verifier.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
- [Community Verifier Service](#community-verifier-service)
* [Prerequisites](#prerequisites)
* [Start Verifier service](#start-verifier-service)
+ [Configuration - Infura key](#configuration---infura-key)
+ [Start the docker](#start-the-docker)
+ [Common Errors](#common-errors)

# Community Verifier Service

The `ops/docker-compose-verifier-service.yml` docker-compose project runs a local Verifier of the OMGX Rinkeby l2geth. The verifier looks at transactions and computes state roots. These community-generated state roots can then be compared against the state roots submitted to the L2 by the unitary sequencer, as the starting point for detecting (and recovering from) sequencer fraud.

## Prerequisites

\- docker
\- docker-compose

## Start Verifier service

### Configuration - Infura key

Replace `INFURA_KEY` with your own key in [docker-compose-verifier-service.yml](.ops/docker-compose-verifier-service.yml). You can get a free Infura key from https://infura.io.

### Start the docker

Start the Verifier service via:

```bash
cd ops
docker-compose -f docker-compose-verifier-service.yml up
```

This will pull two images from docker hub:

* [`data-tranport-layer`](https://hub.docker.com/layers/156092207/omgx/data-transport-layer/production-v1/images/sha256-07d4415aab46863b8c7996c1c40f6221f3ac3f697485ccc262a3a6f0478aa4fb?context=explore): service that indexes transaction data from the L1 chain and L2 chain

* [`replica`](https://hub.docker.com/layers/157390249/omgx/replica/production-v1/images/sha256-fc85c0db75352a911f49ba44372e087e54bd7123963f83a11084939f75581b37?context=explore): L2 geth node

### Common Errors

If you get this:

```bash
(node:1) UnhandledPromiseRejectionWarning: Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.1.0)
```

then you forgot to replace `INFURA_KEY` in this line: `DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT: https://rinkeby.infura.io/v3/INFURA_KEY` with your Infura key. Your Infura key will be a string like `c655138ed943455123456789123456789c`, so the final line will look something like this:

```bash
DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT: https://rinkeby.infura.io/v3/c655138ed943455123456789123456789c
```
29 changes: 0 additions & 29 deletions omgx_documention/Running_your_own_replica.md

This file was deleted.

2 changes: 1 addition & 1 deletion ops/docker-compose-replica-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
replicas: 1
entrypoint: sh ./geth.sh
env_file:
- ./envs/geth.env
- ./envs/geth_rv.env
environment:
ETH1_HTTP: //rinkeby.infura.io/v3/INFURA_KEY
ROLLUP_STATE_DUMP_PATH: https://rinkeby.omgx.network:8081/state-dump.latest.json
Expand Down
57 changes: 57 additions & 0 deletions ops/docker-compose-verifier-service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#############################
# OMGX Verifier service
# This service is used to verify the l2geth
#
# RUN:
# cd /ops
# docker-compose -f docker-compose-omgx-verifier.yml up
#############################

version: "3"

services:
dtl-replica:
image: omgx/data-transport-layer:production-v1
deploy:
replicas: 1
entrypoint: ./dtl.sh
env_file:
- ./envs/dtl.env
# set the rest of the env vars for the network whcih do not
# depend on the docker-compose setup
environment:
# used for setting the address manager address
URL: https://rinkeby.omgx.network:8081/addresses.json
DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT: https://rinkeby.infura.io/v3/INFURA_KEY
DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT: https://rinkeby.omgx.network
DATA_TRANSPORT_LAYER__L2_CHAIN_ID: 28
DATA_TRANSPORT_LAYER__SERVER_PORT: 7878
ports:
- ${DTL_PORT:-7878}:7878

l2geth-verifier:
image: omgx/replica:production-v1
deploy:
replicas: 1
entrypoint: sh ./geth.sh
env_file:
- ./envs/geth_rv.env
environment:
ETH1_HTTP: //rinkeby.infura.io/v3/INFURA_KEY
ROLLUP_STATE_DUMP_PATH: https://rinkeby.omgx.network:8081/state-dump.latest.json
URL: https://rinkeby.omgx.network:8081/addresses.json
# connecting to the DTL
ROLLUP_CLIENT_HTTP: http://dtl-replica:7878
ETH1_CTC_DEPLOYMENT_HEIGHT: 8845198
RETRIES: 60
ROLLUP_BACKEND: 'l1'
ROLLUP_VERIFIER_ENABLE: 'true'
RPC_PORT: 8545
ports:
- ${REPLICA_HTTP_PORT:-8545}:8545
- ${REPLICA_WS_PORT:-8546}:8546
volumes:
- l2geth:/root/.ethereum

volumes:
l2geth:
38 changes: 38 additions & 0 deletions ops/envs/geth_rv.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
ETH1_HTTP=
ETH1_CTC_DEPLOYMENT_HEIGHT=
ETH1_SYNC_SERVICE_ENABLE=true
ETH1_CONFIRMATION_DEPTH=0

ROLLUP_CLIENT_HTTP=
ROLLUP_STATE_DUMP_PATH=
ROLLUP_POLL_INTERVAL_FLAG=500ms
ROLLUP_ENABLE_L2_GAS_POLLING=
ROLLUP_GAS_PRICE_ORACLE_OWNER_ADDRESS=
ROLLUP_ENFORCE_FEES=

ETHERBASE=0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf

RPC_ENABLE=true
RPC_ADDR=0.0.0.0
RPC_PORT=8545
RPC_API=eth,net,rollup,web3,debug
RPC_CORS_DOMAIN=*
RPC_VHOSTS=*

WS=true
WS_ADDR=0.0.0.0
WS_PORT=8546
WS_API=eth,net,rollup,web3
WS_ORIGINS=*

CHAIN_ID=28
DATADIR=/root/.ethereum
DEV=true
GASPRICE=0
GCMODE=archive
IPC_DISABLE=true
NETWORK_ID=28
NO_USB=true
NO_DISCOVER=true
TARGET_GAS_LIMIT=11000000
USING_OVM=true
6 changes: 2 additions & 4 deletions packages/omgx/contracts/test/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ require('dotenv').config()

export const GWEI = BigNumber.from(0)

http://localhost:9545

if(!process.env.L1_NODE_WEB3_URL) {
console.log(`!!You did not set process.env.L1_NODE_WEB3_URL!!`)
console.log(`Setting to default value of http://localhost:9545`)
Expand Down Expand Up @@ -78,12 +76,12 @@ export let addressManagerAddress = process.env.ADDRESS_MANAGER_ADDRESS
export const getAddressManager = async (provider: any) => {
//console.log(addressManagerAddress)
if (addressManagerAddress){
console.log(`ETH1_ADDRESS_RESOLVER_ADDRESS var was set`)
console.log(`ADDRESS_MANAGER_ADDRESS var was set`)
return getContractFactory('Lib_AddressManager')
.connect(provider)
.attach(addressManagerAddress) as any
} else {
console.log(`ETH1_ADDRESS_RESOLVER_ADDRESS var was left unset. Using {$DEPLOYER} response`)
console.log(`ADDRESS_MANAGER_ADDRESS var was left unset. Using {$DEPLOYER} response`)
addressManagerAddress = (await getDeployerAddresses()).AddressManager
console.log('addressManagerAddress:',addressManagerAddress)
return getContractFactory('Lib_AddressManager')
Expand Down

0 comments on commit 8fd511e

Please sign in to comment.