Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix README.md layout and add linting section #488

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 46 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ Your feedback, contributions, and issue reports will be integral to evolving thi
## Installation
<details>
<summary>Building on Linux</summary>

1. Install general prerequisites

```bash
sudo apt install curl git build-essential libssl-dev pkg-config
sudo apt install curl git build-essential libssl-dev pkg-config
```

2. Install Protobuf (required for gRPC)

```bash
sudo apt install protobuf-compiler libprotobuf-dev #Required for gRPC
```
Expand All @@ -34,16 +34,16 @@ Your feedback, contributions, and issue reports will be integral to evolving thi
llvm python3-clang
```
3. Install the [rust toolchain](https://rustup.rs/)
If you already have rust installed, update it by running: `rustup update`

If you already have rust installed, update it by running: `rustup update`
4. Install wasm-pack
```bash
cargo install wasm-pack
```
4. Install wasm32 target
```bash
rustup target add wasm32-unknown-unknown
```
```
5. Clone the repo
```bash
git clone https://github.com/kaspanet/rusty-kaspa
Expand All @@ -53,52 +53,52 @@ Your feedback, contributions, and issue reports will be integral to evolving thi



<details>
<details>
<summary>Building on Windows</summary>


1. [Install Git for Windows](https://gitforwindows.org/) or an alternative Git distribution.

2. Install [Protocol Buffers](https://github.com/protocolbuffers/protobuf/releases/download/v21.10/protoc-21.10-win64.zip) and add the `bin` directory to your `Path`


3. Install [LLVM-15.0.6-win64.exe](https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/LLVM-15.0.6-win64.exe)

Add the `bin` directory of the LLVM installation (`C:\Program Files\LLVM\bin`) to PATH

set `LIBCLANG_PATH` environment variable to point to the `bin` directory as well

**IMPORTANT:** Due to C++ dependency configuration issues, LLVM `AR` installation on Windows may not function correctly when switching between WASM and native C++ code compilation (native `RocksDB+secp256k1` vs WASM32 builds of `secp256k1`). Unfortunately, manually setting `AR` environment variable also confuses C++ build toolchain (it should not be set for native but should be set for WASM32 targets). Currently, the best way to address this, is as follows: after installing LLVM on Windows, go to the target `bin` installation directory and copy or rename `LLVM_AR.exe` to `AR.exe`.

4. Install the [rust toolchain](https://rustup.rs/)
If you already have rust installed, update it by running: `rustup update`

If you already have rust installed, update it by running: `rustup update`
5. Install wasm-pack
```bash
cargo install wasm-pack
```
6. Install wasm32 target
```bash
rustup target add wasm32-unknown-unknown
```
```
7. Clone the repo
```bash
git clone https://github.com/kaspanet/rusty-kaspa
cd rusty-kaspa
```
</details>
</details>


<details>
<details>
<summary>Building on Mac OS</summary>


1. Install Protobuf (required for gRPC)
```bash
brew install protobuf
```
2. Install llvm.
2. Install llvm.

