Skip to content

Commit

Permalink
docs: add docs for using prebuilt rocksdb and local network setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexagon committed May 14, 2024
1 parent ca18b96 commit a00eed2
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 8 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ To format code:
just fmt
```

## Local Network

```bash
# Generate zerostate config stub (with optional --force flag):
just init_zerostate_config
# Generate node config sub (with optional --force flag):
just init_node_config
# Generate a local network of 3 nodes:
just gen_network 3

# Start nodes in separate terminals or spawn them with `&`:
just node 1
just node 2
just node 3
```

## Prebuilt RocksDB

Expand All @@ -53,7 +68,8 @@ cd /path/to
git clone https://github.com/facebook/rocksdb.git
cd rocksdb
git checkout v8.10.0
make -j 10 static_lib
export ROCKSDB_LIB_DIR=/path/to/rocksdb
mkdir -p build && cd ./build
cmake -DWITH_LZ4=ON -DWITH_ZSTD=ON -DWITH_JEMALLOC=ON -DCMAKE_BUILD_TYPE=Release ..
make -j16 rocksdb
export ROCKSDB_LIB_DIR=/path/to/rocksdb/build
```

51 changes: 46 additions & 5 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ integration_test: prepare_integration_tests

gen_network n: build_debug
#!/usr/bin/env bash
set -eE
TEMP_DIR="./.temp"
TYCHO_BIN="./target/debug/tycho"

Expand Down Expand Up @@ -126,17 +128,56 @@ node n: build_debug
--config "$TEMP_DIR/config{{n}}.json" \
--global-config "$TEMP_DIR/global-config.json" \
--import-zerostate "$TEMP_DIR/zerostate.boc" \
--logger-config ./logger.json \
--logger-config ./logger.json

init_node_config: build_debug
init_node_config *flags: build_debug
#!/usr/bin/env bash
set -eE
CONFIG_PATH="./config.json"
LOG_PATH="./logger.json"

TYCHO_BIN="./target/debug/tycho"
$TYCHO_BIN node run --init-config "./config.json"
$TYCHO_BIN node run --init-config "$CONFIG_PATH" {{flags}}

CONFIG=$(jq '.public_ip = "127.0.0.1"' "$CONFIG_PATH")
echo "$CONFIG" > "$CONFIG_PATH"

if ! [ -f "$LOG_PATH" ]; then
cat << EOF > "$LOG_PATH"
{
"tycho": "info",
"tycho_core": "debug",
"tycho_network": "info",
"collation_manager": "debug",
"mempool_adapter": "debug",
"state_node_adapter": "debug",
"mq_adapter": "debug",
"collator": "debug",
"validator": "debug",
"async_queued_dispatcher": "debug"
}
EOF
fi

init_zerostate_config: build_debug
init_zerostate_config *flags: build_debug
#!/usr/bin/env bash
set -eE
KEYS_PATH="./keys.json"
CONFIG_PATH="./zerostate.json"

TYCHO_BIN="./target/debug/tycho"
$TYCHO_BIN tool gen-zerostate --init-config "./zerostate.json"

$TYCHO_BIN tool gen-zerostate --init-config "$CONFIG_PATH" {{flags}}

if ! [ -f "$KEYS_PATH" ]; then
$TYCHO_BIN tool gen-key > "$KEYS_PATH"
fi

PUBLIC_KEY=$(jq '.public' "$KEYS_PATH")
CONFIG=$(jq ".config_public_key = $PUBLIC_KEY | .minter_public_key = $PUBLIC_KEY" "$CONFIG_PATH")
echo "$CONFIG" > "$CONFIG_PATH"

build_debug:
cargo build --bin tycho

0 comments on commit a00eed2

Please sign in to comment.