Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Unique-Divine committed Jun 27, 2024
2 parents ae624cb + 422c676 commit df69ebe
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 143 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bump `golang.org/x/net` from 0.20.0 to 0.23.0 ([#1850](https://github.com/NibiruChain/nibiru/pull/1850))
- Bump `github.com/supranational/blst` from 0.3.8-0.20220526154634-513d2456b344 to 0.3.11 ([#1851](https://github.com/NibiruChain/nibiru/pull/1851))
- Bump `golangci/golangci-lint-action` from 4 to 6 ([#1854](https://github.com/NibiruChain/nibiru/pull/1854), [#1867](https://github.com/NibiruChain/nibiru/pull/1867))
- Bump `github.com/hashicorp/go-getter` from 1.7.1 to 1.7.4 ([#1858](https://github.com/NibiruChain/nibiru/pull/1858))
- Bump `github.com/hashicorp/go-getter` from 1.7.1 to 1.7.5 ([#1858](https://github.com/NibiruChain/nibiru/pull/1858), [#1938](https://github.com/NibiruChain/nibiru/pull/1938))
- Bump `github.com/btcsuite/btcd` from 0.23.3 to 0.24.0 ([#1862](https://github.com/NibiruChain/nibiru/pull/1862))
- Bump `pozetroninc/github-action-get-latest-release` from 0.7.0 to 0.8.0 ([#1863](https://github.com/NibiruChain/nibiru/pull/1863))
- Bump `bufbuild/buf-setup-action` from 1.30.1 to 1.33.0 ([#1891](https://github.com/NibiruChain/nibiru/pull/1891), [#1900](https://github.com/NibiruChain/nibiru/pull/1900), [#1923](https://github.com/NibiruChain/nibiru/pull/1923))
Expand Down
21 changes: 12 additions & 9 deletions CHAOSNET.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,18 @@

Chaosnet is an expanded version of localnet that runs:

- two validators (nibiru-0 and nibiru-1)
- up to two validators (nibiru-0 and nibiru-1)
- pricefeeders for each validator
- a hermes relayer between the two validators
- a faucet
- a postgres:14 database
- a heartmonitor instance
- a liquidator instance
- a graphql server
- a hermes relayer between the two validators (if the `ibc` profile is used)
- a postgres:14 database (if the `heartmonitor` profile is used)
- a heartmonitor instance (if the `heartmonitor` profile is used)
- a graphql server (if the `heartmonitor` profile is used)

## How to run "chaosnet"

1. Make sure you have [Docker](https://docs.docker.com/engine/install/) installed and running
2. Make sure you have `make` installed
3. Docker login to ghcr.io
3. (Optional) Docker login to ghcr.io (only if you want to use the `heartmonitor` profile)

```bash
docker login ghcr.io
Expand All @@ -42,9 +40,14 @@ Enter your GitHub username for the `username` field, and your personal access to

Note that this will take a while the first time you run it, as it will need to pull all the images from the registry, build the chaonset image locally, and set up the IBC channel (which has a lot of round trip packet commits).

Other profiles include

- `make chaosnet-ibc`: creates two validator instances and a hermes relayer
- `make chaosnet-heartmonitor`: single validator with heartmonitor+graphql instance

## How to force pull images from the registry

By default, most images (heart-monitor, liquidator, etc.) are cached locally and won't re-fetch from upstream registries. To force a pull, you can run
By default, most images (heartmonitor, etc.) are cached locally and won't re-fetch from upstream registries. To force a pull, you can run

```sh
make chaosnet-build
Expand Down
67 changes: 42 additions & 25 deletions contrib/docker-compose/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# contrib/docker-compose

- [docker-compose-chaosnet](#docker-compose-chaosnet)
- [Usage Commands:](#usage-commands)
- [Nibiru node services](#nibiru-node-services)
- [Oracle feeder services](#oracle-feeder-services)
- [Hermes IBC relayer services](#hermes-ibc-relayer-services)
- [Faucet Service](#faucet-service)
- [Heart Monitor Services](#heart-monitor-services)
- [Reference Materials](#reference-materials)
- [contrib/docker-compose](#contribdocker-compose)
- [docker-compose-chaosnet](#docker-compose-chaosnet)
- [Usage](#usage)
- [Single validator node + pricefeeder](#single-validator-node--pricefeeder)
- [Two validator nodes + pricefeeder + IBC relayer](#two-validator-nodes--pricefeeder--ibc-relayer)
- [Single validator node + heartmonitor](#single-validator-node--heartmonitor)
- [Other Commands](#other-commands)
- [Services Overview](#services-overview)
- [Nibiru node services](#nibiru-node-services)
- [Pricefeeder services](#pricefeeder-services)
- [Hermes IBC relayer services](#hermes-ibc-relayer-services)
- [Heart Monitor Services](#heart-monitor-services)
- [Reference Materials](#reference-materials)

## docker-compose-chaosnet

Expand All @@ -18,32 +23,54 @@ Nibiru-specific containers.

Features:

- Data volume mounts ensure persistent storage.
- Different ports are utilized to mimic a multi-chain configuration on a single machine.
- Enables testing of cross-chain transactions, chain health monitoring, liquidations, and more in a local Docker context across two chains.
- Enables testing of cross-chain transactions, chain health monitoring, and more in a local Docker context across two chains.

### Usage Commands:
## Usage

### Single validator node + pricefeeder

```sh
docker compose -f docker-compose-chaosnet.yml up
```

### Two validator nodes + pricefeeder + IBC relayer

```sh
docker compose -f docker-compose-chaosnet.yml --profile ibc up
```

### Single validator node + heartmonitor

```sh
docker compose -f docker-compose-chaosnet.yml --profile heartmonitor up
```

### Other Commands

- `docker compose up`: Start the services.
- `docker compose down`: Stop the services.
- `docker compose restart`: Restart all services.
- `docker compose ps`: List containers, their status, ports, etc.
- `docker compose logs`: View std output from containers
- `docker compose logs`: View std output from containers

## Services Overview

### Nibiru node services

- `nibiru-0` and `nibiru-1` (Service): Represents two distinct Nibiru Chain nodes (nibiru-0 and nibiru-1)
running on different ports, using unique mnemonics and chain IDs, imitating two
independent blockchain networks.

### Oracle feeder services
### Pricefeeder services

- `pricefeeder-0` and `pricefeeder-1` (Service): Two price feeder services that push price
data to the respective Nibiru nodes.

### Hermes IBC relayer services

An IBC relayer is set up to connect the two chains using [hermes](https://hermes.informal.systems/).

1. `hermes-keys-task-0` and `hermes-keys-task-1` (Service): Tasks to generate
keys for the validators on `nibiru-0` and `nibiru-1`.
2. `hermes-client-connection-channel-task` (Service): Creates a new channel
Expand All @@ -59,34 +86,24 @@ Brief IBC reference:
Put simply, **connections** represent a secure communication line between two
blockchain to transfer IBC **packets** (data). Once a connection is established,
light client of two chains, usually called the source chain and destination
chain, is established.
chain, is established.

Once a connection is established, **channels** can be formed. A channel
represents a logical pathway for specific types communication over the connection
(like token transfers and other relaying of IBC packets.

### Faucet Service

Dispenses testnet tokens. Faucets provide liquidity on test chains.

Repository: [NibiruChain/go-faucet](https://github.com/NibiruChain/go-faucet)

### Heart Monitor Services

- `heartmonitor-db`: A postgres database for the heart monitor.

- `heartmonitor`: An indexing solution that populates a DB based on events and
block responses emitted from Nibiru nodes.

- `liquidator` : Liquidates underwater positions using the tracked state inside
`hearmonitor-db`.
block responses emitted from Nibiru nodes.

- `graphql`: GraphQL API for the heart monitor data. Used in the Nibiru web app
and other off-chain tools.

Repository: [NibiruChain/go-heartmonitor](https://github.com/NibiruChain/go-heartmonitor).


## Reference Materials

- [Docker Compose file](https://docs.docker.com/compose/compose-file/03-compose-file/)
Expand Down
43 changes: 11 additions & 32 deletions contrib/docker-compose/docker-compose-chaosnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ services:
RPC_PORT: 36657
GRPC_PORT: 19090
LCD_PORT: 11317
profiles: [ibc]
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:36657"]
interval: 60s
Expand All @@ -63,6 +64,7 @@ services:

pricefeeder-1:
image: ghcr.io/nibiruchain/pricefeeder:latest
profiles: [ibc]
restart: always
environment:
CHAIN_ID: nibiru-localnet-1
Expand All @@ -77,6 +79,7 @@ services:

hermes-keys-task-0:
image: informalsystems/hermes:1.6.0
profiles: [ibc]
user: root
command:
[
Expand Down Expand Up @@ -107,6 +110,7 @@ services:

hermes-keys-task-1:
image: informalsystems/hermes:1.6.0
profiles: [ibc]
user: root
command:
[
Expand Down Expand Up @@ -139,6 +143,7 @@ services:

hermes-client-connection-channel-task:
image: informalsystems/hermes:1.6.0
profiles: [ibc]
user: root
command:
[
Expand Down Expand Up @@ -172,6 +177,7 @@ services:

hermes:
image: informalsystems/hermes:1.6.0
profiles: [ibc]
restart: always
user: root
command: ["start"]
Expand All @@ -191,22 +197,9 @@ services:
hermes-client-connection-channel-task:
condition: service_completed_successfully

faucet:
restart: always
image: ghcr.io/nibiruchain/go-faucet:latest
environment:
NODE: nibiru-0:9090
MNEMONIC: undo donkey arena rule old portion long forget rescue post stuff normal reduce raw unable warrior method stairs valley enhance glory lens sign zero
SEND_COINS: 11000000unibi
MAX_SEND_COINS: 110000000unibi
depends_on:
nibiru-0:
condition: service_healthy
ports:
- 8000:8000

heartmonitor-db:
image: postgres:14
profiles: [heartmonitor]
restart: always
environment:
POSTGRES_PASSWORD: postgres
Expand All @@ -216,6 +209,8 @@ services:

heartmonitor:
image: ghcr.io/nibiruchain/go-heartmonitor:latest
platform: linux/amd64
profiles: [heartmonitor]
restart: always
command: --clean
volumes:
Expand All @@ -231,26 +226,10 @@ services:
heartmonitor-db:
condition: service_started

liquidator:
image: ghcr.io/nibiruchain/go-heartmonitor:latest
restart: always
command: --liquidator
environment:
- DATABASE_URI=postgresql://postgres:postgres@heartmonitor-db:5432/heart-monitor?sslmode=disable
- TENDERMINT_RPC_ENDPOINT=http://nibiru-0:26657
- GRPC_ENDPOINT=tcp://nibiru-0:9090
- GRPC_INSECURE=true
- NO_PARTITIONS=true
- LIQUIDATOR_MNEMONIC=record damage person caution truly riot resource luxury rude guide mushroom athlete fantasy dentist friend mule depth salmon photo unfold exclude coyote idea evoke
- LIQUIDATOR_GAS_LIMIT_INITIAL=500000
- LIQUIDATOR_GAS_MULTIPLIER=5
- LIQUIDATOR_GAS_MAX_ATTEMPTS=10
depends_on:
heartmonitor:
condition: service_started

graphql:
image: ghcr.io/nibiruchain/go-heartmonitor:latest
platform: linux/amd64
profiles: [heartmonitor]
restart: always
command: --graphql
environment:
Expand Down
64 changes: 0 additions & 64 deletions contrib/docker-compose/docker-compose-multi-node.yml

This file was deleted.

Loading

0 comments on commit df69ebe

Please sign in to comment.