Skip to content

Commit

Permalink
Merge branch 'release/v1.1.6-fh' into release/v1.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
cgdusek authored Jun 3, 2024
2 parents 05d925c + af92d6f commit bfb3b7a
Show file tree
Hide file tree
Showing 15 changed files with 4,319 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/Cargo.lock
/appnamed
/onexd
/.idea/
56 changes: 42 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@

![GH2AFkdW4AAcOe4](https://github.com/onomyprotocol/onex/assets/76499838/83d43179-3781-4e7a-95af-f3b054bc8e74)

The `onex-mainnet-1` chain will be launched as a consumer chain secured by the Onomy Network.
## Details

- Network information: https://github.com/onomyprotocol/validator/tree/main/testnet
The `onex-mainnet-1` chain will be launched as a consumer chain to the Onomy mainnet parent chain `onomy-mainnet-1`.

- Network information: https://github.com/onomyprotocol/onex/tree/main/chain/onex-mainnet-1
- Chain ID: `onex-mainnet-1`
* Spawn time: `March 4th, 2024` (Will be updated soon)
* Genesis file (without CCV): https://raw.githubusercontent.com/onomyprotocol/validator/main/testnet/onex-mainnet-1/genesis-without-ccv.json
* Spawn time: `April 29th, 2024 17:00 UTC`
* Genesis file (without CCV): https://raw.githubusercontent.com/onomyprotocol/onex/main/chain/onex-mainnet-1/genesis-without-ccv.json
* Genesis with CCV: Available soon
- Current version: `v1.0.3-onex`
- Current version: `v1.1.0`
* Binary:
* Version: [v1.0.3-onex](https://github.com/onomyprotocol/onex/releases/tag/v1.0.3-onex)
* Version: [v1.1.0](https://github.com/onomyprotocol/onex/releases/tag/v1.1.0)
* SHA256: `e719ac86618953dee759e111c414cded126d54b8b8ae4f9f8b21015b06c1d91c`
* Onex GitHub repository: https://github.com/onomyprotocol/onex
- Peers: ``
Expand Down Expand Up @@ -48,26 +50,25 @@ Here is the detail of the Onomy provider chain:
[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:52756,[email protected]:26656
```


### 4. Setup Onex consumer chain
### 2. Setup Onex consumer chain
The validators also need to set up the `onex-mainnet-1` consumer chain. Here are the commands to install the binary and set up the new chain.
```bash
# detail of setup will appear here
cd $HOME/go/bin
wget -O onexd https://github.com/onomyprotocol/onex/releases/download/v1.0.3-onex/onexd && chmod +x onexd
onexd version # v1.0.3-onex
wget -O onexd https://github.com/onomyprotocol/onex/releases/download/v1.1.0/onexd && chmod +x onexd
onexd version # v1.1.0
onexd init <moniker> --chain-id onex-mainnet-1
cd $HOME/.onex/
wget -O config/genesis.json https://raw.githubusercontent.com/onomyprotocol/validator/main/testnet/onex-mainnet-1/genesis-without-ccv.json
wget -O config/genesis.json https://raw.githubusercontent.com/onomyprotocol/onex/main/chain/onex-mainnet-1/genesis-without-ccv.json
```

The validators **MUST NOT** run the node but wait until the new genesis is published on the Onomy repository, which will be detailed in step **[5. Vote the consumer-addition proposal](#5-vote-the-consumer-addition-proposal)**.
The validators **MUST NOT** run the node but wait until the new genesis is published on the Onomy repository, which will be detailed in step **[3. Vote on the consumer-addition proposal](#5-vote-on-the-consumer-addition-proposal)**.

### 5. Vote on the consumer-addition proposal
### 3. Vote on the consumer-addition proposal
The proposal to launch `onex-mainnet-1` as a consumer chain will be submitted on the Onomy provider mainnet and the validators should participate in voting for the proposal. After the proposal is passed, the validators should wait until the `spawn_time` and replace the old genesis file with the new `genesis-with-ccv.json` file from the Onomy repository.

```bash
wget -O /$HOME/.onex/config/genesis.json https://raw.githubusercontent.com/onomyprotocol/validator/main/testnet/onex-mainnet-1/genesis.json
wget -O /$HOME/.onex/config/genesis.json https://raw.githubusercontent.com/onomyprotocol/onex/main/chain/onex-mainnet-1/genesis.json
```

### 6. Wait for genesis and run
Expand All @@ -77,6 +78,32 @@ At the genesis time, validators can start the consumer chain by running
onexd start
```

> Note: if validators choose to run onex and onomy in the same machine, it is highly recommended to setup separate ports to prevent clashing. These ports are: P2P, RPC, REST, gRPC, gRPC-web
The validators can also use service to run and monitor the node. Here is the example of `/etc/systemd/system/onex.service`:
```
[Unit]
Description=Onex node
After=network.target
[Service]
ExecStart=/$HOME/go/bin/onexd start --p2p.persistent_peers="[email protected]:26756,[email protected]:36656"
Restart=always
RestartSec=3
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
```

After that, run these commands to enable and start the chain:
```bash
systemctl daemon-reload
systemctl enable onex.service
systemctl restart onex.service
```
and run `journalctl -fu onex -n150` to check the log.


## Launch Stages
|Step|When?|What do you need to do?|What is happening?|
Expand All @@ -87,3 +114,4 @@ onexd start
|4 |`spawn_time` reached |The `genesis-with-ccv.json` file will be provided in the testnets repo. Replace the old `genesis.json` in the `$HOME/.onex/config` directory with the new `genesis-with-ccv.json`. The new `genesis-with-ccv.json` file with ccv data will be published in [onomyprotocol/valiadtor](https://github.com/onomyprotocol/validator/tree/main/testnet/onex-mainnet-1) |
|5 |Genesis reached | Start your node with the consumer binary | onex-mainnet-1 chain will start and become a consumer chain. |
|6 |3 blocks after upgrade height |Celebrate! :tada: 🥂 |<chain> blocks are now produced by the provider validator set|

9 changes: 9 additions & 0 deletions chain/onex-testnet-5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ The `onex-testnet-5` chain will be launched as a consumer chain in Onomy testnet
- gRPC: `https://grpc-onex.decentrio.ventures`
- Block Explorer: ``

## Upgrade history

Binary versions:
* v1.0.0-dev
* v1.0.1-dev
* v1.0.2-test
* v1.0.2-dev
...

## IBC detail
| | onex-testnet-5 | onomy-testnet-1 |
|-------------|---------------------|-----------------|
Expand Down
65 changes: 65 additions & 0 deletions deploy/the-graph/app-example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/build/
/generated/
subgraph.yaml

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
61 changes: 61 additions & 0 deletions deploy/the-graph/app-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Connect to the indexer via ssh tunnel

```bash
export SSH_USER="your-ssh-user"
export SSH_HOST="your-ssh-host"
ssh $SSH_USER@$SSH_HOST -f -N -L 0.0.0.0:8020:0.0.0.0:8020 -L 0.0.0.0:5001:0.0.0.0:5001 -L 0.0.0.0:8000:0.0.0.0:8000
```

To stop the tunnel later use

```bash
pkill ssh
```

# Build and deploy for onex-testnet-5

```bash
yarn install
yarn run prepare:onex-testnet-5
yarn run codegen
yarn run create-local
yarn run deploy-local
```

# Open GraphQL UI

http://0.0.0.0:8000/subgraphs/name/bank-txs/graphql

# Playground example

Example:

Request:

```graphql
{
bankTxes(first: 10, orderBy: height, orderDirection: desc) {
id
height
}
}
```

Result

````json
{
"data": {
"bankTxes": [
{
"id": "0x2a9e5509c49afbf1325e7d0b543dad7c98d25a526a523e9b09402866ef76b834",
"height": "12833"
},
{
"id": "0x90f8dafe91714efc7fa6b0b7ffa66e4a10ebdd8e6d09eb5eec89e7958f02346a",
"height": "18047"
}
]
}
}
````
4 changes: 4 additions & 0 deletions deploy/the-graph/app-example/config/onex-testnet-5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "onex-testnet-5",
"network": "onex-testnet-5"
}
24 changes: 24 additions & 0 deletions deploy/the-graph/app-example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "bank-txs",
"version": "0.1.0",
"license": "MIT",
"scripts": {
"prepare:onex-testnet-5": "mustache config/onex-testnet-5.json subgraph.template.yaml > subgraph.yaml",
"codegen": "graph codegen",
"build": "graph build",
"create-local": "graph create bank-txs --node http://0.0.0.0:8020",
"deploy-local": "graph deploy bank-txs -l v0.1.0 --ipfs http://0.0.0.0:5001 --node http://0.0.0.0:8020",
"remove-local": "graph remove bank-txs --node http://0.0.0.0:8020",
},
"devDependencies": {
"@graphprotocol/graph-cli": "^0.30.0",
"@graphprotocol/graph-ts": "^0.27.0",
"as-proto-gen": "^1.3.0",
"mustache": "^4.2.0"
},
"dependencies": {
"as-proto": "^1.3.0",
"babel-polyfill": "^6.26.0",
"babel-register": "^6.26.0"
}
}
4 changes: 4 additions & 0 deletions deploy/the-graph/app-example/schema.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
type BankTx @entity {
id: ID!
height: BigInt
}
15 changes: 15 additions & 0 deletions deploy/the-graph/app-example/src/mapping.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {BigInt, cosmos} from "@graphprotocol/graph-ts";
import {BankTx} from "../generated/schema";

export function handleTx(data: cosmos.TransactionData): void {
const messages = data.tx.tx.body.messages;
for (let i = 0; i < messages.length; i++) {
if (messages[i].typeUrl == "/cosmos.bank.v1beta1.MsgSend") {
const hash = data.tx.hash.toHexString();
const msg = new BankTx(hash);
msg.height = BigInt.fromU64(data.block.header.height);
msg.save();
break
}
}
}
18 changes: 18 additions & 0 deletions deploy/the-graph/app-example/subgraph.template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
specVersion: 0.0.5
description: Cosmos Bank Send
schema:
file: ./schema.graphql
dataSources:
- kind: cosmos
name: {{ name }}
network: {{ network }}
source:
startBlock: 1
mapping:
apiVersion: 0.0.7
language: wasm/assemblyscript
entities:
- BankSendTx
transactionHandlers:
- handler: handleTx
file: ./src/mapping.ts
4 changes: 4 additions & 0 deletions deploy/the-graph/app-example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "@graphprotocol/graph-ts/types/tsconfig.base.json",
"include": ["src"]
}
Loading

0 comments on commit bfb3b7a

Please sign in to comment.