The default XCode installation of `llvm` does not support WASM build targets.
To build WASM on MacOS you need to install `llvm` from homebrew (at the time of writing, the llvm version for MacOS is 16.0.1).
```bash
Expand Down Expand Up @@ -131,23 +131,23 @@ To build WASM on MacOS you need to install `llvm` from homebrew (at the time of
source ~/.zshrc
```
3. Install the [rust toolchain](https://rustup.rs/)
If you already have rust installed, update it by running: `rustup update`

If you already have rust installed, update it by running: `rustup update`
4. Install wasm-pack
```bash
cargo install wasm-pack
```
4. Install wasm32 target
```bash
rustup target add wasm32-unknown-unknown
```
```
5. Clone the repo
```bash
git clone https://github.com/kaspanet/rusty-kaspa
cd rusty-kaspa
```

</details>
</details>

<details>

Expand Down Expand Up @@ -233,7 +233,7 @@ cargo run --release --bin kaspad -- --testnet
```

**Testnet 11**

For participation in the 10BPS test network (TN11), see the following detailed [guide](docs/testnet11.md).

<details>
Expand All @@ -247,7 +247,7 @@ cargo run --release --bin kaspad -- --configfile /path/to/configfile.toml
# or
cargo run --release --bin kaspad -- -C /path/to/configfile.toml
```
- The config file should be a list of \<CLI argument\> = \<value\> separated by newlines.
- The config file should be a list of \<CLI argument\> = \<value\> separated by newlines.
- Whitespace around the `=` is fine, `arg=value` and `arg = value` are both parsed correctly.
- Values with special characters like `.` or `=` will require quoting the value i.e \<CLI argument\> = "\<value\>".
- Arguments with multiple values should be surrounded with brackets like `addpeer = ["10.0.0.1", "1.2.3.4"]`.
Expand Down Expand Up @@ -295,17 +295,17 @@ wRPC
**Sidenote:**

Rusty Kaspa integrates an optional wRPC
subsystem. wRPC is a high-performance, platform-neutral, Rust-centric, WebSocket-framed RPC
subsystem. wRPC is a high-performance, platform-neutral, Rust-centric, WebSocket-framed RPC
implementation that can use [Borsh](https://borsh.io/) and JSON protocol encoding.

JSON protocol messaging
is similar to JSON-RPC 1.0, but differs from the specification due to server-side
JSON protocol messaging
is similar to JSON-RPC 1.0, but differs from the specification due to server-side
notifications.

[Borsh](https://borsh.io/) encoding is meant for inter-process communication. When using [Borsh](https://borsh.io/)
both client and server should be built from the same codebase.
both client and server should be built from the same codebase.

JSON protocol is based on
JSON protocol is based on
Kaspa data structures and is data-structure-version agnostic. You can connect to the
JSON endpoint using any WebSocket library. Built-in RPC clients for JavaScript and
TypeScript capable of running in web browsers and Node.js are available as a part of
Expand All @@ -314,27 +314,23 @@ wRPC
</details>



<details>


## Benchmarking & Testing


<details>
<details>

<summary>Simulation framework (Simpa)</summary>

Logging in `kaspad` and `simpa` can be [filtered](https://docs.rs/env_logger/0.10.0/env_logger/#filtering-results) by either:

The current codebase supports a full in-process network simulation, building an actual DAG over virtual time with virtual delay and benchmarking validation time (following the simulation generation).
The current codebase supports a full in-process network simulation, building an actual DAG over virtual time with virtual delay and benchmarking validation time (following the simulation generation).

To see the available commands
```bash
```bash
cargo run --release --bin simpa -- --help
```
```

The following command will run a simulation to produce 1000 blocks with communication delay of 2 seconds and 8 BPS (blocks per second) while attempting to fill each block with up to 200 transactions.
The following command will run a simulation to produce 1000 blocks with communication delay of 2 seconds and 8 BPS (blocks per second) while attempting to fill each block with up to 200 transactions.

```bash
cargo run --release --bin simpa -- -t=200 -d=2 -b=8 -n=1000
Expand All @@ -345,7 +341,7 @@ cargo run --release --bin simpa -- -t=200 -d=2 -b=8 -n=1000



<details>
<details>

<summary>Heap Profiling</summary>

Expand All @@ -360,7 +356,7 @@ It will produce `{bin-name}-heap.json` file in the root of the workdir, that can
</details>


<details>
<details>

<summary>Tests</summary>

Expand All @@ -382,12 +378,21 @@ cd rusty-kaspa
cargo nextest run --release
```

</details>

<details>

<summary>Lints</summary>

```bash
cd rusty-kaspa
./check
```

</details>


<details>
<details>

<summary>Benchmarks</summary>

Expand All @@ -398,7 +403,7 @@ cargo bench

</details>

<details>
<details>

<summary>Logging</summary>

Expand All @@ -413,6 +418,3 @@ Logging in `kaspad` and `simpa` can be [filtered](https://docs.rs/env_logger/0.1
In this command we set the `loglevel` to `INFO`.

</details>