Skip to content

Commit

Permalink
feat(docs): add docusaurus (#554)
Browse files Browse the repository at this point in the history
* Add docusaurus

* Add ci.png

---------

Co-authored-by: Alex Hutchison <[email protected]>
  • Loading branch information
dutchers and alex-syndica authored Feb 7, 2025
1 parent 94720a6 commit 431f105
Show file tree
Hide file tree
Showing 46 changed files with 31,389 additions and 143 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,23 @@
# desktop app config
.DS_Store
.vscode/

# Dependencies
docs/node_modules

# Production
docs/build

# Generated files
docs/.docusaurus
docs/.cache-loader

# Misc
docs/.env.local
docs/.env.development.local
docs/.env.test.local
docs/.env.production.local

docs/npm-debug.log*
docs/yarn-debug.log*
docs/yarn-error.log*
42 changes: 42 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
>>>>>>> d047aad (init docuasaurus project)
15 changes: 15 additions & 0 deletions docs/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"index_name": "docs_syndica",
"start_urls": ["https://docs.syndica.io"],
"selectors": {
"lvl0": {
"selector": "article h1"
},
"lvl1": "article h2",
"lvl2": "article h3",
"lvl3": "article h4",
"lvl4": "article h5",
"lvl5": "article h6, article td:first-child",
"text": "article p, article li, article td:last-child"
}
}
10 changes: 10 additions & 0 deletions docs/docs/contributing/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"position": 4,
"label": "Contributing",
"collapsible": true,
"collapsed": true,
"className": "red",
"customProps": {
"description": "How to contribute to this project"
}
}
8 changes: 6 additions & 2 deletions docs/benchmarks.md → docs/docs/contributing/benchmarks.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# benchmarks
---
sidebar_position: 8
title: Benchmarks
---
# Benchmarks

- run all benchmarks: `./zig-out/bin/benchmark`
- filter specific cases: `./zig-out/bin/benchmark accounts_db_readwrite`
Expand Down Expand Up @@ -45,7 +49,7 @@ python scripts/view_bench.py readWriteAccounts_runtimes.csv readWriteAccounts_ru
# benchmark2, 1, 2, 3, 4, 5
```

![example_benchmark_viz](imgs/bench_eg.png)
![example_benchmark_viz](/img/bench_eg.png)
- each point on y-axis=0 is a runtime
- the point on y-axis=1 is the mean with the bar surrounding it being the standard deviation

Expand Down
15 changes: 11 additions & 4 deletions docs/debugging.md → docs/docs/contributing/debugging.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# using vscode with sig unit tests
---
sidebar_position: 6
title: Debugging
---

move the two files in (`docs/files/`) to the `.vscode` folder in root:
# Debugging

## Using vscode with sig unit tests

move the two files in (`docs/files/`) to the `.vscode` folder in root:
- `launch.json`
- `tasks.json`
add breakpoints and everything should work as normal in vscode

# open file limits on macOS
## Open file limits on macOS

accounts-db opens many account files which requires admin changes to the machine - these are some resources to help:
accounts-db opens many account files which requires admin changes to the machine - these are some resources to help:
- https://superuser.com/questions/433746/is-there-a-fix-for-the-too-many-open-files-in-system-error-on-os-x-10-7-1/443168#443168
- https://gist.github.com/qileq/49fbeff99def200179001d551c0a7036

Expand Down
47 changes: 47 additions & 0 deletions docs/docs/contributing/dev-tools.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
sidebar_position: 5
title: Developer Tools
---

### Test

Run all tests.

```bash
zig build test
```

Include `--summary all` with any test command to see a summary of the test results.

Include a filter to limit which tests are run. Sig tests include their module name. For example, you can run all tests in `gossip.table` like this:

```bash
zig build test --summary all -- gossip.table
```

### Benchmark

Run all benchmarks.

```bash
zig build benchmark
```

Run a benchmark group: socket_utils, gossip, or sync.

```bash
zig build benchmark -- gossip
```

### Fuzzing

Fuzz the gossip protocol.

```bash
# in one terminal, start a gossip node
./zig-out/bin/sig gossip

# in another terminal, fuzz the gossip node
# zig build fuzz -- <entrypoint> <seed> <num_messages>
./zig-out/bin/fuzz 127.0.0.1:8001 19 50000
```
14 changes: 9 additions & 5 deletions docs/fuzzing.md → docs/docs/contributing/fuzzing.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
# fuzzing documentation
---
sidebar_position: 7
title: Fuzzing
---
# Fuzzing

supported components:
- gossip
- accountsdb

main code paths:
- `fuzz.zig` <- main entrypoint
- `fuzz.zig` &lt;- main entrypoint
- `gossip/fuzz_table.zig`
- `gossip/fuzz_service.zig`
- `accountsdb/fuzz.zig`
- `scripts/` <- kcov + fuzz bash scripts
- `scripts/` &lt;- kcov + fuzz bash scripts

kcov will give you coverage information on what was and was not fuzzed
- [https://github.com/SimonKagstrom/kcov](https://github.com/SimonKagstrom/kcov)

*note:* view the full script for helpful install instructions

![](imgs/2024-07-10-09-39-25.png)
![](/img/2024-07-10-09-39-25.png)

![](imgs/2024-07-10-09-39-57.png)
![](/img/2024-07-10-09-39-57.png)

## gossip

Expand Down
69 changes: 69 additions & 0 deletions docs/docs/contributing/getting-started.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
sidebar_position: 1
title: Getting Started
---

Thank you for considering contributing to Syndica's Sig project! We appreciate your interest and support in helping us make this project better. By participating in this project, you are joining a community of developers and contributors working together to create value for the Solana ecosystem.

## 📋 Setup

These tools are optional but recommended for a smooth development process.

- [Zig Language Server (ZLS) 0.11.0](https://github.com/zigtools/zls/wiki/Installation)
- [lldb](https://lldb.llvm.org/): [Zig CLI Debugging](https://devlog.hexops.com/2022/debugging-undefined-behavior/)
- [Zig Language](https://marketplace.visualstudio.com/items?itemName=ziglang.vscode-zig) VS Code extension
- [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb) VS Code extension

### Visual Studio Code

If you use VS Code, you should install the [Zig Language](https://marketplace.visualstudio.com/items?itemName=ziglang.vscode-zig) extension. It can use your installed versions of Zig and ZLS, or it can download and manage its own internal versions.

You can use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb) to debug Zig code with lldb in VS Code's debugging GUI. If you'd like to automatically build the project before running the debugger, you'll need a `zig build` task.

```json
{ ? // See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [{
"label": "zig build",
"type": "shell",
"command": "zig",
"args": ["build", "--summary", "all"],
"options": { "cwd": "${workspaceRoot}" },
"presentation": { "echo": true, "reveal": "always", "focus": false, "panel": "shared", "showReuseMessage": true, "clear": false },
"problemMatcher": [],
"group": { "kind": "build", "isDefault": true }
}]
}
```

To run the debugger, you need a run configuration. This launch.json includes an example for debugging gossip. Customize the args as desired.

```json
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug Gossip Mainnet",
"program": "${workspaceFolder}/zig-out/bin/sig",
"args": [
"gossip",
"--entrypoint",
"entrypoint.mainnet-beta.solana.com:8001",
"--entrypoint",
"entrypoint2.mainnet-beta.solana.com:8001",
"--entrypoint",
"entrypoint3.mainnet-beta.solana.com:8001",
"--entrypoint",
"entrypoint4.mainnet-beta.solana.com:8001",
"--entrypoint",
"entrypoint5.mainnet-beta.solana.com:8001"
],
"cwd": "${workspaceFolder}",
"preLaunchTask": "zig build"
}
]
}
```
9 changes: 9 additions & 0 deletions docs/docs/contributing/join-us.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
sidebar_position: 4
title: Join Us
---

If you are a talented engineer who thrives in a collaborative and fast-paced environment,
and you're excited about contributing to the advancement of Solana's ecosystem, we would love to hear from you.

See our current openings [here](https://jobs.ashbyhq.com/syndica).
14 changes: 14 additions & 0 deletions docs/docs/contributing/roadmap.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
sidebar_position: 2
title: Road Map
---

Since the validator is a large project, we broke it down into individual core components:

- `Gossip`: the entry point of the network where nodes discover other nodes, share metadata about what ports are open, etc.
- `AccountsDB`: an optimized database to represent the state of the blockchain at a specific slot, including the state of all the accounts.
- `Runtime` (Solana Virtual Machine): an execution environment that updates on-chain accounts by processing transactions with on-chain programs.
- `Consensus`: a consensus protocol (TowerBFT) that manages votes and forks to know the head of the chain.
- `RPC`: responsible for serving on-chain data to other clients using remote-procedure calls including account balances, transaction statuses, and more.
- `Proof-of-History`: a proof of the passage of time using a verifiable delay function at the heart of consensus.
- `Block Packing`: find the optimal transaction ordering to pack into a block based on specific read/write locks and priority fees
Loading

0 comments on commit 431f105

Please sign in to comment.